amber-cli.js 2.0 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310
  1. #!/usr/bin/env node
  2. (function(define, require){
  3. define('__wrap__', function (requirejs) {
  4. requirejs.resolve = require.resolve;
  5. require = requirejs;
  6. // This file is used to make additional changes
  7. // when building an app to run in node.js.
  8. // Free to edit. You can break tests (cli test runner uses
  9. // this to build itself - it is a node executable).
  10. define("amber/Platform", ["amber_core/Platform-Node"], {});
  11. define("amber/browser-compatibility", {});
  12. define("jquery", {});
  13. define("config-node", function(){});
  14. /* ====================================================================
  15. |
  16. | Amber Smalltalk
  17. | http://amber-lang.net
  18. |
  19. ======================================================================
  20. ======================================================================
  21. |
  22. | Copyright (c) 2010-2014
  23. | Nicolas Petton <petton.nicolas@gmail.com>
  24. |
  25. | Copyright (c) 2012-2014
  26. | The Amber team https://github.com/amber-smalltalk?tab=members
  27. | Amber contributors https://github.com/amber-smalltalk/amber/graphs/contributors
  28. |
  29. | Amber is released under the MIT license
  30. |
  31. | Permission is hereby granted, free of charge, to any person obtaining
  32. | a copy of this software and associated documentation files (the
  33. | 'Software'), to deal in the Software without restriction, including
  34. | without limitation the rights to use, copy, modify, merge, publish,
  35. | distribute, sublicense, and/or sell copies of the Software, and to
  36. | permit persons to whom the Software is furnished to do so, subject to
  37. | the following conditions:
  38. |
  39. | The above copyright notice and this permission notice shall be
  40. | included in all copies or substantial portions of the Software.
  41. |
  42. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  43. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  44. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  45. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  46. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  47. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  48. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  49. |
  50. ==================================================================== */
  51. //jshint eqnull:true
  52. define('amber/boot',['require', './browser-compatibility'], function (require) {
  53. /* Reconfigurable micro composition system, https://github.com/amber-smalltalk/brikz */
  54. function Brikz(api, apiKey, initKey) {
  55. var brikz = this, backup = {};
  56. apiKey = apiKey || 'exports';
  57. initKey = initKey || '__init__';
  58. function mixin(src, target, what) {
  59. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  60. if (src == null) {
  61. target[keys[i]] = undefined;
  62. } else {
  63. var value = src[keys[i]];
  64. if (typeof value !== "undefined") {
  65. target[keys[i]] = value;
  66. }
  67. }
  68. }
  69. return target;
  70. }
  71. var d = {value: null, enumerable: false, configurable: true, writable: true};
  72. Object.defineProperties(this, {ensure: d, rebuild: d});
  73. var exclude = mixin(this, {});
  74. this.rebuild = function () {
  75. Object.keys(backup).forEach(function (key) {
  76. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  77. });
  78. var oapi = mixin(api, {}), order = [], chk = {};
  79. brikz.ensure = function (key) {
  80. if (key in exclude) {
  81. return null;
  82. }
  83. var b = brikz[key], bak = backup[key];
  84. mixin(null, api, api);
  85. while (typeof b === "function") {
  86. b = new b(brikz, api, bak);
  87. }
  88. if (b && !chk[key]) {
  89. chk[key] = true;
  90. order.push(b);
  91. }
  92. if (b && !b[apiKey]) {
  93. b[apiKey] = mixin(api, {});
  94. }
  95. brikz[key] = b;
  96. return b;
  97. };
  98. Object.keys(brikz).forEach(function (key) {
  99. brikz.ensure(key);
  100. });
  101. brikz.ensure = null;
  102. mixin(oapi, mixin(null, api, api));
  103. order.forEach(function (brik) {
  104. mixin(brik[apiKey] || {}, api);
  105. });
  106. order.forEach(function (brik) {
  107. if (brik[initKey]) brik[initKey]();
  108. });
  109. backup = mixin(brikz, {});
  110. };
  111. }
  112. /* Brikz end */
  113. function inherits(child, parent) {
  114. child.prototype = Object.create(parent.prototype, {
  115. constructor: {
  116. value: child,
  117. enumerable: false, configurable: true, writable: true
  118. }
  119. });
  120. return child;
  121. }
  122. var globals = {};
  123. globals.SmalltalkSettings = {};
  124. var api = {};
  125. var brikz = new Brikz(api);
  126. function RootBrik(brikz, st) {
  127. /* Smalltalk foundational objects */
  128. /* SmalltalkRoot is the hidden root of the Amber hierarchy.
  129. All objects including `Object` inherit from SmalltalkRoot */
  130. function SmalltalkRoot() {
  131. }
  132. function SmalltalkProtoObject() {
  133. }
  134. inherits(SmalltalkProtoObject, SmalltalkRoot);
  135. function SmalltalkObject() {
  136. }
  137. inherits(SmalltalkObject, SmalltalkProtoObject);
  138. function SmalltalkNil() {
  139. }
  140. inherits(SmalltalkNil, SmalltalkObject);
  141. this.Object = SmalltalkObject;
  142. this.nil = new SmalltalkNil();
  143. // Adds an `isNil` property to the `nil` object. When sending
  144. // nil objects from one environment to another, doing
  145. // `anObject == nil` (in JavaScript) does not always answer
  146. // true as the referenced nil object might come from the other
  147. // environment.
  148. Object.defineProperty(this.nil, 'isNil', {
  149. value: true,
  150. enumerable: false, configurable: false, writable: false
  151. });
  152. // Hidden root class of the system.
  153. this.rootAsClass = {fn: SmalltalkRoot};
  154. this.__init__ = function () {
  155. st.addPackage("Kernel-Objects");
  156. st.wrapClassName("ProtoObject", "Kernel-Objects", SmalltalkProtoObject, undefined, false);
  157. st.wrapClassName("Object", "Kernel-Objects", SmalltalkObject, globals.ProtoObject, false);
  158. st.wrapClassName("UndefinedObject", "Kernel-Objects", SmalltalkNil, globals.Object, false);
  159. };
  160. }
  161. function OrganizeBrik(brikz, st) {
  162. brikz.ensure("augments");
  163. var SmalltalkObject = brikz.ensure("root").Object;
  164. function SmalltalkOrganizer() {
  165. }
  166. function SmalltalkPackageOrganizer() {
  167. this.elements = [];
  168. }
  169. function SmalltalkClassOrganizer() {
  170. this.elements = [];
  171. }
  172. inherits(SmalltalkOrganizer, SmalltalkObject);
  173. inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer);
  174. inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
  175. this.__init__ = function () {
  176. st.addPackage("Kernel-Infrastructure");
  177. st.wrapClassName("Organizer", "Kernel-Infrastructure", SmalltalkOrganizer, globals.Object, false);
  178. st.wrapClassName("PackageOrganizer", "Kernel-Infrastructure", SmalltalkPackageOrganizer, globals.Organizer, false);
  179. st.wrapClassName("ClassOrganizer", "Kernel-Infrastructure", SmalltalkClassOrganizer, globals.Organizer, false);
  180. };
  181. this.setupClassOrganization = function (klass) {
  182. klass.organization = new SmalltalkClassOrganizer();
  183. klass.organization.theClass = klass;
  184. };
  185. this.setupPackageOrganization = function (pkg) {
  186. pkg.organization = new SmalltalkPackageOrganizer();
  187. };
  188. this.addOrganizationElement = function (owner, element) {
  189. owner.organization.elements.addElement(element);
  190. };
  191. this.removeOrganizationElement = function (owner, element) {
  192. owner.organization.elements.removeElement(element);
  193. };
  194. }
  195. function DNUBrik(brikz, st) {
  196. brikz.ensure("selectorConversion");
  197. brikz.ensure("messageSend");
  198. var manip = brikz.ensure("manipulation");
  199. var rootAsClass = brikz.ensure("root").rootAsClass;
  200. /* Method not implemented handlers */
  201. var methods = [], methodDict = Object.create(null);
  202. this.selectors = [];
  203. this.jsSelectors = [];
  204. this.make = function (stSelector, targetClasses) {
  205. var method = methodDict[stSelector];
  206. if (method) return;
  207. var jsSelector = st.st2js(stSelector);
  208. this.selectors.push(stSelector);
  209. this.jsSelectors.push(jsSelector);
  210. method = {jsSelector: jsSelector, fn: createHandler(stSelector)};
  211. methodDict[stSelector] = method;
  212. methods.push(method);
  213. manip.installMethod(method, rootAsClass);
  214. targetClasses.forEach(function (target) {
  215. manip.installMethod(method, target);
  216. });
  217. return method;
  218. };
  219. /* Dnu handler method */
  220. function createHandler(stSelector) {
  221. return function () {
  222. return brikz.messageSend.messageNotUnderstood(this, stSelector, arguments);
  223. };
  224. }
  225. }
  226. function ClassInitBrik(brikz, st) {
  227. var dnu = brikz.ensure("dnu");
  228. var manip = brikz.ensure("manipulation");
  229. /* Initialize a class in its class hierarchy. Handle both classes and
  230. metaclasses. */
  231. st.init = function (klass) {
  232. initClass(klass);
  233. if (klass.klass && !klass.meta) {
  234. initClass(klass.klass);
  235. }
  236. };
  237. function initClass(klass) {
  238. if (klass.wrapped) {
  239. copySuperclass(klass);
  240. }
  241. }
  242. this.initClass = initClass;
  243. function copySuperclass(klass) {
  244. var superclass = klass.superclass,
  245. localMethods = klass.methods,
  246. localMethodsByJsSelector = {};
  247. Object.keys(localMethods).forEach(function (each) {
  248. var localMethod = localMethods[each];
  249. localMethodsByJsSelector[localMethod.jsSelector] = localMethod;
  250. });
  251. var myproto = klass.fn.prototype,
  252. superproto = superclass.fn.prototype;
  253. dnu.jsSelectors.forEach(function (selector) {
  254. if (!localMethodsByJsSelector[selector]) {
  255. manip.installMethod({
  256. jsSelector: selector,
  257. fn: superproto[selector]
  258. }, klass);
  259. } else if (!myproto[selector]) {
  260. manip.installMethod(localMethodsByJsSelector[selector], klass);
  261. }
  262. });
  263. }
  264. }
  265. function ManipulationBrik(brikz, st) {
  266. this.installMethod = function (method, klass) {
  267. Object.defineProperty(klass.fn.prototype, method.jsSelector, {
  268. value: method.fn,
  269. enumerable: false, configurable: true, writable: true
  270. });
  271. };
  272. }
  273. function PackagesBrik(brikz, st) {
  274. var org = brikz.ensure("organize");
  275. var root = brikz.ensure("root");
  276. var nil = root.nil;
  277. var SmalltalkObject = root.Object;
  278. function SmalltalkPackage() {
  279. }
  280. inherits(SmalltalkPackage, SmalltalkObject);
  281. this.__init__ = function () {
  282. st.addPackage("Kernel-Infrastructure");
  283. st.wrapClassName("Package", "Kernel-Infrastructure", SmalltalkPackage, globals.Object, false);
  284. };
  285. st.packages = {};
  286. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  287. function pkg(spec) {
  288. var that = new SmalltalkPackage();
  289. that.pkgName = spec.pkgName;
  290. org.setupPackageOrganization(that);
  291. that.properties = spec.properties || {};
  292. return that;
  293. }
  294. /* Add a package to the smalltalk.packages object, creating a new one if needed.
  295. If pkgName is null or empty we return nil, which is an allowed package for a class.
  296. If package already exists we still update the properties of it. */
  297. st.addPackage = function (pkgName, properties) {
  298. if (!pkgName) {
  299. return nil;
  300. }
  301. if (!(st.packages[pkgName])) {
  302. st.packages[pkgName] = pkg({
  303. pkgName: pkgName,
  304. properties: properties
  305. });
  306. } else {
  307. if (properties) {
  308. st.packages[pkgName].properties = properties;
  309. }
  310. }
  311. return st.packages[pkgName];
  312. };
  313. }
  314. function ClassesBrik(brikz, st) {
  315. var org = brikz.ensure("organize");
  316. var root = brikz.ensure("root");
  317. var classInit = brikz.ensure("classInit");
  318. var nil = root.nil;
  319. var rootAsClass = root.rootAsClass;
  320. var SmalltalkObject = root.Object;
  321. rootAsClass.klass = {fn: SmalltalkClass};
  322. function SmalltalkBehavior() {
  323. }
  324. function SmalltalkClass() {
  325. }
  326. function SmalltalkMetaclass() {
  327. }
  328. inherits(SmalltalkBehavior, SmalltalkObject);
  329. inherits(SmalltalkClass, SmalltalkBehavior);
  330. inherits(SmalltalkMetaclass, SmalltalkBehavior);
  331. SmalltalkMetaclass.prototype.meta = true;
  332. this.__init__ = function () {
  333. st.addPackage("Kernel-Classes");
  334. st.wrapClassName("Behavior", "Kernel-Classes", SmalltalkBehavior, globals.Object, false);
  335. st.wrapClassName("Metaclass", "Kernel-Classes", SmalltalkMetaclass, globals.Behavior, false);
  336. st.wrapClassName("Class", "Kernel-Classes", SmalltalkClass, globals.Behavior, false);
  337. // Manually bootstrap the metaclass hierarchy
  338. globals.ProtoObject.klass.superclass = rootAsClass.klass = globals.Class;
  339. addSubclass(globals.ProtoObject.klass);
  340. };
  341. /* Smalltalk classes */
  342. var classes = [];
  343. var wrappedClasses = [];
  344. /* Smalltalk class creation. A class is an instance of an automatically
  345. created metaclass object. Newly created classes (not their metaclass)
  346. should be added to the smalltalk object, see smalltalk.addClass().
  347. Superclass linking is *not* handled here, see smalltalk.init() */
  348. function klass(spec) {
  349. spec = spec || {};
  350. var setSuperClass = spec.superclass;
  351. if (!spec.superclass) {
  352. spec.superclass = rootAsClass;
  353. }
  354. var meta = metaclass(spec);
  355. var that = meta.instanceClass;
  356. that.superclass = setSuperClass;
  357. that.fn = spec.fn || inherits(function () {
  358. }, spec.superclass.fn);
  359. that.subclasses = [];
  360. setupClass(that, spec);
  361. that.className = spec.className;
  362. that.wrapped = spec.wrapped || false;
  363. meta.className = spec.className + ' class';
  364. meta.superclass = spec.superclass.klass;
  365. return that;
  366. }
  367. function metaclass(spec) {
  368. spec = spec || {};
  369. var that = new SmalltalkMetaclass();
  370. that.fn = inherits(function () {
  371. }, spec.superclass.klass.fn);
  372. that.instanceClass = new that.fn();
  373. setupClass(that);
  374. return that;
  375. }
  376. SmalltalkBehavior.prototype.toString = function () {
  377. return 'Smalltalk ' + this.className;
  378. };
  379. function wireKlass(klass) {
  380. Object.defineProperty(klass.fn.prototype, "klass", {
  381. value: klass,
  382. enumerable: false, configurable: true, writable: true
  383. });
  384. }
  385. function setupClass(klass, spec) {
  386. spec = spec || {};
  387. klass.iVarNames = spec.iVarNames || [];
  388. klass.pkg = spec.pkg;
  389. org.setupClassOrganization(klass);
  390. Object.defineProperty(klass, "methods", {
  391. value: Object.create(null),
  392. enumerable: false, configurable: true, writable: true
  393. });
  394. wireKlass(klass);
  395. }
  396. /* Add a class to the smalltalk object, creating a new one if needed.
  397. A Package is lazily created if it does not exist with given name. */
  398. st.addClass = function (className, superclass, iVarNames, pkgName) {
  399. // While subclassing nil is allowed, it might be an error, so
  400. // warn about it.
  401. if (typeof superclass == 'undefined' || superclass == nil) {
  402. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  403. }
  404. rawAddClass(pkgName, className, superclass, iVarNames, false, null);
  405. };
  406. function rawAddClass(pkgName, className, superclass, iVarNames, wrapped, fn) {
  407. var pkg = st.packages[pkgName];
  408. if (!pkg) {
  409. throw new Error("Missing package " + pkgName);
  410. }
  411. if (!superclass || superclass == nil) {
  412. superclass = null;
  413. }
  414. if (globals[className] && globals[className].superclass == superclass) {
  415. // globals[className].superclass = superclass;
  416. globals[className].iVarNames = iVarNames || [];
  417. if (pkg) globals[className].pkg = pkg;
  418. if (fn) {
  419. fn.prototype = globals[className].fn.prototype;
  420. globals[className].fn = fn;
  421. fn.prototype.constructor = fn;
  422. }
  423. } else {
  424. if (globals[className]) {
  425. st.removeClass(globals[className]);
  426. }
  427. globals[className] = klass({
  428. className: className,
  429. superclass: superclass,
  430. pkg: pkg,
  431. iVarNames: iVarNames,
  432. fn: fn,
  433. wrapped: wrapped
  434. });
  435. addSubclass(globals[className]);
  436. }
  437. classes.addElement(globals[className]);
  438. org.addOrganizationElement(pkg, globals[className]);
  439. }
  440. st.removeClass = function (klass) {
  441. org.removeOrganizationElement(klass.pkg, klass);
  442. classes.removeElement(klass);
  443. removeSubclass(klass);
  444. delete globals[klass.className];
  445. };
  446. function addSubclass(klass) {
  447. if (klass.superclass) {
  448. klass.superclass.subclasses.addElement(klass);
  449. }
  450. }
  451. function removeSubclass(klass) {
  452. if (klass.superclass) {
  453. klass.superclass.subclasses.removeElement(klass);
  454. }
  455. }
  456. /* Create a new class wrapping a JavaScript constructor, and add it to the
  457. global smalltalk object. Package is lazily created if it does not exist with given name. */
  458. st.wrapClassName = function (className, pkgName, fn, superclass, wrapped) {
  459. wrapped = wrapped !== false;
  460. rawAddClass(pkgName, className, superclass, globals[className] && globals[className].iVarNames, wrapped, fn);
  461. if (wrapped) {
  462. wrappedClasses.addElement(globals[className]);
  463. }
  464. };
  465. /* Manually set the constructor of an existing Smalltalk klass, making it a wrapped class. */
  466. st.setClassConstructor = function (klass, constructor) {
  467. wrappedClasses.addElement(klass);
  468. klass.wrapped = true;
  469. klass.fn = constructor;
  470. // The fn property changed. We need to add back the klass property to the prototype
  471. wireKlass(klass);
  472. classInit.initClass(klass);
  473. };
  474. /* Create an alias for an existing class */
  475. st.alias = function (klass, alias) {
  476. globals[alias] = klass;
  477. };
  478. /* Answer all registered Smalltalk classes */
  479. //TODO: remove the function and make smalltalk.classes an array
  480. st.classes = function () {
  481. return classes;
  482. };
  483. st.wrappedClasses = function () {
  484. return wrappedClasses;
  485. };
  486. // Still used, but could go away now that subclasses are stored
  487. // into classes directly.
  488. st.allSubclasses = function (klass) {
  489. return klass._allSubclasses();
  490. };
  491. }
  492. function MethodsBrik(brikz, st) {
  493. var manip = brikz.ensure("manipulation");
  494. var org = brikz.ensure("organize");
  495. var stInit = brikz.ensure("stInit");
  496. var dnu = brikz.ensure("dnu");
  497. var SmalltalkObject = brikz.ensure("root").Object;
  498. brikz.ensure("selectorConversion");
  499. brikz.ensure("classes");
  500. function SmalltalkMethod() {
  501. }
  502. inherits(SmalltalkMethod, SmalltalkObject);
  503. this.__init__ = function () {
  504. st.addPackage("Kernel-Methods");
  505. st.wrapClassName("CompiledMethod", "Kernel-Methods", SmalltalkMethod, globals.Object, false);
  506. };
  507. /* Smalltalk method object. To add a method to a class,
  508. use smalltalk.addMethod() */
  509. st.method = function (spec) {
  510. var that = new SmalltalkMethod();
  511. that.selector = spec.selector;
  512. that.jsSelector = spec.jsSelector;
  513. that.args = spec.args || {};
  514. that.protocol = spec.protocol;
  515. that.source = spec.source;
  516. that.messageSends = spec.messageSends || [];
  517. that.referencedClasses = spec.referencedClasses || [];
  518. that.fn = spec.fn;
  519. return that;
  520. };
  521. function ensureJsSelector(method) {
  522. if (!(method.jsSelector)) {
  523. method.jsSelector = st.st2js(method.selector);
  524. }
  525. }
  526. /* Add/remove a method to/from a class */
  527. st.addMethod = function (method, klass) {
  528. ensureJsSelector(method);
  529. manip.installMethod(method, klass);
  530. klass.methods[method.selector] = method;
  531. method.methodClass = klass;
  532. // During the bootstrap, #addCompiledMethod is not used.
  533. // Therefore we populate the organizer here too
  534. org.addOrganizationElement(klass, method.protocol);
  535. propagateMethodChange(klass, method);
  536. var usedSelectors = method.messageSends,
  537. targetClasses = stInit.initialized() ? st.wrappedClasses() : [];
  538. dnu.make(method.selector, targetClasses);
  539. for (var i = 0; i < usedSelectors.length; i++) {
  540. dnu.make(usedSelectors[i], targetClasses);
  541. }
  542. };
  543. function propagateMethodChange(klass, method) {
  544. // If already initialized (else it will be done later anyway),
  545. // re-initialize all subclasses to ensure the method change
  546. // propagation (for wrapped classes, not using the prototype
  547. // chain).
  548. if (stInit.initialized()) {
  549. st.allSubclasses(klass).forEach(function (subclass) {
  550. initMethodInClass(subclass, method);
  551. });
  552. }
  553. }
  554. function initMethodInClass(klass, method) {
  555. if (klass.wrapped && !klass.methods[method.selector]) {
  556. var jsSelector = method.jsSelector;
  557. manip.installMethod({
  558. jsSelector: jsSelector,
  559. fn: klass.superclass.fn.prototype[jsSelector]
  560. }, klass);
  561. }
  562. }
  563. st.removeMethod = function (method, klass) {
  564. if (klass !== method.methodClass) {
  565. throw new Error(
  566. "Refusing to remove method " +
  567. method.methodClass.className + ">>" + method.selector +
  568. " from different class " +
  569. klass.className);
  570. }
  571. ensureJsSelector(method);
  572. delete klass.fn.prototype[method.jsSelector];
  573. delete klass.methods[method.selector];
  574. initMethodInClass(klass, method);
  575. propagateMethodChange(klass, method);
  576. // Do *not* delete protocols from here.
  577. // This is handled by #removeCompiledMethod
  578. };
  579. /* Answer all method selectors based on dnu handlers */
  580. st.allSelectors = function () {
  581. return dnu.selectors;
  582. };
  583. }
  584. function AugmentsBrik(brikz, st) {
  585. /* Array extensions */
  586. Array.prototype.addElement = function (el) {
  587. if (typeof el === 'undefined') {
  588. return;
  589. }
  590. if (this.indexOf(el) == -1) {
  591. this.push(el);
  592. }
  593. };
  594. Array.prototype.removeElement = function (el) {
  595. var i = this.indexOf(el);
  596. if (i !== -1) {
  597. this.splice(i, 1);
  598. }
  599. };
  600. }
  601. function SmalltalkInitBrik(brikz, st) {
  602. brikz.ensure("classInit");
  603. brikz.ensure("classes");
  604. var initialized = false;
  605. /* Smalltalk initialization. Called on page load */
  606. st.initialize = function () {
  607. if (initialized) {
  608. return;
  609. }
  610. st.classes().forEach(function (klass) {
  611. st.init(klass);
  612. });
  613. runnable();
  614. st.classes().forEach(function (klass) {
  615. klass._initialize();
  616. });
  617. initialized = true;
  618. };
  619. this.initialized = function () {
  620. return initialized;
  621. };
  622. this.__init__ = function () {
  623. st.addPackage("Kernel-Methods");
  624. st.wrapClassName("Number", "Kernel-Objects", Number, globals.Object);
  625. st.wrapClassName("BlockClosure", "Kernel-Methods", Function, globals.Object);
  626. st.wrapClassName("Boolean", "Kernel-Objects", Boolean, globals.Object);
  627. st.wrapClassName("Date", "Kernel-Objects", Date, globals.Object);
  628. st.addPackage("Kernel-Collections");
  629. st.addClass("Collection", globals.Object, null, "Kernel-Collections");
  630. st.addClass("IndexableCollection", globals.Collection, null, "Kernel-Collections");
  631. st.addClass("SequenceableCollection", globals.IndexableCollection, null, "Kernel-Collections");
  632. st.addClass("CharacterArray", globals.SequenceableCollection, null, "Kernel-Collections");
  633. st.wrapClassName("String", "Kernel-Collections", String, globals.CharacterArray);
  634. st.wrapClassName("Array", "Kernel-Collections", Array, globals.SequenceableCollection);
  635. st.wrapClassName("RegularExpression", "Kernel-Collections", RegExp, globals.Object);
  636. st.addPackage("Kernel-Exceptions");
  637. st.wrapClassName("Error", "Kernel-Exceptions", Error, globals.Object);
  638. /* Alias definitions */
  639. st.alias(globals.Array, "OrderedCollection");
  640. st.alias(globals.Date, "Time");
  641. };
  642. }
  643. function PrimitivesBrik(brikz, st) {
  644. /* Unique ID number generator */
  645. var oid = 0;
  646. st.nextId = function () {
  647. oid += 1;
  648. return oid;
  649. };
  650. /* Converts a JavaScript object to valid Smalltalk Object */
  651. st.readJSObject = function (js) {
  652. if (js == null)
  653. return null;
  654. var readObject = js.constructor === Object;
  655. var readArray = js.constructor === Array;
  656. var object = readObject ? globals.Dictionary._new() : readArray ? [] : js;
  657. for (var i in js) {
  658. if (readObject) {
  659. object._at_put_(i, st.readJSObject(js[i]));
  660. }
  661. if (readArray) {
  662. object[i] = st.readJSObject(js[i]);
  663. }
  664. }
  665. return object;
  666. };
  667. /* Boolean assertion */
  668. st.assert = function (shouldBeBoolean) {
  669. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  670. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  671. shouldBeBoolean = shouldBeBoolean.valueOf();
  672. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  673. }
  674. globals.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  675. };
  676. /* List of all reserved words in JavaScript. They may not be used as variables
  677. in Smalltalk. */
  678. // list of reserved JavaScript keywords as of
  679. // http://es5.github.com/#x7.6.1.1
  680. // and
  681. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
  682. st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
  683. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  684. 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
  685. 'try', 'typeof', 'var', 'void', 'while', 'with',
  686. // Amber protected words: these should not be compiled as-is when in code
  687. 'arguments',
  688. // ES5: future use: http://es5.github.com/#x7.6.1.2
  689. 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
  690. // ES5: future use in strict mode
  691. 'implements', 'interface', 'let', 'package', 'private', 'protected',
  692. 'public', 'static', 'yield'];
  693. st.globalJsVariables = ['window', 'document', 'process', 'global'];
  694. }
  695. function RuntimeBrik(brikz, st) {
  696. brikz.ensure("selectorConversion");
  697. var root = brikz.ensure("root");
  698. var nil = root.nil;
  699. var SmalltalkObject = root.Object;
  700. function SmalltalkMethodContext(home, setup) {
  701. this.sendIdx = {};
  702. this.homeContext = home;
  703. this.setup = setup || function () {
  704. };
  705. this.supercall = false;
  706. }
  707. inherits(SmalltalkMethodContext, SmalltalkObject);
  708. this.__init__ = function () {
  709. st.addPackage("Kernel-Methods");
  710. st.wrapClassName("MethodContext", "Kernel-Methods", SmalltalkMethodContext, globals.Object, false);
  711. // Fallbacks
  712. SmalltalkMethodContext.prototype.locals = {};
  713. SmalltalkMethodContext.prototype.receiver = null;
  714. SmalltalkMethodContext.prototype.selector = null;
  715. SmalltalkMethodContext.prototype.lookupClass = null;
  716. SmalltalkMethodContext.prototype.fill = function (receiver, selector, locals, lookupClass) {
  717. this.receiver = receiver;
  718. this.selector = selector;
  719. this.locals = locals || {};
  720. this.lookupClass = lookupClass;
  721. if (this.homeContext) {
  722. this.homeContext.evaluatedSelector = selector;
  723. }
  724. };
  725. SmalltalkMethodContext.prototype.fillBlock = function (locals, ctx, index) {
  726. this.locals = locals || {};
  727. this.outerContext = ctx;
  728. this.index = index || 0;
  729. };
  730. SmalltalkMethodContext.prototype.init = function () {
  731. var home = this.homeContext;
  732. if (home) {
  733. home.init();
  734. }
  735. this.setup(this);
  736. };
  737. SmalltalkMethodContext.prototype.method = function () {
  738. var method;
  739. var lookup = this.lookupClass || this.receiver.klass;
  740. while (!method && lookup) {
  741. method = lookup.methods[st.js2st(this.selector)];
  742. lookup = lookup.superclass;
  743. }
  744. return method;
  745. };
  746. };
  747. /* This is the current call context object. While it is publicly available,
  748. Use smalltalk.getThisContext() instead which will answer a safe copy of
  749. the current context */
  750. var thisContext = null;
  751. st.withContext = function (worker, setup) {
  752. if (thisContext) {
  753. return inContext(worker, setup);
  754. } else {
  755. return inContextWithErrorHandling(worker, setup);
  756. }
  757. };
  758. function inContextWithErrorHandling(worker, setup) {
  759. try {
  760. return inContext(worker, setup);
  761. } catch (error) {
  762. handleError(error);
  763. thisContext = null;
  764. // Rethrow the error in any case.
  765. error.amberHandled = true;
  766. throw error;
  767. }
  768. }
  769. function inContext(worker, setup) {
  770. var oldContext = thisContext;
  771. thisContext = new SmalltalkMethodContext(thisContext, setup);
  772. var result = worker(thisContext);
  773. thisContext = oldContext;
  774. return result;
  775. }
  776. /* Wrap a JavaScript exception in a Smalltalk Exception.
  777. In case of a RangeError, stub the stack after 100 contexts to
  778. avoid another RangeError later when the stack is manipulated. */
  779. function wrappedError(error) {
  780. var errorWrapper = globals.JavaScriptException._on_(error);
  781. // Add the error to the context, so it is visible in the stack
  782. try {
  783. errorWrapper._signal();
  784. } catch (ex) {
  785. }
  786. var context = st.getThisContext();
  787. if (isRangeError(error)) {
  788. stubContextStack(context);
  789. }
  790. errorWrapper._context_(context);
  791. return errorWrapper;
  792. }
  793. /* Stub the context stack after 100 contexts */
  794. function stubContextStack(context) {
  795. var currentContext = context;
  796. var contexts = 0;
  797. while (contexts < 100) {
  798. if (currentContext) {
  799. currentContext = currentContext.homeContext;
  800. }
  801. contexts++;
  802. }
  803. if (currentContext) {
  804. currentContext.homeContext = undefined;
  805. }
  806. }
  807. function isRangeError(error) {
  808. return error instanceof RangeError;
  809. }
  810. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  811. (See the Smalltalk class ErrorHandler and its subclasses */
  812. function handleError(error) {
  813. if (!error.smalltalkError) {
  814. error = wrappedError(error);
  815. }
  816. globals.ErrorHandler._handleError_(error);
  817. }
  818. /* Handle thisContext pseudo variable */
  819. st.getThisContext = function () {
  820. if (thisContext) {
  821. thisContext.init();
  822. return thisContext;
  823. } else {
  824. return nil;
  825. }
  826. };
  827. }
  828. function MessageSendBrik(brikz, st) {
  829. brikz.ensure("selectorConversion");
  830. var nil = brikz.ensure("root").nil;
  831. /* Handles unhandled errors during message sends */
  832. // simply send the message and handle #dnu:
  833. st.send = function (receiver, jsSelector, args, klass) {
  834. var method;
  835. if (receiver == null) {
  836. receiver = nil;
  837. }
  838. method = klass ? klass.fn.prototype[jsSelector] : receiver.klass && receiver[jsSelector];
  839. if (method) {
  840. return method.apply(receiver, args || []);
  841. } else {
  842. return messageNotUnderstood(receiver, st.js2st(jsSelector), args);
  843. }
  844. };
  845. function invokeDnuMethod(receiver, stSelector, args) {
  846. return receiver._doesNotUnderstand_(
  847. globals.Message._new()
  848. ._selector_(stSelector)
  849. ._arguments_([].slice.call(args))
  850. );
  851. }
  852. /* Handles #dnu: *and* JavaScript method calls.
  853. if the receiver has no klass, we consider it a JS object (outside of the
  854. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  855. function messageNotUnderstood(receiver, stSelector, args) {
  856. if (receiver.klass != null && !receiver.allowJavaScriptCalls) {
  857. return invokeDnuMethod(receiver, stSelector, args);
  858. }
  859. /* Call a method of a JS object, or answer a property if it exists.
  860. Else try wrapping a JSObjectProxy around the receiver. */
  861. var propertyName = st.st2prop(stSelector);
  862. if (!(propertyName in receiver)) {
  863. return invokeDnuMethod(globals.JSObjectProxy._on_(receiver), stSelector, args);
  864. }
  865. return accessJavaScript(receiver, propertyName, args);
  866. }
  867. /* If the object property is a function, then call it, except if it starts with
  868. an uppercase character (we probably want to answer the function itself in this
  869. case and send it #new from Amber).
  870. Converts keyword-based selectors by using the first
  871. keyword only, but keeping all message arguments.
  872. Example:
  873. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */
  874. function accessJavaScript(receiver, propertyName, args) {
  875. var propertyValue = receiver[propertyName];
  876. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  877. return propertyValue.apply(receiver, args || []);
  878. } else if (args.length > 0) {
  879. receiver[propertyName] = args[0];
  880. return nil;
  881. } else {
  882. return propertyValue;
  883. }
  884. }
  885. st.accessJavaScript = accessJavaScript;
  886. this.messageNotUnderstood = messageNotUnderstood;
  887. }
  888. function SelectorConversionBrik(brikz, st) {
  889. /* Convert a Smalltalk selector into a JS selector */
  890. st.st2js = function (string) {
  891. var selector = '_' + string;
  892. selector = selector.replace(/:/g, '_');
  893. selector = selector.replace(/[\&]/g, '_and');
  894. selector = selector.replace(/[\|]/g, '_or');
  895. selector = selector.replace(/[+]/g, '_plus');
  896. selector = selector.replace(/-/g, '_minus');
  897. selector = selector.replace(/[*]/g, '_star');
  898. selector = selector.replace(/[\/]/g, '_slash');
  899. selector = selector.replace(/[\\]/g, '_backslash');
  900. selector = selector.replace(/[\~]/g, '_tild');
  901. selector = selector.replace(/>/g, '_gt');
  902. selector = selector.replace(/</g, '_lt');
  903. selector = selector.replace(/=/g, '_eq');
  904. selector = selector.replace(/,/g, '_comma');
  905. selector = selector.replace(/[@]/g, '_at');
  906. return selector;
  907. };
  908. /* Convert a string to a valid smalltalk selector.
  909. if you modify the following functions, also change st2js
  910. accordingly */
  911. st.js2st = function (selector) {
  912. if (selector.match(/^__/)) {
  913. return binaryJsToSt(selector);
  914. } else {
  915. return keywordJsToSt(selector);
  916. }
  917. };
  918. function keywordJsToSt(selector) {
  919. return selector.replace(/^_/, '').replace(/_/g, ':');
  920. }
  921. function binaryJsToSt(selector) {
  922. return selector
  923. .replace(/^_/, '')
  924. .replace(/_and/g, '&')
  925. .replace(/_or/g, '|')
  926. .replace(/_plus/g, '+')
  927. .replace(/_minus/g, '-')
  928. .replace(/_star/g, '*')
  929. .replace(/_slash/g, '/')
  930. .replace(/_backslash/g, '\\')
  931. .replace(/_tild/g, '~')
  932. .replace(/_gt/g, '>')
  933. .replace(/_lt/g, '<')
  934. .replace(/_eq/g, '=')
  935. .replace(/_comma/g, ',')
  936. .replace(/_at/g, '@');
  937. }
  938. st.st2prop = function (stSelector) {
  939. var colonPosition = stSelector.indexOf(':');
  940. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  941. };
  942. }
  943. /* Adds AMD and requirejs related methods to the smalltalk object */
  944. function AMDBrik(brikz, st) {
  945. this.__init__ = function () {
  946. st.amdRequire = require;
  947. st.defaultTransportType = st.defaultTransportType || "amd";
  948. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  949. };
  950. }
  951. /* Defines asReceiver to be present at load time */
  952. /* (logically it belongs more to PrimitiveBrik) */
  953. function AsReceiverBrik(brikz, st) {
  954. var nil = brikz.ensure("root").nil;
  955. /**
  956. * This function is used all over the compiled amber code.
  957. * It takes any value (JavaScript or Smalltalk)
  958. * and returns a proper Amber Smalltalk receiver.
  959. *
  960. * null or undefined -> nil,
  961. * plain JS object -> wrapped JS object,
  962. * otherwise unchanged
  963. */
  964. this.asReceiver = function (o) {
  965. if (o == null) return nil;
  966. if (typeof o === "object" || typeof o === "function") {
  967. return o.klass != null ? o : globals.JSObjectProxy._on_(o);
  968. }
  969. // IMPORTANT: This optimization (return o if typeof !== "object")
  970. // assumes all primitive types are wrapped by some Smalltalk class
  971. // so they can be returned as-is, without boxing and looking for .klass.
  972. // KEEP THE primitives-are-wrapped INVARIANT!
  973. return o;
  974. };
  975. }
  976. /* Making smalltalk that can load */
  977. brikz.root = RootBrik;
  978. brikz.dnu = DNUBrik;
  979. brikz.organize = OrganizeBrik;
  980. brikz.selectorConversion = SelectorConversionBrik;
  981. brikz.classInit = ClassInitBrik;
  982. brikz.manipulation = ManipulationBrik;
  983. brikz.packages = PackagesBrik;
  984. brikz.classes = ClassesBrik;
  985. brikz.methods = MethodsBrik;
  986. brikz.stInit = SmalltalkInitBrik;
  987. brikz.augments = AugmentsBrik;
  988. brikz.asReceiver = AsReceiverBrik;
  989. brikz.amd = AMDBrik;
  990. brikz.rebuild();
  991. /* Making smalltalk that can run */
  992. function runnable() {
  993. brikz.messageSend = MessageSendBrik;
  994. brikz.runtime = RuntimeBrik;
  995. brikz.primitives = PrimitivesBrik;
  996. brikz.rebuild();
  997. }
  998. return {
  999. api: api,
  1000. nil: brikz.root.nil,
  1001. dnu: brikz.root.rootAsClass,
  1002. globals: globals,
  1003. asReceiver: brikz.asReceiver.asReceiver
  1004. };
  1005. });
  1006. define('amber/helpers',["amber/boot", "require"], function (boot, require) {
  1007. var globals = boot.globals,
  1008. exports = {},
  1009. api = boot.api,
  1010. nil = boot.nil;
  1011. // API
  1012. exports.popupHelios = function () {
  1013. require(['helios/index'], function (helios) {
  1014. helios.popup();
  1015. }, function (err) {
  1016. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  1017. });
  1018. };
  1019. Object.defineProperty(exports, "api", {
  1020. value: api,
  1021. enumerable: true, configurable: true, writable: false
  1022. });
  1023. Object.defineProperty(exports, "globals", {
  1024. value: globals,
  1025. enumerable: true, configurable: true, writable: false
  1026. });
  1027. Object.defineProperty(exports, "nil", {
  1028. value: nil,
  1029. enumerable: true, configurable: true, writable: false
  1030. });
  1031. function mixinToSettings(source) {
  1032. var settings = globals.SmalltalkSettings;
  1033. Object.keys(source).forEach(function (key) {
  1034. settings[key] = source[key];
  1035. });
  1036. }
  1037. function settingsInLocalStorage() {
  1038. //jshint evil:true
  1039. var global = new Function('return this')(),
  1040. storage = 'localStorage' in global && global.localStorage;
  1041. if (storage) {
  1042. var fromStorage;
  1043. try {
  1044. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  1045. } catch (ex) {
  1046. // pass
  1047. }
  1048. mixinToSettings(fromStorage || {});
  1049. if (typeof window !== "undefined") {
  1050. requirejs(['jquery'], function ($) {
  1051. $(window).on('beforeunload', function () {
  1052. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  1053. });
  1054. });
  1055. }
  1056. }
  1057. }
  1058. exports.initialize = function (options) {
  1059. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  1060. settingsInLocalStorage();
  1061. mixinToSettings(options || {});
  1062. return api.initialize();
  1063. };
  1064. // Exports
  1065. return exports;
  1066. });
  1067. define("amber_core/Kernel-Objects", ["amber/boot"], function($boot){"use strict";
  1068. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  1069. $core.addPackage('Kernel-Objects');
  1070. $core.packages["Kernel-Objects"].innerEval = function (expr) { return eval(expr); };
  1071. $core.packages["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  1072. $core.addClass('ProtoObject', null, [], 'Kernel-Objects');
  1073. $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.";
  1074. $core.addMethod(
  1075. $core.method({
  1076. selector: "=",
  1077. protocol: 'comparing',
  1078. fn: function (anObject){
  1079. var self=this;
  1080. return $core.withContext(function($ctx1) {
  1081. return self.__eq_eq(anObject);
  1082. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  1083. },
  1084. args: ["anObject"],
  1085. source: "= anObject\x0a\x09^ self == anObject",
  1086. referencedClasses: [],
  1087. messageSends: ["=="]
  1088. }),
  1089. $globals.ProtoObject);
  1090. $core.addMethod(
  1091. $core.method({
  1092. selector: "==",
  1093. protocol: 'comparing',
  1094. fn: function (anObject){
  1095. var self=this;
  1096. return $core.withContext(function($ctx1) {
  1097. return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject);
  1098. return self;
  1099. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  1100. },
  1101. args: ["anObject"],
  1102. source: "== anObject\x0a<return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject)>",
  1103. referencedClasses: [],
  1104. messageSends: []
  1105. }),
  1106. $globals.ProtoObject);
  1107. $core.addMethod(
  1108. $core.method({
  1109. selector: "asString",
  1110. protocol: 'converting',
  1111. fn: function (){
  1112. var self=this;
  1113. return $core.withContext(function($ctx1) {
  1114. return self._printString();
  1115. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  1116. },
  1117. args: [],
  1118. source: "asString\x0a\x09^ self printString",
  1119. referencedClasses: [],
  1120. messageSends: ["printString"]
  1121. }),
  1122. $globals.ProtoObject);
  1123. $core.addMethod(
  1124. $core.method({
  1125. selector: "class",
  1126. protocol: 'accessing',
  1127. fn: function (){
  1128. var self=this;
  1129. return $core.withContext(function($ctx1) {
  1130. return self.klass;
  1131. return self;
  1132. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  1133. },
  1134. args: [],
  1135. source: "class\x0a\x09<return self.klass>",
  1136. referencedClasses: [],
  1137. messageSends: []
  1138. }),
  1139. $globals.ProtoObject);
  1140. $core.addMethod(
  1141. $core.method({
  1142. selector: "doesNotUnderstand:",
  1143. protocol: 'error handling',
  1144. fn: function (aMessage){
  1145. var self=this;
  1146. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  1147. return $core.withContext(function($ctx1) {
  1148. var $1;
  1149. $1=$recv($MessageNotUnderstood())._new();
  1150. $recv($1)._receiver_(self);
  1151. $recv($1)._message_(aMessage);
  1152. $recv($1)._signal();
  1153. return self;
  1154. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  1155. },
  1156. args: ["aMessage"],
  1157. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  1158. referencedClasses: ["MessageNotUnderstood"],
  1159. messageSends: ["receiver:", "new", "message:", "signal"]
  1160. }),
  1161. $globals.ProtoObject);
  1162. $core.addMethod(
  1163. $core.method({
  1164. selector: "evaluate:on:",
  1165. protocol: 'evaluating',
  1166. fn: function (aString,anEvaluator){
  1167. var self=this;
  1168. return $core.withContext(function($ctx1) {
  1169. return $recv(anEvaluator)._evaluate_receiver_(aString,self);
  1170. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  1171. },
  1172. args: ["aString", "anEvaluator"],
  1173. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  1174. referencedClasses: [],
  1175. messageSends: ["evaluate:receiver:"]
  1176. }),
  1177. $globals.ProtoObject);
  1178. $core.addMethod(
  1179. $core.method({
  1180. selector: "identityHash",
  1181. protocol: 'accessing',
  1182. fn: function (){
  1183. var self=this;
  1184. return $core.withContext(function($ctx1) {
  1185. var hash=self.identityHash;
  1186. if (hash) return hash;
  1187. hash=$core.nextId();
  1188. Object.defineProperty(self, 'identityHash', {value:hash});
  1189. return hash;
  1190. ;
  1191. return self;
  1192. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  1193. },
  1194. args: [],
  1195. source: "identityHash\x0a\x09<\x0a\x09\x09var hash=self.identityHash;\x0a\x09\x09if (hash) return hash;\x0a\x09\x09hash=$core.nextId();\x0a\x09\x09Object.defineProperty(self, 'identityHash', {value:hash});\x0a\x09\x09return hash;\x0a\x09>",
  1196. referencedClasses: [],
  1197. messageSends: []
  1198. }),
  1199. $globals.ProtoObject);
  1200. $core.addMethod(
  1201. $core.method({
  1202. selector: "ifNil:",
  1203. protocol: 'testing',
  1204. fn: function (aBlock){
  1205. var self=this;
  1206. return self;
  1207. },
  1208. args: ["aBlock"],
  1209. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  1210. referencedClasses: [],
  1211. messageSends: []
  1212. }),
  1213. $globals.ProtoObject);
  1214. $core.addMethod(
  1215. $core.method({
  1216. selector: "ifNil:ifNotNil:",
  1217. protocol: 'testing',
  1218. fn: function (aBlock,anotherBlock){
  1219. var self=this;
  1220. return $core.withContext(function($ctx1) {
  1221. return $recv(anotherBlock)._value_(self);
  1222. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  1223. },
  1224. args: ["aBlock", "anotherBlock"],
  1225. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  1226. referencedClasses: [],
  1227. messageSends: ["value:"]
  1228. }),
  1229. $globals.ProtoObject);
  1230. $core.addMethod(
  1231. $core.method({
  1232. selector: "ifNotNil:",
  1233. protocol: 'testing',
  1234. fn: function (aBlock){
  1235. var self=this;
  1236. return $core.withContext(function($ctx1) {
  1237. return $recv(aBlock)._value_(self);
  1238. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  1239. },
  1240. args: ["aBlock"],
  1241. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  1242. referencedClasses: [],
  1243. messageSends: ["value:"]
  1244. }),
  1245. $globals.ProtoObject);
  1246. $core.addMethod(
  1247. $core.method({
  1248. selector: "ifNotNil:ifNil:",
  1249. protocol: 'testing',
  1250. fn: function (aBlock,anotherBlock){
  1251. var self=this;
  1252. return $core.withContext(function($ctx1) {
  1253. return $recv(aBlock)._value_(self);
  1254. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  1255. },
  1256. args: ["aBlock", "anotherBlock"],
  1257. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  1258. referencedClasses: [],
  1259. messageSends: ["value:"]
  1260. }),
  1261. $globals.ProtoObject);
  1262. $core.addMethod(
  1263. $core.method({
  1264. selector: "initialize",
  1265. protocol: 'initialization',
  1266. fn: function (){
  1267. var self=this;
  1268. return self;
  1269. },
  1270. args: [],
  1271. source: "initialize",
  1272. referencedClasses: [],
  1273. messageSends: []
  1274. }),
  1275. $globals.ProtoObject);
  1276. $core.addMethod(
  1277. $core.method({
  1278. selector: "inspect",
  1279. protocol: 'inspecting',
  1280. fn: function (){
  1281. var self=this;
  1282. function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  1283. return $core.withContext(function($ctx1) {
  1284. $recv($Inspector())._inspect_(self);
  1285. return self;
  1286. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  1287. },
  1288. args: [],
  1289. source: "inspect\x0a\x09Inspector inspect: self",
  1290. referencedClasses: ["Inspector"],
  1291. messageSends: ["inspect:"]
  1292. }),
  1293. $globals.ProtoObject);
  1294. $core.addMethod(
  1295. $core.method({
  1296. selector: "inspectOn:",
  1297. protocol: 'inspecting',
  1298. fn: function (anInspector){
  1299. var self=this;
  1300. return self;
  1301. },
  1302. args: ["anInspector"],
  1303. source: "inspectOn: anInspector",
  1304. referencedClasses: [],
  1305. messageSends: []
  1306. }),
  1307. $globals.ProtoObject);
  1308. $core.addMethod(
  1309. $core.method({
  1310. selector: "instVarAt:",
  1311. protocol: 'accessing',
  1312. fn: function (aString){
  1313. var self=this;
  1314. return $core.withContext(function($ctx1) {
  1315. return self['@'+aString] ;
  1316. return self;
  1317. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  1318. },
  1319. args: ["aString"],
  1320. source: "instVarAt: aString\x0a\x09< return self['@'+aString] >",
  1321. referencedClasses: [],
  1322. messageSends: []
  1323. }),
  1324. $globals.ProtoObject);
  1325. $core.addMethod(
  1326. $core.method({
  1327. selector: "instVarAt:put:",
  1328. protocol: 'accessing',
  1329. fn: function (aString,anObject){
  1330. var self=this;
  1331. return $core.withContext(function($ctx1) {
  1332. self['@' + aString] = anObject ;
  1333. return self;
  1334. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  1335. },
  1336. args: ["aString", "anObject"],
  1337. source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >",
  1338. referencedClasses: [],
  1339. messageSends: []
  1340. }),
  1341. $globals.ProtoObject);
  1342. $core.addMethod(
  1343. $core.method({
  1344. selector: "isKindOf:",
  1345. protocol: 'testing',
  1346. fn: function (aClass){
  1347. var self=this;
  1348. return $core.withContext(function($ctx1) {
  1349. var $1;
  1350. $1=self._isMemberOf_(aClass);
  1351. if($core.assert($1)){
  1352. return true;
  1353. } else {
  1354. return $recv(self._class())._inheritsFrom_(aClass);
  1355. };
  1356. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  1357. },
  1358. args: ["aClass"],
  1359. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  1360. referencedClasses: [],
  1361. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  1362. }),
  1363. $globals.ProtoObject);
  1364. $core.addMethod(
  1365. $core.method({
  1366. selector: "isNil",
  1367. protocol: 'testing',
  1368. fn: function (){
  1369. var self=this;
  1370. return false;
  1371. },
  1372. args: [],
  1373. source: "isNil\x0a\x09^ false",
  1374. referencedClasses: [],
  1375. messageSends: []
  1376. }),
  1377. $globals.ProtoObject);
  1378. $core.addMethod(
  1379. $core.method({
  1380. selector: "isSameInstanceAs:",
  1381. protocol: 'comparing',
  1382. fn: function (anObject){
  1383. var self=this;
  1384. return $core.withContext(function($ctx1) {
  1385. var $1;
  1386. $1=self._identityHash();
  1387. $ctx1.sendIdx["identityHash"]=1;
  1388. return $recv($1).__eq($recv(anObject)._identityHash());
  1389. }, function($ctx1) {$ctx1.fill(self,"isSameInstanceAs:",{anObject:anObject},$globals.ProtoObject)});
  1390. },
  1391. args: ["anObject"],
  1392. source: "isSameInstanceAs: anObject\x0a\x09^ self identityHash = anObject identityHash",
  1393. referencedClasses: [],
  1394. messageSends: ["=", "identityHash"]
  1395. }),
  1396. $globals.ProtoObject);
  1397. $core.addMethod(
  1398. $core.method({
  1399. selector: "notNil",
  1400. protocol: 'testing',
  1401. fn: function (){
  1402. var self=this;
  1403. return $core.withContext(function($ctx1) {
  1404. return $recv(self._isNil())._not();
  1405. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  1406. },
  1407. args: [],
  1408. source: "notNil\x0a\x09^ self isNil not",
  1409. referencedClasses: [],
  1410. messageSends: ["not", "isNil"]
  1411. }),
  1412. $globals.ProtoObject);
  1413. $core.addMethod(
  1414. $core.method({
  1415. selector: "perform:",
  1416. protocol: 'message handling',
  1417. fn: function (aString){
  1418. var self=this;
  1419. return $core.withContext(function($ctx1) {
  1420. return self._perform_withArguments_(aString,[]);
  1421. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  1422. },
  1423. args: ["aString"],
  1424. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  1425. referencedClasses: [],
  1426. messageSends: ["perform:withArguments:"]
  1427. }),
  1428. $globals.ProtoObject);
  1429. $core.addMethod(
  1430. $core.method({
  1431. selector: "perform:withArguments:",
  1432. protocol: 'message handling',
  1433. fn: function (aString,aCollection){
  1434. var self=this;
  1435. return $core.withContext(function($ctx1) {
  1436. return $core.send(self, aString._asJavaScriptMethodName(), aCollection);
  1437. return self;
  1438. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  1439. },
  1440. args: ["aString", "aCollection"],
  1441. source: "perform: aString withArguments: aCollection\x0a\x09<return $core.send(self, aString._asJavaScriptMethodName(), aCollection)>",
  1442. referencedClasses: [],
  1443. messageSends: []
  1444. }),
  1445. $globals.ProtoObject);
  1446. $core.addMethod(
  1447. $core.method({
  1448. selector: "printOn:",
  1449. protocol: 'printing',
  1450. fn: function (aStream){
  1451. var self=this;
  1452. return $core.withContext(function($ctx1) {
  1453. var $5,$4,$3,$2,$1;
  1454. $5=self._class();
  1455. $ctx1.sendIdx["class"]=1;
  1456. $4=$recv($5)._name();
  1457. $ctx1.sendIdx["name"]=1;
  1458. $3=$recv($4)._first();
  1459. $2=$recv($3)._isVowel();
  1460. if($core.assert($2)){
  1461. $1="an ";
  1462. } else {
  1463. $1="a ";
  1464. };
  1465. $recv(aStream)._nextPutAll_($1);
  1466. $ctx1.sendIdx["nextPutAll:"]=1;
  1467. $recv(aStream)._nextPutAll_($recv(self._class())._name());
  1468. return self;
  1469. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  1470. },
  1471. args: ["aStream"],
  1472. 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",
  1473. referencedClasses: [],
  1474. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  1475. }),
  1476. $globals.ProtoObject);
  1477. $core.addMethod(
  1478. $core.method({
  1479. selector: "printString",
  1480. protocol: 'printing',
  1481. fn: function (){
  1482. var self=this;
  1483. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  1484. return $core.withContext(function($ctx1) {
  1485. return $recv($String())._streamContents_((function(str){
  1486. return $core.withContext(function($ctx2) {
  1487. return self._printOn_(str);
  1488. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  1489. }));
  1490. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  1491. },
  1492. args: [],
  1493. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  1494. referencedClasses: ["String"],
  1495. messageSends: ["streamContents:", "printOn:"]
  1496. }),
  1497. $globals.ProtoObject);
  1498. $core.addMethod(
  1499. $core.method({
  1500. selector: "yourself",
  1501. protocol: 'accessing',
  1502. fn: function (){
  1503. var self=this;
  1504. return self;
  1505. },
  1506. args: [],
  1507. source: "yourself\x0a\x09^ self",
  1508. referencedClasses: [],
  1509. messageSends: []
  1510. }),
  1511. $globals.ProtoObject);
  1512. $core.addMethod(
  1513. $core.method({
  1514. selector: "~=",
  1515. protocol: 'comparing',
  1516. fn: function (anObject){
  1517. var self=this;
  1518. return $core.withContext(function($ctx1) {
  1519. var $1;
  1520. $1=$recv(self.__eq(anObject)).__eq(false);
  1521. $ctx1.sendIdx["="]=1;
  1522. return $1;
  1523. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  1524. },
  1525. args: ["anObject"],
  1526. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  1527. referencedClasses: [],
  1528. messageSends: ["="]
  1529. }),
  1530. $globals.ProtoObject);
  1531. $core.addMethod(
  1532. $core.method({
  1533. selector: "~~",
  1534. protocol: 'comparing',
  1535. fn: function (anObject){
  1536. var self=this;
  1537. return $core.withContext(function($ctx1) {
  1538. return $recv(self.__eq_eq(anObject)).__eq(false);
  1539. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  1540. },
  1541. args: ["anObject"],
  1542. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  1543. referencedClasses: [],
  1544. messageSends: ["=", "=="]
  1545. }),
  1546. $globals.ProtoObject);
  1547. $core.addMethod(
  1548. $core.method({
  1549. selector: "initialize",
  1550. protocol: 'initialization',
  1551. fn: function (){
  1552. var self=this;
  1553. return self;
  1554. },
  1555. args: [],
  1556. source: "initialize",
  1557. referencedClasses: [],
  1558. messageSends: []
  1559. }),
  1560. $globals.ProtoObject.klass);
  1561. $core.addClass('Object', $globals.ProtoObject, [], 'Kernel-Objects');
  1562. $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.";
  1563. $core.addMethod(
  1564. $core.method({
  1565. selector: "->",
  1566. protocol: 'converting',
  1567. fn: function (anObject){
  1568. var self=this;
  1569. function $Association(){return $globals.Association||(typeof Association=="undefined"?nil:Association)}
  1570. return $core.withContext(function($ctx1) {
  1571. return $recv($Association())._key_value_(self,anObject);
  1572. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  1573. },
  1574. args: ["anObject"],
  1575. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  1576. referencedClasses: ["Association"],
  1577. messageSends: ["key:value:"]
  1578. }),
  1579. $globals.Object);
  1580. $core.addMethod(
  1581. $core.method({
  1582. selector: "asJSON",
  1583. protocol: 'converting',
  1584. fn: function (){
  1585. var self=this;
  1586. var variables;
  1587. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1588. return $core.withContext(function($ctx1) {
  1589. variables=$recv($HashedCollection())._new();
  1590. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  1591. return $core.withContext(function($ctx2) {
  1592. return $recv(variables)._at_put_(each,$recv(self._instVarAt_(each))._asJSON());
  1593. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1594. }));
  1595. return variables;
  1596. }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},$globals.Object)});
  1597. },
  1598. args: [],
  1599. 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",
  1600. referencedClasses: ["HashedCollection"],
  1601. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJSON", "instVarAt:"]
  1602. }),
  1603. $globals.Object);
  1604. $core.addMethod(
  1605. $core.method({
  1606. selector: "asJSONString",
  1607. protocol: 'converting',
  1608. fn: function (){
  1609. var self=this;
  1610. function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  1611. return $core.withContext(function($ctx1) {
  1612. return $recv($JSON())._stringify_(self._asJSON());
  1613. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  1614. },
  1615. args: [],
  1616. source: "asJSONString\x0a\x09^ JSON stringify: self asJSON",
  1617. referencedClasses: ["JSON"],
  1618. messageSends: ["stringify:", "asJSON"]
  1619. }),
  1620. $globals.Object);
  1621. $core.addMethod(
  1622. $core.method({
  1623. selector: "asJavascript",
  1624. protocol: 'converting',
  1625. fn: function (){
  1626. var self=this;
  1627. return $core.withContext(function($ctx1) {
  1628. return self._asString();
  1629. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Object)});
  1630. },
  1631. args: [],
  1632. source: "asJavascript\x0a\x09^ self asString",
  1633. referencedClasses: [],
  1634. messageSends: ["asString"]
  1635. }),
  1636. $globals.Object);
  1637. $core.addMethod(
  1638. $core.method({
  1639. selector: "basicAt:",
  1640. protocol: 'accessing',
  1641. fn: function (aString){
  1642. var self=this;
  1643. return $core.withContext(function($ctx1) {
  1644. return self[aString];
  1645. return self;
  1646. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  1647. },
  1648. args: ["aString"],
  1649. source: "basicAt: aString\x0a\x09<return self[aString]>",
  1650. referencedClasses: [],
  1651. messageSends: []
  1652. }),
  1653. $globals.Object);
  1654. $core.addMethod(
  1655. $core.method({
  1656. selector: "basicAt:put:",
  1657. protocol: 'accessing',
  1658. fn: function (aString,anObject){
  1659. var self=this;
  1660. return $core.withContext(function($ctx1) {
  1661. return self[aString] = anObject;
  1662. return self;
  1663. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  1664. },
  1665. args: ["aString", "anObject"],
  1666. source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
  1667. referencedClasses: [],
  1668. messageSends: []
  1669. }),
  1670. $globals.Object);
  1671. $core.addMethod(
  1672. $core.method({
  1673. selector: "basicDelete:",
  1674. protocol: 'accessing',
  1675. fn: function (aString){
  1676. var self=this;
  1677. return $core.withContext(function($ctx1) {
  1678. delete self[aString]; return aString;
  1679. return self;
  1680. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  1681. },
  1682. args: ["aString"],
  1683. source: "basicDelete: aString\x0a\x09<delete self[aString]; return aString>",
  1684. referencedClasses: [],
  1685. messageSends: []
  1686. }),
  1687. $globals.Object);
  1688. $core.addMethod(
  1689. $core.method({
  1690. selector: "basicPerform:",
  1691. protocol: 'message handling',
  1692. fn: function (aString){
  1693. var self=this;
  1694. return $core.withContext(function($ctx1) {
  1695. return self._basicPerform_withArguments_(aString,[]);
  1696. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  1697. },
  1698. args: ["aString"],
  1699. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  1700. referencedClasses: [],
  1701. messageSends: ["basicPerform:withArguments:"]
  1702. }),
  1703. $globals.Object);
  1704. $core.addMethod(
  1705. $core.method({
  1706. selector: "basicPerform:withArguments:",
  1707. protocol: 'message handling',
  1708. fn: function (aString,aCollection){
  1709. var self=this;
  1710. return $core.withContext(function($ctx1) {
  1711. return self[aString].apply(self, aCollection);;
  1712. return self;
  1713. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  1714. },
  1715. args: ["aString", "aCollection"],
  1716. source: "basicPerform: aString withArguments: aCollection\x0a\x09<return self[aString].apply(self, aCollection);>",
  1717. referencedClasses: [],
  1718. messageSends: []
  1719. }),
  1720. $globals.Object);
  1721. $core.addMethod(
  1722. $core.method({
  1723. selector: "browse",
  1724. protocol: 'browsing',
  1725. fn: function (){
  1726. var self=this;
  1727. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  1728. return $core.withContext(function($ctx1) {
  1729. $recv($Finder())._findClass_(self._class());
  1730. return self;
  1731. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  1732. },
  1733. args: [],
  1734. source: "browse\x0a\x09Finder findClass: self class",
  1735. referencedClasses: ["Finder"],
  1736. messageSends: ["findClass:", "class"]
  1737. }),
  1738. $globals.Object);
  1739. $core.addMethod(
  1740. $core.method({
  1741. selector: "copy",
  1742. protocol: 'copying',
  1743. fn: function (){
  1744. var self=this;
  1745. return $core.withContext(function($ctx1) {
  1746. return $recv(self._shallowCopy())._postCopy();
  1747. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  1748. },
  1749. args: [],
  1750. source: "copy\x0a\x09^ self shallowCopy postCopy",
  1751. referencedClasses: [],
  1752. messageSends: ["postCopy", "shallowCopy"]
  1753. }),
  1754. $globals.Object);
  1755. $core.addMethod(
  1756. $core.method({
  1757. selector: "deepCopy",
  1758. protocol: 'copying',
  1759. fn: function (){
  1760. var self=this;
  1761. return $core.withContext(function($ctx1) {
  1762. var copy = self.klass._new();
  1763. Object.keys(self).forEach(function (i) {
  1764. if(/^@.+/.test(i)) {
  1765. copy[i] = self[i]._deepCopy();
  1766. }
  1767. });
  1768. return copy;
  1769. ;
  1770. return self;
  1771. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  1772. },
  1773. args: [],
  1774. 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>",
  1775. referencedClasses: [],
  1776. messageSends: []
  1777. }),
  1778. $globals.Object);
  1779. $core.addMethod(
  1780. $core.method({
  1781. selector: "deprecatedAPI",
  1782. protocol: 'error handling',
  1783. fn: function (){
  1784. var self=this;
  1785. return $core.withContext(function($ctx1) {
  1786. var $1,$6,$5,$4,$8,$7,$3,$2;
  1787. $1=console;
  1788. $6=$core.getThisContext()._home();
  1789. $ctx1.sendIdx["home"]=1;
  1790. $5=$recv($6)._asString();
  1791. $ctx1.sendIdx["asString"]=1;
  1792. $4=$recv($5).__comma(" is deprecated! (in ");
  1793. $8=$recv($core.getThisContext()._home())._home();
  1794. $ctx1.sendIdx["home"]=2;
  1795. $7=$recv($8)._asString();
  1796. $3=$recv($4).__comma($7);
  1797. $ctx1.sendIdx[","]=2;
  1798. $2=$recv($3).__comma(")");
  1799. $ctx1.sendIdx[","]=1;
  1800. $recv($1)._warn_($2);
  1801. return self;
  1802. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  1803. },
  1804. args: [],
  1805. 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, ')'.",
  1806. referencedClasses: [],
  1807. messageSends: ["warn:", ",", "asString", "home"]
  1808. }),
  1809. $globals.Object);
  1810. $core.addMethod(
  1811. $core.method({
  1812. selector: "deprecatedAPI:",
  1813. protocol: 'error handling',
  1814. fn: function (aString){
  1815. var self=this;
  1816. return $core.withContext(function($ctx1) {
  1817. var $1,$6,$5,$4,$8,$7,$3,$2;
  1818. $1=console;
  1819. $6=$core.getThisContext()._home();
  1820. $ctx1.sendIdx["home"]=1;
  1821. $5=$recv($6)._asString();
  1822. $ctx1.sendIdx["asString"]=1;
  1823. $4=$recv($5).__comma(" is deprecated! (in ");
  1824. $8=$recv($core.getThisContext()._home())._home();
  1825. $ctx1.sendIdx["home"]=2;
  1826. $7=$recv($8)._asString();
  1827. $3=$recv($4).__comma($7);
  1828. $ctx1.sendIdx[","]=2;
  1829. $2=$recv($3).__comma(")");
  1830. $ctx1.sendIdx[","]=1;
  1831. $recv($1)._warn_($2);
  1832. $ctx1.sendIdx["warn:"]=1;
  1833. $recv(console)._warn_(aString);
  1834. return self;
  1835. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  1836. },
  1837. args: ["aString"],
  1838. 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",
  1839. referencedClasses: [],
  1840. messageSends: ["warn:", ",", "asString", "home"]
  1841. }),
  1842. $globals.Object);
  1843. $core.addMethod(
  1844. $core.method({
  1845. selector: "error:",
  1846. protocol: 'error handling',
  1847. fn: function (aString){
  1848. var self=this;
  1849. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  1850. return $core.withContext(function($ctx1) {
  1851. $recv($Error())._signal_(aString);
  1852. return self;
  1853. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  1854. },
  1855. args: ["aString"],
  1856. source: "error: aString\x0a\x09Error signal: aString",
  1857. referencedClasses: ["Error"],
  1858. messageSends: ["signal:"]
  1859. }),
  1860. $globals.Object);
  1861. $core.addMethod(
  1862. $core.method({
  1863. selector: "halt",
  1864. protocol: 'error handling',
  1865. fn: function (){
  1866. var self=this;
  1867. function $Halt(){return $globals.Halt||(typeof Halt=="undefined"?nil:Halt)}
  1868. return $core.withContext(function($ctx1) {
  1869. $recv($Halt())._signal();
  1870. return self;
  1871. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  1872. },
  1873. args: [],
  1874. source: "halt\x0a\x09Halt signal",
  1875. referencedClasses: ["Halt"],
  1876. messageSends: ["signal"]
  1877. }),
  1878. $globals.Object);
  1879. $core.addMethod(
  1880. $core.method({
  1881. selector: "in:",
  1882. protocol: 'evaluating',
  1883. fn: function (aValuable){
  1884. var self=this;
  1885. return $core.withContext(function($ctx1) {
  1886. return $recv(aValuable)._value_(self);
  1887. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  1888. },
  1889. args: ["aValuable"],
  1890. source: "in: aValuable\x0a\x09^ aValuable value: self",
  1891. referencedClasses: [],
  1892. messageSends: ["value:"]
  1893. }),
  1894. $globals.Object);
  1895. $core.addMethod(
  1896. $core.method({
  1897. selector: "isBehavior",
  1898. protocol: 'testing',
  1899. fn: function (){
  1900. var self=this;
  1901. return false;
  1902. },
  1903. args: [],
  1904. source: "isBehavior\x0a\x09^ false",
  1905. referencedClasses: [],
  1906. messageSends: []
  1907. }),
  1908. $globals.Object);
  1909. $core.addMethod(
  1910. $core.method({
  1911. selector: "isBoolean",
  1912. protocol: 'testing',
  1913. fn: function (){
  1914. var self=this;
  1915. return false;
  1916. },
  1917. args: [],
  1918. source: "isBoolean\x0a\x09^ false",
  1919. referencedClasses: [],
  1920. messageSends: []
  1921. }),
  1922. $globals.Object);
  1923. $core.addMethod(
  1924. $core.method({
  1925. selector: "isClass",
  1926. protocol: 'testing',
  1927. fn: function (){
  1928. var self=this;
  1929. return false;
  1930. },
  1931. args: [],
  1932. source: "isClass\x0a\x09^ false",
  1933. referencedClasses: [],
  1934. messageSends: []
  1935. }),
  1936. $globals.Object);
  1937. $core.addMethod(
  1938. $core.method({
  1939. selector: "isCompiledMethod",
  1940. protocol: 'testing',
  1941. fn: function (){
  1942. var self=this;
  1943. return false;
  1944. },
  1945. args: [],
  1946. source: "isCompiledMethod\x0a\x09^ false",
  1947. referencedClasses: [],
  1948. messageSends: []
  1949. }),
  1950. $globals.Object);
  1951. $core.addMethod(
  1952. $core.method({
  1953. selector: "isImmutable",
  1954. protocol: 'testing',
  1955. fn: function (){
  1956. var self=this;
  1957. return false;
  1958. },
  1959. args: [],
  1960. source: "isImmutable\x0a\x09^ false",
  1961. referencedClasses: [],
  1962. messageSends: []
  1963. }),
  1964. $globals.Object);
  1965. $core.addMethod(
  1966. $core.method({
  1967. selector: "isMemberOf:",
  1968. protocol: 'testing',
  1969. fn: function (aClass){
  1970. var self=this;
  1971. return $core.withContext(function($ctx1) {
  1972. return $recv(self._class()).__eq(aClass);
  1973. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  1974. },
  1975. args: ["aClass"],
  1976. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  1977. referencedClasses: [],
  1978. messageSends: ["=", "class"]
  1979. }),
  1980. $globals.Object);
  1981. $core.addMethod(
  1982. $core.method({
  1983. selector: "isMetaclass",
  1984. protocol: 'testing',
  1985. fn: function (){
  1986. var self=this;
  1987. return false;
  1988. },
  1989. args: [],
  1990. source: "isMetaclass\x0a\x09^ false",
  1991. referencedClasses: [],
  1992. messageSends: []
  1993. }),
  1994. $globals.Object);
  1995. $core.addMethod(
  1996. $core.method({
  1997. selector: "isNumber",
  1998. protocol: 'testing',
  1999. fn: function (){
  2000. var self=this;
  2001. return false;
  2002. },
  2003. args: [],
  2004. source: "isNumber\x0a\x09^ false",
  2005. referencedClasses: [],
  2006. messageSends: []
  2007. }),
  2008. $globals.Object);
  2009. $core.addMethod(
  2010. $core.method({
  2011. selector: "isPackage",
  2012. protocol: 'testing',
  2013. fn: function (){
  2014. var self=this;
  2015. return false;
  2016. },
  2017. args: [],
  2018. source: "isPackage\x0a\x09^ false",
  2019. referencedClasses: [],
  2020. messageSends: []
  2021. }),
  2022. $globals.Object);
  2023. $core.addMethod(
  2024. $core.method({
  2025. selector: "isParseFailure",
  2026. protocol: 'testing',
  2027. fn: function (){
  2028. var self=this;
  2029. return false;
  2030. },
  2031. args: [],
  2032. source: "isParseFailure\x0a\x09^ false",
  2033. referencedClasses: [],
  2034. messageSends: []
  2035. }),
  2036. $globals.Object);
  2037. $core.addMethod(
  2038. $core.method({
  2039. selector: "isString",
  2040. protocol: 'testing',
  2041. fn: function (){
  2042. var self=this;
  2043. return false;
  2044. },
  2045. args: [],
  2046. source: "isString\x0a\x09^ false",
  2047. referencedClasses: [],
  2048. messageSends: []
  2049. }),
  2050. $globals.Object);
  2051. $core.addMethod(
  2052. $core.method({
  2053. selector: "isSymbol",
  2054. protocol: 'testing',
  2055. fn: function (){
  2056. var self=this;
  2057. return false;
  2058. },
  2059. args: [],
  2060. source: "isSymbol\x0a\x09^ false",
  2061. referencedClasses: [],
  2062. messageSends: []
  2063. }),
  2064. $globals.Object);
  2065. $core.addMethod(
  2066. $core.method({
  2067. selector: "postCopy",
  2068. protocol: 'copying',
  2069. fn: function (){
  2070. var self=this;
  2071. return self;
  2072. },
  2073. args: [],
  2074. source: "postCopy",
  2075. referencedClasses: [],
  2076. messageSends: []
  2077. }),
  2078. $globals.Object);
  2079. $core.addMethod(
  2080. $core.method({
  2081. selector: "putOn:",
  2082. protocol: 'streaming',
  2083. fn: function (aStream){
  2084. var self=this;
  2085. return $core.withContext(function($ctx1) {
  2086. $recv(aStream)._nextPut_(self);
  2087. return self;
  2088. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  2089. },
  2090. args: ["aStream"],
  2091. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  2092. referencedClasses: [],
  2093. messageSends: ["nextPut:"]
  2094. }),
  2095. $globals.Object);
  2096. $core.addMethod(
  2097. $core.method({
  2098. selector: "respondsTo:",
  2099. protocol: 'testing',
  2100. fn: function (aSelector){
  2101. var self=this;
  2102. return $core.withContext(function($ctx1) {
  2103. return $recv(self._class())._canUnderstand_(aSelector);
  2104. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  2105. },
  2106. args: ["aSelector"],
  2107. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  2108. referencedClasses: [],
  2109. messageSends: ["canUnderstand:", "class"]
  2110. }),
  2111. $globals.Object);
  2112. $core.addMethod(
  2113. $core.method({
  2114. selector: "shallowCopy",
  2115. protocol: 'copying',
  2116. fn: function (){
  2117. var self=this;
  2118. return $core.withContext(function($ctx1) {
  2119. var copy = self.klass._new();
  2120. Object.keys(self).forEach(function(i) {
  2121. if(/^@.+/.test(i)) {
  2122. copy[i] = self[i];
  2123. }
  2124. });
  2125. return copy;
  2126. ;
  2127. return self;
  2128. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  2129. },
  2130. args: [],
  2131. 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>",
  2132. referencedClasses: [],
  2133. messageSends: []
  2134. }),
  2135. $globals.Object);
  2136. $core.addMethod(
  2137. $core.method({
  2138. selector: "shouldNotImplement",
  2139. protocol: 'error handling',
  2140. fn: function (){
  2141. var self=this;
  2142. return $core.withContext(function($ctx1) {
  2143. self._error_("This method should not be implemented in ".__comma($recv(self._class())._name()));
  2144. return self;
  2145. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  2146. },
  2147. args: [],
  2148. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  2149. referencedClasses: [],
  2150. messageSends: ["error:", ",", "name", "class"]
  2151. }),
  2152. $globals.Object);
  2153. $core.addMethod(
  2154. $core.method({
  2155. selector: "size",
  2156. protocol: 'accessing',
  2157. fn: function (){
  2158. var self=this;
  2159. return $core.withContext(function($ctx1) {
  2160. self._error_("Object not indexable");
  2161. return self;
  2162. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  2163. },
  2164. args: [],
  2165. source: "size\x0a\x09self error: 'Object not indexable'",
  2166. referencedClasses: [],
  2167. messageSends: ["error:"]
  2168. }),
  2169. $globals.Object);
  2170. $core.addMethod(
  2171. $core.method({
  2172. selector: "subclassResponsibility",
  2173. protocol: 'error handling',
  2174. fn: function (){
  2175. var self=this;
  2176. return $core.withContext(function($ctx1) {
  2177. self._error_("This method is a responsibility of a subclass");
  2178. return self;
  2179. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  2180. },
  2181. args: [],
  2182. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  2183. referencedClasses: [],
  2184. messageSends: ["error:"]
  2185. }),
  2186. $globals.Object);
  2187. $core.addMethod(
  2188. $core.method({
  2189. selector: "throw:",
  2190. protocol: 'error handling',
  2191. fn: function (anObject){
  2192. var self=this;
  2193. return $core.withContext(function($ctx1) {
  2194. throw anObject ;
  2195. return self;
  2196. }, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},$globals.Object)});
  2197. },
  2198. args: ["anObject"],
  2199. source: "throw: anObject\x0a\x09< throw anObject >",
  2200. referencedClasses: [],
  2201. messageSends: []
  2202. }),
  2203. $globals.Object);
  2204. $core.addMethod(
  2205. $core.method({
  2206. selector: "value",
  2207. protocol: 'evaluating',
  2208. fn: function (){
  2209. var self=this;
  2210. return $core.withContext(function($ctx1) {
  2211. return self.valueOf();
  2212. return self;
  2213. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  2214. },
  2215. args: [],
  2216. source: "value\x0a\x09<return self.valueOf()>",
  2217. referencedClasses: [],
  2218. messageSends: []
  2219. }),
  2220. $globals.Object);
  2221. $core.addMethod(
  2222. $core.method({
  2223. selector: "accessorProtocolWith:",
  2224. protocol: 'helios',
  2225. fn: function (aGenerator){
  2226. var self=this;
  2227. return $core.withContext(function($ctx1) {
  2228. $recv(aGenerator)._accessorProtocolForObject();
  2229. return self;
  2230. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2231. },
  2232. args: ["aGenerator"],
  2233. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  2234. referencedClasses: [],
  2235. messageSends: ["accessorProtocolForObject"]
  2236. }),
  2237. $globals.Object.klass);
  2238. $core.addMethod(
  2239. $core.method({
  2240. selector: "accessorsSourceCodesWith:",
  2241. protocol: 'helios',
  2242. fn: function (aGenerator){
  2243. var self=this;
  2244. return $core.withContext(function($ctx1) {
  2245. $recv(aGenerator)._accessorsForObject();
  2246. return self;
  2247. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2248. },
  2249. args: ["aGenerator"],
  2250. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  2251. referencedClasses: [],
  2252. messageSends: ["accessorsForObject"]
  2253. }),
  2254. $globals.Object.klass);
  2255. $core.addMethod(
  2256. $core.method({
  2257. selector: "initialize",
  2258. protocol: 'initialization',
  2259. fn: function (){
  2260. var self=this;
  2261. return self;
  2262. },
  2263. args: [],
  2264. source: "initialize\x0a\x09\x22no op\x22",
  2265. referencedClasses: [],
  2266. messageSends: []
  2267. }),
  2268. $globals.Object.klass);
  2269. $core.addMethod(
  2270. $core.method({
  2271. selector: "initializeProtocolWith:",
  2272. protocol: 'helios',
  2273. fn: function (aGenerator){
  2274. var self=this;
  2275. return $core.withContext(function($ctx1) {
  2276. $recv(aGenerator)._initializeProtocolForObject();
  2277. return self;
  2278. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2279. },
  2280. args: ["aGenerator"],
  2281. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  2282. referencedClasses: [],
  2283. messageSends: ["initializeProtocolForObject"]
  2284. }),
  2285. $globals.Object.klass);
  2286. $core.addMethod(
  2287. $core.method({
  2288. selector: "initializeSourceCodesWith:",
  2289. protocol: 'helios',
  2290. fn: function (aGenerator){
  2291. var self=this;
  2292. return $core.withContext(function($ctx1) {
  2293. $recv(aGenerator)._initializeForObject();
  2294. return self;
  2295. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2296. },
  2297. args: ["aGenerator"],
  2298. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  2299. referencedClasses: [],
  2300. messageSends: ["initializeForObject"]
  2301. }),
  2302. $globals.Object.klass);
  2303. $core.addClass('Boolean', $globals.Object, [], 'Kernel-Objects');
  2304. $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: [ ... ]";
  2305. $core.addMethod(
  2306. $core.method({
  2307. selector: "&",
  2308. protocol: 'controlling',
  2309. fn: function (aBoolean){
  2310. var self=this;
  2311. return $core.withContext(function($ctx1) {
  2312. if(self == true) {
  2313. return aBoolean;
  2314. } else {
  2315. return false;
  2316. }
  2317. ;
  2318. return self;
  2319. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  2320. },
  2321. args: ["aBoolean"],
  2322. 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>",
  2323. referencedClasses: [],
  2324. messageSends: []
  2325. }),
  2326. $globals.Boolean);
  2327. $core.addMethod(
  2328. $core.method({
  2329. selector: "==",
  2330. protocol: 'comparing',
  2331. fn: function (aBoolean){
  2332. var self=this;
  2333. return $core.withContext(function($ctx1) {
  2334. if (typeof aBoolean === "boolean") return self.valueOf() === aBoolean;
  2335. else if (aBoolean != null && typeof aBoolean === "object") return self.valueOf() === aBoolean.valueOf();
  2336. else return false;;
  2337. return self;
  2338. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  2339. },
  2340. args: ["aBoolean"],
  2341. source: "== aBoolean\x0a<\x0a\x09if (typeof aBoolean === \x22boolean\x22) return self.valueOf() === aBoolean;\x0a\x09else if (aBoolean != null && typeof aBoolean === \x22object\x22) return self.valueOf() === aBoolean.valueOf();\x0a\x09else return false;\x0a>",
  2342. referencedClasses: [],
  2343. messageSends: []
  2344. }),
  2345. $globals.Boolean);
  2346. $core.addMethod(
  2347. $core.method({
  2348. selector: "and:",
  2349. protocol: 'controlling',
  2350. fn: function (aBlock){
  2351. var self=this;
  2352. return $core.withContext(function($ctx1) {
  2353. var $1;
  2354. $1=self.__eq(true);
  2355. return $recv($1)._ifTrue_ifFalse_(aBlock,(function(){
  2356. return false;
  2357. }));
  2358. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  2359. },
  2360. args: ["aBlock"],
  2361. source: "and: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ false ]",
  2362. referencedClasses: [],
  2363. messageSends: ["ifTrue:ifFalse:", "="]
  2364. }),
  2365. $globals.Boolean);
  2366. $core.addMethod(
  2367. $core.method({
  2368. selector: "asBit",
  2369. protocol: 'converting',
  2370. fn: function (){
  2371. var self=this;
  2372. return $core.withContext(function($ctx1) {
  2373. if($core.assert(self)){
  2374. return (1);
  2375. } else {
  2376. return (0);
  2377. };
  2378. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  2379. },
  2380. args: [],
  2381. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  2382. referencedClasses: [],
  2383. messageSends: ["ifTrue:ifFalse:"]
  2384. }),
  2385. $globals.Boolean);
  2386. $core.addMethod(
  2387. $core.method({
  2388. selector: "asJSON",
  2389. protocol: 'converting',
  2390. fn: function (){
  2391. var self=this;
  2392. return self;
  2393. },
  2394. args: [],
  2395. source: "asJSON\x0a\x09^ self",
  2396. referencedClasses: [],
  2397. messageSends: []
  2398. }),
  2399. $globals.Boolean);
  2400. $core.addMethod(
  2401. $core.method({
  2402. selector: "asString",
  2403. protocol: 'converting',
  2404. fn: function (){
  2405. var self=this;
  2406. return $core.withContext(function($ctx1) {
  2407. return self.toString() ;
  2408. return self;
  2409. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  2410. },
  2411. args: [],
  2412. source: "asString\x0a\x09< return self.toString() >",
  2413. referencedClasses: [],
  2414. messageSends: []
  2415. }),
  2416. $globals.Boolean);
  2417. $core.addMethod(
  2418. $core.method({
  2419. selector: "deepCopy",
  2420. protocol: 'copying',
  2421. fn: function (){
  2422. var self=this;
  2423. return self;
  2424. },
  2425. args: [],
  2426. source: "deepCopy\x0a\x09^ self",
  2427. referencedClasses: [],
  2428. messageSends: []
  2429. }),
  2430. $globals.Boolean);
  2431. $core.addMethod(
  2432. $core.method({
  2433. selector: "ifFalse:",
  2434. protocol: 'controlling',
  2435. fn: function (aBlock){
  2436. var self=this;
  2437. return $core.withContext(function($ctx1) {
  2438. return self._ifTrue_ifFalse_((function(){
  2439. }),aBlock);
  2440. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  2441. },
  2442. args: ["aBlock"],
  2443. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  2444. referencedClasses: [],
  2445. messageSends: ["ifTrue:ifFalse:"]
  2446. }),
  2447. $globals.Boolean);
  2448. $core.addMethod(
  2449. $core.method({
  2450. selector: "ifFalse:ifTrue:",
  2451. protocol: 'controlling',
  2452. fn: function (aBlock,anotherBlock){
  2453. var self=this;
  2454. return $core.withContext(function($ctx1) {
  2455. return self._ifTrue_ifFalse_(anotherBlock,aBlock);
  2456. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  2457. },
  2458. args: ["aBlock", "anotherBlock"],
  2459. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  2460. referencedClasses: [],
  2461. messageSends: ["ifTrue:ifFalse:"]
  2462. }),
  2463. $globals.Boolean);
  2464. $core.addMethod(
  2465. $core.method({
  2466. selector: "ifTrue:",
  2467. protocol: 'controlling',
  2468. fn: function (aBlock){
  2469. var self=this;
  2470. return $core.withContext(function($ctx1) {
  2471. return self._ifTrue_ifFalse_(aBlock,(function(){
  2472. }));
  2473. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  2474. },
  2475. args: ["aBlock"],
  2476. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  2477. referencedClasses: [],
  2478. messageSends: ["ifTrue:ifFalse:"]
  2479. }),
  2480. $globals.Boolean);
  2481. $core.addMethod(
  2482. $core.method({
  2483. selector: "ifTrue:ifFalse:",
  2484. protocol: 'controlling',
  2485. fn: function (aBlock,anotherBlock){
  2486. var self=this;
  2487. return $core.withContext(function($ctx1) {
  2488. if(self == true) {
  2489. return aBlock._value();
  2490. } else {
  2491. return anotherBlock._value();
  2492. }
  2493. ;
  2494. return self;
  2495. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  2496. },
  2497. args: ["aBlock", "anotherBlock"],
  2498. 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>",
  2499. referencedClasses: [],
  2500. messageSends: []
  2501. }),
  2502. $globals.Boolean);
  2503. $core.addMethod(
  2504. $core.method({
  2505. selector: "isBoolean",
  2506. protocol: 'testing',
  2507. fn: function (){
  2508. var self=this;
  2509. return true;
  2510. },
  2511. args: [],
  2512. source: "isBoolean\x0a\x09^ true",
  2513. referencedClasses: [],
  2514. messageSends: []
  2515. }),
  2516. $globals.Boolean);
  2517. $core.addMethod(
  2518. $core.method({
  2519. selector: "isImmutable",
  2520. protocol: 'testing',
  2521. fn: function (){
  2522. var self=this;
  2523. return true;
  2524. },
  2525. args: [],
  2526. source: "isImmutable\x0a\x09^ true",
  2527. referencedClasses: [],
  2528. messageSends: []
  2529. }),
  2530. $globals.Boolean);
  2531. $core.addMethod(
  2532. $core.method({
  2533. selector: "not",
  2534. protocol: 'controlling',
  2535. fn: function (){
  2536. var self=this;
  2537. return $core.withContext(function($ctx1) {
  2538. return self.__eq(false);
  2539. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  2540. },
  2541. args: [],
  2542. source: "not\x0a\x09^ self = false",
  2543. referencedClasses: [],
  2544. messageSends: ["="]
  2545. }),
  2546. $globals.Boolean);
  2547. $core.addMethod(
  2548. $core.method({
  2549. selector: "or:",
  2550. protocol: 'controlling',
  2551. fn: function (aBlock){
  2552. var self=this;
  2553. return $core.withContext(function($ctx1) {
  2554. var $1;
  2555. $1=self.__eq(true);
  2556. return $recv($1)._ifTrue_ifFalse_((function(){
  2557. return true;
  2558. }),aBlock);
  2559. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  2560. },
  2561. args: ["aBlock"],
  2562. source: "or: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: aBlock",
  2563. referencedClasses: [],
  2564. messageSends: ["ifTrue:ifFalse:", "="]
  2565. }),
  2566. $globals.Boolean);
  2567. $core.addMethod(
  2568. $core.method({
  2569. selector: "printOn:",
  2570. protocol: 'printing',
  2571. fn: function (aStream){
  2572. var self=this;
  2573. return $core.withContext(function($ctx1) {
  2574. $recv(aStream)._nextPutAll_(self._asString());
  2575. return self;
  2576. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  2577. },
  2578. args: ["aStream"],
  2579. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  2580. referencedClasses: [],
  2581. messageSends: ["nextPutAll:", "asString"]
  2582. }),
  2583. $globals.Boolean);
  2584. $core.addMethod(
  2585. $core.method({
  2586. selector: "shallowCopy",
  2587. protocol: 'copying',
  2588. fn: function (){
  2589. var self=this;
  2590. return self;
  2591. },
  2592. args: [],
  2593. source: "shallowCopy\x0a\x09^ self",
  2594. referencedClasses: [],
  2595. messageSends: []
  2596. }),
  2597. $globals.Boolean);
  2598. $core.addMethod(
  2599. $core.method({
  2600. selector: "|",
  2601. protocol: 'controlling',
  2602. fn: function (aBoolean){
  2603. var self=this;
  2604. return $core.withContext(function($ctx1) {
  2605. if(self == true) {
  2606. return true;
  2607. } else {
  2608. return aBoolean;
  2609. }
  2610. ;
  2611. return self;
  2612. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  2613. },
  2614. args: ["aBoolean"],
  2615. 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>",
  2616. referencedClasses: [],
  2617. messageSends: []
  2618. }),
  2619. $globals.Boolean);
  2620. $core.addClass('Date', $globals.Object, [], 'Kernel-Objects');
  2621. $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.).";
  2622. $core.addMethod(
  2623. $core.method({
  2624. selector: "+",
  2625. protocol: 'arithmetic',
  2626. fn: function (aDate){
  2627. var self=this;
  2628. return $core.withContext(function($ctx1) {
  2629. return self + aDate;
  2630. return self;
  2631. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  2632. },
  2633. args: ["aDate"],
  2634. source: "+ aDate\x0a\x09<return self + aDate>",
  2635. referencedClasses: [],
  2636. messageSends: []
  2637. }),
  2638. $globals.Date);
  2639. $core.addMethod(
  2640. $core.method({
  2641. selector: "-",
  2642. protocol: 'arithmetic',
  2643. fn: function (aDate){
  2644. var self=this;
  2645. return $core.withContext(function($ctx1) {
  2646. return self - aDate;
  2647. return self;
  2648. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  2649. },
  2650. args: ["aDate"],
  2651. source: "- aDate\x0a\x09<return self - aDate>",
  2652. referencedClasses: [],
  2653. messageSends: []
  2654. }),
  2655. $globals.Date);
  2656. $core.addMethod(
  2657. $core.method({
  2658. selector: "<",
  2659. protocol: 'comparing',
  2660. fn: function (aDate){
  2661. var self=this;
  2662. return $core.withContext(function($ctx1) {
  2663. return self < aDate;
  2664. return self;
  2665. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  2666. },
  2667. args: ["aDate"],
  2668. source: "< aDate\x0a\x09<return self < aDate>",
  2669. referencedClasses: [],
  2670. messageSends: []
  2671. }),
  2672. $globals.Date);
  2673. $core.addMethod(
  2674. $core.method({
  2675. selector: "<=",
  2676. protocol: 'comparing',
  2677. fn: function (aDate){
  2678. var self=this;
  2679. return $core.withContext(function($ctx1) {
  2680. return self <= aDate;
  2681. return self;
  2682. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  2683. },
  2684. args: ["aDate"],
  2685. source: "<= aDate\x0a\x09<return self <= aDate>",
  2686. referencedClasses: [],
  2687. messageSends: []
  2688. }),
  2689. $globals.Date);
  2690. $core.addMethod(
  2691. $core.method({
  2692. selector: "=",
  2693. protocol: 'comparing',
  2694. fn: function (aDate){
  2695. var self=this;
  2696. return $core.withContext(function($ctx1) {
  2697. var $2,$1,$3;
  2698. $2=$recv(aDate)._class();
  2699. $ctx1.sendIdx["class"]=1;
  2700. $1=$recv($2).__eq_eq(self._class());
  2701. $ctx1.sendIdx["=="]=1;
  2702. return $recv($1)._and_((function(){
  2703. return $core.withContext(function($ctx2) {
  2704. $3=self._asMilliseconds();
  2705. $ctx2.sendIdx["asMilliseconds"]=1;
  2706. return $recv($3).__eq_eq($recv(aDate)._asMilliseconds());
  2707. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2708. }));
  2709. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  2710. },
  2711. args: ["aDate"],
  2712. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  2713. referencedClasses: [],
  2714. messageSends: ["and:", "==", "class", "asMilliseconds"]
  2715. }),
  2716. $globals.Date);
  2717. $core.addMethod(
  2718. $core.method({
  2719. selector: ">",
  2720. protocol: 'comparing',
  2721. fn: function (aDate){
  2722. var self=this;
  2723. return $core.withContext(function($ctx1) {
  2724. return self > aDate;
  2725. return self;
  2726. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)});
  2727. },
  2728. args: ["aDate"],
  2729. source: "> aDate\x0a\x09<return self >> aDate>",
  2730. referencedClasses: [],
  2731. messageSends: []
  2732. }),
  2733. $globals.Date);
  2734. $core.addMethod(
  2735. $core.method({
  2736. selector: ">=",
  2737. protocol: 'comparing',
  2738. fn: function (aDate){
  2739. var self=this;
  2740. return $core.withContext(function($ctx1) {
  2741. return self >= aDate;
  2742. return self;
  2743. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  2744. },
  2745. args: ["aDate"],
  2746. source: ">= aDate\x0a\x09<return self >>= aDate>",
  2747. referencedClasses: [],
  2748. messageSends: []
  2749. }),
  2750. $globals.Date);
  2751. $core.addMethod(
  2752. $core.method({
  2753. selector: "asDateString",
  2754. protocol: 'converting',
  2755. fn: function (){
  2756. var self=this;
  2757. return $core.withContext(function($ctx1) {
  2758. return self.toDateString();
  2759. return self;
  2760. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  2761. },
  2762. args: [],
  2763. source: "asDateString\x0a\x09<return self.toDateString()>",
  2764. referencedClasses: [],
  2765. messageSends: []
  2766. }),
  2767. $globals.Date);
  2768. $core.addMethod(
  2769. $core.method({
  2770. selector: "asLocaleString",
  2771. protocol: 'converting',
  2772. fn: function (){
  2773. var self=this;
  2774. return $core.withContext(function($ctx1) {
  2775. return self.toLocaleString();
  2776. return self;
  2777. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  2778. },
  2779. args: [],
  2780. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  2781. referencedClasses: [],
  2782. messageSends: []
  2783. }),
  2784. $globals.Date);
  2785. $core.addMethod(
  2786. $core.method({
  2787. selector: "asMilliseconds",
  2788. protocol: 'converting',
  2789. fn: function (){
  2790. var self=this;
  2791. return $core.withContext(function($ctx1) {
  2792. return self._time();
  2793. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  2794. },
  2795. args: [],
  2796. source: "asMilliseconds\x0a\x09^ self time",
  2797. referencedClasses: [],
  2798. messageSends: ["time"]
  2799. }),
  2800. $globals.Date);
  2801. $core.addMethod(
  2802. $core.method({
  2803. selector: "asNumber",
  2804. protocol: 'converting',
  2805. fn: function (){
  2806. var self=this;
  2807. return $core.withContext(function($ctx1) {
  2808. return self._asMilliseconds();
  2809. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  2810. },
  2811. args: [],
  2812. source: "asNumber\x0a\x09^ self asMilliseconds",
  2813. referencedClasses: [],
  2814. messageSends: ["asMilliseconds"]
  2815. }),
  2816. $globals.Date);
  2817. $core.addMethod(
  2818. $core.method({
  2819. selector: "asString",
  2820. protocol: 'converting',
  2821. fn: function (){
  2822. var self=this;
  2823. return $core.withContext(function($ctx1) {
  2824. return self.toString();
  2825. return self;
  2826. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  2827. },
  2828. args: [],
  2829. source: "asString\x0a\x09<return self.toString()>",
  2830. referencedClasses: [],
  2831. messageSends: []
  2832. }),
  2833. $globals.Date);
  2834. $core.addMethod(
  2835. $core.method({
  2836. selector: "asTimeString",
  2837. protocol: 'converting',
  2838. fn: function (){
  2839. var self=this;
  2840. return $core.withContext(function($ctx1) {
  2841. return self.toTimeString();
  2842. return self;
  2843. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  2844. },
  2845. args: [],
  2846. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  2847. referencedClasses: [],
  2848. messageSends: []
  2849. }),
  2850. $globals.Date);
  2851. $core.addMethod(
  2852. $core.method({
  2853. selector: "day",
  2854. protocol: 'accessing',
  2855. fn: function (){
  2856. var self=this;
  2857. return $core.withContext(function($ctx1) {
  2858. return self._dayOfWeek();
  2859. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  2860. },
  2861. args: [],
  2862. source: "day\x0a\x09^ self dayOfWeek",
  2863. referencedClasses: [],
  2864. messageSends: ["dayOfWeek"]
  2865. }),
  2866. $globals.Date);
  2867. $core.addMethod(
  2868. $core.method({
  2869. selector: "day:",
  2870. protocol: 'accessing',
  2871. fn: function (aNumber){
  2872. var self=this;
  2873. return $core.withContext(function($ctx1) {
  2874. self._dayOfWeek_(aNumber);
  2875. return self;
  2876. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  2877. },
  2878. args: ["aNumber"],
  2879. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  2880. referencedClasses: [],
  2881. messageSends: ["dayOfWeek:"]
  2882. }),
  2883. $globals.Date);
  2884. $core.addMethod(
  2885. $core.method({
  2886. selector: "dayOfMonth",
  2887. protocol: 'accessing',
  2888. fn: function (){
  2889. var self=this;
  2890. return $core.withContext(function($ctx1) {
  2891. return self.getDate();
  2892. return self;
  2893. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  2894. },
  2895. args: [],
  2896. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  2897. referencedClasses: [],
  2898. messageSends: []
  2899. }),
  2900. $globals.Date);
  2901. $core.addMethod(
  2902. $core.method({
  2903. selector: "dayOfMonth:",
  2904. protocol: 'accessing',
  2905. fn: function (aNumber){
  2906. var self=this;
  2907. return $core.withContext(function($ctx1) {
  2908. self.setDate(aNumber);
  2909. return self;
  2910. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  2911. },
  2912. args: ["aNumber"],
  2913. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  2914. referencedClasses: [],
  2915. messageSends: []
  2916. }),
  2917. $globals.Date);
  2918. $core.addMethod(
  2919. $core.method({
  2920. selector: "dayOfWeek",
  2921. protocol: 'accessing',
  2922. fn: function (){
  2923. var self=this;
  2924. return $core.withContext(function($ctx1) {
  2925. return self.getDay() + 1;
  2926. return self;
  2927. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  2928. },
  2929. args: [],
  2930. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  2931. referencedClasses: [],
  2932. messageSends: []
  2933. }),
  2934. $globals.Date);
  2935. $core.addMethod(
  2936. $core.method({
  2937. selector: "dayOfWeek:",
  2938. protocol: 'accessing',
  2939. fn: function (aNumber){
  2940. var self=this;
  2941. return $core.withContext(function($ctx1) {
  2942. return self.setDay(aNumber - 1);
  2943. return self;
  2944. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  2945. },
  2946. args: ["aNumber"],
  2947. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  2948. referencedClasses: [],
  2949. messageSends: []
  2950. }),
  2951. $globals.Date);
  2952. $core.addMethod(
  2953. $core.method({
  2954. selector: "hours",
  2955. protocol: 'accessing',
  2956. fn: function (){
  2957. var self=this;
  2958. return $core.withContext(function($ctx1) {
  2959. return self.getHours();
  2960. return self;
  2961. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  2962. },
  2963. args: [],
  2964. source: "hours\x0a\x09<return self.getHours()>",
  2965. referencedClasses: [],
  2966. messageSends: []
  2967. }),
  2968. $globals.Date);
  2969. $core.addMethod(
  2970. $core.method({
  2971. selector: "hours:",
  2972. protocol: 'accessing',
  2973. fn: function (aNumber){
  2974. var self=this;
  2975. return $core.withContext(function($ctx1) {
  2976. self.setHours(aNumber);
  2977. return self;
  2978. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  2979. },
  2980. args: ["aNumber"],
  2981. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  2982. referencedClasses: [],
  2983. messageSends: []
  2984. }),
  2985. $globals.Date);
  2986. $core.addMethod(
  2987. $core.method({
  2988. selector: "milliseconds",
  2989. protocol: 'accessing',
  2990. fn: function (){
  2991. var self=this;
  2992. return $core.withContext(function($ctx1) {
  2993. return self.getMilliseconds();
  2994. return self;
  2995. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  2996. },
  2997. args: [],
  2998. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  2999. referencedClasses: [],
  3000. messageSends: []
  3001. }),
  3002. $globals.Date);
  3003. $core.addMethod(
  3004. $core.method({
  3005. selector: "milliseconds:",
  3006. protocol: 'accessing',
  3007. fn: function (aNumber){
  3008. var self=this;
  3009. return $core.withContext(function($ctx1) {
  3010. self.setMilliseconds(aNumber);
  3011. return self;
  3012. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  3013. },
  3014. args: ["aNumber"],
  3015. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  3016. referencedClasses: [],
  3017. messageSends: []
  3018. }),
  3019. $globals.Date);
  3020. $core.addMethod(
  3021. $core.method({
  3022. selector: "minutes",
  3023. protocol: 'accessing',
  3024. fn: function (){
  3025. var self=this;
  3026. return $core.withContext(function($ctx1) {
  3027. return self.getMinutes();
  3028. return self;
  3029. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  3030. },
  3031. args: [],
  3032. source: "minutes\x0a\x09<return self.getMinutes()>",
  3033. referencedClasses: [],
  3034. messageSends: []
  3035. }),
  3036. $globals.Date);
  3037. $core.addMethod(
  3038. $core.method({
  3039. selector: "minutes:",
  3040. protocol: 'accessing',
  3041. fn: function (aNumber){
  3042. var self=this;
  3043. return $core.withContext(function($ctx1) {
  3044. self.setMinutes(aNumber);
  3045. return self;
  3046. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  3047. },
  3048. args: ["aNumber"],
  3049. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  3050. referencedClasses: [],
  3051. messageSends: []
  3052. }),
  3053. $globals.Date);
  3054. $core.addMethod(
  3055. $core.method({
  3056. selector: "month",
  3057. protocol: 'accessing',
  3058. fn: function (){
  3059. var self=this;
  3060. return $core.withContext(function($ctx1) {
  3061. return self.getMonth() + 1;
  3062. return self;
  3063. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  3064. },
  3065. args: [],
  3066. source: "month\x0a\x09<return self.getMonth() + 1>",
  3067. referencedClasses: [],
  3068. messageSends: []
  3069. }),
  3070. $globals.Date);
  3071. $core.addMethod(
  3072. $core.method({
  3073. selector: "month:",
  3074. protocol: 'accessing',
  3075. fn: function (aNumber){
  3076. var self=this;
  3077. return $core.withContext(function($ctx1) {
  3078. self.setMonth(aNumber - 1);
  3079. return self;
  3080. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  3081. },
  3082. args: ["aNumber"],
  3083. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  3084. referencedClasses: [],
  3085. messageSends: []
  3086. }),
  3087. $globals.Date);
  3088. $core.addMethod(
  3089. $core.method({
  3090. selector: "printOn:",
  3091. protocol: 'printing',
  3092. fn: function (aStream){
  3093. var self=this;
  3094. return $core.withContext(function($ctx1) {
  3095. $recv(aStream)._nextPutAll_(self._asString());
  3096. return self;
  3097. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  3098. },
  3099. args: ["aStream"],
  3100. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3101. referencedClasses: [],
  3102. messageSends: ["nextPutAll:", "asString"]
  3103. }),
  3104. $globals.Date);
  3105. $core.addMethod(
  3106. $core.method({
  3107. selector: "seconds",
  3108. protocol: 'accessing',
  3109. fn: function (){
  3110. var self=this;
  3111. return $core.withContext(function($ctx1) {
  3112. return self.getSeconds();
  3113. return self;
  3114. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  3115. },
  3116. args: [],
  3117. source: "seconds\x0a\x09<return self.getSeconds()>",
  3118. referencedClasses: [],
  3119. messageSends: []
  3120. }),
  3121. $globals.Date);
  3122. $core.addMethod(
  3123. $core.method({
  3124. selector: "seconds:",
  3125. protocol: 'accessing',
  3126. fn: function (aNumber){
  3127. var self=this;
  3128. return $core.withContext(function($ctx1) {
  3129. self.setSeconds(aNumber);
  3130. return self;
  3131. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  3132. },
  3133. args: ["aNumber"],
  3134. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  3135. referencedClasses: [],
  3136. messageSends: []
  3137. }),
  3138. $globals.Date);
  3139. $core.addMethod(
  3140. $core.method({
  3141. selector: "time",
  3142. protocol: 'accessing',
  3143. fn: function (){
  3144. var self=this;
  3145. return $core.withContext(function($ctx1) {
  3146. return self.getTime();
  3147. return self;
  3148. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  3149. },
  3150. args: [],
  3151. source: "time\x0a\x09<return self.getTime()>",
  3152. referencedClasses: [],
  3153. messageSends: []
  3154. }),
  3155. $globals.Date);
  3156. $core.addMethod(
  3157. $core.method({
  3158. selector: "time:",
  3159. protocol: 'accessing',
  3160. fn: function (aNumber){
  3161. var self=this;
  3162. return $core.withContext(function($ctx1) {
  3163. self.setTime(aNumber);
  3164. return self;
  3165. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  3166. },
  3167. args: ["aNumber"],
  3168. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  3169. referencedClasses: [],
  3170. messageSends: []
  3171. }),
  3172. $globals.Date);
  3173. $core.addMethod(
  3174. $core.method({
  3175. selector: "year",
  3176. protocol: 'accessing',
  3177. fn: function (){
  3178. var self=this;
  3179. return $core.withContext(function($ctx1) {
  3180. return self.getFullYear();
  3181. return self;
  3182. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  3183. },
  3184. args: [],
  3185. source: "year\x0a\x09<return self.getFullYear()>",
  3186. referencedClasses: [],
  3187. messageSends: []
  3188. }),
  3189. $globals.Date);
  3190. $core.addMethod(
  3191. $core.method({
  3192. selector: "year:",
  3193. protocol: 'accessing',
  3194. fn: function (aNumber){
  3195. var self=this;
  3196. return $core.withContext(function($ctx1) {
  3197. self.setFullYear(aNumber);
  3198. return self;
  3199. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  3200. },
  3201. args: ["aNumber"],
  3202. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  3203. referencedClasses: [],
  3204. messageSends: []
  3205. }),
  3206. $globals.Date);
  3207. $core.addMethod(
  3208. $core.method({
  3209. selector: "classTag",
  3210. protocol: 'accessing',
  3211. fn: function (){
  3212. var self=this;
  3213. return "magnitude";
  3214. },
  3215. args: [],
  3216. 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'",
  3217. referencedClasses: [],
  3218. messageSends: []
  3219. }),
  3220. $globals.Date.klass);
  3221. $core.addMethod(
  3222. $core.method({
  3223. selector: "fromMilliseconds:",
  3224. protocol: 'instance creation',
  3225. fn: function (aNumber){
  3226. var self=this;
  3227. return $core.withContext(function($ctx1) {
  3228. return self._new_(aNumber);
  3229. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.klass)});
  3230. },
  3231. args: ["aNumber"],
  3232. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  3233. referencedClasses: [],
  3234. messageSends: ["new:"]
  3235. }),
  3236. $globals.Date.klass);
  3237. $core.addMethod(
  3238. $core.method({
  3239. selector: "fromSeconds:",
  3240. protocol: 'instance creation',
  3241. fn: function (aNumber){
  3242. var self=this;
  3243. return $core.withContext(function($ctx1) {
  3244. return self._fromMilliseconds_($recv(aNumber).__star((1000)));
  3245. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.klass)});
  3246. },
  3247. args: ["aNumber"],
  3248. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  3249. referencedClasses: [],
  3250. messageSends: ["fromMilliseconds:", "*"]
  3251. }),
  3252. $globals.Date.klass);
  3253. $core.addMethod(
  3254. $core.method({
  3255. selector: "fromString:",
  3256. protocol: 'instance creation',
  3257. fn: function (aString){
  3258. var self=this;
  3259. return $core.withContext(function($ctx1) {
  3260. return self._new_(aString);
  3261. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.klass)});
  3262. },
  3263. args: ["aString"],
  3264. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  3265. referencedClasses: [],
  3266. messageSends: ["new:"]
  3267. }),
  3268. $globals.Date.klass);
  3269. $core.addMethod(
  3270. $core.method({
  3271. selector: "millisecondsToRun:",
  3272. protocol: 'instance creation',
  3273. fn: function (aBlock){
  3274. var self=this;
  3275. var t;
  3276. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  3277. return $core.withContext(function($ctx1) {
  3278. t=$recv($Date())._now();
  3279. $ctx1.sendIdx["now"]=1;
  3280. $recv(aBlock)._value();
  3281. return $recv($recv($Date())._now()).__minus(t);
  3282. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.klass)});
  3283. },
  3284. args: ["aBlock"],
  3285. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  3286. referencedClasses: ["Date"],
  3287. messageSends: ["now", "value", "-"]
  3288. }),
  3289. $globals.Date.klass);
  3290. $core.addMethod(
  3291. $core.method({
  3292. selector: "new:",
  3293. protocol: 'instance creation',
  3294. fn: function (anObject){
  3295. var self=this;
  3296. return $core.withContext(function($ctx1) {
  3297. return new Date(anObject);
  3298. return self;
  3299. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.klass)});
  3300. },
  3301. args: ["anObject"],
  3302. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  3303. referencedClasses: [],
  3304. messageSends: []
  3305. }),
  3306. $globals.Date.klass);
  3307. $core.addMethod(
  3308. $core.method({
  3309. selector: "now",
  3310. protocol: 'instance creation',
  3311. fn: function (){
  3312. var self=this;
  3313. return $core.withContext(function($ctx1) {
  3314. return self._today();
  3315. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.klass)});
  3316. },
  3317. args: [],
  3318. source: "now\x0a\x09^ self today",
  3319. referencedClasses: [],
  3320. messageSends: ["today"]
  3321. }),
  3322. $globals.Date.klass);
  3323. $core.addMethod(
  3324. $core.method({
  3325. selector: "today",
  3326. protocol: 'instance creation',
  3327. fn: function (){
  3328. var self=this;
  3329. return $core.withContext(function($ctx1) {
  3330. return self._new();
  3331. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.klass)});
  3332. },
  3333. args: [],
  3334. source: "today\x0a\x09^ self new",
  3335. referencedClasses: [],
  3336. messageSends: ["new"]
  3337. }),
  3338. $globals.Date.klass);
  3339. $core.addClass('Number', $globals.Object, [], 'Kernel-Objects');
  3340. $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 ].";
  3341. $core.addMethod(
  3342. $core.method({
  3343. selector: "&",
  3344. protocol: 'converting',
  3345. fn: function (aNumber){
  3346. var self=this;
  3347. return $core.withContext(function($ctx1) {
  3348. return self & aNumber;
  3349. return self;
  3350. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  3351. },
  3352. args: ["aNumber"],
  3353. source: "& aNumber\x0a\x09<return self & aNumber>",
  3354. referencedClasses: [],
  3355. messageSends: []
  3356. }),
  3357. $globals.Number);
  3358. $core.addMethod(
  3359. $core.method({
  3360. selector: "*",
  3361. protocol: 'arithmetic',
  3362. fn: function (aNumber){
  3363. var self=this;
  3364. return $core.withContext(function($ctx1) {
  3365. return self * aNumber;
  3366. return self;
  3367. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  3368. },
  3369. args: ["aNumber"],
  3370. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  3371. referencedClasses: [],
  3372. messageSends: []
  3373. }),
  3374. $globals.Number);
  3375. $core.addMethod(
  3376. $core.method({
  3377. selector: "**",
  3378. protocol: 'mathematical functions',
  3379. fn: function (exponent){
  3380. var self=this;
  3381. return $core.withContext(function($ctx1) {
  3382. return self._raisedTo_(exponent);
  3383. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  3384. },
  3385. args: ["exponent"],
  3386. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  3387. referencedClasses: [],
  3388. messageSends: ["raisedTo:"]
  3389. }),
  3390. $globals.Number);
  3391. $core.addMethod(
  3392. $core.method({
  3393. selector: "+",
  3394. protocol: 'arithmetic',
  3395. fn: function (aNumber){
  3396. var self=this;
  3397. return $core.withContext(function($ctx1) {
  3398. return self + aNumber;
  3399. return self;
  3400. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  3401. },
  3402. args: ["aNumber"],
  3403. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  3404. referencedClasses: [],
  3405. messageSends: []
  3406. }),
  3407. $globals.Number);
  3408. $core.addMethod(
  3409. $core.method({
  3410. selector: "-",
  3411. protocol: 'arithmetic',
  3412. fn: function (aNumber){
  3413. var self=this;
  3414. return $core.withContext(function($ctx1) {
  3415. return self - aNumber;
  3416. return self;
  3417. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  3418. },
  3419. args: ["aNumber"],
  3420. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  3421. referencedClasses: [],
  3422. messageSends: []
  3423. }),
  3424. $globals.Number);
  3425. $core.addMethod(
  3426. $core.method({
  3427. selector: "/",
  3428. protocol: 'arithmetic',
  3429. fn: function (aNumber){
  3430. var self=this;
  3431. return $core.withContext(function($ctx1) {
  3432. return self / aNumber;
  3433. return self;
  3434. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  3435. },
  3436. args: ["aNumber"],
  3437. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  3438. referencedClasses: [],
  3439. messageSends: []
  3440. }),
  3441. $globals.Number);
  3442. $core.addMethod(
  3443. $core.method({
  3444. selector: "//",
  3445. protocol: 'arithmetic',
  3446. fn: function (aNumber){
  3447. var self=this;
  3448. return $core.withContext(function($ctx1) {
  3449. return $recv(self.__slash(aNumber))._floor();
  3450. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  3451. },
  3452. args: ["aNumber"],
  3453. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  3454. referencedClasses: [],
  3455. messageSends: ["floor", "/"]
  3456. }),
  3457. $globals.Number);
  3458. $core.addMethod(
  3459. $core.method({
  3460. selector: "<",
  3461. protocol: 'comparing',
  3462. fn: function (aNumber){
  3463. var self=this;
  3464. return $core.withContext(function($ctx1) {
  3465. return self < aNumber;
  3466. return self;
  3467. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  3468. },
  3469. args: ["aNumber"],
  3470. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  3471. referencedClasses: [],
  3472. messageSends: []
  3473. }),
  3474. $globals.Number);
  3475. $core.addMethod(
  3476. $core.method({
  3477. selector: "<=",
  3478. protocol: 'comparing',
  3479. fn: function (aNumber){
  3480. var self=this;
  3481. return $core.withContext(function($ctx1) {
  3482. return self <= aNumber;
  3483. return self;
  3484. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  3485. },
  3486. args: ["aNumber"],
  3487. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  3488. referencedClasses: [],
  3489. messageSends: []
  3490. }),
  3491. $globals.Number);
  3492. $core.addMethod(
  3493. $core.method({
  3494. selector: "==",
  3495. protocol: 'comparing',
  3496. fn: function (aNumber){
  3497. var self=this;
  3498. return $core.withContext(function($ctx1) {
  3499. if (typeof aNumber === "number") return Number(self) === aNumber;
  3500. else if (aNumber != null && typeof aNumber === "object") return Number(self) === aNumber.valueOf();
  3501. else return false;;
  3502. return self;
  3503. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  3504. },
  3505. args: ["aNumber"],
  3506. source: "== aNumber\x0a<\x0a\x09if (typeof aNumber === \x22number\x22) return Number(self) === aNumber;\x0a\x09else if (aNumber != null && typeof aNumber === \x22object\x22) return Number(self) === aNumber.valueOf();\x0a\x09else return false;\x0a>",
  3507. referencedClasses: [],
  3508. messageSends: []
  3509. }),
  3510. $globals.Number);
  3511. $core.addMethod(
  3512. $core.method({
  3513. selector: ">",
  3514. protocol: 'comparing',
  3515. fn: function (aNumber){
  3516. var self=this;
  3517. return $core.withContext(function($ctx1) {
  3518. return self > aNumber;
  3519. return self;
  3520. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  3521. },
  3522. args: ["aNumber"],
  3523. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  3524. referencedClasses: [],
  3525. messageSends: []
  3526. }),
  3527. $globals.Number);
  3528. $core.addMethod(
  3529. $core.method({
  3530. selector: ">=",
  3531. protocol: 'comparing',
  3532. fn: function (aNumber){
  3533. var self=this;
  3534. return $core.withContext(function($ctx1) {
  3535. return self >= aNumber;
  3536. return self;
  3537. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  3538. },
  3539. args: ["aNumber"],
  3540. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  3541. referencedClasses: [],
  3542. messageSends: []
  3543. }),
  3544. $globals.Number);
  3545. $core.addMethod(
  3546. $core.method({
  3547. selector: "@",
  3548. protocol: 'converting',
  3549. fn: function (aNumber){
  3550. var self=this;
  3551. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  3552. return $core.withContext(function($ctx1) {
  3553. return $recv($Point())._x_y_(self,aNumber);
  3554. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  3555. },
  3556. args: ["aNumber"],
  3557. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  3558. referencedClasses: ["Point"],
  3559. messageSends: ["x:y:"]
  3560. }),
  3561. $globals.Number);
  3562. $core.addMethod(
  3563. $core.method({
  3564. selector: "\x5c\x5c",
  3565. protocol: 'arithmetic',
  3566. fn: function (aNumber){
  3567. var self=this;
  3568. return $core.withContext(function($ctx1) {
  3569. return self % aNumber;
  3570. return self;
  3571. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  3572. },
  3573. args: ["aNumber"],
  3574. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  3575. referencedClasses: [],
  3576. messageSends: []
  3577. }),
  3578. $globals.Number);
  3579. $core.addMethod(
  3580. $core.method({
  3581. selector: "abs",
  3582. protocol: 'arithmetic',
  3583. fn: function (){
  3584. var self=this;
  3585. return $core.withContext(function($ctx1) {
  3586. return Math.abs(self);;
  3587. return self;
  3588. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  3589. },
  3590. args: [],
  3591. source: "abs\x0a\x09<return Math.abs(self);>",
  3592. referencedClasses: [],
  3593. messageSends: []
  3594. }),
  3595. $globals.Number);
  3596. $core.addMethod(
  3597. $core.method({
  3598. selector: "arcCos",
  3599. protocol: 'mathematical functions',
  3600. fn: function (){
  3601. var self=this;
  3602. return $core.withContext(function($ctx1) {
  3603. return Math.acos(self);;
  3604. return self;
  3605. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  3606. },
  3607. args: [],
  3608. source: "arcCos\x0a\x09<return Math.acos(self);>",
  3609. referencedClasses: [],
  3610. messageSends: []
  3611. }),
  3612. $globals.Number);
  3613. $core.addMethod(
  3614. $core.method({
  3615. selector: "arcSin",
  3616. protocol: 'mathematical functions',
  3617. fn: function (){
  3618. var self=this;
  3619. return $core.withContext(function($ctx1) {
  3620. return Math.asin(self);;
  3621. return self;
  3622. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  3623. },
  3624. args: [],
  3625. source: "arcSin\x0a\x09<return Math.asin(self);>",
  3626. referencedClasses: [],
  3627. messageSends: []
  3628. }),
  3629. $globals.Number);
  3630. $core.addMethod(
  3631. $core.method({
  3632. selector: "arcTan",
  3633. protocol: 'mathematical functions',
  3634. fn: function (){
  3635. var self=this;
  3636. return $core.withContext(function($ctx1) {
  3637. return Math.atan(self);;
  3638. return self;
  3639. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  3640. },
  3641. args: [],
  3642. source: "arcTan\x0a\x09<return Math.atan(self);>",
  3643. referencedClasses: [],
  3644. messageSends: []
  3645. }),
  3646. $globals.Number);
  3647. $core.addMethod(
  3648. $core.method({
  3649. selector: "asJSON",
  3650. protocol: 'converting',
  3651. fn: function (){
  3652. var self=this;
  3653. return self;
  3654. },
  3655. args: [],
  3656. source: "asJSON\x0a\x09^ self",
  3657. referencedClasses: [],
  3658. messageSends: []
  3659. }),
  3660. $globals.Number);
  3661. $core.addMethod(
  3662. $core.method({
  3663. selector: "asJavascript",
  3664. protocol: 'converting',
  3665. fn: function (){
  3666. var self=this;
  3667. return $core.withContext(function($ctx1) {
  3668. var $1;
  3669. $1=$recv("(".__comma(self._printString())).__comma(")");
  3670. $ctx1.sendIdx[","]=1;
  3671. return $1;
  3672. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Number)});
  3673. },
  3674. args: [],
  3675. source: "asJavascript\x0a\x09^ '(', self printString, ')'",
  3676. referencedClasses: [],
  3677. messageSends: [",", "printString"]
  3678. }),
  3679. $globals.Number);
  3680. $core.addMethod(
  3681. $core.method({
  3682. selector: "asNumber",
  3683. protocol: 'converting',
  3684. fn: function (){
  3685. var self=this;
  3686. return self;
  3687. },
  3688. args: [],
  3689. source: "asNumber\x0a\x09^ self",
  3690. referencedClasses: [],
  3691. messageSends: []
  3692. }),
  3693. $globals.Number);
  3694. $core.addMethod(
  3695. $core.method({
  3696. selector: "asPoint",
  3697. protocol: 'converting',
  3698. fn: function (){
  3699. var self=this;
  3700. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  3701. return $core.withContext(function($ctx1) {
  3702. return $recv($Point())._x_y_(self,self);
  3703. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  3704. },
  3705. args: [],
  3706. source: "asPoint\x0a\x09^ Point x: self y: self",
  3707. referencedClasses: ["Point"],
  3708. messageSends: ["x:y:"]
  3709. }),
  3710. $globals.Number);
  3711. $core.addMethod(
  3712. $core.method({
  3713. selector: "asString",
  3714. protocol: 'converting',
  3715. fn: function (){
  3716. var self=this;
  3717. return $core.withContext(function($ctx1) {
  3718. return String(self) ;
  3719. return self;
  3720. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  3721. },
  3722. args: [],
  3723. source: "asString\x0a\x09< return String(self) >",
  3724. referencedClasses: [],
  3725. messageSends: []
  3726. }),
  3727. $globals.Number);
  3728. $core.addMethod(
  3729. $core.method({
  3730. selector: "atRandom",
  3731. protocol: 'converting',
  3732. fn: function (){
  3733. var self=this;
  3734. function $Random(){return $globals.Random||(typeof Random=="undefined"?nil:Random)}
  3735. return $core.withContext(function($ctx1) {
  3736. return $recv($recv($recv($recv($recv($Random())._new())._next()).__star(self))._truncated()).__plus((1));
  3737. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  3738. },
  3739. args: [],
  3740. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  3741. referencedClasses: ["Random"],
  3742. messageSends: ["+", "truncated", "*", "next", "new"]
  3743. }),
  3744. $globals.Number);
  3745. $core.addMethod(
  3746. $core.method({
  3747. selector: "ceiling",
  3748. protocol: 'converting',
  3749. fn: function (){
  3750. var self=this;
  3751. return $core.withContext(function($ctx1) {
  3752. return Math.ceil(self);;
  3753. return self;
  3754. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  3755. },
  3756. args: [],
  3757. source: "ceiling\x0a\x09<return Math.ceil(self);>",
  3758. referencedClasses: [],
  3759. messageSends: []
  3760. }),
  3761. $globals.Number);
  3762. $core.addMethod(
  3763. $core.method({
  3764. selector: "copy",
  3765. protocol: 'copying',
  3766. fn: function (){
  3767. var self=this;
  3768. return self;
  3769. },
  3770. args: [],
  3771. source: "copy\x0a\x09^ self",
  3772. referencedClasses: [],
  3773. messageSends: []
  3774. }),
  3775. $globals.Number);
  3776. $core.addMethod(
  3777. $core.method({
  3778. selector: "cos",
  3779. protocol: 'mathematical functions',
  3780. fn: function (){
  3781. var self=this;
  3782. return $core.withContext(function($ctx1) {
  3783. return Math.cos(self);;
  3784. return self;
  3785. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  3786. },
  3787. args: [],
  3788. source: "cos\x0a\x09<return Math.cos(self);>",
  3789. referencedClasses: [],
  3790. messageSends: []
  3791. }),
  3792. $globals.Number);
  3793. $core.addMethod(
  3794. $core.method({
  3795. selector: "deepCopy",
  3796. protocol: 'copying',
  3797. fn: function (){
  3798. var self=this;
  3799. return $core.withContext(function($ctx1) {
  3800. return self._copy();
  3801. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  3802. },
  3803. args: [],
  3804. source: "deepCopy\x0a\x09^ self copy",
  3805. referencedClasses: [],
  3806. messageSends: ["copy"]
  3807. }),
  3808. $globals.Number);
  3809. $core.addMethod(
  3810. $core.method({
  3811. selector: "even",
  3812. protocol: 'testing',
  3813. fn: function (){
  3814. var self=this;
  3815. return $core.withContext(function($ctx1) {
  3816. return (0).__eq(self.__backslash_backslash((2)));
  3817. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  3818. },
  3819. args: [],
  3820. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  3821. referencedClasses: [],
  3822. messageSends: ["=", "\x5c\x5c"]
  3823. }),
  3824. $globals.Number);
  3825. $core.addMethod(
  3826. $core.method({
  3827. selector: "floor",
  3828. protocol: 'converting',
  3829. fn: function (){
  3830. var self=this;
  3831. return $core.withContext(function($ctx1) {
  3832. return Math.floor(self);;
  3833. return self;
  3834. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  3835. },
  3836. args: [],
  3837. source: "floor\x0a\x09<return Math.floor(self);>",
  3838. referencedClasses: [],
  3839. messageSends: []
  3840. }),
  3841. $globals.Number);
  3842. $core.addMethod(
  3843. $core.method({
  3844. selector: "isImmutable",
  3845. protocol: 'testing',
  3846. fn: function (){
  3847. var self=this;
  3848. return true;
  3849. },
  3850. args: [],
  3851. source: "isImmutable\x0a\x09^ true",
  3852. referencedClasses: [],
  3853. messageSends: []
  3854. }),
  3855. $globals.Number);
  3856. $core.addMethod(
  3857. $core.method({
  3858. selector: "isNumber",
  3859. protocol: 'testing',
  3860. fn: function (){
  3861. var self=this;
  3862. return true;
  3863. },
  3864. args: [],
  3865. source: "isNumber\x0a\x09^ true",
  3866. referencedClasses: [],
  3867. messageSends: []
  3868. }),
  3869. $globals.Number);
  3870. $core.addMethod(
  3871. $core.method({
  3872. selector: "isZero",
  3873. protocol: 'testing',
  3874. fn: function (){
  3875. var self=this;
  3876. return $core.withContext(function($ctx1) {
  3877. return self.__eq((0));
  3878. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  3879. },
  3880. args: [],
  3881. source: "isZero\x0a\x09^ self = 0",
  3882. referencedClasses: [],
  3883. messageSends: ["="]
  3884. }),
  3885. $globals.Number);
  3886. $core.addMethod(
  3887. $core.method({
  3888. selector: "ln",
  3889. protocol: 'mathematical functions',
  3890. fn: function (){
  3891. var self=this;
  3892. return $core.withContext(function($ctx1) {
  3893. return Math.log(self);;
  3894. return self;
  3895. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  3896. },
  3897. args: [],
  3898. source: "ln\x0a\x09<return Math.log(self);>",
  3899. referencedClasses: [],
  3900. messageSends: []
  3901. }),
  3902. $globals.Number);
  3903. $core.addMethod(
  3904. $core.method({
  3905. selector: "log",
  3906. protocol: 'mathematical functions',
  3907. fn: function (){
  3908. var self=this;
  3909. return $core.withContext(function($ctx1) {
  3910. return Math.log(self) / Math.LN10;;
  3911. return self;
  3912. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  3913. },
  3914. args: [],
  3915. source: "log\x0a\x09<return Math.log(self) / Math.LN10;>",
  3916. referencedClasses: [],
  3917. messageSends: []
  3918. }),
  3919. $globals.Number);
  3920. $core.addMethod(
  3921. $core.method({
  3922. selector: "log:",
  3923. protocol: 'mathematical functions',
  3924. fn: function (aNumber){
  3925. var self=this;
  3926. return $core.withContext(function($ctx1) {
  3927. return Math.log(self) / Math.log(aNumber);;
  3928. return self;
  3929. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  3930. },
  3931. args: ["aNumber"],
  3932. source: "log: aNumber\x0a\x09<return Math.log(self) / Math.log(aNumber);>",
  3933. referencedClasses: [],
  3934. messageSends: []
  3935. }),
  3936. $globals.Number);
  3937. $core.addMethod(
  3938. $core.method({
  3939. selector: "max:",
  3940. protocol: 'arithmetic',
  3941. fn: function (aNumber){
  3942. var self=this;
  3943. return $core.withContext(function($ctx1) {
  3944. return Math.max(self, aNumber);;
  3945. return self;
  3946. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  3947. },
  3948. args: ["aNumber"],
  3949. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  3950. referencedClasses: [],
  3951. messageSends: []
  3952. }),
  3953. $globals.Number);
  3954. $core.addMethod(
  3955. $core.method({
  3956. selector: "min:",
  3957. protocol: 'arithmetic',
  3958. fn: function (aNumber){
  3959. var self=this;
  3960. return $core.withContext(function($ctx1) {
  3961. return Math.min(self, aNumber);;
  3962. return self;
  3963. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  3964. },
  3965. args: ["aNumber"],
  3966. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  3967. referencedClasses: [],
  3968. messageSends: []
  3969. }),
  3970. $globals.Number);
  3971. $core.addMethod(
  3972. $core.method({
  3973. selector: "negated",
  3974. protocol: 'arithmetic',
  3975. fn: function (){
  3976. var self=this;
  3977. return $core.withContext(function($ctx1) {
  3978. return (0).__minus(self);
  3979. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  3980. },
  3981. args: [],
  3982. source: "negated\x0a\x09^ 0 - self",
  3983. referencedClasses: [],
  3984. messageSends: ["-"]
  3985. }),
  3986. $globals.Number);
  3987. $core.addMethod(
  3988. $core.method({
  3989. selector: "negative",
  3990. protocol: 'testing',
  3991. fn: function (){
  3992. var self=this;
  3993. return $core.withContext(function($ctx1) {
  3994. return self.__lt((0));
  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. return $recv(self._even())._not();
  4011. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  4012. },
  4013. args: [],
  4014. source: "odd\x0a\x09^ self even not",
  4015. referencedClasses: [],
  4016. messageSends: ["not", "even"]
  4017. }),
  4018. $globals.Number);
  4019. $core.addMethod(
  4020. $core.method({
  4021. selector: "positive",
  4022. protocol: 'testing',
  4023. fn: function (){
  4024. var self=this;
  4025. return $core.withContext(function($ctx1) {
  4026. return self.__gt_eq((0));
  4027. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  4028. },
  4029. args: [],
  4030. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  4031. referencedClasses: [],
  4032. messageSends: [">="]
  4033. }),
  4034. $globals.Number);
  4035. $core.addMethod(
  4036. $core.method({
  4037. selector: "printOn:",
  4038. protocol: 'printing',
  4039. fn: function (aStream){
  4040. var self=this;
  4041. return $core.withContext(function($ctx1) {
  4042. $recv(aStream)._nextPutAll_(self._asString());
  4043. return self;
  4044. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  4045. },
  4046. args: ["aStream"],
  4047. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4048. referencedClasses: [],
  4049. messageSends: ["nextPutAll:", "asString"]
  4050. }),
  4051. $globals.Number);
  4052. $core.addMethod(
  4053. $core.method({
  4054. selector: "printShowingDecimalPlaces:",
  4055. protocol: 'printing',
  4056. fn: function (placesDesired){
  4057. var self=this;
  4058. return $core.withContext(function($ctx1) {
  4059. return self.toFixed(placesDesired);
  4060. return self;
  4061. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  4062. },
  4063. args: ["placesDesired"],
  4064. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  4065. referencedClasses: [],
  4066. messageSends: []
  4067. }),
  4068. $globals.Number);
  4069. $core.addMethod(
  4070. $core.method({
  4071. selector: "raisedTo:",
  4072. protocol: 'mathematical functions',
  4073. fn: function (exponent){
  4074. var self=this;
  4075. return $core.withContext(function($ctx1) {
  4076. return Math.pow(self, exponent);;
  4077. return self;
  4078. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  4079. },
  4080. args: ["exponent"],
  4081. source: "raisedTo: exponent\x0a\x09<return Math.pow(self, exponent);>",
  4082. referencedClasses: [],
  4083. messageSends: []
  4084. }),
  4085. $globals.Number);
  4086. $core.addMethod(
  4087. $core.method({
  4088. selector: "rounded",
  4089. protocol: 'converting',
  4090. fn: function (){
  4091. var self=this;
  4092. return $core.withContext(function($ctx1) {
  4093. return Math.round(self);;
  4094. return self;
  4095. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  4096. },
  4097. args: [],
  4098. source: "rounded\x0a\x09<return Math.round(self);>",
  4099. referencedClasses: [],
  4100. messageSends: []
  4101. }),
  4102. $globals.Number);
  4103. $core.addMethod(
  4104. $core.method({
  4105. selector: "sign",
  4106. protocol: 'mathematical functions',
  4107. fn: function (){
  4108. var self=this;
  4109. return $core.withContext(function($ctx1) {
  4110. var $1,$2;
  4111. $1=self._isZero();
  4112. if($core.assert($1)){
  4113. return (0);
  4114. };
  4115. $2=self._positive();
  4116. if($core.assert($2)){
  4117. return (1);
  4118. } else {
  4119. return (-1);
  4120. };
  4121. return self;
  4122. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  4123. },
  4124. args: [],
  4125. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  4126. referencedClasses: [],
  4127. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  4128. }),
  4129. $globals.Number);
  4130. $core.addMethod(
  4131. $core.method({
  4132. selector: "sin",
  4133. protocol: 'mathematical functions',
  4134. fn: function (){
  4135. var self=this;
  4136. return $core.withContext(function($ctx1) {
  4137. return Math.sin(self);;
  4138. return self;
  4139. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  4140. },
  4141. args: [],
  4142. source: "sin\x0a\x09<return Math.sin(self);>",
  4143. referencedClasses: [],
  4144. messageSends: []
  4145. }),
  4146. $globals.Number);
  4147. $core.addMethod(
  4148. $core.method({
  4149. selector: "sqrt",
  4150. protocol: 'mathematical functions',
  4151. fn: function (){
  4152. var self=this;
  4153. return $core.withContext(function($ctx1) {
  4154. return Math.sqrt(self);
  4155. return self;
  4156. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  4157. },
  4158. args: [],
  4159. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  4160. referencedClasses: [],
  4161. messageSends: []
  4162. }),
  4163. $globals.Number);
  4164. $core.addMethod(
  4165. $core.method({
  4166. selector: "squared",
  4167. protocol: 'mathematical functions',
  4168. fn: function (){
  4169. var self=this;
  4170. return $core.withContext(function($ctx1) {
  4171. return self.__star(self);
  4172. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  4173. },
  4174. args: [],
  4175. source: "squared\x0a\x09^ self * self",
  4176. referencedClasses: [],
  4177. messageSends: ["*"]
  4178. }),
  4179. $globals.Number);
  4180. $core.addMethod(
  4181. $core.method({
  4182. selector: "tan",
  4183. protocol: 'mathematical functions',
  4184. fn: function (){
  4185. var self=this;
  4186. return $core.withContext(function($ctx1) {
  4187. return Math.tan(self);;
  4188. return self;
  4189. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  4190. },
  4191. args: [],
  4192. source: "tan\x0a\x09<return Math.tan(self);>",
  4193. referencedClasses: [],
  4194. messageSends: []
  4195. }),
  4196. $globals.Number);
  4197. $core.addMethod(
  4198. $core.method({
  4199. selector: "timesRepeat:",
  4200. protocol: 'enumerating',
  4201. fn: function (aBlock){
  4202. var self=this;
  4203. var count;
  4204. return $core.withContext(function($ctx1) {
  4205. count=(1);
  4206. $recv((function(){
  4207. return $core.withContext(function($ctx2) {
  4208. return $recv(count).__gt(self);
  4209. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4210. }))._whileFalse_((function(){
  4211. return $core.withContext(function($ctx2) {
  4212. $recv(aBlock)._value();
  4213. count=$recv(count).__plus((1));
  4214. return count;
  4215. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4216. }));
  4217. return self;
  4218. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  4219. },
  4220. args: ["aBlock"],
  4221. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  4222. referencedClasses: [],
  4223. messageSends: ["whileFalse:", ">", "value", "+"]
  4224. }),
  4225. $globals.Number);
  4226. $core.addMethod(
  4227. $core.method({
  4228. selector: "to:",
  4229. protocol: 'converting',
  4230. fn: function (aNumber){
  4231. var self=this;
  4232. var array,first,last,count;
  4233. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  4234. return $core.withContext(function($ctx1) {
  4235. first=self._truncated();
  4236. $ctx1.sendIdx["truncated"]=1;
  4237. last=$recv($recv(aNumber)._truncated()).__plus((1));
  4238. $ctx1.sendIdx["+"]=1;
  4239. count=(1);
  4240. array=$recv($Array())._new();
  4241. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  4242. return $core.withContext(function($ctx2) {
  4243. $recv(array)._at_put_(count,first);
  4244. count=$recv(count).__plus((1));
  4245. $ctx2.sendIdx["+"]=2;
  4246. count;
  4247. first=$recv(first).__plus((1));
  4248. return first;
  4249. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4250. }));
  4251. return array;
  4252. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  4253. },
  4254. args: ["aNumber"],
  4255. 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",
  4256. referencedClasses: ["Array"],
  4257. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  4258. }),
  4259. $globals.Number);
  4260. $core.addMethod(
  4261. $core.method({
  4262. selector: "to:by:",
  4263. protocol: 'converting',
  4264. fn: function (stop,step){
  4265. var self=this;
  4266. var array,value,pos;
  4267. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  4268. return $core.withContext(function($ctx1) {
  4269. var $1,$2;
  4270. value=self;
  4271. array=$recv($Array())._new();
  4272. pos=(1);
  4273. $1=$recv(step).__eq((0));
  4274. if($core.assert($1)){
  4275. self._error_("step must be non-zero");
  4276. };
  4277. $2=$recv(step).__lt((0));
  4278. if($core.assert($2)){
  4279. $recv((function(){
  4280. return $core.withContext(function($ctx2) {
  4281. return $recv(value).__gt_eq(stop);
  4282. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  4283. }))._whileTrue_((function(){
  4284. return $core.withContext(function($ctx2) {
  4285. $recv(array)._at_put_(pos,value);
  4286. $ctx2.sendIdx["at:put:"]=1;
  4287. pos=$recv(pos).__plus((1));
  4288. $ctx2.sendIdx["+"]=1;
  4289. pos;
  4290. value=$recv(value).__plus(step);
  4291. $ctx2.sendIdx["+"]=2;
  4292. return value;
  4293. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  4294. }));
  4295. $ctx1.sendIdx["whileTrue:"]=1;
  4296. } else {
  4297. $recv((function(){
  4298. return $core.withContext(function($ctx2) {
  4299. return $recv(value).__lt_eq(stop);
  4300. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  4301. }))._whileTrue_((function(){
  4302. return $core.withContext(function($ctx2) {
  4303. $recv(array)._at_put_(pos,value);
  4304. pos=$recv(pos).__plus((1));
  4305. $ctx2.sendIdx["+"]=3;
  4306. pos;
  4307. value=$recv(value).__plus(step);
  4308. return value;
  4309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  4310. }));
  4311. };
  4312. return array;
  4313. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  4314. },
  4315. args: ["stop", "step"],
  4316. 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",
  4317. referencedClasses: ["Array"],
  4318. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  4319. }),
  4320. $globals.Number);
  4321. $core.addMethod(
  4322. $core.method({
  4323. selector: "to:by:do:",
  4324. protocol: 'enumerating',
  4325. fn: function (stop,step,aBlock){
  4326. var self=this;
  4327. var value;
  4328. return $core.withContext(function($ctx1) {
  4329. var $1,$2;
  4330. value=self;
  4331. $1=$recv(step).__eq((0));
  4332. if($core.assert($1)){
  4333. self._error_("step must be non-zero");
  4334. };
  4335. $2=$recv(step).__lt((0));
  4336. if($core.assert($2)){
  4337. $recv((function(){
  4338. return $core.withContext(function($ctx2) {
  4339. return $recv(value).__gt_eq(stop);
  4340. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  4341. }))._whileTrue_((function(){
  4342. return $core.withContext(function($ctx2) {
  4343. $recv(aBlock)._value_(value);
  4344. $ctx2.sendIdx["value:"]=1;
  4345. value=$recv(value).__plus(step);
  4346. $ctx2.sendIdx["+"]=1;
  4347. return value;
  4348. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  4349. }));
  4350. $ctx1.sendIdx["whileTrue:"]=1;
  4351. } else {
  4352. $recv((function(){
  4353. return $core.withContext(function($ctx2) {
  4354. return $recv(value).__lt_eq(stop);
  4355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  4356. }))._whileTrue_((function(){
  4357. return $core.withContext(function($ctx2) {
  4358. $recv(aBlock)._value_(value);
  4359. value=$recv(value).__plus(step);
  4360. return value;
  4361. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  4362. }));
  4363. };
  4364. return self;
  4365. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  4366. },
  4367. args: ["stop", "step", "aBlock"],
  4368. 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 ]]",
  4369. referencedClasses: [],
  4370. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  4371. }),
  4372. $globals.Number);
  4373. $core.addMethod(
  4374. $core.method({
  4375. selector: "to:do:",
  4376. protocol: 'enumerating',
  4377. fn: function (stop,aBlock){
  4378. var self=this;
  4379. var nextValue;
  4380. return $core.withContext(function($ctx1) {
  4381. nextValue=self;
  4382. $recv((function(){
  4383. return $core.withContext(function($ctx2) {
  4384. return $recv(nextValue).__lt_eq(stop);
  4385. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4386. }))._whileTrue_((function(){
  4387. return $core.withContext(function($ctx2) {
  4388. $recv(aBlock)._value_(nextValue);
  4389. nextValue=$recv(nextValue).__plus((1));
  4390. return nextValue;
  4391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4392. }));
  4393. return self;
  4394. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  4395. },
  4396. args: ["stop", "aBlock"],
  4397. 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 ]",
  4398. referencedClasses: [],
  4399. messageSends: ["whileTrue:", "<=", "value:", "+"]
  4400. }),
  4401. $globals.Number);
  4402. $core.addMethod(
  4403. $core.method({
  4404. selector: "truncated",
  4405. protocol: 'converting',
  4406. fn: function (){
  4407. var self=this;
  4408. return $core.withContext(function($ctx1) {
  4409. if(self >= 0) {
  4410. return Math.floor(self);
  4411. } else {
  4412. return Math.floor(self * (-1)) * (-1);
  4413. };
  4414. ;
  4415. return self;
  4416. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  4417. },
  4418. args: [],
  4419. 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>",
  4420. referencedClasses: [],
  4421. messageSends: []
  4422. }),
  4423. $globals.Number);
  4424. $core.addMethod(
  4425. $core.method({
  4426. selector: "|",
  4427. protocol: 'converting',
  4428. fn: function (aNumber){
  4429. var self=this;
  4430. return $core.withContext(function($ctx1) {
  4431. return self | aNumber;
  4432. return self;
  4433. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  4434. },
  4435. args: ["aNumber"],
  4436. source: "| aNumber\x0a\x09<return self | aNumber>",
  4437. referencedClasses: [],
  4438. messageSends: []
  4439. }),
  4440. $globals.Number);
  4441. $core.addMethod(
  4442. $core.method({
  4443. selector: "classTag",
  4444. protocol: 'accessing',
  4445. fn: function (){
  4446. var self=this;
  4447. return "magnitude";
  4448. },
  4449. args: [],
  4450. 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'",
  4451. referencedClasses: [],
  4452. messageSends: []
  4453. }),
  4454. $globals.Number.klass);
  4455. $core.addMethod(
  4456. $core.method({
  4457. selector: "e",
  4458. protocol: 'instance creation',
  4459. fn: function (){
  4460. var self=this;
  4461. return $core.withContext(function($ctx1) {
  4462. return Math.E;;
  4463. return self;
  4464. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.klass)});
  4465. },
  4466. args: [],
  4467. source: "e\x0a\x09<return Math.E;>",
  4468. referencedClasses: [],
  4469. messageSends: []
  4470. }),
  4471. $globals.Number.klass);
  4472. $core.addMethod(
  4473. $core.method({
  4474. selector: "pi",
  4475. protocol: 'instance creation',
  4476. fn: function (){
  4477. var self=this;
  4478. return $core.withContext(function($ctx1) {
  4479. return Math.PI;
  4480. return self;
  4481. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.klass)});
  4482. },
  4483. args: [],
  4484. source: "pi\x0a\x09<return Math.PI>",
  4485. referencedClasses: [],
  4486. messageSends: []
  4487. }),
  4488. $globals.Number.klass);
  4489. $core.addClass('Point', $globals.Object, ['x', 'y'], 'Kernel-Objects');
  4490. $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";
  4491. $core.addMethod(
  4492. $core.method({
  4493. selector: "*",
  4494. protocol: 'arithmetic',
  4495. fn: function (aPoint){
  4496. var self=this;
  4497. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  4498. return $core.withContext(function($ctx1) {
  4499. var $2,$4,$3,$1,$6,$5;
  4500. $2=self._x();
  4501. $ctx1.sendIdx["x"]=1;
  4502. $4=$recv(aPoint)._asPoint();
  4503. $ctx1.sendIdx["asPoint"]=1;
  4504. $3=$recv($4)._x();
  4505. $1=$recv($2).__star($3);
  4506. $ctx1.sendIdx["*"]=1;
  4507. $6=self._y();
  4508. $ctx1.sendIdx["y"]=1;
  4509. $5=$recv($6).__star($recv($recv(aPoint)._asPoint())._y());
  4510. return $recv($Point())._x_y_($1,$5);
  4511. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  4512. },
  4513. args: ["aPoint"],
  4514. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  4515. referencedClasses: ["Point"],
  4516. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  4517. }),
  4518. $globals.Point);
  4519. $core.addMethod(
  4520. $core.method({
  4521. selector: "+",
  4522. protocol: 'arithmetic',
  4523. fn: function (aPoint){
  4524. var self=this;
  4525. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  4526. return $core.withContext(function($ctx1) {
  4527. var $2,$4,$3,$1,$6,$5;
  4528. $2=self._x();
  4529. $ctx1.sendIdx["x"]=1;
  4530. $4=$recv(aPoint)._asPoint();
  4531. $ctx1.sendIdx["asPoint"]=1;
  4532. $3=$recv($4)._x();
  4533. $1=$recv($2).__plus($3);
  4534. $ctx1.sendIdx["+"]=1;
  4535. $6=self._y();
  4536. $ctx1.sendIdx["y"]=1;
  4537. $5=$recv($6).__plus($recv($recv(aPoint)._asPoint())._y());
  4538. return $recv($Point())._x_y_($1,$5);
  4539. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  4540. },
  4541. args: ["aPoint"],
  4542. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  4543. referencedClasses: ["Point"],
  4544. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  4545. }),
  4546. $globals.Point);
  4547. $core.addMethod(
  4548. $core.method({
  4549. selector: "-",
  4550. protocol: 'arithmetic',
  4551. fn: function (aPoint){
  4552. var self=this;
  4553. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  4554. return $core.withContext(function($ctx1) {
  4555. var $2,$4,$3,$1,$6,$5;
  4556. $2=self._x();
  4557. $ctx1.sendIdx["x"]=1;
  4558. $4=$recv(aPoint)._asPoint();
  4559. $ctx1.sendIdx["asPoint"]=1;
  4560. $3=$recv($4)._x();
  4561. $1=$recv($2).__minus($3);
  4562. $ctx1.sendIdx["-"]=1;
  4563. $6=self._y();
  4564. $ctx1.sendIdx["y"]=1;
  4565. $5=$recv($6).__minus($recv($recv(aPoint)._asPoint())._y());
  4566. return $recv($Point())._x_y_($1,$5);
  4567. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  4568. },
  4569. args: ["aPoint"],
  4570. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  4571. referencedClasses: ["Point"],
  4572. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  4573. }),
  4574. $globals.Point);
  4575. $core.addMethod(
  4576. $core.method({
  4577. selector: "/",
  4578. protocol: 'arithmetic',
  4579. fn: function (aPoint){
  4580. var self=this;
  4581. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  4582. return $core.withContext(function($ctx1) {
  4583. var $2,$4,$3,$1,$6,$5;
  4584. $2=self._x();
  4585. $ctx1.sendIdx["x"]=1;
  4586. $4=$recv(aPoint)._asPoint();
  4587. $ctx1.sendIdx["asPoint"]=1;
  4588. $3=$recv($4)._x();
  4589. $1=$recv($2).__slash($3);
  4590. $ctx1.sendIdx["/"]=1;
  4591. $6=self._y();
  4592. $ctx1.sendIdx["y"]=1;
  4593. $5=$recv($6).__slash($recv($recv(aPoint)._asPoint())._y());
  4594. return $recv($Point())._x_y_($1,$5);
  4595. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  4596. },
  4597. args: ["aPoint"],
  4598. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  4599. referencedClasses: ["Point"],
  4600. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  4601. }),
  4602. $globals.Point);
  4603. $core.addMethod(
  4604. $core.method({
  4605. selector: "<",
  4606. protocol: 'comparing',
  4607. fn: function (aPoint){
  4608. var self=this;
  4609. return $core.withContext(function($ctx1) {
  4610. var $2,$1,$3;
  4611. $2=self._x();
  4612. $ctx1.sendIdx["x"]=1;
  4613. $1=$recv($2).__lt($recv(aPoint)._x());
  4614. $ctx1.sendIdx["<"]=1;
  4615. return $recv($1)._and_((function(){
  4616. return $core.withContext(function($ctx2) {
  4617. $3=self._y();
  4618. $ctx2.sendIdx["y"]=1;
  4619. return $recv($3).__lt($recv(aPoint)._y());
  4620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4621. }));
  4622. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  4623. },
  4624. args: ["aPoint"],
  4625. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  4626. referencedClasses: [],
  4627. messageSends: ["and:", "<", "x", "y"]
  4628. }),
  4629. $globals.Point);
  4630. $core.addMethod(
  4631. $core.method({
  4632. selector: "<=",
  4633. protocol: 'comparing',
  4634. fn: function (aPoint){
  4635. var self=this;
  4636. return $core.withContext(function($ctx1) {
  4637. var $2,$1,$3;
  4638. $2=self._x();
  4639. $ctx1.sendIdx["x"]=1;
  4640. $1=$recv($2).__lt_eq($recv(aPoint)._x());
  4641. $ctx1.sendIdx["<="]=1;
  4642. return $recv($1)._and_((function(){
  4643. return $core.withContext(function($ctx2) {
  4644. $3=self._y();
  4645. $ctx2.sendIdx["y"]=1;
  4646. return $recv($3).__lt_eq($recv(aPoint)._y());
  4647. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4648. }));
  4649. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  4650. },
  4651. args: ["aPoint"],
  4652. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  4653. referencedClasses: [],
  4654. messageSends: ["and:", "<=", "x", "y"]
  4655. }),
  4656. $globals.Point);
  4657. $core.addMethod(
  4658. $core.method({
  4659. selector: "=",
  4660. protocol: 'comparing',
  4661. fn: function (aPoint){
  4662. var self=this;
  4663. return $core.withContext(function($ctx1) {
  4664. var $2,$1,$4,$3,$6,$5;
  4665. $2=$recv(aPoint)._class();
  4666. $ctx1.sendIdx["class"]=1;
  4667. $1=$recv($2).__eq(self._class());
  4668. $ctx1.sendIdx["="]=1;
  4669. return $recv($1)._and_((function(){
  4670. return $core.withContext(function($ctx2) {
  4671. $4=$recv(aPoint)._x();
  4672. $ctx2.sendIdx["x"]=1;
  4673. $3=$recv($4).__eq(self._x());
  4674. $ctx2.sendIdx["="]=2;
  4675. $6=$recv(aPoint)._y();
  4676. $ctx2.sendIdx["y"]=1;
  4677. $5=$recv($6).__eq(self._y());
  4678. return $recv($3).__and($5);
  4679. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4680. }));
  4681. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  4682. },
  4683. args: ["aPoint"],
  4684. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  4685. referencedClasses: [],
  4686. messageSends: ["and:", "=", "class", "&", "x", "y"]
  4687. }),
  4688. $globals.Point);
  4689. $core.addMethod(
  4690. $core.method({
  4691. selector: ">",
  4692. protocol: 'comparing',
  4693. fn: function (aPoint){
  4694. var self=this;
  4695. return $core.withContext(function($ctx1) {
  4696. var $2,$1,$3;
  4697. $2=self._x();
  4698. $ctx1.sendIdx["x"]=1;
  4699. $1=$recv($2).__gt($recv(aPoint)._x());
  4700. $ctx1.sendIdx[">"]=1;
  4701. return $recv($1)._and_((function(){
  4702. return $core.withContext(function($ctx2) {
  4703. $3=self._y();
  4704. $ctx2.sendIdx["y"]=1;
  4705. return $recv($3).__gt($recv(aPoint)._y());
  4706. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4707. }));
  4708. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  4709. },
  4710. args: ["aPoint"],
  4711. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  4712. referencedClasses: [],
  4713. messageSends: ["and:", ">", "x", "y"]
  4714. }),
  4715. $globals.Point);
  4716. $core.addMethod(
  4717. $core.method({
  4718. selector: ">=",
  4719. protocol: 'comparing',
  4720. fn: function (aPoint){
  4721. var self=this;
  4722. return $core.withContext(function($ctx1) {
  4723. var $2,$1,$3;
  4724. $2=self._x();
  4725. $ctx1.sendIdx["x"]=1;
  4726. $1=$recv($2).__gt_eq($recv(aPoint)._x());
  4727. $ctx1.sendIdx[">="]=1;
  4728. return $recv($1)._and_((function(){
  4729. return $core.withContext(function($ctx2) {
  4730. $3=self._y();
  4731. $ctx2.sendIdx["y"]=1;
  4732. return $recv($3).__gt_eq($recv(aPoint)._y());
  4733. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4734. }));
  4735. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  4736. },
  4737. args: ["aPoint"],
  4738. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  4739. referencedClasses: [],
  4740. messageSends: ["and:", ">=", "x", "y"]
  4741. }),
  4742. $globals.Point);
  4743. $core.addMethod(
  4744. $core.method({
  4745. selector: "asPoint",
  4746. protocol: 'converting',
  4747. fn: function (){
  4748. var self=this;
  4749. return self;
  4750. },
  4751. args: [],
  4752. source: "asPoint\x0a\x09^ self",
  4753. referencedClasses: [],
  4754. messageSends: []
  4755. }),
  4756. $globals.Point);
  4757. $core.addMethod(
  4758. $core.method({
  4759. selector: "dist:",
  4760. protocol: 'transforming',
  4761. fn: function (aPoint){
  4762. var self=this;
  4763. var dx,dy;
  4764. return $core.withContext(function($ctx1) {
  4765. var $2,$1;
  4766. dx=$recv($recv(aPoint)._x()).__minus(self["@x"]);
  4767. $ctx1.sendIdx["-"]=1;
  4768. dy=$recv($recv(aPoint)._y()).__minus(self["@y"]);
  4769. $2=$recv(dx).__star(dx);
  4770. $ctx1.sendIdx["*"]=1;
  4771. $1=$recv($2).__plus($recv(dy).__star(dy));
  4772. return $recv($1)._sqrt();
  4773. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  4774. },
  4775. args: ["aPoint"],
  4776. 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",
  4777. referencedClasses: [],
  4778. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  4779. }),
  4780. $globals.Point);
  4781. $core.addMethod(
  4782. $core.method({
  4783. selector: "printOn:",
  4784. protocol: 'printing',
  4785. fn: function (aStream){
  4786. var self=this;
  4787. return $core.withContext(function($ctx1) {
  4788. var $1;
  4789. $recv(self["@x"])._printOn_(aStream);
  4790. $ctx1.sendIdx["printOn:"]=1;
  4791. $recv(aStream)._nextPutAll_("@");
  4792. $1=$recv($recv(self["@y"])._notNil())._and_((function(){
  4793. return $core.withContext(function($ctx2) {
  4794. return $recv(self["@y"])._negative();
  4795. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4796. }));
  4797. if($core.assert($1)){
  4798. $recv(aStream)._space();
  4799. };
  4800. $recv(self["@y"])._printOn_(aStream);
  4801. return self;
  4802. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  4803. },
  4804. args: ["aStream"],
  4805. 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",
  4806. referencedClasses: [],
  4807. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  4808. }),
  4809. $globals.Point);
  4810. $core.addMethod(
  4811. $core.method({
  4812. selector: "translateBy:",
  4813. protocol: 'transforming',
  4814. fn: function (delta){
  4815. var self=this;
  4816. return $core.withContext(function($ctx1) {
  4817. var $1;
  4818. $1=$recv($recv(delta)._x()).__plus(self["@x"]);
  4819. $ctx1.sendIdx["+"]=1;
  4820. return $recv($1).__at($recv($recv(delta)._y()).__plus(self["@y"]));
  4821. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  4822. },
  4823. args: ["delta"],
  4824. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  4825. referencedClasses: [],
  4826. messageSends: ["@", "+", "x", "y"]
  4827. }),
  4828. $globals.Point);
  4829. $core.addMethod(
  4830. $core.method({
  4831. selector: "x",
  4832. protocol: 'accessing',
  4833. fn: function (){
  4834. var self=this;
  4835. return self["@x"];
  4836. },
  4837. args: [],
  4838. source: "x\x0a\x09^ x",
  4839. referencedClasses: [],
  4840. messageSends: []
  4841. }),
  4842. $globals.Point);
  4843. $core.addMethod(
  4844. $core.method({
  4845. selector: "x:",
  4846. protocol: 'accessing',
  4847. fn: function (aNumber){
  4848. var self=this;
  4849. self["@x"]=aNumber;
  4850. return self;
  4851. },
  4852. args: ["aNumber"],
  4853. source: "x: aNumber\x0a\x09x := aNumber",
  4854. referencedClasses: [],
  4855. messageSends: []
  4856. }),
  4857. $globals.Point);
  4858. $core.addMethod(
  4859. $core.method({
  4860. selector: "y",
  4861. protocol: 'accessing',
  4862. fn: function (){
  4863. var self=this;
  4864. return self["@y"];
  4865. },
  4866. args: [],
  4867. source: "y\x0a\x09^ y",
  4868. referencedClasses: [],
  4869. messageSends: []
  4870. }),
  4871. $globals.Point);
  4872. $core.addMethod(
  4873. $core.method({
  4874. selector: "y:",
  4875. protocol: 'accessing',
  4876. fn: function (aNumber){
  4877. var self=this;
  4878. self["@y"]=aNumber;
  4879. return self;
  4880. },
  4881. args: ["aNumber"],
  4882. source: "y: aNumber\x0a\x09y := aNumber",
  4883. referencedClasses: [],
  4884. messageSends: []
  4885. }),
  4886. $globals.Point);
  4887. $core.addMethod(
  4888. $core.method({
  4889. selector: "classTag",
  4890. protocol: 'accessing',
  4891. fn: function (){
  4892. var self=this;
  4893. return "magnitude";
  4894. },
  4895. args: [],
  4896. 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'",
  4897. referencedClasses: [],
  4898. messageSends: []
  4899. }),
  4900. $globals.Point.klass);
  4901. $core.addMethod(
  4902. $core.method({
  4903. selector: "x:y:",
  4904. protocol: 'instance creation',
  4905. fn: function (aNumber,anotherNumber){
  4906. var self=this;
  4907. return $core.withContext(function($ctx1) {
  4908. var $1;
  4909. $1=self._new();
  4910. $recv($1)._x_(aNumber);
  4911. $recv($1)._y_(anotherNumber);
  4912. return $recv($1)._yourself();
  4913. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.klass)});
  4914. },
  4915. args: ["aNumber", "anotherNumber"],
  4916. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  4917. referencedClasses: [],
  4918. messageSends: ["x:", "new", "y:", "yourself"]
  4919. }),
  4920. $globals.Point.klass);
  4921. $core.addClass('Random', $globals.Object, [], 'Kernel-Objects');
  4922. $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'`.";
  4923. $core.addMethod(
  4924. $core.method({
  4925. selector: "next",
  4926. protocol: 'accessing',
  4927. fn: function (){
  4928. var self=this;
  4929. return $core.withContext(function($ctx1) {
  4930. return Math.random();
  4931. return self;
  4932. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  4933. },
  4934. args: [],
  4935. source: "next\x0a\x09<return Math.random()>",
  4936. referencedClasses: [],
  4937. messageSends: []
  4938. }),
  4939. $globals.Random);
  4940. $core.addMethod(
  4941. $core.method({
  4942. selector: "next:",
  4943. protocol: 'accessing',
  4944. fn: function (anInteger){
  4945. var self=this;
  4946. return $core.withContext(function($ctx1) {
  4947. return $recv((1)._to_(anInteger))._collect_((function(each){
  4948. return $core.withContext(function($ctx2) {
  4949. return self._next();
  4950. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4951. }));
  4952. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  4953. },
  4954. args: ["anInteger"],
  4955. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  4956. referencedClasses: [],
  4957. messageSends: ["collect:", "to:", "next"]
  4958. }),
  4959. $globals.Random);
  4960. $core.addClass('UndefinedObject', $globals.Object, [], 'Kernel-Objects');
  4961. $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`.";
  4962. $core.addMethod(
  4963. $core.method({
  4964. selector: "asJSON",
  4965. protocol: 'converting',
  4966. fn: function (){
  4967. var self=this;
  4968. return null;
  4969. },
  4970. args: [],
  4971. source: "asJSON\x0a\x09^ null",
  4972. referencedClasses: [],
  4973. messageSends: []
  4974. }),
  4975. $globals.UndefinedObject);
  4976. $core.addMethod(
  4977. $core.method({
  4978. selector: "deepCopy",
  4979. protocol: 'copying',
  4980. fn: function (){
  4981. var self=this;
  4982. return self;
  4983. },
  4984. args: [],
  4985. source: "deepCopy\x0a\x09^ self",
  4986. referencedClasses: [],
  4987. messageSends: []
  4988. }),
  4989. $globals.UndefinedObject);
  4990. $core.addMethod(
  4991. $core.method({
  4992. selector: "ifNil:",
  4993. protocol: 'testing',
  4994. fn: function (aBlock){
  4995. var self=this;
  4996. return $core.withContext(function($ctx1) {
  4997. return self._ifNil_ifNotNil_(aBlock,(function(){
  4998. }));
  4999. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  5000. },
  5001. args: ["aBlock"],
  5002. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  5003. referencedClasses: [],
  5004. messageSends: ["ifNil:ifNotNil:"]
  5005. }),
  5006. $globals.UndefinedObject);
  5007. $core.addMethod(
  5008. $core.method({
  5009. selector: "ifNil:ifNotNil:",
  5010. protocol: 'testing',
  5011. fn: function (aBlock,anotherBlock){
  5012. var self=this;
  5013. return $core.withContext(function($ctx1) {
  5014. return $recv(aBlock)._value();
  5015. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5016. },
  5017. args: ["aBlock", "anotherBlock"],
  5018. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  5019. referencedClasses: [],
  5020. messageSends: ["value"]
  5021. }),
  5022. $globals.UndefinedObject);
  5023. $core.addMethod(
  5024. $core.method({
  5025. selector: "ifNotNil:",
  5026. protocol: 'testing',
  5027. fn: function (aBlock){
  5028. var self=this;
  5029. return self;
  5030. },
  5031. args: ["aBlock"],
  5032. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  5033. referencedClasses: [],
  5034. messageSends: []
  5035. }),
  5036. $globals.UndefinedObject);
  5037. $core.addMethod(
  5038. $core.method({
  5039. selector: "ifNotNil:ifNil:",
  5040. protocol: 'testing',
  5041. fn: function (aBlock,anotherBlock){
  5042. var self=this;
  5043. return $core.withContext(function($ctx1) {
  5044. return $recv(anotherBlock)._value();
  5045. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5046. },
  5047. args: ["aBlock", "anotherBlock"],
  5048. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  5049. referencedClasses: [],
  5050. messageSends: ["value"]
  5051. }),
  5052. $globals.UndefinedObject);
  5053. $core.addMethod(
  5054. $core.method({
  5055. selector: "isImmutable",
  5056. protocol: 'testing',
  5057. fn: function (){
  5058. var self=this;
  5059. return true;
  5060. },
  5061. args: [],
  5062. source: "isImmutable\x0a\x09^ true",
  5063. referencedClasses: [],
  5064. messageSends: []
  5065. }),
  5066. $globals.UndefinedObject);
  5067. $core.addMethod(
  5068. $core.method({
  5069. selector: "isNil",
  5070. protocol: 'testing',
  5071. fn: function (){
  5072. var self=this;
  5073. return true;
  5074. },
  5075. args: [],
  5076. source: "isNil\x0a\x09^ true",
  5077. referencedClasses: [],
  5078. messageSends: []
  5079. }),
  5080. $globals.UndefinedObject);
  5081. $core.addMethod(
  5082. $core.method({
  5083. selector: "notNil",
  5084. protocol: 'testing',
  5085. fn: function (){
  5086. var self=this;
  5087. return false;
  5088. },
  5089. args: [],
  5090. source: "notNil\x0a\x09^ false",
  5091. referencedClasses: [],
  5092. messageSends: []
  5093. }),
  5094. $globals.UndefinedObject);
  5095. $core.addMethod(
  5096. $core.method({
  5097. selector: "printOn:",
  5098. protocol: 'printing',
  5099. fn: function (aStream){
  5100. var self=this;
  5101. return $core.withContext(function($ctx1) {
  5102. $recv(aStream)._nextPutAll_("nil");
  5103. return self;
  5104. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  5105. },
  5106. args: ["aStream"],
  5107. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  5108. referencedClasses: [],
  5109. messageSends: ["nextPutAll:"]
  5110. }),
  5111. $globals.UndefinedObject);
  5112. $core.addMethod(
  5113. $core.method({
  5114. selector: "shallowCopy",
  5115. protocol: 'copying',
  5116. fn: function (){
  5117. var self=this;
  5118. return self;
  5119. },
  5120. args: [],
  5121. source: "shallowCopy\x0a\x09^ self",
  5122. referencedClasses: [],
  5123. messageSends: []
  5124. }),
  5125. $globals.UndefinedObject);
  5126. $core.addMethod(
  5127. $core.method({
  5128. selector: "subclass:instanceVariableNames:",
  5129. protocol: 'class creation',
  5130. fn: function (aString,anotherString){
  5131. var self=this;
  5132. return $core.withContext(function($ctx1) {
  5133. return self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  5134. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.UndefinedObject)});
  5135. },
  5136. args: ["aString", "anotherString"],
  5137. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  5138. referencedClasses: [],
  5139. messageSends: ["subclass:instanceVariableNames:package:"]
  5140. }),
  5141. $globals.UndefinedObject);
  5142. $core.addMethod(
  5143. $core.method({
  5144. selector: "subclass:instanceVariableNames:category:",
  5145. protocol: 'class creation',
  5146. fn: function (aString,aString2,aString3){
  5147. var self=this;
  5148. return $core.withContext(function($ctx1) {
  5149. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5150. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  5151. },
  5152. args: ["aString", "aString2", "aString3"],
  5153. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  5154. referencedClasses: [],
  5155. messageSends: ["subclass:instanceVariableNames:package:"]
  5156. }),
  5157. $globals.UndefinedObject);
  5158. $core.addMethod(
  5159. $core.method({
  5160. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  5161. protocol: 'class creation',
  5162. fn: function (aString,aString2,classVars,pools,aString3){
  5163. var self=this;
  5164. return $core.withContext(function($ctx1) {
  5165. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5166. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.UndefinedObject)});
  5167. },
  5168. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  5169. 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",
  5170. referencedClasses: [],
  5171. messageSends: ["subclass:instanceVariableNames:package:"]
  5172. }),
  5173. $globals.UndefinedObject);
  5174. $core.addMethod(
  5175. $core.method({
  5176. selector: "subclass:instanceVariableNames:package:",
  5177. protocol: 'class creation',
  5178. fn: function (aString,aString2,aString3){
  5179. var self=this;
  5180. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  5181. return $core.withContext(function($ctx1) {
  5182. return $recv($recv($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  5183. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  5184. },
  5185. args: ["aString", "aString2", "aString3"],
  5186. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  5187. referencedClasses: ["ClassBuilder"],
  5188. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  5189. }),
  5190. $globals.UndefinedObject);
  5191. $core.addMethod(
  5192. $core.method({
  5193. selector: "new",
  5194. protocol: 'instance creation',
  5195. fn: function (){
  5196. var self=this;
  5197. return $core.withContext(function($ctx1) {
  5198. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  5199. return self;
  5200. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.klass)});
  5201. },
  5202. args: [],
  5203. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  5204. referencedClasses: [],
  5205. messageSends: ["error:"]
  5206. }),
  5207. $globals.UndefinedObject.klass);
  5208. });
  5209. define("amber_core/Kernel-Classes", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  5210. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  5211. $core.addPackage('Kernel-Classes');
  5212. $core.packages["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  5213. $core.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  5214. $core.addClass('Behavior', $globals.Object, [], 'Kernel-Classes');
  5215. $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.";
  5216. $core.addMethod(
  5217. $core.method({
  5218. selector: ">>",
  5219. protocol: 'accessing',
  5220. fn: function (aString){
  5221. var self=this;
  5222. return $core.withContext(function($ctx1) {
  5223. return self._methodAt_(aString);
  5224. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.Behavior)});
  5225. },
  5226. args: ["aString"],
  5227. source: ">> aString\x0a\x09^ self methodAt: aString",
  5228. referencedClasses: [],
  5229. messageSends: ["methodAt:"]
  5230. }),
  5231. $globals.Behavior);
  5232. $core.addMethod(
  5233. $core.method({
  5234. selector: "addCompiledMethod:",
  5235. protocol: 'compiling',
  5236. fn: function (aMethod){
  5237. var self=this;
  5238. var oldMethod,announcement;
  5239. function $MethodAdded(){return $globals.MethodAdded||(typeof MethodAdded=="undefined"?nil:MethodAdded)}
  5240. function $MethodModified(){return $globals.MethodModified||(typeof MethodModified=="undefined"?nil:MethodModified)}
  5241. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  5242. return $core.withContext(function($ctx1) {
  5243. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$receiver;
  5244. oldMethod=$recv(self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  5245. return nil;
  5246. }));
  5247. $2=self._protocols();
  5248. $3=$recv(aMethod)._protocol();
  5249. $ctx1.sendIdx["protocol"]=1;
  5250. $1=$recv($2)._includes_($3);
  5251. if(!$core.assert($1)){
  5252. $4=self._organization();
  5253. $5=$recv(aMethod)._protocol();
  5254. $ctx1.sendIdx["protocol"]=2;
  5255. $recv($4)._addElement_($5);
  5256. };
  5257. self._basicAddCompiledMethod_(aMethod);
  5258. $6=oldMethod;
  5259. if(($receiver = $6) == null || $receiver.isNil){
  5260. $6;
  5261. } else {
  5262. self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  5263. };
  5264. $7=oldMethod;
  5265. if(($receiver = $7) == null || $receiver.isNil){
  5266. $8=$recv($MethodAdded())._new();
  5267. $ctx1.sendIdx["new"]=1;
  5268. $recv($8)._method_(aMethod);
  5269. $ctx1.sendIdx["method:"]=1;
  5270. $9=$recv($8)._yourself();
  5271. $ctx1.sendIdx["yourself"]=1;
  5272. announcement=$9;
  5273. } else {
  5274. $10=$recv($MethodModified())._new();
  5275. $recv($10)._oldMethod_(oldMethod);
  5276. $recv($10)._method_(aMethod);
  5277. announcement=$recv($10)._yourself();
  5278. };
  5279. $recv($recv($SystemAnnouncer())._current())._announce_(announcement);
  5280. return self;
  5281. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.Behavior)});
  5282. },
  5283. args: ["aMethod"],
  5284. 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",
  5285. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  5286. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  5287. }),
  5288. $globals.Behavior);
  5289. $core.addMethod(
  5290. $core.method({
  5291. selector: "allInstanceVariableNames",
  5292. protocol: 'accessing',
  5293. fn: function (){
  5294. var self=this;
  5295. var result;
  5296. return $core.withContext(function($ctx1) {
  5297. var $1,$receiver;
  5298. result=$recv(self._instanceVariableNames())._copy();
  5299. $1=self._superclass();
  5300. $ctx1.sendIdx["superclass"]=1;
  5301. if(($receiver = $1) == null || $receiver.isNil){
  5302. $1;
  5303. } else {
  5304. $recv(result)._addAll_($recv(self._superclass())._allInstanceVariableNames());
  5305. };
  5306. return result;
  5307. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  5308. },
  5309. args: [],
  5310. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  5311. referencedClasses: [],
  5312. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  5313. }),
  5314. $globals.Behavior);
  5315. $core.addMethod(
  5316. $core.method({
  5317. selector: "allSelectors",
  5318. protocol: 'accessing',
  5319. fn: function (){
  5320. var self=this;
  5321. return $core.withContext(function($ctx1) {
  5322. var $1,$2;
  5323. $1=self._allSuperclasses();
  5324. $2=self._selectors();
  5325. $ctx1.sendIdx["selectors"]=1;
  5326. return $recv($1)._inject_into_($2,(function(acc,each){
  5327. return $core.withContext(function($ctx2) {
  5328. $recv(acc)._addAll_($recv(each)._selectors());
  5329. return $recv(acc)._yourself();
  5330. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  5331. }));
  5332. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  5333. },
  5334. args: [],
  5335. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  5336. referencedClasses: [],
  5337. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  5338. }),
  5339. $globals.Behavior);
  5340. $core.addMethod(
  5341. $core.method({
  5342. selector: "allSubclasses",
  5343. protocol: 'accessing',
  5344. fn: function (){
  5345. var self=this;
  5346. var subclasses,index;
  5347. return $core.withContext(function($ctx1) {
  5348. subclasses=self._subclasses();
  5349. $ctx1.sendIdx["subclasses"]=1;
  5350. index=(1);
  5351. $recv((function(){
  5352. return $core.withContext(function($ctx2) {
  5353. return $recv(index).__gt($recv(subclasses)._size());
  5354. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5355. }))._whileFalse_((function(){
  5356. return $core.withContext(function($ctx2) {
  5357. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  5358. index=$recv(index).__plus((1));
  5359. return index;
  5360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5361. }));
  5362. return subclasses;
  5363. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{subclasses:subclasses,index:index},$globals.Behavior)});
  5364. },
  5365. args: [],
  5366. 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",
  5367. referencedClasses: [],
  5368. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+"]
  5369. }),
  5370. $globals.Behavior);
  5371. $core.addMethod(
  5372. $core.method({
  5373. selector: "allSubclassesDo:",
  5374. protocol: 'enumerating',
  5375. fn: function (aBlock){
  5376. var self=this;
  5377. return $core.withContext(function($ctx1) {
  5378. $recv(self._allSubclasses())._do_((function(each){
  5379. return $core.withContext(function($ctx2) {
  5380. return $recv(aBlock)._value_(each);
  5381. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5382. }));
  5383. return self;
  5384. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  5385. },
  5386. args: ["aBlock"],
  5387. 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 ]",
  5388. referencedClasses: [],
  5389. messageSends: ["do:", "allSubclasses", "value:"]
  5390. }),
  5391. $globals.Behavior);
  5392. $core.addMethod(
  5393. $core.method({
  5394. selector: "allSuperclasses",
  5395. protocol: 'accessing',
  5396. fn: function (){
  5397. var self=this;
  5398. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  5399. return $core.withContext(function($ctx1) {
  5400. var $1,$3,$2,$receiver;
  5401. $1=self._superclass();
  5402. $ctx1.sendIdx["superclass"]=1;
  5403. if(($receiver = $1) == null || $receiver.isNil){
  5404. return [];
  5405. } else {
  5406. $1;
  5407. };
  5408. $3=self._superclass();
  5409. $ctx1.sendIdx["superclass"]=2;
  5410. $2=$recv($OrderedCollection())._with_($3);
  5411. $recv($2)._addAll_($recv(self._superclass())._allSuperclasses());
  5412. return $recv($2)._yourself();
  5413. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  5414. },
  5415. args: [],
  5416. 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",
  5417. referencedClasses: ["OrderedCollection"],
  5418. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  5419. }),
  5420. $globals.Behavior);
  5421. $core.addMethod(
  5422. $core.method({
  5423. selector: "basicAddCompiledMethod:",
  5424. protocol: 'private',
  5425. fn: function (aMethod){
  5426. var self=this;
  5427. return $core.withContext(function($ctx1) {
  5428. $core.addMethod(aMethod, self);
  5429. return self;
  5430. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  5431. },
  5432. args: ["aMethod"],
  5433. source: "basicAddCompiledMethod: aMethod\x0a\x09<$core.addMethod(aMethod, self)>",
  5434. referencedClasses: [],
  5435. messageSends: []
  5436. }),
  5437. $globals.Behavior);
  5438. $core.addMethod(
  5439. $core.method({
  5440. selector: "basicNew",
  5441. protocol: 'instance creation',
  5442. fn: function (){
  5443. var self=this;
  5444. return $core.withContext(function($ctx1) {
  5445. return new self.fn();
  5446. return self;
  5447. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  5448. },
  5449. args: [],
  5450. source: "basicNew\x0a\x09<return new self.fn()>",
  5451. referencedClasses: [],
  5452. messageSends: []
  5453. }),
  5454. $globals.Behavior);
  5455. $core.addMethod(
  5456. $core.method({
  5457. selector: "basicRemoveCompiledMethod:",
  5458. protocol: 'private',
  5459. fn: function (aMethod){
  5460. var self=this;
  5461. return $core.withContext(function($ctx1) {
  5462. $core.removeMethod(aMethod,self);
  5463. return self;
  5464. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  5465. },
  5466. args: ["aMethod"],
  5467. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<$core.removeMethod(aMethod,self)>",
  5468. referencedClasses: [],
  5469. messageSends: []
  5470. }),
  5471. $globals.Behavior);
  5472. $core.addMethod(
  5473. $core.method({
  5474. selector: "canUnderstand:",
  5475. protocol: 'testing',
  5476. fn: function (aSelector){
  5477. var self=this;
  5478. return $core.withContext(function($ctx1) {
  5479. var $2,$1;
  5480. return $recv(self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  5481. return $core.withContext(function($ctx2) {
  5482. $2=self._superclass();
  5483. $ctx2.sendIdx["superclass"]=1;
  5484. $1=$recv($2)._notNil();
  5485. return $recv($1)._and_((function(){
  5486. return $core.withContext(function($ctx3) {
  5487. return $recv(self._superclass())._canUnderstand_(aSelector);
  5488. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  5489. }));
  5490. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5491. }));
  5492. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  5493. },
  5494. args: ["aSelector"],
  5495. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  5496. referencedClasses: [],
  5497. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  5498. }),
  5499. $globals.Behavior);
  5500. $core.addMethod(
  5501. $core.method({
  5502. selector: "comment",
  5503. protocol: 'accessing',
  5504. fn: function (){
  5505. var self=this;
  5506. return $core.withContext(function($ctx1) {
  5507. var $1,$receiver;
  5508. $1=self._basicAt_("comment");
  5509. if(($receiver = $1) == null || $receiver.isNil){
  5510. return "";
  5511. } else {
  5512. return $1;
  5513. };
  5514. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.Behavior)});
  5515. },
  5516. args: [],
  5517. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  5518. referencedClasses: [],
  5519. messageSends: ["ifNil:", "basicAt:"]
  5520. }),
  5521. $globals.Behavior);
  5522. $core.addMethod(
  5523. $core.method({
  5524. selector: "comment:",
  5525. protocol: 'accessing',
  5526. fn: function (aString){
  5527. var self=this;
  5528. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  5529. function $ClassCommentChanged(){return $globals.ClassCommentChanged||(typeof ClassCommentChanged=="undefined"?nil:ClassCommentChanged)}
  5530. return $core.withContext(function($ctx1) {
  5531. var $1,$3,$2;
  5532. self._basicAt_put_("comment",aString);
  5533. $1=$recv($SystemAnnouncer())._current();
  5534. $3=$recv($ClassCommentChanged())._new();
  5535. $recv($3)._theClass_(self);
  5536. $2=$recv($3)._yourself();
  5537. $recv($1)._announce_($2);
  5538. return self;
  5539. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.Behavior)});
  5540. },
  5541. args: ["aString"],
  5542. 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)",
  5543. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  5544. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  5545. }),
  5546. $globals.Behavior);
  5547. $core.addMethod(
  5548. $core.method({
  5549. selector: "compile:protocol:",
  5550. protocol: 'compiling',
  5551. fn: function (aString,anotherString){
  5552. var self=this;
  5553. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  5554. return $core.withContext(function($ctx1) {
  5555. return $recv($recv($Compiler())._new())._install_forClass_protocol_(aString,self,anotherString);
  5556. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.Behavior)});
  5557. },
  5558. args: ["aString", "anotherString"],
  5559. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  5560. referencedClasses: ["Compiler"],
  5561. messageSends: ["install:forClass:protocol:", "new"]
  5562. }),
  5563. $globals.Behavior);
  5564. $core.addMethod(
  5565. $core.method({
  5566. selector: "definition",
  5567. protocol: 'accessing',
  5568. fn: function (){
  5569. var self=this;
  5570. return "";
  5571. },
  5572. args: [],
  5573. source: "definition\x0a\x09^ ''",
  5574. referencedClasses: [],
  5575. messageSends: []
  5576. }),
  5577. $globals.Behavior);
  5578. $core.addMethod(
  5579. $core.method({
  5580. selector: "includesBehavior:",
  5581. protocol: 'testing',
  5582. fn: function (aClass){
  5583. var self=this;
  5584. return $core.withContext(function($ctx1) {
  5585. return $recv(self.__eq_eq(aClass))._or_((function(){
  5586. return $core.withContext(function($ctx2) {
  5587. return self._inheritsFrom_(aClass);
  5588. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5589. }));
  5590. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  5591. },
  5592. args: ["aClass"],
  5593. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  5594. referencedClasses: [],
  5595. messageSends: ["or:", "==", "inheritsFrom:"]
  5596. }),
  5597. $globals.Behavior);
  5598. $core.addMethod(
  5599. $core.method({
  5600. selector: "includesSelector:",
  5601. protocol: 'testing',
  5602. fn: function (aString){
  5603. var self=this;
  5604. return $core.withContext(function($ctx1) {
  5605. return $recv(self._methodDictionary())._includesKey_(aString);
  5606. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.Behavior)});
  5607. },
  5608. args: ["aString"],
  5609. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  5610. referencedClasses: [],
  5611. messageSends: ["includesKey:", "methodDictionary"]
  5612. }),
  5613. $globals.Behavior);
  5614. $core.addMethod(
  5615. $core.method({
  5616. selector: "inheritsFrom:",
  5617. protocol: 'testing',
  5618. fn: function (aClass){
  5619. var self=this;
  5620. return $core.withContext(function($ctx1) {
  5621. var $1,$3,$2,$receiver;
  5622. $1=self._superclass();
  5623. $ctx1.sendIdx["superclass"]=1;
  5624. if(($receiver = $1) == null || $receiver.isNil){
  5625. return false;
  5626. } else {
  5627. $1;
  5628. };
  5629. $3=self._superclass();
  5630. $ctx1.sendIdx["superclass"]=2;
  5631. $2=$recv(aClass).__eq_eq($3);
  5632. return $recv($2)._or_((function(){
  5633. return $core.withContext(function($ctx2) {
  5634. return $recv(self._superclass())._inheritsFrom_(aClass);
  5635. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5636. }));
  5637. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  5638. },
  5639. args: ["aClass"],
  5640. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  5641. referencedClasses: [],
  5642. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  5643. }),
  5644. $globals.Behavior);
  5645. $core.addMethod(
  5646. $core.method({
  5647. selector: "instanceVariableNames",
  5648. protocol: 'accessing',
  5649. fn: function (){
  5650. var self=this;
  5651. return $core.withContext(function($ctx1) {
  5652. return self.iVarNames;
  5653. return self;
  5654. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  5655. },
  5656. args: [],
  5657. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  5658. referencedClasses: [],
  5659. messageSends: []
  5660. }),
  5661. $globals.Behavior);
  5662. $core.addMethod(
  5663. $core.method({
  5664. selector: "isBehavior",
  5665. protocol: 'testing',
  5666. fn: function (){
  5667. var self=this;
  5668. return true;
  5669. },
  5670. args: [],
  5671. source: "isBehavior\x0a\x09^ true",
  5672. referencedClasses: [],
  5673. messageSends: []
  5674. }),
  5675. $globals.Behavior);
  5676. $core.addMethod(
  5677. $core.method({
  5678. selector: "javascriptConstructor",
  5679. protocol: 'accessing',
  5680. fn: function (){
  5681. var self=this;
  5682. return $core.withContext(function($ctx1) {
  5683. return self.fn;
  5684. return self;
  5685. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  5686. },
  5687. args: [],
  5688. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<return self.fn>",
  5689. referencedClasses: [],
  5690. messageSends: []
  5691. }),
  5692. $globals.Behavior);
  5693. $core.addMethod(
  5694. $core.method({
  5695. selector: "javascriptConstructor:",
  5696. protocol: 'accessing',
  5697. fn: function (aJavaScriptFunction){
  5698. var self=this;
  5699. return $core.withContext(function($ctx1) {
  5700. $core.setClassConstructor(self, aJavaScriptFunction);;
  5701. return self;
  5702. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  5703. },
  5704. args: ["aJavaScriptFunction"],
  5705. 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);>",
  5706. referencedClasses: [],
  5707. messageSends: []
  5708. }),
  5709. $globals.Behavior);
  5710. $core.addMethod(
  5711. $core.method({
  5712. selector: "lookupSelector:",
  5713. protocol: 'accessing',
  5714. fn: function (selector){
  5715. var self=this;
  5716. var lookupClass;
  5717. return $core.withContext(function($ctx1) {
  5718. var $1;
  5719. var $early={};
  5720. try {
  5721. lookupClass=self;
  5722. $recv((function(){
  5723. return $core.withContext(function($ctx2) {
  5724. return $recv(lookupClass).__eq(nil);
  5725. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5726. }))._whileFalse_((function(){
  5727. return $core.withContext(function($ctx2) {
  5728. $1=$recv(lookupClass)._includesSelector_(selector);
  5729. if($core.assert($1)){
  5730. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  5731. };
  5732. lookupClass=$recv(lookupClass)._superclass();
  5733. return lookupClass;
  5734. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5735. }));
  5736. return nil;
  5737. }
  5738. catch(e) {if(e===$early)return e[0]; throw e}
  5739. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  5740. },
  5741. args: ["selector"],
  5742. 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",
  5743. referencedClasses: [],
  5744. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  5745. }),
  5746. $globals.Behavior);
  5747. $core.addMethod(
  5748. $core.method({
  5749. selector: "methodAt:",
  5750. protocol: 'accessing',
  5751. fn: function (aString){
  5752. var self=this;
  5753. return $core.withContext(function($ctx1) {
  5754. return $recv(self._methodDictionary())._at_(aString);
  5755. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.Behavior)});
  5756. },
  5757. args: ["aString"],
  5758. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  5759. referencedClasses: [],
  5760. messageSends: ["at:", "methodDictionary"]
  5761. }),
  5762. $globals.Behavior);
  5763. $core.addMethod(
  5764. $core.method({
  5765. selector: "methodDictionary",
  5766. protocol: 'accessing',
  5767. fn: function (){
  5768. var self=this;
  5769. return $core.withContext(function($ctx1) {
  5770. var dict = $globals.HashedCollection._new();
  5771. var methods = self.methods;
  5772. Object.keys(methods).forEach(function(i) {
  5773. if(methods[i].selector) {
  5774. dict._at_put_(methods[i].selector, methods[i]);
  5775. }
  5776. });
  5777. return dict;
  5778. return self;
  5779. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.Behavior)});
  5780. },
  5781. args: [],
  5782. 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>",
  5783. referencedClasses: [],
  5784. messageSends: []
  5785. }),
  5786. $globals.Behavior);
  5787. $core.addMethod(
  5788. $core.method({
  5789. selector: "methodTemplate",
  5790. protocol: 'accessing',
  5791. fn: function (){
  5792. var self=this;
  5793. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  5794. return $core.withContext(function($ctx1) {
  5795. var $2,$3,$1,$6,$7,$5,$8,$4;
  5796. return $recv($String())._streamContents_((function(stream){
  5797. return $core.withContext(function($ctx2) {
  5798. $recv(stream)._nextPutAll_("messageSelectorAndArgumentNames");
  5799. $ctx2.sendIdx["nextPutAll:"]=1;
  5800. $2=$recv($String())._lf();
  5801. $ctx2.sendIdx["lf"]=1;
  5802. $3=$recv($String())._tab();
  5803. $ctx2.sendIdx["tab"]=1;
  5804. $1=$recv($2).__comma($3);
  5805. $ctx2.sendIdx[","]=1;
  5806. $recv(stream)._nextPutAll_($1);
  5807. $ctx2.sendIdx["nextPutAll:"]=2;
  5808. $recv(stream)._nextPutAll_("\x22comment stating purpose of message\x22");
  5809. $ctx2.sendIdx["nextPutAll:"]=3;
  5810. $6=$recv($String())._lf();
  5811. $ctx2.sendIdx["lf"]=2;
  5812. $7=$recv($String())._lf();
  5813. $ctx2.sendIdx["lf"]=3;
  5814. $5=$recv($6).__comma($7);
  5815. $ctx2.sendIdx[","]=3;
  5816. $8=$recv($String())._tab();
  5817. $ctx2.sendIdx["tab"]=2;
  5818. $4=$recv($5).__comma($8);
  5819. $ctx2.sendIdx[","]=2;
  5820. $recv(stream)._nextPutAll_($4);
  5821. $ctx2.sendIdx["nextPutAll:"]=4;
  5822. $recv(stream)._nextPutAll_("| temporary variable names |");
  5823. $ctx2.sendIdx["nextPutAll:"]=5;
  5824. $recv(stream)._nextPutAll_($recv($recv($String())._lf()).__comma($recv($String())._tab()));
  5825. $ctx2.sendIdx["nextPutAll:"]=6;
  5826. return $recv(stream)._nextPutAll_("statements");
  5827. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  5828. }));
  5829. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.Behavior)});
  5830. },
  5831. args: [],
  5832. 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' ]",
  5833. referencedClasses: ["String"],
  5834. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab"]
  5835. }),
  5836. $globals.Behavior);
  5837. $core.addMethod(
  5838. $core.method({
  5839. selector: "methods",
  5840. protocol: 'accessing',
  5841. fn: function (){
  5842. var self=this;
  5843. return $core.withContext(function($ctx1) {
  5844. return $recv(self._methodDictionary())._values();
  5845. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.Behavior)});
  5846. },
  5847. args: [],
  5848. source: "methods\x0a\x09^ self methodDictionary values",
  5849. referencedClasses: [],
  5850. messageSends: ["values", "methodDictionary"]
  5851. }),
  5852. $globals.Behavior);
  5853. $core.addMethod(
  5854. $core.method({
  5855. selector: "methodsInProtocol:",
  5856. protocol: 'accessing',
  5857. fn: function (aString){
  5858. var self=this;
  5859. return $core.withContext(function($ctx1) {
  5860. return $recv(self._methods())._select_((function(each){
  5861. return $core.withContext(function($ctx2) {
  5862. return $recv($recv(each)._protocol()).__eq(aString);
  5863. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5864. }));
  5865. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.Behavior)});
  5866. },
  5867. args: ["aString"],
  5868. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  5869. referencedClasses: [],
  5870. messageSends: ["select:", "methods", "=", "protocol"]
  5871. }),
  5872. $globals.Behavior);
  5873. $core.addMethod(
  5874. $core.method({
  5875. selector: "name",
  5876. protocol: 'accessing',
  5877. fn: function (){
  5878. var self=this;
  5879. return $core.withContext(function($ctx1) {
  5880. return self.className || nil;
  5881. return self;
  5882. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Behavior)});
  5883. },
  5884. args: [],
  5885. source: "name\x0a\x09<return self.className || nil>",
  5886. referencedClasses: [],
  5887. messageSends: []
  5888. }),
  5889. $globals.Behavior);
  5890. $core.addMethod(
  5891. $core.method({
  5892. selector: "new",
  5893. protocol: 'instance creation',
  5894. fn: function (){
  5895. var self=this;
  5896. return $core.withContext(function($ctx1) {
  5897. return $recv(self._basicNew())._initialize();
  5898. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  5899. },
  5900. args: [],
  5901. source: "new\x0a\x09^ self basicNew initialize",
  5902. referencedClasses: [],
  5903. messageSends: ["initialize", "basicNew"]
  5904. }),
  5905. $globals.Behavior);
  5906. $core.addMethod(
  5907. $core.method({
  5908. selector: "organization",
  5909. protocol: 'accessing',
  5910. fn: function (){
  5911. var self=this;
  5912. return $core.withContext(function($ctx1) {
  5913. return self._basicAt_("organization");
  5914. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Behavior)});
  5915. },
  5916. args: [],
  5917. source: "organization\x0a\x09^ self basicAt: 'organization'",
  5918. referencedClasses: [],
  5919. messageSends: ["basicAt:"]
  5920. }),
  5921. $globals.Behavior);
  5922. $core.addMethod(
  5923. $core.method({
  5924. selector: "ownMethods",
  5925. protocol: 'accessing',
  5926. fn: function (){
  5927. var self=this;
  5928. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  5929. return $core.withContext(function($ctx1) {
  5930. var $1;
  5931. return $recv($recv(self._ownProtocols())._inject_into_($recv($OrderedCollection())._new(),(function(acc,each){
  5932. return $core.withContext(function($ctx2) {
  5933. return $recv(acc).__comma(self._methodsInProtocol_(each));
  5934. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  5935. })))._sorted_((function(a,b){
  5936. return $core.withContext(function($ctx2) {
  5937. $1=$recv(a)._selector();
  5938. $ctx2.sendIdx["selector"]=1;
  5939. return $recv($1).__lt_eq($recv(b)._selector());
  5940. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  5941. }));
  5942. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.Behavior)});
  5943. },
  5944. args: [],
  5945. 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 ]",
  5946. referencedClasses: ["OrderedCollection"],
  5947. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "methodsInProtocol:", "<=", "selector"]
  5948. }),
  5949. $globals.Behavior);
  5950. $core.addMethod(
  5951. $core.method({
  5952. selector: "ownProtocols",
  5953. protocol: 'accessing',
  5954. fn: function (){
  5955. var self=this;
  5956. return $core.withContext(function($ctx1) {
  5957. return $recv(self._protocols())._reject_((function(each){
  5958. return $core.withContext(function($ctx2) {
  5959. return $recv(each)._match_("^\x5c*");
  5960. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5961. }));
  5962. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.Behavior)});
  5963. },
  5964. args: [],
  5965. 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*' ]",
  5966. referencedClasses: [],
  5967. messageSends: ["reject:", "protocols", "match:"]
  5968. }),
  5969. $globals.Behavior);
  5970. $core.addMethod(
  5971. $core.method({
  5972. selector: "packageOfProtocol:",
  5973. protocol: 'accessing',
  5974. fn: function (aString){
  5975. var self=this;
  5976. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  5977. return $core.withContext(function($ctx1) {
  5978. var $1;
  5979. $1=$recv(aString)._beginsWith_("*");
  5980. if(!$core.assert($1)){
  5981. return self._package();
  5982. };
  5983. return $recv($Package())._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  5984. return nil;
  5985. }));
  5986. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.Behavior)});
  5987. },
  5988. args: ["aString"],
  5989. 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 ]",
  5990. referencedClasses: ["Package"],
  5991. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  5992. }),
  5993. $globals.Behavior);
  5994. $core.addMethod(
  5995. $core.method({
  5996. selector: "protocols",
  5997. protocol: 'accessing',
  5998. fn: function (){
  5999. var self=this;
  6000. return $core.withContext(function($ctx1) {
  6001. return $recv($recv(self._organization())._elements())._sorted();
  6002. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.Behavior)});
  6003. },
  6004. args: [],
  6005. source: "protocols\x0a\x09^ self organization elements sorted",
  6006. referencedClasses: [],
  6007. messageSends: ["sorted", "elements", "organization"]
  6008. }),
  6009. $globals.Behavior);
  6010. $core.addMethod(
  6011. $core.method({
  6012. selector: "protocolsDo:",
  6013. protocol: 'enumerating',
  6014. fn: function (aBlock){
  6015. var self=this;
  6016. var methodsByProtocol;
  6017. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  6018. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  6019. return $core.withContext(function($ctx1) {
  6020. methodsByProtocol=$recv($HashedCollection())._new();
  6021. $ctx1.sendIdx["new"]=1;
  6022. $recv(self._methodDictionary())._valuesDo_((function(m){
  6023. return $core.withContext(function($ctx2) {
  6024. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  6025. return $core.withContext(function($ctx3) {
  6026. return $recv($Array())._new();
  6027. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  6028. })))._add_(m);
  6029. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  6030. }));
  6031. $recv(self._protocols())._do_((function(protocol){
  6032. return $core.withContext(function($ctx2) {
  6033. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  6034. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  6035. }));
  6036. return self;
  6037. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.Behavior)});
  6038. },
  6039. args: ["aBlock"],
  6040. 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) ]",
  6041. referencedClasses: ["HashedCollection", "Array"],
  6042. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  6043. }),
  6044. $globals.Behavior);
  6045. $core.addMethod(
  6046. $core.method({
  6047. selector: "prototype",
  6048. protocol: 'accessing',
  6049. fn: function (){
  6050. var self=this;
  6051. return $core.withContext(function($ctx1) {
  6052. return self.fn.prototype;
  6053. return self;
  6054. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  6055. },
  6056. args: [],
  6057. source: "prototype\x0a\x09<return self.fn.prototype>",
  6058. referencedClasses: [],
  6059. messageSends: []
  6060. }),
  6061. $globals.Behavior);
  6062. $core.addMethod(
  6063. $core.method({
  6064. selector: "recompile",
  6065. protocol: 'compiling',
  6066. fn: function (){
  6067. var self=this;
  6068. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6069. return $core.withContext(function($ctx1) {
  6070. return $recv($recv($Compiler())._new())._recompile_(self);
  6071. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.Behavior)});
  6072. },
  6073. args: [],
  6074. source: "recompile\x0a\x09^ Compiler new recompile: self",
  6075. referencedClasses: ["Compiler"],
  6076. messageSends: ["recompile:", "new"]
  6077. }),
  6078. $globals.Behavior);
  6079. $core.addMethod(
  6080. $core.method({
  6081. selector: "removeCompiledMethod:",
  6082. protocol: 'compiling',
  6083. fn: function (aMethod){
  6084. var self=this;
  6085. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6086. function $MethodRemoved(){return $globals.MethodRemoved||(typeof MethodRemoved=="undefined"?nil:MethodRemoved)}
  6087. return $core.withContext(function($ctx1) {
  6088. var $1,$3,$2;
  6089. self._basicRemoveCompiledMethod_(aMethod);
  6090. self._removeProtocolIfEmpty_($recv(aMethod)._protocol());
  6091. $1=$recv($SystemAnnouncer())._current();
  6092. $3=$recv($MethodRemoved())._new();
  6093. $recv($3)._method_(aMethod);
  6094. $2=$recv($3)._yourself();
  6095. $recv($1)._announce_($2);
  6096. return self;
  6097. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  6098. },
  6099. args: ["aMethod"],
  6100. 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)",
  6101. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  6102. messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"]
  6103. }),
  6104. $globals.Behavior);
  6105. $core.addMethod(
  6106. $core.method({
  6107. selector: "removeProtocolIfEmpty:",
  6108. protocol: 'accessing',
  6109. fn: function (aString){
  6110. var self=this;
  6111. return $core.withContext(function($ctx1) {
  6112. $recv(self._methods())._detect_ifNone_((function(each){
  6113. return $core.withContext(function($ctx2) {
  6114. return $recv($recv(each)._protocol()).__eq(aString);
  6115. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6116. }),(function(){
  6117. return $core.withContext(function($ctx2) {
  6118. return $recv(self._organization())._removeElement_(aString);
  6119. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6120. }));
  6121. return self;
  6122. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.Behavior)});
  6123. },
  6124. args: ["aString"],
  6125. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  6126. referencedClasses: [],
  6127. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  6128. }),
  6129. $globals.Behavior);
  6130. $core.addMethod(
  6131. $core.method({
  6132. selector: "selectors",
  6133. protocol: 'accessing',
  6134. fn: function (){
  6135. var self=this;
  6136. return $core.withContext(function($ctx1) {
  6137. return $recv(self._methodDictionary())._keys();
  6138. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.Behavior)});
  6139. },
  6140. args: [],
  6141. source: "selectors\x0a\x09^ self methodDictionary keys",
  6142. referencedClasses: [],
  6143. messageSends: ["keys", "methodDictionary"]
  6144. }),
  6145. $globals.Behavior);
  6146. $core.addMethod(
  6147. $core.method({
  6148. selector: "subclasses",
  6149. protocol: 'accessing',
  6150. fn: function (){
  6151. var self=this;
  6152. return $core.withContext(function($ctx1) {
  6153. self._subclassResponsibility();
  6154. return self;
  6155. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  6156. },
  6157. args: [],
  6158. source: "subclasses\x0a\x09self subclassResponsibility",
  6159. referencedClasses: [],
  6160. messageSends: ["subclassResponsibility"]
  6161. }),
  6162. $globals.Behavior);
  6163. $core.addMethod(
  6164. $core.method({
  6165. selector: "superclass",
  6166. protocol: 'accessing',
  6167. fn: function (){
  6168. var self=this;
  6169. return $core.withContext(function($ctx1) {
  6170. return self.superclass;
  6171. return self;
  6172. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  6173. },
  6174. args: [],
  6175. source: "superclass\x0a\x09<return self.superclass>",
  6176. referencedClasses: [],
  6177. messageSends: []
  6178. }),
  6179. $globals.Behavior);
  6180. $core.addMethod(
  6181. $core.method({
  6182. selector: "theMetaClass",
  6183. protocol: 'accessing',
  6184. fn: function (){
  6185. var self=this;
  6186. return $core.withContext(function($ctx1) {
  6187. self._subclassResponsibility();
  6188. return self;
  6189. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  6190. },
  6191. args: [],
  6192. source: "theMetaClass\x0a\x09self subclassResponsibility",
  6193. referencedClasses: [],
  6194. messageSends: ["subclassResponsibility"]
  6195. }),
  6196. $globals.Behavior);
  6197. $core.addMethod(
  6198. $core.method({
  6199. selector: "theNonMetaClass",
  6200. protocol: 'accessing',
  6201. fn: function (){
  6202. var self=this;
  6203. return $core.withContext(function($ctx1) {
  6204. self._subclassResponsibility();
  6205. return self;
  6206. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  6207. },
  6208. args: [],
  6209. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  6210. referencedClasses: [],
  6211. messageSends: ["subclassResponsibility"]
  6212. }),
  6213. $globals.Behavior);
  6214. $core.addMethod(
  6215. $core.method({
  6216. selector: "withAllSubclasses",
  6217. protocol: 'accessing',
  6218. fn: function (){
  6219. var self=this;
  6220. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  6221. return $core.withContext(function($ctx1) {
  6222. var $1;
  6223. $1=$recv($Array())._with_(self);
  6224. $recv($1)._addAll_(self._allSubclasses());
  6225. return $recv($1)._yourself();
  6226. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  6227. },
  6228. args: [],
  6229. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  6230. referencedClasses: ["Array"],
  6231. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  6232. }),
  6233. $globals.Behavior);
  6234. $core.addClass('Class', $globals.Behavior, [], 'Kernel-Classes');
  6235. $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.";
  6236. $core.addMethod(
  6237. $core.method({
  6238. selector: "asJavascript",
  6239. protocol: 'converting',
  6240. fn: function (){
  6241. var self=this;
  6242. return $core.withContext(function($ctx1) {
  6243. return "$globals.".__comma(self._name());
  6244. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Class)});
  6245. },
  6246. args: [],
  6247. source: "asJavascript\x0a\x09^ '$globals.', self name",
  6248. referencedClasses: [],
  6249. messageSends: [",", "name"]
  6250. }),
  6251. $globals.Class);
  6252. $core.addMethod(
  6253. $core.method({
  6254. selector: "browse",
  6255. protocol: 'browsing',
  6256. fn: function (){
  6257. var self=this;
  6258. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  6259. return $core.withContext(function($ctx1) {
  6260. $recv($Finder())._findClass_(self);
  6261. return self;
  6262. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Class)});
  6263. },
  6264. args: [],
  6265. source: "browse\x0a\x09Finder findClass: self",
  6266. referencedClasses: ["Finder"],
  6267. messageSends: ["findClass:"]
  6268. }),
  6269. $globals.Class);
  6270. $core.addMethod(
  6271. $core.method({
  6272. selector: "category",
  6273. protocol: 'accessing',
  6274. fn: function (){
  6275. var self=this;
  6276. return $core.withContext(function($ctx1) {
  6277. var $1,$receiver;
  6278. $1=self._package();
  6279. $ctx1.sendIdx["package"]=1;
  6280. if(($receiver = $1) == null || $receiver.isNil){
  6281. return "Unclassified";
  6282. } else {
  6283. return $recv(self._package())._name();
  6284. };
  6285. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.Class)});
  6286. },
  6287. args: [],
  6288. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  6289. referencedClasses: [],
  6290. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  6291. }),
  6292. $globals.Class);
  6293. $core.addMethod(
  6294. $core.method({
  6295. selector: "classTag",
  6296. protocol: 'accessing',
  6297. fn: function (){
  6298. var self=this;
  6299. return "class";
  6300. },
  6301. args: [],
  6302. 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'",
  6303. referencedClasses: [],
  6304. messageSends: []
  6305. }),
  6306. $globals.Class);
  6307. $core.addMethod(
  6308. $core.method({
  6309. selector: "definition",
  6310. protocol: 'accessing',
  6311. fn: function (){
  6312. var self=this;
  6313. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  6314. return $core.withContext(function($ctx1) {
  6315. var $2,$3,$1,$4,$5;
  6316. return $recv($String())._streamContents_((function(stream){
  6317. return $core.withContext(function($ctx2) {
  6318. $recv(stream)._nextPutAll_($recv(self._superclass())._asString());
  6319. $ctx2.sendIdx["nextPutAll:"]=1;
  6320. $recv(stream)._nextPutAll_(" subclass: #");
  6321. $ctx2.sendIdx["nextPutAll:"]=2;
  6322. $recv(stream)._nextPutAll_(self._name());
  6323. $ctx2.sendIdx["nextPutAll:"]=3;
  6324. $2=$recv($String())._lf();
  6325. $ctx2.sendIdx["lf"]=1;
  6326. $3=$recv($String())._tab();
  6327. $ctx2.sendIdx["tab"]=1;
  6328. $1=$recv($2).__comma($3);
  6329. $ctx2.sendIdx[","]=1;
  6330. $recv(stream)._nextPutAll_($1);
  6331. $ctx2.sendIdx["nextPutAll:"]=4;
  6332. $4=$recv(stream)._nextPutAll_("instanceVariableNames: '");
  6333. $ctx2.sendIdx["nextPutAll:"]=5;
  6334. $4;
  6335. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  6336. return $core.withContext(function($ctx3) {
  6337. return $recv(stream)._nextPutAll_(each);
  6338. $ctx3.sendIdx["nextPutAll:"]=6;
  6339. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6340. }),(function(){
  6341. return $core.withContext(function($ctx3) {
  6342. return $recv(stream)._nextPutAll_(" ");
  6343. $ctx3.sendIdx["nextPutAll:"]=7;
  6344. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6345. }));
  6346. $5=$recv("'".__comma($recv($String())._lf())).__comma($recv($String())._tab());
  6347. $ctx2.sendIdx[","]=2;
  6348. $recv(stream)._nextPutAll_($5);
  6349. $ctx2.sendIdx["nextPutAll:"]=8;
  6350. $recv(stream)._nextPutAll_("package: '");
  6351. $ctx2.sendIdx["nextPutAll:"]=9;
  6352. $recv(stream)._nextPutAll_(self._category());
  6353. $ctx2.sendIdx["nextPutAll:"]=10;
  6354. return $recv(stream)._nextPutAll_("'");
  6355. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6356. }));
  6357. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  6358. },
  6359. args: [],
  6360. 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: '''' ]",
  6361. referencedClasses: ["String"],
  6362. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category"]
  6363. }),
  6364. $globals.Class);
  6365. $core.addMethod(
  6366. $core.method({
  6367. selector: "isClass",
  6368. protocol: 'testing',
  6369. fn: function (){
  6370. var self=this;
  6371. return true;
  6372. },
  6373. args: [],
  6374. source: "isClass\x0a\x09^ true",
  6375. referencedClasses: [],
  6376. messageSends: []
  6377. }),
  6378. $globals.Class);
  6379. $core.addMethod(
  6380. $core.method({
  6381. selector: "package",
  6382. protocol: 'accessing',
  6383. fn: function (){
  6384. var self=this;
  6385. return $core.withContext(function($ctx1) {
  6386. return self._basicAt_("pkg");
  6387. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Class)});
  6388. },
  6389. args: [],
  6390. source: "package\x0a\x09^ self basicAt: 'pkg'",
  6391. referencedClasses: [],
  6392. messageSends: ["basicAt:"]
  6393. }),
  6394. $globals.Class);
  6395. $core.addMethod(
  6396. $core.method({
  6397. selector: "package:",
  6398. protocol: 'accessing',
  6399. fn: function (aPackage){
  6400. var self=this;
  6401. var oldPackage;
  6402. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6403. function $ClassMoved(){return $globals.ClassMoved||(typeof ClassMoved=="undefined"?nil:ClassMoved)}
  6404. return $core.withContext(function($ctx1) {
  6405. var $2,$1,$3,$4,$6,$5;
  6406. $2=self._package();
  6407. $ctx1.sendIdx["package"]=1;
  6408. $1=$recv($2).__eq(aPackage);
  6409. if($core.assert($1)){
  6410. return self;
  6411. };
  6412. oldPackage=self._package();
  6413. self._basicAt_put_("pkg",aPackage);
  6414. $3=$recv(oldPackage)._organization();
  6415. $ctx1.sendIdx["organization"]=1;
  6416. $recv($3)._removeElement_(self);
  6417. $recv($recv(aPackage)._organization())._addElement_(self);
  6418. $4=$recv($SystemAnnouncer())._current();
  6419. $6=$recv($ClassMoved())._new();
  6420. $recv($6)._theClass_(self);
  6421. $recv($6)._oldPackage_(oldPackage);
  6422. $5=$recv($6)._yourself();
  6423. $recv($4)._announce_($5);
  6424. return self;
  6425. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.Class)});
  6426. },
  6427. args: ["aPackage"],
  6428. 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)",
  6429. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  6430. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  6431. }),
  6432. $globals.Class);
  6433. $core.addMethod(
  6434. $core.method({
  6435. selector: "printOn:",
  6436. protocol: 'printing',
  6437. fn: function (aStream){
  6438. var self=this;
  6439. return $core.withContext(function($ctx1) {
  6440. $recv(aStream)._nextPutAll_(self._name());
  6441. return self;
  6442. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Class)});
  6443. },
  6444. args: ["aStream"],
  6445. source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
  6446. referencedClasses: [],
  6447. messageSends: ["nextPutAll:", "name"]
  6448. }),
  6449. $globals.Class);
  6450. $core.addMethod(
  6451. $core.method({
  6452. selector: "rename:",
  6453. protocol: 'accessing',
  6454. fn: function (aString){
  6455. var self=this;
  6456. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6457. return $core.withContext(function($ctx1) {
  6458. $recv($recv($ClassBuilder())._new())._renameClass_to_(self,aString);
  6459. return self;
  6460. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  6461. },
  6462. args: ["aString"],
  6463. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  6464. referencedClasses: ["ClassBuilder"],
  6465. messageSends: ["renameClass:to:", "new"]
  6466. }),
  6467. $globals.Class);
  6468. $core.addMethod(
  6469. $core.method({
  6470. selector: "subclass:instanceVariableNames:",
  6471. protocol: 'class creation',
  6472. fn: function (aString,anotherString){
  6473. var self=this;
  6474. return $core.withContext(function($ctx1) {
  6475. return self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  6476. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.Class)});
  6477. },
  6478. args: ["aString", "anotherString"],
  6479. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  6480. referencedClasses: [],
  6481. messageSends: ["subclass:instanceVariableNames:package:"]
  6482. }),
  6483. $globals.Class);
  6484. $core.addMethod(
  6485. $core.method({
  6486. selector: "subclass:instanceVariableNames:category:",
  6487. protocol: 'class creation',
  6488. fn: function (aString,aString2,aString3){
  6489. var self=this;
  6490. return $core.withContext(function($ctx1) {
  6491. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  6492. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  6493. },
  6494. args: ["aString", "aString2", "aString3"],
  6495. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  6496. referencedClasses: [],
  6497. messageSends: ["subclass:instanceVariableNames:package:"]
  6498. }),
  6499. $globals.Class);
  6500. $core.addMethod(
  6501. $core.method({
  6502. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  6503. protocol: 'class creation',
  6504. fn: function (aString,aString2,classVars,pools,aString3){
  6505. var self=this;
  6506. return $core.withContext(function($ctx1) {
  6507. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  6508. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.Class)});
  6509. },
  6510. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  6511. 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",
  6512. referencedClasses: [],
  6513. messageSends: ["subclass:instanceVariableNames:package:"]
  6514. }),
  6515. $globals.Class);
  6516. $core.addMethod(
  6517. $core.method({
  6518. selector: "subclass:instanceVariableNames:package:",
  6519. protocol: 'class creation',
  6520. fn: function (aString,aString2,aString3){
  6521. var self=this;
  6522. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6523. return $core.withContext(function($ctx1) {
  6524. return $recv($recv($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  6525. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  6526. },
  6527. args: ["aString", "aString2", "aString3"],
  6528. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  6529. referencedClasses: ["ClassBuilder"],
  6530. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  6531. }),
  6532. $globals.Class);
  6533. $core.addMethod(
  6534. $core.method({
  6535. selector: "subclasses",
  6536. protocol: 'accessing',
  6537. fn: function (){
  6538. var self=this;
  6539. return $core.withContext(function($ctx1) {
  6540. return self.subclasses._copy();
  6541. return self;
  6542. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  6543. },
  6544. args: [],
  6545. source: "subclasses\x0a\x09<return self.subclasses._copy()>",
  6546. referencedClasses: [],
  6547. messageSends: []
  6548. }),
  6549. $globals.Class);
  6550. $core.addMethod(
  6551. $core.method({
  6552. selector: "theMetaClass",
  6553. protocol: 'accessing',
  6554. fn: function (){
  6555. var self=this;
  6556. return $core.withContext(function($ctx1) {
  6557. return self._class();
  6558. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  6559. },
  6560. args: [],
  6561. source: "theMetaClass\x0a\x09^ self class",
  6562. referencedClasses: [],
  6563. messageSends: ["class"]
  6564. }),
  6565. $globals.Class);
  6566. $core.addMethod(
  6567. $core.method({
  6568. selector: "theNonMetaClass",
  6569. protocol: 'accessing',
  6570. fn: function (){
  6571. var self=this;
  6572. return self;
  6573. },
  6574. args: [],
  6575. source: "theNonMetaClass\x0a\x09^ self",
  6576. referencedClasses: [],
  6577. messageSends: []
  6578. }),
  6579. $globals.Class);
  6580. $core.addClass('Metaclass', $globals.Behavior, [], 'Kernel-Classes');
  6581. $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.";
  6582. $core.addMethod(
  6583. $core.method({
  6584. selector: "asJavascript",
  6585. protocol: 'converting',
  6586. fn: function (){
  6587. var self=this;
  6588. return $core.withContext(function($ctx1) {
  6589. var $1;
  6590. $1=$recv("$globals.".__comma($recv(self._instanceClass())._name())).__comma(".klass");
  6591. $ctx1.sendIdx[","]=1;
  6592. return $1;
  6593. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Metaclass)});
  6594. },
  6595. args: [],
  6596. source: "asJavascript\x0a\x09^ '$globals.', self instanceClass name, '.klass'",
  6597. referencedClasses: [],
  6598. messageSends: [",", "name", "instanceClass"]
  6599. }),
  6600. $globals.Metaclass);
  6601. $core.addMethod(
  6602. $core.method({
  6603. selector: "definition",
  6604. protocol: 'accessing',
  6605. fn: function (){
  6606. var self=this;
  6607. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  6608. return $core.withContext(function($ctx1) {
  6609. var $1;
  6610. return $recv($String())._streamContents_((function(stream){
  6611. return $core.withContext(function($ctx2) {
  6612. $recv(stream)._nextPutAll_(self._asString());
  6613. $ctx2.sendIdx["nextPutAll:"]=1;
  6614. $1=$recv(stream)._nextPutAll_(" instanceVariableNames: '");
  6615. $ctx2.sendIdx["nextPutAll:"]=2;
  6616. $1;
  6617. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  6618. return $core.withContext(function($ctx3) {
  6619. return $recv(stream)._nextPutAll_(each);
  6620. $ctx3.sendIdx["nextPutAll:"]=3;
  6621. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6622. }),(function(){
  6623. return $core.withContext(function($ctx3) {
  6624. return $recv(stream)._nextPutAll_(" ");
  6625. $ctx3.sendIdx["nextPutAll:"]=4;
  6626. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6627. }));
  6628. return $recv(stream)._nextPutAll_("'");
  6629. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6630. }));
  6631. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  6632. },
  6633. args: [],
  6634. 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: '''' ]",
  6635. referencedClasses: ["String"],
  6636. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"]
  6637. }),
  6638. $globals.Metaclass);
  6639. $core.addMethod(
  6640. $core.method({
  6641. selector: "instanceClass",
  6642. protocol: 'accessing',
  6643. fn: function (){
  6644. var self=this;
  6645. return $core.withContext(function($ctx1) {
  6646. return self.instanceClass;
  6647. return self;
  6648. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  6649. },
  6650. args: [],
  6651. source: "instanceClass\x0a\x09<return self.instanceClass>",
  6652. referencedClasses: [],
  6653. messageSends: []
  6654. }),
  6655. $globals.Metaclass);
  6656. $core.addMethod(
  6657. $core.method({
  6658. selector: "instanceVariableNames:",
  6659. protocol: 'accessing',
  6660. fn: function (aCollection){
  6661. var self=this;
  6662. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6663. return $core.withContext(function($ctx1) {
  6664. $recv($recv($ClassBuilder())._new())._class_instanceVariableNames_(self,aCollection);
  6665. return self;
  6666. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  6667. },
  6668. args: ["aCollection"],
  6669. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
  6670. referencedClasses: ["ClassBuilder"],
  6671. messageSends: ["class:instanceVariableNames:", "new"]
  6672. }),
  6673. $globals.Metaclass);
  6674. $core.addMethod(
  6675. $core.method({
  6676. selector: "isMetaclass",
  6677. protocol: 'testing',
  6678. fn: function (){
  6679. var self=this;
  6680. return true;
  6681. },
  6682. args: [],
  6683. source: "isMetaclass\x0a\x09^ true",
  6684. referencedClasses: [],
  6685. messageSends: []
  6686. }),
  6687. $globals.Metaclass);
  6688. $core.addMethod(
  6689. $core.method({
  6690. selector: "package",
  6691. protocol: 'accessing',
  6692. fn: function (){
  6693. var self=this;
  6694. return $core.withContext(function($ctx1) {
  6695. return $recv(self._instanceClass())._package();
  6696. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  6697. },
  6698. args: [],
  6699. source: "package\x0a\x09^ self instanceClass package",
  6700. referencedClasses: [],
  6701. messageSends: ["package", "instanceClass"]
  6702. }),
  6703. $globals.Metaclass);
  6704. $core.addMethod(
  6705. $core.method({
  6706. selector: "printOn:",
  6707. protocol: 'printing',
  6708. fn: function (aStream){
  6709. var self=this;
  6710. return $core.withContext(function($ctx1) {
  6711. $recv(aStream)._nextPutAll_($recv(self._instanceClass())._name());
  6712. $ctx1.sendIdx["nextPutAll:"]=1;
  6713. $recv(aStream)._nextPutAll_(" class");
  6714. return self;
  6715. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Metaclass)});
  6716. },
  6717. args: ["aStream"],
  6718. source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
  6719. referencedClasses: [],
  6720. messageSends: ["nextPutAll:", "name", "instanceClass"]
  6721. }),
  6722. $globals.Metaclass);
  6723. $core.addMethod(
  6724. $core.method({
  6725. selector: "subclasses",
  6726. protocol: 'accessing',
  6727. fn: function (){
  6728. var self=this;
  6729. return $core.withContext(function($ctx1) {
  6730. return $recv($recv($recv(self._instanceClass())._subclasses())._select_((function(each){
  6731. return $core.withContext(function($ctx2) {
  6732. return $recv($recv(each)._isMetaclass())._not();
  6733. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6734. })))._collect_((function(each){
  6735. return $core.withContext(function($ctx2) {
  6736. return $recv(each)._theMetaClass();
  6737. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  6738. }));
  6739. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  6740. },
  6741. args: [],
  6742. source: "subclasses\x0a\x09^ (self instanceClass subclasses \x0a\x09\x09select: [ :each | each isMetaclass not ])\x0a\x09\x09collect: [ :each | each theMetaClass ]",
  6743. referencedClasses: [],
  6744. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "not", "isMetaclass", "theMetaClass"]
  6745. }),
  6746. $globals.Metaclass);
  6747. $core.addMethod(
  6748. $core.method({
  6749. selector: "theMetaClass",
  6750. protocol: 'accessing',
  6751. fn: function (){
  6752. var self=this;
  6753. return self;
  6754. },
  6755. args: [],
  6756. source: "theMetaClass\x0a\x09^ self",
  6757. referencedClasses: [],
  6758. messageSends: []
  6759. }),
  6760. $globals.Metaclass);
  6761. $core.addMethod(
  6762. $core.method({
  6763. selector: "theNonMetaClass",
  6764. protocol: 'accessing',
  6765. fn: function (){
  6766. var self=this;
  6767. return $core.withContext(function($ctx1) {
  6768. return self._instanceClass();
  6769. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  6770. },
  6771. args: [],
  6772. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  6773. referencedClasses: [],
  6774. messageSends: ["instanceClass"]
  6775. }),
  6776. $globals.Metaclass);
  6777. $core.addClass('ClassBuilder', $globals.Object, [], 'Kernel-Classes');
  6778. $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:`.";
  6779. $core.addMethod(
  6780. $core.method({
  6781. selector: "addSubclassOf:named:instanceVariableNames:package:",
  6782. protocol: 'class definition',
  6783. fn: function (aClass,className,aCollection,packageName){
  6784. var self=this;
  6785. var theClass,thePackage;
  6786. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  6787. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  6788. return $core.withContext(function($ctx1) {
  6789. var $1,$2,$receiver;
  6790. theClass=$recv($recv($Smalltalk())._globals())._at_(className);
  6791. thePackage=$recv($Package())._named_(packageName);
  6792. $1=theClass;
  6793. if(($receiver = $1) == null || $receiver.isNil){
  6794. $1;
  6795. } else {
  6796. $recv(theClass)._package_(thePackage);
  6797. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  6798. if(!$core.assert($2)){
  6799. return self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  6800. };
  6801. };
  6802. return self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  6803. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  6804. },
  6805. args: ["aClass", "className", "aCollection", "packageName"],
  6806. 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",
  6807. referencedClasses: ["Smalltalk", "Package"],
  6808. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "basicAddSubclassOf:named:instanceVariableNames:package:"]
  6809. }),
  6810. $globals.ClassBuilder);
  6811. $core.addMethod(
  6812. $core.method({
  6813. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  6814. protocol: 'private',
  6815. fn: function (aClass,aString,aCollection,packageName){
  6816. var self=this;
  6817. return $core.withContext(function($ctx1) {
  6818. $core.addClass(aString, aClass, aCollection, packageName);
  6819. return $globals[aString]
  6820. ;
  6821. return self;
  6822. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  6823. },
  6824. args: ["aClass", "aString", "aCollection", "packageName"],
  6825. 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>",
  6826. referencedClasses: [],
  6827. messageSends: []
  6828. }),
  6829. $globals.ClassBuilder);
  6830. $core.addMethod(
  6831. $core.method({
  6832. selector: "basicClass:instanceVariableNames:",
  6833. protocol: 'private',
  6834. fn: function (aClass,aString){
  6835. var self=this;
  6836. return $core.withContext(function($ctx1) {
  6837. self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
  6838. return self;
  6839. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  6840. },
  6841. args: ["aClass", "aString"],
  6842. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  6843. referencedClasses: [],
  6844. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"]
  6845. }),
  6846. $globals.ClassBuilder);
  6847. $core.addMethod(
  6848. $core.method({
  6849. selector: "basicClass:instanceVariables:",
  6850. protocol: 'private',
  6851. fn: function (aClass,aCollection){
  6852. var self=this;
  6853. return $core.withContext(function($ctx1) {
  6854. var $1;
  6855. $1=$recv(aClass)._isMetaclass();
  6856. if(!$core.assert($1)){
  6857. self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  6858. };
  6859. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  6860. return self;
  6861. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  6862. },
  6863. args: ["aClass", "aCollection"],
  6864. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  6865. referencedClasses: [],
  6866. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  6867. }),
  6868. $globals.ClassBuilder);
  6869. $core.addMethod(
  6870. $core.method({
  6871. selector: "basicRemoveClass:",
  6872. protocol: 'private',
  6873. fn: function (aClass){
  6874. var self=this;
  6875. return $core.withContext(function($ctx1) {
  6876. $core.removeClass(aClass);
  6877. return self;
  6878. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  6879. },
  6880. args: ["aClass"],
  6881. source: "basicRemoveClass: aClass\x0a\x09<$core.removeClass(aClass)>",
  6882. referencedClasses: [],
  6883. messageSends: []
  6884. }),
  6885. $globals.ClassBuilder);
  6886. $core.addMethod(
  6887. $core.method({
  6888. selector: "basicRenameClass:to:",
  6889. protocol: 'private',
  6890. fn: function (aClass,aString){
  6891. var self=this;
  6892. return $core.withContext(function($ctx1) {
  6893. $globals[aString] = aClass;
  6894. delete $globals[aClass.className];
  6895. aClass.className = aString;
  6896. ;
  6897. return self;
  6898. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  6899. },
  6900. args: ["aClass", "aString"],
  6901. 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>",
  6902. referencedClasses: [],
  6903. messageSends: []
  6904. }),
  6905. $globals.ClassBuilder);
  6906. $core.addMethod(
  6907. $core.method({
  6908. selector: "basicSwapClassNames:with:",
  6909. protocol: 'private',
  6910. fn: function (aClass,anotherClass){
  6911. var self=this;
  6912. return $core.withContext(function($ctx1) {
  6913. var tmp = aClass.className;
  6914. aClass.className = anotherClass.className;
  6915. anotherClass.className = tmp;
  6916. ;
  6917. return self;
  6918. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  6919. },
  6920. args: ["aClass", "anotherClass"],
  6921. 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>",
  6922. referencedClasses: [],
  6923. messageSends: []
  6924. }),
  6925. $globals.ClassBuilder);
  6926. $core.addMethod(
  6927. $core.method({
  6928. selector: "class:instanceVariableNames:",
  6929. protocol: 'class definition',
  6930. fn: function (aClass,ivarNames){
  6931. var self=this;
  6932. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6933. function $ClassDefinitionChanged(){return $globals.ClassDefinitionChanged||(typeof ClassDefinitionChanged=="undefined"?nil:ClassDefinitionChanged)}
  6934. return $core.withContext(function($ctx1) {
  6935. var $1,$3,$2;
  6936. self._basicClass_instanceVariableNames_(aClass,ivarNames);
  6937. self._setupClass_(aClass);
  6938. $1=$recv($SystemAnnouncer())._current();
  6939. $3=$recv($ClassDefinitionChanged())._new();
  6940. $recv($3)._theClass_(aClass);
  6941. $2=$recv($3)._yourself();
  6942. $recv($1)._announce_($2);
  6943. return self;
  6944. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  6945. },
  6946. args: ["aClass", "ivarNames"],
  6947. 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)",
  6948. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  6949. messageSends: ["basicClass:instanceVariableNames:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"]
  6950. }),
  6951. $globals.ClassBuilder);
  6952. $core.addMethod(
  6953. $core.method({
  6954. selector: "copyClass:named:",
  6955. protocol: 'copying',
  6956. fn: function (aClass,className){
  6957. var self=this;
  6958. var newClass;
  6959. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6960. function $ClassAdded(){return $globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  6961. return $core.withContext(function($ctx1) {
  6962. var $1,$3,$2;
  6963. newClass=self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  6964. self._copyClass_to_(aClass,newClass);
  6965. $1=$recv($SystemAnnouncer())._current();
  6966. $3=$recv($ClassAdded())._new();
  6967. $recv($3)._theClass_(newClass);
  6968. $2=$recv($3)._yourself();
  6969. $recv($1)._announce_($2);
  6970. return newClass;
  6971. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  6972. },
  6973. args: ["aClass", "className"],
  6974. 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",
  6975. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  6976. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  6977. }),
  6978. $globals.ClassBuilder);
  6979. $core.addMethod(
  6980. $core.method({
  6981. selector: "copyClass:to:",
  6982. protocol: 'copying',
  6983. fn: function (aClass,anotherClass){
  6984. var self=this;
  6985. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6986. return $core.withContext(function($ctx1) {
  6987. var $1,$2,$3,$4,$5,$7,$6,$9,$8;
  6988. $recv(anotherClass)._comment_($recv(aClass)._comment());
  6989. $1=$recv(aClass)._methodDictionary();
  6990. $ctx1.sendIdx["methodDictionary"]=1;
  6991. $recv($1)._valuesDo_((function(each){
  6992. return $core.withContext(function($ctx2) {
  6993. $2=$recv($Compiler())._new();
  6994. $ctx2.sendIdx["new"]=1;
  6995. $3=$recv(each)._source();
  6996. $ctx2.sendIdx["source"]=1;
  6997. $4=$recv(each)._protocol();
  6998. $ctx2.sendIdx["protocol"]=1;
  6999. return $recv($2)._install_forClass_protocol_($3,anotherClass,$4);
  7000. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  7001. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7002. }));
  7003. $ctx1.sendIdx["valuesDo:"]=1;
  7004. $5=$recv(anotherClass)._class();
  7005. $ctx1.sendIdx["class"]=1;
  7006. $7=$recv(aClass)._class();
  7007. $ctx1.sendIdx["class"]=2;
  7008. $6=$recv($7)._instanceVariableNames();
  7009. self._basicClass_instanceVariables_($5,$6);
  7010. $9=$recv(aClass)._class();
  7011. $ctx1.sendIdx["class"]=3;
  7012. $8=$recv($9)._methodDictionary();
  7013. $recv($8)._valuesDo_((function(each){
  7014. return $core.withContext(function($ctx2) {
  7015. return $recv($recv($Compiler())._new())._install_forClass_protocol_($recv(each)._source(),$recv(anotherClass)._class(),$recv(each)._protocol());
  7016. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7017. }));
  7018. self._setupClass_(anotherClass);
  7019. return self;
  7020. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7021. },
  7022. args: ["aClass", "anotherClass"],
  7023. 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",
  7024. referencedClasses: ["Compiler"],
  7025. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "install:forClass:protocol:", "new", "source", "protocol", "basicClass:instanceVariables:", "class", "instanceVariableNames", "setupClass:"]
  7026. }),
  7027. $globals.ClassBuilder);
  7028. $core.addMethod(
  7029. $core.method({
  7030. selector: "installMethod:forClass:protocol:",
  7031. protocol: 'method definition',
  7032. fn: function (aCompiledMethod,aBehavior,aString){
  7033. var self=this;
  7034. return $core.withContext(function($ctx1) {
  7035. $recv(aCompiledMethod)._protocol_(aString);
  7036. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  7037. return aCompiledMethod;
  7038. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  7039. },
  7040. args: ["aCompiledMethod", "aBehavior", "aString"],
  7041. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  7042. referencedClasses: [],
  7043. messageSends: ["protocol:", "addCompiledMethod:"]
  7044. }),
  7045. $globals.ClassBuilder);
  7046. $core.addMethod(
  7047. $core.method({
  7048. selector: "instanceVariableNamesFor:",
  7049. protocol: 'accessing',
  7050. fn: function (aString){
  7051. var self=this;
  7052. return $core.withContext(function($ctx1) {
  7053. return $recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  7054. return $core.withContext(function($ctx2) {
  7055. return $recv(each)._isEmpty();
  7056. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7057. }));
  7058. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  7059. },
  7060. args: ["aString"],
  7061. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  7062. referencedClasses: [],
  7063. messageSends: ["reject:", "tokenize:", "isEmpty"]
  7064. }),
  7065. $globals.ClassBuilder);
  7066. $core.addMethod(
  7067. $core.method({
  7068. selector: "migrateClass:superclass:",
  7069. protocol: 'class migration',
  7070. fn: function (aClass,anotherClass){
  7071. var self=this;
  7072. return $core.withContext(function($ctx1) {
  7073. var $1;
  7074. $1=$recv(aClass)._name();
  7075. $ctx1.sendIdx["name"]=1;
  7076. return self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  7077. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7078. },
  7079. args: ["aClass", "anotherClass"],
  7080. 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",
  7081. referencedClasses: [],
  7082. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  7083. }),
  7084. $globals.ClassBuilder);
  7085. $core.addMethod(
  7086. $core.method({
  7087. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  7088. protocol: 'class migration',
  7089. fn: function (className,aClass,aCollection,packageName){
  7090. var self=this;
  7091. var oldClass,newClass,tmp;
  7092. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  7093. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  7094. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7095. function $ClassMigrated(){return $globals.ClassMigrated||(typeof ClassMigrated=="undefined"?nil:ClassMigrated)}
  7096. return $core.withContext(function($ctx1) {
  7097. var $1,$2,$4,$3;
  7098. tmp="new*".__comma(className);
  7099. oldClass=$recv($recv($Smalltalk())._globals())._at_(className);
  7100. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  7101. self._basicSwapClassNames_with_(oldClass,newClass);
  7102. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  7103. $recv((function(){
  7104. return $core.withContext(function($ctx2) {
  7105. return self._copyClass_to_(oldClass,newClass);
  7106. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7107. }))._on_do_($Error(),(function(exception){
  7108. return $core.withContext(function($ctx2) {
  7109. self._basicSwapClassNames_with_(oldClass,newClass);
  7110. $1=self._basicRemoveClass_(newClass);
  7111. $ctx2.sendIdx["basicRemoveClass:"]=1;
  7112. $1;
  7113. return $recv(exception)._resignal();
  7114. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  7115. }));
  7116. self._rawRenameClass_to_(oldClass,tmp);
  7117. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  7118. self._rawRenameClass_to_(newClass,className);
  7119. $recv($recv(oldClass)._subclasses())._do_((function(each){
  7120. return $core.withContext(function($ctx2) {
  7121. return self._migrateClass_superclass_(each,newClass);
  7122. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7123. }));
  7124. self._basicRemoveClass_(oldClass);
  7125. $2=$recv($SystemAnnouncer())._current();
  7126. $4=$recv($ClassMigrated())._new();
  7127. $recv($4)._theClass_(newClass);
  7128. $recv($4)._oldClass_(oldClass);
  7129. $3=$recv($4)._yourself();
  7130. $recv($2)._announce_($3);
  7131. return newClass;
  7132. }, 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)});
  7133. },
  7134. args: ["className", "aClass", "aCollection", "packageName"],
  7135. 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",
  7136. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  7137. 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"]
  7138. }),
  7139. $globals.ClassBuilder);
  7140. $core.addMethod(
  7141. $core.method({
  7142. selector: "rawRenameClass:to:",
  7143. protocol: 'private',
  7144. fn: function (aClass,aString){
  7145. var self=this;
  7146. return $core.withContext(function($ctx1) {
  7147. $globals[aString] = aClass;
  7148. ;
  7149. return self;
  7150. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7151. },
  7152. args: ["aClass", "aString"],
  7153. source: "rawRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09$globals[aString] = aClass;\x0a\x09>",
  7154. referencedClasses: [],
  7155. messageSends: []
  7156. }),
  7157. $globals.ClassBuilder);
  7158. $core.addMethod(
  7159. $core.method({
  7160. selector: "renameClass:to:",
  7161. protocol: 'class migration',
  7162. fn: function (aClass,className){
  7163. var self=this;
  7164. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7165. function $ClassRenamed(){return $globals.ClassRenamed||(typeof ClassRenamed=="undefined"?nil:ClassRenamed)}
  7166. return $core.withContext(function($ctx1) {
  7167. var $1,$3,$2;
  7168. self._basicRenameClass_to_(aClass,className);
  7169. $recv(aClass)._recompile();
  7170. $1=$recv($SystemAnnouncer())._current();
  7171. $3=$recv($ClassRenamed())._new();
  7172. $recv($3)._theClass_(aClass);
  7173. $2=$recv($3)._yourself();
  7174. $recv($1)._announce_($2);
  7175. return self;
  7176. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  7177. },
  7178. args: ["aClass", "className"],
  7179. 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)",
  7180. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  7181. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  7182. }),
  7183. $globals.ClassBuilder);
  7184. $core.addMethod(
  7185. $core.method({
  7186. selector: "setupClass:",
  7187. protocol: 'public',
  7188. fn: function (aClass){
  7189. var self=this;
  7190. return $core.withContext(function($ctx1) {
  7191. $core.init(aClass);;
  7192. return self;
  7193. }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},$globals.ClassBuilder)});
  7194. },
  7195. args: ["aClass"],
  7196. source: "setupClass: aClass\x0a\x09<$core.init(aClass);>",
  7197. referencedClasses: [],
  7198. messageSends: []
  7199. }),
  7200. $globals.ClassBuilder);
  7201. $core.addMethod(
  7202. $core.method({
  7203. selector: "superclass:subclass:",
  7204. protocol: 'class definition',
  7205. fn: function (aClass,className){
  7206. var self=this;
  7207. return $core.withContext(function($ctx1) {
  7208. return self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  7209. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  7210. },
  7211. args: ["aClass", "className"],
  7212. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  7213. referencedClasses: [],
  7214. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  7215. }),
  7216. $globals.ClassBuilder);
  7217. $core.addMethod(
  7218. $core.method({
  7219. selector: "superclass:subclass:instanceVariableNames:package:",
  7220. protocol: 'class definition',
  7221. fn: function (aClass,className,ivarNames,packageName){
  7222. var self=this;
  7223. var newClass;
  7224. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7225. function $ClassAdded(){return $globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  7226. return $core.withContext(function($ctx1) {
  7227. var $1,$2,$3,$5,$4,$receiver;
  7228. $1=self._instanceVariableNamesFor_(ivarNames);
  7229. if(($receiver = packageName) == null || $receiver.isNil){
  7230. $2="unclassified";
  7231. } else {
  7232. $2=packageName;
  7233. };
  7234. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  7235. self._setupClass_(newClass);
  7236. $3=$recv($SystemAnnouncer())._current();
  7237. $5=$recv($ClassAdded())._new();
  7238. $recv($5)._theClass_(newClass);
  7239. $4=$recv($5)._yourself();
  7240. $recv($3)._announce_($4);
  7241. return newClass;
  7242. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  7243. },
  7244. args: ["aClass", "className", "ivarNames", "packageName"],
  7245. 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",
  7246. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  7247. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"]
  7248. }),
  7249. $globals.ClassBuilder);
  7250. $core.addClass('ClassSorterNode', $globals.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  7251. $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.";
  7252. $core.addMethod(
  7253. $core.method({
  7254. selector: "getNodesFrom:",
  7255. protocol: 'accessing',
  7256. fn: function (aCollection){
  7257. var self=this;
  7258. var children,others;
  7259. function $ClassSorterNode(){return $globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  7260. return $core.withContext(function($ctx1) {
  7261. var $1;
  7262. children=[];
  7263. others=[];
  7264. $recv(aCollection)._do_((function(each){
  7265. return $core.withContext(function($ctx2) {
  7266. $1=$recv($recv(each)._superclass()).__eq(self._theClass());
  7267. if($core.assert($1)){
  7268. return $recv(children)._add_(each);
  7269. $ctx2.sendIdx["add:"]=1;
  7270. } else {
  7271. return $recv(others)._add_(each);
  7272. };
  7273. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7274. }));
  7275. self["@nodes"]=$recv(children)._collect_((function(each){
  7276. return $core.withContext(function($ctx2) {
  7277. return $recv($ClassSorterNode())._on_classes_level_(each,others,$recv(self._level()).__plus((1)));
  7278. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  7279. }));
  7280. return self;
  7281. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  7282. },
  7283. args: ["aCollection"],
  7284. 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 ]",
  7285. referencedClasses: ["ClassSorterNode"],
  7286. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  7287. }),
  7288. $globals.ClassSorterNode);
  7289. $core.addMethod(
  7290. $core.method({
  7291. selector: "level",
  7292. protocol: 'accessing',
  7293. fn: function (){
  7294. var self=this;
  7295. return self["@level"];
  7296. },
  7297. args: [],
  7298. source: "level\x0a\x09^ level",
  7299. referencedClasses: [],
  7300. messageSends: []
  7301. }),
  7302. $globals.ClassSorterNode);
  7303. $core.addMethod(
  7304. $core.method({
  7305. selector: "level:",
  7306. protocol: 'accessing',
  7307. fn: function (anInteger){
  7308. var self=this;
  7309. self["@level"]=anInteger;
  7310. return self;
  7311. },
  7312. args: ["anInteger"],
  7313. source: "level: anInteger\x0a\x09level := anInteger",
  7314. referencedClasses: [],
  7315. messageSends: []
  7316. }),
  7317. $globals.ClassSorterNode);
  7318. $core.addMethod(
  7319. $core.method({
  7320. selector: "nodes",
  7321. protocol: 'accessing',
  7322. fn: function (){
  7323. var self=this;
  7324. return self["@nodes"];
  7325. },
  7326. args: [],
  7327. source: "nodes\x0a\x09^ nodes",
  7328. referencedClasses: [],
  7329. messageSends: []
  7330. }),
  7331. $globals.ClassSorterNode);
  7332. $core.addMethod(
  7333. $core.method({
  7334. selector: "theClass",
  7335. protocol: 'accessing',
  7336. fn: function (){
  7337. var self=this;
  7338. return self["@theClass"];
  7339. },
  7340. args: [],
  7341. source: "theClass\x0a\x09^ theClass",
  7342. referencedClasses: [],
  7343. messageSends: []
  7344. }),
  7345. $globals.ClassSorterNode);
  7346. $core.addMethod(
  7347. $core.method({
  7348. selector: "theClass:",
  7349. protocol: 'accessing',
  7350. fn: function (aClass){
  7351. var self=this;
  7352. self["@theClass"]=aClass;
  7353. return self;
  7354. },
  7355. args: ["aClass"],
  7356. source: "theClass: aClass\x0a\x09theClass := aClass",
  7357. referencedClasses: [],
  7358. messageSends: []
  7359. }),
  7360. $globals.ClassSorterNode);
  7361. $core.addMethod(
  7362. $core.method({
  7363. selector: "traverseClassesWith:",
  7364. protocol: 'visiting',
  7365. fn: function (aCollection){
  7366. var self=this;
  7367. return $core.withContext(function($ctx1) {
  7368. var $1,$3,$2;
  7369. $1=self._theClass();
  7370. $ctx1.sendIdx["theClass"]=1;
  7371. $recv(aCollection)._add_($1);
  7372. $recv($recv(self._nodes())._sorted_((function(a,b){
  7373. return $core.withContext(function($ctx2) {
  7374. $3=$recv(a)._theClass();
  7375. $ctx2.sendIdx["theClass"]=2;
  7376. $2=$recv($3)._name();
  7377. $ctx2.sendIdx["name"]=1;
  7378. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  7379. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  7380. })))._do_((function(aNode){
  7381. return $core.withContext(function($ctx2) {
  7382. return $recv(aNode)._traverseClassesWith_(aCollection);
  7383. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  7384. }));
  7385. return self;
  7386. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  7387. },
  7388. args: ["aCollection"],
  7389. 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 ].",
  7390. referencedClasses: [],
  7391. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  7392. }),
  7393. $globals.ClassSorterNode);
  7394. $core.addMethod(
  7395. $core.method({
  7396. selector: "on:classes:level:",
  7397. protocol: 'instance creation',
  7398. fn: function (aClass,aCollection,anInteger){
  7399. var self=this;
  7400. return $core.withContext(function($ctx1) {
  7401. var $1;
  7402. $1=self._new();
  7403. $recv($1)._theClass_(aClass);
  7404. $recv($1)._level_(anInteger);
  7405. $recv($1)._getNodesFrom_(aCollection);
  7406. return $recv($1)._yourself();
  7407. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.klass)});
  7408. },
  7409. args: ["aClass", "aCollection", "anInteger"],
  7410. 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",
  7411. referencedClasses: [],
  7412. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  7413. }),
  7414. $globals.ClassSorterNode.klass);
  7415. });
  7416. define("amber_core/Kernel-Methods", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  7417. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  7418. $core.addPackage('Kernel-Methods');
  7419. $core.packages["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
  7420. $core.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7421. $core.addClass('BlockClosure', $globals.Object, [], 'Kernel-Methods');
  7422. $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 | ... ] `";
  7423. $core.addMethod(
  7424. $core.method({
  7425. selector: "applyTo:arguments:",
  7426. protocol: 'evaluating',
  7427. fn: function (anObject,aCollection){
  7428. var self=this;
  7429. return $core.withContext(function($ctx1) {
  7430. return self.apply(anObject, aCollection);
  7431. return self;
  7432. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  7433. },
  7434. args: ["anObject", "aCollection"],
  7435. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  7436. referencedClasses: [],
  7437. messageSends: []
  7438. }),
  7439. $globals.BlockClosure);
  7440. $core.addMethod(
  7441. $core.method({
  7442. selector: "asCompiledMethod:",
  7443. protocol: 'converting',
  7444. fn: function (aString){
  7445. var self=this;
  7446. return $core.withContext(function($ctx1) {
  7447. return $core.method({selector:aString, fn:self});;
  7448. return self;
  7449. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  7450. },
  7451. args: ["aString"],
  7452. source: "asCompiledMethod: aString\x0a\x09<return $core.method({selector:aString, fn:self});>",
  7453. referencedClasses: [],
  7454. messageSends: []
  7455. }),
  7456. $globals.BlockClosure);
  7457. $core.addMethod(
  7458. $core.method({
  7459. selector: "compiledSource",
  7460. protocol: 'accessing',
  7461. fn: function (){
  7462. var self=this;
  7463. return $core.withContext(function($ctx1) {
  7464. return self.toString();
  7465. return self;
  7466. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  7467. },
  7468. args: [],
  7469. source: "compiledSource\x0a\x09<return self.toString()>",
  7470. referencedClasses: [],
  7471. messageSends: []
  7472. }),
  7473. $globals.BlockClosure);
  7474. $core.addMethod(
  7475. $core.method({
  7476. selector: "currySelf",
  7477. protocol: 'converting',
  7478. fn: function (){
  7479. var self=this;
  7480. return $core.withContext(function($ctx1) {
  7481. return function () {
  7482. var args = [ this ];
  7483. args.push.apply(args, arguments);
  7484. return self.apply(null, args);
  7485. }
  7486. ;
  7487. return self;
  7488. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  7489. },
  7490. args: [],
  7491. 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>",
  7492. referencedClasses: [],
  7493. messageSends: []
  7494. }),
  7495. $globals.BlockClosure);
  7496. $core.addMethod(
  7497. $core.method({
  7498. selector: "ensure:",
  7499. protocol: 'evaluating',
  7500. fn: function (aBlock){
  7501. var self=this;
  7502. return $core.withContext(function($ctx1) {
  7503. try{return self._value()}finally{aBlock._value()};
  7504. return self;
  7505. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  7506. },
  7507. args: ["aBlock"],
  7508. source: "ensure: aBlock\x0a\x09<try{return self._value()}finally{aBlock._value()}>",
  7509. referencedClasses: [],
  7510. messageSends: []
  7511. }),
  7512. $globals.BlockClosure);
  7513. $core.addMethod(
  7514. $core.method({
  7515. selector: "fork",
  7516. protocol: 'timeout/interval',
  7517. fn: function (){
  7518. var self=this;
  7519. function $ForkPool(){return $globals.ForkPool||(typeof ForkPool=="undefined"?nil:ForkPool)}
  7520. return $core.withContext(function($ctx1) {
  7521. $recv($recv($ForkPool())._default())._fork_(self);
  7522. return self;
  7523. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  7524. },
  7525. args: [],
  7526. source: "fork\x0a\x09ForkPool default fork: self",
  7527. referencedClasses: ["ForkPool"],
  7528. messageSends: ["fork:", "default"]
  7529. }),
  7530. $globals.BlockClosure);
  7531. $core.addMethod(
  7532. $core.method({
  7533. selector: "new",
  7534. protocol: 'evaluating',
  7535. fn: function (){
  7536. var self=this;
  7537. return $core.withContext(function($ctx1) {
  7538. return new self();
  7539. return self;
  7540. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  7541. },
  7542. args: [],
  7543. 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()>",
  7544. referencedClasses: [],
  7545. messageSends: []
  7546. }),
  7547. $globals.BlockClosure);
  7548. $core.addMethod(
  7549. $core.method({
  7550. selector: "newValue:",
  7551. protocol: 'evaluating',
  7552. fn: function (anObject){
  7553. var self=this;
  7554. return $core.withContext(function($ctx1) {
  7555. return self._newWithValues_([anObject]);
  7556. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  7557. },
  7558. args: ["anObject"],
  7559. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  7560. referencedClasses: [],
  7561. messageSends: ["newWithValues:"]
  7562. }),
  7563. $globals.BlockClosure);
  7564. $core.addMethod(
  7565. $core.method({
  7566. selector: "newValue:value:",
  7567. protocol: 'evaluating',
  7568. fn: function (anObject,anObject2){
  7569. var self=this;
  7570. return $core.withContext(function($ctx1) {
  7571. return self._newWithValues_([anObject,anObject2]);
  7572. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  7573. },
  7574. args: ["anObject", "anObject2"],
  7575. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  7576. referencedClasses: [],
  7577. messageSends: ["newWithValues:"]
  7578. }),
  7579. $globals.BlockClosure);
  7580. $core.addMethod(
  7581. $core.method({
  7582. selector: "newValue:value:value:",
  7583. protocol: 'evaluating',
  7584. fn: function (anObject,anObject2,anObject3){
  7585. var self=this;
  7586. return $core.withContext(function($ctx1) {
  7587. return self._newWithValues_([anObject,anObject2,anObject3]);
  7588. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  7589. },
  7590. args: ["anObject", "anObject2", "anObject3"],
  7591. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  7592. referencedClasses: [],
  7593. messageSends: ["newWithValues:"]
  7594. }),
  7595. $globals.BlockClosure);
  7596. $core.addMethod(
  7597. $core.method({
  7598. selector: "newWithValues:",
  7599. protocol: 'evaluating',
  7600. fn: function (aCollection){
  7601. var self=this;
  7602. return $core.withContext(function($ctx1) {
  7603. var object = Object.create(self.prototype);
  7604. var result = self.apply(object, aCollection);
  7605. return typeof result === "object" ? result : object;
  7606. ;
  7607. return self;
  7608. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  7609. },
  7610. args: ["aCollection"],
  7611. 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>",
  7612. referencedClasses: [],
  7613. messageSends: []
  7614. }),
  7615. $globals.BlockClosure);
  7616. $core.addMethod(
  7617. $core.method({
  7618. selector: "numArgs",
  7619. protocol: 'accessing',
  7620. fn: function (){
  7621. var self=this;
  7622. return $core.withContext(function($ctx1) {
  7623. return self.length;
  7624. return self;
  7625. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  7626. },
  7627. args: [],
  7628. source: "numArgs\x0a\x09<return self.length>",
  7629. referencedClasses: [],
  7630. messageSends: []
  7631. }),
  7632. $globals.BlockClosure);
  7633. $core.addMethod(
  7634. $core.method({
  7635. selector: "on:do:",
  7636. protocol: 'error handling',
  7637. fn: function (anErrorClass,aBlock){
  7638. var self=this;
  7639. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  7640. return $core.withContext(function($ctx1) {
  7641. var $1;
  7642. return self._tryCatch_((function(error){
  7643. var smalltalkError;
  7644. return $core.withContext(function($ctx2) {
  7645. smalltalkError=$recv($Smalltalk())._asSmalltalkException_(error);
  7646. smalltalkError;
  7647. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  7648. if($core.assert($1)){
  7649. return $recv(aBlock)._value_(smalltalkError);
  7650. } else {
  7651. return $recv(smalltalkError)._resignal();
  7652. };
  7653. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  7654. }));
  7655. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  7656. },
  7657. args: ["anErrorClass", "aBlock"],
  7658. 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 ] ]",
  7659. referencedClasses: ["Smalltalk"],
  7660. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"]
  7661. }),
  7662. $globals.BlockClosure);
  7663. $core.addMethod(
  7664. $core.method({
  7665. selector: "receiver",
  7666. protocol: 'accessing',
  7667. fn: function (){
  7668. var self=this;
  7669. return nil;
  7670. },
  7671. args: [],
  7672. source: "receiver\x0a\x09^ nil",
  7673. referencedClasses: [],
  7674. messageSends: []
  7675. }),
  7676. $globals.BlockClosure);
  7677. $core.addMethod(
  7678. $core.method({
  7679. selector: "timeToRun",
  7680. protocol: 'evaluating',
  7681. fn: function (){
  7682. var self=this;
  7683. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  7684. return $core.withContext(function($ctx1) {
  7685. return $recv($Date())._millisecondsToRun_(self);
  7686. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  7687. },
  7688. args: [],
  7689. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  7690. referencedClasses: ["Date"],
  7691. messageSends: ["millisecondsToRun:"]
  7692. }),
  7693. $globals.BlockClosure);
  7694. $core.addMethod(
  7695. $core.method({
  7696. selector: "tryCatch:",
  7697. protocol: 'error handling',
  7698. fn: function (aBlock){
  7699. var self=this;
  7700. return $core.withContext(function($ctx1) {
  7701. try {
  7702. return self._value();
  7703. } catch(error) {
  7704. // pass non-local returns undetected
  7705. if (Array.isArray(error) && error.length === 1) throw error;
  7706. return aBlock._value_(error);
  7707. }
  7708. ;
  7709. return self;
  7710. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  7711. },
  7712. args: ["aBlock"],
  7713. 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>",
  7714. referencedClasses: [],
  7715. messageSends: []
  7716. }),
  7717. $globals.BlockClosure);
  7718. $core.addMethod(
  7719. $core.method({
  7720. selector: "value",
  7721. protocol: 'evaluating',
  7722. fn: function (){
  7723. var self=this;
  7724. return $core.withContext(function($ctx1) {
  7725. return self();;
  7726. return self;
  7727. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  7728. },
  7729. args: [],
  7730. source: "value\x0a\x09<return self();>",
  7731. referencedClasses: [],
  7732. messageSends: []
  7733. }),
  7734. $globals.BlockClosure);
  7735. $core.addMethod(
  7736. $core.method({
  7737. selector: "value:",
  7738. protocol: 'evaluating',
  7739. fn: function (anArg){
  7740. var self=this;
  7741. return $core.withContext(function($ctx1) {
  7742. return self(anArg);;
  7743. return self;
  7744. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  7745. },
  7746. args: ["anArg"],
  7747. source: "value: anArg\x0a\x09<return self(anArg);>",
  7748. referencedClasses: [],
  7749. messageSends: []
  7750. }),
  7751. $globals.BlockClosure);
  7752. $core.addMethod(
  7753. $core.method({
  7754. selector: "value:value:",
  7755. protocol: 'evaluating',
  7756. fn: function (firstArg,secondArg){
  7757. var self=this;
  7758. return $core.withContext(function($ctx1) {
  7759. return self(firstArg, secondArg);;
  7760. return self;
  7761. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  7762. },
  7763. args: ["firstArg", "secondArg"],
  7764. source: "value: firstArg value: secondArg\x0a\x09<return self(firstArg, secondArg);>",
  7765. referencedClasses: [],
  7766. messageSends: []
  7767. }),
  7768. $globals.BlockClosure);
  7769. $core.addMethod(
  7770. $core.method({
  7771. selector: "value:value:value:",
  7772. protocol: 'evaluating',
  7773. fn: function (firstArg,secondArg,thirdArg){
  7774. var self=this;
  7775. return $core.withContext(function($ctx1) {
  7776. return self(firstArg, secondArg, thirdArg);;
  7777. return self;
  7778. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  7779. },
  7780. args: ["firstArg", "secondArg", "thirdArg"],
  7781. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  7782. referencedClasses: [],
  7783. messageSends: []
  7784. }),
  7785. $globals.BlockClosure);
  7786. $core.addMethod(
  7787. $core.method({
  7788. selector: "valueWithInterval:",
  7789. protocol: 'timeout/interval',
  7790. fn: function (aNumber){
  7791. var self=this;
  7792. return $core.withContext(function($ctx1) {
  7793. var interval = setInterval(self, aNumber);
  7794. return $globals.Timeout._on_(interval);
  7795. ;
  7796. return self;
  7797. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  7798. },
  7799. args: ["aNumber"],
  7800. source: "valueWithInterval: aNumber\x0a\x09<\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09>",
  7801. referencedClasses: [],
  7802. messageSends: []
  7803. }),
  7804. $globals.BlockClosure);
  7805. $core.addMethod(
  7806. $core.method({
  7807. selector: "valueWithPossibleArguments:",
  7808. protocol: 'evaluating',
  7809. fn: function (aCollection){
  7810. var self=this;
  7811. return $core.withContext(function($ctx1) {
  7812. return self.apply(null, aCollection);;
  7813. return self;
  7814. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  7815. },
  7816. args: ["aCollection"],
  7817. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  7818. referencedClasses: [],
  7819. messageSends: []
  7820. }),
  7821. $globals.BlockClosure);
  7822. $core.addMethod(
  7823. $core.method({
  7824. selector: "valueWithTimeout:",
  7825. protocol: 'timeout/interval',
  7826. fn: function (aNumber){
  7827. var self=this;
  7828. return $core.withContext(function($ctx1) {
  7829. var timeout = setTimeout(self, aNumber);
  7830. return $globals.Timeout._on_(timeout);
  7831. ;
  7832. return self;
  7833. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  7834. },
  7835. args: ["aNumber"],
  7836. source: "valueWithTimeout: aNumber\x0a\x09<\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09>",
  7837. referencedClasses: [],
  7838. messageSends: []
  7839. }),
  7840. $globals.BlockClosure);
  7841. $core.addMethod(
  7842. $core.method({
  7843. selector: "whileFalse",
  7844. protocol: 'controlling',
  7845. fn: function (){
  7846. var self=this;
  7847. return $core.withContext(function($ctx1) {
  7848. self._whileFalse_((function(){
  7849. }));
  7850. return self;
  7851. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  7852. },
  7853. args: [],
  7854. source: "whileFalse\x0a\x09self whileFalse: []",
  7855. referencedClasses: [],
  7856. messageSends: ["whileFalse:"]
  7857. }),
  7858. $globals.BlockClosure);
  7859. $core.addMethod(
  7860. $core.method({
  7861. selector: "whileFalse:",
  7862. protocol: 'controlling',
  7863. fn: function (aBlock){
  7864. var self=this;
  7865. return $core.withContext(function($ctx1) {
  7866. while(!$core.assert(self._value())) {aBlock._value()};
  7867. return self;
  7868. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  7869. },
  7870. args: ["aBlock"],
  7871. source: "whileFalse: aBlock\x0a\x09<while(!$core.assert(self._value())) {aBlock._value()}>",
  7872. referencedClasses: [],
  7873. messageSends: []
  7874. }),
  7875. $globals.BlockClosure);
  7876. $core.addMethod(
  7877. $core.method({
  7878. selector: "whileTrue",
  7879. protocol: 'controlling',
  7880. fn: function (){
  7881. var self=this;
  7882. return $core.withContext(function($ctx1) {
  7883. self._whileTrue_((function(){
  7884. }));
  7885. return self;
  7886. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  7887. },
  7888. args: [],
  7889. source: "whileTrue\x0a\x09self whileTrue: []",
  7890. referencedClasses: [],
  7891. messageSends: ["whileTrue:"]
  7892. }),
  7893. $globals.BlockClosure);
  7894. $core.addMethod(
  7895. $core.method({
  7896. selector: "whileTrue:",
  7897. protocol: 'controlling',
  7898. fn: function (aBlock){
  7899. var self=this;
  7900. return $core.withContext(function($ctx1) {
  7901. while($core.assert(self._value())) {aBlock._value()};
  7902. return self;
  7903. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  7904. },
  7905. args: ["aBlock"],
  7906. source: "whileTrue: aBlock\x0a\x09<while($core.assert(self._value())) {aBlock._value()}>",
  7907. referencedClasses: [],
  7908. messageSends: []
  7909. }),
  7910. $globals.BlockClosure);
  7911. $core.addClass('CompiledMethod', $globals.Object, [], 'Kernel-Methods');
  7912. $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";
  7913. $core.addMethod(
  7914. $core.method({
  7915. selector: "arguments",
  7916. protocol: 'accessing',
  7917. fn: function (){
  7918. var self=this;
  7919. return $core.withContext(function($ctx1) {
  7920. return self.args || [];
  7921. return self;
  7922. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  7923. },
  7924. args: [],
  7925. source: "arguments\x0a\x09<return self.args || []>",
  7926. referencedClasses: [],
  7927. messageSends: []
  7928. }),
  7929. $globals.CompiledMethod);
  7930. $core.addMethod(
  7931. $core.method({
  7932. selector: "browse",
  7933. protocol: 'browsing',
  7934. fn: function (){
  7935. var self=this;
  7936. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  7937. return $core.withContext(function($ctx1) {
  7938. $recv($Finder())._findMethod_(self);
  7939. return self;
  7940. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  7941. },
  7942. args: [],
  7943. source: "browse\x0a\x09Finder findMethod: self",
  7944. referencedClasses: ["Finder"],
  7945. messageSends: ["findMethod:"]
  7946. }),
  7947. $globals.CompiledMethod);
  7948. $core.addMethod(
  7949. $core.method({
  7950. selector: "category",
  7951. protocol: 'accessing',
  7952. fn: function (){
  7953. var self=this;
  7954. return $core.withContext(function($ctx1) {
  7955. return self._protocol();
  7956. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  7957. },
  7958. args: [],
  7959. source: "category\x0a\x09^ self protocol",
  7960. referencedClasses: [],
  7961. messageSends: ["protocol"]
  7962. }),
  7963. $globals.CompiledMethod);
  7964. $core.addMethod(
  7965. $core.method({
  7966. selector: "defaultProtocol",
  7967. protocol: 'defaults',
  7968. fn: function (){
  7969. var self=this;
  7970. return "as yet unclassified";
  7971. },
  7972. args: [],
  7973. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  7974. referencedClasses: [],
  7975. messageSends: []
  7976. }),
  7977. $globals.CompiledMethod);
  7978. $core.addMethod(
  7979. $core.method({
  7980. selector: "fn",
  7981. protocol: 'accessing',
  7982. fn: function (){
  7983. var self=this;
  7984. return $core.withContext(function($ctx1) {
  7985. return self._basicAt_("fn");
  7986. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  7987. },
  7988. args: [],
  7989. source: "fn\x0a\x09^ self basicAt: 'fn'",
  7990. referencedClasses: [],
  7991. messageSends: ["basicAt:"]
  7992. }),
  7993. $globals.CompiledMethod);
  7994. $core.addMethod(
  7995. $core.method({
  7996. selector: "fn:",
  7997. protocol: 'accessing',
  7998. fn: function (aBlock){
  7999. var self=this;
  8000. return $core.withContext(function($ctx1) {
  8001. self._basicAt_put_("fn",aBlock);
  8002. return self;
  8003. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  8004. },
  8005. args: ["aBlock"],
  8006. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  8007. referencedClasses: [],
  8008. messageSends: ["basicAt:put:"]
  8009. }),
  8010. $globals.CompiledMethod);
  8011. $core.addMethod(
  8012. $core.method({
  8013. selector: "isCompiledMethod",
  8014. protocol: 'testing',
  8015. fn: function (){
  8016. var self=this;
  8017. return true;
  8018. },
  8019. args: [],
  8020. source: "isCompiledMethod\x0a\x09^ true",
  8021. referencedClasses: [],
  8022. messageSends: []
  8023. }),
  8024. $globals.CompiledMethod);
  8025. $core.addMethod(
  8026. $core.method({
  8027. selector: "isOverridden",
  8028. protocol: 'testing',
  8029. fn: function (){
  8030. var self=this;
  8031. var selector;
  8032. return $core.withContext(function($ctx1) {
  8033. var $1;
  8034. var $early={};
  8035. try {
  8036. selector=self._selector();
  8037. $recv(self._methodClass())._allSubclassesDo_((function(each){
  8038. return $core.withContext(function($ctx2) {
  8039. $1=$recv(each)._includesSelector_(selector);
  8040. if($core.assert($1)){
  8041. throw $early=[true];
  8042. };
  8043. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8044. }));
  8045. return false;
  8046. }
  8047. catch(e) {if(e===$early)return e[0]; throw e}
  8048. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  8049. },
  8050. args: [],
  8051. 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",
  8052. referencedClasses: [],
  8053. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  8054. }),
  8055. $globals.CompiledMethod);
  8056. $core.addMethod(
  8057. $core.method({
  8058. selector: "isOverride",
  8059. protocol: 'testing',
  8060. fn: function (){
  8061. var self=this;
  8062. var superclass;
  8063. return $core.withContext(function($ctx1) {
  8064. var $1,$2,$receiver;
  8065. $1=self._methodClass();
  8066. $ctx1.sendIdx["methodClass"]=1;
  8067. superclass=$recv($1)._superclass();
  8068. $ctx1.sendIdx["superclass"]=1;
  8069. $2=superclass;
  8070. if(($receiver = $2) == null || $receiver.isNil){
  8071. return false;
  8072. } else {
  8073. $2;
  8074. };
  8075. return $recv($recv($recv(self._methodClass())._superclass())._lookupSelector_(self._selector()))._notNil();
  8076. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  8077. },
  8078. args: [],
  8079. 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",
  8080. referencedClasses: [],
  8081. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  8082. }),
  8083. $globals.CompiledMethod);
  8084. $core.addMethod(
  8085. $core.method({
  8086. selector: "messageSends",
  8087. protocol: 'accessing',
  8088. fn: function (){
  8089. var self=this;
  8090. return $core.withContext(function($ctx1) {
  8091. return self._basicAt_("messageSends");
  8092. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  8093. },
  8094. args: [],
  8095. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  8096. referencedClasses: [],
  8097. messageSends: ["basicAt:"]
  8098. }),
  8099. $globals.CompiledMethod);
  8100. $core.addMethod(
  8101. $core.method({
  8102. selector: "methodClass",
  8103. protocol: 'accessing',
  8104. fn: function (){
  8105. var self=this;
  8106. return $core.withContext(function($ctx1) {
  8107. return self._basicAt_("methodClass");
  8108. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  8109. },
  8110. args: [],
  8111. source: "methodClass\x0a\x09^ self basicAt: 'methodClass'",
  8112. referencedClasses: [],
  8113. messageSends: ["basicAt:"]
  8114. }),
  8115. $globals.CompiledMethod);
  8116. $core.addMethod(
  8117. $core.method({
  8118. selector: "package",
  8119. protocol: 'accessing',
  8120. fn: function (){
  8121. var self=this;
  8122. return $core.withContext(function($ctx1) {
  8123. var $1,$receiver;
  8124. $1=self._methodClass();
  8125. if(($receiver = $1) == null || $receiver.isNil){
  8126. return $1;
  8127. } else {
  8128. var class_;
  8129. class_=$receiver;
  8130. return $recv(class_)._packageOfProtocol_(self._protocol());
  8131. };
  8132. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  8133. },
  8134. args: [],
  8135. 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 ]",
  8136. referencedClasses: [],
  8137. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  8138. }),
  8139. $globals.CompiledMethod);
  8140. $core.addMethod(
  8141. $core.method({
  8142. selector: "protocol",
  8143. protocol: 'accessing',
  8144. fn: function (){
  8145. var self=this;
  8146. return $core.withContext(function($ctx1) {
  8147. var $1,$receiver;
  8148. $1=self._basicAt_("protocol");
  8149. if(($receiver = $1) == null || $receiver.isNil){
  8150. return self._defaultProtocol();
  8151. } else {
  8152. return $1;
  8153. };
  8154. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  8155. },
  8156. args: [],
  8157. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  8158. referencedClasses: [],
  8159. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  8160. }),
  8161. $globals.CompiledMethod);
  8162. $core.addMethod(
  8163. $core.method({
  8164. selector: "protocol:",
  8165. protocol: 'accessing',
  8166. fn: function (aString){
  8167. var self=this;
  8168. var oldProtocol;
  8169. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  8170. function $MethodMoved(){return $globals.MethodMoved||(typeof MethodMoved=="undefined"?nil:MethodMoved)}
  8171. return $core.withContext(function($ctx1) {
  8172. var $1,$3,$2,$4,$receiver;
  8173. oldProtocol=self._protocol();
  8174. self._basicAt_put_("protocol",aString);
  8175. $1=$recv($SystemAnnouncer())._current();
  8176. $3=$recv($MethodMoved())._new();
  8177. $recv($3)._method_(self);
  8178. $recv($3)._oldProtocol_(oldProtocol);
  8179. $2=$recv($3)._yourself();
  8180. $recv($1)._announce_($2);
  8181. $4=self._methodClass();
  8182. if(($receiver = $4) == null || $receiver.isNil){
  8183. $4;
  8184. } else {
  8185. var methodClass;
  8186. methodClass=$receiver;
  8187. $recv($recv(methodClass)._organization())._addElement_(aString);
  8188. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  8189. };
  8190. return self;
  8191. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  8192. },
  8193. args: ["aString"],
  8194. 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 ]",
  8195. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  8196. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  8197. }),
  8198. $globals.CompiledMethod);
  8199. $core.addMethod(
  8200. $core.method({
  8201. selector: "referencedClasses",
  8202. protocol: 'accessing',
  8203. fn: function (){
  8204. var self=this;
  8205. return $core.withContext(function($ctx1) {
  8206. return self._basicAt_("referencedClasses");
  8207. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  8208. },
  8209. args: [],
  8210. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  8211. referencedClasses: [],
  8212. messageSends: ["basicAt:"]
  8213. }),
  8214. $globals.CompiledMethod);
  8215. $core.addMethod(
  8216. $core.method({
  8217. selector: "selector",
  8218. protocol: 'accessing',
  8219. fn: function (){
  8220. var self=this;
  8221. return $core.withContext(function($ctx1) {
  8222. return self._basicAt_("selector");
  8223. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  8224. },
  8225. args: [],
  8226. source: "selector\x0a\x09^ self basicAt: 'selector'",
  8227. referencedClasses: [],
  8228. messageSends: ["basicAt:"]
  8229. }),
  8230. $globals.CompiledMethod);
  8231. $core.addMethod(
  8232. $core.method({
  8233. selector: "selector:",
  8234. protocol: 'accessing',
  8235. fn: function (aString){
  8236. var self=this;
  8237. return $core.withContext(function($ctx1) {
  8238. self._basicAt_put_("selector",aString);
  8239. return self;
  8240. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  8241. },
  8242. args: ["aString"],
  8243. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  8244. referencedClasses: [],
  8245. messageSends: ["basicAt:put:"]
  8246. }),
  8247. $globals.CompiledMethod);
  8248. $core.addMethod(
  8249. $core.method({
  8250. selector: "sendTo:arguments:",
  8251. protocol: 'evaluating',
  8252. fn: function (anObject,aCollection){
  8253. var self=this;
  8254. return $core.withContext(function($ctx1) {
  8255. return $recv(self._fn())._applyTo_arguments_(anObject,aCollection);
  8256. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  8257. },
  8258. args: ["anObject", "aCollection"],
  8259. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  8260. referencedClasses: [],
  8261. messageSends: ["applyTo:arguments:", "fn"]
  8262. }),
  8263. $globals.CompiledMethod);
  8264. $core.addMethod(
  8265. $core.method({
  8266. selector: "source",
  8267. protocol: 'accessing',
  8268. fn: function (){
  8269. var self=this;
  8270. return $core.withContext(function($ctx1) {
  8271. var $1,$receiver;
  8272. $1=self._basicAt_("source");
  8273. if(($receiver = $1) == null || $receiver.isNil){
  8274. return "";
  8275. } else {
  8276. return $1;
  8277. };
  8278. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  8279. },
  8280. args: [],
  8281. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  8282. referencedClasses: [],
  8283. messageSends: ["ifNil:", "basicAt:"]
  8284. }),
  8285. $globals.CompiledMethod);
  8286. $core.addMethod(
  8287. $core.method({
  8288. selector: "source:",
  8289. protocol: 'accessing',
  8290. fn: function (aString){
  8291. var self=this;
  8292. return $core.withContext(function($ctx1) {
  8293. self._basicAt_put_("source",aString);
  8294. return self;
  8295. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  8296. },
  8297. args: ["aString"],
  8298. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  8299. referencedClasses: [],
  8300. messageSends: ["basicAt:put:"]
  8301. }),
  8302. $globals.CompiledMethod);
  8303. $core.addClass('ForkPool', $globals.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  8304. $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`";
  8305. $core.addMethod(
  8306. $core.method({
  8307. selector: "addWorker",
  8308. protocol: 'private',
  8309. fn: function (){
  8310. var self=this;
  8311. return $core.withContext(function($ctx1) {
  8312. $recv(self["@worker"])._valueWithTimeout_((0));
  8313. self["@poolSize"]=$recv(self["@poolSize"]).__plus((1));
  8314. return self;
  8315. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  8316. },
  8317. args: [],
  8318. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  8319. referencedClasses: [],
  8320. messageSends: ["valueWithTimeout:", "+"]
  8321. }),
  8322. $globals.ForkPool);
  8323. $core.addMethod(
  8324. $core.method({
  8325. selector: "defaultMaxPoolSize",
  8326. protocol: 'defaults',
  8327. fn: function (){
  8328. var self=this;
  8329. return $core.withContext(function($ctx1) {
  8330. return $recv(self._class())._defaultMaxPoolSize();
  8331. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  8332. },
  8333. args: [],
  8334. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  8335. referencedClasses: [],
  8336. messageSends: ["defaultMaxPoolSize", "class"]
  8337. }),
  8338. $globals.ForkPool);
  8339. $core.addMethod(
  8340. $core.method({
  8341. selector: "fork:",
  8342. protocol: 'actions',
  8343. fn: function (aBlock){
  8344. var self=this;
  8345. return $core.withContext(function($ctx1) {
  8346. var $1;
  8347. $1=$recv(self["@poolSize"]).__lt(self._maxPoolSize());
  8348. if($core.assert($1)){
  8349. self._addWorker();
  8350. };
  8351. $recv(self["@queue"])._nextPut_(aBlock);
  8352. return self;
  8353. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  8354. },
  8355. args: ["aBlock"],
  8356. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  8357. referencedClasses: [],
  8358. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  8359. }),
  8360. $globals.ForkPool);
  8361. $core.addMethod(
  8362. $core.method({
  8363. selector: "initialize",
  8364. protocol: 'initialization',
  8365. fn: function (){
  8366. var self=this;
  8367. function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  8368. return $core.withContext(function($ctx1) {
  8369. (
  8370. $ctx1.supercall = true,
  8371. ($globals.ForkPool.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  8372. $ctx1.supercall = false;
  8373. self["@poolSize"]=(0);
  8374. self["@queue"]=$recv($Queue())._new();
  8375. self["@worker"]=self._makeWorker();
  8376. return self;
  8377. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  8378. },
  8379. args: [],
  8380. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  8381. referencedClasses: ["Queue"],
  8382. messageSends: ["initialize", "new", "makeWorker"]
  8383. }),
  8384. $globals.ForkPool);
  8385. $core.addMethod(
  8386. $core.method({
  8387. selector: "makeWorker",
  8388. protocol: 'initialization',
  8389. fn: function (){
  8390. var self=this;
  8391. var sentinel;
  8392. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  8393. return $core.withContext(function($ctx1) {
  8394. var $1;
  8395. sentinel=$recv($Object())._new();
  8396. return (function(){
  8397. var block;
  8398. return $core.withContext(function($ctx2) {
  8399. self["@poolSize"]=$recv(self["@poolSize"]).__minus((1));
  8400. self["@poolSize"];
  8401. block=$recv(self["@queue"])._nextIfAbsent_((function(){
  8402. return sentinel;
  8403. }));
  8404. block;
  8405. $1=$recv(block).__eq_eq(sentinel);
  8406. if(!$core.assert($1)){
  8407. return $recv((function(){
  8408. return $core.withContext(function($ctx3) {
  8409. return $recv(block)._value();
  8410. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  8411. }))._ensure_((function(){
  8412. return $core.withContext(function($ctx3) {
  8413. return self._addWorker();
  8414. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  8415. }));
  8416. };
  8417. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  8418. });
  8419. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  8420. },
  8421. args: [],
  8422. 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 ] ]]",
  8423. referencedClasses: ["Object"],
  8424. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  8425. }),
  8426. $globals.ForkPool);
  8427. $core.addMethod(
  8428. $core.method({
  8429. selector: "maxPoolSize",
  8430. protocol: 'accessing',
  8431. fn: function (){
  8432. var self=this;
  8433. return $core.withContext(function($ctx1) {
  8434. var $1,$receiver;
  8435. $1=self["@maxPoolSize"];
  8436. if(($receiver = $1) == null || $receiver.isNil){
  8437. return self._defaultMaxPoolSize();
  8438. } else {
  8439. return $1;
  8440. };
  8441. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  8442. },
  8443. args: [],
  8444. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  8445. referencedClasses: [],
  8446. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  8447. }),
  8448. $globals.ForkPool);
  8449. $core.addMethod(
  8450. $core.method({
  8451. selector: "maxPoolSize:",
  8452. protocol: 'accessing',
  8453. fn: function (anInteger){
  8454. var self=this;
  8455. self["@maxPoolSize"]=anInteger;
  8456. return self;
  8457. },
  8458. args: ["anInteger"],
  8459. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  8460. referencedClasses: [],
  8461. messageSends: []
  8462. }),
  8463. $globals.ForkPool);
  8464. $globals.ForkPool.klass.iVarNames = ['default'];
  8465. $core.addMethod(
  8466. $core.method({
  8467. selector: "default",
  8468. protocol: 'accessing',
  8469. fn: function (){
  8470. var self=this;
  8471. return $core.withContext(function($ctx1) {
  8472. var $1,$receiver;
  8473. $1=self["@default"];
  8474. if(($receiver = $1) == null || $receiver.isNil){
  8475. self["@default"]=self._new();
  8476. return self["@default"];
  8477. } else {
  8478. return $1;
  8479. };
  8480. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.klass)});
  8481. },
  8482. args: [],
  8483. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  8484. referencedClasses: [],
  8485. messageSends: ["ifNil:", "new"]
  8486. }),
  8487. $globals.ForkPool.klass);
  8488. $core.addMethod(
  8489. $core.method({
  8490. selector: "defaultMaxPoolSize",
  8491. protocol: 'accessing',
  8492. fn: function (){
  8493. var self=this;
  8494. return (100);
  8495. },
  8496. args: [],
  8497. source: "defaultMaxPoolSize\x0a\x09^ 100",
  8498. referencedClasses: [],
  8499. messageSends: []
  8500. }),
  8501. $globals.ForkPool.klass);
  8502. $core.addMethod(
  8503. $core.method({
  8504. selector: "resetDefault",
  8505. protocol: 'accessing',
  8506. fn: function (){
  8507. var self=this;
  8508. self["@default"]=nil;
  8509. return self;
  8510. },
  8511. args: [],
  8512. source: "resetDefault\x0a\x09default := nil",
  8513. referencedClasses: [],
  8514. messageSends: []
  8515. }),
  8516. $globals.ForkPool.klass);
  8517. $core.addClass('Message', $globals.Object, ['selector', 'arguments'], 'Kernel-Methods');
  8518. $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.";
  8519. $core.addMethod(
  8520. $core.method({
  8521. selector: "arguments",
  8522. protocol: 'accessing',
  8523. fn: function (){
  8524. var self=this;
  8525. return self["@arguments"];
  8526. },
  8527. args: [],
  8528. source: "arguments\x0a\x09^ arguments",
  8529. referencedClasses: [],
  8530. messageSends: []
  8531. }),
  8532. $globals.Message);
  8533. $core.addMethod(
  8534. $core.method({
  8535. selector: "arguments:",
  8536. protocol: 'accessing',
  8537. fn: function (anArray){
  8538. var self=this;
  8539. self["@arguments"]=anArray;
  8540. return self;
  8541. },
  8542. args: ["anArray"],
  8543. source: "arguments: anArray\x0a\x09arguments := anArray",
  8544. referencedClasses: [],
  8545. messageSends: []
  8546. }),
  8547. $globals.Message);
  8548. $core.addMethod(
  8549. $core.method({
  8550. selector: "printOn:",
  8551. protocol: 'printing',
  8552. fn: function (aStream){
  8553. var self=this;
  8554. return $core.withContext(function($ctx1) {
  8555. (
  8556. $ctx1.supercall = true,
  8557. ($globals.Message.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  8558. $ctx1.supercall = false;
  8559. $recv(aStream)._nextPutAll_("(");
  8560. $ctx1.sendIdx["nextPutAll:"]=1;
  8561. $recv(aStream)._nextPutAll_(self._selector());
  8562. $ctx1.sendIdx["nextPutAll:"]=2;
  8563. $recv(aStream)._nextPutAll_(")");
  8564. return self;
  8565. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  8566. },
  8567. args: ["aStream"],
  8568. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  8569. referencedClasses: [],
  8570. messageSends: ["printOn:", "nextPutAll:", "selector"]
  8571. }),
  8572. $globals.Message);
  8573. $core.addMethod(
  8574. $core.method({
  8575. selector: "selector",
  8576. protocol: 'accessing',
  8577. fn: function (){
  8578. var self=this;
  8579. return self["@selector"];
  8580. },
  8581. args: [],
  8582. source: "selector\x0a\x09^ selector",
  8583. referencedClasses: [],
  8584. messageSends: []
  8585. }),
  8586. $globals.Message);
  8587. $core.addMethod(
  8588. $core.method({
  8589. selector: "selector:",
  8590. protocol: 'accessing',
  8591. fn: function (aString){
  8592. var self=this;
  8593. self["@selector"]=aString;
  8594. return self;
  8595. },
  8596. args: ["aString"],
  8597. source: "selector: aString\x0a\x09selector := aString",
  8598. referencedClasses: [],
  8599. messageSends: []
  8600. }),
  8601. $globals.Message);
  8602. $core.addMethod(
  8603. $core.method({
  8604. selector: "sendTo:",
  8605. protocol: 'actions',
  8606. fn: function (anObject){
  8607. var self=this;
  8608. return $core.withContext(function($ctx1) {
  8609. return $recv(anObject)._perform_withArguments_(self._selector(),self._arguments());
  8610. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  8611. },
  8612. args: ["anObject"],
  8613. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  8614. referencedClasses: [],
  8615. messageSends: ["perform:withArguments:", "selector", "arguments"]
  8616. }),
  8617. $globals.Message);
  8618. $core.addMethod(
  8619. $core.method({
  8620. selector: "selector:arguments:",
  8621. protocol: 'instance creation',
  8622. fn: function (aString,anArray){
  8623. var self=this;
  8624. return $core.withContext(function($ctx1) {
  8625. var $1;
  8626. $1=self._new();
  8627. $recv($1)._selector_(aString);
  8628. $recv($1)._arguments_(anArray);
  8629. return $recv($1)._yourself();
  8630. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.klass)});
  8631. },
  8632. args: ["aString", "anArray"],
  8633. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  8634. referencedClasses: [],
  8635. messageSends: ["selector:", "new", "arguments:", "yourself"]
  8636. }),
  8637. $globals.Message.klass);
  8638. $core.addClass('MessageSend', $globals.Object, ['receiver', 'message'], 'Kernel-Methods');
  8639. $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.";
  8640. $core.addMethod(
  8641. $core.method({
  8642. selector: "arguments",
  8643. protocol: 'accessing',
  8644. fn: function (){
  8645. var self=this;
  8646. return $core.withContext(function($ctx1) {
  8647. return $recv(self["@message"])._arguments();
  8648. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  8649. },
  8650. args: [],
  8651. source: "arguments\x0a\x09^ message arguments",
  8652. referencedClasses: [],
  8653. messageSends: ["arguments"]
  8654. }),
  8655. $globals.MessageSend);
  8656. $core.addMethod(
  8657. $core.method({
  8658. selector: "arguments:",
  8659. protocol: 'accessing',
  8660. fn: function (aCollection){
  8661. var self=this;
  8662. return $core.withContext(function($ctx1) {
  8663. $recv(self["@message"])._arguments_(aCollection);
  8664. return self;
  8665. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  8666. },
  8667. args: ["aCollection"],
  8668. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  8669. referencedClasses: [],
  8670. messageSends: ["arguments:"]
  8671. }),
  8672. $globals.MessageSend);
  8673. $core.addMethod(
  8674. $core.method({
  8675. selector: "initialize",
  8676. protocol: 'initialization',
  8677. fn: function (){
  8678. var self=this;
  8679. function $Message(){return $globals.Message||(typeof Message=="undefined"?nil:Message)}
  8680. return $core.withContext(function($ctx1) {
  8681. (
  8682. $ctx1.supercall = true,
  8683. ($globals.MessageSend.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  8684. $ctx1.supercall = false;
  8685. self["@message"]=$recv($Message())._new();
  8686. return self;
  8687. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  8688. },
  8689. args: [],
  8690. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  8691. referencedClasses: ["Message"],
  8692. messageSends: ["initialize", "new"]
  8693. }),
  8694. $globals.MessageSend);
  8695. $core.addMethod(
  8696. $core.method({
  8697. selector: "printOn:",
  8698. protocol: 'printing',
  8699. fn: function (aStream){
  8700. var self=this;
  8701. return $core.withContext(function($ctx1) {
  8702. (
  8703. $ctx1.supercall = true,
  8704. ($globals.MessageSend.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  8705. $ctx1.supercall = false;
  8706. $recv(aStream)._nextPutAll_("(");
  8707. $ctx1.sendIdx["nextPutAll:"]=1;
  8708. $recv(aStream)._nextPutAll_(self._receiver());
  8709. $ctx1.sendIdx["nextPutAll:"]=2;
  8710. $recv(aStream)._nextPutAll_(" >> ");
  8711. $ctx1.sendIdx["nextPutAll:"]=3;
  8712. $recv(aStream)._nextPutAll_(self._selector());
  8713. $ctx1.sendIdx["nextPutAll:"]=4;
  8714. $recv(aStream)._nextPutAll_(")");
  8715. return self;
  8716. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  8717. },
  8718. args: ["aStream"],
  8719. 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: ')'",
  8720. referencedClasses: [],
  8721. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  8722. }),
  8723. $globals.MessageSend);
  8724. $core.addMethod(
  8725. $core.method({
  8726. selector: "receiver",
  8727. protocol: 'accessing',
  8728. fn: function (){
  8729. var self=this;
  8730. return self["@receiver"];
  8731. },
  8732. args: [],
  8733. source: "receiver\x0a\x09^ receiver",
  8734. referencedClasses: [],
  8735. messageSends: []
  8736. }),
  8737. $globals.MessageSend);
  8738. $core.addMethod(
  8739. $core.method({
  8740. selector: "receiver:",
  8741. protocol: 'accessing',
  8742. fn: function (anObject){
  8743. var self=this;
  8744. self["@receiver"]=anObject;
  8745. return self;
  8746. },
  8747. args: ["anObject"],
  8748. source: "receiver: anObject\x0a\x09receiver := anObject",
  8749. referencedClasses: [],
  8750. messageSends: []
  8751. }),
  8752. $globals.MessageSend);
  8753. $core.addMethod(
  8754. $core.method({
  8755. selector: "selector",
  8756. protocol: 'accessing',
  8757. fn: function (){
  8758. var self=this;
  8759. return $core.withContext(function($ctx1) {
  8760. return $recv(self["@message"])._selector();
  8761. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  8762. },
  8763. args: [],
  8764. source: "selector\x0a\x09^ message selector",
  8765. referencedClasses: [],
  8766. messageSends: ["selector"]
  8767. }),
  8768. $globals.MessageSend);
  8769. $core.addMethod(
  8770. $core.method({
  8771. selector: "selector:",
  8772. protocol: 'accessing',
  8773. fn: function (aString){
  8774. var self=this;
  8775. return $core.withContext(function($ctx1) {
  8776. $recv(self["@message"])._selector_(aString);
  8777. return self;
  8778. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  8779. },
  8780. args: ["aString"],
  8781. source: "selector: aString\x0a\x09message selector: aString",
  8782. referencedClasses: [],
  8783. messageSends: ["selector:"]
  8784. }),
  8785. $globals.MessageSend);
  8786. $core.addMethod(
  8787. $core.method({
  8788. selector: "value",
  8789. protocol: 'evaluating',
  8790. fn: function (){
  8791. var self=this;
  8792. return $core.withContext(function($ctx1) {
  8793. return $recv(self["@message"])._sendTo_(self._receiver());
  8794. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  8795. },
  8796. args: [],
  8797. source: "value\x0a\x09^ message sendTo: self receiver",
  8798. referencedClasses: [],
  8799. messageSends: ["sendTo:", "receiver"]
  8800. }),
  8801. $globals.MessageSend);
  8802. $core.addMethod(
  8803. $core.method({
  8804. selector: "value:",
  8805. protocol: 'evaluating',
  8806. fn: function (anObject){
  8807. var self=this;
  8808. return $core.withContext(function($ctx1) {
  8809. var $1;
  8810. $1=self["@message"];
  8811. $recv($1)._arguments_([anObject]);
  8812. return $recv($1)._sendTo_(self._receiver());
  8813. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  8814. },
  8815. args: ["anObject"],
  8816. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  8817. referencedClasses: [],
  8818. messageSends: ["arguments:", "sendTo:", "receiver"]
  8819. }),
  8820. $globals.MessageSend);
  8821. $core.addMethod(
  8822. $core.method({
  8823. selector: "value:value:",
  8824. protocol: 'evaluating',
  8825. fn: function (firstArgument,secondArgument){
  8826. var self=this;
  8827. return $core.withContext(function($ctx1) {
  8828. var $1;
  8829. $1=self["@message"];
  8830. $recv($1)._arguments_([firstArgument,secondArgument]);
  8831. return $recv($1)._sendTo_(self._receiver());
  8832. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  8833. },
  8834. args: ["firstArgument", "secondArgument"],
  8835. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  8836. referencedClasses: [],
  8837. messageSends: ["arguments:", "sendTo:", "receiver"]
  8838. }),
  8839. $globals.MessageSend);
  8840. $core.addMethod(
  8841. $core.method({
  8842. selector: "value:value:value:",
  8843. protocol: 'evaluating',
  8844. fn: function (firstArgument,secondArgument,thirdArgument){
  8845. var self=this;
  8846. return $core.withContext(function($ctx1) {
  8847. var $1;
  8848. $1=self["@message"];
  8849. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  8850. return $recv($1)._sendTo_(self._receiver());
  8851. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  8852. },
  8853. args: ["firstArgument", "secondArgument", "thirdArgument"],
  8854. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  8855. referencedClasses: [],
  8856. messageSends: ["arguments:", "sendTo:", "receiver"]
  8857. }),
  8858. $globals.MessageSend);
  8859. $core.addMethod(
  8860. $core.method({
  8861. selector: "valueWithPossibleArguments:",
  8862. protocol: 'evaluating',
  8863. fn: function (aCollection){
  8864. var self=this;
  8865. return $core.withContext(function($ctx1) {
  8866. self._arguments_(aCollection);
  8867. return self._value();
  8868. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  8869. },
  8870. args: ["aCollection"],
  8871. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  8872. referencedClasses: [],
  8873. messageSends: ["arguments:", "value"]
  8874. }),
  8875. $globals.MessageSend);
  8876. $core.addClass('MethodContext', $globals.Object, [], 'Kernel-Methods');
  8877. $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`.";
  8878. $core.addMethod(
  8879. $core.method({
  8880. selector: "asString",
  8881. protocol: 'converting',
  8882. fn: function (){
  8883. var self=this;
  8884. return $core.withContext(function($ctx1) {
  8885. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  8886. $2=self._isBlockContext();
  8887. if($core.assert($2)){
  8888. $3="a block (in ".__comma($recv(self._methodContext())._asString());
  8889. $ctx1.sendIdx[","]=2;
  8890. $1=$recv($3).__comma(")");
  8891. $ctx1.sendIdx[","]=1;
  8892. } else {
  8893. var methodClass;
  8894. methodClass=$recv(self._method())._methodClass();
  8895. methodClass;
  8896. $5=methodClass;
  8897. $7=self._receiver();
  8898. $ctx1.sendIdx["receiver"]=1;
  8899. $6=$recv($7)._class();
  8900. $ctx1.sendIdx["class"]=1;
  8901. $4=$recv($5).__eq($6);
  8902. if($core.assert($4)){
  8903. $11=self._receiver();
  8904. $ctx1.sendIdx["receiver"]=2;
  8905. $10=$recv($11)._class();
  8906. $ctx1.sendIdx["class"]=2;
  8907. $9=$recv($10)._name();
  8908. $ctx1.sendIdx["name"]=1;
  8909. $8=$recv($9).__comma(" >> ");
  8910. $ctx1.sendIdx[","]=4;
  8911. $12=self._selector();
  8912. $ctx1.sendIdx["selector"]=1;
  8913. $1=$recv($8).__comma($12);
  8914. $ctx1.sendIdx[","]=3;
  8915. } else {
  8916. $16=$recv($recv(self._receiver())._class())._name();
  8917. $ctx1.sendIdx["name"]=2;
  8918. $15=$recv($16).__comma("(");
  8919. $14=$recv($15).__comma($recv(methodClass)._name());
  8920. $ctx1.sendIdx[","]=7;
  8921. $13=$recv($14).__comma(") >> ");
  8922. $ctx1.sendIdx[","]=6;
  8923. $1=$recv($13).__comma(self._selector());
  8924. $ctx1.sendIdx[","]=5;
  8925. };
  8926. };
  8927. return $1;
  8928. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  8929. },
  8930. args: [],
  8931. 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 ] ]",
  8932. referencedClasses: [],
  8933. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  8934. }),
  8935. $globals.MethodContext);
  8936. $core.addMethod(
  8937. $core.method({
  8938. selector: "basicReceiver",
  8939. protocol: 'accessing',
  8940. fn: function (){
  8941. var self=this;
  8942. return $core.withContext(function($ctx1) {
  8943. return self.receiver;
  8944. return self;
  8945. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  8946. },
  8947. args: [],
  8948. source: "basicReceiver\x0a\x09<return self.receiver>",
  8949. referencedClasses: [],
  8950. messageSends: []
  8951. }),
  8952. $globals.MethodContext);
  8953. $core.addMethod(
  8954. $core.method({
  8955. selector: "evaluatedSelector",
  8956. protocol: 'accessing',
  8957. fn: function (){
  8958. var self=this;
  8959. return $core.withContext(function($ctx1) {
  8960. return self.evaluatedSelector;
  8961. return self;
  8962. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  8963. },
  8964. args: [],
  8965. source: "evaluatedSelector\x0a\x09<return self.evaluatedSelector>",
  8966. referencedClasses: [],
  8967. messageSends: []
  8968. }),
  8969. $globals.MethodContext);
  8970. $core.addMethod(
  8971. $core.method({
  8972. selector: "findContextSuchThat:",
  8973. protocol: 'accessing',
  8974. fn: function (testBlock){
  8975. var self=this;
  8976. var context;
  8977. return $core.withContext(function($ctx1) {
  8978. var $1;
  8979. var $early={};
  8980. try {
  8981. context=self;
  8982. $recv((function(){
  8983. return $core.withContext(function($ctx2) {
  8984. return $recv(context)._isNil();
  8985. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8986. }))._whileFalse_((function(){
  8987. return $core.withContext(function($ctx2) {
  8988. $1=$recv(testBlock)._value_(context);
  8989. if($core.assert($1)){
  8990. throw $early=[context];
  8991. };
  8992. context=$recv(context)._outerContext();
  8993. return context;
  8994. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8995. }));
  8996. return nil;
  8997. }
  8998. catch(e) {if(e===$early)return e[0]; throw e}
  8999. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  9000. },
  9001. args: ["testBlock"],
  9002. 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",
  9003. referencedClasses: [],
  9004. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  9005. }),
  9006. $globals.MethodContext);
  9007. $core.addMethod(
  9008. $core.method({
  9009. selector: "home",
  9010. protocol: 'accessing',
  9011. fn: function (){
  9012. var self=this;
  9013. return $core.withContext(function($ctx1) {
  9014. return self.homeContext;
  9015. return self;
  9016. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  9017. },
  9018. args: [],
  9019. source: "home\x0a\x09<return self.homeContext>",
  9020. referencedClasses: [],
  9021. messageSends: []
  9022. }),
  9023. $globals.MethodContext);
  9024. $core.addMethod(
  9025. $core.method({
  9026. selector: "index",
  9027. protocol: 'accessing',
  9028. fn: function (){
  9029. var self=this;
  9030. return $core.withContext(function($ctx1) {
  9031. return self.index || 0;
  9032. return self;
  9033. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  9034. },
  9035. args: [],
  9036. source: "index\x0a\x09<return self.index || 0>",
  9037. referencedClasses: [],
  9038. messageSends: []
  9039. }),
  9040. $globals.MethodContext);
  9041. $core.addMethod(
  9042. $core.method({
  9043. selector: "isBlockContext",
  9044. protocol: 'testing',
  9045. fn: function (){
  9046. var self=this;
  9047. return $core.withContext(function($ctx1) {
  9048. return $recv(self._selector())._isNil();
  9049. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  9050. },
  9051. args: [],
  9052. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  9053. referencedClasses: [],
  9054. messageSends: ["isNil", "selector"]
  9055. }),
  9056. $globals.MethodContext);
  9057. $core.addMethod(
  9058. $core.method({
  9059. selector: "locals",
  9060. protocol: 'accessing',
  9061. fn: function (){
  9062. var self=this;
  9063. return $core.withContext(function($ctx1) {
  9064. return self.locals || {};
  9065. return self;
  9066. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  9067. },
  9068. args: [],
  9069. source: "locals\x0a\x09<return self.locals || {}>",
  9070. referencedClasses: [],
  9071. messageSends: []
  9072. }),
  9073. $globals.MethodContext);
  9074. $core.addMethod(
  9075. $core.method({
  9076. selector: "method",
  9077. protocol: 'accessing',
  9078. fn: function (){
  9079. var self=this;
  9080. var method,lookupClass,receiverClass,supercall;
  9081. return $core.withContext(function($ctx1) {
  9082. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  9083. $1=self._methodContext();
  9084. $ctx1.sendIdx["methodContext"]=1;
  9085. if(($receiver = $1) == null || $receiver.isNil){
  9086. return nil;
  9087. } else {
  9088. $1;
  9089. };
  9090. $3=self._methodContext();
  9091. $ctx1.sendIdx["methodContext"]=2;
  9092. $2=$recv($3)._receiver();
  9093. receiverClass=$recv($2)._class();
  9094. $4=receiverClass;
  9095. $6=self._methodContext();
  9096. $ctx1.sendIdx["methodContext"]=3;
  9097. $5=$recv($6)._selector();
  9098. $ctx1.sendIdx["selector"]=1;
  9099. method=$recv($4)._lookupSelector_($5);
  9100. $ctx1.sendIdx["lookupSelector:"]=1;
  9101. $7=self._outerContext();
  9102. if(($receiver = $7) == null || $receiver.isNil){
  9103. supercall=false;
  9104. } else {
  9105. var outer;
  9106. outer=$receiver;
  9107. supercall=$recv(outer)._supercall();
  9108. };
  9109. $8=supercall;
  9110. if($core.assert($8)){
  9111. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv(self._methodContext())._selector());
  9112. } else {
  9113. return method;
  9114. };
  9115. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  9116. },
  9117. args: [],
  9118. 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 ]",
  9119. referencedClasses: [],
  9120. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  9121. }),
  9122. $globals.MethodContext);
  9123. $core.addMethod(
  9124. $core.method({
  9125. selector: "methodContext",
  9126. protocol: 'accessing',
  9127. fn: function (){
  9128. var self=this;
  9129. return $core.withContext(function($ctx1) {
  9130. var $1,$2,$receiver;
  9131. $1=self._isBlockContext();
  9132. if(!$core.assert($1)){
  9133. return self;
  9134. };
  9135. $2=self._outerContext();
  9136. if(($receiver = $2) == null || $receiver.isNil){
  9137. return $2;
  9138. } else {
  9139. var outer;
  9140. outer=$receiver;
  9141. return $recv(outer)._methodContext();
  9142. };
  9143. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  9144. },
  9145. args: [],
  9146. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  9147. referencedClasses: [],
  9148. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  9149. }),
  9150. $globals.MethodContext);
  9151. $core.addMethod(
  9152. $core.method({
  9153. selector: "outerContext",
  9154. protocol: 'accessing',
  9155. fn: function (){
  9156. var self=this;
  9157. return $core.withContext(function($ctx1) {
  9158. return self.outerContext || self.homeContext;
  9159. return self;
  9160. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  9161. },
  9162. args: [],
  9163. source: "outerContext\x0a\x09<return self.outerContext || self.homeContext>",
  9164. referencedClasses: [],
  9165. messageSends: []
  9166. }),
  9167. $globals.MethodContext);
  9168. $core.addMethod(
  9169. $core.method({
  9170. selector: "printOn:",
  9171. protocol: 'printing',
  9172. fn: function (aStream){
  9173. var self=this;
  9174. return $core.withContext(function($ctx1) {
  9175. (
  9176. $ctx1.supercall = true,
  9177. ($globals.MethodContext.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  9178. $ctx1.supercall = false;
  9179. $recv(aStream)._nextPutAll_("(");
  9180. $ctx1.sendIdx["nextPutAll:"]=1;
  9181. $recv(aStream)._nextPutAll_(self._asString());
  9182. $ctx1.sendIdx["nextPutAll:"]=2;
  9183. $recv(aStream)._nextPutAll_(")");
  9184. return self;
  9185. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  9186. },
  9187. args: ["aStream"],
  9188. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  9189. referencedClasses: [],
  9190. messageSends: ["printOn:", "nextPutAll:", "asString"]
  9191. }),
  9192. $globals.MethodContext);
  9193. $core.addMethod(
  9194. $core.method({
  9195. selector: "receiver",
  9196. protocol: 'accessing',
  9197. fn: function (){
  9198. var self=this;
  9199. return $core.withContext(function($ctx1) {
  9200. var $2,$1;
  9201. $1=$recv(self._isBlockContext())._and_((function(){
  9202. return $core.withContext(function($ctx2) {
  9203. $2=self._outerContext();
  9204. $ctx2.sendIdx["outerContext"]=1;
  9205. return $recv($2)._notNil();
  9206. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9207. }));
  9208. if($core.assert($1)){
  9209. return $recv(self._outerContext())._receiver();
  9210. } else {
  9211. return self._basicReceiver();
  9212. };
  9213. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  9214. },
  9215. args: [],
  9216. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  9217. referencedClasses: [],
  9218. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  9219. }),
  9220. $globals.MethodContext);
  9221. $core.addMethod(
  9222. $core.method({
  9223. selector: "selector",
  9224. protocol: 'accessing',
  9225. fn: function (){
  9226. var self=this;
  9227. return $core.withContext(function($ctx1) {
  9228. if(self.selector) {
  9229. return $core.js2st(self.selector);
  9230. } else {
  9231. return nil;
  9232. }
  9233. ;
  9234. return self;
  9235. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  9236. },
  9237. args: [],
  9238. 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>",
  9239. referencedClasses: [],
  9240. messageSends: []
  9241. }),
  9242. $globals.MethodContext);
  9243. $core.addMethod(
  9244. $core.method({
  9245. selector: "sendIndexAt:",
  9246. protocol: 'accessing',
  9247. fn: function (aSelector){
  9248. var self=this;
  9249. return $core.withContext(function($ctx1) {
  9250. return self.sendIdx[aSelector] || 0;
  9251. return self;
  9252. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  9253. },
  9254. args: ["aSelector"],
  9255. source: "sendIndexAt: aSelector\x0a\x09<return self.sendIdx[aSelector] || 0>",
  9256. referencedClasses: [],
  9257. messageSends: []
  9258. }),
  9259. $globals.MethodContext);
  9260. $core.addMethod(
  9261. $core.method({
  9262. selector: "sendIndexes",
  9263. protocol: 'accessing',
  9264. fn: function (){
  9265. var self=this;
  9266. return $core.withContext(function($ctx1) {
  9267. return self.sendIdx;
  9268. return self;
  9269. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  9270. },
  9271. args: [],
  9272. source: "sendIndexes\x0a\x09<return self.sendIdx>",
  9273. referencedClasses: [],
  9274. messageSends: []
  9275. }),
  9276. $globals.MethodContext);
  9277. $core.addMethod(
  9278. $core.method({
  9279. selector: "supercall",
  9280. protocol: 'accessing',
  9281. fn: function (){
  9282. var self=this;
  9283. return $core.withContext(function($ctx1) {
  9284. return self.supercall == true;
  9285. return self;
  9286. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  9287. },
  9288. args: [],
  9289. source: "supercall\x0a\x09<return self.supercall == true>",
  9290. referencedClasses: [],
  9291. messageSends: []
  9292. }),
  9293. $globals.MethodContext);
  9294. $core.addClass('NativeFunction', $globals.Object, [], 'Kernel-Methods');
  9295. $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' ]";
  9296. $core.addMethod(
  9297. $core.method({
  9298. selector: "constructor:",
  9299. protocol: 'instance creation',
  9300. fn: function (aString){
  9301. var self=this;
  9302. return $core.withContext(function($ctx1) {
  9303. self._deprecatedAPI_("Use constructorNamed:");
  9304. var nativeFunc=eval(aString);
  9305. return new nativeFunc();
  9306. ;
  9307. return self;
  9308. }, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},$globals.NativeFunction.klass)});
  9309. },
  9310. args: ["aString"],
  9311. 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>",
  9312. referencedClasses: [],
  9313. messageSends: []
  9314. }),
  9315. $globals.NativeFunction.klass);
  9316. $core.addMethod(
  9317. $core.method({
  9318. selector: "constructor:value:",
  9319. protocol: 'instance creation',
  9320. fn: function (aString,anObject){
  9321. var self=this;
  9322. return $core.withContext(function($ctx1) {
  9323. self._deprecatedAPI_("Use constructorNamed:value:");
  9324. var nativeFunc=eval(aString);
  9325. return new nativeFunc(anObject);
  9326. ;
  9327. return self;
  9328. }, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9329. },
  9330. args: ["aString", "anObject"],
  9331. 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>",
  9332. referencedClasses: [],
  9333. messageSends: []
  9334. }),
  9335. $globals.NativeFunction.klass);
  9336. $core.addMethod(
  9337. $core.method({
  9338. selector: "constructor:value:value:",
  9339. protocol: 'instance creation',
  9340. fn: function (aString,anObject,anObject2){
  9341. var self=this;
  9342. return $core.withContext(function($ctx1) {
  9343. self._deprecatedAPI_("Use constructorNamed:value:value:");
  9344. var nativeFunc=eval(aString);
  9345. return new nativeFunc(anObject,anObject2);
  9346. ;
  9347. return self;
  9348. }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9349. },
  9350. args: ["aString", "anObject", "anObject2"],
  9351. 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>",
  9352. referencedClasses: [],
  9353. messageSends: []
  9354. }),
  9355. $globals.NativeFunction.klass);
  9356. $core.addMethod(
  9357. $core.method({
  9358. selector: "constructor:value:value:value:",
  9359. protocol: 'instance creation',
  9360. fn: function (aString,anObject,anObject2,anObject3){
  9361. var self=this;
  9362. return $core.withContext(function($ctx1) {
  9363. self._deprecatedAPI_("Use constructorNamed:value:value:value");
  9364. var nativeFunc=eval(aString);
  9365. return new nativeFunc(anObject,anObject2, anObject3);
  9366. ;
  9367. return self;
  9368. }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9369. },
  9370. args: ["aString", "anObject", "anObject2", "anObject3"],
  9371. 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>",
  9372. referencedClasses: [],
  9373. messageSends: []
  9374. }),
  9375. $globals.NativeFunction.klass);
  9376. $core.addMethod(
  9377. $core.method({
  9378. selector: "constructorNamed:",
  9379. protocol: 'instance creation',
  9380. fn: function (aString){
  9381. var self=this;
  9382. return $core.withContext(function($ctx1) {
  9383. var nativeFunc=(new Function('return this'))()[aString];
  9384. return new nativeFunc();
  9385. ;
  9386. return self;
  9387. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.klass)});
  9388. },
  9389. args: ["aString"],
  9390. source: "constructorNamed: aString\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  9391. referencedClasses: [],
  9392. messageSends: []
  9393. }),
  9394. $globals.NativeFunction.klass);
  9395. $core.addMethod(
  9396. $core.method({
  9397. selector: "constructorNamed:value:",
  9398. protocol: 'instance creation',
  9399. fn: function (aString,anObject){
  9400. var self=this;
  9401. return $core.withContext(function($ctx1) {
  9402. var nativeFunc=(new Function('return this'))()[aString];
  9403. return new nativeFunc(anObject);
  9404. ;
  9405. return self;
  9406. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9407. },
  9408. args: ["aString", "anObject"],
  9409. source: "constructorNamed: aString value: anObject\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  9410. referencedClasses: [],
  9411. messageSends: []
  9412. }),
  9413. $globals.NativeFunction.klass);
  9414. $core.addMethod(
  9415. $core.method({
  9416. selector: "constructorNamed:value:value:",
  9417. protocol: 'instance creation',
  9418. fn: function (aString,anObject,anObject2){
  9419. var self=this;
  9420. return $core.withContext(function($ctx1) {
  9421. var nativeFunc=(new Function('return this'))()[aString];
  9422. return new nativeFunc(anObject,anObject2);
  9423. ;
  9424. return self;
  9425. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9426. },
  9427. args: ["aString", "anObject", "anObject2"],
  9428. 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>",
  9429. referencedClasses: [],
  9430. messageSends: []
  9431. }),
  9432. $globals.NativeFunction.klass);
  9433. $core.addMethod(
  9434. $core.method({
  9435. selector: "constructorNamed:value:value:value:",
  9436. protocol: 'instance creation',
  9437. fn: function (aString,anObject,anObject2,anObject3){
  9438. var self=this;
  9439. return $core.withContext(function($ctx1) {
  9440. var nativeFunc=(new Function('return this'))()[aString];
  9441. return new nativeFunc(anObject,anObject2, anObject3);
  9442. ;
  9443. return self;
  9444. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9445. },
  9446. args: ["aString", "anObject", "anObject2", "anObject3"],
  9447. 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>",
  9448. referencedClasses: [],
  9449. messageSends: []
  9450. }),
  9451. $globals.NativeFunction.klass);
  9452. $core.addMethod(
  9453. $core.method({
  9454. selector: "constructorOf:",
  9455. protocol: 'instance creation',
  9456. fn: function (nativeFunc){
  9457. var self=this;
  9458. return $core.withContext(function($ctx1) {
  9459. return new nativeFunc();
  9460. ;
  9461. return self;
  9462. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  9463. },
  9464. args: ["nativeFunc"],
  9465. source: "constructorOf: nativeFunc\x0a\x09<\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  9466. referencedClasses: [],
  9467. messageSends: []
  9468. }),
  9469. $globals.NativeFunction.klass);
  9470. $core.addMethod(
  9471. $core.method({
  9472. selector: "constructorOf:value:",
  9473. protocol: 'instance creation',
  9474. fn: function (nativeFunc,anObject){
  9475. var self=this;
  9476. return $core.withContext(function($ctx1) {
  9477. return new nativeFunc(anObject);
  9478. ;
  9479. return self;
  9480. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  9481. },
  9482. args: ["nativeFunc", "anObject"],
  9483. source: "constructorOf: nativeFunc value: anObject\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  9484. referencedClasses: [],
  9485. messageSends: []
  9486. }),
  9487. $globals.NativeFunction.klass);
  9488. $core.addMethod(
  9489. $core.method({
  9490. selector: "constructorOf:value:value:",
  9491. protocol: 'instance creation',
  9492. fn: function (nativeFunc,anObject,anObject2){
  9493. var self=this;
  9494. return $core.withContext(function($ctx1) {
  9495. return new nativeFunc(anObject,anObject2);
  9496. ;
  9497. return self;
  9498. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9499. },
  9500. args: ["nativeFunc", "anObject", "anObject2"],
  9501. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
  9502. referencedClasses: [],
  9503. messageSends: []
  9504. }),
  9505. $globals.NativeFunction.klass);
  9506. $core.addMethod(
  9507. $core.method({
  9508. selector: "constructorOf:value:value:value:",
  9509. protocol: 'instance creation',
  9510. fn: function (nativeFunc,anObject,anObject2,anObject3){
  9511. var self=this;
  9512. return $core.withContext(function($ctx1) {
  9513. return new nativeFunc(anObject,anObject2, anObject3);
  9514. ;
  9515. return self;
  9516. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9517. },
  9518. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  9519. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9520. referencedClasses: [],
  9521. messageSends: []
  9522. }),
  9523. $globals.NativeFunction.klass);
  9524. $core.addMethod(
  9525. $core.method({
  9526. selector: "exists:",
  9527. protocol: 'testing',
  9528. fn: function (aString){
  9529. var self=this;
  9530. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  9531. return $core.withContext(function($ctx1) {
  9532. return $recv($Smalltalk())._existsJsGlobal_(aString);
  9533. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.klass)});
  9534. },
  9535. args: ["aString"],
  9536. source: "exists: aString\x0a\x09^ Smalltalk existsJsGlobal: aString",
  9537. referencedClasses: ["Smalltalk"],
  9538. messageSends: ["existsJsGlobal:"]
  9539. }),
  9540. $globals.NativeFunction.klass);
  9541. $core.addMethod(
  9542. $core.method({
  9543. selector: "functionNamed:",
  9544. protocol: 'function calling',
  9545. fn: function (aString){
  9546. var self=this;
  9547. return $core.withContext(function($ctx1) {
  9548. var nativeFunc=(new Function('return this'))()[aString];
  9549. return nativeFunc();
  9550. ;
  9551. return self;
  9552. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.klass)});
  9553. },
  9554. args: ["aString"],
  9555. source: "functionNamed: aString\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc();\x0a\x09>",
  9556. referencedClasses: [],
  9557. messageSends: []
  9558. }),
  9559. $globals.NativeFunction.klass);
  9560. $core.addMethod(
  9561. $core.method({
  9562. selector: "functionNamed:value:",
  9563. protocol: 'function calling',
  9564. fn: function (aString,anObject){
  9565. var self=this;
  9566. return $core.withContext(function($ctx1) {
  9567. var nativeFunc=(new Function('return this'))()[aString];
  9568. return nativeFunc(anObject);
  9569. ;
  9570. return self;
  9571. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9572. },
  9573. args: ["aString", "anObject"],
  9574. source: "functionNamed: aString value: anObject\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09>",
  9575. referencedClasses: [],
  9576. messageSends: []
  9577. }),
  9578. $globals.NativeFunction.klass);
  9579. $core.addMethod(
  9580. $core.method({
  9581. selector: "functionNamed:value:value:",
  9582. protocol: 'function calling',
  9583. fn: function (aString,anObject,anObject2){
  9584. var self=this;
  9585. return $core.withContext(function($ctx1) {
  9586. var nativeFunc=(new Function('return this'))()[aString];
  9587. return nativeFunc(anObject,anObject2);
  9588. ;
  9589. return self;
  9590. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9591. },
  9592. args: ["aString", "anObject", "anObject2"],
  9593. 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>",
  9594. referencedClasses: [],
  9595. messageSends: []
  9596. }),
  9597. $globals.NativeFunction.klass);
  9598. $core.addMethod(
  9599. $core.method({
  9600. selector: "functionNamed:value:value:value:",
  9601. protocol: 'function calling',
  9602. fn: function (aString,anObject,anObject2,anObject3){
  9603. var self=this;
  9604. return $core.withContext(function($ctx1) {
  9605. var nativeFunc=(new Function('return this'))()[aString];
  9606. return nativeFunc(anObject,anObject2, anObject3);
  9607. ;
  9608. return self;
  9609. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9610. },
  9611. args: ["aString", "anObject", "anObject2", "anObject3"],
  9612. 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>",
  9613. referencedClasses: [],
  9614. messageSends: []
  9615. }),
  9616. $globals.NativeFunction.klass);
  9617. $core.addMethod(
  9618. $core.method({
  9619. selector: "functionNamed:valueWithArgs:",
  9620. protocol: 'function calling',
  9621. fn: function (aString,args){
  9622. var self=this;
  9623. return $core.withContext(function($ctx1) {
  9624. var nativeFunc=(new Function('return this'))()[aString];
  9625. return Function.prototype.apply.call(nativeFunc, null, args);
  9626. ;
  9627. return self;
  9628. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.klass)});
  9629. },
  9630. args: ["aString", "args"],
  9631. 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>",
  9632. referencedClasses: [],
  9633. messageSends: []
  9634. }),
  9635. $globals.NativeFunction.klass);
  9636. $core.addMethod(
  9637. $core.method({
  9638. selector: "functionOf:",
  9639. protocol: 'function calling',
  9640. fn: function (nativeFunc){
  9641. var self=this;
  9642. return $core.withContext(function($ctx1) {
  9643. return nativeFunc();
  9644. ;
  9645. return self;
  9646. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  9647. },
  9648. args: ["nativeFunc"],
  9649. source: "functionOf: nativeFunc\x0a\x09<\x0a\x09\x09return nativeFunc();\x0a\x09>",
  9650. referencedClasses: [],
  9651. messageSends: []
  9652. }),
  9653. $globals.NativeFunction.klass);
  9654. $core.addMethod(
  9655. $core.method({
  9656. selector: "functionOf:value:",
  9657. protocol: 'function calling',
  9658. fn: function (nativeFunc,anObject){
  9659. var self=this;
  9660. return $core.withContext(function($ctx1) {
  9661. return nativeFunc(anObject);
  9662. ;
  9663. return self;
  9664. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  9665. },
  9666. args: ["nativeFunc", "anObject"],
  9667. source: "functionOf: nativeFunc value: anObject\x0a\x09<\x0a\x09\x09return nativeFunc(anObject);\x0a\x09>",
  9668. referencedClasses: [],
  9669. messageSends: []
  9670. }),
  9671. $globals.NativeFunction.klass);
  9672. $core.addMethod(
  9673. $core.method({
  9674. selector: "functionOf:value:value:",
  9675. protocol: 'function calling',
  9676. fn: function (nativeFunc,anObject,anObject2){
  9677. var self=this;
  9678. return $core.withContext(function($ctx1) {
  9679. return nativeFunc(anObject,anObject2);
  9680. ;
  9681. return self;
  9682. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9683. },
  9684. args: ["nativeFunc", "anObject", "anObject2"],
  9685. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09>",
  9686. referencedClasses: [],
  9687. messageSends: []
  9688. }),
  9689. $globals.NativeFunction.klass);
  9690. $core.addMethod(
  9691. $core.method({
  9692. selector: "functionOf:value:value:value:",
  9693. protocol: 'function calling',
  9694. fn: function (nativeFunc,anObject,anObject2,anObject3){
  9695. var self=this;
  9696. return $core.withContext(function($ctx1) {
  9697. return nativeFunc(anObject,anObject2, anObject3);
  9698. ;
  9699. return self;
  9700. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9701. },
  9702. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  9703. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9704. referencedClasses: [],
  9705. messageSends: []
  9706. }),
  9707. $globals.NativeFunction.klass);
  9708. $core.addMethod(
  9709. $core.method({
  9710. selector: "functionOf:valueWithArgs:",
  9711. protocol: 'function calling',
  9712. fn: function (nativeFunc,args){
  9713. var self=this;
  9714. return $core.withContext(function($ctx1) {
  9715. return Function.prototype.apply.call(nativeFunc, null, args);
  9716. ;
  9717. return self;
  9718. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.klass)});
  9719. },
  9720. args: ["nativeFunc", "args"],
  9721. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09>",
  9722. referencedClasses: [],
  9723. messageSends: []
  9724. }),
  9725. $globals.NativeFunction.klass);
  9726. $core.addMethod(
  9727. $core.method({
  9728. selector: "methodOf:this:",
  9729. protocol: 'method calling',
  9730. fn: function (nativeFunc,thisObject){
  9731. var self=this;
  9732. return $core.withContext(function($ctx1) {
  9733. return Function.prototype.call.call(nativeFunc, thisObject);
  9734. ;
  9735. return self;
  9736. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.klass)});
  9737. },
  9738. args: ["nativeFunc", "thisObject"],
  9739. source: "methodOf: nativeFunc this: thisObject\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09>",
  9740. referencedClasses: [],
  9741. messageSends: []
  9742. }),
  9743. $globals.NativeFunction.klass);
  9744. $core.addMethod(
  9745. $core.method({
  9746. selector: "methodOf:this:value:",
  9747. protocol: 'method calling',
  9748. fn: function (nativeFunc,thisObject,anObject){
  9749. var self=this;
  9750. return $core.withContext(function($ctx1) {
  9751. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  9752. ;
  9753. return self;
  9754. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.klass)});
  9755. },
  9756. args: ["nativeFunc", "thisObject", "anObject"],
  9757. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09>",
  9758. referencedClasses: [],
  9759. messageSends: []
  9760. }),
  9761. $globals.NativeFunction.klass);
  9762. $core.addMethod(
  9763. $core.method({
  9764. selector: "methodOf:this:value:value:",
  9765. protocol: 'method calling',
  9766. fn: function (nativeFunc,thisObject,anObject,anObject2){
  9767. var self=this;
  9768. return $core.withContext(function($ctx1) {
  9769. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  9770. ;
  9771. return self;
  9772. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9773. },
  9774. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  9775. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);\x0a\x09>",
  9776. referencedClasses: [],
  9777. messageSends: []
  9778. }),
  9779. $globals.NativeFunction.klass);
  9780. $core.addMethod(
  9781. $core.method({
  9782. selector: "methodOf:this:value:value:value:",
  9783. protocol: 'method calling',
  9784. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  9785. var self=this;
  9786. return $core.withContext(function($ctx1) {
  9787. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  9788. ;
  9789. return self;
  9790. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9791. },
  9792. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  9793. 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>",
  9794. referencedClasses: [],
  9795. messageSends: []
  9796. }),
  9797. $globals.NativeFunction.klass);
  9798. $core.addMethod(
  9799. $core.method({
  9800. selector: "methodOf:this:valueWithArgs:",
  9801. protocol: 'method calling',
  9802. fn: function (nativeFunc,thisObject,args){
  9803. var self=this;
  9804. return $core.withContext(function($ctx1) {
  9805. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  9806. ;
  9807. return self;
  9808. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.klass)});
  9809. },
  9810. args: ["nativeFunc", "thisObject", "args"],
  9811. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09>",
  9812. referencedClasses: [],
  9813. messageSends: []
  9814. }),
  9815. $globals.NativeFunction.klass);
  9816. $core.addClass('Timeout', $globals.Object, ['rawTimeout'], 'Kernel-Methods');
  9817. $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.";
  9818. $core.addMethod(
  9819. $core.method({
  9820. selector: "clearInterval",
  9821. protocol: 'timeout/interval',
  9822. fn: function (){
  9823. var self=this;
  9824. return $core.withContext(function($ctx1) {
  9825. var interval = self["@rawTimeout"];
  9826. clearInterval(interval);
  9827. ;
  9828. return self;
  9829. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  9830. },
  9831. args: [],
  9832. source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>",
  9833. referencedClasses: [],
  9834. messageSends: []
  9835. }),
  9836. $globals.Timeout);
  9837. $core.addMethod(
  9838. $core.method({
  9839. selector: "clearTimeout",
  9840. protocol: 'timeout/interval',
  9841. fn: function (){
  9842. var self=this;
  9843. return $core.withContext(function($ctx1) {
  9844. var timeout = self["@rawTimeout"];
  9845. clearTimeout(timeout);
  9846. ;
  9847. return self;
  9848. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  9849. },
  9850. args: [],
  9851. source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>",
  9852. referencedClasses: [],
  9853. messageSends: []
  9854. }),
  9855. $globals.Timeout);
  9856. $core.addMethod(
  9857. $core.method({
  9858. selector: "rawTimeout:",
  9859. protocol: 'accessing',
  9860. fn: function (anObject){
  9861. var self=this;
  9862. self["@rawTimeout"]=anObject;
  9863. return self;
  9864. },
  9865. args: ["anObject"],
  9866. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  9867. referencedClasses: [],
  9868. messageSends: []
  9869. }),
  9870. $globals.Timeout);
  9871. $core.addMethod(
  9872. $core.method({
  9873. selector: "on:",
  9874. protocol: 'instance creation',
  9875. fn: function (anObject){
  9876. var self=this;
  9877. return $core.withContext(function($ctx1) {
  9878. var $1;
  9879. $1=self._new();
  9880. $recv($1)._rawTimeout_(anObject);
  9881. return $recv($1)._yourself();
  9882. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.klass)});
  9883. },
  9884. args: ["anObject"],
  9885. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  9886. referencedClasses: [],
  9887. messageSends: ["rawTimeout:", "new", "yourself"]
  9888. }),
  9889. $globals.Timeout.klass);
  9890. });
  9891. define("amber_core/Kernel-Collections", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  9892. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  9893. $core.addPackage('Kernel-Collections');
  9894. $core.packages["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  9895. $core.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  9896. $core.addClass('Association', $globals.Object, ['key', 'value'], 'Kernel-Collections');
  9897. $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:`";
  9898. $core.addMethod(
  9899. $core.method({
  9900. selector: "=",
  9901. protocol: 'comparing',
  9902. fn: function (anAssociation){
  9903. var self=this;
  9904. return $core.withContext(function($ctx1) {
  9905. var $3,$2,$5,$4,$6,$1;
  9906. $3=self._class();
  9907. $ctx1.sendIdx["class"]=1;
  9908. $2=$recv($3).__eq($recv(anAssociation)._class());
  9909. $ctx1.sendIdx["="]=1;
  9910. $1=$recv($2)._and_((function(){
  9911. return $core.withContext(function($ctx2) {
  9912. $5=self._key();
  9913. $ctx2.sendIdx["key"]=1;
  9914. $4=$recv($5).__eq($recv(anAssociation)._key());
  9915. $ctx2.sendIdx["="]=2;
  9916. return $recv($4)._and_((function(){
  9917. return $core.withContext(function($ctx3) {
  9918. $6=self._value();
  9919. $ctx3.sendIdx["value"]=1;
  9920. return $recv($6).__eq($recv(anAssociation)._value());
  9921. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  9922. }));
  9923. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9924. }));
  9925. $ctx1.sendIdx["and:"]=1;
  9926. return $1;
  9927. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  9928. },
  9929. args: ["anAssociation"],
  9930. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  9931. referencedClasses: [],
  9932. messageSends: ["and:", "=", "class", "key", "value"]
  9933. }),
  9934. $globals.Association);
  9935. $core.addMethod(
  9936. $core.method({
  9937. selector: "key",
  9938. protocol: 'accessing',
  9939. fn: function (){
  9940. var self=this;
  9941. return self["@key"];
  9942. },
  9943. args: [],
  9944. source: "key\x0a\x09^ key",
  9945. referencedClasses: [],
  9946. messageSends: []
  9947. }),
  9948. $globals.Association);
  9949. $core.addMethod(
  9950. $core.method({
  9951. selector: "key:",
  9952. protocol: 'accessing',
  9953. fn: function (aKey){
  9954. var self=this;
  9955. self["@key"]=aKey;
  9956. return self;
  9957. },
  9958. args: ["aKey"],
  9959. source: "key: aKey\x0a\x09key := aKey",
  9960. referencedClasses: [],
  9961. messageSends: []
  9962. }),
  9963. $globals.Association);
  9964. $core.addMethod(
  9965. $core.method({
  9966. selector: "printOn:",
  9967. protocol: 'printing',
  9968. fn: function (aStream){
  9969. var self=this;
  9970. return $core.withContext(function($ctx1) {
  9971. $recv(self._key())._printOn_(aStream);
  9972. $ctx1.sendIdx["printOn:"]=1;
  9973. $recv(aStream)._nextPutAll_(" -> ");
  9974. $recv(self._value())._printOn_(aStream);
  9975. return self;
  9976. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  9977. },
  9978. args: ["aStream"],
  9979. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  9980. referencedClasses: [],
  9981. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  9982. }),
  9983. $globals.Association);
  9984. $core.addMethod(
  9985. $core.method({
  9986. selector: "value",
  9987. protocol: 'accessing',
  9988. fn: function (){
  9989. var self=this;
  9990. return self["@value"];
  9991. },
  9992. args: [],
  9993. source: "value\x0a\x09^ value",
  9994. referencedClasses: [],
  9995. messageSends: []
  9996. }),
  9997. $globals.Association);
  9998. $core.addMethod(
  9999. $core.method({
  10000. selector: "value:",
  10001. protocol: 'accessing',
  10002. fn: function (aValue){
  10003. var self=this;
  10004. self["@value"]=aValue;
  10005. return self;
  10006. },
  10007. args: ["aValue"],
  10008. source: "value: aValue\x0a\x09value := aValue",
  10009. referencedClasses: [],
  10010. messageSends: []
  10011. }),
  10012. $globals.Association);
  10013. $core.addMethod(
  10014. $core.method({
  10015. selector: "key:value:",
  10016. protocol: 'instance creation',
  10017. fn: function (aKey,aValue){
  10018. var self=this;
  10019. return $core.withContext(function($ctx1) {
  10020. var $1;
  10021. $1=self._new();
  10022. $recv($1)._key_(aKey);
  10023. $recv($1)._value_(aValue);
  10024. return $recv($1)._yourself();
  10025. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.klass)});
  10026. },
  10027. args: ["aKey", "aValue"],
  10028. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  10029. referencedClasses: [],
  10030. messageSends: ["key:", "new", "value:", "yourself"]
  10031. }),
  10032. $globals.Association.klass);
  10033. $core.addClass('BucketStore', $globals.Object, ['buckets', 'hashBlock'], 'Kernel-Collections');
  10034. $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`.";
  10035. $core.addMethod(
  10036. $core.method({
  10037. selector: "bucketOfElement:",
  10038. protocol: 'accessing',
  10039. fn: function (anObject){
  10040. var self=this;
  10041. return $core.withContext(function($ctx1) {
  10042. var hash = self['@hashBlock'](anObject);
  10043. if (!hash) return null;
  10044. var buckets = self['@buckets'],
  10045. bucket = buckets[hash];
  10046. if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
  10047. return bucket;
  10048. ;
  10049. return self;
  10050. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  10051. },
  10052. args: ["anObject"],
  10053. 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>",
  10054. referencedClasses: [],
  10055. messageSends: []
  10056. }),
  10057. $globals.BucketStore);
  10058. $core.addMethod(
  10059. $core.method({
  10060. selector: "do:",
  10061. protocol: 'enumerating',
  10062. fn: function (aBlock){
  10063. var self=this;
  10064. return $core.withContext(function($ctx1) {
  10065. var buckets = self['@buckets'];
  10066. var keys = Object.keys(buckets);
  10067. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  10068. ;
  10069. return self;
  10070. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  10071. },
  10072. args: ["aBlock"],
  10073. 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>",
  10074. referencedClasses: [],
  10075. messageSends: []
  10076. }),
  10077. $globals.BucketStore);
  10078. $core.addMethod(
  10079. $core.method({
  10080. selector: "hashBlock:",
  10081. protocol: 'accessing',
  10082. fn: function (aBlock){
  10083. var self=this;
  10084. self["@hashBlock"]=aBlock;
  10085. return self;
  10086. },
  10087. args: ["aBlock"],
  10088. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  10089. referencedClasses: [],
  10090. messageSends: []
  10091. }),
  10092. $globals.BucketStore);
  10093. $core.addMethod(
  10094. $core.method({
  10095. selector: "initialize",
  10096. protocol: 'initialization',
  10097. fn: function (){
  10098. var self=this;
  10099. return $core.withContext(function($ctx1) {
  10100. (
  10101. $ctx1.supercall = true,
  10102. ($globals.BucketStore.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  10103. $ctx1.supercall = false;
  10104. self._removeAll();
  10105. return self;
  10106. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  10107. },
  10108. args: [],
  10109. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  10110. referencedClasses: [],
  10111. messageSends: ["initialize", "removeAll"]
  10112. }),
  10113. $globals.BucketStore);
  10114. $core.addMethod(
  10115. $core.method({
  10116. selector: "newBucket",
  10117. protocol: 'private',
  10118. fn: function (){
  10119. var self=this;
  10120. return $core.withContext(function($ctx1) {
  10121. self._subclassResponsibility();
  10122. return self;
  10123. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  10124. },
  10125. args: [],
  10126. source: "newBucket\x0a\x09self subclassResponsibility",
  10127. referencedClasses: [],
  10128. messageSends: ["subclassResponsibility"]
  10129. }),
  10130. $globals.BucketStore);
  10131. $core.addMethod(
  10132. $core.method({
  10133. selector: "removeAll",
  10134. protocol: 'adding/removing',
  10135. fn: function (){
  10136. var self=this;
  10137. return $core.withContext(function($ctx1) {
  10138. self['@buckets'] = Object.create(null);;
  10139. return self;
  10140. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  10141. },
  10142. args: [],
  10143. source: "removeAll\x0a\x09<self['@buckets'] = Object.create(null);>",
  10144. referencedClasses: [],
  10145. messageSends: []
  10146. }),
  10147. $globals.BucketStore);
  10148. $core.addMethod(
  10149. $core.method({
  10150. selector: "hashBlock:",
  10151. protocol: 'instance creation',
  10152. fn: function (aBlock){
  10153. var self=this;
  10154. return $core.withContext(function($ctx1) {
  10155. var $1;
  10156. $1=self._new();
  10157. $recv($1)._hashBlock_(aBlock);
  10158. return $recv($1)._yourself();
  10159. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.klass)});
  10160. },
  10161. args: ["aBlock"],
  10162. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  10163. referencedClasses: [],
  10164. messageSends: ["hashBlock:", "new", "yourself"]
  10165. }),
  10166. $globals.BucketStore.klass);
  10167. $core.addClass('ArrayBucketStore', $globals.BucketStore, [], 'Kernel-Collections');
  10168. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  10169. $core.addMethod(
  10170. $core.method({
  10171. selector: "newBucket",
  10172. protocol: 'private',
  10173. fn: function (){
  10174. var self=this;
  10175. return [];
  10176. },
  10177. args: [],
  10178. source: "newBucket\x0a\x09^ #()",
  10179. referencedClasses: [],
  10180. messageSends: []
  10181. }),
  10182. $globals.ArrayBucketStore);
  10183. $core.addClass('Collection', $globals.Object, [], 'Kernel-Collections');
  10184. $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.";
  10185. $core.addMethod(
  10186. $core.method({
  10187. selector: ",",
  10188. protocol: 'copying',
  10189. fn: function (aCollection){
  10190. var self=this;
  10191. return $core.withContext(function($ctx1) {
  10192. var $1;
  10193. $1=self._copy();
  10194. $recv($1)._addAll_(aCollection);
  10195. return $recv($1)._yourself();
  10196. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  10197. },
  10198. args: ["aCollection"],
  10199. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  10200. referencedClasses: [],
  10201. messageSends: ["addAll:", "copy", "yourself"]
  10202. }),
  10203. $globals.Collection);
  10204. $core.addMethod(
  10205. $core.method({
  10206. selector: "add:",
  10207. protocol: 'adding/removing',
  10208. fn: function (anObject){
  10209. var self=this;
  10210. return $core.withContext(function($ctx1) {
  10211. self._subclassResponsibility();
  10212. return self;
  10213. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  10214. },
  10215. args: ["anObject"],
  10216. source: "add: anObject\x0a\x09self subclassResponsibility",
  10217. referencedClasses: [],
  10218. messageSends: ["subclassResponsibility"]
  10219. }),
  10220. $globals.Collection);
  10221. $core.addMethod(
  10222. $core.method({
  10223. selector: "addAll:",
  10224. protocol: 'adding/removing',
  10225. fn: function (aCollection){
  10226. var self=this;
  10227. return $core.withContext(function($ctx1) {
  10228. $recv(aCollection)._do_((function(each){
  10229. return $core.withContext(function($ctx2) {
  10230. return self._add_(each);
  10231. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10232. }));
  10233. return aCollection;
  10234. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  10235. },
  10236. args: ["aCollection"],
  10237. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  10238. referencedClasses: [],
  10239. messageSends: ["do:", "add:"]
  10240. }),
  10241. $globals.Collection);
  10242. $core.addMethod(
  10243. $core.method({
  10244. selector: "allSatisfy:",
  10245. protocol: 'enumerating',
  10246. fn: function (aBlock){
  10247. var self=this;
  10248. return $core.withContext(function($ctx1) {
  10249. var $1;
  10250. var $early={};
  10251. try {
  10252. self._do_((function(each){
  10253. return $core.withContext(function($ctx2) {
  10254. $1=$recv(aBlock)._value_(each);
  10255. if(!$core.assert($1)){
  10256. throw $early=[false];
  10257. };
  10258. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10259. }));
  10260. return true;
  10261. }
  10262. catch(e) {if(e===$early)return e[0]; throw e}
  10263. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  10264. },
  10265. args: ["aBlock"],
  10266. 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",
  10267. referencedClasses: [],
  10268. messageSends: ["do:", "ifFalse:", "value:"]
  10269. }),
  10270. $globals.Collection);
  10271. $core.addMethod(
  10272. $core.method({
  10273. selector: "anyOne",
  10274. protocol: 'adding/removing',
  10275. fn: function (){
  10276. var self=this;
  10277. return $core.withContext(function($ctx1) {
  10278. var $early={};
  10279. try {
  10280. self._ifEmpty_((function(){
  10281. return $core.withContext(function($ctx2) {
  10282. return self._error_("Collection is empty");
  10283. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10284. }));
  10285. self._do_((function(each){
  10286. throw $early=[each];
  10287. }));
  10288. return self;
  10289. }
  10290. catch(e) {if(e===$early)return e[0]; throw e}
  10291. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  10292. },
  10293. args: [],
  10294. 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 ]",
  10295. referencedClasses: [],
  10296. messageSends: ["ifEmpty:", "error:", "do:"]
  10297. }),
  10298. $globals.Collection);
  10299. $core.addMethod(
  10300. $core.method({
  10301. selector: "anySatisfy:",
  10302. protocol: 'enumerating',
  10303. fn: function (aBlock){
  10304. var self=this;
  10305. return $core.withContext(function($ctx1) {
  10306. var $1;
  10307. var $early={};
  10308. try {
  10309. self._do_((function(each){
  10310. return $core.withContext(function($ctx2) {
  10311. $1=$recv(aBlock)._value_(each);
  10312. if($core.assert($1)){
  10313. throw $early=[true];
  10314. };
  10315. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10316. }));
  10317. return false;
  10318. }
  10319. catch(e) {if(e===$early)return e[0]; throw e}
  10320. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  10321. },
  10322. args: ["aBlock"],
  10323. 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",
  10324. referencedClasses: [],
  10325. messageSends: ["do:", "ifTrue:", "value:"]
  10326. }),
  10327. $globals.Collection);
  10328. $core.addMethod(
  10329. $core.method({
  10330. selector: "asArray",
  10331. protocol: 'converting',
  10332. fn: function (){
  10333. var self=this;
  10334. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  10335. return $core.withContext(function($ctx1) {
  10336. return $recv($Array())._withAll_(self);
  10337. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  10338. },
  10339. args: [],
  10340. source: "asArray\x0a\x09^ Array withAll: self",
  10341. referencedClasses: ["Array"],
  10342. messageSends: ["withAll:"]
  10343. }),
  10344. $globals.Collection);
  10345. $core.addMethod(
  10346. $core.method({
  10347. selector: "asJSON",
  10348. protocol: 'converting',
  10349. fn: function (){
  10350. var self=this;
  10351. return $core.withContext(function($ctx1) {
  10352. return $recv(self._asArray())._collect_((function(each){
  10353. return $core.withContext(function($ctx2) {
  10354. return $recv(each)._asJSON();
  10355. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10356. }));
  10357. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.Collection)});
  10358. },
  10359. args: [],
  10360. source: "asJSON\x0a\x09^ self asArray collect: [ :each | each asJSON ]",
  10361. referencedClasses: [],
  10362. messageSends: ["collect:", "asArray", "asJSON"]
  10363. }),
  10364. $globals.Collection);
  10365. $core.addMethod(
  10366. $core.method({
  10367. selector: "asOrderedCollection",
  10368. protocol: 'converting',
  10369. fn: function (){
  10370. var self=this;
  10371. return $core.withContext(function($ctx1) {
  10372. return self._asArray();
  10373. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  10374. },
  10375. args: [],
  10376. source: "asOrderedCollection\x0a\x09^ self asArray",
  10377. referencedClasses: [],
  10378. messageSends: ["asArray"]
  10379. }),
  10380. $globals.Collection);
  10381. $core.addMethod(
  10382. $core.method({
  10383. selector: "asSet",
  10384. protocol: 'converting',
  10385. fn: function (){
  10386. var self=this;
  10387. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  10388. return $core.withContext(function($ctx1) {
  10389. return $recv($Set())._withAll_(self);
  10390. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  10391. },
  10392. args: [],
  10393. source: "asSet\x0a\x09^ Set withAll: self",
  10394. referencedClasses: ["Set"],
  10395. messageSends: ["withAll:"]
  10396. }),
  10397. $globals.Collection);
  10398. $core.addMethod(
  10399. $core.method({
  10400. selector: "collect:",
  10401. protocol: 'enumerating',
  10402. fn: function (aBlock){
  10403. var self=this;
  10404. var stream;
  10405. return $core.withContext(function($ctx1) {
  10406. stream=$recv($recv(self._class())._new())._writeStream();
  10407. self._do_((function(each){
  10408. return $core.withContext(function($ctx2) {
  10409. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  10410. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10411. }));
  10412. return $recv(stream)._contents();
  10413. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  10414. },
  10415. args: ["aBlock"],
  10416. 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",
  10417. referencedClasses: [],
  10418. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  10419. }),
  10420. $globals.Collection);
  10421. $core.addMethod(
  10422. $core.method({
  10423. selector: "copyWith:",
  10424. protocol: 'copying',
  10425. fn: function (anObject){
  10426. var self=this;
  10427. return $core.withContext(function($ctx1) {
  10428. var $1;
  10429. $1=self._copy();
  10430. $recv($1)._add_(anObject);
  10431. return $recv($1)._yourself();
  10432. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  10433. },
  10434. args: ["anObject"],
  10435. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  10436. referencedClasses: [],
  10437. messageSends: ["add:", "copy", "yourself"]
  10438. }),
  10439. $globals.Collection);
  10440. $core.addMethod(
  10441. $core.method({
  10442. selector: "copyWithAll:",
  10443. protocol: 'copying',
  10444. fn: function (aCollection){
  10445. var self=this;
  10446. return $core.withContext(function($ctx1) {
  10447. var $1;
  10448. $1=self._copy();
  10449. $recv($1)._addAll_(aCollection);
  10450. return $recv($1)._yourself();
  10451. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  10452. },
  10453. args: ["aCollection"],
  10454. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  10455. referencedClasses: [],
  10456. messageSends: ["addAll:", "copy", "yourself"]
  10457. }),
  10458. $globals.Collection);
  10459. $core.addMethod(
  10460. $core.method({
  10461. selector: "copyWithoutAll:",
  10462. protocol: 'copying',
  10463. fn: function (aCollection){
  10464. var self=this;
  10465. return $core.withContext(function($ctx1) {
  10466. return self._reject_((function(each){
  10467. return $core.withContext(function($ctx2) {
  10468. return $recv(aCollection)._includes_(each);
  10469. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10470. }));
  10471. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  10472. },
  10473. args: ["aCollection"],
  10474. 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 ]",
  10475. referencedClasses: [],
  10476. messageSends: ["reject:", "includes:"]
  10477. }),
  10478. $globals.Collection);
  10479. $core.addMethod(
  10480. $core.method({
  10481. selector: "deepCopy",
  10482. protocol: 'copying',
  10483. fn: function (){
  10484. var self=this;
  10485. return $core.withContext(function($ctx1) {
  10486. return self._collect_((function(each){
  10487. return $core.withContext(function($ctx2) {
  10488. return $recv(each)._deepCopy();
  10489. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10490. }));
  10491. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  10492. },
  10493. args: [],
  10494. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  10495. referencedClasses: [],
  10496. messageSends: ["collect:", "deepCopy"]
  10497. }),
  10498. $globals.Collection);
  10499. $core.addMethod(
  10500. $core.method({
  10501. selector: "detect:",
  10502. protocol: 'enumerating',
  10503. fn: function (aBlock){
  10504. var self=this;
  10505. return $core.withContext(function($ctx1) {
  10506. return self._detect_ifNone_(aBlock,(function(){
  10507. return $core.withContext(function($ctx2) {
  10508. return self._errorNotFound();
  10509. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10510. }));
  10511. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  10512. },
  10513. args: ["aBlock"],
  10514. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  10515. referencedClasses: [],
  10516. messageSends: ["detect:ifNone:", "errorNotFound"]
  10517. }),
  10518. $globals.Collection);
  10519. $core.addMethod(
  10520. $core.method({
  10521. selector: "detect:ifNone:",
  10522. protocol: 'enumerating',
  10523. fn: function (aBlock,anotherBlock){
  10524. var self=this;
  10525. return $core.withContext(function($ctx1) {
  10526. self._subclassResponsibility();
  10527. return self;
  10528. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  10529. },
  10530. args: ["aBlock", "anotherBlock"],
  10531. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  10532. referencedClasses: [],
  10533. messageSends: ["subclassResponsibility"]
  10534. }),
  10535. $globals.Collection);
  10536. $core.addMethod(
  10537. $core.method({
  10538. selector: "do:",
  10539. protocol: 'enumerating',
  10540. fn: function (aBlock){
  10541. var self=this;
  10542. return $core.withContext(function($ctx1) {
  10543. self._subclassResponsibility();
  10544. return self;
  10545. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  10546. },
  10547. args: ["aBlock"],
  10548. source: "do: aBlock\x0a\x09self subclassResponsibility",
  10549. referencedClasses: [],
  10550. messageSends: ["subclassResponsibility"]
  10551. }),
  10552. $globals.Collection);
  10553. $core.addMethod(
  10554. $core.method({
  10555. selector: "do:separatedBy:",
  10556. protocol: 'enumerating',
  10557. fn: function (aBlock,anotherBlock){
  10558. var self=this;
  10559. var actionBeforeElement;
  10560. return $core.withContext(function($ctx1) {
  10561. actionBeforeElement=(function(){
  10562. actionBeforeElement=anotherBlock;
  10563. return actionBeforeElement;
  10564. });
  10565. self._do_((function(each){
  10566. return $core.withContext(function($ctx2) {
  10567. $recv(actionBeforeElement)._value();
  10568. return $recv(aBlock)._value_(each);
  10569. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  10570. }));
  10571. return self;
  10572. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  10573. },
  10574. args: ["aBlock", "anotherBlock"],
  10575. 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 ]",
  10576. referencedClasses: [],
  10577. messageSends: ["do:", "value", "value:"]
  10578. }),
  10579. $globals.Collection);
  10580. $core.addMethod(
  10581. $core.method({
  10582. selector: "errorNotFound",
  10583. protocol: 'error handling',
  10584. fn: function (){
  10585. var self=this;
  10586. return $core.withContext(function($ctx1) {
  10587. self._error_("Object is not in the collection");
  10588. return self;
  10589. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  10590. },
  10591. args: [],
  10592. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  10593. referencedClasses: [],
  10594. messageSends: ["error:"]
  10595. }),
  10596. $globals.Collection);
  10597. $core.addMethod(
  10598. $core.method({
  10599. selector: "ifEmpty:",
  10600. protocol: 'testing',
  10601. fn: function (aBlock){
  10602. var self=this;
  10603. return $core.withContext(function($ctx1) {
  10604. var $1;
  10605. $1=self._isEmpty();
  10606. return $recv($1)._ifTrue_ifFalse_(aBlock,(function(){
  10607. return self;
  10608. }));
  10609. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  10610. },
  10611. args: ["aBlock"],
  10612. 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 ]",
  10613. referencedClasses: [],
  10614. messageSends: ["ifTrue:ifFalse:", "isEmpty"]
  10615. }),
  10616. $globals.Collection);
  10617. $core.addMethod(
  10618. $core.method({
  10619. selector: "ifEmpty:ifNotEmpty:",
  10620. protocol: 'testing',
  10621. fn: function (aBlock,anotherBlock){
  10622. var self=this;
  10623. return $core.withContext(function($ctx1) {
  10624. var $1;
  10625. $1=self._isEmpty();
  10626. return $recv($1)._ifTrue_ifFalse_(aBlock,(function(){
  10627. return $core.withContext(function($ctx2) {
  10628. return $recv(anotherBlock)._value_(self);
  10629. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10630. }));
  10631. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  10632. },
  10633. args: ["aBlock", "anotherBlock"],
  10634. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  10635. referencedClasses: [],
  10636. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value:"]
  10637. }),
  10638. $globals.Collection);
  10639. $core.addMethod(
  10640. $core.method({
  10641. selector: "ifNotEmpty:",
  10642. protocol: 'testing',
  10643. fn: function (aBlock){
  10644. var self=this;
  10645. return $core.withContext(function($ctx1) {
  10646. var $1;
  10647. $1=self._notEmpty();
  10648. if($core.assert($1)){
  10649. return $recv(aBlock)._value_(self);
  10650. } else {
  10651. return self;
  10652. };
  10653. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  10654. },
  10655. args: ["aBlock"],
  10656. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  10657. referencedClasses: [],
  10658. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  10659. }),
  10660. $globals.Collection);
  10661. $core.addMethod(
  10662. $core.method({
  10663. selector: "ifNotEmpty:ifEmpty:",
  10664. protocol: 'testing',
  10665. fn: function (aBlock,anotherBlock){
  10666. var self=this;
  10667. return $core.withContext(function($ctx1) {
  10668. var $1;
  10669. $1=self._notEmpty();
  10670. return $recv($1)._ifTrue_ifFalse_((function(){
  10671. return $core.withContext(function($ctx2) {
  10672. return $recv(aBlock)._value_(self);
  10673. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10674. }),anotherBlock);
  10675. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  10676. },
  10677. args: ["aBlock", "anotherBlock"],
  10678. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: anotherBlock",
  10679. referencedClasses: [],
  10680. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  10681. }),
  10682. $globals.Collection);
  10683. $core.addMethod(
  10684. $core.method({
  10685. selector: "includes:",
  10686. protocol: 'testing',
  10687. fn: function (anObject){
  10688. var self=this;
  10689. return $core.withContext(function($ctx1) {
  10690. return self._anySatisfy_((function(each){
  10691. return $core.withContext(function($ctx2) {
  10692. return $recv(each).__eq(anObject);
  10693. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10694. }));
  10695. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  10696. },
  10697. args: ["anObject"],
  10698. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  10699. referencedClasses: [],
  10700. messageSends: ["anySatisfy:", "="]
  10701. }),
  10702. $globals.Collection);
  10703. $core.addMethod(
  10704. $core.method({
  10705. selector: "inject:into:",
  10706. protocol: 'enumerating',
  10707. fn: function (anObject,aBlock){
  10708. var self=this;
  10709. var result;
  10710. return $core.withContext(function($ctx1) {
  10711. result=anObject;
  10712. self._do_((function(each){
  10713. return $core.withContext(function($ctx2) {
  10714. result=$recv(aBlock)._value_value_(result,each);
  10715. return result;
  10716. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10717. }));
  10718. return result;
  10719. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  10720. },
  10721. args: ["anObject", "aBlock"],
  10722. 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",
  10723. referencedClasses: [],
  10724. messageSends: ["do:", "value:value:"]
  10725. }),
  10726. $globals.Collection);
  10727. $core.addMethod(
  10728. $core.method({
  10729. selector: "intersection:",
  10730. protocol: 'enumerating',
  10731. fn: function (aCollection){
  10732. var self=this;
  10733. var set,outputSet;
  10734. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  10735. return $core.withContext(function($ctx1) {
  10736. var $2,$1;
  10737. set=self._asSet();
  10738. outputSet=$recv($Set())._new();
  10739. $recv(aCollection)._do_((function(each){
  10740. return $core.withContext(function($ctx2) {
  10741. $2=$recv(set)._includes_(each);
  10742. $ctx2.sendIdx["includes:"]=1;
  10743. $1=$recv($2)._and_((function(){
  10744. return $core.withContext(function($ctx3) {
  10745. return $recv($recv(outputSet)._includes_(each))._not();
  10746. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  10747. }));
  10748. if($core.assert($1)){
  10749. return $recv(outputSet)._add_(each);
  10750. };
  10751. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10752. }));
  10753. return $recv(self._class())._withAll_($recv(outputSet)._asArray());
  10754. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  10755. },
  10756. args: ["aCollection"],
  10757. 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",
  10758. referencedClasses: ["Set"],
  10759. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  10760. }),
  10761. $globals.Collection);
  10762. $core.addMethod(
  10763. $core.method({
  10764. selector: "isEmpty",
  10765. protocol: 'testing',
  10766. fn: function (){
  10767. var self=this;
  10768. return $core.withContext(function($ctx1) {
  10769. return $recv(self._size()).__eq((0));
  10770. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  10771. },
  10772. args: [],
  10773. source: "isEmpty\x0a\x09^ self size = 0",
  10774. referencedClasses: [],
  10775. messageSends: ["=", "size"]
  10776. }),
  10777. $globals.Collection);
  10778. $core.addMethod(
  10779. $core.method({
  10780. selector: "noneSatisfy:",
  10781. protocol: 'enumerating',
  10782. fn: function (aBlock){
  10783. var self=this;
  10784. return $core.withContext(function($ctx1) {
  10785. var $1;
  10786. var $early={};
  10787. try {
  10788. self._do_((function(item){
  10789. return $core.withContext(function($ctx2) {
  10790. $1=$recv(aBlock)._value_(item);
  10791. if($core.assert($1)){
  10792. throw $early=[false];
  10793. };
  10794. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  10795. }));
  10796. return true;
  10797. }
  10798. catch(e) {if(e===$early)return e[0]; throw e}
  10799. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  10800. },
  10801. args: ["aBlock"],
  10802. 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",
  10803. referencedClasses: [],
  10804. messageSends: ["do:", "ifTrue:", "value:"]
  10805. }),
  10806. $globals.Collection);
  10807. $core.addMethod(
  10808. $core.method({
  10809. selector: "notEmpty",
  10810. protocol: 'testing',
  10811. fn: function (){
  10812. var self=this;
  10813. return $core.withContext(function($ctx1) {
  10814. return $recv(self._isEmpty())._not();
  10815. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  10816. },
  10817. args: [],
  10818. source: "notEmpty\x0a\x09^ self isEmpty not",
  10819. referencedClasses: [],
  10820. messageSends: ["not", "isEmpty"]
  10821. }),
  10822. $globals.Collection);
  10823. $core.addMethod(
  10824. $core.method({
  10825. selector: "occurrencesOf:",
  10826. protocol: 'accessing',
  10827. fn: function (anObject){
  10828. var self=this;
  10829. var tally;
  10830. return $core.withContext(function($ctx1) {
  10831. var $1;
  10832. tally=(0);
  10833. self._do_((function(each){
  10834. return $core.withContext(function($ctx2) {
  10835. $1=$recv(anObject).__eq(each);
  10836. if($core.assert($1)){
  10837. tally=$recv(tally).__plus((1));
  10838. return tally;
  10839. };
  10840. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10841. }));
  10842. return tally;
  10843. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  10844. },
  10845. args: ["anObject"],
  10846. 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",
  10847. referencedClasses: [],
  10848. messageSends: ["do:", "ifTrue:", "=", "+"]
  10849. }),
  10850. $globals.Collection);
  10851. $core.addMethod(
  10852. $core.method({
  10853. selector: "putOn:",
  10854. protocol: 'streaming',
  10855. fn: function (aStream){
  10856. var self=this;
  10857. return $core.withContext(function($ctx1) {
  10858. self._do_((function(each){
  10859. return $core.withContext(function($ctx2) {
  10860. return $recv(each)._putOn_(aStream);
  10861. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10862. }));
  10863. return self;
  10864. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  10865. },
  10866. args: ["aStream"],
  10867. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  10868. referencedClasses: [],
  10869. messageSends: ["do:", "putOn:"]
  10870. }),
  10871. $globals.Collection);
  10872. $core.addMethod(
  10873. $core.method({
  10874. selector: "reject:",
  10875. protocol: 'enumerating',
  10876. fn: function (aBlock){
  10877. var self=this;
  10878. return $core.withContext(function($ctx1) {
  10879. return self._select_((function(each){
  10880. return $core.withContext(function($ctx2) {
  10881. return $recv($recv(aBlock)._value_(each)).__eq(false);
  10882. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10883. }));
  10884. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  10885. },
  10886. args: ["aBlock"],
  10887. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  10888. referencedClasses: [],
  10889. messageSends: ["select:", "=", "value:"]
  10890. }),
  10891. $globals.Collection);
  10892. $core.addMethod(
  10893. $core.method({
  10894. selector: "remove:",
  10895. protocol: 'adding/removing',
  10896. fn: function (anObject){
  10897. var self=this;
  10898. return $core.withContext(function($ctx1) {
  10899. return self._remove_ifAbsent_(anObject,(function(){
  10900. return $core.withContext(function($ctx2) {
  10901. return self._errorNotFound();
  10902. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10903. }));
  10904. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  10905. },
  10906. args: ["anObject"],
  10907. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  10908. referencedClasses: [],
  10909. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  10910. }),
  10911. $globals.Collection);
  10912. $core.addMethod(
  10913. $core.method({
  10914. selector: "remove:ifAbsent:",
  10915. protocol: 'adding/removing',
  10916. fn: function (anObject,aBlock){
  10917. var self=this;
  10918. return $core.withContext(function($ctx1) {
  10919. self._subclassResponsibility();
  10920. return self;
  10921. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  10922. },
  10923. args: ["anObject", "aBlock"],
  10924. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  10925. referencedClasses: [],
  10926. messageSends: ["subclassResponsibility"]
  10927. }),
  10928. $globals.Collection);
  10929. $core.addMethod(
  10930. $core.method({
  10931. selector: "removeAll",
  10932. protocol: 'adding/removing',
  10933. fn: function (){
  10934. var self=this;
  10935. return $core.withContext(function($ctx1) {
  10936. self._subclassResponsibility();
  10937. return self;
  10938. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  10939. },
  10940. args: [],
  10941. source: "removeAll\x0a\x09self subclassResponsibility",
  10942. referencedClasses: [],
  10943. messageSends: ["subclassResponsibility"]
  10944. }),
  10945. $globals.Collection);
  10946. $core.addMethod(
  10947. $core.method({
  10948. selector: "select:",
  10949. protocol: 'enumerating',
  10950. fn: function (aBlock){
  10951. var self=this;
  10952. var stream;
  10953. return $core.withContext(function($ctx1) {
  10954. var $1;
  10955. stream=$recv($recv(self._class())._new())._writeStream();
  10956. self._do_((function(each){
  10957. return $core.withContext(function($ctx2) {
  10958. $1=$recv(aBlock)._value_(each);
  10959. if($core.assert($1)){
  10960. return $recv(stream)._nextPut_(each);
  10961. };
  10962. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10963. }));
  10964. return $recv(stream)._contents();
  10965. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  10966. },
  10967. args: ["aBlock"],
  10968. 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",
  10969. referencedClasses: [],
  10970. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  10971. }),
  10972. $globals.Collection);
  10973. $core.addMethod(
  10974. $core.method({
  10975. selector: "select:thenCollect:",
  10976. protocol: 'enumerating',
  10977. fn: function (selectBlock,collectBlock){
  10978. var self=this;
  10979. var stream;
  10980. return $core.withContext(function($ctx1) {
  10981. var $1;
  10982. stream=$recv($recv(self._class())._new())._writeStream();
  10983. self._do_((function(each){
  10984. return $core.withContext(function($ctx2) {
  10985. $1=$recv(selectBlock)._value_(each);
  10986. $ctx2.sendIdx["value:"]=1;
  10987. if($core.assert($1)){
  10988. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  10989. };
  10990. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10991. }));
  10992. return $recv(stream)._contents();
  10993. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  10994. },
  10995. args: ["selectBlock", "collectBlock"],
  10996. 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",
  10997. referencedClasses: [],
  10998. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  10999. }),
  11000. $globals.Collection);
  11001. $core.addMethod(
  11002. $core.method({
  11003. selector: "shallowCopy",
  11004. protocol: 'copying',
  11005. fn: function (){
  11006. var self=this;
  11007. return $core.withContext(function($ctx1) {
  11008. return self._collect_((function(each){
  11009. return each;
  11010. }));
  11011. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  11012. },
  11013. args: [],
  11014. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  11015. referencedClasses: [],
  11016. messageSends: ["collect:"]
  11017. }),
  11018. $globals.Collection);
  11019. $core.addMethod(
  11020. $core.method({
  11021. selector: "size",
  11022. protocol: 'accessing',
  11023. fn: function (){
  11024. var self=this;
  11025. return $core.withContext(function($ctx1) {
  11026. self._subclassResponsibility();
  11027. return self;
  11028. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  11029. },
  11030. args: [],
  11031. source: "size\x0a\x09self subclassResponsibility",
  11032. referencedClasses: [],
  11033. messageSends: ["subclassResponsibility"]
  11034. }),
  11035. $globals.Collection);
  11036. $core.addMethod(
  11037. $core.method({
  11038. selector: "classTag",
  11039. protocol: 'accessing',
  11040. fn: function (){
  11041. var self=this;
  11042. return "collection";
  11043. },
  11044. args: [],
  11045. 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'",
  11046. referencedClasses: [],
  11047. messageSends: []
  11048. }),
  11049. $globals.Collection.klass);
  11050. $core.addMethod(
  11051. $core.method({
  11052. selector: "new:",
  11053. protocol: 'instance creation',
  11054. fn: function (anInteger){
  11055. var self=this;
  11056. return $core.withContext(function($ctx1) {
  11057. return self._new();
  11058. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.klass)});
  11059. },
  11060. args: ["anInteger"],
  11061. source: "new: anInteger\x0a\x09^ self new",
  11062. referencedClasses: [],
  11063. messageSends: ["new"]
  11064. }),
  11065. $globals.Collection.klass);
  11066. $core.addMethod(
  11067. $core.method({
  11068. selector: "with:",
  11069. protocol: 'instance creation',
  11070. fn: function (anObject){
  11071. var self=this;
  11072. return $core.withContext(function($ctx1) {
  11073. var $1;
  11074. $1=self._new();
  11075. $recv($1)._add_(anObject);
  11076. return $recv($1)._yourself();
  11077. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.klass)});
  11078. },
  11079. args: ["anObject"],
  11080. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  11081. referencedClasses: [],
  11082. messageSends: ["add:", "new", "yourself"]
  11083. }),
  11084. $globals.Collection.klass);
  11085. $core.addMethod(
  11086. $core.method({
  11087. selector: "with:with:",
  11088. protocol: 'instance creation',
  11089. fn: function (anObject,anotherObject){
  11090. var self=this;
  11091. return $core.withContext(function($ctx1) {
  11092. var $1;
  11093. $1=self._new();
  11094. $recv($1)._add_(anObject);
  11095. $ctx1.sendIdx["add:"]=1;
  11096. $recv($1)._add_(anotherObject);
  11097. return $recv($1)._yourself();
  11098. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.klass)});
  11099. },
  11100. args: ["anObject", "anotherObject"],
  11101. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  11102. referencedClasses: [],
  11103. messageSends: ["add:", "new", "yourself"]
  11104. }),
  11105. $globals.Collection.klass);
  11106. $core.addMethod(
  11107. $core.method({
  11108. selector: "with:with:with:",
  11109. protocol: 'instance creation',
  11110. fn: function (firstObject,secondObject,thirdObject){
  11111. var self=this;
  11112. return $core.withContext(function($ctx1) {
  11113. var $1;
  11114. $1=self._new();
  11115. $recv($1)._add_(firstObject);
  11116. $ctx1.sendIdx["add:"]=1;
  11117. $recv($1)._add_(secondObject);
  11118. $ctx1.sendIdx["add:"]=2;
  11119. $recv($1)._add_(thirdObject);
  11120. return $recv($1)._yourself();
  11121. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.klass)});
  11122. },
  11123. args: ["firstObject", "secondObject", "thirdObject"],
  11124. 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",
  11125. referencedClasses: [],
  11126. messageSends: ["add:", "new", "yourself"]
  11127. }),
  11128. $globals.Collection.klass);
  11129. $core.addMethod(
  11130. $core.method({
  11131. selector: "withAll:",
  11132. protocol: 'instance creation',
  11133. fn: function (aCollection){
  11134. var self=this;
  11135. return $core.withContext(function($ctx1) {
  11136. var $1;
  11137. $1=self._new();
  11138. $recv($1)._addAll_(aCollection);
  11139. return $recv($1)._yourself();
  11140. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.klass)});
  11141. },
  11142. args: ["aCollection"],
  11143. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  11144. referencedClasses: [],
  11145. messageSends: ["addAll:", "new", "yourself"]
  11146. }),
  11147. $globals.Collection.klass);
  11148. $core.addClass('IndexableCollection', $globals.Collection, [], 'Kernel-Collections');
  11149. $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.";
  11150. $core.addMethod(
  11151. $core.method({
  11152. selector: "at:",
  11153. protocol: 'accessing',
  11154. fn: function (anIndex){
  11155. var self=this;
  11156. return $core.withContext(function($ctx1) {
  11157. return self._at_ifAbsent_(anIndex,(function(){
  11158. return $core.withContext(function($ctx2) {
  11159. return self._errorNotFound();
  11160. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11161. }));
  11162. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  11163. },
  11164. args: ["anIndex"],
  11165. 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 ]",
  11166. referencedClasses: [],
  11167. messageSends: ["at:ifAbsent:", "errorNotFound"]
  11168. }),
  11169. $globals.IndexableCollection);
  11170. $core.addMethod(
  11171. $core.method({
  11172. selector: "at:ifAbsent:",
  11173. protocol: 'accessing',
  11174. fn: function (anIndex,aBlock){
  11175. var self=this;
  11176. return $core.withContext(function($ctx1) {
  11177. self._subclassResponsibility();
  11178. return self;
  11179. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  11180. },
  11181. args: ["anIndex", "aBlock"],
  11182. 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",
  11183. referencedClasses: [],
  11184. messageSends: ["subclassResponsibility"]
  11185. }),
  11186. $globals.IndexableCollection);
  11187. $core.addMethod(
  11188. $core.method({
  11189. selector: "at:ifAbsentPut:",
  11190. protocol: 'accessing',
  11191. fn: function (aKey,aBlock){
  11192. var self=this;
  11193. return $core.withContext(function($ctx1) {
  11194. return self._at_ifAbsent_(aKey,(function(){
  11195. return $core.withContext(function($ctx2) {
  11196. return self._at_put_(aKey,$recv(aBlock)._value());
  11197. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11198. }));
  11199. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  11200. },
  11201. args: ["aKey", "aBlock"],
  11202. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  11203. referencedClasses: [],
  11204. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  11205. }),
  11206. $globals.IndexableCollection);
  11207. $core.addMethod(
  11208. $core.method({
  11209. selector: "at:ifPresent:",
  11210. protocol: 'accessing',
  11211. fn: function (anIndex,aBlock){
  11212. var self=this;
  11213. return $core.withContext(function($ctx1) {
  11214. return self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  11215. return nil;
  11216. }));
  11217. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  11218. },
  11219. args: ["anIndex", "aBlock"],
  11220. 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 ]",
  11221. referencedClasses: [],
  11222. messageSends: ["at:ifPresent:ifAbsent:"]
  11223. }),
  11224. $globals.IndexableCollection);
  11225. $core.addMethod(
  11226. $core.method({
  11227. selector: "at:ifPresent:ifAbsent:",
  11228. protocol: 'accessing',
  11229. fn: function (anIndex,aBlock,anotherBlock){
  11230. var self=this;
  11231. return $core.withContext(function($ctx1) {
  11232. self._subclassResponsibility();
  11233. return self;
  11234. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  11235. },
  11236. args: ["anIndex", "aBlock", "anotherBlock"],
  11237. 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",
  11238. referencedClasses: [],
  11239. messageSends: ["subclassResponsibility"]
  11240. }),
  11241. $globals.IndexableCollection);
  11242. $core.addMethod(
  11243. $core.method({
  11244. selector: "at:put:",
  11245. protocol: 'accessing',
  11246. fn: function (anIndex,anObject){
  11247. var self=this;
  11248. return $core.withContext(function($ctx1) {
  11249. self._subclassResponsibility();
  11250. return self;
  11251. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  11252. },
  11253. args: ["anIndex", "anObject"],
  11254. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  11255. referencedClasses: [],
  11256. messageSends: ["subclassResponsibility"]
  11257. }),
  11258. $globals.IndexableCollection);
  11259. $core.addMethod(
  11260. $core.method({
  11261. selector: "indexOf:",
  11262. protocol: 'accessing',
  11263. fn: function (anObject){
  11264. var self=this;
  11265. return $core.withContext(function($ctx1) {
  11266. return self._indexOf_ifAbsent_(anObject,(function(){
  11267. return $core.withContext(function($ctx2) {
  11268. return self._errorNotFound();
  11269. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11270. }));
  11271. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  11272. },
  11273. args: ["anObject"],
  11274. 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 ]",
  11275. referencedClasses: [],
  11276. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  11277. }),
  11278. $globals.IndexableCollection);
  11279. $core.addMethod(
  11280. $core.method({
  11281. selector: "indexOf:ifAbsent:",
  11282. protocol: 'accessing',
  11283. fn: function (anObject,aBlock){
  11284. var self=this;
  11285. return $core.withContext(function($ctx1) {
  11286. self._subclassResponsibility();
  11287. return self;
  11288. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  11289. },
  11290. args: ["anObject", "aBlock"],
  11291. 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",
  11292. referencedClasses: [],
  11293. messageSends: ["subclassResponsibility"]
  11294. }),
  11295. $globals.IndexableCollection);
  11296. $core.addMethod(
  11297. $core.method({
  11298. selector: "with:do:",
  11299. protocol: 'enumerating',
  11300. fn: function (anotherCollection,aBlock){
  11301. var self=this;
  11302. return $core.withContext(function($ctx1) {
  11303. self._withIndexDo_((function(each,index){
  11304. return $core.withContext(function($ctx2) {
  11305. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  11306. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  11307. }));
  11308. return self;
  11309. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  11310. },
  11311. args: ["anotherCollection", "aBlock"],
  11312. 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) ]",
  11313. referencedClasses: [],
  11314. messageSends: ["withIndexDo:", "value:value:", "at:"]
  11315. }),
  11316. $globals.IndexableCollection);
  11317. $core.addMethod(
  11318. $core.method({
  11319. selector: "withIndexDo:",
  11320. protocol: 'enumerating',
  11321. fn: function (aBlock){
  11322. var self=this;
  11323. return $core.withContext(function($ctx1) {
  11324. self._subclassResponsibility();
  11325. return self;
  11326. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  11327. },
  11328. args: ["aBlock"],
  11329. 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",
  11330. referencedClasses: [],
  11331. messageSends: ["subclassResponsibility"]
  11332. }),
  11333. $globals.IndexableCollection);
  11334. $core.addClass('AssociativeCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  11335. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  11336. $core.addMethod(
  11337. $core.method({
  11338. selector: "=",
  11339. protocol: 'comparing',
  11340. fn: function (anAssocitativeCollection){
  11341. var self=this;
  11342. return $core.withContext(function($ctx1) {
  11343. var $2,$1,$4,$3,$5;
  11344. $2=self._class();
  11345. $ctx1.sendIdx["class"]=1;
  11346. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  11347. $ctx1.sendIdx["="]=1;
  11348. if(!$core.assert($1)){
  11349. return false;
  11350. };
  11351. $4=self._size();
  11352. $ctx1.sendIdx["size"]=1;
  11353. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  11354. $ctx1.sendIdx["="]=2;
  11355. if(!$core.assert($3)){
  11356. return false;
  11357. };
  11358. $5=self._associations();
  11359. $ctx1.sendIdx["associations"]=1;
  11360. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  11361. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  11362. },
  11363. args: ["anAssocitativeCollection"],
  11364. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  11365. referencedClasses: [],
  11366. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  11367. }),
  11368. $globals.AssociativeCollection);
  11369. $core.addMethod(
  11370. $core.method({
  11371. selector: "add:",
  11372. protocol: 'adding/removing',
  11373. fn: function (anAssociation){
  11374. var self=this;
  11375. return $core.withContext(function($ctx1) {
  11376. self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  11377. return self;
  11378. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  11379. },
  11380. args: ["anAssociation"],
  11381. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  11382. referencedClasses: [],
  11383. messageSends: ["at:put:", "key", "value"]
  11384. }),
  11385. $globals.AssociativeCollection);
  11386. $core.addMethod(
  11387. $core.method({
  11388. selector: "addAll:",
  11389. protocol: 'adding/removing',
  11390. fn: function (anAssociativeCollection){
  11391. var self=this;
  11392. return $core.withContext(function($ctx1) {
  11393. (
  11394. $ctx1.supercall = true,
  11395. ($globals.AssociativeCollection.superclass||$boot.dnu).fn.prototype._addAll_.apply($recv(self), [$recv(anAssociativeCollection)._associations()]));
  11396. $ctx1.supercall = false;
  11397. return anAssociativeCollection;
  11398. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  11399. },
  11400. args: ["anAssociativeCollection"],
  11401. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  11402. referencedClasses: [],
  11403. messageSends: ["addAll:", "associations"]
  11404. }),
  11405. $globals.AssociativeCollection);
  11406. $core.addMethod(
  11407. $core.method({
  11408. selector: "asDictionary",
  11409. protocol: 'converting',
  11410. fn: function (){
  11411. var self=this;
  11412. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  11413. return $core.withContext(function($ctx1) {
  11414. return $recv($Dictionary())._from_(self._associations());
  11415. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  11416. },
  11417. args: [],
  11418. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  11419. referencedClasses: ["Dictionary"],
  11420. messageSends: ["from:", "associations"]
  11421. }),
  11422. $globals.AssociativeCollection);
  11423. $core.addMethod(
  11424. $core.method({
  11425. selector: "asHashedCollection",
  11426. protocol: 'converting',
  11427. fn: function (){
  11428. var self=this;
  11429. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  11430. return $core.withContext(function($ctx1) {
  11431. return $recv($HashedCollection())._from_(self._associations());
  11432. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  11433. },
  11434. args: [],
  11435. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  11436. referencedClasses: ["HashedCollection"],
  11437. messageSends: ["from:", "associations"]
  11438. }),
  11439. $globals.AssociativeCollection);
  11440. $core.addMethod(
  11441. $core.method({
  11442. selector: "asJSON",
  11443. protocol: 'converting',
  11444. fn: function (){
  11445. var self=this;
  11446. var hash;
  11447. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  11448. return $core.withContext(function($ctx1) {
  11449. hash=$recv($HashedCollection())._new();
  11450. self._keysAndValuesDo_((function(key,value){
  11451. return $core.withContext(function($ctx2) {
  11452. return $recv(hash)._at_put_(key,$recv(value)._asJSON());
  11453. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11454. }));
  11455. return hash;
  11456. }, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},$globals.AssociativeCollection)});
  11457. },
  11458. args: [],
  11459. 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",
  11460. referencedClasses: ["HashedCollection"],
  11461. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"]
  11462. }),
  11463. $globals.AssociativeCollection);
  11464. $core.addMethod(
  11465. $core.method({
  11466. selector: "associations",
  11467. protocol: 'accessing',
  11468. fn: function (){
  11469. var self=this;
  11470. var associations;
  11471. return $core.withContext(function($ctx1) {
  11472. associations=[];
  11473. self._associationsDo_((function(each){
  11474. return $core.withContext(function($ctx2) {
  11475. return $recv(associations)._add_(each);
  11476. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11477. }));
  11478. return associations;
  11479. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  11480. },
  11481. args: [],
  11482. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  11483. referencedClasses: [],
  11484. messageSends: ["associationsDo:", "add:"]
  11485. }),
  11486. $globals.AssociativeCollection);
  11487. $core.addMethod(
  11488. $core.method({
  11489. selector: "associationsDo:",
  11490. protocol: 'enumerating',
  11491. fn: function (aBlock){
  11492. var self=this;
  11493. function $Association(){return $globals.Association||(typeof Association=="undefined"?nil:Association)}
  11494. return $core.withContext(function($ctx1) {
  11495. self._keysAndValuesDo_((function(key,value){
  11496. return $core.withContext(function($ctx2) {
  11497. return $recv(aBlock)._value_($recv($Association())._key_value_(key,value));
  11498. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11499. }));
  11500. return self;
  11501. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  11502. },
  11503. args: ["aBlock"],
  11504. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  11505. referencedClasses: ["Association"],
  11506. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  11507. }),
  11508. $globals.AssociativeCollection);
  11509. $core.addMethod(
  11510. $core.method({
  11511. selector: "at:ifPresent:ifAbsent:",
  11512. protocol: 'accessing',
  11513. fn: function (aKey,aBlock,anotherBlock){
  11514. var self=this;
  11515. return $core.withContext(function($ctx1) {
  11516. var $1;
  11517. $1=self._includesKey_(aKey);
  11518. if($core.assert($1)){
  11519. return $recv(aBlock)._value_(self._at_(aKey));
  11520. } else {
  11521. return $recv(anotherBlock)._value();
  11522. };
  11523. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  11524. },
  11525. args: ["aKey", "aBlock", "anotherBlock"],
  11526. 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 ]",
  11527. referencedClasses: [],
  11528. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  11529. }),
  11530. $globals.AssociativeCollection);
  11531. $core.addMethod(
  11532. $core.method({
  11533. selector: "collect:",
  11534. protocol: 'enumerating',
  11535. fn: function (aBlock){
  11536. var self=this;
  11537. var newDict;
  11538. return $core.withContext(function($ctx1) {
  11539. newDict=$recv(self._class())._new();
  11540. self._keysAndValuesDo_((function(key,value){
  11541. return $core.withContext(function($ctx2) {
  11542. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  11543. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11544. }));
  11545. return newDict;
  11546. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  11547. },
  11548. args: ["aBlock"],
  11549. 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",
  11550. referencedClasses: [],
  11551. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  11552. }),
  11553. $globals.AssociativeCollection);
  11554. $core.addMethod(
  11555. $core.method({
  11556. selector: "deepCopy",
  11557. protocol: 'copying',
  11558. fn: function (){
  11559. var self=this;
  11560. var copy;
  11561. return $core.withContext(function($ctx1) {
  11562. copy=$recv(self._class())._new();
  11563. self._keysAndValuesDo_((function(key,value){
  11564. return $core.withContext(function($ctx2) {
  11565. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  11566. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11567. }));
  11568. return copy;
  11569. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  11570. },
  11571. args: [],
  11572. 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",
  11573. referencedClasses: [],
  11574. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  11575. }),
  11576. $globals.AssociativeCollection);
  11577. $core.addMethod(
  11578. $core.method({
  11579. selector: "detect:ifNone:",
  11580. protocol: 'enumerating',
  11581. fn: function (aBlock,anotherBlock){
  11582. var self=this;
  11583. return $core.withContext(function($ctx1) {
  11584. return $recv(self._values())._detect_ifNone_(aBlock,anotherBlock);
  11585. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  11586. },
  11587. args: ["aBlock", "anotherBlock"],
  11588. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  11589. referencedClasses: [],
  11590. messageSends: ["detect:ifNone:", "values"]
  11591. }),
  11592. $globals.AssociativeCollection);
  11593. $core.addMethod(
  11594. $core.method({
  11595. selector: "do:",
  11596. protocol: 'enumerating',
  11597. fn: function (aBlock){
  11598. var self=this;
  11599. return $core.withContext(function($ctx1) {
  11600. self._valuesDo_(aBlock);
  11601. return self;
  11602. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  11603. },
  11604. args: ["aBlock"],
  11605. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  11606. referencedClasses: [],
  11607. messageSends: ["valuesDo:"]
  11608. }),
  11609. $globals.AssociativeCollection);
  11610. $core.addMethod(
  11611. $core.method({
  11612. selector: "includes:",
  11613. protocol: 'enumerating',
  11614. fn: function (anObject){
  11615. var self=this;
  11616. return $core.withContext(function($ctx1) {
  11617. return $recv(self._values())._includes_(anObject);
  11618. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  11619. },
  11620. args: ["anObject"],
  11621. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  11622. referencedClasses: [],
  11623. messageSends: ["includes:", "values"]
  11624. }),
  11625. $globals.AssociativeCollection);
  11626. $core.addMethod(
  11627. $core.method({
  11628. selector: "includesKey:",
  11629. protocol: 'testing',
  11630. fn: function (aKey){
  11631. var self=this;
  11632. return $core.withContext(function($ctx1) {
  11633. self._subclassResponsibility();
  11634. return self;
  11635. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  11636. },
  11637. args: ["aKey"],
  11638. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  11639. referencedClasses: [],
  11640. messageSends: ["subclassResponsibility"]
  11641. }),
  11642. $globals.AssociativeCollection);
  11643. $core.addMethod(
  11644. $core.method({
  11645. selector: "indexOf:ifAbsent:",
  11646. protocol: 'accessing',
  11647. fn: function (anObject,aBlock){
  11648. var self=this;
  11649. return $core.withContext(function($ctx1) {
  11650. return $recv(self._keys())._detect_ifNone_((function(each){
  11651. return $core.withContext(function($ctx2) {
  11652. return $recv(self._at_(each)).__eq(anObject);
  11653. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11654. }),aBlock);
  11655. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  11656. },
  11657. args: ["anObject", "aBlock"],
  11658. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  11659. referencedClasses: [],
  11660. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  11661. }),
  11662. $globals.AssociativeCollection);
  11663. $core.addMethod(
  11664. $core.method({
  11665. selector: "keyAtValue:",
  11666. protocol: 'accessing',
  11667. fn: function (anObject){
  11668. var self=this;
  11669. return $core.withContext(function($ctx1) {
  11670. return self._keyAtValue_ifAbsent_(anObject,(function(){
  11671. return $core.withContext(function($ctx2) {
  11672. return self._errorNotFound();
  11673. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11674. }));
  11675. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  11676. },
  11677. args: ["anObject"],
  11678. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  11679. referencedClasses: [],
  11680. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  11681. }),
  11682. $globals.AssociativeCollection);
  11683. $core.addMethod(
  11684. $core.method({
  11685. selector: "keyAtValue:ifAbsent:",
  11686. protocol: 'accessing',
  11687. fn: function (anObject,aBlock){
  11688. var self=this;
  11689. return $core.withContext(function($ctx1) {
  11690. return self._indexOf_ifAbsent_(anObject,aBlock);
  11691. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  11692. },
  11693. args: ["anObject", "aBlock"],
  11694. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  11695. referencedClasses: [],
  11696. messageSends: ["indexOf:ifAbsent:"]
  11697. }),
  11698. $globals.AssociativeCollection);
  11699. $core.addMethod(
  11700. $core.method({
  11701. selector: "keys",
  11702. protocol: 'accessing',
  11703. fn: function (){
  11704. var self=this;
  11705. return $core.withContext(function($ctx1) {
  11706. self._subclassResponsibility();
  11707. return self;
  11708. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  11709. },
  11710. args: [],
  11711. source: "keys\x0a\x09self subclassResponsibility",
  11712. referencedClasses: [],
  11713. messageSends: ["subclassResponsibility"]
  11714. }),
  11715. $globals.AssociativeCollection);
  11716. $core.addMethod(
  11717. $core.method({
  11718. selector: "keysAndValuesDo:",
  11719. protocol: 'enumerating',
  11720. fn: function (aBlock){
  11721. var self=this;
  11722. return $core.withContext(function($ctx1) {
  11723. self._keysDo_((function(each){
  11724. return $core.withContext(function($ctx2) {
  11725. return $recv(aBlock)._value_value_(each,self._at_(each));
  11726. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11727. }));
  11728. return self;
  11729. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  11730. },
  11731. args: ["aBlock"],
  11732. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  11733. referencedClasses: [],
  11734. messageSends: ["keysDo:", "value:value:", "at:"]
  11735. }),
  11736. $globals.AssociativeCollection);
  11737. $core.addMethod(
  11738. $core.method({
  11739. selector: "keysDo:",
  11740. protocol: 'enumerating',
  11741. fn: function (aBlock){
  11742. var self=this;
  11743. return $core.withContext(function($ctx1) {
  11744. self._subclassResponsibility();
  11745. return self;
  11746. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  11747. },
  11748. args: ["aBlock"],
  11749. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  11750. referencedClasses: [],
  11751. messageSends: ["subclassResponsibility"]
  11752. }),
  11753. $globals.AssociativeCollection);
  11754. $core.addMethod(
  11755. $core.method({
  11756. selector: "printOn:",
  11757. protocol: 'printing',
  11758. fn: function (aStream){
  11759. var self=this;
  11760. return $core.withContext(function($ctx1) {
  11761. (
  11762. $ctx1.supercall = true,
  11763. ($globals.AssociativeCollection.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  11764. $ctx1.supercall = false;
  11765. $ctx1.sendIdx["printOn:"]=1;
  11766. $recv(aStream)._nextPutAll_(" (");
  11767. $ctx1.sendIdx["nextPutAll:"]=1;
  11768. $recv(self._associations())._do_separatedBy_((function(each){
  11769. return $core.withContext(function($ctx2) {
  11770. return $recv(each)._printOn_(aStream);
  11771. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11772. }),(function(){
  11773. return $core.withContext(function($ctx2) {
  11774. return $recv(aStream)._nextPutAll_(" , ");
  11775. $ctx2.sendIdx["nextPutAll:"]=2;
  11776. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  11777. }));
  11778. $recv(aStream)._nextPutAll_(")");
  11779. return self;
  11780. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  11781. },
  11782. args: ["aStream"],
  11783. 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: ')'",
  11784. referencedClasses: [],
  11785. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  11786. }),
  11787. $globals.AssociativeCollection);
  11788. $core.addMethod(
  11789. $core.method({
  11790. selector: "remove:ifAbsent:",
  11791. protocol: 'adding/removing',
  11792. fn: function (aKey,aBlock){
  11793. var self=this;
  11794. return $core.withContext(function($ctx1) {
  11795. return self._removeKey_ifAbsent_(aKey,aBlock);
  11796. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  11797. },
  11798. args: ["aKey", "aBlock"],
  11799. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  11800. referencedClasses: [],
  11801. messageSends: ["removeKey:ifAbsent:"]
  11802. }),
  11803. $globals.AssociativeCollection);
  11804. $core.addMethod(
  11805. $core.method({
  11806. selector: "removeAll",
  11807. protocol: 'adding/removing',
  11808. fn: function (){
  11809. var self=this;
  11810. return $core.withContext(function($ctx1) {
  11811. return $recv(self._keys())._do_((function(each){
  11812. return $core.withContext(function($ctx2) {
  11813. return self._removeKey_(each);
  11814. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11815. }));
  11816. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  11817. },
  11818. args: [],
  11819. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  11820. referencedClasses: [],
  11821. messageSends: ["do:", "keys", "removeKey:"]
  11822. }),
  11823. $globals.AssociativeCollection);
  11824. $core.addMethod(
  11825. $core.method({
  11826. selector: "removeKey:",
  11827. protocol: 'adding/removing',
  11828. fn: function (aKey){
  11829. var self=this;
  11830. return $core.withContext(function($ctx1) {
  11831. return self._remove_(aKey);
  11832. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  11833. },
  11834. args: ["aKey"],
  11835. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  11836. referencedClasses: [],
  11837. messageSends: ["remove:"]
  11838. }),
  11839. $globals.AssociativeCollection);
  11840. $core.addMethod(
  11841. $core.method({
  11842. selector: "removeKey:ifAbsent:",
  11843. protocol: 'adding/removing',
  11844. fn: function (aKey,aBlock){
  11845. var self=this;
  11846. return $core.withContext(function($ctx1) {
  11847. self._subclassResponsibility();
  11848. return self;
  11849. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  11850. },
  11851. args: ["aKey", "aBlock"],
  11852. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  11853. referencedClasses: [],
  11854. messageSends: ["subclassResponsibility"]
  11855. }),
  11856. $globals.AssociativeCollection);
  11857. $core.addMethod(
  11858. $core.method({
  11859. selector: "select:",
  11860. protocol: 'enumerating',
  11861. fn: function (aBlock){
  11862. var self=this;
  11863. var newDict;
  11864. return $core.withContext(function($ctx1) {
  11865. var $1;
  11866. newDict=$recv(self._class())._new();
  11867. self._keysAndValuesDo_((function(key,value){
  11868. return $core.withContext(function($ctx2) {
  11869. $1=$recv(aBlock)._value_(value);
  11870. if($core.assert($1)){
  11871. return $recv(newDict)._at_put_(key,value);
  11872. };
  11873. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11874. }));
  11875. return newDict;
  11876. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  11877. },
  11878. args: ["aBlock"],
  11879. 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",
  11880. referencedClasses: [],
  11881. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  11882. }),
  11883. $globals.AssociativeCollection);
  11884. $core.addMethod(
  11885. $core.method({
  11886. selector: "shallowCopy",
  11887. protocol: 'copying',
  11888. fn: function (){
  11889. var self=this;
  11890. var copy;
  11891. return $core.withContext(function($ctx1) {
  11892. copy=$recv(self._class())._new();
  11893. self._keysAndValuesDo_((function(key,value){
  11894. return $core.withContext(function($ctx2) {
  11895. return $recv(copy)._at_put_(key,value);
  11896. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11897. }));
  11898. return copy;
  11899. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  11900. },
  11901. args: [],
  11902. 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",
  11903. referencedClasses: [],
  11904. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  11905. }),
  11906. $globals.AssociativeCollection);
  11907. $core.addMethod(
  11908. $core.method({
  11909. selector: "size",
  11910. protocol: 'accessing',
  11911. fn: function (){
  11912. var self=this;
  11913. return $core.withContext(function($ctx1) {
  11914. return $recv(self._keys())._size();
  11915. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  11916. },
  11917. args: [],
  11918. source: "size\x0a\x09^ self keys size",
  11919. referencedClasses: [],
  11920. messageSends: ["size", "keys"]
  11921. }),
  11922. $globals.AssociativeCollection);
  11923. $core.addMethod(
  11924. $core.method({
  11925. selector: "values",
  11926. protocol: 'accessing',
  11927. fn: function (){
  11928. var self=this;
  11929. return $core.withContext(function($ctx1) {
  11930. self._subclassResponsibility();
  11931. return self;
  11932. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  11933. },
  11934. args: [],
  11935. source: "values\x0a\x09self subclassResponsibility",
  11936. referencedClasses: [],
  11937. messageSends: ["subclassResponsibility"]
  11938. }),
  11939. $globals.AssociativeCollection);
  11940. $core.addMethod(
  11941. $core.method({
  11942. selector: "valuesDo:",
  11943. protocol: 'enumerating',
  11944. fn: function (aBlock){
  11945. var self=this;
  11946. return $core.withContext(function($ctx1) {
  11947. self._subclassResponsibility();
  11948. return self;
  11949. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  11950. },
  11951. args: ["aBlock"],
  11952. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  11953. referencedClasses: [],
  11954. messageSends: ["subclassResponsibility"]
  11955. }),
  11956. $globals.AssociativeCollection);
  11957. $core.addMethod(
  11958. $core.method({
  11959. selector: "withIndexDo:",
  11960. protocol: 'enumerating',
  11961. fn: function (aBlock){
  11962. var self=this;
  11963. return $core.withContext(function($ctx1) {
  11964. self._keysAndValuesDo_((function(key,value){
  11965. return $core.withContext(function($ctx2) {
  11966. return $recv(aBlock)._value_value_(value,key);
  11967. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11968. }));
  11969. return self;
  11970. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  11971. },
  11972. args: ["aBlock"],
  11973. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  11974. referencedClasses: [],
  11975. messageSends: ["keysAndValuesDo:", "value:value:"]
  11976. }),
  11977. $globals.AssociativeCollection);
  11978. $core.addMethod(
  11979. $core.method({
  11980. selector: "from:",
  11981. protocol: 'instance creation',
  11982. fn: function (aCollection){
  11983. var self=this;
  11984. var newCollection;
  11985. return $core.withContext(function($ctx1) {
  11986. newCollection=self._new();
  11987. $recv(aCollection)._do_((function(each){
  11988. return $core.withContext(function($ctx2) {
  11989. return $recv(newCollection)._add_(each);
  11990. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11991. }));
  11992. return newCollection;
  11993. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  11994. },
  11995. args: ["aCollection"],
  11996. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  11997. referencedClasses: [],
  11998. messageSends: ["new", "do:", "add:"]
  11999. }),
  12000. $globals.AssociativeCollection.klass);
  12001. $core.addMethod(
  12002. $core.method({
  12003. selector: "fromPairs:",
  12004. protocol: 'instance creation',
  12005. fn: function (aCollection){
  12006. var self=this;
  12007. return $core.withContext(function($ctx1) {
  12008. return self._from_(aCollection);
  12009. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.klass)});
  12010. },
  12011. args: ["aCollection"],
  12012. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  12013. referencedClasses: [],
  12014. messageSends: ["from:"]
  12015. }),
  12016. $globals.AssociativeCollection.klass);
  12017. $core.addMethod(
  12018. $core.method({
  12019. selector: "newFromPairs:",
  12020. protocol: 'instance creation',
  12021. fn: function (aCollection){
  12022. var self=this;
  12023. var newCollection;
  12024. return $core.withContext(function($ctx1) {
  12025. var $2,$1,$3,$4;
  12026. $2=$recv(aCollection)._size();
  12027. $ctx1.sendIdx["size"]=1;
  12028. $1=$recv($2)._even();
  12029. if(!$core.assert($1)){
  12030. self._error_("#newFromPairs only accepts arrays of an even length");
  12031. };
  12032. newCollection=self._new();
  12033. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  12034. return $core.withContext(function($ctx2) {
  12035. $3=newCollection;
  12036. $4=$recv(aCollection)._at_(each);
  12037. $ctx2.sendIdx["at:"]=1;
  12038. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  12039. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  12040. }));
  12041. return newCollection;
  12042. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  12043. },
  12044. args: ["aCollection"],
  12045. 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",
  12046. referencedClasses: [],
  12047. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  12048. }),
  12049. $globals.AssociativeCollection.klass);
  12050. $core.addClass('Dictionary', $globals.AssociativeCollection, ['keys', 'values'], 'Kernel-Collections');
  12051. $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.";
  12052. $core.addMethod(
  12053. $core.method({
  12054. selector: "at:ifAbsent:",
  12055. protocol: 'accessing',
  12056. fn: function (aKey,aBlock){
  12057. var self=this;
  12058. return $core.withContext(function($ctx1) {
  12059. var index = self._positionOfKey_(aKey);
  12060. return index >=0 ? self['@values'][index] : aBlock._value();
  12061. ;
  12062. return self;
  12063. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  12064. },
  12065. args: ["aKey", "aBlock"],
  12066. 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>",
  12067. referencedClasses: [],
  12068. messageSends: []
  12069. }),
  12070. $globals.Dictionary);
  12071. $core.addMethod(
  12072. $core.method({
  12073. selector: "at:put:",
  12074. protocol: 'accessing',
  12075. fn: function (aKey,aValue){
  12076. var self=this;
  12077. return $core.withContext(function($ctx1) {
  12078. var index = self._positionOfKey_(aKey);
  12079. if(index === -1) {
  12080. var keys = self['@keys'];
  12081. index = keys.length;
  12082. keys.push(aKey);
  12083. }
  12084. return self['@values'][index] = aValue;
  12085. ;
  12086. return self;
  12087. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  12088. },
  12089. args: ["aKey", "aValue"],
  12090. 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>",
  12091. referencedClasses: [],
  12092. messageSends: []
  12093. }),
  12094. $globals.Dictionary);
  12095. $core.addMethod(
  12096. $core.method({
  12097. selector: "includesKey:",
  12098. protocol: 'testing',
  12099. fn: function (aKey){
  12100. var self=this;
  12101. return $core.withContext(function($ctx1) {
  12102. return self._positionOfKey_(aKey) >= 0; ;
  12103. return self;
  12104. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  12105. },
  12106. args: ["aKey"],
  12107. source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
  12108. referencedClasses: [],
  12109. messageSends: []
  12110. }),
  12111. $globals.Dictionary);
  12112. $core.addMethod(
  12113. $core.method({
  12114. selector: "indexOf:ifAbsent:",
  12115. protocol: 'accessing',
  12116. fn: function (anObject,aBlock){
  12117. var self=this;
  12118. var index;
  12119. return $core.withContext(function($ctx1) {
  12120. var $1;
  12121. index=$recv(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  12122. return (0);
  12123. }));
  12124. $1=$recv(index).__eq((0));
  12125. if($core.assert($1)){
  12126. return $recv(aBlock)._value();
  12127. } else {
  12128. return $recv(self["@keys"])._at_(index);
  12129. };
  12130. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  12131. },
  12132. args: ["anObject", "aBlock"],
  12133. 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 ]",
  12134. referencedClasses: [],
  12135. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  12136. }),
  12137. $globals.Dictionary);
  12138. $core.addMethod(
  12139. $core.method({
  12140. selector: "initialize",
  12141. protocol: 'initialization',
  12142. fn: function (){
  12143. var self=this;
  12144. return $core.withContext(function($ctx1) {
  12145. (
  12146. $ctx1.supercall = true,
  12147. ($globals.Dictionary.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  12148. $ctx1.supercall = false;
  12149. self["@keys"]=[];
  12150. self["@values"]=[];
  12151. return self;
  12152. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  12153. },
  12154. args: [],
  12155. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  12156. referencedClasses: [],
  12157. messageSends: ["initialize"]
  12158. }),
  12159. $globals.Dictionary);
  12160. $core.addMethod(
  12161. $core.method({
  12162. selector: "keys",
  12163. protocol: 'accessing',
  12164. fn: function (){
  12165. var self=this;
  12166. return $core.withContext(function($ctx1) {
  12167. return $recv(self["@keys"])._copy();
  12168. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  12169. },
  12170. args: [],
  12171. source: "keys\x0a\x09^ keys copy",
  12172. referencedClasses: [],
  12173. messageSends: ["copy"]
  12174. }),
  12175. $globals.Dictionary);
  12176. $core.addMethod(
  12177. $core.method({
  12178. selector: "keysAndValuesDo:",
  12179. protocol: 'enumerating',
  12180. fn: function (aBlock){
  12181. var self=this;
  12182. return $core.withContext(function($ctx1) {
  12183. return $recv(self["@keys"])._with_do_(self["@values"],aBlock);
  12184. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  12185. },
  12186. args: ["aBlock"],
  12187. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  12188. referencedClasses: [],
  12189. messageSends: ["with:do:"]
  12190. }),
  12191. $globals.Dictionary);
  12192. $core.addMethod(
  12193. $core.method({
  12194. selector: "keysDo:",
  12195. protocol: 'enumerating',
  12196. fn: function (aBlock){
  12197. var self=this;
  12198. return $core.withContext(function($ctx1) {
  12199. return $recv(self["@keys"])._do_(aBlock);
  12200. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  12201. },
  12202. args: ["aBlock"],
  12203. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  12204. referencedClasses: [],
  12205. messageSends: ["do:"]
  12206. }),
  12207. $globals.Dictionary);
  12208. $core.addMethod(
  12209. $core.method({
  12210. selector: "positionOfKey:",
  12211. protocol: 'private',
  12212. fn: function (anObject){
  12213. var self=this;
  12214. return $core.withContext(function($ctx1) {
  12215. var keys = self['@keys'];
  12216. for(var i=0;i<keys.length;i++){
  12217. if(keys[i].__eq(anObject)) { return i;}
  12218. }
  12219. return -1;
  12220. ;
  12221. return self;
  12222. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  12223. },
  12224. args: ["anObject"],
  12225. 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>",
  12226. referencedClasses: [],
  12227. messageSends: []
  12228. }),
  12229. $globals.Dictionary);
  12230. $core.addMethod(
  12231. $core.method({
  12232. selector: "removeAll",
  12233. protocol: 'adding/removing',
  12234. fn: function (){
  12235. var self=this;
  12236. return $core.withContext(function($ctx1) {
  12237. $recv(self["@keys"])._removeAll();
  12238. $ctx1.sendIdx["removeAll"]=1;
  12239. $recv(self["@values"])._removeAll();
  12240. return self;
  12241. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  12242. },
  12243. args: [],
  12244. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  12245. referencedClasses: [],
  12246. messageSends: ["removeAll"]
  12247. }),
  12248. $globals.Dictionary);
  12249. $core.addMethod(
  12250. $core.method({
  12251. selector: "removeKey:ifAbsent:",
  12252. protocol: 'adding/removing',
  12253. fn: function (aKey,aBlock){
  12254. var self=this;
  12255. return $core.withContext(function($ctx1) {
  12256. var index = self._positionOfKey_(aKey);
  12257. if(index === -1) {
  12258. return aBlock._value()
  12259. } else {
  12260. var keys = self['@keys'], values = self['@values'];
  12261. var value = values[index], l = keys.length;
  12262. keys[index] = keys[l-1];
  12263. keys.pop();
  12264. values[index] = values[l-1];
  12265. values.pop();
  12266. return value;
  12267. }
  12268. ;
  12269. return self;
  12270. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  12271. },
  12272. args: ["aKey", "aBlock"],
  12273. 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>",
  12274. referencedClasses: [],
  12275. messageSends: []
  12276. }),
  12277. $globals.Dictionary);
  12278. $core.addMethod(
  12279. $core.method({
  12280. selector: "values",
  12281. protocol: 'accessing',
  12282. fn: function (){
  12283. var self=this;
  12284. return self["@values"];
  12285. },
  12286. args: [],
  12287. source: "values\x0a\x09^ values",
  12288. referencedClasses: [],
  12289. messageSends: []
  12290. }),
  12291. $globals.Dictionary);
  12292. $core.addMethod(
  12293. $core.method({
  12294. selector: "valuesDo:",
  12295. protocol: 'enumerating',
  12296. fn: function (aBlock){
  12297. var self=this;
  12298. return $core.withContext(function($ctx1) {
  12299. return $recv(self["@values"])._do_(aBlock);
  12300. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  12301. },
  12302. args: ["aBlock"],
  12303. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  12304. referencedClasses: [],
  12305. messageSends: ["do:"]
  12306. }),
  12307. $globals.Dictionary);
  12308. $core.addClass('HashedCollection', $globals.AssociativeCollection, [], 'Kernel-Collections');
  12309. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  12310. $core.addMethod(
  12311. $core.method({
  12312. selector: "at:ifAbsent:",
  12313. protocol: 'accessing',
  12314. fn: function (aKey,aBlock){
  12315. var self=this;
  12316. return $core.withContext(function($ctx1) {
  12317. var $1;
  12318. $1=self._includesKey_(aKey);
  12319. if($core.assert($1)){
  12320. return self._basicAt_(aKey);
  12321. } else {
  12322. return $recv(aBlock)._value();
  12323. };
  12324. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  12325. },
  12326. args: ["aKey", "aBlock"],
  12327. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  12328. referencedClasses: [],
  12329. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  12330. }),
  12331. $globals.HashedCollection);
  12332. $core.addMethod(
  12333. $core.method({
  12334. selector: "at:put:",
  12335. protocol: 'accessing',
  12336. fn: function (aKey,aValue){
  12337. var self=this;
  12338. return $core.withContext(function($ctx1) {
  12339. return self._basicAt_put_(aKey,aValue);
  12340. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  12341. },
  12342. args: ["aKey", "aValue"],
  12343. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  12344. referencedClasses: [],
  12345. messageSends: ["basicAt:put:"]
  12346. }),
  12347. $globals.HashedCollection);
  12348. $core.addMethod(
  12349. $core.method({
  12350. selector: "includesKey:",
  12351. protocol: 'testing',
  12352. fn: function (aKey){
  12353. var self=this;
  12354. return $core.withContext(function($ctx1) {
  12355. return self.hasOwnProperty(aKey);
  12356. return self;
  12357. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  12358. },
  12359. args: ["aKey"],
  12360. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  12361. referencedClasses: [],
  12362. messageSends: []
  12363. }),
  12364. $globals.HashedCollection);
  12365. $core.addMethod(
  12366. $core.method({
  12367. selector: "keys",
  12368. protocol: 'accessing',
  12369. fn: function (){
  12370. var self=this;
  12371. return $core.withContext(function($ctx1) {
  12372. return Object.keys(self);
  12373. return self;
  12374. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  12375. },
  12376. args: [],
  12377. source: "keys\x0a\x09<return Object.keys(self)>",
  12378. referencedClasses: [],
  12379. messageSends: []
  12380. }),
  12381. $globals.HashedCollection);
  12382. $core.addMethod(
  12383. $core.method({
  12384. selector: "keysDo:",
  12385. protocol: 'enumerating',
  12386. fn: function (aBlock){
  12387. var self=this;
  12388. return $core.withContext(function($ctx1) {
  12389. $recv(self._keys())._do_(aBlock);
  12390. return self;
  12391. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  12392. },
  12393. args: ["aBlock"],
  12394. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  12395. referencedClasses: [],
  12396. messageSends: ["do:", "keys"]
  12397. }),
  12398. $globals.HashedCollection);
  12399. $core.addMethod(
  12400. $core.method({
  12401. selector: "removeKey:ifAbsent:",
  12402. protocol: 'adding/removing',
  12403. fn: function (aKey,aBlock){
  12404. var self=this;
  12405. return $core.withContext(function($ctx1) {
  12406. return self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  12407. return $core.withContext(function($ctx2) {
  12408. self._basicDelete_(aKey);
  12409. return removed;
  12410. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  12411. }),(function(){
  12412. return $core.withContext(function($ctx2) {
  12413. return $recv(aBlock)._value();
  12414. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12415. }));
  12416. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  12417. },
  12418. args: ["aKey", "aBlock"],
  12419. 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 ]",
  12420. referencedClasses: [],
  12421. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  12422. }),
  12423. $globals.HashedCollection);
  12424. $core.addMethod(
  12425. $core.method({
  12426. selector: "values",
  12427. protocol: 'accessing',
  12428. fn: function (){
  12429. var self=this;
  12430. return $core.withContext(function($ctx1) {
  12431. return self._keys().map(function(key){
  12432. return self._at_(key);
  12433. });
  12434. ;
  12435. return self;
  12436. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  12437. },
  12438. args: [],
  12439. source: "values\x0a\x09<\x0a\x09\x09return self._keys().map(function(key){\x0a\x09\x09\x09return self._at_(key);\x0a\x09\x09});\x0a\x09>",
  12440. referencedClasses: [],
  12441. messageSends: []
  12442. }),
  12443. $globals.HashedCollection);
  12444. $core.addMethod(
  12445. $core.method({
  12446. selector: "valuesDo:",
  12447. protocol: 'enumerating',
  12448. fn: function (aBlock){
  12449. var self=this;
  12450. return $core.withContext(function($ctx1) {
  12451. $recv(self._values())._do_(aBlock);
  12452. return self;
  12453. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  12454. },
  12455. args: ["aBlock"],
  12456. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  12457. referencedClasses: [],
  12458. messageSends: ["do:", "values"]
  12459. }),
  12460. $globals.HashedCollection);
  12461. $core.addClass('SequenceableCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  12462. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  12463. $core.addMethod(
  12464. $core.method({
  12465. selector: "=",
  12466. protocol: 'comparing',
  12467. fn: function (aCollection){
  12468. var self=this;
  12469. return $core.withContext(function($ctx1) {
  12470. var $3,$2,$4,$1,$5;
  12471. var $early={};
  12472. try {
  12473. $3=self._class();
  12474. $ctx1.sendIdx["class"]=1;
  12475. $2=$recv($3).__eq($recv(aCollection)._class());
  12476. $ctx1.sendIdx["="]=1;
  12477. $1=$recv($2)._and_((function(){
  12478. return $core.withContext(function($ctx2) {
  12479. $4=self._size();
  12480. $ctx2.sendIdx["size"]=1;
  12481. return $recv($4).__eq($recv(aCollection)._size());
  12482. $ctx2.sendIdx["="]=2;
  12483. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12484. }));
  12485. if(!$core.assert($1)){
  12486. return false;
  12487. };
  12488. self._withIndexDo_((function(each,i){
  12489. return $core.withContext(function($ctx2) {
  12490. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  12491. if(!$core.assert($5)){
  12492. throw $early=[false];
  12493. };
  12494. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  12495. }));
  12496. return true;
  12497. }
  12498. catch(e) {if(e===$early)return e[0]; throw e}
  12499. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  12500. },
  12501. args: ["aCollection"],
  12502. 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",
  12503. referencedClasses: [],
  12504. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  12505. }),
  12506. $globals.SequenceableCollection);
  12507. $core.addMethod(
  12508. $core.method({
  12509. selector: "addLast:",
  12510. protocol: 'adding/removing',
  12511. fn: function (anObject){
  12512. var self=this;
  12513. return $core.withContext(function($ctx1) {
  12514. self._add_(anObject);
  12515. return self;
  12516. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  12517. },
  12518. args: ["anObject"],
  12519. source: "addLast: anObject\x0a\x09self add: anObject",
  12520. referencedClasses: [],
  12521. messageSends: ["add:"]
  12522. }),
  12523. $globals.SequenceableCollection);
  12524. $core.addMethod(
  12525. $core.method({
  12526. selector: "allButFirst",
  12527. protocol: 'accessing',
  12528. fn: function (){
  12529. var self=this;
  12530. return $core.withContext(function($ctx1) {
  12531. return self._copyFrom_to_((2),self._size());
  12532. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  12533. },
  12534. args: [],
  12535. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  12536. referencedClasses: [],
  12537. messageSends: ["copyFrom:to:", "size"]
  12538. }),
  12539. $globals.SequenceableCollection);
  12540. $core.addMethod(
  12541. $core.method({
  12542. selector: "allButLast",
  12543. protocol: 'accessing',
  12544. fn: function (){
  12545. var self=this;
  12546. return $core.withContext(function($ctx1) {
  12547. return self._copyFrom_to_((1),$recv(self._size()).__minus((1)));
  12548. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  12549. },
  12550. args: [],
  12551. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  12552. referencedClasses: [],
  12553. messageSends: ["copyFrom:to:", "-", "size"]
  12554. }),
  12555. $globals.SequenceableCollection);
  12556. $core.addMethod(
  12557. $core.method({
  12558. selector: "atRandom",
  12559. protocol: 'accessing',
  12560. fn: function (){
  12561. var self=this;
  12562. return $core.withContext(function($ctx1) {
  12563. return self._at_($recv(self._size())._atRandom());
  12564. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  12565. },
  12566. args: [],
  12567. source: "atRandom\x0a\x09^ self at: self size atRandom",
  12568. referencedClasses: [],
  12569. messageSends: ["at:", "atRandom", "size"]
  12570. }),
  12571. $globals.SequenceableCollection);
  12572. $core.addMethod(
  12573. $core.method({
  12574. selector: "beginsWith:",
  12575. protocol: 'testing',
  12576. fn: function (prefix){
  12577. var self=this;
  12578. return $core.withContext(function($ctx1) {
  12579. var $2,$3,$1;
  12580. $2=self._size();
  12581. $ctx1.sendIdx["size"]=1;
  12582. $3=$recv(prefix)._size();
  12583. $ctx1.sendIdx["size"]=2;
  12584. $1=$recv($2).__lt($3);
  12585. if($core.assert($1)){
  12586. return false;
  12587. };
  12588. return $recv(self._first_($recv(prefix)._size())).__eq(prefix);
  12589. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  12590. },
  12591. args: ["prefix"],
  12592. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  12593. referencedClasses: [],
  12594. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  12595. }),
  12596. $globals.SequenceableCollection);
  12597. $core.addMethod(
  12598. $core.method({
  12599. selector: "copyFrom:to:",
  12600. protocol: 'copying',
  12601. fn: function (anIndex,anotherIndex){
  12602. var self=this;
  12603. return $core.withContext(function($ctx1) {
  12604. self._subclassResponsibility();
  12605. return self;
  12606. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  12607. },
  12608. args: ["anIndex", "anotherIndex"],
  12609. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  12610. referencedClasses: [],
  12611. messageSends: ["subclassResponsibility"]
  12612. }),
  12613. $globals.SequenceableCollection);
  12614. $core.addMethod(
  12615. $core.method({
  12616. selector: "detect:ifNone:",
  12617. protocol: 'enumerating',
  12618. fn: function (aBlock,anotherBlock){
  12619. var self=this;
  12620. return $core.withContext(function($ctx1) {
  12621. self = self._numericallyIndexable();
  12622. for(var i = 0; i < self.length; i++)
  12623. if(aBlock._value_(self[i]))
  12624. return self[i];
  12625. return anotherBlock._value();
  12626. ;
  12627. return self;
  12628. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  12629. },
  12630. args: ["aBlock", "anotherBlock"],
  12631. 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>",
  12632. referencedClasses: [],
  12633. messageSends: []
  12634. }),
  12635. $globals.SequenceableCollection);
  12636. $core.addMethod(
  12637. $core.method({
  12638. selector: "do:",
  12639. protocol: 'enumerating',
  12640. fn: function (aBlock){
  12641. var self=this;
  12642. return $core.withContext(function($ctx1) {
  12643. self = self._numericallyIndexable();
  12644. for(var i=0; i < self.length; i++) {
  12645. aBlock._value_(self[i]);
  12646. }
  12647. ;
  12648. return self;
  12649. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  12650. },
  12651. args: ["aBlock"],
  12652. 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>",
  12653. referencedClasses: [],
  12654. messageSends: []
  12655. }),
  12656. $globals.SequenceableCollection);
  12657. $core.addMethod(
  12658. $core.method({
  12659. selector: "endsWith:",
  12660. protocol: 'testing',
  12661. fn: function (suffix){
  12662. var self=this;
  12663. return $core.withContext(function($ctx1) {
  12664. var $2,$3,$1;
  12665. $2=self._size();
  12666. $ctx1.sendIdx["size"]=1;
  12667. $3=$recv(suffix)._size();
  12668. $ctx1.sendIdx["size"]=2;
  12669. $1=$recv($2).__lt($3);
  12670. if($core.assert($1)){
  12671. return false;
  12672. };
  12673. return $recv(self._last_($recv(suffix)._size())).__eq(suffix);
  12674. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  12675. },
  12676. args: ["suffix"],
  12677. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  12678. referencedClasses: [],
  12679. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  12680. }),
  12681. $globals.SequenceableCollection);
  12682. $core.addMethod(
  12683. $core.method({
  12684. selector: "first",
  12685. protocol: 'accessing',
  12686. fn: function (){
  12687. var self=this;
  12688. return $core.withContext(function($ctx1) {
  12689. return self._at_((1));
  12690. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  12691. },
  12692. args: [],
  12693. source: "first\x0a\x09^ self at: 1",
  12694. referencedClasses: [],
  12695. messageSends: ["at:"]
  12696. }),
  12697. $globals.SequenceableCollection);
  12698. $core.addMethod(
  12699. $core.method({
  12700. selector: "first:",
  12701. protocol: 'accessing',
  12702. fn: function (aNumber){
  12703. var self=this;
  12704. return $core.withContext(function($ctx1) {
  12705. var $1;
  12706. $1=$recv(self._size()).__lt(aNumber);
  12707. if($core.assert($1)){
  12708. self._error_("Invalid number of elements");
  12709. };
  12710. return self._copyFrom_to_((1),aNumber);
  12711. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  12712. },
  12713. args: ["aNumber"],
  12714. 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",
  12715. referencedClasses: [],
  12716. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  12717. }),
  12718. $globals.SequenceableCollection);
  12719. $core.addMethod(
  12720. $core.method({
  12721. selector: "fourth",
  12722. protocol: 'accessing',
  12723. fn: function (){
  12724. var self=this;
  12725. return $core.withContext(function($ctx1) {
  12726. return self._at_((4));
  12727. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  12728. },
  12729. args: [],
  12730. source: "fourth\x0a\x09^ self at: 4",
  12731. referencedClasses: [],
  12732. messageSends: ["at:"]
  12733. }),
  12734. $globals.SequenceableCollection);
  12735. $core.addMethod(
  12736. $core.method({
  12737. selector: "includes:",
  12738. protocol: 'testing',
  12739. fn: function (anObject){
  12740. var self=this;
  12741. return $core.withContext(function($ctx1) {
  12742. return $recv(self._indexOf_ifAbsent_(anObject,(function(){
  12743. return nil;
  12744. })))._notNil();
  12745. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  12746. },
  12747. args: ["anObject"],
  12748. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  12749. referencedClasses: [],
  12750. messageSends: ["notNil", "indexOf:ifAbsent:"]
  12751. }),
  12752. $globals.SequenceableCollection);
  12753. $core.addMethod(
  12754. $core.method({
  12755. selector: "indexOf:ifAbsent:",
  12756. protocol: 'accessing',
  12757. fn: function (anObject,aBlock){
  12758. var self=this;
  12759. return $core.withContext(function($ctx1) {
  12760. self = self._numericallyIndexable();
  12761. for(var i=0; i < self.length; i++) {
  12762. if($recv(self[i]).__eq(anObject)) {return i+1}
  12763. };
  12764. return aBlock._value();
  12765. ;
  12766. return self;
  12767. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  12768. },
  12769. args: ["anObject", "aBlock"],
  12770. 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>",
  12771. referencedClasses: [],
  12772. messageSends: []
  12773. }),
  12774. $globals.SequenceableCollection);
  12775. $core.addMethod(
  12776. $core.method({
  12777. selector: "indexOf:startingAt:",
  12778. protocol: 'accessing',
  12779. fn: function (anObject,start){
  12780. var self=this;
  12781. return $core.withContext(function($ctx1) {
  12782. return self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  12783. return (0);
  12784. }));
  12785. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  12786. },
  12787. args: ["anObject", "start"],
  12788. 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 ]",
  12789. referencedClasses: [],
  12790. messageSends: ["indexOf:startingAt:ifAbsent:"]
  12791. }),
  12792. $globals.SequenceableCollection);
  12793. $core.addMethod(
  12794. $core.method({
  12795. selector: "indexOf:startingAt:ifAbsent:",
  12796. protocol: 'accessing',
  12797. fn: function (anObject,start,aBlock){
  12798. var self=this;
  12799. return $core.withContext(function($ctx1) {
  12800. self = self._numericallyIndexable();
  12801. for(var i=start - 1; i < self.length; i++){
  12802. if($recv(self[i]).__eq(anObject)) {return i+1}
  12803. }
  12804. return aBlock._value();
  12805. ;
  12806. return self;
  12807. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  12808. },
  12809. args: ["anObject", "start", "aBlock"],
  12810. 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>",
  12811. referencedClasses: [],
  12812. messageSends: []
  12813. }),
  12814. $globals.SequenceableCollection);
  12815. $core.addMethod(
  12816. $core.method({
  12817. selector: "last",
  12818. protocol: 'accessing',
  12819. fn: function (){
  12820. var self=this;
  12821. return $core.withContext(function($ctx1) {
  12822. return self._at_(self._size());
  12823. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  12824. },
  12825. args: [],
  12826. source: "last\x0a\x09^ self at: self size",
  12827. referencedClasses: [],
  12828. messageSends: ["at:", "size"]
  12829. }),
  12830. $globals.SequenceableCollection);
  12831. $core.addMethod(
  12832. $core.method({
  12833. selector: "last:",
  12834. protocol: 'accessing',
  12835. fn: function (aNumber){
  12836. var self=this;
  12837. return $core.withContext(function($ctx1) {
  12838. var $2,$1,$5,$4,$3;
  12839. $2=self._size();
  12840. $ctx1.sendIdx["size"]=1;
  12841. $1=$recv($2).__lt(aNumber);
  12842. if($core.assert($1)){
  12843. self._error_("Invalid number of elements");
  12844. };
  12845. $5=self._size();
  12846. $ctx1.sendIdx["size"]=2;
  12847. $4=$recv($5).__minus(aNumber);
  12848. $3=$recv($4).__plus((1));
  12849. return self._copyFrom_to_($3,self._size());
  12850. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  12851. },
  12852. args: ["aNumber"],
  12853. 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",
  12854. referencedClasses: [],
  12855. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  12856. }),
  12857. $globals.SequenceableCollection);
  12858. $core.addMethod(
  12859. $core.method({
  12860. selector: "newStream",
  12861. protocol: 'streaming',
  12862. fn: function (){
  12863. var self=this;
  12864. return $core.withContext(function($ctx1) {
  12865. return $recv(self._streamClass())._on_(self);
  12866. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  12867. },
  12868. args: [],
  12869. source: "newStream\x0a\x09^ self streamClass on: self",
  12870. referencedClasses: [],
  12871. messageSends: ["on:", "streamClass"]
  12872. }),
  12873. $globals.SequenceableCollection);
  12874. $core.addMethod(
  12875. $core.method({
  12876. selector: "numericallyIndexable",
  12877. protocol: 'private',
  12878. fn: function (){
  12879. var self=this;
  12880. return $core.withContext(function($ctx1) {
  12881. self._subclassResponsibility();
  12882. return self;
  12883. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  12884. },
  12885. args: [],
  12886. 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",
  12887. referencedClasses: [],
  12888. messageSends: ["subclassResponsibility"]
  12889. }),
  12890. $globals.SequenceableCollection);
  12891. $core.addMethod(
  12892. $core.method({
  12893. selector: "readStream",
  12894. protocol: 'streaming',
  12895. fn: function (){
  12896. var self=this;
  12897. return $core.withContext(function($ctx1) {
  12898. return self._stream();
  12899. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  12900. },
  12901. args: [],
  12902. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  12903. referencedClasses: [],
  12904. messageSends: ["stream"]
  12905. }),
  12906. $globals.SequenceableCollection);
  12907. $core.addMethod(
  12908. $core.method({
  12909. selector: "removeLast",
  12910. protocol: 'adding/removing',
  12911. fn: function (){
  12912. var self=this;
  12913. return $core.withContext(function($ctx1) {
  12914. return self._remove_(self._last());
  12915. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  12916. },
  12917. args: [],
  12918. source: "removeLast\x0a\x09^ self remove: self last",
  12919. referencedClasses: [],
  12920. messageSends: ["remove:", "last"]
  12921. }),
  12922. $globals.SequenceableCollection);
  12923. $core.addMethod(
  12924. $core.method({
  12925. selector: "reversed",
  12926. protocol: 'converting',
  12927. fn: function (){
  12928. var self=this;
  12929. return $core.withContext(function($ctx1) {
  12930. self._subclassResponsibility();
  12931. return self;
  12932. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  12933. },
  12934. args: [],
  12935. source: "reversed\x0a\x09self subclassResponsibility",
  12936. referencedClasses: [],
  12937. messageSends: ["subclassResponsibility"]
  12938. }),
  12939. $globals.SequenceableCollection);
  12940. $core.addMethod(
  12941. $core.method({
  12942. selector: "second",
  12943. protocol: 'accessing',
  12944. fn: function (){
  12945. var self=this;
  12946. return $core.withContext(function($ctx1) {
  12947. return self._at_((2));
  12948. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  12949. },
  12950. args: [],
  12951. source: "second\x0a\x09^ self at: 2",
  12952. referencedClasses: [],
  12953. messageSends: ["at:"]
  12954. }),
  12955. $globals.SequenceableCollection);
  12956. $core.addMethod(
  12957. $core.method({
  12958. selector: "stream",
  12959. protocol: 'streaming',
  12960. fn: function (){
  12961. var self=this;
  12962. return $core.withContext(function($ctx1) {
  12963. return self._newStream();
  12964. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  12965. },
  12966. args: [],
  12967. source: "stream\x0a\x09^ self newStream",
  12968. referencedClasses: [],
  12969. messageSends: ["newStream"]
  12970. }),
  12971. $globals.SequenceableCollection);
  12972. $core.addMethod(
  12973. $core.method({
  12974. selector: "streamClass",
  12975. protocol: 'streaming',
  12976. fn: function (){
  12977. var self=this;
  12978. return $core.withContext(function($ctx1) {
  12979. return $recv(self._class())._streamClass();
  12980. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  12981. },
  12982. args: [],
  12983. source: "streamClass\x0a\x09^ self class streamClass",
  12984. referencedClasses: [],
  12985. messageSends: ["streamClass", "class"]
  12986. }),
  12987. $globals.SequenceableCollection);
  12988. $core.addMethod(
  12989. $core.method({
  12990. selector: "third",
  12991. protocol: 'accessing',
  12992. fn: function (){
  12993. var self=this;
  12994. return $core.withContext(function($ctx1) {
  12995. return self._at_((3));
  12996. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  12997. },
  12998. args: [],
  12999. source: "third\x0a\x09^ self at: 3",
  13000. referencedClasses: [],
  13001. messageSends: ["at:"]
  13002. }),
  13003. $globals.SequenceableCollection);
  13004. $core.addMethod(
  13005. $core.method({
  13006. selector: "with:do:",
  13007. protocol: 'enumerating',
  13008. fn: function (anotherCollection,aBlock){
  13009. var self=this;
  13010. return $core.withContext(function($ctx1) {
  13011. self = self._numericallyIndexable();
  13012. anotherCollection = anotherCollection._numericallyIndexable();
  13013. for(var i=0; i<self.length; i++) {
  13014. aBlock._value_value_(self[i], anotherCollection[i]);
  13015. }
  13016. ;
  13017. return self;
  13018. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  13019. },
  13020. args: ["anotherCollection", "aBlock"],
  13021. 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>",
  13022. referencedClasses: [],
  13023. messageSends: []
  13024. }),
  13025. $globals.SequenceableCollection);
  13026. $core.addMethod(
  13027. $core.method({
  13028. selector: "withIndexDo:",
  13029. protocol: 'enumerating',
  13030. fn: function (aBlock){
  13031. var self=this;
  13032. return $core.withContext(function($ctx1) {
  13033. self = self._numericallyIndexable();
  13034. for(var i=0; i < self.length; i++) {
  13035. aBlock._value_value_(self[i], i+1);
  13036. }
  13037. ;
  13038. return self;
  13039. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  13040. },
  13041. args: ["aBlock"],
  13042. 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>",
  13043. referencedClasses: [],
  13044. messageSends: []
  13045. }),
  13046. $globals.SequenceableCollection);
  13047. $core.addMethod(
  13048. $core.method({
  13049. selector: "writeStream",
  13050. protocol: 'streaming',
  13051. fn: function (){
  13052. var self=this;
  13053. return $core.withContext(function($ctx1) {
  13054. return self._stream();
  13055. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  13056. },
  13057. args: [],
  13058. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  13059. referencedClasses: [],
  13060. messageSends: ["stream"]
  13061. }),
  13062. $globals.SequenceableCollection);
  13063. $core.addMethod(
  13064. $core.method({
  13065. selector: "streamClass",
  13066. protocol: 'accessing',
  13067. fn: function (){
  13068. var self=this;
  13069. function $Stream(){return $globals.Stream||(typeof Stream=="undefined"?nil:Stream)}
  13070. return $Stream();
  13071. },
  13072. args: [],
  13073. source: "streamClass\x0a\x09\x09^ Stream",
  13074. referencedClasses: ["Stream"],
  13075. messageSends: []
  13076. }),
  13077. $globals.SequenceableCollection.klass);
  13078. $core.addMethod(
  13079. $core.method({
  13080. selector: "streamContents:",
  13081. protocol: 'streaming',
  13082. fn: function (aBlock){
  13083. var self=this;
  13084. var stream;
  13085. return $core.withContext(function($ctx1) {
  13086. stream=$recv(self._streamClass())._on_(self._new());
  13087. $recv(aBlock)._value_(stream);
  13088. return $recv(stream)._contents();
  13089. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.klass)});
  13090. },
  13091. args: ["aBlock"],
  13092. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  13093. referencedClasses: [],
  13094. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  13095. }),
  13096. $globals.SequenceableCollection.klass);
  13097. $core.addClass('Array', $globals.SequenceableCollection, [], 'Kernel-Collections');
  13098. $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`.";
  13099. $core.addMethod(
  13100. $core.method({
  13101. selector: "add:",
  13102. protocol: 'adding/removing',
  13103. fn: function (anObject){
  13104. var self=this;
  13105. return $core.withContext(function($ctx1) {
  13106. self.push(anObject); return anObject;;
  13107. return self;
  13108. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  13109. },
  13110. args: ["anObject"],
  13111. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  13112. referencedClasses: [],
  13113. messageSends: []
  13114. }),
  13115. $globals.Array);
  13116. $core.addMethod(
  13117. $core.method({
  13118. selector: "addAll:",
  13119. protocol: 'adding/removing',
  13120. fn: function (aCollection){
  13121. var self=this;
  13122. return $core.withContext(function($ctx1) {
  13123. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  13124. else $globals.Array.superclass.fn.prototype._addAll_.call(self, aCollection);
  13125. return aCollection;;
  13126. return self;
  13127. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  13128. },
  13129. args: ["aCollection"],
  13130. source: "addAll: aCollection\x0a<\x0a\x09if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);\x0a\x09else $globals.Array.superclass.fn.prototype._addAll_.call(self, aCollection);\x0a\x09return aCollection;\x0a>",
  13131. referencedClasses: [],
  13132. messageSends: []
  13133. }),
  13134. $globals.Array);
  13135. $core.addMethod(
  13136. $core.method({
  13137. selector: "addFirst:",
  13138. protocol: 'adding/removing',
  13139. fn: function (anObject){
  13140. var self=this;
  13141. return $core.withContext(function($ctx1) {
  13142. self.unshift(anObject); return anObject;;
  13143. return self;
  13144. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  13145. },
  13146. args: ["anObject"],
  13147. source: "addFirst: anObject\x0a\x09<self.unshift(anObject); return anObject;>",
  13148. referencedClasses: [],
  13149. messageSends: []
  13150. }),
  13151. $globals.Array);
  13152. $core.addMethod(
  13153. $core.method({
  13154. selector: "asJavascript",
  13155. protocol: 'converting',
  13156. fn: function (){
  13157. var self=this;
  13158. return $core.withContext(function($ctx1) {
  13159. var $1;
  13160. $1=$recv("[".__comma($recv(self._collect_((function(each){
  13161. return $core.withContext(function($ctx2) {
  13162. return $recv(each)._asJavascript();
  13163. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13164. })))._join_(", "))).__comma("]");
  13165. $ctx1.sendIdx[","]=1;
  13166. return $1;
  13167. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Array)});
  13168. },
  13169. args: [],
  13170. source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'",
  13171. referencedClasses: [],
  13172. messageSends: [",", "join:", "collect:", "asJavascript"]
  13173. }),
  13174. $globals.Array);
  13175. $core.addMethod(
  13176. $core.method({
  13177. selector: "at:ifAbsent:",
  13178. protocol: 'accessing',
  13179. fn: function (anIndex,aBlock){
  13180. var self=this;
  13181. return $core.withContext(function($ctx1) {
  13182. return anIndex >= 1 && anIndex <= self.length
  13183. ? self[anIndex - 1]
  13184. : aBlock._value()
  13185. ;
  13186. return self;
  13187. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  13188. },
  13189. args: ["anIndex", "aBlock"],
  13190. 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>",
  13191. referencedClasses: [],
  13192. messageSends: []
  13193. }),
  13194. $globals.Array);
  13195. $core.addMethod(
  13196. $core.method({
  13197. selector: "at:ifPresent:ifAbsent:",
  13198. protocol: 'accessing',
  13199. fn: function (anIndex,aBlock,anotherBlock){
  13200. var self=this;
  13201. return $core.withContext(function($ctx1) {
  13202. return anIndex >= 1 && anIndex <= self.length
  13203. ? aBlock._value_(self[anIndex - 1])
  13204. : anotherBlock._value()
  13205. ;
  13206. return self;
  13207. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  13208. },
  13209. args: ["anIndex", "aBlock", "anotherBlock"],
  13210. 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>",
  13211. referencedClasses: [],
  13212. messageSends: []
  13213. }),
  13214. $globals.Array);
  13215. $core.addMethod(
  13216. $core.method({
  13217. selector: "at:put:",
  13218. protocol: 'accessing',
  13219. fn: function (anIndex,anObject){
  13220. var self=this;
  13221. return $core.withContext(function($ctx1) {
  13222. return self[anIndex - 1] = anObject;
  13223. return self;
  13224. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  13225. },
  13226. args: ["anIndex", "anObject"],
  13227. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  13228. referencedClasses: [],
  13229. messageSends: []
  13230. }),
  13231. $globals.Array);
  13232. $core.addMethod(
  13233. $core.method({
  13234. selector: "collect:",
  13235. protocol: 'enumerating',
  13236. fn: function (aBlock){
  13237. var self=this;
  13238. return $core.withContext(function($ctx1) {
  13239. return self.map(function(each) {return aBlock._value_(each)});
  13240. return self;
  13241. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  13242. },
  13243. args: ["aBlock"],
  13244. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.map(function(each) {return aBlock._value_(each)})>",
  13245. referencedClasses: [],
  13246. messageSends: []
  13247. }),
  13248. $globals.Array);
  13249. $core.addMethod(
  13250. $core.method({
  13251. selector: "copyFrom:to:",
  13252. protocol: 'copying',
  13253. fn: function (anIndex,anotherIndex){
  13254. var self=this;
  13255. return $core.withContext(function($ctx1) {
  13256. if (anIndex >= 1 && anotherIndex <= self.length) {
  13257. return self.slice(anIndex - 1, anotherIndex);
  13258. } else {
  13259. self._at_(anIndex);
  13260. self._at_(self.length + 1);
  13261. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  13262. };
  13263. return self;
  13264. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  13265. },
  13266. args: ["anIndex", "anotherIndex"],
  13267. source: "copyFrom: anIndex to: anotherIndex\x0a<\x0a\x09if (anIndex >>= 1 && anotherIndex <= self.length) {\x0a\x09\x09return self.slice(anIndex - 1, anotherIndex);\x0a\x09} else {\x0a\x09\x09self._at_(anIndex);\x0a\x09\x09self._at_(self.length + 1);\x0a\x09\x09throw new Error(\x22Incorrect indexes in #copyFrom:to: not caught by #at:\x22);\x0a\x09}\x0a>",
  13268. referencedClasses: [],
  13269. messageSends: []
  13270. }),
  13271. $globals.Array);
  13272. $core.addMethod(
  13273. $core.method({
  13274. selector: "join:",
  13275. protocol: 'enumerating',
  13276. fn: function (aString){
  13277. var self=this;
  13278. return $core.withContext(function($ctx1) {
  13279. return self.join(aString);
  13280. return self;
  13281. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  13282. },
  13283. args: ["aString"],
  13284. source: "join: aString\x0a\x09<return self.join(aString)>",
  13285. referencedClasses: [],
  13286. messageSends: []
  13287. }),
  13288. $globals.Array);
  13289. $core.addMethod(
  13290. $core.method({
  13291. selector: "numericallyIndexable",
  13292. protocol: 'private',
  13293. fn: function (){
  13294. var self=this;
  13295. return self;
  13296. },
  13297. args: [],
  13298. source: "numericallyIndexable\x0a\x09^ self",
  13299. referencedClasses: [],
  13300. messageSends: []
  13301. }),
  13302. $globals.Array);
  13303. $core.addMethod(
  13304. $core.method({
  13305. selector: "printOn:",
  13306. protocol: 'printing',
  13307. fn: function (aStream){
  13308. var self=this;
  13309. return $core.withContext(function($ctx1) {
  13310. (
  13311. $ctx1.supercall = true,
  13312. ($globals.Array.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  13313. $ctx1.supercall = false;
  13314. $ctx1.sendIdx["printOn:"]=1;
  13315. $recv(aStream)._nextPutAll_(" (");
  13316. $ctx1.sendIdx["nextPutAll:"]=1;
  13317. self._do_separatedBy_((function(each){
  13318. return $core.withContext(function($ctx2) {
  13319. return $recv(each)._printOn_(aStream);
  13320. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13321. }),(function(){
  13322. return $core.withContext(function($ctx2) {
  13323. return $recv(aStream)._nextPutAll_(" ");
  13324. $ctx2.sendIdx["nextPutAll:"]=2;
  13325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13326. }));
  13327. $recv(aStream)._nextPutAll_(")");
  13328. return self;
  13329. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  13330. },
  13331. args: ["aStream"],
  13332. 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: ')'",
  13333. referencedClasses: [],
  13334. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  13335. }),
  13336. $globals.Array);
  13337. $core.addMethod(
  13338. $core.method({
  13339. selector: "remove:ifAbsent:",
  13340. protocol: 'adding/removing',
  13341. fn: function (anObject,aBlock){
  13342. var self=this;
  13343. var index;
  13344. return $core.withContext(function($ctx1) {
  13345. var $1;
  13346. index=self._indexOf_ifAbsent_(anObject,(function(){
  13347. return (0);
  13348. }));
  13349. $1=$recv(index).__eq((0));
  13350. if($core.assert($1)){
  13351. return $recv(aBlock)._value();
  13352. } else {
  13353. self._removeIndex_(index);
  13354. return anObject;
  13355. };
  13356. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  13357. },
  13358. args: ["anObject", "aBlock"],
  13359. 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 ]",
  13360. referencedClasses: [],
  13361. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  13362. }),
  13363. $globals.Array);
  13364. $core.addMethod(
  13365. $core.method({
  13366. selector: "removeAll",
  13367. protocol: 'adding/removing',
  13368. fn: function (){
  13369. var self=this;
  13370. return $core.withContext(function($ctx1) {
  13371. self.length = 0;
  13372. return self;
  13373. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  13374. },
  13375. args: [],
  13376. source: "removeAll\x0a\x09<self.length = 0>",
  13377. referencedClasses: [],
  13378. messageSends: []
  13379. }),
  13380. $globals.Array);
  13381. $core.addMethod(
  13382. $core.method({
  13383. selector: "removeFrom:to:",
  13384. protocol: 'adding/removing',
  13385. fn: function (aNumber,anotherNumber){
  13386. var self=this;
  13387. return $core.withContext(function($ctx1) {
  13388. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  13389. return self;
  13390. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  13391. },
  13392. args: ["aNumber", "anotherNumber"],
  13393. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber -1, anotherNumber - aNumber + 1)>",
  13394. referencedClasses: [],
  13395. messageSends: []
  13396. }),
  13397. $globals.Array);
  13398. $core.addMethod(
  13399. $core.method({
  13400. selector: "removeIndex:",
  13401. protocol: 'adding/removing',
  13402. fn: function (anInteger){
  13403. var self=this;
  13404. return $core.withContext(function($ctx1) {
  13405. self.splice(anInteger - 1, 1);
  13406. return self;
  13407. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  13408. },
  13409. args: ["anInteger"],
  13410. source: "removeIndex: anInteger\x0a\x09<self.splice(anInteger - 1, 1)>",
  13411. referencedClasses: [],
  13412. messageSends: []
  13413. }),
  13414. $globals.Array);
  13415. $core.addMethod(
  13416. $core.method({
  13417. selector: "removeLast",
  13418. protocol: 'adding/removing',
  13419. fn: function (){
  13420. var self=this;
  13421. return $core.withContext(function($ctx1) {
  13422. return self.pop();;
  13423. return self;
  13424. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  13425. },
  13426. args: [],
  13427. source: "removeLast\x0a\x09<return self.pop();>",
  13428. referencedClasses: [],
  13429. messageSends: []
  13430. }),
  13431. $globals.Array);
  13432. $core.addMethod(
  13433. $core.method({
  13434. selector: "reversed",
  13435. protocol: 'converting',
  13436. fn: function (){
  13437. var self=this;
  13438. return $core.withContext(function($ctx1) {
  13439. return self.slice().reverse();
  13440. return self;
  13441. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  13442. },
  13443. args: [],
  13444. source: "reversed\x0a\x09<return self.slice().reverse()>",
  13445. referencedClasses: [],
  13446. messageSends: []
  13447. }),
  13448. $globals.Array);
  13449. $core.addMethod(
  13450. $core.method({
  13451. selector: "select:",
  13452. protocol: 'enumerating',
  13453. fn: function (aBlock){
  13454. var self=this;
  13455. return $core.withContext(function($ctx1) {
  13456. return self.filter(function(each) {return aBlock._value_(each)});
  13457. return self;
  13458. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  13459. },
  13460. args: ["aBlock"],
  13461. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.filter(function(each) {return aBlock._value_(each)})>",
  13462. referencedClasses: [],
  13463. messageSends: []
  13464. }),
  13465. $globals.Array);
  13466. $core.addMethod(
  13467. $core.method({
  13468. selector: "shallowCopy",
  13469. protocol: 'copying',
  13470. fn: function (){
  13471. var self=this;
  13472. return $core.withContext(function($ctx1) {
  13473. return self.slice();
  13474. return self;
  13475. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  13476. },
  13477. args: [],
  13478. source: "shallowCopy\x0a\x09<return self.slice()>",
  13479. referencedClasses: [],
  13480. messageSends: []
  13481. }),
  13482. $globals.Array);
  13483. $core.addMethod(
  13484. $core.method({
  13485. selector: "size",
  13486. protocol: 'accessing',
  13487. fn: function (){
  13488. var self=this;
  13489. return $core.withContext(function($ctx1) {
  13490. return self.length;
  13491. return self;
  13492. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  13493. },
  13494. args: [],
  13495. source: "size\x0a\x09<return self.length>",
  13496. referencedClasses: [],
  13497. messageSends: []
  13498. }),
  13499. $globals.Array);
  13500. $core.addMethod(
  13501. $core.method({
  13502. selector: "sort",
  13503. protocol: 'enumerating',
  13504. fn: function (){
  13505. var self=this;
  13506. return $core.withContext(function($ctx1) {
  13507. return self._sort_((function(a,b){
  13508. return $core.withContext(function($ctx2) {
  13509. return $recv(a).__lt(b);
  13510. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  13511. }));
  13512. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  13513. },
  13514. args: [],
  13515. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  13516. referencedClasses: [],
  13517. messageSends: ["sort:", "<"]
  13518. }),
  13519. $globals.Array);
  13520. $core.addMethod(
  13521. $core.method({
  13522. selector: "sort:",
  13523. protocol: 'enumerating',
  13524. fn: function (aBlock){
  13525. var self=this;
  13526. return $core.withContext(function($ctx1) {
  13527. return self.sort(function(a, b) {
  13528. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  13529. })
  13530. ;
  13531. return self;
  13532. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  13533. },
  13534. args: ["aBlock"],
  13535. 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>",
  13536. referencedClasses: [],
  13537. messageSends: []
  13538. }),
  13539. $globals.Array);
  13540. $core.addMethod(
  13541. $core.method({
  13542. selector: "sorted",
  13543. protocol: 'enumerating',
  13544. fn: function (){
  13545. var self=this;
  13546. return $core.withContext(function($ctx1) {
  13547. return $recv(self._copy())._sort();
  13548. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  13549. },
  13550. args: [],
  13551. source: "sorted\x0a\x09^ self copy sort",
  13552. referencedClasses: [],
  13553. messageSends: ["sort", "copy"]
  13554. }),
  13555. $globals.Array);
  13556. $core.addMethod(
  13557. $core.method({
  13558. selector: "sorted:",
  13559. protocol: 'enumerating',
  13560. fn: function (aBlock){
  13561. var self=this;
  13562. return $core.withContext(function($ctx1) {
  13563. return $recv(self._copy())._sort_(aBlock);
  13564. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  13565. },
  13566. args: ["aBlock"],
  13567. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  13568. referencedClasses: [],
  13569. messageSends: ["sort:", "copy"]
  13570. }),
  13571. $globals.Array);
  13572. $core.addMethod(
  13573. $core.method({
  13574. selector: "new:",
  13575. protocol: 'instance creation',
  13576. fn: function (anInteger){
  13577. var self=this;
  13578. return $core.withContext(function($ctx1) {
  13579. return new Array(anInteger);
  13580. return self;
  13581. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.klass)});
  13582. },
  13583. args: ["anInteger"],
  13584. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  13585. referencedClasses: [],
  13586. messageSends: []
  13587. }),
  13588. $globals.Array.klass);
  13589. $core.addMethod(
  13590. $core.method({
  13591. selector: "with:",
  13592. protocol: 'instance creation',
  13593. fn: function (anObject){
  13594. var self=this;
  13595. return $core.withContext(function($ctx1) {
  13596. var $1;
  13597. $1=self._new_((1));
  13598. $recv($1)._at_put_((1),anObject);
  13599. return $recv($1)._yourself();
  13600. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.klass)});
  13601. },
  13602. args: ["anObject"],
  13603. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  13604. referencedClasses: [],
  13605. messageSends: ["at:put:", "new:", "yourself"]
  13606. }),
  13607. $globals.Array.klass);
  13608. $core.addMethod(
  13609. $core.method({
  13610. selector: "with:with:",
  13611. protocol: 'instance creation',
  13612. fn: function (anObject,anObject2){
  13613. var self=this;
  13614. return $core.withContext(function($ctx1) {
  13615. var $1;
  13616. $1=self._new_((2));
  13617. $recv($1)._at_put_((1),anObject);
  13618. $ctx1.sendIdx["at:put:"]=1;
  13619. $recv($1)._at_put_((2),anObject2);
  13620. return $recv($1)._yourself();
  13621. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.klass)});
  13622. },
  13623. args: ["anObject", "anObject2"],
  13624. 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",
  13625. referencedClasses: [],
  13626. messageSends: ["at:put:", "new:", "yourself"]
  13627. }),
  13628. $globals.Array.klass);
  13629. $core.addMethod(
  13630. $core.method({
  13631. selector: "with:with:with:",
  13632. protocol: 'instance creation',
  13633. fn: function (anObject,anObject2,anObject3){
  13634. var self=this;
  13635. return $core.withContext(function($ctx1) {
  13636. var $1;
  13637. $1=self._new_((3));
  13638. $recv($1)._at_put_((1),anObject);
  13639. $ctx1.sendIdx["at:put:"]=1;
  13640. $recv($1)._at_put_((2),anObject2);
  13641. $ctx1.sendIdx["at:put:"]=2;
  13642. $recv($1)._at_put_((3),anObject3);
  13643. return $recv($1)._yourself();
  13644. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.klass)});
  13645. },
  13646. args: ["anObject", "anObject2", "anObject3"],
  13647. 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",
  13648. referencedClasses: [],
  13649. messageSends: ["at:put:", "new:", "yourself"]
  13650. }),
  13651. $globals.Array.klass);
  13652. $core.addMethod(
  13653. $core.method({
  13654. selector: "withAll:",
  13655. protocol: 'instance creation',
  13656. fn: function (aCollection){
  13657. var self=this;
  13658. var instance,index;
  13659. return $core.withContext(function($ctx1) {
  13660. index=(1);
  13661. instance=self._new_($recv(aCollection)._size());
  13662. $recv(aCollection)._do_((function(each){
  13663. return $core.withContext(function($ctx2) {
  13664. $recv(instance)._at_put_(index,each);
  13665. index=$recv(index).__plus((1));
  13666. return index;
  13667. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13668. }));
  13669. return instance;
  13670. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.klass)});
  13671. },
  13672. args: ["aCollection"],
  13673. 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",
  13674. referencedClasses: [],
  13675. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  13676. }),
  13677. $globals.Array.klass);
  13678. $core.addClass('CharacterArray', $globals.SequenceableCollection, [], 'Kernel-Collections');
  13679. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  13680. $core.addMethod(
  13681. $core.method({
  13682. selector: ",",
  13683. protocol: 'copying',
  13684. fn: function (aString){
  13685. var self=this;
  13686. return $core.withContext(function($ctx1) {
  13687. var $1;
  13688. $1=self._asString();
  13689. $ctx1.sendIdx["asString"]=1;
  13690. return $recv($1).__comma($recv(aString)._asString());
  13691. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  13692. },
  13693. args: ["aString"],
  13694. source: ", aString\x0a\x09^ self asString, aString asString",
  13695. referencedClasses: [],
  13696. messageSends: [",", "asString"]
  13697. }),
  13698. $globals.CharacterArray);
  13699. $core.addMethod(
  13700. $core.method({
  13701. selector: "add:",
  13702. protocol: 'adding/removing',
  13703. fn: function (anObject){
  13704. var self=this;
  13705. return $core.withContext(function($ctx1) {
  13706. self._errorReadOnly();
  13707. return self;
  13708. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  13709. },
  13710. args: ["anObject"],
  13711. source: "add: anObject\x0a\x09self errorReadOnly",
  13712. referencedClasses: [],
  13713. messageSends: ["errorReadOnly"]
  13714. }),
  13715. $globals.CharacterArray);
  13716. $core.addMethod(
  13717. $core.method({
  13718. selector: "asLowercase",
  13719. protocol: 'converting',
  13720. fn: function (){
  13721. var self=this;
  13722. return $core.withContext(function($ctx1) {
  13723. return $recv(self._class())._fromString_($recv(self._asString())._asLowercase());
  13724. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  13725. },
  13726. args: [],
  13727. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  13728. referencedClasses: [],
  13729. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  13730. }),
  13731. $globals.CharacterArray);
  13732. $core.addMethod(
  13733. $core.method({
  13734. selector: "asNumber",
  13735. protocol: 'converting',
  13736. fn: function (){
  13737. var self=this;
  13738. return $core.withContext(function($ctx1) {
  13739. return $recv(self._asString())._asNumber();
  13740. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  13741. },
  13742. args: [],
  13743. source: "asNumber\x0a\x09^ self asString asNumber",
  13744. referencedClasses: [],
  13745. messageSends: ["asNumber", "asString"]
  13746. }),
  13747. $globals.CharacterArray);
  13748. $core.addMethod(
  13749. $core.method({
  13750. selector: "asString",
  13751. protocol: 'converting',
  13752. fn: function (){
  13753. var self=this;
  13754. return $core.withContext(function($ctx1) {
  13755. return self._subclassResponsibility();
  13756. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  13757. },
  13758. args: [],
  13759. source: "asString\x0a\x09^ self subclassResponsibility",
  13760. referencedClasses: [],
  13761. messageSends: ["subclassResponsibility"]
  13762. }),
  13763. $globals.CharacterArray);
  13764. $core.addMethod(
  13765. $core.method({
  13766. selector: "asSymbol",
  13767. protocol: 'converting',
  13768. fn: function (){
  13769. var self=this;
  13770. return $core.withContext(function($ctx1) {
  13771. return self._asString();
  13772. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  13773. },
  13774. args: [],
  13775. source: "asSymbol\x0a\x09^ self asString",
  13776. referencedClasses: [],
  13777. messageSends: ["asString"]
  13778. }),
  13779. $globals.CharacterArray);
  13780. $core.addMethod(
  13781. $core.method({
  13782. selector: "asUppercase",
  13783. protocol: 'converting',
  13784. fn: function (){
  13785. var self=this;
  13786. return $core.withContext(function($ctx1) {
  13787. return $recv(self._class())._fromString_($recv(self._asString())._asUppercase());
  13788. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  13789. },
  13790. args: [],
  13791. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  13792. referencedClasses: [],
  13793. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  13794. }),
  13795. $globals.CharacterArray);
  13796. $core.addMethod(
  13797. $core.method({
  13798. selector: "at:put:",
  13799. protocol: 'accessing',
  13800. fn: function (anIndex,anObject){
  13801. var self=this;
  13802. return $core.withContext(function($ctx1) {
  13803. self._errorReadOnly();
  13804. return self;
  13805. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  13806. },
  13807. args: ["anIndex", "anObject"],
  13808. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  13809. referencedClasses: [],
  13810. messageSends: ["errorReadOnly"]
  13811. }),
  13812. $globals.CharacterArray);
  13813. $core.addMethod(
  13814. $core.method({
  13815. selector: "errorReadOnly",
  13816. protocol: 'error handling',
  13817. fn: function (){
  13818. var self=this;
  13819. return $core.withContext(function($ctx1) {
  13820. self._error_("Object is read-only");
  13821. return self;
  13822. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  13823. },
  13824. args: [],
  13825. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  13826. referencedClasses: [],
  13827. messageSends: ["error:"]
  13828. }),
  13829. $globals.CharacterArray);
  13830. $core.addMethod(
  13831. $core.method({
  13832. selector: "printOn:",
  13833. protocol: 'printing',
  13834. fn: function (aStream){
  13835. var self=this;
  13836. return $core.withContext(function($ctx1) {
  13837. $recv(self._asString())._printOn_(aStream);
  13838. return self;
  13839. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  13840. },
  13841. args: ["aStream"],
  13842. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  13843. referencedClasses: [],
  13844. messageSends: ["printOn:", "asString"]
  13845. }),
  13846. $globals.CharacterArray);
  13847. $core.addMethod(
  13848. $core.method({
  13849. selector: "putOn:",
  13850. protocol: 'streaming',
  13851. fn: function (aStream){
  13852. var self=this;
  13853. return $core.withContext(function($ctx1) {
  13854. $recv(aStream)._nextPutString_(self);
  13855. return self;
  13856. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  13857. },
  13858. args: ["aStream"],
  13859. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  13860. referencedClasses: [],
  13861. messageSends: ["nextPutString:"]
  13862. }),
  13863. $globals.CharacterArray);
  13864. $core.addMethod(
  13865. $core.method({
  13866. selector: "remove:",
  13867. protocol: 'adding/removing',
  13868. fn: function (anObject){
  13869. var self=this;
  13870. return $core.withContext(function($ctx1) {
  13871. self._errorReadOnly();
  13872. return self;
  13873. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  13874. },
  13875. args: ["anObject"],
  13876. source: "remove: anObject\x0a\x09self errorReadOnly",
  13877. referencedClasses: [],
  13878. messageSends: ["errorReadOnly"]
  13879. }),
  13880. $globals.CharacterArray);
  13881. $core.addMethod(
  13882. $core.method({
  13883. selector: "fromString:",
  13884. protocol: 'instance creation',
  13885. fn: function (aString){
  13886. var self=this;
  13887. return $core.withContext(function($ctx1) {
  13888. self._subclassResponsibility();
  13889. return self;
  13890. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.klass)});
  13891. },
  13892. args: ["aString"],
  13893. source: "fromString: aString\x0a\x09self subclassResponsibility",
  13894. referencedClasses: [],
  13895. messageSends: ["subclassResponsibility"]
  13896. }),
  13897. $globals.CharacterArray.klass);
  13898. $core.addClass('String', $globals.CharacterArray, [], 'Kernel-Collections');
  13899. $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 >> #,`";
  13900. $core.addMethod(
  13901. $core.method({
  13902. selector: ",",
  13903. protocol: 'copying',
  13904. fn: function (aString){
  13905. var self=this;
  13906. return $core.withContext(function($ctx1) {
  13907. return String(self) + aString;
  13908. return self;
  13909. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  13910. },
  13911. args: ["aString"],
  13912. source: ", aString\x0a\x09<return String(self) + aString>",
  13913. referencedClasses: [],
  13914. messageSends: []
  13915. }),
  13916. $globals.String);
  13917. $core.addMethod(
  13918. $core.method({
  13919. selector: "<",
  13920. protocol: 'comparing',
  13921. fn: function (aString){
  13922. var self=this;
  13923. return $core.withContext(function($ctx1) {
  13924. return String(self) < aString._asString();
  13925. return self;
  13926. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  13927. },
  13928. args: ["aString"],
  13929. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  13930. referencedClasses: [],
  13931. messageSends: []
  13932. }),
  13933. $globals.String);
  13934. $core.addMethod(
  13935. $core.method({
  13936. selector: "<=",
  13937. protocol: 'comparing',
  13938. fn: function (aString){
  13939. var self=this;
  13940. return $core.withContext(function($ctx1) {
  13941. return String(self) <= aString._asString();
  13942. return self;
  13943. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  13944. },
  13945. args: ["aString"],
  13946. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  13947. referencedClasses: [],
  13948. messageSends: []
  13949. }),
  13950. $globals.String);
  13951. $core.addMethod(
  13952. $core.method({
  13953. selector: "=",
  13954. protocol: 'comparing',
  13955. fn: function (aString){
  13956. var self=this;
  13957. return $core.withContext(function($ctx1) {
  13958. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  13959. return self;
  13960. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  13961. },
  13962. args: ["aString"],
  13963. source: "= aString\x0a<return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())>",
  13964. referencedClasses: [],
  13965. messageSends: []
  13966. }),
  13967. $globals.String);
  13968. $core.addMethod(
  13969. $core.method({
  13970. selector: "==",
  13971. protocol: 'comparing',
  13972. fn: function (aString){
  13973. var self=this;
  13974. return $core.withContext(function($ctx1) {
  13975. if (typeof aString === "string") return String(self) === aString;
  13976. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  13977. else return false;;
  13978. return self;
  13979. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  13980. },
  13981. args: ["aString"],
  13982. source: "== aString\x0a<\x0a\x09if (typeof aString === \x22string\x22) return String(self) === aString;\x0a\x09else if (aString != null && typeof aString === \x22object\x22) return String(self) === aString.valueOf();\x0a\x09else return false;\x0a>",
  13983. referencedClasses: [],
  13984. messageSends: []
  13985. }),
  13986. $globals.String);
  13987. $core.addMethod(
  13988. $core.method({
  13989. selector: ">",
  13990. protocol: 'comparing',
  13991. fn: function (aString){
  13992. var self=this;
  13993. return $core.withContext(function($ctx1) {
  13994. return String(self) > aString._asString();
  13995. return self;
  13996. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  13997. },
  13998. args: ["aString"],
  13999. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  14000. referencedClasses: [],
  14001. messageSends: []
  14002. }),
  14003. $globals.String);
  14004. $core.addMethod(
  14005. $core.method({
  14006. selector: ">=",
  14007. protocol: 'comparing',
  14008. fn: function (aString){
  14009. var self=this;
  14010. return $core.withContext(function($ctx1) {
  14011. return String(self) >= aString._asString();
  14012. return self;
  14013. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  14014. },
  14015. args: ["aString"],
  14016. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  14017. referencedClasses: [],
  14018. messageSends: []
  14019. }),
  14020. $globals.String);
  14021. $core.addMethod(
  14022. $core.method({
  14023. selector: "asJSON",
  14024. protocol: 'converting',
  14025. fn: function (){
  14026. var self=this;
  14027. return self;
  14028. },
  14029. args: [],
  14030. source: "asJSON\x0a\x09^ self",
  14031. referencedClasses: [],
  14032. messageSends: []
  14033. }),
  14034. $globals.String);
  14035. $core.addMethod(
  14036. $core.method({
  14037. selector: "asJavaScriptMethodName",
  14038. protocol: 'converting',
  14039. fn: function (){
  14040. var self=this;
  14041. return $core.withContext(function($ctx1) {
  14042. return $core.st2js(self);
  14043. return self;
  14044. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  14045. },
  14046. args: [],
  14047. source: "asJavaScriptMethodName\x0a\x09<return $core.st2js(self)>",
  14048. referencedClasses: [],
  14049. messageSends: []
  14050. }),
  14051. $globals.String);
  14052. $core.addMethod(
  14053. $core.method({
  14054. selector: "asJavascript",
  14055. protocol: 'converting',
  14056. fn: function (){
  14057. var self=this;
  14058. return $core.withContext(function($ctx1) {
  14059. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  14060. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  14061. else
  14062. return "\"" + self + "\"";
  14063. ;
  14064. return self;
  14065. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.String)});
  14066. },
  14067. args: [],
  14068. 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>",
  14069. referencedClasses: [],
  14070. messageSends: []
  14071. }),
  14072. $globals.String);
  14073. $core.addMethod(
  14074. $core.method({
  14075. selector: "asLowercase",
  14076. protocol: 'converting',
  14077. fn: function (){
  14078. var self=this;
  14079. return $core.withContext(function($ctx1) {
  14080. return self.toLowerCase();
  14081. return self;
  14082. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  14083. },
  14084. args: [],
  14085. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  14086. referencedClasses: [],
  14087. messageSends: []
  14088. }),
  14089. $globals.String);
  14090. $core.addMethod(
  14091. $core.method({
  14092. selector: "asMutator",
  14093. protocol: 'converting',
  14094. fn: function (){
  14095. var self=this;
  14096. return $core.withContext(function($ctx1) {
  14097. var $1;
  14098. $1=$recv(self._last()).__eq(":");
  14099. if(!$core.assert($1)){
  14100. return self.__comma(":");
  14101. };
  14102. return self;
  14103. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  14104. },
  14105. args: [],
  14106. 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",
  14107. referencedClasses: [],
  14108. messageSends: ["ifFalse:", "=", "last", ","]
  14109. }),
  14110. $globals.String);
  14111. $core.addMethod(
  14112. $core.method({
  14113. selector: "asNumber",
  14114. protocol: 'converting',
  14115. fn: function (){
  14116. var self=this;
  14117. return $core.withContext(function($ctx1) {
  14118. return Number(self);
  14119. return self;
  14120. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  14121. },
  14122. args: [],
  14123. source: "asNumber\x0a\x09<return Number(self)>",
  14124. referencedClasses: [],
  14125. messageSends: []
  14126. }),
  14127. $globals.String);
  14128. $core.addMethod(
  14129. $core.method({
  14130. selector: "asRegexp",
  14131. protocol: 'converting',
  14132. fn: function (){
  14133. var self=this;
  14134. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  14135. return $core.withContext(function($ctx1) {
  14136. return $recv($RegularExpression())._fromString_(self);
  14137. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  14138. },
  14139. args: [],
  14140. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  14141. referencedClasses: ["RegularExpression"],
  14142. messageSends: ["fromString:"]
  14143. }),
  14144. $globals.String);
  14145. $core.addMethod(
  14146. $core.method({
  14147. selector: "asString",
  14148. protocol: 'converting',
  14149. fn: function (){
  14150. var self=this;
  14151. return self;
  14152. },
  14153. args: [],
  14154. source: "asString\x0a\x09^ self",
  14155. referencedClasses: [],
  14156. messageSends: []
  14157. }),
  14158. $globals.String);
  14159. $core.addMethod(
  14160. $core.method({
  14161. selector: "asSymbol",
  14162. protocol: 'converting',
  14163. fn: function (){
  14164. var self=this;
  14165. return self;
  14166. },
  14167. args: [],
  14168. source: "asSymbol\x0a\x09^ self",
  14169. referencedClasses: [],
  14170. messageSends: []
  14171. }),
  14172. $globals.String);
  14173. $core.addMethod(
  14174. $core.method({
  14175. selector: "asUppercase",
  14176. protocol: 'converting',
  14177. fn: function (){
  14178. var self=this;
  14179. return $core.withContext(function($ctx1) {
  14180. return self.toUpperCase();
  14181. return self;
  14182. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  14183. },
  14184. args: [],
  14185. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  14186. referencedClasses: [],
  14187. messageSends: []
  14188. }),
  14189. $globals.String);
  14190. $core.addMethod(
  14191. $core.method({
  14192. selector: "asciiValue",
  14193. protocol: 'accessing',
  14194. fn: function (){
  14195. var self=this;
  14196. return $core.withContext(function($ctx1) {
  14197. return self.charCodeAt(0);;
  14198. return self;
  14199. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  14200. },
  14201. args: [],
  14202. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  14203. referencedClasses: [],
  14204. messageSends: []
  14205. }),
  14206. $globals.String);
  14207. $core.addMethod(
  14208. $core.method({
  14209. selector: "at:ifAbsent:",
  14210. protocol: 'accessing',
  14211. fn: function (anIndex,aBlock){
  14212. var self=this;
  14213. return $core.withContext(function($ctx1) {
  14214. return String(self)[anIndex - 1] || aBlock._value();
  14215. return self;
  14216. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  14217. },
  14218. args: ["anIndex", "aBlock"],
  14219. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self)[anIndex - 1] || aBlock._value()>",
  14220. referencedClasses: [],
  14221. messageSends: []
  14222. }),
  14223. $globals.String);
  14224. $core.addMethod(
  14225. $core.method({
  14226. selector: "at:ifPresent:ifAbsent:",
  14227. protocol: 'accessing',
  14228. fn: function (anIndex,aBlock,anotherBlock){
  14229. var self=this;
  14230. return $core.withContext(function($ctx1) {
  14231. var result = String(self)[anIndex - 1];
  14232. return result ? aBlock._value_(result) : anotherBlock._value();
  14233. ;
  14234. return self;
  14235. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  14236. },
  14237. args: ["anIndex", "aBlock", "anotherBlock"],
  14238. 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>",
  14239. referencedClasses: [],
  14240. messageSends: []
  14241. }),
  14242. $globals.String);
  14243. $core.addMethod(
  14244. $core.method({
  14245. selector: "capitalized",
  14246. protocol: 'converting',
  14247. fn: function (){
  14248. var self=this;
  14249. return $core.withContext(function($ctx1) {
  14250. var $1;
  14251. $1=self._isEmpty();
  14252. if($core.assert($1)){
  14253. return self;
  14254. } else {
  14255. return $recv($recv(self._first())._asUppercase()).__comma(self._allButFirst());
  14256. };
  14257. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  14258. },
  14259. args: [],
  14260. source: "capitalized\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self first asUppercase, self allButFirst ]",
  14261. referencedClasses: [],
  14262. messageSends: ["ifTrue:ifFalse:", "isEmpty", ",", "asUppercase", "first", "allButFirst"]
  14263. }),
  14264. $globals.String);
  14265. $core.addMethod(
  14266. $core.method({
  14267. selector: "charCodeAt:",
  14268. protocol: 'accessing',
  14269. fn: function (anInteger){
  14270. var self=this;
  14271. return $core.withContext(function($ctx1) {
  14272. return self.charCodeAt(anInteger - 1);
  14273. return self;
  14274. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  14275. },
  14276. args: ["anInteger"],
  14277. source: "charCodeAt: anInteger\x0a\x09<return self.charCodeAt(anInteger - 1)>",
  14278. referencedClasses: [],
  14279. messageSends: []
  14280. }),
  14281. $globals.String);
  14282. $core.addMethod(
  14283. $core.method({
  14284. selector: "copyFrom:to:",
  14285. protocol: 'copying',
  14286. fn: function (anIndex,anotherIndex){
  14287. var self=this;
  14288. return $core.withContext(function($ctx1) {
  14289. return self.substring(anIndex - 1, anotherIndex);
  14290. return self;
  14291. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  14292. },
  14293. args: ["anIndex", "anotherIndex"],
  14294. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  14295. referencedClasses: [],
  14296. messageSends: []
  14297. }),
  14298. $globals.String);
  14299. $core.addMethod(
  14300. $core.method({
  14301. selector: "crlfSanitized",
  14302. protocol: 'converting',
  14303. fn: function (){
  14304. var self=this;
  14305. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  14306. return $core.withContext(function($ctx1) {
  14307. return $recv(self._lines())._join_($recv($String())._lf());
  14308. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  14309. },
  14310. args: [],
  14311. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  14312. referencedClasses: ["String"],
  14313. messageSends: ["join:", "lines", "lf"]
  14314. }),
  14315. $globals.String);
  14316. $core.addMethod(
  14317. $core.method({
  14318. selector: "deepCopy",
  14319. protocol: 'copying',
  14320. fn: function (){
  14321. var self=this;
  14322. return $core.withContext(function($ctx1) {
  14323. return self._shallowCopy();
  14324. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  14325. },
  14326. args: [],
  14327. source: "deepCopy\x0a\x09^ self shallowCopy",
  14328. referencedClasses: [],
  14329. messageSends: ["shallowCopy"]
  14330. }),
  14331. $globals.String);
  14332. $core.addMethod(
  14333. $core.method({
  14334. selector: "escaped",
  14335. protocol: 'converting',
  14336. fn: function (){
  14337. var self=this;
  14338. return $core.withContext(function($ctx1) {
  14339. return escape(self);
  14340. return self;
  14341. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  14342. },
  14343. args: [],
  14344. source: "escaped\x0a\x09<return escape(self)>",
  14345. referencedClasses: [],
  14346. messageSends: []
  14347. }),
  14348. $globals.String);
  14349. $core.addMethod(
  14350. $core.method({
  14351. selector: "includesSubString:",
  14352. protocol: 'testing',
  14353. fn: function (subString){
  14354. var self=this;
  14355. return $core.withContext(function($ctx1) {
  14356. return self.indexOf(subString) != -1;
  14357. return self;
  14358. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  14359. },
  14360. args: ["subString"],
  14361. source: "includesSubString: subString\x0a\x09<return self.indexOf(subString) != -1>",
  14362. referencedClasses: [],
  14363. messageSends: []
  14364. }),
  14365. $globals.String);
  14366. $core.addMethod(
  14367. $core.method({
  14368. selector: "isCapitalized",
  14369. protocol: 'testing',
  14370. fn: function (){
  14371. var self=this;
  14372. return $core.withContext(function($ctx1) {
  14373. var $2,$1;
  14374. $2=self._first();
  14375. $ctx1.sendIdx["first"]=1;
  14376. $1=$recv($2)._asUppercase();
  14377. return $recv($1).__eq_eq(self._first());
  14378. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  14379. },
  14380. args: [],
  14381. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  14382. referencedClasses: [],
  14383. messageSends: ["==", "asUppercase", "first"]
  14384. }),
  14385. $globals.String);
  14386. $core.addMethod(
  14387. $core.method({
  14388. selector: "isImmutable",
  14389. protocol: 'testing',
  14390. fn: function (){
  14391. var self=this;
  14392. return true;
  14393. },
  14394. args: [],
  14395. source: "isImmutable\x0a\x09^ true",
  14396. referencedClasses: [],
  14397. messageSends: []
  14398. }),
  14399. $globals.String);
  14400. $core.addMethod(
  14401. $core.method({
  14402. selector: "isString",
  14403. protocol: 'testing',
  14404. fn: function (){
  14405. var self=this;
  14406. return true;
  14407. },
  14408. args: [],
  14409. source: "isString\x0a\x09^ true",
  14410. referencedClasses: [],
  14411. messageSends: []
  14412. }),
  14413. $globals.String);
  14414. $core.addMethod(
  14415. $core.method({
  14416. selector: "isVowel",
  14417. protocol: 'testing',
  14418. fn: function (){
  14419. var self=this;
  14420. return $core.withContext(function($ctx1) {
  14421. return $recv($recv(self._size()).__eq((1)))._and_((function(){
  14422. return $core.withContext(function($ctx2) {
  14423. return "aeiou"._includes_(self._asLowercase());
  14424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14425. }));
  14426. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  14427. },
  14428. args: [],
  14429. 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 ]",
  14430. referencedClasses: [],
  14431. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  14432. }),
  14433. $globals.String);
  14434. $core.addMethod(
  14435. $core.method({
  14436. selector: "join:",
  14437. protocol: 'split join',
  14438. fn: function (aCollection){
  14439. var self=this;
  14440. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  14441. return $core.withContext(function($ctx1) {
  14442. return $recv($String())._streamContents_((function(stream){
  14443. return $core.withContext(function($ctx2) {
  14444. return $recv(aCollection)._do_separatedBy_((function(each){
  14445. return $core.withContext(function($ctx3) {
  14446. return $recv(stream)._nextPutAll_($recv(each)._asString());
  14447. $ctx3.sendIdx["nextPutAll:"]=1;
  14448. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14449. }),(function(){
  14450. return $core.withContext(function($ctx3) {
  14451. return $recv(stream)._nextPutAll_(self);
  14452. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  14453. }));
  14454. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14455. }));
  14456. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  14457. },
  14458. args: ["aCollection"],
  14459. 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 ]]",
  14460. referencedClasses: ["String"],
  14461. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  14462. }),
  14463. $globals.String);
  14464. $core.addMethod(
  14465. $core.method({
  14466. selector: "lineIndicesDo:",
  14467. protocol: 'split join',
  14468. fn: function (aBlock){
  14469. var self=this;
  14470. var cr,lf,start,sz,nextLF,nextCR;
  14471. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  14472. return $core.withContext(function($ctx1) {
  14473. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  14474. var $early={};
  14475. try {
  14476. start=(1);
  14477. sz=self._size();
  14478. cr=$recv($String())._cr();
  14479. nextCR=self._indexOf_startingAt_(cr,(1));
  14480. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  14481. lf=$recv($String())._lf();
  14482. nextLF=self._indexOf_startingAt_(lf,(1));
  14483. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  14484. $recv((function(){
  14485. return $core.withContext(function($ctx2) {
  14486. return $recv(start).__lt_eq(sz);
  14487. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14488. }))._whileTrue_((function(){
  14489. return $core.withContext(function($ctx2) {
  14490. $2=$recv(nextLF).__eq((0));
  14491. $ctx2.sendIdx["="]=1;
  14492. $1=$recv($2)._and_((function(){
  14493. return $core.withContext(function($ctx3) {
  14494. return $recv(nextCR).__eq((0));
  14495. $ctx3.sendIdx["="]=2;
  14496. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  14497. }));
  14498. $ctx2.sendIdx["and:"]=1;
  14499. if($core.assert($1)){
  14500. $recv(aBlock)._value_value_value_(start,sz,sz);
  14501. $ctx2.sendIdx["value:value:value:"]=1;
  14502. throw $early=[self];
  14503. };
  14504. $4=$recv(nextCR).__eq((0));
  14505. $ctx2.sendIdx["="]=3;
  14506. $3=$recv($4)._or_((function(){
  14507. return $core.withContext(function($ctx3) {
  14508. $5=(0).__lt(nextLF);
  14509. $ctx3.sendIdx["<"]=1;
  14510. return $recv($5)._and_((function(){
  14511. return $core.withContext(function($ctx4) {
  14512. return $recv(nextLF).__lt(nextCR);
  14513. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  14514. }));
  14515. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  14516. }));
  14517. if($core.assert($3)){
  14518. $6=start;
  14519. $7=$recv(nextLF).__minus((1));
  14520. $ctx2.sendIdx["-"]=1;
  14521. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  14522. $ctx2.sendIdx["value:value:value:"]=2;
  14523. start=(1).__plus(nextLF);
  14524. $ctx2.sendIdx["+"]=1;
  14525. start;
  14526. nextLF=self._indexOf_startingAt_(lf,start);
  14527. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  14528. return nextLF;
  14529. } else {
  14530. $9=(1).__plus(nextCR);
  14531. $ctx2.sendIdx["+"]=2;
  14532. $8=$recv($9).__eq(nextLF);
  14533. if($core.assert($8)){
  14534. $10=start;
  14535. $11=$recv(nextCR).__minus((1));
  14536. $ctx2.sendIdx["-"]=2;
  14537. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  14538. $ctx2.sendIdx["value:value:value:"]=3;
  14539. start=(1).__plus(nextLF);
  14540. $ctx2.sendIdx["+"]=3;
  14541. start;
  14542. nextCR=self._indexOf_startingAt_(cr,start);
  14543. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  14544. nextCR;
  14545. nextLF=self._indexOf_startingAt_(lf,start);
  14546. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  14547. return nextLF;
  14548. } else {
  14549. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  14550. start=(1).__plus(nextCR);
  14551. start;
  14552. nextCR=self._indexOf_startingAt_(cr,start);
  14553. return nextCR;
  14554. };
  14555. };
  14556. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14557. }));
  14558. return self;
  14559. }
  14560. catch(e) {if(e===$early)return e[0]; throw e}
  14561. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  14562. },
  14563. args: ["aBlock"],
  14564. 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 ] ]]",
  14565. referencedClasses: ["String"],
  14566. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  14567. }),
  14568. $globals.String);
  14569. $core.addMethod(
  14570. $core.method({
  14571. selector: "lineNumber:",
  14572. protocol: 'split join',
  14573. fn: function (anIndex){
  14574. var self=this;
  14575. var lineCount;
  14576. return $core.withContext(function($ctx1) {
  14577. var $2,$1;
  14578. var $early={};
  14579. try {
  14580. lineCount=(0);
  14581. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  14582. return $core.withContext(function($ctx2) {
  14583. lineCount=$recv(lineCount).__plus((1));
  14584. $2=lineCount;
  14585. $1=$recv($2).__eq(anIndex);
  14586. if($core.assert($1)){
  14587. throw $early=[self._copyFrom_to_(start,endWithoutDelimiters)];
  14588. };
  14589. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  14590. }));
  14591. return nil;
  14592. }
  14593. catch(e) {if(e===$early)return e[0]; throw e}
  14594. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  14595. },
  14596. args: ["anIndex"],
  14597. 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",
  14598. referencedClasses: [],
  14599. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  14600. }),
  14601. $globals.String);
  14602. $core.addMethod(
  14603. $core.method({
  14604. selector: "lines",
  14605. protocol: 'split join',
  14606. fn: function (){
  14607. var self=this;
  14608. return $core.withContext(function($ctx1) {
  14609. var result = self.split(/\r\n|\r|\n/);
  14610. if (!result[result.length-1]) result.pop();
  14611. return result;;
  14612. return self;
  14613. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  14614. },
  14615. args: [],
  14616. source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a<\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;\x0a>",
  14617. referencedClasses: [],
  14618. messageSends: []
  14619. }),
  14620. $globals.String);
  14621. $core.addMethod(
  14622. $core.method({
  14623. selector: "linesDo:",
  14624. protocol: 'split join',
  14625. fn: function (aBlock){
  14626. var self=this;
  14627. return $core.withContext(function($ctx1) {
  14628. $recv(self._lines())._do_(aBlock);
  14629. return self;
  14630. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  14631. },
  14632. args: ["aBlock"],
  14633. source: "linesDo: aBlock\x0a\x09\x22Execute aBlock with each line in this string. The terminating line\x0a\x09delimiters CR, LF or CRLF pairs are not included in what is passed to aBlock\x22\x0a\x0a\x09self lines do: aBlock",
  14634. referencedClasses: [],
  14635. messageSends: ["do:", "lines"]
  14636. }),
  14637. $globals.String);
  14638. $core.addMethod(
  14639. $core.method({
  14640. selector: "match:",
  14641. protocol: 'regular expressions',
  14642. fn: function (aRegexp){
  14643. var self=this;
  14644. return $core.withContext(function($ctx1) {
  14645. return self.search(aRegexp) != -1;
  14646. return self;
  14647. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  14648. },
  14649. args: ["aRegexp"],
  14650. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  14651. referencedClasses: [],
  14652. messageSends: []
  14653. }),
  14654. $globals.String);
  14655. $core.addMethod(
  14656. $core.method({
  14657. selector: "matchesOf:",
  14658. protocol: 'regular expressions',
  14659. fn: function (aRegularExpression){
  14660. var self=this;
  14661. return $core.withContext(function($ctx1) {
  14662. return self.match(aRegularExpression);
  14663. return self;
  14664. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  14665. },
  14666. args: ["aRegularExpression"],
  14667. source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
  14668. referencedClasses: [],
  14669. messageSends: []
  14670. }),
  14671. $globals.String);
  14672. $core.addMethod(
  14673. $core.method({
  14674. selector: "numericallyIndexable",
  14675. protocol: 'private',
  14676. fn: function (){
  14677. var self=this;
  14678. return $core.withContext(function($ctx1) {
  14679. return String(self);
  14680. return self;
  14681. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  14682. },
  14683. args: [],
  14684. source: "numericallyIndexable\x0a\x09<return String(self)>",
  14685. referencedClasses: [],
  14686. messageSends: []
  14687. }),
  14688. $globals.String);
  14689. $core.addMethod(
  14690. $core.method({
  14691. selector: "printNl",
  14692. protocol: 'printing',
  14693. fn: function (){
  14694. var self=this;
  14695. return $core.withContext(function($ctx1) {
  14696. console.log(self);
  14697. return self;
  14698. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  14699. },
  14700. args: [],
  14701. source: "printNl\x0a\x09<console.log(self)>",
  14702. referencedClasses: [],
  14703. messageSends: []
  14704. }),
  14705. $globals.String);
  14706. $core.addMethod(
  14707. $core.method({
  14708. selector: "printOn:",
  14709. protocol: 'printing',
  14710. fn: function (aStream){
  14711. var self=this;
  14712. return $core.withContext(function($ctx1) {
  14713. $recv(aStream)._nextPutAll_("'");
  14714. $ctx1.sendIdx["nextPutAll:"]=1;
  14715. $recv(aStream)._nextPutAll_(self);
  14716. $ctx1.sendIdx["nextPutAll:"]=2;
  14717. $recv(aStream)._nextPutAll_("'");
  14718. return self;
  14719. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  14720. },
  14721. args: ["aStream"],
  14722. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  14723. referencedClasses: [],
  14724. messageSends: ["nextPutAll:"]
  14725. }),
  14726. $globals.String);
  14727. $core.addMethod(
  14728. $core.method({
  14729. selector: "replace:with:",
  14730. protocol: 'regular expressions',
  14731. fn: function (aString,anotherString){
  14732. var self=this;
  14733. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  14734. return $core.withContext(function($ctx1) {
  14735. return self._replaceRegexp_with_($recv($RegularExpression())._fromString_flag_(aString,"g"),anotherString);
  14736. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  14737. },
  14738. args: ["aString", "anotherString"],
  14739. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  14740. referencedClasses: ["RegularExpression"],
  14741. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  14742. }),
  14743. $globals.String);
  14744. $core.addMethod(
  14745. $core.method({
  14746. selector: "replaceRegexp:with:",
  14747. protocol: 'regular expressions',
  14748. fn: function (aRegexp,aString){
  14749. var self=this;
  14750. return $core.withContext(function($ctx1) {
  14751. return self.replace(aRegexp, aString);
  14752. return self;
  14753. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  14754. },
  14755. args: ["aRegexp", "aString"],
  14756. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  14757. referencedClasses: [],
  14758. messageSends: []
  14759. }),
  14760. $globals.String);
  14761. $core.addMethod(
  14762. $core.method({
  14763. selector: "reversed",
  14764. protocol: 'converting',
  14765. fn: function (){
  14766. var self=this;
  14767. return $core.withContext(function($ctx1) {
  14768. return self.split("").reverse().join("");
  14769. return self;
  14770. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  14771. },
  14772. args: [],
  14773. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  14774. referencedClasses: [],
  14775. messageSends: []
  14776. }),
  14777. $globals.String);
  14778. $core.addMethod(
  14779. $core.method({
  14780. selector: "shallowCopy",
  14781. protocol: 'copying',
  14782. fn: function (){
  14783. var self=this;
  14784. return self;
  14785. },
  14786. args: [],
  14787. source: "shallowCopy\x0a\x09^ self",
  14788. referencedClasses: [],
  14789. messageSends: []
  14790. }),
  14791. $globals.String);
  14792. $core.addMethod(
  14793. $core.method({
  14794. selector: "size",
  14795. protocol: 'accessing',
  14796. fn: function (){
  14797. var self=this;
  14798. return $core.withContext(function($ctx1) {
  14799. return self.length;
  14800. return self;
  14801. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  14802. },
  14803. args: [],
  14804. source: "size\x0a\x09<return self.length>",
  14805. referencedClasses: [],
  14806. messageSends: []
  14807. }),
  14808. $globals.String);
  14809. $core.addMethod(
  14810. $core.method({
  14811. selector: "subStrings:",
  14812. protocol: 'split join',
  14813. fn: function (aString){
  14814. var self=this;
  14815. return $core.withContext(function($ctx1) {
  14816. return self._tokenize_(aString);
  14817. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  14818. },
  14819. args: ["aString"],
  14820. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  14821. referencedClasses: [],
  14822. messageSends: ["tokenize:"]
  14823. }),
  14824. $globals.String);
  14825. $core.addMethod(
  14826. $core.method({
  14827. selector: "tokenize:",
  14828. protocol: 'split join',
  14829. fn: function (aString){
  14830. var self=this;
  14831. return $core.withContext(function($ctx1) {
  14832. return self.split(aString);
  14833. return self;
  14834. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  14835. },
  14836. args: ["aString"],
  14837. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  14838. referencedClasses: [],
  14839. messageSends: []
  14840. }),
  14841. $globals.String);
  14842. $core.addMethod(
  14843. $core.method({
  14844. selector: "trimBoth",
  14845. protocol: 'regular expressions',
  14846. fn: function (){
  14847. var self=this;
  14848. return $core.withContext(function($ctx1) {
  14849. return self._trimBoth_("\x5cs");
  14850. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  14851. },
  14852. args: [],
  14853. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  14854. referencedClasses: [],
  14855. messageSends: ["trimBoth:"]
  14856. }),
  14857. $globals.String);
  14858. $core.addMethod(
  14859. $core.method({
  14860. selector: "trimBoth:",
  14861. protocol: 'regular expressions',
  14862. fn: function (separators){
  14863. var self=this;
  14864. return $core.withContext(function($ctx1) {
  14865. return $recv(self._trimLeft_(separators))._trimRight_(separators);
  14866. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  14867. },
  14868. args: ["separators"],
  14869. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  14870. referencedClasses: [],
  14871. messageSends: ["trimRight:", "trimLeft:"]
  14872. }),
  14873. $globals.String);
  14874. $core.addMethod(
  14875. $core.method({
  14876. selector: "trimLeft",
  14877. protocol: 'regular expressions',
  14878. fn: function (){
  14879. var self=this;
  14880. return $core.withContext(function($ctx1) {
  14881. return self._trimLeft_("\x5cs");
  14882. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  14883. },
  14884. args: [],
  14885. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  14886. referencedClasses: [],
  14887. messageSends: ["trimLeft:"]
  14888. }),
  14889. $globals.String);
  14890. $core.addMethod(
  14891. $core.method({
  14892. selector: "trimLeft:",
  14893. protocol: 'regular expressions',
  14894. fn: function (separators){
  14895. var self=this;
  14896. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  14897. return $core.withContext(function($ctx1) {
  14898. var $2,$1;
  14899. $2=$recv("^[".__comma(separators)).__comma("]+");
  14900. $ctx1.sendIdx[","]=1;
  14901. $1=$recv($RegularExpression())._fromString_flag_($2,"g");
  14902. return self._replaceRegexp_with_($1,"");
  14903. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  14904. },
  14905. args: ["separators"],
  14906. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  14907. referencedClasses: ["RegularExpression"],
  14908. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  14909. }),
  14910. $globals.String);
  14911. $core.addMethod(
  14912. $core.method({
  14913. selector: "trimRight",
  14914. protocol: 'regular expressions',
  14915. fn: function (){
  14916. var self=this;
  14917. return $core.withContext(function($ctx1) {
  14918. return self._trimRight_("\x5cs");
  14919. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  14920. },
  14921. args: [],
  14922. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  14923. referencedClasses: [],
  14924. messageSends: ["trimRight:"]
  14925. }),
  14926. $globals.String);
  14927. $core.addMethod(
  14928. $core.method({
  14929. selector: "trimRight:",
  14930. protocol: 'regular expressions',
  14931. fn: function (separators){
  14932. var self=this;
  14933. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  14934. return $core.withContext(function($ctx1) {
  14935. var $2,$1;
  14936. $2=$recv("[".__comma(separators)).__comma("]+$");
  14937. $ctx1.sendIdx[","]=1;
  14938. $1=$recv($RegularExpression())._fromString_flag_($2,"g");
  14939. return self._replaceRegexp_with_($1,"");
  14940. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  14941. },
  14942. args: ["separators"],
  14943. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  14944. referencedClasses: ["RegularExpression"],
  14945. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  14946. }),
  14947. $globals.String);
  14948. $core.addMethod(
  14949. $core.method({
  14950. selector: "unescaped",
  14951. protocol: 'converting',
  14952. fn: function (){
  14953. var self=this;
  14954. return $core.withContext(function($ctx1) {
  14955. return unescape(self);
  14956. return self;
  14957. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  14958. },
  14959. args: [],
  14960. source: "unescaped\x0a\x09<return unescape(self)>",
  14961. referencedClasses: [],
  14962. messageSends: []
  14963. }),
  14964. $globals.String);
  14965. $core.addMethod(
  14966. $core.method({
  14967. selector: "uriComponentDecoded",
  14968. protocol: 'converting',
  14969. fn: function (){
  14970. var self=this;
  14971. return $core.withContext(function($ctx1) {
  14972. return decodeURIComponent(self);
  14973. return self;
  14974. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  14975. },
  14976. args: [],
  14977. source: "uriComponentDecoded\x0a\x09<return decodeURIComponent(self)>",
  14978. referencedClasses: [],
  14979. messageSends: []
  14980. }),
  14981. $globals.String);
  14982. $core.addMethod(
  14983. $core.method({
  14984. selector: "uriComponentEncoded",
  14985. protocol: 'converting',
  14986. fn: function (){
  14987. var self=this;
  14988. return $core.withContext(function($ctx1) {
  14989. return encodeURIComponent(self);
  14990. return self;
  14991. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  14992. },
  14993. args: [],
  14994. source: "uriComponentEncoded\x0a\x09<return encodeURIComponent(self)>",
  14995. referencedClasses: [],
  14996. messageSends: []
  14997. }),
  14998. $globals.String);
  14999. $core.addMethod(
  15000. $core.method({
  15001. selector: "uriDecoded",
  15002. protocol: 'converting',
  15003. fn: function (){
  15004. var self=this;
  15005. return $core.withContext(function($ctx1) {
  15006. return decodeURI(self);
  15007. return self;
  15008. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  15009. },
  15010. args: [],
  15011. source: "uriDecoded\x0a\x09<return decodeURI(self)>",
  15012. referencedClasses: [],
  15013. messageSends: []
  15014. }),
  15015. $globals.String);
  15016. $core.addMethod(
  15017. $core.method({
  15018. selector: "uriEncoded",
  15019. protocol: 'converting',
  15020. fn: function (){
  15021. var self=this;
  15022. return $core.withContext(function($ctx1) {
  15023. return encodeURI(self);
  15024. return self;
  15025. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  15026. },
  15027. args: [],
  15028. source: "uriEncoded\x0a\x09<return encodeURI(self)>",
  15029. referencedClasses: [],
  15030. messageSends: []
  15031. }),
  15032. $globals.String);
  15033. $core.addMethod(
  15034. $core.method({
  15035. selector: "value:",
  15036. protocol: 'evaluating',
  15037. fn: function (anObject){
  15038. var self=this;
  15039. return $core.withContext(function($ctx1) {
  15040. return $recv(anObject)._perform_(self);
  15041. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  15042. },
  15043. args: ["anObject"],
  15044. source: "value: anObject \x0a\x09^ anObject perform: self",
  15045. referencedClasses: [],
  15046. messageSends: ["perform:"]
  15047. }),
  15048. $globals.String);
  15049. $core.addMethod(
  15050. $core.method({
  15051. selector: "cr",
  15052. protocol: 'accessing',
  15053. fn: function (){
  15054. var self=this;
  15055. return $core.withContext(function($ctx1) {
  15056. return '\r';
  15057. return self;
  15058. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.klass)});
  15059. },
  15060. args: [],
  15061. source: "cr\x0a\x09<return '\x5cr'>",
  15062. referencedClasses: [],
  15063. messageSends: []
  15064. }),
  15065. $globals.String.klass);
  15066. $core.addMethod(
  15067. $core.method({
  15068. selector: "crlf",
  15069. protocol: 'accessing',
  15070. fn: function (){
  15071. var self=this;
  15072. return $core.withContext(function($ctx1) {
  15073. return '\r\n';
  15074. return self;
  15075. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.klass)});
  15076. },
  15077. args: [],
  15078. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  15079. referencedClasses: [],
  15080. messageSends: []
  15081. }),
  15082. $globals.String.klass);
  15083. $core.addMethod(
  15084. $core.method({
  15085. selector: "esc",
  15086. protocol: 'accessing',
  15087. fn: function (){
  15088. var self=this;
  15089. return $core.withContext(function($ctx1) {
  15090. return self._fromCharCode_((27));
  15091. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.klass)});
  15092. },
  15093. args: [],
  15094. source: "esc\x0a\x09^ self fromCharCode: 27",
  15095. referencedClasses: [],
  15096. messageSends: ["fromCharCode:"]
  15097. }),
  15098. $globals.String.klass);
  15099. $core.addMethod(
  15100. $core.method({
  15101. selector: "fromCharCode:",
  15102. protocol: 'instance creation',
  15103. fn: function (anInteger){
  15104. var self=this;
  15105. return $core.withContext(function($ctx1) {
  15106. return String.fromCharCode(anInteger);
  15107. return self;
  15108. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.klass)});
  15109. },
  15110. args: ["anInteger"],
  15111. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  15112. referencedClasses: [],
  15113. messageSends: []
  15114. }),
  15115. $globals.String.klass);
  15116. $core.addMethod(
  15117. $core.method({
  15118. selector: "fromString:",
  15119. protocol: 'instance creation',
  15120. fn: function (aString){
  15121. var self=this;
  15122. return $core.withContext(function($ctx1) {
  15123. return String(aString);
  15124. return self;
  15125. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.klass)});
  15126. },
  15127. args: ["aString"],
  15128. source: "fromString: aString\x0a\x09\x09<return String(aString)>",
  15129. referencedClasses: [],
  15130. messageSends: []
  15131. }),
  15132. $globals.String.klass);
  15133. $core.addMethod(
  15134. $core.method({
  15135. selector: "lf",
  15136. protocol: 'accessing',
  15137. fn: function (){
  15138. var self=this;
  15139. return $core.withContext(function($ctx1) {
  15140. return '\n';
  15141. return self;
  15142. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.klass)});
  15143. },
  15144. args: [],
  15145. source: "lf\x0a\x09<return '\x5cn'>",
  15146. referencedClasses: [],
  15147. messageSends: []
  15148. }),
  15149. $globals.String.klass);
  15150. $core.addMethod(
  15151. $core.method({
  15152. selector: "random",
  15153. protocol: 'random',
  15154. fn: function (){
  15155. var self=this;
  15156. return $core.withContext(function($ctx1) {
  15157. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  15158. return self;
  15159. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.klass)});
  15160. },
  15161. args: [],
  15162. 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);>",
  15163. referencedClasses: [],
  15164. messageSends: []
  15165. }),
  15166. $globals.String.klass);
  15167. $core.addMethod(
  15168. $core.method({
  15169. selector: "randomNotIn:",
  15170. protocol: 'random',
  15171. fn: function (aString){
  15172. var self=this;
  15173. var result;
  15174. return $core.withContext(function($ctx1) {
  15175. $recv((function(){
  15176. return $core.withContext(function($ctx2) {
  15177. result=self._random();
  15178. result;
  15179. return $recv(aString)._includesSubString_(result);
  15180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15181. }))._whileTrue();
  15182. return result;
  15183. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.klass)});
  15184. },
  15185. args: ["aString"],
  15186. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  15187. referencedClasses: [],
  15188. messageSends: ["whileTrue", "random", "includesSubString:"]
  15189. }),
  15190. $globals.String.klass);
  15191. $core.addMethod(
  15192. $core.method({
  15193. selector: "space",
  15194. protocol: 'accessing',
  15195. fn: function (){
  15196. var self=this;
  15197. return $core.withContext(function($ctx1) {
  15198. return ' ';
  15199. return self;
  15200. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.klass)});
  15201. },
  15202. args: [],
  15203. source: "space\x0a\x09<return ' '>",
  15204. referencedClasses: [],
  15205. messageSends: []
  15206. }),
  15207. $globals.String.klass);
  15208. $core.addMethod(
  15209. $core.method({
  15210. selector: "streamClass",
  15211. protocol: 'accessing',
  15212. fn: function (){
  15213. var self=this;
  15214. function $StringStream(){return $globals.StringStream||(typeof StringStream=="undefined"?nil:StringStream)}
  15215. return $StringStream();
  15216. },
  15217. args: [],
  15218. source: "streamClass\x0a\x09\x09^ StringStream",
  15219. referencedClasses: ["StringStream"],
  15220. messageSends: []
  15221. }),
  15222. $globals.String.klass);
  15223. $core.addMethod(
  15224. $core.method({
  15225. selector: "tab",
  15226. protocol: 'accessing',
  15227. fn: function (){
  15228. var self=this;
  15229. return $core.withContext(function($ctx1) {
  15230. return '\t';
  15231. return self;
  15232. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.klass)});
  15233. },
  15234. args: [],
  15235. source: "tab\x0a\x09<return '\x5ct'>",
  15236. referencedClasses: [],
  15237. messageSends: []
  15238. }),
  15239. $globals.String.klass);
  15240. $core.addMethod(
  15241. $core.method({
  15242. selector: "value:",
  15243. protocol: 'instance creation',
  15244. fn: function (aUTFCharCode){
  15245. var self=this;
  15246. return $core.withContext(function($ctx1) {
  15247. return String.fromCharCode(aUTFCharCode);;
  15248. return self;
  15249. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.klass)});
  15250. },
  15251. args: ["aUTFCharCode"],
  15252. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  15253. referencedClasses: [],
  15254. messageSends: []
  15255. }),
  15256. $globals.String.klass);
  15257. $core.addClass('Set', $globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections');
  15258. $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`.";
  15259. $core.addMethod(
  15260. $core.method({
  15261. selector: "=",
  15262. protocol: 'comparing',
  15263. fn: function (aCollection){
  15264. var self=this;
  15265. return $core.withContext(function($ctx1) {
  15266. var $2,$1,$4,$3,$5;
  15267. var $early={};
  15268. try {
  15269. $2=self._class();
  15270. $ctx1.sendIdx["class"]=1;
  15271. $1=$recv($2).__eq($recv(aCollection)._class());
  15272. $ctx1.sendIdx["="]=1;
  15273. if(!$core.assert($1)){
  15274. return false;
  15275. };
  15276. $4=self._size();
  15277. $ctx1.sendIdx["size"]=1;
  15278. $3=$recv($4).__eq($recv(aCollection)._size());
  15279. if(!$core.assert($3)){
  15280. return false;
  15281. };
  15282. self._do_((function(each){
  15283. return $core.withContext(function($ctx2) {
  15284. $5=$recv(aCollection)._includes_(each);
  15285. if(!$core.assert($5)){
  15286. throw $early=[false];
  15287. };
  15288. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15289. }));
  15290. return true;
  15291. }
  15292. catch(e) {if(e===$early)return e[0]; throw e}
  15293. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  15294. },
  15295. args: ["aCollection"],
  15296. 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",
  15297. referencedClasses: [],
  15298. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  15299. }),
  15300. $globals.Set);
  15301. $core.addMethod(
  15302. $core.method({
  15303. selector: "add:",
  15304. protocol: 'adding/removing',
  15305. fn: function (anObject){
  15306. var self=this;
  15307. var bucket;
  15308. return $core.withContext(function($ctx1) {
  15309. var $1,$receiver;
  15310. bucket=self._bucketsOfElement_(anObject);
  15311. $1=$recv(bucket)._second();
  15312. if(($receiver = $1) == null || $receiver.isNil){
  15313. var object,slowBucket;
  15314. object=$recv(bucket)._first();
  15315. $ctx1.sendIdx["first"]=1;
  15316. object;
  15317. slowBucket=$recv(bucket)._third();
  15318. slowBucket;
  15319. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  15320. return $core.withContext(function($ctx2) {
  15321. $recv(slowBucket)._add_(object);
  15322. self["@size"]=$recv(self["@size"]).__plus((1));
  15323. return self["@size"];
  15324. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15325. }));
  15326. return object;
  15327. } else {
  15328. var primitiveBucket;
  15329. primitiveBucket=$receiver;
  15330. return self._add_in_($recv(bucket)._first(),primitiveBucket);
  15331. };
  15332. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  15333. },
  15334. args: ["anObject"],
  15335. 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 ]",
  15336. referencedClasses: [],
  15337. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  15338. }),
  15339. $globals.Set);
  15340. $core.addMethod(
  15341. $core.method({
  15342. selector: "add:in:",
  15343. protocol: 'private',
  15344. fn: function (anObject,anotherObject){
  15345. var self=this;
  15346. return $core.withContext(function($ctx1) {
  15347. if (anObject in anotherObject.store) { return false; }
  15348. self['@size']++;
  15349. anotherObject.store[anObject] = true;
  15350. return anObject;
  15351. ;
  15352. return self;
  15353. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  15354. },
  15355. args: ["anObject", "anotherObject"],
  15356. source: "add: anObject in: anotherObject\x0a\x09<\x0a\x09\x09if (anObject in anotherObject.store) { return false; }\x0a\x09\x09self['@size']++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09>",
  15357. referencedClasses: [],
  15358. messageSends: []
  15359. }),
  15360. $globals.Set);
  15361. $core.addMethod(
  15362. $core.method({
  15363. selector: "bucketsOfElement:",
  15364. protocol: 'private',
  15365. fn: function (anObject){
  15366. var self=this;
  15367. return $core.withContext(function($ctx1) {
  15368. // include nil to well-known objects under 'boolean' fastBucket
  15369. if (anObject == null || anObject.isNil) return [ null, self['@fastBuckets'].boolean ];
  15370. var prim = anObject.valueOf();
  15371. if (typeof prim === "object" || typeof prim === "function" || !self['@fastBuckets'][typeof prim]) {
  15372. var bucket = null;
  15373. self['@slowBucketStores'].some(function (store) {
  15374. return bucket = store._bucketOfElement_(anObject);
  15375. });
  15376. return [ anObject, null, bucket || self['@defaultBucket'] ];
  15377. }
  15378. return [ prim, self['@fastBuckets'][typeof prim] ];
  15379. ;
  15380. return self;
  15381. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  15382. },
  15383. args: ["anObject"],
  15384. source: "bucketsOfElement: anObject\x0a\x09\x22Find the appropriate bucket for `anObject`.\x0a\x09For optimization purposes, directly answer an array with: \x0a\x09- the object to be store\x0a\x09- the primitive bucket\x0a\x09- the slow bucket\x22\x0a\x09\x0a\x09<\x0a\x09\x09// include nil to well-known objects under 'boolean' fastBucket\x0a\x09\x09if (anObject == null || anObject.isNil) return [ null, self['@fastBuckets'].boolean ];\x0a\x09\x09\x0a\x09\x09var prim = anObject.valueOf();\x0a\x09\x09if (typeof prim === \x22object\x22 || typeof prim === \x22function\x22 || !self['@fastBuckets'][typeof prim]) {\x0a\x09\x09\x09var bucket = null;\x0a\x09\x09\x09self['@slowBucketStores'].some(function (store) {\x0a\x09\x09\x09\x09return bucket = store._bucketOfElement_(anObject);\x0a\x09\x09\x09});\x0a\x09\x09\x09return [ anObject, null, bucket || self['@defaultBucket'] ];\x0a\x09\x09}\x0a\x09\x09return [ prim, self['@fastBuckets'][typeof prim] ];\x0a\x09>",
  15385. referencedClasses: [],
  15386. messageSends: []
  15387. }),
  15388. $globals.Set);
  15389. $core.addMethod(
  15390. $core.method({
  15391. selector: "classNameOf:",
  15392. protocol: 'private',
  15393. fn: function (anObject){
  15394. var self=this;
  15395. return $core.withContext(function($ctx1) {
  15396. return anObject.klass != null && anObject.klass.className;
  15397. return self;
  15398. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  15399. },
  15400. args: ["anObject"],
  15401. 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>",
  15402. referencedClasses: [],
  15403. messageSends: []
  15404. }),
  15405. $globals.Set);
  15406. $core.addMethod(
  15407. $core.method({
  15408. selector: "collect:",
  15409. protocol: 'enumerating',
  15410. fn: function (aBlock){
  15411. var self=this;
  15412. var collection;
  15413. return $core.withContext(function($ctx1) {
  15414. collection=$recv(self._class())._new();
  15415. self._do_((function(each){
  15416. return $core.withContext(function($ctx2) {
  15417. return $recv(collection)._add_($recv(aBlock)._value_(each));
  15418. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15419. }));
  15420. return collection;
  15421. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  15422. },
  15423. args: ["aBlock"],
  15424. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  15425. referencedClasses: [],
  15426. messageSends: ["new", "class", "do:", "add:", "value:"]
  15427. }),
  15428. $globals.Set);
  15429. $core.addMethod(
  15430. $core.method({
  15431. selector: "detect:ifNone:",
  15432. protocol: 'enumerating',
  15433. fn: function (aBlock,anotherBlock){
  15434. var self=this;
  15435. return $core.withContext(function($ctx1) {
  15436. var $1;
  15437. var $early={};
  15438. try {
  15439. self._do_((function(each){
  15440. return $core.withContext(function($ctx2) {
  15441. $1=$recv(aBlock)._value_(each);
  15442. if($core.assert($1)){
  15443. throw $early=[each];
  15444. };
  15445. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15446. }));
  15447. return $recv(anotherBlock)._value();
  15448. }
  15449. catch(e) {if(e===$early)return e[0]; throw e}
  15450. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  15451. },
  15452. args: ["aBlock", "anotherBlock"],
  15453. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  15454. referencedClasses: [],
  15455. messageSends: ["do:", "ifTrue:", "value:", "value"]
  15456. }),
  15457. $globals.Set);
  15458. $core.addMethod(
  15459. $core.method({
  15460. selector: "do:",
  15461. protocol: 'enumerating',
  15462. fn: function (aBlock){
  15463. var self=this;
  15464. return $core.withContext(function($ctx1) {
  15465. var el, keys, i;
  15466. el = self['@fastBuckets'];
  15467. keys = Object.keys(el);
  15468. for (i = 0; i < keys.length; ++i) {
  15469. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  15470. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  15471. else { store._do_(aBlock); }
  15472. }
  15473. el = self['@slowBucketStores'];
  15474. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  15475. self['@defaultBucket']._do_(aBlock);
  15476. ;
  15477. return self;
  15478. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  15479. },
  15480. args: ["aBlock"],
  15481. 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>",
  15482. referencedClasses: [],
  15483. messageSends: []
  15484. }),
  15485. $globals.Set);
  15486. $core.addMethod(
  15487. $core.method({
  15488. selector: "includes:",
  15489. protocol: 'testing',
  15490. fn: function (anObject){
  15491. var self=this;
  15492. var bucket;
  15493. return $core.withContext(function($ctx1) {
  15494. var $1,$2,$3,$receiver;
  15495. bucket=self._bucketsOfElement_(anObject);
  15496. $1=$recv(bucket)._second();
  15497. if(($receiver = $1) == null || $receiver.isNil){
  15498. $2=$recv(bucket)._third();
  15499. $3=$recv(bucket)._first();
  15500. $ctx1.sendIdx["first"]=1;
  15501. return $recv($2)._includes_($3);
  15502. } else {
  15503. var primitiveBucket;
  15504. primitiveBucket=$receiver;
  15505. return self._includes_in_($recv(bucket)._first(),primitiveBucket);
  15506. };
  15507. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  15508. },
  15509. args: ["anObject"],
  15510. 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 ]",
  15511. referencedClasses: [],
  15512. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  15513. }),
  15514. $globals.Set);
  15515. $core.addMethod(
  15516. $core.method({
  15517. selector: "includes:in:",
  15518. protocol: 'private',
  15519. fn: function (anObject,anotherObject){
  15520. var self=this;
  15521. return $core.withContext(function($ctx1) {
  15522. return anObject in anotherObject.store;
  15523. return self;
  15524. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  15525. },
  15526. args: ["anObject", "anotherObject"],
  15527. source: "includes: anObject in: anotherObject\x0a\x09<return anObject in anotherObject.store>",
  15528. referencedClasses: [],
  15529. messageSends: []
  15530. }),
  15531. $globals.Set);
  15532. $core.addMethod(
  15533. $core.method({
  15534. selector: "initialize",
  15535. protocol: 'initialization',
  15536. fn: function (){
  15537. var self=this;
  15538. return $core.withContext(function($ctx1) {
  15539. (
  15540. $ctx1.supercall = true,
  15541. ($globals.Set.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  15542. $ctx1.supercall = false;
  15543. self["@defaultBucket"]=[];
  15544. self._initializeSlowBucketStores();
  15545. self._removeAll();
  15546. return self;
  15547. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  15548. },
  15549. args: [],
  15550. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  15551. referencedClasses: [],
  15552. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  15553. }),
  15554. $globals.Set);
  15555. $core.addMethod(
  15556. $core.method({
  15557. selector: "initializeSlowBucketStores",
  15558. protocol: 'initialization',
  15559. fn: function (){
  15560. var self=this;
  15561. function $ArrayBucketStore(){return $globals.ArrayBucketStore||(typeof ArrayBucketStore=="undefined"?nil:ArrayBucketStore)}
  15562. return $core.withContext(function($ctx1) {
  15563. var $1;
  15564. $1=$recv($ArrayBucketStore())._hashBlock_((function(x){
  15565. return $core.withContext(function($ctx2) {
  15566. return self._classNameOf_(x);
  15567. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  15568. }));
  15569. $ctx1.sendIdx["hashBlock:"]=1;
  15570. self["@slowBucketStores"]=[$1,$recv($ArrayBucketStore())._hashBlock_((function(x){
  15571. return $core.withContext(function($ctx2) {
  15572. return self._jsConstructorNameOf_(x);
  15573. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  15574. }))];
  15575. return self;
  15576. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  15577. },
  15578. args: [],
  15579. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  15580. referencedClasses: ["ArrayBucketStore"],
  15581. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  15582. }),
  15583. $globals.Set);
  15584. $core.addMethod(
  15585. $core.method({
  15586. selector: "jsConstructorNameOf:",
  15587. protocol: 'private',
  15588. fn: function (anObject){
  15589. var self=this;
  15590. return $core.withContext(function($ctx1) {
  15591. return anObject.constructor && anObject.constructor.name;
  15592. return self;
  15593. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  15594. },
  15595. args: ["anObject"],
  15596. source: "jsConstructorNameOf: anObject\x0a\x09<return anObject.constructor && anObject.constructor.name>",
  15597. referencedClasses: [],
  15598. messageSends: []
  15599. }),
  15600. $globals.Set);
  15601. $core.addMethod(
  15602. $core.method({
  15603. selector: "printOn:",
  15604. protocol: 'printing',
  15605. fn: function (aStream){
  15606. var self=this;
  15607. return $core.withContext(function($ctx1) {
  15608. (
  15609. $ctx1.supercall = true,
  15610. ($globals.Set.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  15611. $ctx1.supercall = false;
  15612. $ctx1.sendIdx["printOn:"]=1;
  15613. $recv(aStream)._nextPutAll_(" (");
  15614. $ctx1.sendIdx["nextPutAll:"]=1;
  15615. self._do_separatedBy_((function(each){
  15616. return $core.withContext(function($ctx2) {
  15617. return $recv(each)._printOn_(aStream);
  15618. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15619. }),(function(){
  15620. return $core.withContext(function($ctx2) {
  15621. return $recv(aStream)._nextPutAll_(" ");
  15622. $ctx2.sendIdx["nextPutAll:"]=2;
  15623. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15624. }));
  15625. $recv(aStream)._nextPutAll_(")");
  15626. return self;
  15627. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  15628. },
  15629. args: ["aStream"],
  15630. 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: ')'",
  15631. referencedClasses: [],
  15632. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  15633. }),
  15634. $globals.Set);
  15635. $core.addMethod(
  15636. $core.method({
  15637. selector: "remove:ifAbsent:",
  15638. protocol: 'adding/removing',
  15639. fn: function (anObject,aBlock){
  15640. var self=this;
  15641. var bucket;
  15642. return $core.withContext(function($ctx1) {
  15643. var $1,$2,$3,$receiver;
  15644. var $early={};
  15645. try {
  15646. bucket=self._bucketsOfElement_(anObject);
  15647. $1=$recv(bucket)._second();
  15648. if(($receiver = $1) == null || $receiver.isNil){
  15649. $2=$recv(bucket)._third();
  15650. $3=$recv(bucket)._first();
  15651. $ctx1.sendIdx["first"]=1;
  15652. $recv($2)._remove_ifAbsent_($3,(function(){
  15653. return $core.withContext(function($ctx2) {
  15654. throw $early=[$recv(aBlock)._value()];
  15655. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15656. }));
  15657. self["@size"]=$recv(self["@size"]).__minus((1));
  15658. return self["@size"];
  15659. } else {
  15660. var primitiveBucket;
  15661. primitiveBucket=$receiver;
  15662. return self._remove_in_($recv(bucket)._first(),primitiveBucket);
  15663. };
  15664. }
  15665. catch(e) {if(e===$early)return e[0]; throw e}
  15666. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  15667. },
  15668. args: ["anObject", "aBlock"],
  15669. 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 ]",
  15670. referencedClasses: [],
  15671. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  15672. }),
  15673. $globals.Set);
  15674. $core.addMethod(
  15675. $core.method({
  15676. selector: "remove:in:",
  15677. protocol: 'private',
  15678. fn: function (anObject,anotherObject){
  15679. var self=this;
  15680. return $core.withContext(function($ctx1) {
  15681. if (delete anotherObject.store[anObject]) self['@size']--;
  15682. return self;
  15683. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  15684. },
  15685. args: ["anObject", "anotherObject"],
  15686. source: "remove: anObject in: anotherObject\x0a\x09<if (delete anotherObject.store[anObject]) self['@size']-->",
  15687. referencedClasses: [],
  15688. messageSends: []
  15689. }),
  15690. $globals.Set);
  15691. $core.addMethod(
  15692. $core.method({
  15693. selector: "removeAll",
  15694. protocol: 'adding/removing',
  15695. fn: function (){
  15696. var self=this;
  15697. return $core.withContext(function($ctx1) {
  15698. self['@fastBuckets'] = {
  15699. 'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },
  15700. 'number': { store: Object.create(null), fn: Number },
  15701. 'string': { store: Object.create(null) }
  15702. };
  15703. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  15704. self['@defaultBucket']._removeAll();
  15705. self['@size'] = 0;
  15706. ;
  15707. return self;
  15708. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  15709. },
  15710. args: [],
  15711. 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>",
  15712. referencedClasses: [],
  15713. messageSends: []
  15714. }),
  15715. $globals.Set);
  15716. $core.addMethod(
  15717. $core.method({
  15718. selector: "select:",
  15719. protocol: 'enumerating',
  15720. fn: function (aBlock){
  15721. var self=this;
  15722. var collection;
  15723. return $core.withContext(function($ctx1) {
  15724. var $1;
  15725. collection=$recv(self._class())._new();
  15726. self._do_((function(each){
  15727. return $core.withContext(function($ctx2) {
  15728. $1=$recv(aBlock)._value_(each);
  15729. if($core.assert($1)){
  15730. return $recv(collection)._add_(each);
  15731. };
  15732. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15733. }));
  15734. return collection;
  15735. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  15736. },
  15737. args: ["aBlock"],
  15738. 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",
  15739. referencedClasses: [],
  15740. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  15741. }),
  15742. $globals.Set);
  15743. $core.addMethod(
  15744. $core.method({
  15745. selector: "size",
  15746. protocol: 'accessing',
  15747. fn: function (){
  15748. var self=this;
  15749. return self["@size"];
  15750. },
  15751. args: [],
  15752. source: "size\x0a\x09^ size",
  15753. referencedClasses: [],
  15754. messageSends: []
  15755. }),
  15756. $globals.Set);
  15757. $core.addClass('ProtoStream', $globals.Object, [], 'Kernel-Collections');
  15758. $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.";
  15759. $core.addMethod(
  15760. $core.method({
  15761. selector: "<<",
  15762. protocol: 'writing',
  15763. fn: function (anObject){
  15764. var self=this;
  15765. return $core.withContext(function($ctx1) {
  15766. self._write_(anObject);
  15767. return self;
  15768. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  15769. },
  15770. args: ["anObject"],
  15771. source: "<< anObject\x0a\x09self write: anObject",
  15772. referencedClasses: [],
  15773. messageSends: ["write:"]
  15774. }),
  15775. $globals.ProtoStream);
  15776. $core.addMethod(
  15777. $core.method({
  15778. selector: "atEnd",
  15779. protocol: 'testing',
  15780. fn: function (){
  15781. var self=this;
  15782. return $core.withContext(function($ctx1) {
  15783. self._subclassResponsibility();
  15784. return self;
  15785. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  15786. },
  15787. args: [],
  15788. source: "atEnd\x0a\x09self subclassResponsibility",
  15789. referencedClasses: [],
  15790. messageSends: ["subclassResponsibility"]
  15791. }),
  15792. $globals.ProtoStream);
  15793. $core.addMethod(
  15794. $core.method({
  15795. selector: "atStart",
  15796. protocol: 'testing',
  15797. fn: function (){
  15798. var self=this;
  15799. return $core.withContext(function($ctx1) {
  15800. self._subclassResponsibility();
  15801. return self;
  15802. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  15803. },
  15804. args: [],
  15805. source: "atStart\x0a\x09self subclassResponsibility",
  15806. referencedClasses: [],
  15807. messageSends: ["subclassResponsibility"]
  15808. }),
  15809. $globals.ProtoStream);
  15810. $core.addMethod(
  15811. $core.method({
  15812. selector: "contents",
  15813. protocol: 'accessing',
  15814. fn: function (){
  15815. var self=this;
  15816. return $core.withContext(function($ctx1) {
  15817. self._subclassResponsibility();
  15818. return self;
  15819. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  15820. },
  15821. args: [],
  15822. source: "contents\x0a\x09self subclassResponsibility",
  15823. referencedClasses: [],
  15824. messageSends: ["subclassResponsibility"]
  15825. }),
  15826. $globals.ProtoStream);
  15827. $core.addMethod(
  15828. $core.method({
  15829. selector: "do:",
  15830. protocol: 'enumerating',
  15831. fn: function (aBlock){
  15832. var self=this;
  15833. return $core.withContext(function($ctx1) {
  15834. $recv((function(){
  15835. return $core.withContext(function($ctx2) {
  15836. return self._atEnd();
  15837. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15838. }))._whileFalse_((function(){
  15839. return $core.withContext(function($ctx2) {
  15840. return $recv(aBlock)._value_(self._next());
  15841. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15842. }));
  15843. return self;
  15844. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  15845. },
  15846. args: ["aBlock"],
  15847. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  15848. referencedClasses: [],
  15849. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  15850. }),
  15851. $globals.ProtoStream);
  15852. $core.addMethod(
  15853. $core.method({
  15854. selector: "isEmpty",
  15855. protocol: 'testing',
  15856. fn: function (){
  15857. var self=this;
  15858. return $core.withContext(function($ctx1) {
  15859. return $recv(self._atStart())._and_((function(){
  15860. return $core.withContext(function($ctx2) {
  15861. return self._atEnd();
  15862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15863. }));
  15864. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  15865. },
  15866. args: [],
  15867. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  15868. referencedClasses: [],
  15869. messageSends: ["and:", "atStart", "atEnd"]
  15870. }),
  15871. $globals.ProtoStream);
  15872. $core.addMethod(
  15873. $core.method({
  15874. selector: "next",
  15875. protocol: 'reading',
  15876. fn: function (){
  15877. var self=this;
  15878. return $core.withContext(function($ctx1) {
  15879. var $1;
  15880. $1=self._atEnd();
  15881. if($core.assert($1)){
  15882. return nil;
  15883. } else {
  15884. return self._subclassResponsibility();
  15885. };
  15886. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  15887. },
  15888. args: [],
  15889. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  15890. referencedClasses: [],
  15891. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  15892. }),
  15893. $globals.ProtoStream);
  15894. $core.addMethod(
  15895. $core.method({
  15896. selector: "nextPut:",
  15897. protocol: 'writing',
  15898. fn: function (anObject){
  15899. var self=this;
  15900. return $core.withContext(function($ctx1) {
  15901. self._subclassResponsibility();
  15902. return self;
  15903. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  15904. },
  15905. args: ["anObject"],
  15906. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  15907. referencedClasses: [],
  15908. messageSends: ["subclassResponsibility"]
  15909. }),
  15910. $globals.ProtoStream);
  15911. $core.addMethod(
  15912. $core.method({
  15913. selector: "nextPutAll:",
  15914. protocol: 'writing',
  15915. fn: function (aCollection){
  15916. var self=this;
  15917. return $core.withContext(function($ctx1) {
  15918. $recv(aCollection)._do_((function(each){
  15919. return $core.withContext(function($ctx2) {
  15920. return self._nextPut_(each);
  15921. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15922. }));
  15923. return self;
  15924. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  15925. },
  15926. args: ["aCollection"],
  15927. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  15928. referencedClasses: [],
  15929. messageSends: ["do:", "nextPut:"]
  15930. }),
  15931. $globals.ProtoStream);
  15932. $core.addMethod(
  15933. $core.method({
  15934. selector: "nextPutJSObject:",
  15935. protocol: 'writing',
  15936. fn: function (aJSObject){
  15937. var self=this;
  15938. return $core.withContext(function($ctx1) {
  15939. self._nextPut_(aJSObject);
  15940. return self;
  15941. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  15942. },
  15943. args: ["aJSObject"],
  15944. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  15945. referencedClasses: [],
  15946. messageSends: ["nextPut:"]
  15947. }),
  15948. $globals.ProtoStream);
  15949. $core.addMethod(
  15950. $core.method({
  15951. selector: "nextPutString:",
  15952. protocol: 'writing',
  15953. fn: function (aString){
  15954. var self=this;
  15955. return $core.withContext(function($ctx1) {
  15956. self._nextPut_(aString);
  15957. return self;
  15958. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  15959. },
  15960. args: ["aString"],
  15961. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  15962. referencedClasses: [],
  15963. messageSends: ["nextPut:"]
  15964. }),
  15965. $globals.ProtoStream);
  15966. $core.addMethod(
  15967. $core.method({
  15968. selector: "peek",
  15969. protocol: 'reading',
  15970. fn: function (){
  15971. var self=this;
  15972. return $core.withContext(function($ctx1) {
  15973. var $1;
  15974. $1=self._atEnd();
  15975. if($core.assert($1)){
  15976. return nil;
  15977. } else {
  15978. return self._subclassResponsibility();
  15979. };
  15980. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  15981. },
  15982. args: [],
  15983. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  15984. referencedClasses: [],
  15985. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  15986. }),
  15987. $globals.ProtoStream);
  15988. $core.addMethod(
  15989. $core.method({
  15990. selector: "reset",
  15991. protocol: 'actions',
  15992. fn: function (){
  15993. var self=this;
  15994. return $core.withContext(function($ctx1) {
  15995. self._subclassResponsibility();
  15996. return self;
  15997. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  15998. },
  15999. args: [],
  16000. source: "reset\x0a\x09self subclassResponsibility",
  16001. referencedClasses: [],
  16002. messageSends: ["subclassResponsibility"]
  16003. }),
  16004. $globals.ProtoStream);
  16005. $core.addMethod(
  16006. $core.method({
  16007. selector: "resetContents",
  16008. protocol: 'actions',
  16009. fn: function (){
  16010. var self=this;
  16011. return $core.withContext(function($ctx1) {
  16012. self._subclassResponsibility();
  16013. return self;
  16014. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  16015. },
  16016. args: [],
  16017. source: "resetContents\x0a\x09self subclassResponsibility",
  16018. referencedClasses: [],
  16019. messageSends: ["subclassResponsibility"]
  16020. }),
  16021. $globals.ProtoStream);
  16022. $core.addMethod(
  16023. $core.method({
  16024. selector: "setToEnd",
  16025. protocol: 'positioning',
  16026. fn: function (){
  16027. var self=this;
  16028. return $core.withContext(function($ctx1) {
  16029. self._subclassResponsibility();
  16030. return self;
  16031. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  16032. },
  16033. args: [],
  16034. source: "setToEnd\x0a\x09self subclassResponsibility",
  16035. referencedClasses: [],
  16036. messageSends: ["subclassResponsibility"]
  16037. }),
  16038. $globals.ProtoStream);
  16039. $core.addMethod(
  16040. $core.method({
  16041. selector: "setToStart",
  16042. protocol: 'positioning',
  16043. fn: function (){
  16044. var self=this;
  16045. return $core.withContext(function($ctx1) {
  16046. self._reset();
  16047. return self;
  16048. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  16049. },
  16050. args: [],
  16051. source: "setToStart\x0a\x09self reset",
  16052. referencedClasses: [],
  16053. messageSends: ["reset"]
  16054. }),
  16055. $globals.ProtoStream);
  16056. $core.addMethod(
  16057. $core.method({
  16058. selector: "write:",
  16059. protocol: 'writing',
  16060. fn: function (anObject){
  16061. var self=this;
  16062. return $core.withContext(function($ctx1) {
  16063. $recv(anObject)._putOn_(self);
  16064. return self;
  16065. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  16066. },
  16067. args: ["anObject"],
  16068. source: "write: anObject\x0a\x09anObject putOn: self",
  16069. referencedClasses: [],
  16070. messageSends: ["putOn:"]
  16071. }),
  16072. $globals.ProtoStream);
  16073. $core.addMethod(
  16074. $core.method({
  16075. selector: "on:",
  16076. protocol: 'instance creation',
  16077. fn: function (aCollection){
  16078. var self=this;
  16079. return $core.withContext(function($ctx1) {
  16080. var $1;
  16081. $1=self._new();
  16082. $recv($1)._setCollection_(aCollection);
  16083. $recv($1)._setStreamSize_($recv(aCollection)._size());
  16084. return $recv($1)._yourself();
  16085. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.klass)});
  16086. },
  16087. args: ["aCollection"],
  16088. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  16089. referencedClasses: [],
  16090. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  16091. }),
  16092. $globals.ProtoStream.klass);
  16093. $core.addClass('Stream', $globals.ProtoStream, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  16094. $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.";
  16095. $core.addMethod(
  16096. $core.method({
  16097. selector: "atEnd",
  16098. protocol: 'testing',
  16099. fn: function (){
  16100. var self=this;
  16101. return $core.withContext(function($ctx1) {
  16102. return $recv(self._position()).__eq(self._size());
  16103. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  16104. },
  16105. args: [],
  16106. source: "atEnd\x0a\x09^ self position = self size",
  16107. referencedClasses: [],
  16108. messageSends: ["=", "position", "size"]
  16109. }),
  16110. $globals.Stream);
  16111. $core.addMethod(
  16112. $core.method({
  16113. selector: "atStart",
  16114. protocol: 'testing',
  16115. fn: function (){
  16116. var self=this;
  16117. return $core.withContext(function($ctx1) {
  16118. return $recv(self._position()).__eq((0));
  16119. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  16120. },
  16121. args: [],
  16122. source: "atStart\x0a\x09^ self position = 0",
  16123. referencedClasses: [],
  16124. messageSends: ["=", "position"]
  16125. }),
  16126. $globals.Stream);
  16127. $core.addMethod(
  16128. $core.method({
  16129. selector: "close",
  16130. protocol: 'actions',
  16131. fn: function (){
  16132. var self=this;
  16133. return self;
  16134. },
  16135. args: [],
  16136. source: "close",
  16137. referencedClasses: [],
  16138. messageSends: []
  16139. }),
  16140. $globals.Stream);
  16141. $core.addMethod(
  16142. $core.method({
  16143. selector: "collection",
  16144. protocol: 'accessing',
  16145. fn: function (){
  16146. var self=this;
  16147. return self["@collection"];
  16148. },
  16149. args: [],
  16150. source: "collection\x0a\x09^ collection",
  16151. referencedClasses: [],
  16152. messageSends: []
  16153. }),
  16154. $globals.Stream);
  16155. $core.addMethod(
  16156. $core.method({
  16157. selector: "contents",
  16158. protocol: 'accessing',
  16159. fn: function (){
  16160. var self=this;
  16161. return $core.withContext(function($ctx1) {
  16162. return $recv(self._collection())._copyFrom_to_((1),self._streamSize());
  16163. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  16164. },
  16165. args: [],
  16166. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  16167. referencedClasses: [],
  16168. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  16169. }),
  16170. $globals.Stream);
  16171. $core.addMethod(
  16172. $core.method({
  16173. selector: "flush",
  16174. protocol: 'actions',
  16175. fn: function (){
  16176. var self=this;
  16177. return self;
  16178. },
  16179. args: [],
  16180. source: "flush",
  16181. referencedClasses: [],
  16182. messageSends: []
  16183. }),
  16184. $globals.Stream);
  16185. $core.addMethod(
  16186. $core.method({
  16187. selector: "isEmpty",
  16188. protocol: 'testing',
  16189. fn: function (){
  16190. var self=this;
  16191. return $core.withContext(function($ctx1) {
  16192. return $recv(self._size()).__eq((0));
  16193. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  16194. },
  16195. args: [],
  16196. source: "isEmpty\x0a\x09^ self size = 0",
  16197. referencedClasses: [],
  16198. messageSends: ["=", "size"]
  16199. }),
  16200. $globals.Stream);
  16201. $core.addMethod(
  16202. $core.method({
  16203. selector: "next",
  16204. protocol: 'reading',
  16205. fn: function (){
  16206. var self=this;
  16207. return $core.withContext(function($ctx1) {
  16208. var $1,$3,$2;
  16209. $1=self._atEnd();
  16210. if($core.assert($1)){
  16211. return nil;
  16212. } else {
  16213. $3=self._position();
  16214. $ctx1.sendIdx["position"]=1;
  16215. $2=$recv($3).__plus((1));
  16216. self._position_($2);
  16217. return $recv(self["@collection"])._at_(self._position());
  16218. };
  16219. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  16220. },
  16221. args: [],
  16222. 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 ]",
  16223. referencedClasses: [],
  16224. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  16225. }),
  16226. $globals.Stream);
  16227. $core.addMethod(
  16228. $core.method({
  16229. selector: "next:",
  16230. protocol: 'reading',
  16231. fn: function (anInteger){
  16232. var self=this;
  16233. var tempCollection;
  16234. return $core.withContext(function($ctx1) {
  16235. var $1;
  16236. tempCollection=$recv($recv(self._collection())._class())._new();
  16237. $recv(anInteger)._timesRepeat_((function(){
  16238. return $core.withContext(function($ctx2) {
  16239. $1=self._atEnd();
  16240. if(!$core.assert($1)){
  16241. return $recv(tempCollection)._add_(self._next());
  16242. };
  16243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16244. }));
  16245. return tempCollection;
  16246. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  16247. },
  16248. args: ["anInteger"],
  16249. 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",
  16250. referencedClasses: [],
  16251. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  16252. }),
  16253. $globals.Stream);
  16254. $core.addMethod(
  16255. $core.method({
  16256. selector: "nextPut:",
  16257. protocol: 'writing',
  16258. fn: function (anObject){
  16259. var self=this;
  16260. return $core.withContext(function($ctx1) {
  16261. var $2,$1,$3,$4;
  16262. $2=self._position();
  16263. $ctx1.sendIdx["position"]=1;
  16264. $1=$recv($2).__plus((1));
  16265. self._position_($1);
  16266. $3=self._collection();
  16267. $4=self._position();
  16268. $ctx1.sendIdx["position"]=2;
  16269. $recv($3)._at_put_($4,anObject);
  16270. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  16271. return self;
  16272. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  16273. },
  16274. args: ["anObject"],
  16275. 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)",
  16276. referencedClasses: [],
  16277. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  16278. }),
  16279. $globals.Stream);
  16280. $core.addMethod(
  16281. $core.method({
  16282. selector: "peek",
  16283. protocol: 'reading',
  16284. fn: function (){
  16285. var self=this;
  16286. return $core.withContext(function($ctx1) {
  16287. var $1;
  16288. $1=self._atEnd();
  16289. if(!$core.assert($1)){
  16290. return $recv(self._collection())._at_($recv(self._position()).__plus((1)));
  16291. };
  16292. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  16293. },
  16294. args: [],
  16295. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  16296. referencedClasses: [],
  16297. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  16298. }),
  16299. $globals.Stream);
  16300. $core.addMethod(
  16301. $core.method({
  16302. selector: "position",
  16303. protocol: 'accessing',
  16304. fn: function (){
  16305. var self=this;
  16306. return $core.withContext(function($ctx1) {
  16307. var $1,$receiver;
  16308. $1=self["@position"];
  16309. if(($receiver = $1) == null || $receiver.isNil){
  16310. self["@position"]=(0);
  16311. return self["@position"];
  16312. } else {
  16313. return $1;
  16314. };
  16315. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  16316. },
  16317. args: [],
  16318. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  16319. referencedClasses: [],
  16320. messageSends: ["ifNil:"]
  16321. }),
  16322. $globals.Stream);
  16323. $core.addMethod(
  16324. $core.method({
  16325. selector: "position:",
  16326. protocol: 'accessing',
  16327. fn: function (anInteger){
  16328. var self=this;
  16329. self["@position"]=anInteger;
  16330. return self;
  16331. },
  16332. args: ["anInteger"],
  16333. source: "position: anInteger\x0a\x09position := anInteger",
  16334. referencedClasses: [],
  16335. messageSends: []
  16336. }),
  16337. $globals.Stream);
  16338. $core.addMethod(
  16339. $core.method({
  16340. selector: "reset",
  16341. protocol: 'actions',
  16342. fn: function (){
  16343. var self=this;
  16344. return $core.withContext(function($ctx1) {
  16345. self._position_((0));
  16346. return self;
  16347. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  16348. },
  16349. args: [],
  16350. source: "reset\x0a\x09self position: 0",
  16351. referencedClasses: [],
  16352. messageSends: ["position:"]
  16353. }),
  16354. $globals.Stream);
  16355. $core.addMethod(
  16356. $core.method({
  16357. selector: "resetContents",
  16358. protocol: 'actions',
  16359. fn: function (){
  16360. var self=this;
  16361. return $core.withContext(function($ctx1) {
  16362. self._reset();
  16363. self._setStreamSize_((0));
  16364. return self;
  16365. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  16366. },
  16367. args: [],
  16368. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  16369. referencedClasses: [],
  16370. messageSends: ["reset", "setStreamSize:"]
  16371. }),
  16372. $globals.Stream);
  16373. $core.addMethod(
  16374. $core.method({
  16375. selector: "setCollection:",
  16376. protocol: 'accessing',
  16377. fn: function (aCollection){
  16378. var self=this;
  16379. self["@collection"]=aCollection;
  16380. return self;
  16381. },
  16382. args: ["aCollection"],
  16383. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  16384. referencedClasses: [],
  16385. messageSends: []
  16386. }),
  16387. $globals.Stream);
  16388. $core.addMethod(
  16389. $core.method({
  16390. selector: "setStreamSize:",
  16391. protocol: 'accessing',
  16392. fn: function (anInteger){
  16393. var self=this;
  16394. self["@streamSize"]=anInteger;
  16395. return self;
  16396. },
  16397. args: ["anInteger"],
  16398. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  16399. referencedClasses: [],
  16400. messageSends: []
  16401. }),
  16402. $globals.Stream);
  16403. $core.addMethod(
  16404. $core.method({
  16405. selector: "setToEnd",
  16406. protocol: 'positioning',
  16407. fn: function (){
  16408. var self=this;
  16409. return $core.withContext(function($ctx1) {
  16410. self._position_(self._size());
  16411. return self;
  16412. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  16413. },
  16414. args: [],
  16415. source: "setToEnd\x0a\x09self position: self size",
  16416. referencedClasses: [],
  16417. messageSends: ["position:", "size"]
  16418. }),
  16419. $globals.Stream);
  16420. $core.addMethod(
  16421. $core.method({
  16422. selector: "size",
  16423. protocol: 'accessing',
  16424. fn: function (){
  16425. var self=this;
  16426. return $core.withContext(function($ctx1) {
  16427. return self._streamSize();
  16428. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  16429. },
  16430. args: [],
  16431. source: "size\x0a\x09^ self streamSize",
  16432. referencedClasses: [],
  16433. messageSends: ["streamSize"]
  16434. }),
  16435. $globals.Stream);
  16436. $core.addMethod(
  16437. $core.method({
  16438. selector: "skip:",
  16439. protocol: 'positioning',
  16440. fn: function (anInteger){
  16441. var self=this;
  16442. return $core.withContext(function($ctx1) {
  16443. self._position_($recv($recv(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  16444. return self;
  16445. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  16446. },
  16447. args: ["anInteger"],
  16448. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  16449. referencedClasses: [],
  16450. messageSends: ["position:", "min:max:", "+", "position", "size"]
  16451. }),
  16452. $globals.Stream);
  16453. $core.addMethod(
  16454. $core.method({
  16455. selector: "streamSize",
  16456. protocol: 'accessing',
  16457. fn: function (){
  16458. var self=this;
  16459. return self["@streamSize"];
  16460. },
  16461. args: [],
  16462. source: "streamSize\x0a\x09^ streamSize",
  16463. referencedClasses: [],
  16464. messageSends: []
  16465. }),
  16466. $globals.Stream);
  16467. $core.addMethod(
  16468. $core.method({
  16469. selector: "on:",
  16470. protocol: 'instance creation',
  16471. fn: function (aCollection){
  16472. var self=this;
  16473. return $core.withContext(function($ctx1) {
  16474. var $1;
  16475. $1=self._new();
  16476. $recv($1)._setCollection_(aCollection);
  16477. $recv($1)._setStreamSize_($recv(aCollection)._size());
  16478. return $recv($1)._yourself();
  16479. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.klass)});
  16480. },
  16481. args: ["aCollection"],
  16482. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  16483. referencedClasses: [],
  16484. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  16485. }),
  16486. $globals.Stream.klass);
  16487. $core.addClass('StringStream', $globals.Stream, [], 'Kernel-Collections');
  16488. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  16489. $core.addMethod(
  16490. $core.method({
  16491. selector: "cr",
  16492. protocol: 'writing',
  16493. fn: function (){
  16494. var self=this;
  16495. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  16496. return $core.withContext(function($ctx1) {
  16497. return self._nextPutAll_($recv($String())._cr());
  16498. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  16499. },
  16500. args: [],
  16501. source: "cr\x0a\x09^ self nextPutAll: String cr",
  16502. referencedClasses: ["String"],
  16503. messageSends: ["nextPutAll:", "cr"]
  16504. }),
  16505. $globals.StringStream);
  16506. $core.addMethod(
  16507. $core.method({
  16508. selector: "crlf",
  16509. protocol: 'writing',
  16510. fn: function (){
  16511. var self=this;
  16512. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  16513. return $core.withContext(function($ctx1) {
  16514. return self._nextPutAll_($recv($String())._crlf());
  16515. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  16516. },
  16517. args: [],
  16518. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  16519. referencedClasses: ["String"],
  16520. messageSends: ["nextPutAll:", "crlf"]
  16521. }),
  16522. $globals.StringStream);
  16523. $core.addMethod(
  16524. $core.method({
  16525. selector: "lf",
  16526. protocol: 'writing',
  16527. fn: function (){
  16528. var self=this;
  16529. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  16530. return $core.withContext(function($ctx1) {
  16531. return self._nextPutAll_($recv($String())._lf());
  16532. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  16533. },
  16534. args: [],
  16535. source: "lf\x0a\x09^ self nextPutAll: String lf",
  16536. referencedClasses: ["String"],
  16537. messageSends: ["nextPutAll:", "lf"]
  16538. }),
  16539. $globals.StringStream);
  16540. $core.addMethod(
  16541. $core.method({
  16542. selector: "next:",
  16543. protocol: 'reading',
  16544. fn: function (anInteger){
  16545. var self=this;
  16546. var tempCollection;
  16547. return $core.withContext(function($ctx1) {
  16548. var $1;
  16549. tempCollection=$recv($recv(self._collection())._class())._new();
  16550. $recv(anInteger)._timesRepeat_((function(){
  16551. return $core.withContext(function($ctx2) {
  16552. $1=self._atEnd();
  16553. if(!$core.assert($1)){
  16554. tempCollection=$recv(tempCollection).__comma(self._next());
  16555. return tempCollection;
  16556. };
  16557. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16558. }));
  16559. return tempCollection;
  16560. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  16561. },
  16562. args: ["anInteger"],
  16563. 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",
  16564. referencedClasses: [],
  16565. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  16566. }),
  16567. $globals.StringStream);
  16568. $core.addMethod(
  16569. $core.method({
  16570. selector: "nextPut:",
  16571. protocol: 'writing',
  16572. fn: function (aString){
  16573. var self=this;
  16574. return $core.withContext(function($ctx1) {
  16575. self._nextPutAll_(aString);
  16576. return self;
  16577. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  16578. },
  16579. args: ["aString"],
  16580. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  16581. referencedClasses: [],
  16582. messageSends: ["nextPutAll:"]
  16583. }),
  16584. $globals.StringStream);
  16585. $core.addMethod(
  16586. $core.method({
  16587. selector: "nextPutAll:",
  16588. protocol: 'writing',
  16589. fn: function (aString){
  16590. var self=this;
  16591. var pre,post;
  16592. return $core.withContext(function($ctx1) {
  16593. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  16594. $1=self._atEnd();
  16595. if($core.assert($1)){
  16596. $3=self._collection();
  16597. $ctx1.sendIdx["collection"]=1;
  16598. $2=$recv($3).__comma(aString);
  16599. $ctx1.sendIdx[","]=1;
  16600. self._setCollection_($2);
  16601. $ctx1.sendIdx["setCollection:"]=1;
  16602. } else {
  16603. $4=self._collection();
  16604. $ctx1.sendIdx["collection"]=2;
  16605. $5=self._position();
  16606. $ctx1.sendIdx["position"]=1;
  16607. pre=$recv($4)._copyFrom_to_((1),$5);
  16608. $ctx1.sendIdx["copyFrom:to:"]=1;
  16609. pre;
  16610. $6=self._collection();
  16611. $ctx1.sendIdx["collection"]=3;
  16612. $9=self._position();
  16613. $ctx1.sendIdx["position"]=2;
  16614. $8=$recv($9).__plus((1));
  16615. $ctx1.sendIdx["+"]=2;
  16616. $10=$recv(aString)._size();
  16617. $ctx1.sendIdx["size"]=1;
  16618. $7=$recv($8).__plus($10);
  16619. $ctx1.sendIdx["+"]=1;
  16620. $11=$recv(self._collection())._size();
  16621. $ctx1.sendIdx["size"]=2;
  16622. post=$recv($6)._copyFrom_to_($7,$11);
  16623. post;
  16624. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  16625. $ctx1.sendIdx[","]=2;
  16626. self._setCollection_($12);
  16627. };
  16628. $14=self._position();
  16629. $ctx1.sendIdx["position"]=3;
  16630. $13=$recv($14).__plus($recv(aString)._size());
  16631. self._position_($13);
  16632. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  16633. return self;
  16634. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  16635. },
  16636. args: ["aString"],
  16637. 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)",
  16638. referencedClasses: [],
  16639. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  16640. }),
  16641. $globals.StringStream);
  16642. $core.addMethod(
  16643. $core.method({
  16644. selector: "nextPutString:",
  16645. protocol: 'writing',
  16646. fn: function (aString){
  16647. var self=this;
  16648. return $core.withContext(function($ctx1) {
  16649. self._nextPutAll_(aString);
  16650. return self;
  16651. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  16652. },
  16653. args: ["aString"],
  16654. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  16655. referencedClasses: [],
  16656. messageSends: ["nextPutAll:"]
  16657. }),
  16658. $globals.StringStream);
  16659. $core.addMethod(
  16660. $core.method({
  16661. selector: "space",
  16662. protocol: 'writing',
  16663. fn: function (){
  16664. var self=this;
  16665. return $core.withContext(function($ctx1) {
  16666. self._nextPut_(" ");
  16667. return self;
  16668. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  16669. },
  16670. args: [],
  16671. source: "space\x0a\x09self nextPut: ' '",
  16672. referencedClasses: [],
  16673. messageSends: ["nextPut:"]
  16674. }),
  16675. $globals.StringStream);
  16676. $core.addMethod(
  16677. $core.method({
  16678. selector: "tab",
  16679. protocol: 'writing',
  16680. fn: function (){
  16681. var self=this;
  16682. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  16683. return $core.withContext(function($ctx1) {
  16684. return self._nextPutAll_($recv($String())._tab());
  16685. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  16686. },
  16687. args: [],
  16688. source: "tab\x0a\x09^ self nextPutAll: String tab",
  16689. referencedClasses: ["String"],
  16690. messageSends: ["nextPutAll:", "tab"]
  16691. }),
  16692. $globals.StringStream);
  16693. $core.addClass('Queue', $globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  16694. $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.";
  16695. $core.addMethod(
  16696. $core.method({
  16697. selector: "initialize",
  16698. protocol: 'initialization',
  16699. fn: function (){
  16700. var self=this;
  16701. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  16702. return $core.withContext(function($ctx1) {
  16703. (
  16704. $ctx1.supercall = true,
  16705. ($globals.Queue.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  16706. $ctx1.supercall = false;
  16707. self["@read"]=$recv($OrderedCollection())._new();
  16708. $ctx1.sendIdx["new"]=1;
  16709. self["@write"]=$recv($OrderedCollection())._new();
  16710. self["@readIndex"]=(1);
  16711. return self;
  16712. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  16713. },
  16714. args: [],
  16715. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  16716. referencedClasses: ["OrderedCollection"],
  16717. messageSends: ["initialize", "new"]
  16718. }),
  16719. $globals.Queue);
  16720. $core.addMethod(
  16721. $core.method({
  16722. selector: "next",
  16723. protocol: 'accessing',
  16724. fn: function (){
  16725. var self=this;
  16726. return $core.withContext(function($ctx1) {
  16727. return self._nextIfAbsent_((function(){
  16728. return $core.withContext(function($ctx2) {
  16729. return self._error_("Cannot read from empty Queue.");
  16730. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16731. }));
  16732. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  16733. },
  16734. args: [],
  16735. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  16736. referencedClasses: [],
  16737. messageSends: ["nextIfAbsent:", "error:"]
  16738. }),
  16739. $globals.Queue);
  16740. $core.addMethod(
  16741. $core.method({
  16742. selector: "nextIfAbsent:",
  16743. protocol: 'accessing',
  16744. fn: function (aBlock){
  16745. var self=this;
  16746. var result;
  16747. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  16748. return $core.withContext(function($ctx1) {
  16749. var $1,$2;
  16750. var $early={};
  16751. try {
  16752. result=$recv(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  16753. return $core.withContext(function($ctx2) {
  16754. $1=$recv(self["@write"])._isEmpty();
  16755. if($core.assert($1)){
  16756. $2=$recv(self["@readIndex"]).__gt((1));
  16757. if($core.assert($2)){
  16758. self["@read"]=[];
  16759. self["@read"];
  16760. self["@readIndex"]=(1);
  16761. self["@readIndex"];
  16762. };
  16763. throw $early=[$recv(aBlock)._value()];
  16764. };
  16765. self["@read"]=self["@write"];
  16766. self["@read"];
  16767. self["@readIndex"]=(1);
  16768. self["@readIndex"];
  16769. self["@write"]=$recv($OrderedCollection())._new();
  16770. self["@write"];
  16771. return $recv(self["@read"])._first();
  16772. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16773. }));
  16774. $recv(self["@read"])._at_put_(self["@readIndex"],nil);
  16775. self["@readIndex"]=$recv(self["@readIndex"]).__plus((1));
  16776. return result;
  16777. }
  16778. catch(e) {if(e===$early)return e[0]; throw e}
  16779. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  16780. },
  16781. args: ["aBlock"],
  16782. 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",
  16783. referencedClasses: ["OrderedCollection"],
  16784. messageSends: ["at:ifAbsent:", "ifTrue:", "isEmpty", ">", "value", "new", "first", "at:put:", "+"]
  16785. }),
  16786. $globals.Queue);
  16787. $core.addMethod(
  16788. $core.method({
  16789. selector: "nextPut:",
  16790. protocol: 'accessing',
  16791. fn: function (anObject){
  16792. var self=this;
  16793. return $core.withContext(function($ctx1) {
  16794. $recv(self["@write"])._add_(anObject);
  16795. return self;
  16796. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  16797. },
  16798. args: ["anObject"],
  16799. source: "nextPut: anObject\x0a\x09write add: anObject",
  16800. referencedClasses: [],
  16801. messageSends: ["add:"]
  16802. }),
  16803. $globals.Queue);
  16804. $core.addClass('RegularExpression', $globals.Object, [], 'Kernel-Collections');
  16805. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  16806. $core.addMethod(
  16807. $core.method({
  16808. selector: "compile:",
  16809. protocol: 'evaluating',
  16810. fn: function (aString){
  16811. var self=this;
  16812. return $core.withContext(function($ctx1) {
  16813. return self.compile(aString);
  16814. return self;
  16815. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  16816. },
  16817. args: ["aString"],
  16818. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  16819. referencedClasses: [],
  16820. messageSends: []
  16821. }),
  16822. $globals.RegularExpression);
  16823. $core.addMethod(
  16824. $core.method({
  16825. selector: "exec:",
  16826. protocol: 'evaluating',
  16827. fn: function (aString){
  16828. var self=this;
  16829. return $core.withContext(function($ctx1) {
  16830. return self.exec(aString) || nil;
  16831. return self;
  16832. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  16833. },
  16834. args: ["aString"],
  16835. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  16836. referencedClasses: [],
  16837. messageSends: []
  16838. }),
  16839. $globals.RegularExpression);
  16840. $core.addMethod(
  16841. $core.method({
  16842. selector: "test:",
  16843. protocol: 'evaluating',
  16844. fn: function (aString){
  16845. var self=this;
  16846. return $core.withContext(function($ctx1) {
  16847. return self.test(aString);
  16848. return self;
  16849. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  16850. },
  16851. args: ["aString"],
  16852. source: "test: aString\x0a\x09<return self.test(aString)>",
  16853. referencedClasses: [],
  16854. messageSends: []
  16855. }),
  16856. $globals.RegularExpression);
  16857. $core.addMethod(
  16858. $core.method({
  16859. selector: "fromString:",
  16860. protocol: 'instance creation',
  16861. fn: function (aString){
  16862. var self=this;
  16863. return $core.withContext(function($ctx1) {
  16864. return self._fromString_flag_(aString,"");
  16865. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.klass)});
  16866. },
  16867. args: ["aString"],
  16868. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  16869. referencedClasses: [],
  16870. messageSends: ["fromString:flag:"]
  16871. }),
  16872. $globals.RegularExpression.klass);
  16873. $core.addMethod(
  16874. $core.method({
  16875. selector: "fromString:flag:",
  16876. protocol: 'instance creation',
  16877. fn: function (aString,anotherString){
  16878. var self=this;
  16879. return $core.withContext(function($ctx1) {
  16880. return new RegExp(aString, anotherString);
  16881. return self;
  16882. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.klass)});
  16883. },
  16884. args: ["aString", "anotherString"],
  16885. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  16886. referencedClasses: [],
  16887. messageSends: []
  16888. }),
  16889. $globals.RegularExpression.klass);
  16890. });
  16891. define("amber_core/Kernel-Exceptions", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  16892. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  16893. $core.addPackage('Kernel-Exceptions');
  16894. $core.packages["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
  16895. $core.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  16896. $core.addClass('Error', $globals.Object, ['messageText'], 'Kernel-Exceptions');
  16897. $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.";
  16898. $core.addMethod(
  16899. $core.method({
  16900. selector: "beHandled",
  16901. protocol: 'accessing',
  16902. fn: function (){
  16903. var self=this;
  16904. return $core.withContext(function($ctx1) {
  16905. self.amberHandled = true;
  16906. return self;
  16907. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  16908. },
  16909. args: [],
  16910. source: "beHandled\x0a\x09<self.amberHandled = true>",
  16911. referencedClasses: [],
  16912. messageSends: []
  16913. }),
  16914. $globals.Error);
  16915. $core.addMethod(
  16916. $core.method({
  16917. selector: "beUnhandled",
  16918. protocol: 'accessing',
  16919. fn: function (){
  16920. var self=this;
  16921. return $core.withContext(function($ctx1) {
  16922. self.amberHandled = false;
  16923. return self;
  16924. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  16925. },
  16926. args: [],
  16927. source: "beUnhandled\x0a\x09<self.amberHandled = false>",
  16928. referencedClasses: [],
  16929. messageSends: []
  16930. }),
  16931. $globals.Error);
  16932. $core.addMethod(
  16933. $core.method({
  16934. selector: "context",
  16935. protocol: 'accessing',
  16936. fn: function (){
  16937. var self=this;
  16938. return $core.withContext(function($ctx1) {
  16939. return self.context;
  16940. return self;
  16941. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  16942. },
  16943. args: [],
  16944. source: "context\x0a\x09<return self.context>",
  16945. referencedClasses: [],
  16946. messageSends: []
  16947. }),
  16948. $globals.Error);
  16949. $core.addMethod(
  16950. $core.method({
  16951. selector: "initialize",
  16952. protocol: 'initialization',
  16953. fn: function (){
  16954. var self=this;
  16955. return $core.withContext(function($ctx1) {
  16956. self._messageText_("Errorclass: ".__comma($recv(self._class())._name()));
  16957. return self;
  16958. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  16959. },
  16960. args: [],
  16961. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  16962. referencedClasses: [],
  16963. messageSends: ["messageText:", ",", "name", "class"]
  16964. }),
  16965. $globals.Error);
  16966. $core.addMethod(
  16967. $core.method({
  16968. selector: "isSmalltalkError",
  16969. protocol: 'testing',
  16970. fn: function (){
  16971. var self=this;
  16972. return $core.withContext(function($ctx1) {
  16973. return self.smalltalkError === true;
  16974. return self;
  16975. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  16976. },
  16977. args: [],
  16978. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  16979. referencedClasses: [],
  16980. messageSends: []
  16981. }),
  16982. $globals.Error);
  16983. $core.addMethod(
  16984. $core.method({
  16985. selector: "jsStack",
  16986. protocol: 'accessing',
  16987. fn: function (){
  16988. var self=this;
  16989. return $core.withContext(function($ctx1) {
  16990. return self.stack;
  16991. return self;
  16992. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  16993. },
  16994. args: [],
  16995. source: "jsStack\x0a\x09<return self.stack>",
  16996. referencedClasses: [],
  16997. messageSends: []
  16998. }),
  16999. $globals.Error);
  17000. $core.addMethod(
  17001. $core.method({
  17002. selector: "messageText",
  17003. protocol: 'accessing',
  17004. fn: function (){
  17005. var self=this;
  17006. return self["@messageText"];
  17007. },
  17008. args: [],
  17009. source: "messageText\x0a\x09^ messageText",
  17010. referencedClasses: [],
  17011. messageSends: []
  17012. }),
  17013. $globals.Error);
  17014. $core.addMethod(
  17015. $core.method({
  17016. selector: "messageText:",
  17017. protocol: 'accessing',
  17018. fn: function (aString){
  17019. var self=this;
  17020. self["@messageText"]=aString;
  17021. return self;
  17022. },
  17023. args: ["aString"],
  17024. source: "messageText: aString\x0a\x09messageText := aString",
  17025. referencedClasses: [],
  17026. messageSends: []
  17027. }),
  17028. $globals.Error);
  17029. $core.addMethod(
  17030. $core.method({
  17031. selector: "resignal",
  17032. protocol: 'signaling',
  17033. fn: function (){
  17034. var self=this;
  17035. return $core.withContext(function($ctx1) {
  17036. self.amberHandled = false;
  17037. throw(self);
  17038. ;
  17039. return self;
  17040. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  17041. },
  17042. args: [],
  17043. 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>",
  17044. referencedClasses: [],
  17045. messageSends: []
  17046. }),
  17047. $globals.Error);
  17048. $core.addMethod(
  17049. $core.method({
  17050. selector: "signal",
  17051. protocol: 'signaling',
  17052. fn: function (){
  17053. var self=this;
  17054. return $core.withContext(function($ctx1) {
  17055. self.amberHandled = false;
  17056. self.context = $core.getThisContext();
  17057. self.smalltalkError = true;
  17058. throw self;
  17059. ;
  17060. return self;
  17061. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  17062. },
  17063. args: [],
  17064. 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>",
  17065. referencedClasses: [],
  17066. messageSends: []
  17067. }),
  17068. $globals.Error);
  17069. $core.addMethod(
  17070. $core.method({
  17071. selector: "signal:",
  17072. protocol: 'signaling',
  17073. fn: function (aString){
  17074. var self=this;
  17075. return $core.withContext(function($ctx1) {
  17076. self._messageText_(aString);
  17077. self._signal();
  17078. return self;
  17079. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  17080. },
  17081. args: ["aString"],
  17082. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  17083. referencedClasses: [],
  17084. messageSends: ["messageText:", "signal"]
  17085. }),
  17086. $globals.Error);
  17087. $core.addMethod(
  17088. $core.method({
  17089. selector: "signalerContext",
  17090. protocol: 'accessing',
  17091. fn: function (){
  17092. var self=this;
  17093. return $core.withContext(function($ctx1) {
  17094. return self._signalerContextFrom_(self._context());
  17095. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  17096. },
  17097. args: [],
  17098. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  17099. referencedClasses: [],
  17100. messageSends: ["signalerContextFrom:", "context"]
  17101. }),
  17102. $globals.Error);
  17103. $core.addMethod(
  17104. $core.method({
  17105. selector: "signalerContextFrom:",
  17106. protocol: 'accessing',
  17107. fn: function (aContext){
  17108. var self=this;
  17109. return $core.withContext(function($ctx1) {
  17110. var $3,$2,$1;
  17111. return $recv(aContext)._findContextSuchThat_((function(context){
  17112. return $core.withContext(function($ctx2) {
  17113. $3=$recv(context)._receiver();
  17114. $ctx2.sendIdx["receiver"]=1;
  17115. $2=$recv($3).__eq_eq(self);
  17116. $ctx2.sendIdx["=="]=1;
  17117. $1=$recv($2)._or_((function(){
  17118. return $core.withContext(function($ctx3) {
  17119. return $recv($recv(context)._receiver()).__eq_eq(self._class());
  17120. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17121. }));
  17122. return $recv($1)._not();
  17123. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  17124. }));
  17125. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  17126. },
  17127. args: ["aContext"],
  17128. 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 ]",
  17129. referencedClasses: [],
  17130. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  17131. }),
  17132. $globals.Error);
  17133. $core.addMethod(
  17134. $core.method({
  17135. selector: "wasHandled",
  17136. protocol: 'testing',
  17137. fn: function (){
  17138. var self=this;
  17139. return $core.withContext(function($ctx1) {
  17140. return self.amberHandled || false;
  17141. return self;
  17142. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  17143. },
  17144. args: [],
  17145. source: "wasHandled\x0a\x09<return self.amberHandled || false>",
  17146. referencedClasses: [],
  17147. messageSends: []
  17148. }),
  17149. $globals.Error);
  17150. $core.addMethod(
  17151. $core.method({
  17152. selector: "classTag",
  17153. protocol: 'accessing',
  17154. fn: function (){
  17155. var self=this;
  17156. return "exception";
  17157. },
  17158. args: [],
  17159. 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'",
  17160. referencedClasses: [],
  17161. messageSends: []
  17162. }),
  17163. $globals.Error.klass);
  17164. $core.addMethod(
  17165. $core.method({
  17166. selector: "signal",
  17167. protocol: 'instance creation',
  17168. fn: function (){
  17169. var self=this;
  17170. return $core.withContext(function($ctx1) {
  17171. return $recv(self._new())._signal();
  17172. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.klass)});
  17173. },
  17174. args: [],
  17175. source: "signal\x0a\x09^ self new signal",
  17176. referencedClasses: [],
  17177. messageSends: ["signal", "new"]
  17178. }),
  17179. $globals.Error.klass);
  17180. $core.addMethod(
  17181. $core.method({
  17182. selector: "signal:",
  17183. protocol: 'instance creation',
  17184. fn: function (aString){
  17185. var self=this;
  17186. return $core.withContext(function($ctx1) {
  17187. return $recv(self._new())._signal_(aString);
  17188. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.klass)});
  17189. },
  17190. args: ["aString"],
  17191. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  17192. referencedClasses: [],
  17193. messageSends: ["signal:", "new"]
  17194. }),
  17195. $globals.Error.klass);
  17196. $core.addClass('Halt', $globals.Error, [], 'Kernel-Exceptions');
  17197. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  17198. $core.addMethod(
  17199. $core.method({
  17200. selector: "messageText",
  17201. protocol: 'accessing',
  17202. fn: function (){
  17203. var self=this;
  17204. return "Halt encountered";
  17205. },
  17206. args: [],
  17207. source: "messageText\x0a\x09^ 'Halt encountered'",
  17208. referencedClasses: [],
  17209. messageSends: []
  17210. }),
  17211. $globals.Halt);
  17212. $core.addMethod(
  17213. $core.method({
  17214. selector: "signalerContextFrom:",
  17215. protocol: 'accessing',
  17216. fn: function (aContext){
  17217. var self=this;
  17218. return $core.withContext(function($ctx1) {
  17219. var $3,$2,$1;
  17220. return $recv(aContext)._findContextSuchThat_((function(context){
  17221. return $core.withContext(function($ctx2) {
  17222. $3=$recv(context)._receiver();
  17223. $ctx2.sendIdx["receiver"]=1;
  17224. $2=$recv($3).__eq_eq(self);
  17225. $ctx2.sendIdx["=="]=1;
  17226. $1=$recv($2)._or_((function(){
  17227. return $core.withContext(function($ctx3) {
  17228. return $recv($recv($recv(context)._receiver()).__eq_eq(self._class()))._or_((function(){
  17229. return $core.withContext(function($ctx4) {
  17230. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  17231. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  17232. }));
  17233. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17234. }));
  17235. $ctx2.sendIdx["or:"]=1;
  17236. return $recv($1)._not();
  17237. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  17238. }));
  17239. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  17240. },
  17241. args: ["aContext"],
  17242. 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 ]",
  17243. referencedClasses: [],
  17244. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  17245. }),
  17246. $globals.Halt);
  17247. $core.addClass('JavaScriptException', $globals.Error, ['exception'], 'Kernel-Exceptions');
  17248. $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:`";
  17249. $core.addMethod(
  17250. $core.method({
  17251. selector: "context:",
  17252. protocol: 'accessing',
  17253. fn: function (aMethodContext){
  17254. var self=this;
  17255. return $core.withContext(function($ctx1) {
  17256. self.context = aMethodContext;
  17257. return self;
  17258. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  17259. },
  17260. args: ["aMethodContext"],
  17261. 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>",
  17262. referencedClasses: [],
  17263. messageSends: []
  17264. }),
  17265. $globals.JavaScriptException);
  17266. $core.addMethod(
  17267. $core.method({
  17268. selector: "exception",
  17269. protocol: 'accessing',
  17270. fn: function (){
  17271. var self=this;
  17272. return self["@exception"];
  17273. },
  17274. args: [],
  17275. source: "exception\x0a\x09^ exception",
  17276. referencedClasses: [],
  17277. messageSends: []
  17278. }),
  17279. $globals.JavaScriptException);
  17280. $core.addMethod(
  17281. $core.method({
  17282. selector: "exception:",
  17283. protocol: 'accessing',
  17284. fn: function (anException){
  17285. var self=this;
  17286. self["@exception"]=anException;
  17287. return self;
  17288. },
  17289. args: ["anException"],
  17290. source: "exception: anException\x0a\x09exception := anException",
  17291. referencedClasses: [],
  17292. messageSends: []
  17293. }),
  17294. $globals.JavaScriptException);
  17295. $core.addMethod(
  17296. $core.method({
  17297. selector: "messageText",
  17298. protocol: 'accessing',
  17299. fn: function (){
  17300. var self=this;
  17301. return $core.withContext(function($ctx1) {
  17302. return 'JavaScript exception: ' + self["@exception"].toString();
  17303. return self;
  17304. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  17305. },
  17306. args: [],
  17307. source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
  17308. referencedClasses: [],
  17309. messageSends: []
  17310. }),
  17311. $globals.JavaScriptException);
  17312. $core.addMethod(
  17313. $core.method({
  17314. selector: "on:",
  17315. protocol: 'instance creation',
  17316. fn: function (anException){
  17317. var self=this;
  17318. return $core.withContext(function($ctx1) {
  17319. var $1;
  17320. $1=self._new();
  17321. $recv($1)._exception_(anException);
  17322. return $recv($1)._yourself();
  17323. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.klass)});
  17324. },
  17325. args: ["anException"],
  17326. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  17327. referencedClasses: [],
  17328. messageSends: ["exception:", "new", "yourself"]
  17329. }),
  17330. $globals.JavaScriptException.klass);
  17331. $core.addMethod(
  17332. $core.method({
  17333. selector: "on:context:",
  17334. protocol: 'instance creation',
  17335. fn: function (anException,aMethodContext){
  17336. var self=this;
  17337. return $core.withContext(function($ctx1) {
  17338. var $1;
  17339. $1=self._new();
  17340. $recv($1)._exception_(anException);
  17341. $recv($1)._context_(aMethodContext);
  17342. return $recv($1)._yourself();
  17343. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.klass)});
  17344. },
  17345. args: ["anException", "aMethodContext"],
  17346. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  17347. referencedClasses: [],
  17348. messageSends: ["exception:", "new", "context:", "yourself"]
  17349. }),
  17350. $globals.JavaScriptException.klass);
  17351. $core.addClass('MessageNotUnderstood', $globals.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  17352. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  17353. $core.addMethod(
  17354. $core.method({
  17355. selector: "message",
  17356. protocol: 'accessing',
  17357. fn: function (){
  17358. var self=this;
  17359. return self["@message"];
  17360. },
  17361. args: [],
  17362. source: "message\x0a\x09^ message",
  17363. referencedClasses: [],
  17364. messageSends: []
  17365. }),
  17366. $globals.MessageNotUnderstood);
  17367. $core.addMethod(
  17368. $core.method({
  17369. selector: "message:",
  17370. protocol: 'accessing',
  17371. fn: function (aMessage){
  17372. var self=this;
  17373. self["@message"]=aMessage;
  17374. return self;
  17375. },
  17376. args: ["aMessage"],
  17377. source: "message: aMessage\x0a\x09message := aMessage",
  17378. referencedClasses: [],
  17379. messageSends: []
  17380. }),
  17381. $globals.MessageNotUnderstood);
  17382. $core.addMethod(
  17383. $core.method({
  17384. selector: "messageText",
  17385. protocol: 'accessing',
  17386. fn: function (){
  17387. var self=this;
  17388. return $core.withContext(function($ctx1) {
  17389. var $1;
  17390. $1=$recv($recv($recv(self._receiver())._asString()).__comma(" does not understand #")).__comma($recv(self._message())._selector());
  17391. $ctx1.sendIdx[","]=1;
  17392. return $1;
  17393. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  17394. },
  17395. args: [],
  17396. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  17397. referencedClasses: [],
  17398. messageSends: [",", "asString", "receiver", "selector", "message"]
  17399. }),
  17400. $globals.MessageNotUnderstood);
  17401. $core.addMethod(
  17402. $core.method({
  17403. selector: "receiver",
  17404. protocol: 'accessing',
  17405. fn: function (){
  17406. var self=this;
  17407. return self["@receiver"];
  17408. },
  17409. args: [],
  17410. source: "receiver\x0a\x09^ receiver",
  17411. referencedClasses: [],
  17412. messageSends: []
  17413. }),
  17414. $globals.MessageNotUnderstood);
  17415. $core.addMethod(
  17416. $core.method({
  17417. selector: "receiver:",
  17418. protocol: 'accessing',
  17419. fn: function (anObject){
  17420. var self=this;
  17421. self["@receiver"]=anObject;
  17422. return self;
  17423. },
  17424. args: ["anObject"],
  17425. source: "receiver: anObject\x0a\x09receiver := anObject",
  17426. referencedClasses: [],
  17427. messageSends: []
  17428. }),
  17429. $globals.MessageNotUnderstood);
  17430. $core.addClass('NonBooleanReceiver', $globals.Error, ['object'], 'Kernel-Exceptions');
  17431. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  17432. $core.addMethod(
  17433. $core.method({
  17434. selector: "object",
  17435. protocol: 'accessing',
  17436. fn: function (){
  17437. var self=this;
  17438. return self["@object"];
  17439. },
  17440. args: [],
  17441. source: "object\x0a\x09^ object",
  17442. referencedClasses: [],
  17443. messageSends: []
  17444. }),
  17445. $globals.NonBooleanReceiver);
  17446. $core.addMethod(
  17447. $core.method({
  17448. selector: "object:",
  17449. protocol: 'accessing',
  17450. fn: function (anObject){
  17451. var self=this;
  17452. self["@object"]=anObject;
  17453. return self;
  17454. },
  17455. args: ["anObject"],
  17456. source: "object: anObject\x0a\x09object := anObject",
  17457. referencedClasses: [],
  17458. messageSends: []
  17459. }),
  17460. $globals.NonBooleanReceiver);
  17461. });
  17462. define("amber_core/Kernel-Infrastructure", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Collections"], function($boot){"use strict";
  17463. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  17464. $core.addPackage('Kernel-Infrastructure');
  17465. $core.packages["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  17466. $core.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17467. $core.addClass('JSObjectProxy', $globals.ProtoObject, ['jsObject'], 'Kernel-Infrastructure');
  17468. $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`.";
  17469. $core.addMethod(
  17470. $core.method({
  17471. selector: "=",
  17472. protocol: 'comparing',
  17473. fn: function (anObject){
  17474. var self=this;
  17475. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  17476. return $core.withContext(function($ctx1) {
  17477. var $2,$1;
  17478. $2=$recv(anObject)._class();
  17479. $ctx1.sendIdx["class"]=1;
  17480. $1=$recv($2).__eq_eq(self._class());
  17481. if(!$core.assert($1)){
  17482. return false;
  17483. };
  17484. return $recv($JSObjectProxy())._compareJSObjectOfProxy_withProxy_(self,anObject);
  17485. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  17486. },
  17487. args: ["anObject"],
  17488. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  17489. referencedClasses: ["JSObjectProxy"],
  17490. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  17491. }),
  17492. $globals.JSObjectProxy);
  17493. $core.addMethod(
  17494. $core.method({
  17495. selector: "asJSON",
  17496. protocol: 'enumerating',
  17497. fn: function (){
  17498. var self=this;
  17499. return self["@jsObject"];
  17500. },
  17501. args: [],
  17502. source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  17503. referencedClasses: [],
  17504. messageSends: []
  17505. }),
  17506. $globals.JSObjectProxy);
  17507. $core.addMethod(
  17508. $core.method({
  17509. selector: "at:",
  17510. protocol: 'accessing',
  17511. fn: function (aString){
  17512. var self=this;
  17513. return $core.withContext(function($ctx1) {
  17514. return self['@jsObject'][aString];
  17515. return self;
  17516. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  17517. },
  17518. args: ["aString"],
  17519. source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
  17520. referencedClasses: [],
  17521. messageSends: []
  17522. }),
  17523. $globals.JSObjectProxy);
  17524. $core.addMethod(
  17525. $core.method({
  17526. selector: "at:ifAbsent:",
  17527. protocol: 'accessing',
  17528. fn: function (aString,aBlock){
  17529. var self=this;
  17530. return $core.withContext(function($ctx1) {
  17531. var obj = self['@jsObject'];
  17532. return aString in obj ? obj[aString] : aBlock._value();
  17533. ;
  17534. return self;
  17535. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  17536. },
  17537. args: ["aString", "aBlock"],
  17538. 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>",
  17539. referencedClasses: [],
  17540. messageSends: []
  17541. }),
  17542. $globals.JSObjectProxy);
  17543. $core.addMethod(
  17544. $core.method({
  17545. selector: "at:ifPresent:",
  17546. protocol: 'accessing',
  17547. fn: function (aString,aBlock){
  17548. var self=this;
  17549. return $core.withContext(function($ctx1) {
  17550. var obj = self['@jsObject'];
  17551. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  17552. ;
  17553. return self;
  17554. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  17555. },
  17556. args: ["aString", "aBlock"],
  17557. 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>",
  17558. referencedClasses: [],
  17559. messageSends: []
  17560. }),
  17561. $globals.JSObjectProxy);
  17562. $core.addMethod(
  17563. $core.method({
  17564. selector: "at:ifPresent:ifAbsent:",
  17565. protocol: 'accessing',
  17566. fn: function (aString,aBlock,anotherBlock){
  17567. var self=this;
  17568. return $core.withContext(function($ctx1) {
  17569. var obj = self['@jsObject'];
  17570. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  17571. ;
  17572. return self;
  17573. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  17574. },
  17575. args: ["aString", "aBlock", "anotherBlock"],
  17576. 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>",
  17577. referencedClasses: [],
  17578. messageSends: []
  17579. }),
  17580. $globals.JSObjectProxy);
  17581. $core.addMethod(
  17582. $core.method({
  17583. selector: "at:put:",
  17584. protocol: 'accessing',
  17585. fn: function (aString,anObject){
  17586. var self=this;
  17587. return $core.withContext(function($ctx1) {
  17588. return self['@jsObject'][aString] = anObject;
  17589. return self;
  17590. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  17591. },
  17592. args: ["aString", "anObject"],
  17593. source: "at: aString put: anObject\x0a\x09<return self['@jsObject'][aString] = anObject>",
  17594. referencedClasses: [],
  17595. messageSends: []
  17596. }),
  17597. $globals.JSObjectProxy);
  17598. $core.addMethod(
  17599. $core.method({
  17600. selector: "doesNotUnderstand:",
  17601. protocol: 'proxy',
  17602. fn: function (aMessage){
  17603. var self=this;
  17604. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  17605. return $core.withContext(function($ctx1) {
  17606. var $1,$receiver;
  17607. $1=$recv($JSObjectProxy())._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  17608. if(($receiver = $1) == null || $receiver.isNil){
  17609. return (
  17610. $ctx1.supercall = true,
  17611. ($globals.JSObjectProxy.superclass||$boot.dnu).fn.prototype._doesNotUnderstand_.apply($recv(self), [aMessage]));
  17612. $ctx1.supercall = false;
  17613. } else {
  17614. var jsSelector;
  17615. jsSelector=$receiver;
  17616. return $recv($JSObjectProxy())._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  17617. };
  17618. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  17619. },
  17620. args: ["aMessage"],
  17621. 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 ]",
  17622. referencedClasses: ["JSObjectProxy"],
  17623. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  17624. }),
  17625. $globals.JSObjectProxy);
  17626. $core.addMethod(
  17627. $core.method({
  17628. selector: "in:",
  17629. protocol: 'accessing',
  17630. fn: function (aValuable){
  17631. var self=this;
  17632. return $core.withContext(function($ctx1) {
  17633. return $recv(aValuable)._value_(self["@jsObject"]);
  17634. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  17635. },
  17636. args: ["aValuable"],
  17637. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  17638. referencedClasses: [],
  17639. messageSends: ["value:"]
  17640. }),
  17641. $globals.JSObjectProxy);
  17642. $core.addMethod(
  17643. $core.method({
  17644. selector: "jsObject",
  17645. protocol: 'accessing',
  17646. fn: function (){
  17647. var self=this;
  17648. return self["@jsObject"];
  17649. },
  17650. args: [],
  17651. source: "jsObject\x0a\x09^ jsObject",
  17652. referencedClasses: [],
  17653. messageSends: []
  17654. }),
  17655. $globals.JSObjectProxy);
  17656. $core.addMethod(
  17657. $core.method({
  17658. selector: "keysAndValuesDo:",
  17659. protocol: 'enumerating',
  17660. fn: function (aBlock){
  17661. var self=this;
  17662. return $core.withContext(function($ctx1) {
  17663. var o = self['@jsObject'];
  17664. for(var i in o) {
  17665. aBlock._value_value_(i, o[i]);
  17666. }
  17667. ;
  17668. return self;
  17669. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  17670. },
  17671. args: ["aBlock"],
  17672. 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>",
  17673. referencedClasses: [],
  17674. messageSends: []
  17675. }),
  17676. $globals.JSObjectProxy);
  17677. $core.addMethod(
  17678. $core.method({
  17679. selector: "printOn:",
  17680. protocol: 'printing',
  17681. fn: function (aStream){
  17682. var self=this;
  17683. return $core.withContext(function($ctx1) {
  17684. $recv(aStream)._nextPutAll_(self._printString());
  17685. return self;
  17686. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  17687. },
  17688. args: ["aStream"],
  17689. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  17690. referencedClasses: [],
  17691. messageSends: ["nextPutAll:", "printString"]
  17692. }),
  17693. $globals.JSObjectProxy);
  17694. $core.addMethod(
  17695. $core.method({
  17696. selector: "printString",
  17697. protocol: 'printing',
  17698. fn: function (){
  17699. var self=this;
  17700. return $core.withContext(function($ctx1) {
  17701. var js = self['@jsObject'];
  17702. return js.toString
  17703. ? js.toString()
  17704. : Object.prototype.toString.call(js)
  17705. ;
  17706. return self;
  17707. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  17708. },
  17709. args: [],
  17710. 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>",
  17711. referencedClasses: [],
  17712. messageSends: []
  17713. }),
  17714. $globals.JSObjectProxy);
  17715. $core.addMethod(
  17716. $core.method({
  17717. selector: "putOn:",
  17718. protocol: 'streaming',
  17719. fn: function (aStream){
  17720. var self=this;
  17721. return $core.withContext(function($ctx1) {
  17722. $recv(aStream)._nextPutJSObject_(self["@jsObject"]);
  17723. return self;
  17724. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  17725. },
  17726. args: ["aStream"],
  17727. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  17728. referencedClasses: [],
  17729. messageSends: ["nextPutJSObject:"]
  17730. }),
  17731. $globals.JSObjectProxy);
  17732. $core.addMethod(
  17733. $core.method({
  17734. selector: "addObjectVariablesTo:ofProxy:",
  17735. protocol: 'proxy',
  17736. fn: function (aDictionary,aProxy){
  17737. var self=this;
  17738. return $core.withContext(function($ctx1) {
  17739. var jsObject = aProxy['@jsObject'];
  17740. for(var i in jsObject) {
  17741. aDictionary._at_put_(i, jsObject[i]);
  17742. }
  17743. ;
  17744. return self;
  17745. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  17746. },
  17747. args: ["aDictionary", "aProxy"],
  17748. 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>",
  17749. referencedClasses: [],
  17750. messageSends: []
  17751. }),
  17752. $globals.JSObjectProxy.klass);
  17753. $core.addMethod(
  17754. $core.method({
  17755. selector: "compareJSObjectOfProxy:withProxy:",
  17756. protocol: 'proxy',
  17757. fn: function (aProxy,anotherProxy){
  17758. var self=this;
  17759. return $core.withContext(function($ctx1) {
  17760. var anotherJSObject = anotherProxy.klass ? anotherProxy["@jsObject"] : anotherProxy;
  17761. return aProxy["@jsObject"] === anotherJSObject;
  17762. return self;
  17763. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.klass)});
  17764. },
  17765. args: ["aProxy", "anotherProxy"],
  17766. source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<\x0a\x09var anotherJSObject = anotherProxy.klass ? anotherProxy[\x22@jsObject\x22] : anotherProxy;\x0a\x09return aProxy[\x22@jsObject\x22] === anotherJSObject\x0a>",
  17767. referencedClasses: [],
  17768. messageSends: []
  17769. }),
  17770. $globals.JSObjectProxy.klass);
  17771. $core.addMethod(
  17772. $core.method({
  17773. selector: "forwardMessage:withArguments:ofProxy:",
  17774. protocol: 'proxy',
  17775. fn: function (aString,anArray,aProxy){
  17776. var self=this;
  17777. return $core.withContext(function($ctx1) {
  17778. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  17779. ;
  17780. return self;
  17781. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  17782. },
  17783. args: ["aString", "anArray", "aProxy"],
  17784. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09>",
  17785. referencedClasses: [],
  17786. messageSends: []
  17787. }),
  17788. $globals.JSObjectProxy.klass);
  17789. $core.addMethod(
  17790. $core.method({
  17791. selector: "jsObject:ofProxy:",
  17792. protocol: 'proxy',
  17793. fn: function (aJSObject,aProxy){
  17794. var self=this;
  17795. return $core.withContext(function($ctx1) {
  17796. aProxy['@jsObject'] = aJSObject;
  17797. return self;
  17798. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  17799. },
  17800. args: ["aJSObject", "aProxy"],
  17801. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<aProxy['@jsObject'] = aJSObject>",
  17802. referencedClasses: [],
  17803. messageSends: []
  17804. }),
  17805. $globals.JSObjectProxy.klass);
  17806. $core.addMethod(
  17807. $core.method({
  17808. selector: "lookupProperty:ofProxy:",
  17809. protocol: 'proxy',
  17810. fn: function (aString,aProxy){
  17811. var self=this;
  17812. return $core.withContext(function($ctx1) {
  17813. return aString in aProxy._jsObject() ? aString : nil;
  17814. return self;
  17815. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  17816. },
  17817. args: ["aString", "aProxy"],
  17818. 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>",
  17819. referencedClasses: [],
  17820. messageSends: []
  17821. }),
  17822. $globals.JSObjectProxy.klass);
  17823. $core.addMethod(
  17824. $core.method({
  17825. selector: "on:",
  17826. protocol: 'instance creation',
  17827. fn: function (aJSObject){
  17828. var self=this;
  17829. var instance;
  17830. return $core.withContext(function($ctx1) {
  17831. instance=self._new();
  17832. self._jsObject_ofProxy_(aJSObject,instance);
  17833. return instance;
  17834. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.klass)});
  17835. },
  17836. args: ["aJSObject"],
  17837. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  17838. referencedClasses: [],
  17839. messageSends: ["new", "jsObject:ofProxy:"]
  17840. }),
  17841. $globals.JSObjectProxy.klass);
  17842. $core.addClass('Organizer', $globals.Object, [], 'Kernel-Infrastructure');
  17843. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  17844. $core.addMethod(
  17845. $core.method({
  17846. selector: "addElement:",
  17847. protocol: 'accessing',
  17848. fn: function (anObject){
  17849. var self=this;
  17850. return $core.withContext(function($ctx1) {
  17851. self.elements.addElement(anObject);
  17852. return self;
  17853. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  17854. },
  17855. args: ["anObject"],
  17856. source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
  17857. referencedClasses: [],
  17858. messageSends: []
  17859. }),
  17860. $globals.Organizer);
  17861. $core.addMethod(
  17862. $core.method({
  17863. selector: "elements",
  17864. protocol: 'accessing',
  17865. fn: function (){
  17866. var self=this;
  17867. return $core.withContext(function($ctx1) {
  17868. return $recv(self._basicAt_("elements"))._copy();
  17869. }, function($ctx1) {$ctx1.fill(self,"elements",{},$globals.Organizer)});
  17870. },
  17871. args: [],
  17872. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  17873. referencedClasses: [],
  17874. messageSends: ["copy", "basicAt:"]
  17875. }),
  17876. $globals.Organizer);
  17877. $core.addMethod(
  17878. $core.method({
  17879. selector: "removeElement:",
  17880. protocol: 'accessing',
  17881. fn: function (anObject){
  17882. var self=this;
  17883. return $core.withContext(function($ctx1) {
  17884. self.elements.removeElement(anObject);
  17885. return self;
  17886. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  17887. },
  17888. args: ["anObject"],
  17889. source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
  17890. referencedClasses: [],
  17891. messageSends: []
  17892. }),
  17893. $globals.Organizer);
  17894. $core.addClass('ClassOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  17895. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  17896. $core.addMethod(
  17897. $core.method({
  17898. selector: "addElement:",
  17899. protocol: 'accessing',
  17900. fn: function (aString){
  17901. var self=this;
  17902. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  17903. function $ProtocolAdded(){return $globals.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)}
  17904. return $core.withContext(function($ctx1) {
  17905. var $1,$3,$2;
  17906. (
  17907. $ctx1.supercall = true,
  17908. ($globals.ClassOrganizer.superclass||$boot.dnu).fn.prototype._addElement_.apply($recv(self), [aString]));
  17909. $ctx1.supercall = false;
  17910. $1=$recv($SystemAnnouncer())._current();
  17911. $3=$recv($ProtocolAdded())._new();
  17912. $recv($3)._protocol_(aString);
  17913. $recv($3)._theClass_(self._theClass());
  17914. $2=$recv($3)._yourself();
  17915. $recv($1)._announce_($2);
  17916. return self;
  17917. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  17918. },
  17919. args: ["aString"],
  17920. 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)",
  17921. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  17922. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  17923. }),
  17924. $globals.ClassOrganizer);
  17925. $core.addMethod(
  17926. $core.method({
  17927. selector: "removeElement:",
  17928. protocol: 'accessing',
  17929. fn: function (aString){
  17930. var self=this;
  17931. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  17932. function $ProtocolRemoved(){return $globals.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)}
  17933. return $core.withContext(function($ctx1) {
  17934. var $1,$3,$2;
  17935. (
  17936. $ctx1.supercall = true,
  17937. ($globals.ClassOrganizer.superclass||$boot.dnu).fn.prototype._removeElement_.apply($recv(self), [aString]));
  17938. $ctx1.supercall = false;
  17939. $1=$recv($SystemAnnouncer())._current();
  17940. $3=$recv($ProtocolRemoved())._new();
  17941. $recv($3)._protocol_(aString);
  17942. $recv($3)._theClass_(self._theClass());
  17943. $2=$recv($3)._yourself();
  17944. $recv($1)._announce_($2);
  17945. return self;
  17946. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  17947. },
  17948. args: ["aString"],
  17949. 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)",
  17950. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  17951. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  17952. }),
  17953. $globals.ClassOrganizer);
  17954. $core.addMethod(
  17955. $core.method({
  17956. selector: "theClass",
  17957. protocol: 'accessing',
  17958. fn: function (){
  17959. var self=this;
  17960. return $core.withContext(function($ctx1) {
  17961. return self.theClass ;
  17962. return self;
  17963. }, function($ctx1) {$ctx1.fill(self,"theClass",{},$globals.ClassOrganizer)});
  17964. },
  17965. args: [],
  17966. source: "theClass\x0a\x09< return self.theClass >",
  17967. referencedClasses: [],
  17968. messageSends: []
  17969. }),
  17970. $globals.ClassOrganizer);
  17971. $core.addClass('PackageOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  17972. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  17973. $core.addClass('Package', $globals.Object, ['transport', 'imports', 'dirty'], 'Kernel-Infrastructure');
  17974. $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'";
  17975. $core.addMethod(
  17976. $core.method({
  17977. selector: "basicImports",
  17978. protocol: 'private',
  17979. fn: function (){
  17980. var self=this;
  17981. return $core.withContext(function($ctx1) {
  17982. return self.imports || [];
  17983. return self;
  17984. }, function($ctx1) {$ctx1.fill(self,"basicImports",{},$globals.Package)});
  17985. },
  17986. args: [],
  17987. 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 || []>",
  17988. referencedClasses: [],
  17989. messageSends: []
  17990. }),
  17991. $globals.Package);
  17992. $core.addMethod(
  17993. $core.method({
  17994. selector: "basicName:",
  17995. protocol: 'private',
  17996. fn: function (aString){
  17997. var self=this;
  17998. return $core.withContext(function($ctx1) {
  17999. self.pkgName = aString;
  18000. return self;
  18001. }, function($ctx1) {$ctx1.fill(self,"basicName:",{aString:aString},$globals.Package)});
  18002. },
  18003. args: ["aString"],
  18004. source: "basicName: aString\x0a\x09<self.pkgName = aString>",
  18005. referencedClasses: [],
  18006. messageSends: []
  18007. }),
  18008. $globals.Package);
  18009. $core.addMethod(
  18010. $core.method({
  18011. selector: "basicTransport",
  18012. protocol: 'private',
  18013. fn: function (){
  18014. var self=this;
  18015. return $core.withContext(function($ctx1) {
  18016. return self.transport;
  18017. return self;
  18018. }, function($ctx1) {$ctx1.fill(self,"basicTransport",{},$globals.Package)});
  18019. },
  18020. args: [],
  18021. 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>",
  18022. referencedClasses: [],
  18023. messageSends: []
  18024. }),
  18025. $globals.Package);
  18026. $core.addMethod(
  18027. $core.method({
  18028. selector: "beClean",
  18029. protocol: 'accessing',
  18030. fn: function (){
  18031. var self=this;
  18032. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  18033. function $PackageClean(){return $globals.PackageClean||(typeof PackageClean=="undefined"?nil:PackageClean)}
  18034. return $core.withContext(function($ctx1) {
  18035. var $1,$3,$2;
  18036. self["@dirty"]=false;
  18037. $1=$recv($SystemAnnouncer())._current();
  18038. $3=$recv($PackageClean())._new();
  18039. $recv($3)._package_(self);
  18040. $2=$recv($3)._yourself();
  18041. $recv($1)._announce_($2);
  18042. return self;
  18043. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  18044. },
  18045. args: [],
  18046. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  18047. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  18048. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  18049. }),
  18050. $globals.Package);
  18051. $core.addMethod(
  18052. $core.method({
  18053. selector: "beDirty",
  18054. protocol: 'accessing',
  18055. fn: function (){
  18056. var self=this;
  18057. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  18058. function $PackageDirty(){return $globals.PackageDirty||(typeof PackageDirty=="undefined"?nil:PackageDirty)}
  18059. return $core.withContext(function($ctx1) {
  18060. var $1,$3,$2;
  18061. self["@dirty"]=true;
  18062. $1=$recv($SystemAnnouncer())._current();
  18063. $3=$recv($PackageDirty())._new();
  18064. $recv($3)._package_(self);
  18065. $2=$recv($3)._yourself();
  18066. $recv($1)._announce_($2);
  18067. return self;
  18068. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  18069. },
  18070. args: [],
  18071. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  18072. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  18073. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  18074. }),
  18075. $globals.Package);
  18076. $core.addMethod(
  18077. $core.method({
  18078. selector: "classTemplate",
  18079. protocol: 'accessing',
  18080. fn: function (){
  18081. var self=this;
  18082. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  18083. return $core.withContext(function($ctx1) {
  18084. var $2,$3,$1,$4,$5;
  18085. return $recv($String())._streamContents_((function(stream){
  18086. return $core.withContext(function($ctx2) {
  18087. $recv(stream)._nextPutAll_("Object");
  18088. $ctx2.sendIdx["nextPutAll:"]=1;
  18089. $recv(stream)._nextPutAll_(" subclass: #NameOfSubclass");
  18090. $ctx2.sendIdx["nextPutAll:"]=2;
  18091. $2=$recv($String())._lf();
  18092. $ctx2.sendIdx["lf"]=1;
  18093. $3=$recv($String())._tab();
  18094. $ctx2.sendIdx["tab"]=1;
  18095. $1=$recv($2).__comma($3);
  18096. $ctx2.sendIdx[","]=1;
  18097. $recv(stream)._nextPutAll_($1);
  18098. $ctx2.sendIdx["nextPutAll:"]=3;
  18099. $4=$recv(stream)._nextPutAll_("instanceVariableNames: ''");
  18100. $ctx2.sendIdx["nextPutAll:"]=4;
  18101. $4;
  18102. $5=$recv("'".__comma($recv($String())._lf())).__comma($recv($String())._tab());
  18103. $ctx2.sendIdx[","]=2;
  18104. $recv(stream)._nextPutAll_($5);
  18105. $ctx2.sendIdx["nextPutAll:"]=5;
  18106. $recv(stream)._nextPutAll_("package: '");
  18107. $ctx2.sendIdx["nextPutAll:"]=6;
  18108. $recv(stream)._nextPutAll_(self._name());
  18109. $ctx2.sendIdx["nextPutAll:"]=7;
  18110. return $recv(stream)._nextPutAll_("'");
  18111. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18112. }));
  18113. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  18114. },
  18115. args: [],
  18116. 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: '''' ]",
  18117. referencedClasses: ["String"],
  18118. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab", "name"]
  18119. }),
  18120. $globals.Package);
  18121. $core.addMethod(
  18122. $core.method({
  18123. selector: "classes",
  18124. protocol: 'classes',
  18125. fn: function (){
  18126. var self=this;
  18127. return $core.withContext(function($ctx1) {
  18128. return $recv(self._organization())._elements();
  18129. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  18130. },
  18131. args: [],
  18132. source: "classes\x0a\x09^ self organization elements",
  18133. referencedClasses: [],
  18134. messageSends: ["elements", "organization"]
  18135. }),
  18136. $globals.Package);
  18137. $core.addMethod(
  18138. $core.method({
  18139. selector: "definition",
  18140. protocol: 'accessing',
  18141. fn: function (){
  18142. var self=this;
  18143. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  18144. return $core.withContext(function($ctx1) {
  18145. var $1,$3,$4,$2,$6,$5,$8,$9,$7,$10;
  18146. return $recv($String())._streamContents_((function(stream){
  18147. return $core.withContext(function($ctx2) {
  18148. $1=$recv(self._class())._name();
  18149. $ctx2.sendIdx["name"]=1;
  18150. $recv(stream)._nextPutAll_($1);
  18151. $ctx2.sendIdx["nextPutAll:"]=1;
  18152. $3=$recv($String())._lf();
  18153. $ctx2.sendIdx["lf"]=1;
  18154. $4=$recv($String())._tab();
  18155. $ctx2.sendIdx["tab"]=1;
  18156. $2=$recv($3).__comma($4);
  18157. $ctx2.sendIdx[","]=1;
  18158. $recv(stream)._nextPutAll_($2);
  18159. $ctx2.sendIdx["nextPutAll:"]=2;
  18160. $recv(stream)._nextPutAll_("named: ");
  18161. $ctx2.sendIdx["nextPutAll:"]=3;
  18162. $6="'".__comma(self._name());
  18163. $ctx2.sendIdx[","]=3;
  18164. $5=$recv($6).__comma("'");
  18165. $ctx2.sendIdx[","]=2;
  18166. $recv(stream)._nextPutAll_($5);
  18167. $ctx2.sendIdx["nextPutAll:"]=4;
  18168. $8=$recv($String())._lf();
  18169. $ctx2.sendIdx["lf"]=2;
  18170. $9=$recv($String())._tab();
  18171. $ctx2.sendIdx["tab"]=2;
  18172. $7=$recv($8).__comma($9);
  18173. $ctx2.sendIdx[","]=4;
  18174. $recv(stream)._nextPutAll_($7);
  18175. $ctx2.sendIdx["nextPutAll:"]=5;
  18176. $recv(stream)._nextPutAll_("imports: ");
  18177. $ctx2.sendIdx["nextPutAll:"]=6;
  18178. $recv(stream)._nextPutAll_(self._importsDefinition());
  18179. $ctx2.sendIdx["nextPutAll:"]=7;
  18180. $10=$recv($recv($String())._lf()).__comma($recv($String())._tab());
  18181. $ctx2.sendIdx[","]=5;
  18182. $recv(stream)._nextPutAll_($10);
  18183. $ctx2.sendIdx["nextPutAll:"]=8;
  18184. $recv(stream)._nextPutAll_("transport: (");
  18185. $ctx2.sendIdx["nextPutAll:"]=9;
  18186. return $recv(stream)._nextPutAll_($recv($recv(self._transport())._definition()).__comma(")"));
  18187. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18188. }));
  18189. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  18190. },
  18191. args: [],
  18192. 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, ')' ]",
  18193. referencedClasses: ["String"],
  18194. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "lf", "tab", "importsDefinition", "definition", "transport"]
  18195. }),
  18196. $globals.Package);
  18197. $core.addMethod(
  18198. $core.method({
  18199. selector: "imports",
  18200. protocol: 'accessing',
  18201. fn: function (){
  18202. var self=this;
  18203. return $core.withContext(function($ctx1) {
  18204. var $1,$receiver;
  18205. $1=self["@imports"];
  18206. if(($receiver = $1) == null || $receiver.isNil){
  18207. var parsed;
  18208. parsed=self._importsFromJson_(self._basicImports());
  18209. parsed;
  18210. self._imports_(parsed);
  18211. return self["@imports"];
  18212. } else {
  18213. return $1;
  18214. };
  18215. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  18216. },
  18217. args: [],
  18218. 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 ]",
  18219. referencedClasses: [],
  18220. messageSends: ["ifNil:", "importsFromJson:", "basicImports", "imports:"]
  18221. }),
  18222. $globals.Package);
  18223. $core.addMethod(
  18224. $core.method({
  18225. selector: "imports:",
  18226. protocol: 'accessing',
  18227. fn: function (anArray){
  18228. var self=this;
  18229. return $core.withContext(function($ctx1) {
  18230. self._validateImports_(anArray);
  18231. self["@imports"]=$recv(anArray)._asSet();
  18232. return self;
  18233. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  18234. },
  18235. args: ["anArray"],
  18236. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  18237. referencedClasses: [],
  18238. messageSends: ["validateImports:", "asSet"]
  18239. }),
  18240. $globals.Package);
  18241. $core.addMethod(
  18242. $core.method({
  18243. selector: "importsAsJson",
  18244. protocol: 'converting',
  18245. fn: function (){
  18246. var self=this;
  18247. return $core.withContext(function($ctx1) {
  18248. var $1;
  18249. return $recv(self._sortedImportsAsArray())._collect_((function(each){
  18250. return $core.withContext(function($ctx2) {
  18251. $1=$recv(each)._isString();
  18252. if($core.assert($1)){
  18253. return each;
  18254. } else {
  18255. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  18256. $ctx2.sendIdx[","]=1;
  18257. };
  18258. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18259. }));
  18260. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  18261. },
  18262. args: [],
  18263. 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 ]]",
  18264. referencedClasses: [],
  18265. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  18266. }),
  18267. $globals.Package);
  18268. $core.addMethod(
  18269. $core.method({
  18270. selector: "importsDefinition",
  18271. protocol: 'accessing',
  18272. fn: function (){
  18273. var self=this;
  18274. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  18275. return $core.withContext(function($ctx1) {
  18276. return $recv($String())._streamContents_((function(stream){
  18277. return $core.withContext(function($ctx2) {
  18278. $recv(stream)._nextPutAll_("{");
  18279. $ctx2.sendIdx["nextPutAll:"]=1;
  18280. $recv(self._sortedImportsAsArray())._do_separatedBy_((function(each){
  18281. return $core.withContext(function($ctx3) {
  18282. return $recv(stream)._nextPutAll_($recv(each)._importsString());
  18283. $ctx3.sendIdx["nextPutAll:"]=2;
  18284. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  18285. }),(function(){
  18286. return $core.withContext(function($ctx3) {
  18287. return $recv(stream)._nextPutAll_(". ");
  18288. $ctx3.sendIdx["nextPutAll:"]=3;
  18289. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  18290. }));
  18291. return $recv(stream)._nextPutAll_("}");
  18292. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18293. }));
  18294. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  18295. },
  18296. args: [],
  18297. 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: '}' ]",
  18298. referencedClasses: ["String"],
  18299. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "sortedImportsAsArray", "importsString"]
  18300. }),
  18301. $globals.Package);
  18302. $core.addMethod(
  18303. $core.method({
  18304. selector: "importsFromJson:",
  18305. protocol: 'converting',
  18306. fn: function (anArray){
  18307. var self=this;
  18308. return $core.withContext(function($ctx1) {
  18309. var $1;
  18310. return $recv(anArray)._collect_((function(each){
  18311. var split;
  18312. return $core.withContext(function($ctx2) {
  18313. split=$recv(each)._tokenize_("=");
  18314. split;
  18315. $1=$recv($recv(split)._size()).__eq((1));
  18316. if($core.assert($1)){
  18317. return $recv(split)._first();
  18318. $ctx2.sendIdx["first"]=1;
  18319. } else {
  18320. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  18321. };
  18322. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  18323. }));
  18324. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  18325. },
  18326. args: ["anArray"],
  18327. 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 ]]",
  18328. referencedClasses: [],
  18329. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  18330. }),
  18331. $globals.Package);
  18332. $core.addMethod(
  18333. $core.method({
  18334. selector: "isDirty",
  18335. protocol: 'testing',
  18336. fn: function (){
  18337. var self=this;
  18338. return $core.withContext(function($ctx1) {
  18339. var $1,$receiver;
  18340. $1=self["@dirty"];
  18341. if(($receiver = $1) == null || $receiver.isNil){
  18342. return false;
  18343. } else {
  18344. return $1;
  18345. };
  18346. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  18347. },
  18348. args: [],
  18349. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  18350. referencedClasses: [],
  18351. messageSends: ["ifNil:"]
  18352. }),
  18353. $globals.Package);
  18354. $core.addMethod(
  18355. $core.method({
  18356. selector: "isPackage",
  18357. protocol: 'testing',
  18358. fn: function (){
  18359. var self=this;
  18360. return true;
  18361. },
  18362. args: [],
  18363. source: "isPackage\x0a\x09^ true",
  18364. referencedClasses: [],
  18365. messageSends: []
  18366. }),
  18367. $globals.Package);
  18368. $core.addMethod(
  18369. $core.method({
  18370. selector: "loadDependencies",
  18371. protocol: 'dependencies',
  18372. fn: function (){
  18373. var self=this;
  18374. var classes,packages;
  18375. return $core.withContext(function($ctx1) {
  18376. var $1;
  18377. classes=self._loadDependencyClasses();
  18378. $1=$recv($recv(classes)._collect_((function(each){
  18379. return $core.withContext(function($ctx2) {
  18380. return $recv(each)._package();
  18381. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18382. })))._asSet();
  18383. $recv($1)._remove_ifAbsent_(self,(function(){
  18384. }));
  18385. return $recv($1)._yourself();
  18386. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  18387. },
  18388. args: [],
  18389. 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",
  18390. referencedClasses: [],
  18391. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  18392. }),
  18393. $globals.Package);
  18394. $core.addMethod(
  18395. $core.method({
  18396. selector: "loadDependencyClasses",
  18397. protocol: 'dependencies',
  18398. fn: function (){
  18399. var self=this;
  18400. var starCategoryName;
  18401. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  18402. return $core.withContext(function($ctx1) {
  18403. var $3,$2,$1,$5,$4;
  18404. starCategoryName="*".__comma(self._name());
  18405. $ctx1.sendIdx[","]=1;
  18406. $3=self._classes();
  18407. $ctx1.sendIdx["classes"]=1;
  18408. $2=$recv($3)._collect_((function(each){
  18409. return $core.withContext(function($ctx2) {
  18410. return $recv(each)._superclass();
  18411. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18412. }));
  18413. $1=$recv($2)._asSet();
  18414. $recv($1)._remove_ifAbsent_(nil,(function(){
  18415. }));
  18416. $recv($1)._addAll_($recv($recv($Smalltalk())._classes())._select_((function(each){
  18417. return $core.withContext(function($ctx2) {
  18418. $5=$recv(each)._protocols();
  18419. $ctx2.sendIdx["protocols"]=1;
  18420. $4=$recv($5).__comma($recv($recv(each)._class())._protocols());
  18421. return $recv($4)._includes_(starCategoryName);
  18422. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  18423. })));
  18424. return $recv($1)._yourself();
  18425. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  18426. },
  18427. args: [],
  18428. 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",
  18429. referencedClasses: ["Smalltalk"],
  18430. messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "includes:", "protocols", "class", "yourself"]
  18431. }),
  18432. $globals.Package);
  18433. $core.addMethod(
  18434. $core.method({
  18435. selector: "name",
  18436. protocol: 'accessing',
  18437. fn: function (){
  18438. var self=this;
  18439. return $core.withContext(function($ctx1) {
  18440. return self.pkgName;
  18441. return self;
  18442. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Package)});
  18443. },
  18444. args: [],
  18445. source: "name\x0a\x09<return self.pkgName>",
  18446. referencedClasses: [],
  18447. messageSends: []
  18448. }),
  18449. $globals.Package);
  18450. $core.addMethod(
  18451. $core.method({
  18452. selector: "name:",
  18453. protocol: 'accessing',
  18454. fn: function (aString){
  18455. var self=this;
  18456. return $core.withContext(function($ctx1) {
  18457. self._basicName_(aString);
  18458. self._beDirty();
  18459. return self;
  18460. }, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},$globals.Package)});
  18461. },
  18462. args: ["aString"],
  18463. source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty",
  18464. referencedClasses: [],
  18465. messageSends: ["basicName:", "beDirty"]
  18466. }),
  18467. $globals.Package);
  18468. $core.addMethod(
  18469. $core.method({
  18470. selector: "organization",
  18471. protocol: 'accessing',
  18472. fn: function (){
  18473. var self=this;
  18474. return $core.withContext(function($ctx1) {
  18475. return self._basicAt_("organization");
  18476. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Package)});
  18477. },
  18478. args: [],
  18479. source: "organization\x0a\x09^ self basicAt: 'organization'",
  18480. referencedClasses: [],
  18481. messageSends: ["basicAt:"]
  18482. }),
  18483. $globals.Package);
  18484. $core.addMethod(
  18485. $core.method({
  18486. selector: "printOn:",
  18487. protocol: 'printing',
  18488. fn: function (aStream){
  18489. var self=this;
  18490. return $core.withContext(function($ctx1) {
  18491. (
  18492. $ctx1.supercall = true,
  18493. ($globals.Package.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  18494. $ctx1.supercall = false;
  18495. $recv(aStream)._nextPutAll_(" (");
  18496. $ctx1.sendIdx["nextPutAll:"]=1;
  18497. $recv(aStream)._nextPutAll_(self._name());
  18498. $ctx1.sendIdx["nextPutAll:"]=2;
  18499. $recv(aStream)._nextPutAll_(")");
  18500. return self;
  18501. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  18502. },
  18503. args: ["aStream"],
  18504. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  18505. referencedClasses: [],
  18506. messageSends: ["printOn:", "nextPutAll:", "name"]
  18507. }),
  18508. $globals.Package);
  18509. $core.addMethod(
  18510. $core.method({
  18511. selector: "setupClasses",
  18512. protocol: 'classes',
  18513. fn: function (){
  18514. var self=this;
  18515. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  18516. return $core.withContext(function($ctx1) {
  18517. var $1;
  18518. $1=self._classes();
  18519. $recv($1)._do_((function(each){
  18520. return $core.withContext(function($ctx2) {
  18521. return $recv($recv($ClassBuilder())._new())._setupClass_(each);
  18522. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18523. }));
  18524. $ctx1.sendIdx["do:"]=1;
  18525. $recv($1)._do_((function(each){
  18526. return $core.withContext(function($ctx2) {
  18527. return $recv(each)._initialize();
  18528. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  18529. }));
  18530. return self;
  18531. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  18532. },
  18533. args: [],
  18534. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  18535. referencedClasses: ["ClassBuilder"],
  18536. messageSends: ["do:", "classes", "setupClass:", "new", "initialize"]
  18537. }),
  18538. $globals.Package);
  18539. $core.addMethod(
  18540. $core.method({
  18541. selector: "sortedClasses",
  18542. protocol: 'classes',
  18543. fn: function (){
  18544. var self=this;
  18545. return $core.withContext(function($ctx1) {
  18546. return $recv(self._class())._sortedClasses_(self._classes());
  18547. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  18548. },
  18549. args: [],
  18550. 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",
  18551. referencedClasses: [],
  18552. messageSends: ["sortedClasses:", "class", "classes"]
  18553. }),
  18554. $globals.Package);
  18555. $core.addMethod(
  18556. $core.method({
  18557. selector: "sortedImportsAsArray",
  18558. protocol: 'private',
  18559. fn: function (){
  18560. var self=this;
  18561. return $core.withContext(function($ctx1) {
  18562. var $3,$2,$4,$1,$6,$5,$7;
  18563. return $recv($recv(self._imports())._asArray())._sorted_((function(a,b){
  18564. return $core.withContext(function($ctx2) {
  18565. $3=$recv(a)._isString();
  18566. $ctx2.sendIdx["isString"]=1;
  18567. $2=$recv($3)._not();
  18568. $4=$recv(b)._isString();
  18569. $ctx2.sendIdx["isString"]=2;
  18570. $1=$recv($2).__and($4);
  18571. return $recv($1)._or_((function(){
  18572. return $core.withContext(function($ctx3) {
  18573. $6=$recv(a)._isString();
  18574. $ctx3.sendIdx["isString"]=3;
  18575. $5=$recv($6).__eq($recv(b)._isString());
  18576. return $recv($5)._and_((function(){
  18577. return $core.withContext(function($ctx4) {
  18578. $7=$recv(a)._value();
  18579. $ctx4.sendIdx["value"]=1;
  18580. return $recv($7).__lt_eq($recv(b)._value());
  18581. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  18582. }));
  18583. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  18584. }));
  18585. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  18586. }));
  18587. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  18588. },
  18589. args: [],
  18590. 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 ]]]",
  18591. referencedClasses: [],
  18592. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  18593. }),
  18594. $globals.Package);
  18595. $core.addMethod(
  18596. $core.method({
  18597. selector: "transport",
  18598. protocol: 'accessing',
  18599. fn: function (){
  18600. var self=this;
  18601. function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  18602. return $core.withContext(function($ctx1) {
  18603. var $1,$2,$receiver;
  18604. $1=self["@transport"];
  18605. if(($receiver = $1) == null || $receiver.isNil){
  18606. $2=$recv($PackageTransport())._fromJson_(self._basicTransport());
  18607. $recv($2)._package_(self);
  18608. self["@transport"]=$recv($2)._yourself();
  18609. return self["@transport"];
  18610. } else {
  18611. return $1;
  18612. };
  18613. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  18614. },
  18615. args: [],
  18616. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  18617. referencedClasses: ["PackageTransport"],
  18618. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"]
  18619. }),
  18620. $globals.Package);
  18621. $core.addMethod(
  18622. $core.method({
  18623. selector: "transport:",
  18624. protocol: 'accessing',
  18625. fn: function (aPackageTransport){
  18626. var self=this;
  18627. return $core.withContext(function($ctx1) {
  18628. self["@transport"]=aPackageTransport;
  18629. $recv(aPackageTransport)._package_(self);
  18630. return self;
  18631. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  18632. },
  18633. args: ["aPackageTransport"],
  18634. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  18635. referencedClasses: [],
  18636. messageSends: ["package:"]
  18637. }),
  18638. $globals.Package);
  18639. $core.addMethod(
  18640. $core.method({
  18641. selector: "validateImports:",
  18642. protocol: 'validation',
  18643. fn: function (aCollection){
  18644. var self=this;
  18645. return $core.withContext(function($ctx1) {
  18646. var $1,$2,$5,$4,$3,$6;
  18647. $recv(aCollection)._do_((function(import_){
  18648. return $core.withContext(function($ctx2) {
  18649. $1=$recv(import_)._isString();
  18650. $ctx2.sendIdx["isString"]=1;
  18651. if(!$core.assert($1)){
  18652. $2=$recv(import_)._respondsTo_("key");
  18653. if(!$core.assert($2)){
  18654. self._error_("Imports must be Strings or Associations");
  18655. $ctx2.sendIdx["error:"]=1;
  18656. };
  18657. $5=$recv(import_)._key();
  18658. $ctx2.sendIdx["key"]=1;
  18659. $4=$recv($5)._isString();
  18660. $ctx2.sendIdx["isString"]=2;
  18661. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  18662. if(!$core.assert($3)){
  18663. self._error_("Key and value must be Strings");
  18664. $ctx2.sendIdx["error:"]=2;
  18665. };
  18666. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  18667. if(!$core.assert($6)){
  18668. return self._error_("Keys must be identifiers");
  18669. };
  18670. };
  18671. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  18672. }));
  18673. return self;
  18674. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  18675. },
  18676. args: ["aCollection"],
  18677. 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' ]]]",
  18678. referencedClasses: [],
  18679. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  18680. }),
  18681. $globals.Package);
  18682. $globals.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  18683. $core.addMethod(
  18684. $core.method({
  18685. selector: "named:",
  18686. protocol: 'accessing',
  18687. fn: function (aPackageName){
  18688. var self=this;
  18689. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  18690. return $core.withContext(function($ctx1) {
  18691. return $recv($Smalltalk())._packageAt_ifAbsent_(aPackageName,(function(){
  18692. return $core.withContext(function($ctx2) {
  18693. return $recv($Smalltalk())._createPackage_(aPackageName);
  18694. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  18695. }));
  18696. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.klass)});
  18697. },
  18698. args: ["aPackageName"],
  18699. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  18700. referencedClasses: ["Smalltalk"],
  18701. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  18702. }),
  18703. $globals.Package.klass);
  18704. $core.addMethod(
  18705. $core.method({
  18706. selector: "named:ifAbsent:",
  18707. protocol: 'accessing',
  18708. fn: function (aPackageName,aBlock){
  18709. var self=this;
  18710. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  18711. return $core.withContext(function($ctx1) {
  18712. return $recv($Smalltalk())._packageAt_ifAbsent_(aPackageName,aBlock);
  18713. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.klass)});
  18714. },
  18715. args: ["aPackageName", "aBlock"],
  18716. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  18717. referencedClasses: ["Smalltalk"],
  18718. messageSends: ["packageAt:ifAbsent:"]
  18719. }),
  18720. $globals.Package.klass);
  18721. $core.addMethod(
  18722. $core.method({
  18723. selector: "named:imports:transport:",
  18724. protocol: 'accessing',
  18725. fn: function (aPackageName,anArray,aTransport){
  18726. var self=this;
  18727. var package_;
  18728. return $core.withContext(function($ctx1) {
  18729. package_=self._named_(aPackageName);
  18730. $recv(package_)._imports_(anArray);
  18731. $recv(package_)._transport_(aTransport);
  18732. return package_;
  18733. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  18734. },
  18735. args: ["aPackageName", "anArray", "aTransport"],
  18736. source: "named: aPackageName imports: anArray transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package imports: anArray.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  18737. referencedClasses: [],
  18738. messageSends: ["named:", "imports:", "transport:"]
  18739. }),
  18740. $globals.Package.klass);
  18741. $core.addMethod(
  18742. $core.method({
  18743. selector: "named:transport:",
  18744. protocol: 'accessing',
  18745. fn: function (aPackageName,aTransport){
  18746. var self=this;
  18747. var package_;
  18748. return $core.withContext(function($ctx1) {
  18749. package_=self._named_(aPackageName);
  18750. $recv(package_)._transport_(aTransport);
  18751. return package_;
  18752. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  18753. },
  18754. args: ["aPackageName", "aTransport"],
  18755. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  18756. referencedClasses: [],
  18757. messageSends: ["named:", "transport:"]
  18758. }),
  18759. $globals.Package.klass);
  18760. $core.addMethod(
  18761. $core.method({
  18762. selector: "sortedClasses:",
  18763. protocol: 'sorting',
  18764. fn: function (classes){
  18765. var self=this;
  18766. var children,others,nodes,expandedClasses;
  18767. function $ClassSorterNode(){return $globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  18768. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  18769. return $core.withContext(function($ctx1) {
  18770. var $1,$3,$2;
  18771. children=[];
  18772. others=[];
  18773. $recv(classes)._do_((function(each){
  18774. return $core.withContext(function($ctx2) {
  18775. $1=$recv(classes)._includes_($recv(each)._superclass());
  18776. if($core.assert($1)){
  18777. return $recv(others)._add_(each);
  18778. } else {
  18779. return $recv(children)._add_(each);
  18780. $ctx2.sendIdx["add:"]=1;
  18781. };
  18782. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18783. }));
  18784. $ctx1.sendIdx["do:"]=1;
  18785. nodes=$recv(children)._collect_((function(each){
  18786. return $core.withContext(function($ctx2) {
  18787. return $recv($ClassSorterNode())._on_classes_level_(each,others,(0));
  18788. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  18789. }));
  18790. nodes=$recv(nodes)._sorted_((function(a,b){
  18791. return $core.withContext(function($ctx2) {
  18792. $3=$recv(a)._theClass();
  18793. $ctx2.sendIdx["theClass"]=1;
  18794. $2=$recv($3)._name();
  18795. $ctx2.sendIdx["name"]=1;
  18796. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  18797. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  18798. }));
  18799. expandedClasses=$recv($Array())._new();
  18800. $recv(nodes)._do_((function(aNode){
  18801. return $core.withContext(function($ctx2) {
  18802. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  18803. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  18804. }));
  18805. return expandedClasses;
  18806. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.klass)});
  18807. },
  18808. args: ["classes"],
  18809. 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",
  18810. referencedClasses: ["ClassSorterNode", "Array"],
  18811. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  18812. }),
  18813. $globals.Package.klass);
  18814. $core.addClass('PackageStateObserver', $globals.Object, [], 'Kernel-Infrastructure');
  18815. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  18816. $core.addMethod(
  18817. $core.method({
  18818. selector: "announcer",
  18819. protocol: 'accessing',
  18820. fn: function (){
  18821. var self=this;
  18822. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  18823. return $core.withContext(function($ctx1) {
  18824. return $recv($SystemAnnouncer())._current();
  18825. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  18826. },
  18827. args: [],
  18828. source: "announcer\x0a\x09^ SystemAnnouncer current",
  18829. referencedClasses: ["SystemAnnouncer"],
  18830. messageSends: ["current"]
  18831. }),
  18832. $globals.PackageStateObserver);
  18833. $core.addMethod(
  18834. $core.method({
  18835. selector: "observeSystem",
  18836. protocol: 'actions',
  18837. fn: function (){
  18838. var self=this;
  18839. function $PackageAdded(){return $globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
  18840. function $ClassAnnouncement(){return $globals.ClassAnnouncement||(typeof ClassAnnouncement=="undefined"?nil:ClassAnnouncement)}
  18841. function $MethodAnnouncement(){return $globals.MethodAnnouncement||(typeof MethodAnnouncement=="undefined"?nil:MethodAnnouncement)}
  18842. function $ProtocolAnnouncement(){return $globals.ProtocolAnnouncement||(typeof ProtocolAnnouncement=="undefined"?nil:ProtocolAnnouncement)}
  18843. return $core.withContext(function($ctx1) {
  18844. var $1;
  18845. $1=self._announcer();
  18846. $recv($1)._on_send_to_($PackageAdded(),"onPackageAdded:",self);
  18847. $ctx1.sendIdx["on:send:to:"]=1;
  18848. $recv($1)._on_send_to_($ClassAnnouncement(),"onClassModification:",self);
  18849. $ctx1.sendIdx["on:send:to:"]=2;
  18850. $recv($1)._on_send_to_($MethodAnnouncement(),"onMethodModification:",self);
  18851. $ctx1.sendIdx["on:send:to:"]=3;
  18852. $recv($1)._on_send_to_($ProtocolAnnouncement(),"onProtocolModification:",self);
  18853. return self;
  18854. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  18855. },
  18856. args: [],
  18857. 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",
  18858. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  18859. messageSends: ["on:send:to:", "announcer"]
  18860. }),
  18861. $globals.PackageStateObserver);
  18862. $core.addMethod(
  18863. $core.method({
  18864. selector: "onClassModification:",
  18865. protocol: 'reactions',
  18866. fn: function (anAnnouncement){
  18867. var self=this;
  18868. return $core.withContext(function($ctx1) {
  18869. var $1,$receiver;
  18870. $1=$recv(anAnnouncement)._theClass();
  18871. if(($receiver = $1) == null || $receiver.isNil){
  18872. $1;
  18873. } else {
  18874. var theClass;
  18875. theClass=$receiver;
  18876. $recv($recv(theClass)._package())._beDirty();
  18877. };
  18878. return self;
  18879. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  18880. },
  18881. args: ["anAnnouncement"],
  18882. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  18883. referencedClasses: [],
  18884. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  18885. }),
  18886. $globals.PackageStateObserver);
  18887. $core.addMethod(
  18888. $core.method({
  18889. selector: "onMethodModification:",
  18890. protocol: 'reactions',
  18891. fn: function (anAnnouncement){
  18892. var self=this;
  18893. return $core.withContext(function($ctx1) {
  18894. var $1,$receiver;
  18895. $1=$recv($recv(anAnnouncement)._method())._package();
  18896. if(($receiver = $1) == null || $receiver.isNil){
  18897. $1;
  18898. } else {
  18899. var package_;
  18900. package_=$receiver;
  18901. $recv(package_)._beDirty();
  18902. };
  18903. return self;
  18904. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  18905. },
  18906. args: ["anAnnouncement"],
  18907. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  18908. referencedClasses: [],
  18909. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  18910. }),
  18911. $globals.PackageStateObserver);
  18912. $core.addMethod(
  18913. $core.method({
  18914. selector: "onPackageAdded:",
  18915. protocol: 'reactions',
  18916. fn: function (anAnnouncement){
  18917. var self=this;
  18918. return $core.withContext(function($ctx1) {
  18919. $recv($recv(anAnnouncement)._package())._beDirty();
  18920. return self;
  18921. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  18922. },
  18923. args: ["anAnnouncement"],
  18924. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  18925. referencedClasses: [],
  18926. messageSends: ["beDirty", "package"]
  18927. }),
  18928. $globals.PackageStateObserver);
  18929. $core.addMethod(
  18930. $core.method({
  18931. selector: "onProtocolModification:",
  18932. protocol: 'reactions',
  18933. fn: function (anAnnouncement){
  18934. var self=this;
  18935. return $core.withContext(function($ctx1) {
  18936. var $1,$receiver;
  18937. $1=$recv(anAnnouncement)._package();
  18938. if(($receiver = $1) == null || $receiver.isNil){
  18939. $1;
  18940. } else {
  18941. var package_;
  18942. package_=$receiver;
  18943. $recv(package_)._beDirty();
  18944. };
  18945. return self;
  18946. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  18947. },
  18948. args: ["anAnnouncement"],
  18949. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  18950. referencedClasses: [],
  18951. messageSends: ["ifNotNil:", "package", "beDirty"]
  18952. }),
  18953. $globals.PackageStateObserver);
  18954. $globals.PackageStateObserver.klass.iVarNames = ['current'];
  18955. $core.addMethod(
  18956. $core.method({
  18957. selector: "current",
  18958. protocol: 'accessing',
  18959. fn: function (){
  18960. var self=this;
  18961. return $core.withContext(function($ctx1) {
  18962. var $1,$receiver;
  18963. $1=self["@current"];
  18964. if(($receiver = $1) == null || $receiver.isNil){
  18965. self["@current"]=self._new();
  18966. return self["@current"];
  18967. } else {
  18968. return $1;
  18969. };
  18970. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.klass)});
  18971. },
  18972. args: [],
  18973. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  18974. referencedClasses: [],
  18975. messageSends: ["ifNil:", "new"]
  18976. }),
  18977. $globals.PackageStateObserver.klass);
  18978. $core.addMethod(
  18979. $core.method({
  18980. selector: "initialize",
  18981. protocol: 'initialization',
  18982. fn: function (){
  18983. var self=this;
  18984. return $core.withContext(function($ctx1) {
  18985. $recv(self._current())._observeSystem();
  18986. return self;
  18987. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.klass)});
  18988. },
  18989. args: [],
  18990. source: "initialize\x0a\x09self current observeSystem",
  18991. referencedClasses: [],
  18992. messageSends: ["observeSystem", "current"]
  18993. }),
  18994. $globals.PackageStateObserver.klass);
  18995. $core.addClass('ParseError', $globals.Error, [], 'Kernel-Infrastructure');
  18996. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  18997. $core.addClass('RethrowErrorHandler', $globals.Object, [], 'Kernel-Infrastructure');
  18998. $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.";
  18999. $core.addMethod(
  19000. $core.method({
  19001. selector: "basicSignal:",
  19002. protocol: 'error handling',
  19003. fn: function (anError){
  19004. var self=this;
  19005. return $core.withContext(function($ctx1) {
  19006. throw anError;
  19007. return self;
  19008. }, function($ctx1) {$ctx1.fill(self,"basicSignal:",{anError:anError},$globals.RethrowErrorHandler)});
  19009. },
  19010. args: ["anError"],
  19011. source: "basicSignal: anError\x0a <throw anError>",
  19012. referencedClasses: [],
  19013. messageSends: []
  19014. }),
  19015. $globals.RethrowErrorHandler);
  19016. $core.addMethod(
  19017. $core.method({
  19018. selector: "handleError:",
  19019. protocol: 'error handling',
  19020. fn: function (anError){
  19021. var self=this;
  19022. return $core.withContext(function($ctx1) {
  19023. self._basicSignal_(anError);
  19024. return self;
  19025. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.RethrowErrorHandler)});
  19026. },
  19027. args: ["anError"],
  19028. source: "handleError: anError\x0a self basicSignal: anError",
  19029. referencedClasses: [],
  19030. messageSends: ["basicSignal:"]
  19031. }),
  19032. $globals.RethrowErrorHandler);
  19033. $core.addClass('Setting', $globals.Object, ['key', 'value', 'defaultValue'], 'Kernel-Infrastructure');
  19034. $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`";
  19035. $core.addMethod(
  19036. $core.method({
  19037. selector: "defaultValue",
  19038. protocol: 'accessing',
  19039. fn: function (){
  19040. var self=this;
  19041. return self["@defaultValue"];
  19042. },
  19043. args: [],
  19044. source: "defaultValue\x0a\x09^ defaultValue",
  19045. referencedClasses: [],
  19046. messageSends: []
  19047. }),
  19048. $globals.Setting);
  19049. $core.addMethod(
  19050. $core.method({
  19051. selector: "defaultValue:",
  19052. protocol: 'accessing',
  19053. fn: function (aStringifiableObject){
  19054. var self=this;
  19055. self["@defaultValue"]=aStringifiableObject;
  19056. return self;
  19057. },
  19058. args: ["aStringifiableObject"],
  19059. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  19060. referencedClasses: [],
  19061. messageSends: []
  19062. }),
  19063. $globals.Setting);
  19064. $core.addMethod(
  19065. $core.method({
  19066. selector: "key",
  19067. protocol: 'accessing',
  19068. fn: function (){
  19069. var self=this;
  19070. return self["@key"];
  19071. },
  19072. args: [],
  19073. source: "key\x0a\x09^ key",
  19074. referencedClasses: [],
  19075. messageSends: []
  19076. }),
  19077. $globals.Setting);
  19078. $core.addMethod(
  19079. $core.method({
  19080. selector: "key:",
  19081. protocol: 'accessing',
  19082. fn: function (aString){
  19083. var self=this;
  19084. self["@key"]=aString;
  19085. return self;
  19086. },
  19087. args: ["aString"],
  19088. source: "key: aString\x0a\x09key := aString",
  19089. referencedClasses: [],
  19090. messageSends: []
  19091. }),
  19092. $globals.Setting);
  19093. $core.addMethod(
  19094. $core.method({
  19095. selector: "value",
  19096. protocol: 'accessing',
  19097. fn: function (){
  19098. var self=this;
  19099. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  19100. return $core.withContext(function($ctx1) {
  19101. return $recv($recv($Smalltalk())._settings())._at_ifAbsent_(self._key(),(function(){
  19102. return $core.withContext(function($ctx2) {
  19103. return self._defaultValue();
  19104. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19105. }));
  19106. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  19107. },
  19108. args: [],
  19109. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  19110. referencedClasses: ["Smalltalk"],
  19111. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  19112. }),
  19113. $globals.Setting);
  19114. $core.addMethod(
  19115. $core.method({
  19116. selector: "value:",
  19117. protocol: 'accessing',
  19118. fn: function (aStringifiableObject){
  19119. var self=this;
  19120. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  19121. return $core.withContext(function($ctx1) {
  19122. return $recv($recv($Smalltalk())._settings())._at_put_(self._key(),aStringifiableObject);
  19123. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  19124. },
  19125. args: ["aStringifiableObject"],
  19126. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  19127. referencedClasses: ["Smalltalk"],
  19128. messageSends: ["at:put:", "settings", "key"]
  19129. }),
  19130. $globals.Setting);
  19131. $core.addMethod(
  19132. $core.method({
  19133. selector: "at:ifAbsent:",
  19134. protocol: 'instance creation',
  19135. fn: function (aString,aDefaultValue){
  19136. var self=this;
  19137. return $core.withContext(function($ctx1) {
  19138. var $1;
  19139. $1=(
  19140. $ctx1.supercall = true,
  19141. ($globals.Setting.klass.superclass||$boot.dnu).fn.prototype._new.apply($recv(self), []));
  19142. $ctx1.supercall = false;
  19143. $recv($1)._key_(aString);
  19144. $recv($1)._defaultValue_(aDefaultValue);
  19145. return $recv($1)._yourself();
  19146. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.klass)});
  19147. },
  19148. args: ["aString", "aDefaultValue"],
  19149. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  19150. referencedClasses: [],
  19151. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  19152. }),
  19153. $globals.Setting.klass);
  19154. $core.addMethod(
  19155. $core.method({
  19156. selector: "new",
  19157. protocol: 'instance creation',
  19158. fn: function (){
  19159. var self=this;
  19160. return $core.withContext(function($ctx1) {
  19161. self._shouldNotImplement();
  19162. return self;
  19163. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.klass)});
  19164. },
  19165. args: [],
  19166. source: "new\x0a\x09self shouldNotImplement",
  19167. referencedClasses: [],
  19168. messageSends: ["shouldNotImplement"]
  19169. }),
  19170. $globals.Setting.klass);
  19171. $core.addClass('SmalltalkImage', $globals.Object, [], 'Kernel-Infrastructure');
  19172. $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.";
  19173. $core.addMethod(
  19174. $core.method({
  19175. selector: "addGlobalJsVariable:",
  19176. protocol: 'globals',
  19177. fn: function (aString){
  19178. var self=this;
  19179. return $core.withContext(function($ctx1) {
  19180. $recv(self._globalJsVariables())._add_(aString);
  19181. return self;
  19182. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  19183. },
  19184. args: ["aString"],
  19185. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  19186. referencedClasses: [],
  19187. messageSends: ["add:", "globalJsVariables"]
  19188. }),
  19189. $globals.SmalltalkImage);
  19190. $core.addMethod(
  19191. $core.method({
  19192. selector: "amdRequire",
  19193. protocol: 'accessing amd',
  19194. fn: function (){
  19195. var self=this;
  19196. return $core.withContext(function($ctx1) {
  19197. return $recv(self._core())._at_("amdRequire");
  19198. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  19199. },
  19200. args: [],
  19201. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  19202. referencedClasses: [],
  19203. messageSends: ["at:", "core"]
  19204. }),
  19205. $globals.SmalltalkImage);
  19206. $core.addMethod(
  19207. $core.method({
  19208. selector: "asSmalltalkException:",
  19209. protocol: 'error handling',
  19210. fn: function (anObject){
  19211. var self=this;
  19212. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  19213. function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  19214. return $core.withContext(function($ctx1) {
  19215. var $1;
  19216. $1=$recv(self._isSmalltalkObject_(anObject))._and_((function(){
  19217. return $core.withContext(function($ctx2) {
  19218. return $recv(anObject)._isKindOf_($Error());
  19219. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19220. }));
  19221. if($core.assert($1)){
  19222. return anObject;
  19223. } else {
  19224. return $recv($JavaScriptException())._on_(anObject);
  19225. };
  19226. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  19227. },
  19228. args: ["anObject"],
  19229. 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 ]",
  19230. referencedClasses: ["Error", "JavaScriptException"],
  19231. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  19232. }),
  19233. $globals.SmalltalkImage);
  19234. $core.addMethod(
  19235. $core.method({
  19236. selector: "basicCreatePackage:",
  19237. protocol: 'private',
  19238. fn: function (packageName){
  19239. var self=this;
  19240. return $core.withContext(function($ctx1) {
  19241. return $core.addPackage(packageName);
  19242. return self;
  19243. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  19244. },
  19245. args: ["packageName"],
  19246. 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)>",
  19247. referencedClasses: [],
  19248. messageSends: []
  19249. }),
  19250. $globals.SmalltalkImage);
  19251. $core.addMethod(
  19252. $core.method({
  19253. selector: "basicParse:",
  19254. protocol: 'private',
  19255. fn: function (aString){
  19256. var self=this;
  19257. function $SmalltalkParser(){return $globals.SmalltalkParser||(typeof SmalltalkParser=="undefined"?nil:SmalltalkParser)}
  19258. return $core.withContext(function($ctx1) {
  19259. return $recv($SmalltalkParser())._parse_(aString);
  19260. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  19261. },
  19262. args: ["aString"],
  19263. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  19264. referencedClasses: ["SmalltalkParser"],
  19265. messageSends: ["parse:"]
  19266. }),
  19267. $globals.SmalltalkImage);
  19268. $core.addMethod(
  19269. $core.method({
  19270. selector: "basicRegisterPackage:",
  19271. protocol: 'private',
  19272. fn: function (aPackage){
  19273. var self=this;
  19274. return $core.withContext(function($ctx1) {
  19275. $core.packages[aPackage.pkgName]=aPackage;
  19276. return self;
  19277. }, function($ctx1) {$ctx1.fill(self,"basicRegisterPackage:",{aPackage:aPackage},$globals.SmalltalkImage)});
  19278. },
  19279. args: ["aPackage"],
  19280. source: "basicRegisterPackage: aPackage\x0a\x09\x22Put aPackage in $core.packages object.\x22\x0a\x09<$core.packages[aPackage.pkgName]=aPackage>",
  19281. referencedClasses: [],
  19282. messageSends: []
  19283. }),
  19284. $globals.SmalltalkImage);
  19285. $core.addMethod(
  19286. $core.method({
  19287. selector: "cancelOptOut:",
  19288. protocol: 'accessing',
  19289. fn: function (anObject){
  19290. var self=this;
  19291. return $core.withContext(function($ctx1) {
  19292. delete anObject.klass;
  19293. return self;
  19294. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  19295. },
  19296. args: ["anObject"],
  19297. 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>",
  19298. referencedClasses: [],
  19299. messageSends: []
  19300. }),
  19301. $globals.SmalltalkImage);
  19302. $core.addMethod(
  19303. $core.method({
  19304. selector: "classes",
  19305. protocol: 'classes',
  19306. fn: function (){
  19307. var self=this;
  19308. return $core.withContext(function($ctx1) {
  19309. return $core.classes();
  19310. return self;
  19311. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  19312. },
  19313. args: [],
  19314. source: "classes\x0a\x09<return $core.classes()>",
  19315. referencedClasses: [],
  19316. messageSends: []
  19317. }),
  19318. $globals.SmalltalkImage);
  19319. $core.addMethod(
  19320. $core.method({
  19321. selector: "core",
  19322. protocol: 'accessing',
  19323. fn: function (){
  19324. var self=this;
  19325. return $core.withContext(function($ctx1) {
  19326. return $core;
  19327. return self;
  19328. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  19329. },
  19330. args: [],
  19331. source: "core\x0a\x09<return $core>",
  19332. referencedClasses: [],
  19333. messageSends: []
  19334. }),
  19335. $globals.SmalltalkImage);
  19336. $core.addMethod(
  19337. $core.method({
  19338. selector: "createPackage:",
  19339. protocol: 'packages',
  19340. fn: function (packageName){
  19341. var self=this;
  19342. var package_,announcement;
  19343. function $PackageAdded(){return $globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
  19344. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  19345. return $core.withContext(function($ctx1) {
  19346. var $1;
  19347. package_=self._basicCreatePackage_(packageName);
  19348. $1=$recv($PackageAdded())._new();
  19349. $recv($1)._package_(package_);
  19350. announcement=$recv($1)._yourself();
  19351. $recv($recv($SystemAnnouncer())._current())._announce_(announcement);
  19352. return package_;
  19353. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  19354. },
  19355. args: ["packageName"],
  19356. 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",
  19357. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  19358. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  19359. }),
  19360. $globals.SmalltalkImage);
  19361. $core.addMethod(
  19362. $core.method({
  19363. selector: "defaultAmdNamespace",
  19364. protocol: 'accessing amd',
  19365. fn: function (){
  19366. var self=this;
  19367. return $core.withContext(function($ctx1) {
  19368. return "transport.defaultAmdNamespace"._settingValue();
  19369. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  19370. },
  19371. args: [],
  19372. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  19373. referencedClasses: [],
  19374. messageSends: ["settingValue"]
  19375. }),
  19376. $globals.SmalltalkImage);
  19377. $core.addMethod(
  19378. $core.method({
  19379. selector: "defaultAmdNamespace:",
  19380. protocol: 'accessing amd',
  19381. fn: function (aString){
  19382. var self=this;
  19383. return $core.withContext(function($ctx1) {
  19384. "transport.defaultAmdNamespace"._settingValue_(aString);
  19385. return self;
  19386. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  19387. },
  19388. args: ["aString"],
  19389. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  19390. referencedClasses: [],
  19391. messageSends: ["settingValue:"]
  19392. }),
  19393. $globals.SmalltalkImage);
  19394. $core.addMethod(
  19395. $core.method({
  19396. selector: "deleteClass:",
  19397. protocol: 'private',
  19398. fn: function (aClass){
  19399. var self=this;
  19400. return $core.withContext(function($ctx1) {
  19401. $core.removeClass(aClass);
  19402. return self;
  19403. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  19404. },
  19405. args: ["aClass"],
  19406. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<$core.removeClass(aClass)>",
  19407. referencedClasses: [],
  19408. messageSends: []
  19409. }),
  19410. $globals.SmalltalkImage);
  19411. $core.addMethod(
  19412. $core.method({
  19413. selector: "deleteGlobalJsVariable:",
  19414. protocol: 'globals',
  19415. fn: function (aString){
  19416. var self=this;
  19417. return $core.withContext(function($ctx1) {
  19418. $recv(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  19419. }));
  19420. return self;
  19421. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  19422. },
  19423. args: ["aString"],
  19424. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  19425. referencedClasses: [],
  19426. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  19427. }),
  19428. $globals.SmalltalkImage);
  19429. $core.addMethod(
  19430. $core.method({
  19431. selector: "deletePackage:",
  19432. protocol: 'private',
  19433. fn: function (packageName){
  19434. var self=this;
  19435. return $core.withContext(function($ctx1) {
  19436. delete $core.packages[packageName];
  19437. return self;
  19438. }, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  19439. },
  19440. args: ["packageName"],
  19441. 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]>",
  19442. referencedClasses: [],
  19443. messageSends: []
  19444. }),
  19445. $globals.SmalltalkImage);
  19446. $core.addMethod(
  19447. $core.method({
  19448. selector: "existsJsGlobal:",
  19449. protocol: 'testing',
  19450. fn: function (aString){
  19451. var self=this;
  19452. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  19453. return $core.withContext(function($ctx1) {
  19454. return $recv($recv($Platform())._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  19455. return true;
  19456. }),(function(){
  19457. return false;
  19458. }));
  19459. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  19460. },
  19461. args: ["aString"],
  19462. source: "existsJsGlobal: aString\x0a\x09^ Platform globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  19463. referencedClasses: ["Platform"],
  19464. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  19465. }),
  19466. $globals.SmalltalkImage);
  19467. $core.addMethod(
  19468. $core.method({
  19469. selector: "globalJsVariables",
  19470. protocol: 'globals',
  19471. fn: function (){
  19472. var self=this;
  19473. return $core.withContext(function($ctx1) {
  19474. return $core.globalJsVariables;
  19475. return self;
  19476. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  19477. },
  19478. args: [],
  19479. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<return $core.globalJsVariables>",
  19480. referencedClasses: [],
  19481. messageSends: []
  19482. }),
  19483. $globals.SmalltalkImage);
  19484. $core.addMethod(
  19485. $core.method({
  19486. selector: "globals",
  19487. protocol: 'accessing',
  19488. fn: function (){
  19489. var self=this;
  19490. return $core.withContext(function($ctx1) {
  19491. return $globals;
  19492. return self;
  19493. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  19494. },
  19495. args: [],
  19496. source: "globals\x0a\x09<return $globals>",
  19497. referencedClasses: [],
  19498. messageSends: []
  19499. }),
  19500. $globals.SmalltalkImage);
  19501. $core.addMethod(
  19502. $core.method({
  19503. selector: "includesKey:",
  19504. protocol: 'accessing',
  19505. fn: function (aKey){
  19506. var self=this;
  19507. return $core.withContext(function($ctx1) {
  19508. return $core.hasOwnProperty(aKey);
  19509. return self;
  19510. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  19511. },
  19512. args: ["aKey"],
  19513. source: "includesKey: aKey\x0a\x09<return $core.hasOwnProperty(aKey)>",
  19514. referencedClasses: [],
  19515. messageSends: []
  19516. }),
  19517. $globals.SmalltalkImage);
  19518. $core.addMethod(
  19519. $core.method({
  19520. selector: "isSmalltalkObject:",
  19521. protocol: 'testing',
  19522. fn: function (anObject){
  19523. var self=this;
  19524. return $core.withContext(function($ctx1) {
  19525. return anObject.klass != null;
  19526. return self;
  19527. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  19528. },
  19529. args: ["anObject"],
  19530. 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>",
  19531. referencedClasses: [],
  19532. messageSends: []
  19533. }),
  19534. $globals.SmalltalkImage);
  19535. $core.addMethod(
  19536. $core.method({
  19537. selector: "optOut:",
  19538. protocol: 'accessing',
  19539. fn: function (anObject){
  19540. var self=this;
  19541. return $core.withContext(function($ctx1) {
  19542. anObject.klass = null;
  19543. return self;
  19544. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  19545. },
  19546. args: ["anObject"],
  19547. 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>",
  19548. referencedClasses: [],
  19549. messageSends: []
  19550. }),
  19551. $globals.SmalltalkImage);
  19552. $core.addMethod(
  19553. $core.method({
  19554. selector: "packageAt:",
  19555. protocol: 'packages',
  19556. fn: function (packageName){
  19557. var self=this;
  19558. return $core.withContext(function($ctx1) {
  19559. return $core.packages[packageName];
  19560. return self;
  19561. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
  19562. },
  19563. args: ["packageName"],
  19564. source: "packageAt: packageName\x0a\x09<return $core.packages[packageName]>",
  19565. referencedClasses: [],
  19566. messageSends: []
  19567. }),
  19568. $globals.SmalltalkImage);
  19569. $core.addMethod(
  19570. $core.method({
  19571. selector: "packageAt:ifAbsent:",
  19572. protocol: 'packages',
  19573. fn: function (packageName,aBlock){
  19574. var self=this;
  19575. return $core.withContext(function($ctx1) {
  19576. var $1;
  19577. $1=self._packageAt_(packageName);
  19578. return $recv($1)._ifNil_(aBlock);
  19579. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  19580. },
  19581. args: ["packageName", "aBlock"],
  19582. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
  19583. referencedClasses: [],
  19584. messageSends: ["ifNil:", "packageAt:"]
  19585. }),
  19586. $globals.SmalltalkImage);
  19587. $core.addMethod(
  19588. $core.method({
  19589. selector: "packages",
  19590. protocol: 'packages',
  19591. fn: function (){
  19592. var self=this;
  19593. return $core.withContext(function($ctx1) {
  19594. return Object.keys($core.packages).map(function(k) {
  19595. return $core.packages[k];
  19596. })
  19597. ;
  19598. return self;
  19599. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  19600. },
  19601. args: [],
  19602. 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>",
  19603. referencedClasses: [],
  19604. messageSends: []
  19605. }),
  19606. $globals.SmalltalkImage);
  19607. $core.addMethod(
  19608. $core.method({
  19609. selector: "parse:",
  19610. protocol: 'accessing',
  19611. fn: function (aString){
  19612. var self=this;
  19613. var result;
  19614. return $core.withContext(function($ctx1) {
  19615. var $1;
  19616. $recv((function(){
  19617. return $core.withContext(function($ctx2) {
  19618. result=self._basicParse_(aString);
  19619. return result;
  19620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19621. }))._tryCatch_((function(ex){
  19622. return $core.withContext(function($ctx2) {
  19623. return $recv(self._parseError_parsing_(ex,aString))._signal();
  19624. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  19625. }));
  19626. $1=result;
  19627. $recv($1)._source_(aString);
  19628. return $recv($1)._yourself();
  19629. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  19630. },
  19631. args: ["aString"],
  19632. 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",
  19633. referencedClasses: [],
  19634. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  19635. }),
  19636. $globals.SmalltalkImage);
  19637. $core.addMethod(
  19638. $core.method({
  19639. selector: "parseError:parsing:",
  19640. protocol: 'error handling',
  19641. fn: function (anException,aString){
  19642. var self=this;
  19643. function $ParseError(){return $globals.ParseError||(typeof ParseError=="undefined"?nil:ParseError)}
  19644. return $core.withContext(function($ctx1) {
  19645. var $1,$7,$6,$5,$8,$4,$3,$2;
  19646. $1=$recv($ParseError())._new();
  19647. $7=$recv(anException)._basicAt_("line");
  19648. $ctx1.sendIdx["basicAt:"]=1;
  19649. $6="Parse error on line ".__comma($7);
  19650. $5=$recv($6).__comma(" column ");
  19651. $ctx1.sendIdx[","]=4;
  19652. $8=$recv(anException)._basicAt_("column");
  19653. $ctx1.sendIdx["basicAt:"]=2;
  19654. $4=$recv($5).__comma($8);
  19655. $ctx1.sendIdx[","]=3;
  19656. $3=$recv($4).__comma(" : Unexpected character ");
  19657. $ctx1.sendIdx[","]=2;
  19658. $2=$recv($3).__comma($recv(anException)._basicAt_("found"));
  19659. $ctx1.sendIdx[","]=1;
  19660. return $recv($1)._messageText_($2);
  19661. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  19662. },
  19663. args: ["anException", "aString"],
  19664. 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')",
  19665. referencedClasses: ["ParseError"],
  19666. messageSends: ["messageText:", "new", ",", "basicAt:"]
  19667. }),
  19668. $globals.SmalltalkImage);
  19669. $core.addMethod(
  19670. $core.method({
  19671. selector: "pseudoVariableNames",
  19672. protocol: 'accessing',
  19673. fn: function (){
  19674. var self=this;
  19675. return ["self", "super", "nil", "true", "false", "thisContext"];
  19676. },
  19677. args: [],
  19678. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  19679. referencedClasses: [],
  19680. messageSends: []
  19681. }),
  19682. $globals.SmalltalkImage);
  19683. $core.addMethod(
  19684. $core.method({
  19685. selector: "readJSObject:",
  19686. protocol: 'accessing',
  19687. fn: function (anObject){
  19688. var self=this;
  19689. return $core.withContext(function($ctx1) {
  19690. return $core.readJSObject(anObject);
  19691. return self;
  19692. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  19693. },
  19694. args: ["anObject"],
  19695. source: "readJSObject: anObject\x0a\x09<return $core.readJSObject(anObject)>",
  19696. referencedClasses: [],
  19697. messageSends: []
  19698. }),
  19699. $globals.SmalltalkImage);
  19700. $core.addMethod(
  19701. $core.method({
  19702. selector: "removeClass:",
  19703. protocol: 'classes',
  19704. fn: function (aClass){
  19705. var self=this;
  19706. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  19707. function $ClassRemoved(){return $globals.ClassRemoved||(typeof ClassRemoved=="undefined"?nil:ClassRemoved)}
  19708. return $core.withContext(function($ctx1) {
  19709. var $1,$2,$4,$3;
  19710. $1=$recv(aClass)._isMetaclass();
  19711. if($core.assert($1)){
  19712. self._error_($recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  19713. };
  19714. self._deleteClass_(aClass);
  19715. $2=$recv($SystemAnnouncer())._current();
  19716. $4=$recv($ClassRemoved())._new();
  19717. $recv($4)._theClass_(aClass);
  19718. $3=$recv($4)._yourself();
  19719. $recv($2)._announce_($3);
  19720. return self;
  19721. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  19722. },
  19723. args: ["aClass"],
  19724. 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)",
  19725. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  19726. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"]
  19727. }),
  19728. $globals.SmalltalkImage);
  19729. $core.addMethod(
  19730. $core.method({
  19731. selector: "removePackage:",
  19732. protocol: 'packages',
  19733. fn: function (packageName){
  19734. var self=this;
  19735. var pkg;
  19736. return $core.withContext(function($ctx1) {
  19737. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  19738. return $core.withContext(function($ctx2) {
  19739. return self._error_("Missing package: ".__comma(packageName));
  19740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19741. }));
  19742. $recv($recv(pkg)._classes())._do_((function(each){
  19743. return $core.withContext(function($ctx2) {
  19744. return self._removeClass_(each);
  19745. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  19746. }));
  19747. self._deletePackage_(packageName);
  19748. return self;
  19749. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  19750. },
  19751. args: ["packageName"],
  19752. 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",
  19753. referencedClasses: [],
  19754. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"]
  19755. }),
  19756. $globals.SmalltalkImage);
  19757. $core.addMethod(
  19758. $core.method({
  19759. selector: "renamePackage:to:",
  19760. protocol: 'packages',
  19761. fn: function (packageName,newName){
  19762. var self=this;
  19763. var pkg;
  19764. return $core.withContext(function($ctx1) {
  19765. var $1,$2,$receiver;
  19766. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  19767. return $core.withContext(function($ctx2) {
  19768. $1="Missing package: ".__comma(packageName);
  19769. $ctx2.sendIdx[","]=1;
  19770. return self._error_($1);
  19771. $ctx2.sendIdx["error:"]=1;
  19772. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19773. }));
  19774. $2=self._packageAt_(newName);
  19775. if(($receiver = $2) == null || $receiver.isNil){
  19776. $2;
  19777. } else {
  19778. self._error_("Already exists a package called: ".__comma(newName));
  19779. };
  19780. $recv(pkg)._name_(newName);
  19781. self._basicRegisterPackage_(pkg);
  19782. self._deletePackage_(packageName);
  19783. return self;
  19784. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  19785. },
  19786. args: ["packageName", "newName"],
  19787. 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.",
  19788. referencedClasses: [],
  19789. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "basicRegisterPackage:", "deletePackage:"]
  19790. }),
  19791. $globals.SmalltalkImage);
  19792. $core.addMethod(
  19793. $core.method({
  19794. selector: "reservedWords",
  19795. protocol: 'accessing',
  19796. fn: function (){
  19797. var self=this;
  19798. return $core.withContext(function($ctx1) {
  19799. return $core.reservedWords;
  19800. return self;
  19801. }, function($ctx1) {$ctx1.fill(self,"reservedWords",{},$globals.SmalltalkImage)});
  19802. },
  19803. args: [],
  19804. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return $core.reservedWords>",
  19805. referencedClasses: [],
  19806. messageSends: []
  19807. }),
  19808. $globals.SmalltalkImage);
  19809. $core.addMethod(
  19810. $core.method({
  19811. selector: "settings",
  19812. protocol: 'accessing',
  19813. fn: function (){
  19814. var self=this;
  19815. function $SmalltalkSettings(){return $globals.SmalltalkSettings||(typeof SmalltalkSettings=="undefined"?nil:SmalltalkSettings)}
  19816. return $SmalltalkSettings();
  19817. },
  19818. args: [],
  19819. source: "settings\x0a\x09^ SmalltalkSettings",
  19820. referencedClasses: ["SmalltalkSettings"],
  19821. messageSends: []
  19822. }),
  19823. $globals.SmalltalkImage);
  19824. $core.addMethod(
  19825. $core.method({
  19826. selector: "version",
  19827. protocol: 'accessing',
  19828. fn: function (){
  19829. var self=this;
  19830. return "0.15.0-pre";
  19831. },
  19832. args: [],
  19833. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.15.0-pre'",
  19834. referencedClasses: [],
  19835. messageSends: []
  19836. }),
  19837. $globals.SmalltalkImage);
  19838. $globals.SmalltalkImage.klass.iVarNames = ['current'];
  19839. $core.addMethod(
  19840. $core.method({
  19841. selector: "current",
  19842. protocol: 'instance creation',
  19843. fn: function (){
  19844. var self=this;
  19845. return $core.withContext(function($ctx1) {
  19846. var $1,$receiver;
  19847. $1=self["@current"];
  19848. if(($receiver = $1) == null || $receiver.isNil){
  19849. self["@current"]=(
  19850. $ctx1.supercall = true,
  19851. ($globals.SmalltalkImage.klass.superclass||$boot.dnu).fn.prototype._new.apply($recv(self), []));
  19852. $ctx1.supercall = false;
  19853. return self["@current"];
  19854. } else {
  19855. self._deprecatedAPI();
  19856. return self["@current"];
  19857. };
  19858. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.klass)});
  19859. },
  19860. args: [],
  19861. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  19862. referencedClasses: [],
  19863. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  19864. }),
  19865. $globals.SmalltalkImage.klass);
  19866. $core.addMethod(
  19867. $core.method({
  19868. selector: "initialize",
  19869. protocol: 'initialization',
  19870. fn: function (){
  19871. var self=this;
  19872. var st;
  19873. return $core.withContext(function($ctx1) {
  19874. st=self._current();
  19875. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  19876. return self;
  19877. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.klass)});
  19878. },
  19879. args: [],
  19880. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  19881. referencedClasses: [],
  19882. messageSends: ["current", "at:put:", "globals"]
  19883. }),
  19884. $globals.SmalltalkImage.klass);
  19885. $core.addMethod(
  19886. $core.method({
  19887. selector: "new",
  19888. protocol: 'instance creation',
  19889. fn: function (){
  19890. var self=this;
  19891. return $core.withContext(function($ctx1) {
  19892. self._shouldNotImplement();
  19893. return self;
  19894. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.klass)});
  19895. },
  19896. args: [],
  19897. source: "new\x0a\x09self shouldNotImplement",
  19898. referencedClasses: [],
  19899. messageSends: ["shouldNotImplement"]
  19900. }),
  19901. $globals.SmalltalkImage.klass);
  19902. $core.addMethod(
  19903. $core.method({
  19904. selector: "importsString",
  19905. protocol: '*Kernel-Infrastructure',
  19906. fn: function (){
  19907. var self=this;
  19908. return $core.withContext(function($ctx1) {
  19909. var $3,$2,$1;
  19910. $3=$recv(self._key())._importsString();
  19911. $ctx1.sendIdx["importsString"]=1;
  19912. $2=$recv($3).__comma(" -> ");
  19913. $1=$recv($2).__comma($recv(self._value())._importsString());
  19914. $ctx1.sendIdx[","]=1;
  19915. return $1;
  19916. }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.Association)});
  19917. },
  19918. args: [],
  19919. 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",
  19920. referencedClasses: [],
  19921. messageSends: [",", "importsString", "key", "value"]
  19922. }),
  19923. $globals.Association);
  19924. $core.addMethod(
  19925. $core.method({
  19926. selector: "asJavaScriptPropertyName",
  19927. protocol: '*Kernel-Infrastructure',
  19928. fn: function (){
  19929. var self=this;
  19930. return $core.withContext(function($ctx1) {
  19931. return $core.st2prop(self);
  19932. return self;
  19933. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  19934. },
  19935. args: [],
  19936. source: "asJavaScriptPropertyName\x0a<return $core.st2prop(self)>",
  19937. referencedClasses: [],
  19938. messageSends: []
  19939. }),
  19940. $globals.String);
  19941. $core.addMethod(
  19942. $core.method({
  19943. selector: "asSetting",
  19944. protocol: '*Kernel-Infrastructure',
  19945. fn: function (){
  19946. var self=this;
  19947. function $Setting(){return $globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
  19948. return $core.withContext(function($ctx1) {
  19949. return $recv($Setting())._at_ifAbsent_(self,nil);
  19950. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  19951. },
  19952. args: [],
  19953. 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",
  19954. referencedClasses: ["Setting"],
  19955. messageSends: ["at:ifAbsent:"]
  19956. }),
  19957. $globals.String);
  19958. $core.addMethod(
  19959. $core.method({
  19960. selector: "asSettingIfAbsent:",
  19961. protocol: '*Kernel-Infrastructure',
  19962. fn: function (aDefaultValue){
  19963. var self=this;
  19964. function $Setting(){return $globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
  19965. return $core.withContext(function($ctx1) {
  19966. return $recv($Setting())._at_ifAbsent_(self,aDefaultValue);
  19967. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  19968. },
  19969. args: ["aDefaultValue"],
  19970. 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",
  19971. referencedClasses: ["Setting"],
  19972. messageSends: ["at:ifAbsent:"]
  19973. }),
  19974. $globals.String);
  19975. $core.addMethod(
  19976. $core.method({
  19977. selector: "importsString",
  19978. protocol: '*Kernel-Infrastructure',
  19979. fn: function (){
  19980. var self=this;
  19981. return $core.withContext(function($ctx1) {
  19982. var $1;
  19983. $1=$recv("'".__comma(self._replace_with_("'","''"))).__comma("'");
  19984. $ctx1.sendIdx[","]=1;
  19985. return $1;
  19986. }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.String)});
  19987. },
  19988. args: [],
  19989. source: "importsString\x0a\x09\x22Answer receiver as Smalltalk expression\x22\x0a\x09^ '''', (self replace: '''' with: ''''''), ''''",
  19990. referencedClasses: [],
  19991. messageSends: [",", "replace:with:"]
  19992. }),
  19993. $globals.String);
  19994. $core.addMethod(
  19995. $core.method({
  19996. selector: "settingValue",
  19997. protocol: '*Kernel-Infrastructure',
  19998. fn: function (){
  19999. var self=this;
  20000. return $core.withContext(function($ctx1) {
  20001. return $recv(self._asSetting())._value();
  20002. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  20003. },
  20004. args: [],
  20005. source: "settingValue\x0a\x09^ self asSetting value",
  20006. referencedClasses: [],
  20007. messageSends: ["value", "asSetting"]
  20008. }),
  20009. $globals.String);
  20010. $core.addMethod(
  20011. $core.method({
  20012. selector: "settingValue:",
  20013. protocol: '*Kernel-Infrastructure',
  20014. fn: function (aValue){
  20015. var self=this;
  20016. return $core.withContext(function($ctx1) {
  20017. return $recv(self._asSetting())._value_(aValue);
  20018. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  20019. },
  20020. args: ["aValue"],
  20021. 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",
  20022. referencedClasses: [],
  20023. messageSends: ["value:", "asSetting"]
  20024. }),
  20025. $globals.String);
  20026. $core.addMethod(
  20027. $core.method({
  20028. selector: "settingValueIfAbsent:",
  20029. protocol: '*Kernel-Infrastructure',
  20030. fn: function (aDefaultValue){
  20031. var self=this;
  20032. return $core.withContext(function($ctx1) {
  20033. return $recv(self._asSettingIfAbsent_(aDefaultValue))._value();
  20034. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  20035. },
  20036. args: ["aDefaultValue"],
  20037. 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",
  20038. referencedClasses: [],
  20039. messageSends: ["value", "asSettingIfAbsent:"]
  20040. }),
  20041. $globals.String);
  20042. });
  20043. define("amber_core/Kernel-Announcements", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20044. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  20045. $core.addPackage('Kernel-Announcements');
  20046. $core.packages["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  20047. $core.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20048. $core.addClass('AnnouncementSubscription', $globals.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
  20049. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  20050. $core.addMethod(
  20051. $core.method({
  20052. selector: "announcementClass",
  20053. protocol: 'accessing',
  20054. fn: function (){
  20055. var self=this;
  20056. return self["@announcementClass"];
  20057. },
  20058. args: [],
  20059. source: "announcementClass\x0a\x09^ announcementClass",
  20060. referencedClasses: [],
  20061. messageSends: []
  20062. }),
  20063. $globals.AnnouncementSubscription);
  20064. $core.addMethod(
  20065. $core.method({
  20066. selector: "announcementClass:",
  20067. protocol: 'accessing',
  20068. fn: function (aClass){
  20069. var self=this;
  20070. self["@announcementClass"]=aClass;
  20071. return self;
  20072. },
  20073. args: ["aClass"],
  20074. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  20075. referencedClasses: [],
  20076. messageSends: []
  20077. }),
  20078. $globals.AnnouncementSubscription);
  20079. $core.addMethod(
  20080. $core.method({
  20081. selector: "deliver:",
  20082. protocol: 'announcing',
  20083. fn: function (anAnnouncement){
  20084. var self=this;
  20085. return $core.withContext(function($ctx1) {
  20086. var $1;
  20087. $1=self._handlesAnnouncement_(anAnnouncement);
  20088. if($core.assert($1)){
  20089. $recv(self._valuable())._value_(anAnnouncement);
  20090. };
  20091. return self;
  20092. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  20093. },
  20094. args: ["anAnnouncement"],
  20095. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  20096. referencedClasses: [],
  20097. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  20098. }),
  20099. $globals.AnnouncementSubscription);
  20100. $core.addMethod(
  20101. $core.method({
  20102. selector: "handlesAnnouncement:",
  20103. protocol: 'announcing',
  20104. fn: function (anAnnouncement){
  20105. var self=this;
  20106. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  20107. return $core.withContext(function($ctx1) {
  20108. var $2,$3,$1,$receiver;
  20109. $2=$recv($Smalltalk())._globals();
  20110. $ctx1.sendIdx["globals"]=1;
  20111. $3=$recv(self._announcementClass())._name();
  20112. $ctx1.sendIdx["name"]=1;
  20113. $1=$recv($2)._at_($3);
  20114. $ctx1.sendIdx["at:"]=1;
  20115. if(($receiver = $1) == null || $receiver.isNil){
  20116. return false;
  20117. } else {
  20118. var class_;
  20119. class_=$receiver;
  20120. return $recv($recv($recv($Smalltalk())._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  20121. };
  20122. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  20123. },
  20124. args: ["anAnnouncement"],
  20125. 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 ]",
  20126. referencedClasses: ["Smalltalk"],
  20127. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  20128. }),
  20129. $globals.AnnouncementSubscription);
  20130. $core.addMethod(
  20131. $core.method({
  20132. selector: "receiver",
  20133. protocol: 'accessing',
  20134. fn: function (){
  20135. var self=this;
  20136. return $core.withContext(function($ctx1) {
  20137. return $recv(self._valuable())._receiver();
  20138. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  20139. },
  20140. args: [],
  20141. source: "receiver\x0a\x09^ self valuable receiver",
  20142. referencedClasses: [],
  20143. messageSends: ["receiver", "valuable"]
  20144. }),
  20145. $globals.AnnouncementSubscription);
  20146. $core.addMethod(
  20147. $core.method({
  20148. selector: "valuable",
  20149. protocol: 'accessing',
  20150. fn: function (){
  20151. var self=this;
  20152. return self["@valuable"];
  20153. },
  20154. args: [],
  20155. source: "valuable\x0a\x09^ valuable",
  20156. referencedClasses: [],
  20157. messageSends: []
  20158. }),
  20159. $globals.AnnouncementSubscription);
  20160. $core.addMethod(
  20161. $core.method({
  20162. selector: "valuable:",
  20163. protocol: 'accessing',
  20164. fn: function (aValuable){
  20165. var self=this;
  20166. self["@valuable"]=aValuable;
  20167. return self;
  20168. },
  20169. args: ["aValuable"],
  20170. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  20171. referencedClasses: [],
  20172. messageSends: []
  20173. }),
  20174. $globals.AnnouncementSubscription);
  20175. $core.addClass('AnnouncementValuable', $globals.Object, ['valuable', 'receiver'], 'Kernel-Announcements');
  20176. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  20177. $core.addMethod(
  20178. $core.method({
  20179. selector: "receiver",
  20180. protocol: 'accessing',
  20181. fn: function (){
  20182. var self=this;
  20183. return self["@receiver"];
  20184. },
  20185. args: [],
  20186. source: "receiver\x0a\x09^ receiver",
  20187. referencedClasses: [],
  20188. messageSends: []
  20189. }),
  20190. $globals.AnnouncementValuable);
  20191. $core.addMethod(
  20192. $core.method({
  20193. selector: "receiver:",
  20194. protocol: 'accessing',
  20195. fn: function (anObject){
  20196. var self=this;
  20197. self["@receiver"]=anObject;
  20198. return self;
  20199. },
  20200. args: ["anObject"],
  20201. source: "receiver: anObject\x0a\x09receiver := anObject",
  20202. referencedClasses: [],
  20203. messageSends: []
  20204. }),
  20205. $globals.AnnouncementValuable);
  20206. $core.addMethod(
  20207. $core.method({
  20208. selector: "valuable",
  20209. protocol: 'accessing',
  20210. fn: function (){
  20211. var self=this;
  20212. return self["@valuable"];
  20213. },
  20214. args: [],
  20215. source: "valuable\x0a\x09^ valuable",
  20216. referencedClasses: [],
  20217. messageSends: []
  20218. }),
  20219. $globals.AnnouncementValuable);
  20220. $core.addMethod(
  20221. $core.method({
  20222. selector: "valuable:",
  20223. protocol: 'accessing',
  20224. fn: function (anObject){
  20225. var self=this;
  20226. self["@valuable"]=anObject;
  20227. return self;
  20228. },
  20229. args: ["anObject"],
  20230. source: "valuable: anObject\x0a\x09valuable := anObject",
  20231. referencedClasses: [],
  20232. messageSends: []
  20233. }),
  20234. $globals.AnnouncementValuable);
  20235. $core.addMethod(
  20236. $core.method({
  20237. selector: "value",
  20238. protocol: 'evaluating',
  20239. fn: function (){
  20240. var self=this;
  20241. return $core.withContext(function($ctx1) {
  20242. return $recv(self._valuable())._value();
  20243. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  20244. },
  20245. args: [],
  20246. source: "value\x0a\x09^ self valuable value",
  20247. referencedClasses: [],
  20248. messageSends: ["value", "valuable"]
  20249. }),
  20250. $globals.AnnouncementValuable);
  20251. $core.addMethod(
  20252. $core.method({
  20253. selector: "value:",
  20254. protocol: 'evaluating',
  20255. fn: function (anObject){
  20256. var self=this;
  20257. return $core.withContext(function($ctx1) {
  20258. return $recv(self._valuable())._value_(anObject);
  20259. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  20260. },
  20261. args: ["anObject"],
  20262. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  20263. referencedClasses: [],
  20264. messageSends: ["value:", "valuable"]
  20265. }),
  20266. $globals.AnnouncementValuable);
  20267. $core.addClass('Announcer', $globals.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  20268. $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' ].";
  20269. $core.addMethod(
  20270. $core.method({
  20271. selector: "announce:",
  20272. protocol: 'announcing',
  20273. fn: function (anAnnouncement){
  20274. var self=this;
  20275. return $core.withContext(function($ctx1) {
  20276. $recv(self["@subscriptions"])._do_((function(each){
  20277. return $core.withContext(function($ctx2) {
  20278. return $recv(each)._deliver_(anAnnouncement);
  20279. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20280. }));
  20281. return self;
  20282. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  20283. },
  20284. args: ["anAnnouncement"],
  20285. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  20286. referencedClasses: [],
  20287. messageSends: ["do:", "deliver:"]
  20288. }),
  20289. $globals.Announcer);
  20290. $core.addMethod(
  20291. $core.method({
  20292. selector: "initialize",
  20293. protocol: 'initialization',
  20294. fn: function (){
  20295. var self=this;
  20296. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  20297. return $core.withContext(function($ctx1) {
  20298. (
  20299. $ctx1.supercall = true,
  20300. ($globals.Announcer.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  20301. $ctx1.supercall = false;
  20302. self["@subscriptions"]=$recv($OrderedCollection())._new();
  20303. return self;
  20304. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  20305. },
  20306. args: [],
  20307. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  20308. referencedClasses: ["OrderedCollection"],
  20309. messageSends: ["initialize", "new"]
  20310. }),
  20311. $globals.Announcer);
  20312. $core.addMethod(
  20313. $core.method({
  20314. selector: "on:do:",
  20315. protocol: 'subscribing',
  20316. fn: function (aClass,aBlock){
  20317. var self=this;
  20318. return $core.withContext(function($ctx1) {
  20319. self._on_do_for_(aClass,aBlock,nil);
  20320. return self;
  20321. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  20322. },
  20323. args: ["aClass", "aBlock"],
  20324. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  20325. referencedClasses: [],
  20326. messageSends: ["on:do:for:"]
  20327. }),
  20328. $globals.Announcer);
  20329. $core.addMethod(
  20330. $core.method({
  20331. selector: "on:do:for:",
  20332. protocol: 'subscribing',
  20333. fn: function (aClass,aBlock,aReceiver){
  20334. var self=this;
  20335. function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  20336. function $AnnouncementValuable(){return $globals.AnnouncementValuable||(typeof AnnouncementValuable=="undefined"?nil:AnnouncementValuable)}
  20337. return $core.withContext(function($ctx1) {
  20338. var $1,$3,$5,$6,$4,$2;
  20339. $1=self["@subscriptions"];
  20340. $3=$recv($AnnouncementSubscription())._new();
  20341. $ctx1.sendIdx["new"]=1;
  20342. $5=$recv($AnnouncementValuable())._new();
  20343. $recv($5)._valuable_(aBlock);
  20344. $recv($5)._receiver_(aReceiver);
  20345. $6=$recv($5)._yourself();
  20346. $ctx1.sendIdx["yourself"]=1;
  20347. $4=$6;
  20348. $recv($3)._valuable_($4);
  20349. $ctx1.sendIdx["valuable:"]=1;
  20350. $recv($3)._announcementClass_(aClass);
  20351. $2=$recv($3)._yourself();
  20352. $recv($1)._add_($2);
  20353. return self;
  20354. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  20355. },
  20356. args: ["aClass", "aBlock", "aReceiver"],
  20357. 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)",
  20358. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  20359. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  20360. }),
  20361. $globals.Announcer);
  20362. $core.addMethod(
  20363. $core.method({
  20364. selector: "on:doOnce:",
  20365. protocol: 'subscribing',
  20366. fn: function (aClass,aBlock){
  20367. var self=this;
  20368. var subscription;
  20369. function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  20370. return $core.withContext(function($ctx1) {
  20371. var $1;
  20372. $1=$recv($AnnouncementSubscription())._new();
  20373. $recv($1)._announcementClass_(aClass);
  20374. subscription=$recv($1)._yourself();
  20375. $recv(subscription)._valuable_((function(ann){
  20376. return $core.withContext(function($ctx2) {
  20377. $recv(self["@subscriptions"])._remove_(subscription);
  20378. return $recv(aBlock)._value_(ann);
  20379. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  20380. }));
  20381. $recv(self["@subscriptions"])._add_(subscription);
  20382. return self;
  20383. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  20384. },
  20385. args: ["aClass", "aBlock"],
  20386. 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",
  20387. referencedClasses: ["AnnouncementSubscription"],
  20388. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  20389. }),
  20390. $globals.Announcer);
  20391. $core.addMethod(
  20392. $core.method({
  20393. selector: "on:send:to:",
  20394. protocol: 'subscribing',
  20395. fn: function (aClass,aSelector,anObject){
  20396. var self=this;
  20397. function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  20398. function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  20399. return $core.withContext(function($ctx1) {
  20400. var $1,$3,$5,$6,$4,$2;
  20401. $1=self["@subscriptions"];
  20402. $3=$recv($AnnouncementSubscription())._new();
  20403. $ctx1.sendIdx["new"]=1;
  20404. $5=$recv($MessageSend())._new();
  20405. $recv($5)._receiver_(anObject);
  20406. $recv($5)._selector_(aSelector);
  20407. $6=$recv($5)._yourself();
  20408. $ctx1.sendIdx["yourself"]=1;
  20409. $4=$6;
  20410. $recv($3)._valuable_($4);
  20411. $recv($3)._announcementClass_(aClass);
  20412. $2=$recv($3)._yourself();
  20413. $recv($1)._add_($2);
  20414. return self;
  20415. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  20416. },
  20417. args: ["aClass", "aSelector", "anObject"],
  20418. 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)",
  20419. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  20420. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  20421. }),
  20422. $globals.Announcer);
  20423. $core.addMethod(
  20424. $core.method({
  20425. selector: "unsubscribe:",
  20426. protocol: 'subscribing',
  20427. fn: function (anObject){
  20428. var self=this;
  20429. return $core.withContext(function($ctx1) {
  20430. self["@subscriptions"]=$recv(self["@subscriptions"])._reject_((function(each){
  20431. return $core.withContext(function($ctx2) {
  20432. return $recv($recv(each)._receiver()).__eq(anObject);
  20433. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20434. }));
  20435. return self;
  20436. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  20437. },
  20438. args: ["anObject"],
  20439. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  20440. referencedClasses: [],
  20441. messageSends: ["reject:", "=", "receiver"]
  20442. }),
  20443. $globals.Announcer);
  20444. $core.addClass('SystemAnnouncer', $globals.Announcer, [], 'Kernel-Announcements');
  20445. $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`";
  20446. $globals.SystemAnnouncer.klass.iVarNames = ['current'];
  20447. $core.addMethod(
  20448. $core.method({
  20449. selector: "current",
  20450. protocol: 'accessing',
  20451. fn: function (){
  20452. var self=this;
  20453. return $core.withContext(function($ctx1) {
  20454. var $1,$receiver;
  20455. $1=self["@current"];
  20456. if(($receiver = $1) == null || $receiver.isNil){
  20457. self["@current"]=(
  20458. $ctx1.supercall = true,
  20459. ($globals.SystemAnnouncer.klass.superclass||$boot.dnu).fn.prototype._new.apply($recv(self), []));
  20460. $ctx1.supercall = false;
  20461. return self["@current"];
  20462. } else {
  20463. return $1;
  20464. };
  20465. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.klass)});
  20466. },
  20467. args: [],
  20468. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  20469. referencedClasses: [],
  20470. messageSends: ["ifNil:", "new"]
  20471. }),
  20472. $globals.SystemAnnouncer.klass);
  20473. $core.addMethod(
  20474. $core.method({
  20475. selector: "new",
  20476. protocol: 'instance creation',
  20477. fn: function (){
  20478. var self=this;
  20479. return $core.withContext(function($ctx1) {
  20480. self._shouldNotImplement();
  20481. return self;
  20482. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.klass)});
  20483. },
  20484. args: [],
  20485. source: "new\x0a\x09self shouldNotImplement",
  20486. referencedClasses: [],
  20487. messageSends: ["shouldNotImplement"]
  20488. }),
  20489. $globals.SystemAnnouncer.klass);
  20490. $core.addClass('SystemAnnouncement', $globals.Object, [], 'Kernel-Announcements');
  20491. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  20492. $core.addMethod(
  20493. $core.method({
  20494. selector: "classTag",
  20495. protocol: 'accessing',
  20496. fn: function (){
  20497. var self=this;
  20498. return "announcement";
  20499. },
  20500. args: [],
  20501. 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'",
  20502. referencedClasses: [],
  20503. messageSends: []
  20504. }),
  20505. $globals.SystemAnnouncement.klass);
  20506. $core.addClass('ClassAnnouncement', $globals.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
  20507. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  20508. $core.addMethod(
  20509. $core.method({
  20510. selector: "theClass",
  20511. protocol: 'accessing',
  20512. fn: function (){
  20513. var self=this;
  20514. return self["@theClass"];
  20515. },
  20516. args: [],
  20517. source: "theClass\x0a\x09^ theClass",
  20518. referencedClasses: [],
  20519. messageSends: []
  20520. }),
  20521. $globals.ClassAnnouncement);
  20522. $core.addMethod(
  20523. $core.method({
  20524. selector: "theClass:",
  20525. protocol: 'accessing',
  20526. fn: function (aClass){
  20527. var self=this;
  20528. self["@theClass"]=aClass;
  20529. return self;
  20530. },
  20531. args: ["aClass"],
  20532. source: "theClass: aClass\x0a\x09theClass := aClass",
  20533. referencedClasses: [],
  20534. messageSends: []
  20535. }),
  20536. $globals.ClassAnnouncement);
  20537. $core.addClass('ClassAdded', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  20538. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  20539. $core.addClass('ClassCommentChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  20540. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  20541. $core.addClass('ClassDefinitionChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  20542. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  20543. $core.addClass('ClassMigrated', $globals.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements');
  20544. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  20545. $core.addMethod(
  20546. $core.method({
  20547. selector: "oldClass",
  20548. protocol: 'accessing',
  20549. fn: function (){
  20550. var self=this;
  20551. return self["@oldClass"];
  20552. },
  20553. args: [],
  20554. source: "oldClass\x0a\x09^ oldClass",
  20555. referencedClasses: [],
  20556. messageSends: []
  20557. }),
  20558. $globals.ClassMigrated);
  20559. $core.addMethod(
  20560. $core.method({
  20561. selector: "oldClass:",
  20562. protocol: 'accessing',
  20563. fn: function (aClass){
  20564. var self=this;
  20565. self["@oldClass"]=aClass;
  20566. return self;
  20567. },
  20568. args: ["aClass"],
  20569. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  20570. referencedClasses: [],
  20571. messageSends: []
  20572. }),
  20573. $globals.ClassMigrated);
  20574. $core.addClass('ClassMoved', $globals.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
  20575. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  20576. $core.addMethod(
  20577. $core.method({
  20578. selector: "oldPackage",
  20579. protocol: 'accessing',
  20580. fn: function (){
  20581. var self=this;
  20582. return self["@oldPackage"];
  20583. },
  20584. args: [],
  20585. source: "oldPackage\x0a\x09^ oldPackage",
  20586. referencedClasses: [],
  20587. messageSends: []
  20588. }),
  20589. $globals.ClassMoved);
  20590. $core.addMethod(
  20591. $core.method({
  20592. selector: "oldPackage:",
  20593. protocol: 'accessing',
  20594. fn: function (aPackage){
  20595. var self=this;
  20596. self["@oldPackage"]=aPackage;
  20597. return self;
  20598. },
  20599. args: ["aPackage"],
  20600. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  20601. referencedClasses: [],
  20602. messageSends: []
  20603. }),
  20604. $globals.ClassMoved);
  20605. $core.addClass('ClassRemoved', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  20606. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  20607. $core.addClass('ClassRenamed', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  20608. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  20609. $core.addClass('MethodAnnouncement', $globals.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  20610. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  20611. $core.addMethod(
  20612. $core.method({
  20613. selector: "method",
  20614. protocol: 'accessing',
  20615. fn: function (){
  20616. var self=this;
  20617. return self["@method"];
  20618. },
  20619. args: [],
  20620. source: "method\x0a\x09^ method",
  20621. referencedClasses: [],
  20622. messageSends: []
  20623. }),
  20624. $globals.MethodAnnouncement);
  20625. $core.addMethod(
  20626. $core.method({
  20627. selector: "method:",
  20628. protocol: 'accessing',
  20629. fn: function (aCompiledMethod){
  20630. var self=this;
  20631. self["@method"]=aCompiledMethod;
  20632. return self;
  20633. },
  20634. args: ["aCompiledMethod"],
  20635. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  20636. referencedClasses: [],
  20637. messageSends: []
  20638. }),
  20639. $globals.MethodAnnouncement);
  20640. $core.addClass('MethodAdded', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  20641. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  20642. $core.addClass('MethodModified', $globals.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
  20643. $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.";
  20644. $core.addMethod(
  20645. $core.method({
  20646. selector: "oldMethod",
  20647. protocol: 'accessing',
  20648. fn: function (){
  20649. var self=this;
  20650. return self["@oldMethod"];
  20651. },
  20652. args: [],
  20653. source: "oldMethod\x0a\x09^ oldMethod",
  20654. referencedClasses: [],
  20655. messageSends: []
  20656. }),
  20657. $globals.MethodModified);
  20658. $core.addMethod(
  20659. $core.method({
  20660. selector: "oldMethod:",
  20661. protocol: 'accessing',
  20662. fn: function (aMethod){
  20663. var self=this;
  20664. self["@oldMethod"]=aMethod;
  20665. return self;
  20666. },
  20667. args: ["aMethod"],
  20668. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  20669. referencedClasses: [],
  20670. messageSends: []
  20671. }),
  20672. $globals.MethodModified);
  20673. $core.addClass('MethodMoved', $globals.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
  20674. $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.";
  20675. $core.addMethod(
  20676. $core.method({
  20677. selector: "oldProtocol",
  20678. protocol: 'accessing',
  20679. fn: function (){
  20680. var self=this;
  20681. return self["@oldProtocol"];
  20682. },
  20683. args: [],
  20684. source: "oldProtocol\x0a\x09^ oldProtocol",
  20685. referencedClasses: [],
  20686. messageSends: []
  20687. }),
  20688. $globals.MethodMoved);
  20689. $core.addMethod(
  20690. $core.method({
  20691. selector: "oldProtocol:",
  20692. protocol: 'accessing',
  20693. fn: function (aString){
  20694. var self=this;
  20695. self["@oldProtocol"]=aString;
  20696. return self;
  20697. },
  20698. args: ["aString"],
  20699. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  20700. referencedClasses: [],
  20701. messageSends: []
  20702. }),
  20703. $globals.MethodMoved);
  20704. $core.addClass('MethodRemoved', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  20705. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  20706. $core.addClass('PackageAnnouncement', $globals.SystemAnnouncement, ['package'], 'Kernel-Announcements');
  20707. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  20708. $core.addMethod(
  20709. $core.method({
  20710. selector: "package",
  20711. protocol: 'accessing',
  20712. fn: function (){
  20713. var self=this;
  20714. return self["@package"];
  20715. },
  20716. args: [],
  20717. source: "package\x0a\x09^ package",
  20718. referencedClasses: [],
  20719. messageSends: []
  20720. }),
  20721. $globals.PackageAnnouncement);
  20722. $core.addMethod(
  20723. $core.method({
  20724. selector: "package:",
  20725. protocol: 'accessing',
  20726. fn: function (aPackage){
  20727. var self=this;
  20728. self["@package"]=aPackage;
  20729. return self;
  20730. },
  20731. args: ["aPackage"],
  20732. source: "package: aPackage\x0a\x09package := aPackage",
  20733. referencedClasses: [],
  20734. messageSends: []
  20735. }),
  20736. $globals.PackageAnnouncement);
  20737. $core.addClass('PackageAdded', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  20738. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  20739. $core.addClass('PackageClean', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  20740. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  20741. $core.addClass('PackageDirty', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  20742. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  20743. $core.addClass('PackageRemoved', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  20744. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  20745. $core.addClass('ProtocolAnnouncement', $globals.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
  20746. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  20747. $core.addMethod(
  20748. $core.method({
  20749. selector: "package",
  20750. protocol: 'accessing',
  20751. fn: function (){
  20752. var self=this;
  20753. return $core.withContext(function($ctx1) {
  20754. var $1,$receiver;
  20755. $1=self._theClass();
  20756. if(($receiver = $1) == null || $receiver.isNil){
  20757. return $1;
  20758. } else {
  20759. var class_;
  20760. class_=$receiver;
  20761. return $recv(class_)._packageOfProtocol_(self._protocol());
  20762. };
  20763. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  20764. },
  20765. args: [],
  20766. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  20767. referencedClasses: [],
  20768. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  20769. }),
  20770. $globals.ProtocolAnnouncement);
  20771. $core.addMethod(
  20772. $core.method({
  20773. selector: "protocol",
  20774. protocol: 'accessing',
  20775. fn: function (){
  20776. var self=this;
  20777. return self["@protocol"];
  20778. },
  20779. args: [],
  20780. source: "protocol\x0a\x09^ protocol",
  20781. referencedClasses: [],
  20782. messageSends: []
  20783. }),
  20784. $globals.ProtocolAnnouncement);
  20785. $core.addMethod(
  20786. $core.method({
  20787. selector: "protocol:",
  20788. protocol: 'accessing',
  20789. fn: function (aString){
  20790. var self=this;
  20791. self["@protocol"]=aString;
  20792. return self;
  20793. },
  20794. args: ["aString"],
  20795. source: "protocol: aString\x0a\x09protocol := aString",
  20796. referencedClasses: [],
  20797. messageSends: []
  20798. }),
  20799. $globals.ProtocolAnnouncement);
  20800. $core.addMethod(
  20801. $core.method({
  20802. selector: "theClass",
  20803. protocol: 'accessing',
  20804. fn: function (){
  20805. var self=this;
  20806. return self["@theClass"];
  20807. },
  20808. args: [],
  20809. source: "theClass\x0a\x09^ theClass",
  20810. referencedClasses: [],
  20811. messageSends: []
  20812. }),
  20813. $globals.ProtocolAnnouncement);
  20814. $core.addMethod(
  20815. $core.method({
  20816. selector: "theClass:",
  20817. protocol: 'accessing',
  20818. fn: function (aClass){
  20819. var self=this;
  20820. self["@theClass"]=aClass;
  20821. return self;
  20822. },
  20823. args: ["aClass"],
  20824. source: "theClass: aClass\x0a\x09theClass := aClass",
  20825. referencedClasses: [],
  20826. messageSends: []
  20827. }),
  20828. $globals.ProtocolAnnouncement);
  20829. $core.addClass('ProtocolAdded', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  20830. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  20831. $core.addClass('ProtocolRemoved', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  20832. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  20833. });
  20834. define("amber_core/Platform-Services", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections", "amber_core/Kernel-Methods", "amber_core/Kernel-Infrastructure"], function($boot){"use strict";
  20835. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  20836. $core.addPackage('Platform-Services');
  20837. $core.packages["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  20838. $core.packages["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20839. $core.addClass('ConsoleErrorHandler', $globals.Object, [], 'Platform-Services');
  20840. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  20841. $core.addMethod(
  20842. $core.method({
  20843. selector: "handleError:",
  20844. protocol: 'error handling',
  20845. fn: function (anError){
  20846. var self=this;
  20847. return $core.withContext(function($ctx1) {
  20848. var $1,$receiver;
  20849. $1=$recv(anError)._context();
  20850. $ctx1.sendIdx["context"]=1;
  20851. if(($receiver = $1) == null || $receiver.isNil){
  20852. $1;
  20853. } else {
  20854. self._logErrorContext_($recv(anError)._context());
  20855. };
  20856. self._logError_(anError);
  20857. return self;
  20858. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  20859. },
  20860. args: ["anError"],
  20861. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  20862. referencedClasses: [],
  20863. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  20864. }),
  20865. $globals.ConsoleErrorHandler);
  20866. $core.addMethod(
  20867. $core.method({
  20868. selector: "log:",
  20869. protocol: 'private',
  20870. fn: function (aString){
  20871. var self=this;
  20872. return $core.withContext(function($ctx1) {
  20873. $recv(console)._log_(aString);
  20874. return self;
  20875. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  20876. },
  20877. args: ["aString"],
  20878. source: "log: aString\x0a\x09console log: aString",
  20879. referencedClasses: [],
  20880. messageSends: ["log:"]
  20881. }),
  20882. $globals.ConsoleErrorHandler);
  20883. $core.addMethod(
  20884. $core.method({
  20885. selector: "logContext:",
  20886. protocol: 'private',
  20887. fn: function (aContext){
  20888. var self=this;
  20889. return $core.withContext(function($ctx1) {
  20890. var $1,$receiver;
  20891. $1=$recv(aContext)._home();
  20892. $ctx1.sendIdx["home"]=1;
  20893. if(($receiver = $1) == null || $receiver.isNil){
  20894. $1;
  20895. } else {
  20896. self._logContext_($recv(aContext)._home());
  20897. };
  20898. self._log_($recv(aContext)._asString());
  20899. return self;
  20900. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  20901. },
  20902. args: ["aContext"],
  20903. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  20904. referencedClasses: [],
  20905. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  20906. }),
  20907. $globals.ConsoleErrorHandler);
  20908. $core.addMethod(
  20909. $core.method({
  20910. selector: "logError:",
  20911. protocol: 'private',
  20912. fn: function (anError){
  20913. var self=this;
  20914. return $core.withContext(function($ctx1) {
  20915. self._log_($recv(anError)._messageText());
  20916. return self;
  20917. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  20918. },
  20919. args: ["anError"],
  20920. source: "logError: anError\x0a\x09self log: anError messageText",
  20921. referencedClasses: [],
  20922. messageSends: ["log:", "messageText"]
  20923. }),
  20924. $globals.ConsoleErrorHandler);
  20925. $core.addMethod(
  20926. $core.method({
  20927. selector: "logErrorContext:",
  20928. protocol: 'private',
  20929. fn: function (aContext){
  20930. var self=this;
  20931. return $core.withContext(function($ctx1) {
  20932. var $1,$receiver;
  20933. if(($receiver = aContext) == null || $receiver.isNil){
  20934. aContext;
  20935. } else {
  20936. $1=$recv(aContext)._home();
  20937. $ctx1.sendIdx["home"]=1;
  20938. if(($receiver = $1) == null || $receiver.isNil){
  20939. $1;
  20940. } else {
  20941. self._logContext_($recv(aContext)._home());
  20942. };
  20943. };
  20944. return self;
  20945. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  20946. },
  20947. args: ["aContext"],
  20948. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  20949. referencedClasses: [],
  20950. messageSends: ["ifNotNil:", "home", "logContext:"]
  20951. }),
  20952. $globals.ConsoleErrorHandler);
  20953. $globals.ConsoleErrorHandler.klass.iVarNames = ['current'];
  20954. $core.addMethod(
  20955. $core.method({
  20956. selector: "initialize",
  20957. protocol: 'initialization',
  20958. fn: function (){
  20959. var self=this;
  20960. function $ErrorHandler(){return $globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  20961. return $core.withContext(function($ctx1) {
  20962. $recv($ErrorHandler())._registerIfNone_(self._new());
  20963. return self;
  20964. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.klass)});
  20965. },
  20966. args: [],
  20967. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  20968. referencedClasses: ["ErrorHandler"],
  20969. messageSends: ["registerIfNone:", "new"]
  20970. }),
  20971. $globals.ConsoleErrorHandler.klass);
  20972. $core.addClass('ConsoleTranscript', $globals.Object, ['textarea'], 'Platform-Services');
  20973. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  20974. $core.addMethod(
  20975. $core.method({
  20976. selector: "clear",
  20977. protocol: 'printing',
  20978. fn: function (){
  20979. var self=this;
  20980. return self;
  20981. },
  20982. args: [],
  20983. source: "clear\x0a\x09\x22no op\x22",
  20984. referencedClasses: [],
  20985. messageSends: []
  20986. }),
  20987. $globals.ConsoleTranscript);
  20988. $core.addMethod(
  20989. $core.method({
  20990. selector: "cr",
  20991. protocol: 'printing',
  20992. fn: function (){
  20993. var self=this;
  20994. return self;
  20995. },
  20996. args: [],
  20997. source: "cr\x0a\x09\x22no op\x22",
  20998. referencedClasses: [],
  20999. messageSends: []
  21000. }),
  21001. $globals.ConsoleTranscript);
  21002. $core.addMethod(
  21003. $core.method({
  21004. selector: "open",
  21005. protocol: 'actions',
  21006. fn: function (){
  21007. var self=this;
  21008. return self;
  21009. },
  21010. args: [],
  21011. source: "open",
  21012. referencedClasses: [],
  21013. messageSends: []
  21014. }),
  21015. $globals.ConsoleTranscript);
  21016. $core.addMethod(
  21017. $core.method({
  21018. selector: "show:",
  21019. protocol: 'printing',
  21020. fn: function (anObject){
  21021. var self=this;
  21022. return $core.withContext(function($ctx1) {
  21023. console.log(String($recv(anObject)._asString()));
  21024. return self;
  21025. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  21026. },
  21027. args: ["anObject"],
  21028. 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()))>",
  21029. referencedClasses: [],
  21030. messageSends: []
  21031. }),
  21032. $globals.ConsoleTranscript);
  21033. $core.addMethod(
  21034. $core.method({
  21035. selector: "initialize",
  21036. protocol: 'initialization',
  21037. fn: function (){
  21038. var self=this;
  21039. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  21040. return $core.withContext(function($ctx1) {
  21041. $recv($Transcript())._registerIfNone_(self._new());
  21042. return self;
  21043. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.klass)});
  21044. },
  21045. args: [],
  21046. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  21047. referencedClasses: ["Transcript"],
  21048. messageSends: ["registerIfNone:", "new"]
  21049. }),
  21050. $globals.ConsoleTranscript.klass);
  21051. $core.addClass('InterfacingObject', $globals.Object, [], 'Platform-Services');
  21052. $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 }.";
  21053. $core.addMethod(
  21054. $core.method({
  21055. selector: "ajax:",
  21056. protocol: 'actions',
  21057. fn: function (anObject){
  21058. var self=this;
  21059. function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  21060. return $core.withContext(function($ctx1) {
  21061. self._deprecatedAPI();
  21062. return $recv($PlatformInterface())._ajax_(anObject);
  21063. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.InterfacingObject)});
  21064. },
  21065. args: ["anObject"],
  21066. source: "ajax: anObject\x0a\x09self deprecatedAPI.\x0a\x09^ PlatformInterface ajax: anObject",
  21067. referencedClasses: ["PlatformInterface"],
  21068. messageSends: ["deprecatedAPI", "ajax:"]
  21069. }),
  21070. $globals.InterfacingObject);
  21071. $core.addMethod(
  21072. $core.method({
  21073. selector: "alert:",
  21074. protocol: 'actions',
  21075. fn: function (aString){
  21076. var self=this;
  21077. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21078. return $core.withContext(function($ctx1) {
  21079. return $recv($Terminal())._alert_(aString);
  21080. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.InterfacingObject)});
  21081. },
  21082. args: ["aString"],
  21083. source: "alert: aString\x0a\x09^ Terminal alert: aString",
  21084. referencedClasses: ["Terminal"],
  21085. messageSends: ["alert:"]
  21086. }),
  21087. $globals.InterfacingObject);
  21088. $core.addMethod(
  21089. $core.method({
  21090. selector: "confirm:",
  21091. protocol: 'actions',
  21092. fn: function (aString){
  21093. var self=this;
  21094. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21095. return $core.withContext(function($ctx1) {
  21096. return $recv($Terminal())._confirm_(aString);
  21097. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.InterfacingObject)});
  21098. },
  21099. args: ["aString"],
  21100. source: "confirm: aString\x0a\x09^ Terminal confirm: aString",
  21101. referencedClasses: ["Terminal"],
  21102. messageSends: ["confirm:"]
  21103. }),
  21104. $globals.InterfacingObject);
  21105. $core.addMethod(
  21106. $core.method({
  21107. selector: "prompt:",
  21108. protocol: 'actions',
  21109. fn: function (aString){
  21110. var self=this;
  21111. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21112. return $core.withContext(function($ctx1) {
  21113. return $recv($Terminal())._prompt_(aString);
  21114. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.InterfacingObject)});
  21115. },
  21116. args: ["aString"],
  21117. source: "prompt: aString\x0a\x09^ Terminal prompt: aString",
  21118. referencedClasses: ["Terminal"],
  21119. messageSends: ["prompt:"]
  21120. }),
  21121. $globals.InterfacingObject);
  21122. $core.addMethod(
  21123. $core.method({
  21124. selector: "prompt:default:",
  21125. protocol: 'actions',
  21126. fn: function (aString,defaultString){
  21127. var self=this;
  21128. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21129. return $core.withContext(function($ctx1) {
  21130. return $recv($Terminal())._prompt_default_(aString,defaultString);
  21131. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.InterfacingObject)});
  21132. },
  21133. args: ["aString", "defaultString"],
  21134. source: "prompt: aString default: defaultString\x0a\x09^ Terminal prompt: aString default: defaultString",
  21135. referencedClasses: ["Terminal"],
  21136. messageSends: ["prompt:default:"]
  21137. }),
  21138. $globals.InterfacingObject);
  21139. $core.addClass('Environment', $globals.InterfacingObject, [], 'Platform-Services');
  21140. $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.";
  21141. $core.addMethod(
  21142. $core.method({
  21143. selector: "addInstVarNamed:to:",
  21144. protocol: 'compiling',
  21145. fn: function (aString,aClass){
  21146. var self=this;
  21147. return $core.withContext(function($ctx1) {
  21148. var $1,$2,$3,$5,$4;
  21149. $1=self._classBuilder();
  21150. $2=$recv(aClass)._superclass();
  21151. $3=$recv(aClass)._name();
  21152. $ctx1.sendIdx["name"]=1;
  21153. $5=$recv($recv(aClass)._instanceVariableNames())._copy();
  21154. $recv($5)._add_(aString);
  21155. $4=$recv($5)._yourself();
  21156. $recv($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$4,$recv($recv(aClass)._package())._name());
  21157. return self;
  21158. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},$globals.Environment)});
  21159. },
  21160. args: ["aString", "aClass"],
  21161. 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",
  21162. referencedClasses: [],
  21163. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"]
  21164. }),
  21165. $globals.Environment);
  21166. $core.addMethod(
  21167. $core.method({
  21168. selector: "allSelectors",
  21169. protocol: 'accessing',
  21170. fn: function (){
  21171. var self=this;
  21172. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21173. return $core.withContext(function($ctx1) {
  21174. return $recv($recv($Smalltalk())._core())._allSelectors();
  21175. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  21176. },
  21177. args: [],
  21178. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  21179. referencedClasses: ["Smalltalk"],
  21180. messageSends: ["allSelectors", "core"]
  21181. }),
  21182. $globals.Environment);
  21183. $core.addMethod(
  21184. $core.method({
  21185. selector: "availableClassNames",
  21186. protocol: 'accessing',
  21187. fn: function (){
  21188. var self=this;
  21189. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21190. return $core.withContext(function($ctx1) {
  21191. return $recv($recv($Smalltalk())._classes())._collect_((function(each){
  21192. return $core.withContext(function($ctx2) {
  21193. return $recv(each)._name();
  21194. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21195. }));
  21196. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  21197. },
  21198. args: [],
  21199. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  21200. referencedClasses: ["Smalltalk"],
  21201. messageSends: ["collect:", "classes", "name"]
  21202. }),
  21203. $globals.Environment);
  21204. $core.addMethod(
  21205. $core.method({
  21206. selector: "availablePackageNames",
  21207. protocol: 'accessing',
  21208. fn: function (){
  21209. var self=this;
  21210. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21211. return $core.withContext(function($ctx1) {
  21212. return $recv($recv($Smalltalk())._packages())._collect_((function(each){
  21213. return $core.withContext(function($ctx2) {
  21214. return $recv(each)._name();
  21215. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21216. }));
  21217. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  21218. },
  21219. args: [],
  21220. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  21221. referencedClasses: ["Smalltalk"],
  21222. messageSends: ["collect:", "packages", "name"]
  21223. }),
  21224. $globals.Environment);
  21225. $core.addMethod(
  21226. $core.method({
  21227. selector: "availableProtocolsFor:",
  21228. protocol: 'accessing',
  21229. fn: function (aClass){
  21230. var self=this;
  21231. var protocols;
  21232. return $core.withContext(function($ctx1) {
  21233. var $1,$receiver;
  21234. protocols=$recv(aClass)._protocols();
  21235. $1=$recv(aClass)._superclass();
  21236. $ctx1.sendIdx["superclass"]=1;
  21237. if(($receiver = $1) == null || $receiver.isNil){
  21238. $1;
  21239. } else {
  21240. $recv(protocols)._addAll_(self._availableProtocolsFor_($recv(aClass)._superclass()));
  21241. };
  21242. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  21243. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  21244. },
  21245. args: ["aClass"],
  21246. 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",
  21247. referencedClasses: [],
  21248. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  21249. }),
  21250. $globals.Environment);
  21251. $core.addMethod(
  21252. $core.method({
  21253. selector: "classBuilder",
  21254. protocol: 'accessing',
  21255. fn: function (){
  21256. var self=this;
  21257. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  21258. return $core.withContext(function($ctx1) {
  21259. return $recv($ClassBuilder())._new();
  21260. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  21261. },
  21262. args: [],
  21263. source: "classBuilder\x0a\x09^ ClassBuilder new",
  21264. referencedClasses: ["ClassBuilder"],
  21265. messageSends: ["new"]
  21266. }),
  21267. $globals.Environment);
  21268. $core.addMethod(
  21269. $core.method({
  21270. selector: "classNamed:",
  21271. protocol: 'accessing',
  21272. fn: function (aString){
  21273. var self=this;
  21274. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21275. return $core.withContext(function($ctx1) {
  21276. var $1,$receiver;
  21277. $1=$recv($recv($Smalltalk())._globals())._at_($recv(aString)._asSymbol());
  21278. if(($receiver = $1) == null || $receiver.isNil){
  21279. return self._error_("Invalid class name");
  21280. } else {
  21281. return $1;
  21282. };
  21283. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  21284. },
  21285. args: ["aString"],
  21286. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  21287. referencedClasses: ["Smalltalk"],
  21288. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  21289. }),
  21290. $globals.Environment);
  21291. $core.addMethod(
  21292. $core.method({
  21293. selector: "classes",
  21294. protocol: 'accessing',
  21295. fn: function (){
  21296. var self=this;
  21297. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21298. return $core.withContext(function($ctx1) {
  21299. return $recv($Smalltalk())._classes();
  21300. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  21301. },
  21302. args: [],
  21303. source: "classes\x0a\x09^ Smalltalk classes",
  21304. referencedClasses: ["Smalltalk"],
  21305. messageSends: ["classes"]
  21306. }),
  21307. $globals.Environment);
  21308. $core.addMethod(
  21309. $core.method({
  21310. selector: "commitPackage:onSuccess:onError:",
  21311. protocol: 'actions',
  21312. fn: function (aPackage,aBlock,anotherBlock){
  21313. var self=this;
  21314. return $core.withContext(function($ctx1) {
  21315. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  21316. return self;
  21317. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  21318. },
  21319. args: ["aPackage", "aBlock", "anotherBlock"],
  21320. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  21321. referencedClasses: [],
  21322. messageSends: ["commitOnSuccess:onError:", "transport"]
  21323. }),
  21324. $globals.Environment);
  21325. $core.addMethod(
  21326. $core.method({
  21327. selector: "compileClassComment:for:",
  21328. protocol: 'compiling',
  21329. fn: function (aString,aClass){
  21330. var self=this;
  21331. return $core.withContext(function($ctx1) {
  21332. $recv(aClass)._comment_(aString);
  21333. return self;
  21334. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  21335. },
  21336. args: ["aString", "aClass"],
  21337. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  21338. referencedClasses: [],
  21339. messageSends: ["comment:"]
  21340. }),
  21341. $globals.Environment);
  21342. $core.addMethod(
  21343. $core.method({
  21344. selector: "compileClassDefinition:",
  21345. protocol: 'compiling',
  21346. fn: function (aString){
  21347. var self=this;
  21348. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  21349. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  21350. return $core.withContext(function($ctx1) {
  21351. $recv((function(){
  21352. return $core.withContext(function($ctx2) {
  21353. return self._evaluate_for_(aString,$recv($DoIt())._new());
  21354. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  21355. }))._on_do_($Error(),(function(error){
  21356. return $core.withContext(function($ctx2) {
  21357. return self._alert_($recv(error)._messageText());
  21358. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  21359. }));
  21360. return self;
  21361. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  21362. },
  21363. args: ["aString"],
  21364. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | self alert: error messageText ]",
  21365. referencedClasses: ["DoIt", "Error"],
  21366. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  21367. }),
  21368. $globals.Environment);
  21369. $core.addMethod(
  21370. $core.method({
  21371. selector: "compileMethod:for:protocol:",
  21372. protocol: 'compiling',
  21373. fn: function (sourceCode,class_,protocol){
  21374. var self=this;
  21375. return $core.withContext(function($ctx1) {
  21376. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  21377. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  21378. },
  21379. args: ["sourceCode", "class", "protocol"],
  21380. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  21381. referencedClasses: [],
  21382. messageSends: ["compile:protocol:"]
  21383. }),
  21384. $globals.Environment);
  21385. $core.addMethod(
  21386. $core.method({
  21387. selector: "copyClass:to:",
  21388. protocol: 'actions',
  21389. fn: function (aClass,aClassName){
  21390. var self=this;
  21391. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21392. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  21393. return $core.withContext(function($ctx1) {
  21394. var $1,$2,$receiver;
  21395. $1=$recv($recv($Smalltalk())._globals())._at_(aClassName);
  21396. if(($receiver = $1) == null || $receiver.isNil){
  21397. $1;
  21398. } else {
  21399. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  21400. $ctx1.sendIdx[","]=1;
  21401. self._error_($2);
  21402. };
  21403. $recv($recv($ClassBuilder())._new())._copyClass_named_(aClass,aClassName);
  21404. return self;
  21405. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  21406. },
  21407. args: ["aClass", "aClassName"],
  21408. 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",
  21409. referencedClasses: ["Smalltalk", "ClassBuilder"],
  21410. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  21411. }),
  21412. $globals.Environment);
  21413. $core.addMethod(
  21414. $core.method({
  21415. selector: "doItReceiver",
  21416. protocol: 'accessing',
  21417. fn: function (){
  21418. var self=this;
  21419. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  21420. return $core.withContext(function($ctx1) {
  21421. return $recv($DoIt())._new();
  21422. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  21423. },
  21424. args: [],
  21425. source: "doItReceiver\x0a\x09^ DoIt new",
  21426. referencedClasses: ["DoIt"],
  21427. messageSends: ["new"]
  21428. }),
  21429. $globals.Environment);
  21430. $core.addMethod(
  21431. $core.method({
  21432. selector: "evaluate:for:",
  21433. protocol: 'evaluating',
  21434. fn: function (aString,anObject){
  21435. var self=this;
  21436. function $Evaluator(){return $globals.Evaluator||(typeof Evaluator=="undefined"?nil:Evaluator)}
  21437. return $core.withContext(function($ctx1) {
  21438. return $recv($Evaluator())._evaluate_for_(aString,anObject);
  21439. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  21440. },
  21441. args: ["aString", "anObject"],
  21442. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  21443. referencedClasses: ["Evaluator"],
  21444. messageSends: ["evaluate:for:"]
  21445. }),
  21446. $globals.Environment);
  21447. $core.addMethod(
  21448. $core.method({
  21449. selector: "evaluate:on:do:",
  21450. protocol: 'error handling',
  21451. fn: function (aBlock,anErrorClass,exceptionBlock){
  21452. var self=this;
  21453. return $core.withContext(function($ctx1) {
  21454. var $1;
  21455. $recv(aBlock)._tryCatch_((function(exception){
  21456. return $core.withContext(function($ctx2) {
  21457. $1=$recv(exception)._isKindOf_(self._classNamed_($recv(anErrorClass)._name()));
  21458. if($core.assert($1)){
  21459. return $recv(exceptionBlock)._value_(exception);
  21460. } else {
  21461. return $recv(exception)._resignal();
  21462. };
  21463. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  21464. }));
  21465. return self;
  21466. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  21467. },
  21468. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  21469. 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 ] ]",
  21470. referencedClasses: [],
  21471. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "resignal"]
  21472. }),
  21473. $globals.Environment);
  21474. $core.addMethod(
  21475. $core.method({
  21476. selector: "inspect:",
  21477. protocol: 'actions',
  21478. fn: function (anObject){
  21479. var self=this;
  21480. function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  21481. return $core.withContext(function($ctx1) {
  21482. $recv($Inspector())._inspect_(anObject);
  21483. return self;
  21484. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  21485. },
  21486. args: ["anObject"],
  21487. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  21488. referencedClasses: ["Inspector"],
  21489. messageSends: ["inspect:"]
  21490. }),
  21491. $globals.Environment);
  21492. $core.addMethod(
  21493. $core.method({
  21494. selector: "moveClass:toPackage:",
  21495. protocol: 'actions',
  21496. fn: function (aClass,aPackageName){
  21497. var self=this;
  21498. var package_;
  21499. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  21500. return $core.withContext(function($ctx1) {
  21501. var $1,$2,$receiver;
  21502. package_=$recv($Package())._named_(aPackageName);
  21503. $1=package_;
  21504. if(($receiver = $1) == null || $receiver.isNil){
  21505. self._error_("Invalid package name");
  21506. } else {
  21507. $1;
  21508. };
  21509. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  21510. if($core.assert($2)){
  21511. return self;
  21512. };
  21513. $recv(aClass)._package_(package_);
  21514. return self;
  21515. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  21516. },
  21517. args: ["aClass", "aPackageName"],
  21518. 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",
  21519. referencedClasses: ["Package"],
  21520. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"]
  21521. }),
  21522. $globals.Environment);
  21523. $core.addMethod(
  21524. $core.method({
  21525. selector: "moveMethod:toClass:",
  21526. protocol: 'actions',
  21527. fn: function (aMethod,aClassName){
  21528. var self=this;
  21529. var destinationClass;
  21530. return $core.withContext(function($ctx1) {
  21531. var $2,$3,$1,$5,$4;
  21532. destinationClass=self._classNamed_(aClassName);
  21533. $2=destinationClass;
  21534. $3=$recv(aMethod)._methodClass();
  21535. $ctx1.sendIdx["methodClass"]=1;
  21536. $1=$recv($2).__eq_eq($3);
  21537. if($core.assert($1)){
  21538. return self;
  21539. };
  21540. $5=$recv(aMethod)._methodClass();
  21541. $ctx1.sendIdx["methodClass"]=2;
  21542. $4=$recv($5)._isMetaclass();
  21543. if($core.assert($4)){
  21544. destinationClass=$recv(destinationClass)._class();
  21545. destinationClass;
  21546. };
  21547. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  21548. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  21549. return self;
  21550. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  21551. },
  21552. args: ["aMethod", "aClassName"],
  21553. 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",
  21554. referencedClasses: [],
  21555. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "class", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  21556. }),
  21557. $globals.Environment);
  21558. $core.addMethod(
  21559. $core.method({
  21560. selector: "moveMethod:toProtocol:",
  21561. protocol: 'actions',
  21562. fn: function (aMethod,aProtocol){
  21563. var self=this;
  21564. return $core.withContext(function($ctx1) {
  21565. $recv(aMethod)._protocol_(aProtocol);
  21566. return self;
  21567. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  21568. },
  21569. args: ["aMethod", "aProtocol"],
  21570. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol",
  21571. referencedClasses: [],
  21572. messageSends: ["protocol:"]
  21573. }),
  21574. $globals.Environment);
  21575. $core.addMethod(
  21576. $core.method({
  21577. selector: "packages",
  21578. protocol: 'accessing',
  21579. fn: function (){
  21580. var self=this;
  21581. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21582. return $core.withContext(function($ctx1) {
  21583. return $recv($Smalltalk())._packages();
  21584. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  21585. },
  21586. args: [],
  21587. source: "packages\x0a\x09^ Smalltalk packages",
  21588. referencedClasses: ["Smalltalk"],
  21589. messageSends: ["packages"]
  21590. }),
  21591. $globals.Environment);
  21592. $core.addMethod(
  21593. $core.method({
  21594. selector: "registerErrorHandler:",
  21595. protocol: 'services',
  21596. fn: function (anErrorHandler){
  21597. var self=this;
  21598. function $ErrorHandler(){return $globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  21599. return $core.withContext(function($ctx1) {
  21600. $recv($ErrorHandler())._register_(anErrorHandler);
  21601. return self;
  21602. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  21603. },
  21604. args: ["anErrorHandler"],
  21605. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  21606. referencedClasses: ["ErrorHandler"],
  21607. messageSends: ["register:"]
  21608. }),
  21609. $globals.Environment);
  21610. $core.addMethod(
  21611. $core.method({
  21612. selector: "registerFinder:",
  21613. protocol: 'services',
  21614. fn: function (aFinder){
  21615. var self=this;
  21616. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  21617. return $core.withContext(function($ctx1) {
  21618. $recv($Finder())._register_(aFinder);
  21619. return self;
  21620. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  21621. },
  21622. args: ["aFinder"],
  21623. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  21624. referencedClasses: ["Finder"],
  21625. messageSends: ["register:"]
  21626. }),
  21627. $globals.Environment);
  21628. $core.addMethod(
  21629. $core.method({
  21630. selector: "registerInspector:",
  21631. protocol: 'services',
  21632. fn: function (anInspector){
  21633. var self=this;
  21634. function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  21635. return $core.withContext(function($ctx1) {
  21636. $recv($Inspector())._register_(anInspector);
  21637. return self;
  21638. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  21639. },
  21640. args: ["anInspector"],
  21641. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  21642. referencedClasses: ["Inspector"],
  21643. messageSends: ["register:"]
  21644. }),
  21645. $globals.Environment);
  21646. $core.addMethod(
  21647. $core.method({
  21648. selector: "registerProgressHandler:",
  21649. protocol: 'services',
  21650. fn: function (aProgressHandler){
  21651. var self=this;
  21652. function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  21653. return $core.withContext(function($ctx1) {
  21654. $recv($ProgressHandler())._register_(aProgressHandler);
  21655. return self;
  21656. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  21657. },
  21658. args: ["aProgressHandler"],
  21659. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  21660. referencedClasses: ["ProgressHandler"],
  21661. messageSends: ["register:"]
  21662. }),
  21663. $globals.Environment);
  21664. $core.addMethod(
  21665. $core.method({
  21666. selector: "registerTranscript:",
  21667. protocol: 'services',
  21668. fn: function (aTranscript){
  21669. var self=this;
  21670. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  21671. return $core.withContext(function($ctx1) {
  21672. $recv($Transcript())._register_(aTranscript);
  21673. return self;
  21674. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  21675. },
  21676. args: ["aTranscript"],
  21677. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  21678. referencedClasses: ["Transcript"],
  21679. messageSends: ["register:"]
  21680. }),
  21681. $globals.Environment);
  21682. $core.addMethod(
  21683. $core.method({
  21684. selector: "removeClass:",
  21685. protocol: 'actions',
  21686. fn: function (aClass){
  21687. var self=this;
  21688. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21689. return $core.withContext(function($ctx1) {
  21690. $recv($Smalltalk())._removeClass_(aClass);
  21691. return self;
  21692. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  21693. },
  21694. args: ["aClass"],
  21695. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  21696. referencedClasses: ["Smalltalk"],
  21697. messageSends: ["removeClass:"]
  21698. }),
  21699. $globals.Environment);
  21700. $core.addMethod(
  21701. $core.method({
  21702. selector: "removeMethod:",
  21703. protocol: 'actions',
  21704. fn: function (aMethod){
  21705. var self=this;
  21706. return $core.withContext(function($ctx1) {
  21707. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  21708. return self;
  21709. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  21710. },
  21711. args: ["aMethod"],
  21712. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  21713. referencedClasses: [],
  21714. messageSends: ["removeCompiledMethod:", "methodClass"]
  21715. }),
  21716. $globals.Environment);
  21717. $core.addMethod(
  21718. $core.method({
  21719. selector: "removeProtocol:from:",
  21720. protocol: 'actions',
  21721. fn: function (aString,aClass){
  21722. var self=this;
  21723. return $core.withContext(function($ctx1) {
  21724. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  21725. return $core.withContext(function($ctx2) {
  21726. return $recv(aClass)._removeCompiledMethod_(each);
  21727. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21728. }));
  21729. return self;
  21730. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  21731. },
  21732. args: ["aString", "aClass"],
  21733. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  21734. referencedClasses: [],
  21735. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  21736. }),
  21737. $globals.Environment);
  21738. $core.addMethod(
  21739. $core.method({
  21740. selector: "renameClass:to:",
  21741. protocol: 'actions',
  21742. fn: function (aClass,aClassName){
  21743. var self=this;
  21744. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21745. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  21746. return $core.withContext(function($ctx1) {
  21747. var $1,$2,$receiver;
  21748. $1=$recv($recv($Smalltalk())._globals())._at_(aClassName);
  21749. if(($receiver = $1) == null || $receiver.isNil){
  21750. $1;
  21751. } else {
  21752. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  21753. $ctx1.sendIdx[","]=1;
  21754. self._error_($2);
  21755. };
  21756. $recv($recv($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
  21757. return self;
  21758. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  21759. },
  21760. args: ["aClass", "aClassName"],
  21761. 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",
  21762. referencedClasses: ["Smalltalk", "ClassBuilder"],
  21763. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  21764. }),
  21765. $globals.Environment);
  21766. $core.addMethod(
  21767. $core.method({
  21768. selector: "renamePackage:to:",
  21769. protocol: 'actions',
  21770. fn: function (aPackageName,aNewPackageName){
  21771. var self=this;
  21772. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21773. return $core.withContext(function($ctx1) {
  21774. var $1,$2,$receiver;
  21775. $1=$recv($recv($Smalltalk())._globals())._at_(aNewPackageName);
  21776. if(($receiver = $1) == null || $receiver.isNil){
  21777. $1;
  21778. } else {
  21779. $2=$recv("A package named ".__comma(aNewPackageName)).__comma(" already exists");
  21780. $ctx1.sendIdx[","]=1;
  21781. self._error_($2);
  21782. };
  21783. $recv($Smalltalk())._renamePackage_to_(aPackageName,aNewPackageName);
  21784. return self;
  21785. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  21786. },
  21787. args: ["aPackageName", "aNewPackageName"],
  21788. 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",
  21789. referencedClasses: ["Smalltalk"],
  21790. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renamePackage:to:"]
  21791. }),
  21792. $globals.Environment);
  21793. $core.addMethod(
  21794. $core.method({
  21795. selector: "renameProtocol:to:in:",
  21796. protocol: 'actions',
  21797. fn: function (aString,anotherString,aClass){
  21798. var self=this;
  21799. return $core.withContext(function($ctx1) {
  21800. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  21801. return $core.withContext(function($ctx2) {
  21802. return $recv(each)._protocol_(anotherString);
  21803. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21804. }));
  21805. return self;
  21806. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  21807. },
  21808. args: ["aString", "anotherString", "aClass"],
  21809. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  21810. referencedClasses: [],
  21811. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  21812. }),
  21813. $globals.Environment);
  21814. $core.addMethod(
  21815. $core.method({
  21816. selector: "setClassCommentOf:to:",
  21817. protocol: 'actions',
  21818. fn: function (aClass,aString){
  21819. var self=this;
  21820. return $core.withContext(function($ctx1) {
  21821. $recv(aClass)._comment_(aString);
  21822. return self;
  21823. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  21824. },
  21825. args: ["aClass", "aString"],
  21826. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  21827. referencedClasses: [],
  21828. messageSends: ["comment:"]
  21829. }),
  21830. $globals.Environment);
  21831. $core.addMethod(
  21832. $core.method({
  21833. selector: "systemAnnouncer",
  21834. protocol: 'accessing',
  21835. fn: function (){
  21836. var self=this;
  21837. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21838. return $core.withContext(function($ctx1) {
  21839. return $recv($recv($recv($Smalltalk())._globals())._at_("SystemAnnouncer"))._current();
  21840. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  21841. },
  21842. args: [],
  21843. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  21844. referencedClasses: ["Smalltalk"],
  21845. messageSends: ["current", "at:", "globals"]
  21846. }),
  21847. $globals.Environment);
  21848. $core.addClass('NullProgressHandler', $globals.Object, [], 'Platform-Services');
  21849. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  21850. $core.addMethod(
  21851. $core.method({
  21852. selector: "do:on:displaying:",
  21853. protocol: 'progress handling',
  21854. fn: function (aBlock,aCollection,aString){
  21855. var self=this;
  21856. return $core.withContext(function($ctx1) {
  21857. $recv(aCollection)._do_(aBlock);
  21858. return self;
  21859. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  21860. },
  21861. args: ["aBlock", "aCollection", "aString"],
  21862. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  21863. referencedClasses: [],
  21864. messageSends: ["do:"]
  21865. }),
  21866. $globals.NullProgressHandler);
  21867. $globals.NullProgressHandler.klass.iVarNames = ['current'];
  21868. $core.addMethod(
  21869. $core.method({
  21870. selector: "initialize",
  21871. protocol: 'initialization',
  21872. fn: function (){
  21873. var self=this;
  21874. function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  21875. return $core.withContext(function($ctx1) {
  21876. $recv($ProgressHandler())._registerIfNone_(self._new());
  21877. return self;
  21878. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.klass)});
  21879. },
  21880. args: [],
  21881. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  21882. referencedClasses: ["ProgressHandler"],
  21883. messageSends: ["registerIfNone:", "new"]
  21884. }),
  21885. $globals.NullProgressHandler.klass);
  21886. $core.addClass('PlatformInterface', $globals.Object, [], 'Platform-Services');
  21887. $globals.PlatformInterface.comment="Deprecated. Use `Platform` or `Terminal`.";
  21888. $core.addMethod(
  21889. $core.method({
  21890. selector: "ajax:",
  21891. protocol: 'actions',
  21892. fn: function (anObject){
  21893. var self=this;
  21894. function $JQuery(){return $globals.JQuery||(typeof JQuery=="undefined"?nil:JQuery)}
  21895. return $core.withContext(function($ctx1) {
  21896. var $receiver;
  21897. self._deprecatedAPI_("Use Platform newXhr or dedicated library.");
  21898. if(($receiver = $JQuery()) == null || $receiver.isNil){
  21899. return self._error_("JQuery wrapper not loaded, cannot do AJAX.");
  21900. } else {
  21901. return $recv($recv($JQuery())._current())._ajax_(anObject);
  21902. };
  21903. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.PlatformInterface.klass)});
  21904. },
  21905. args: ["anObject"],
  21906. 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.' ]",
  21907. referencedClasses: ["JQuery"],
  21908. messageSends: ["deprecatedAPI:", "ifNotNil:ifNil:", "ajax:", "current", "error:"]
  21909. }),
  21910. $globals.PlatformInterface.klass);
  21911. $core.addMethod(
  21912. $core.method({
  21913. selector: "alert:",
  21914. protocol: 'actions',
  21915. fn: function (aString){
  21916. var self=this;
  21917. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21918. return $core.withContext(function($ctx1) {
  21919. self._deprecatedAPI_("Use Terminal alert:");
  21920. return $recv($Terminal())._alert_(aString);
  21921. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.PlatformInterface.klass)});
  21922. },
  21923. args: ["aString"],
  21924. source: "alert: aString\x0a\x09self deprecatedAPI: 'Use Terminal alert:'.\x0a\x09^ Terminal alert: aString",
  21925. referencedClasses: ["Terminal"],
  21926. messageSends: ["deprecatedAPI:", "alert:"]
  21927. }),
  21928. $globals.PlatformInterface.klass);
  21929. $core.addMethod(
  21930. $core.method({
  21931. selector: "confirm:",
  21932. protocol: 'actions',
  21933. fn: function (aString){
  21934. var self=this;
  21935. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21936. return $core.withContext(function($ctx1) {
  21937. self._deprecatedAPI_("Use Terminal confirm:");
  21938. return $recv($Terminal())._confirm_(aString);
  21939. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.PlatformInterface.klass)});
  21940. },
  21941. args: ["aString"],
  21942. source: "confirm: aString\x0a\x09self deprecatedAPI: 'Use Terminal confirm:'.\x0a\x09^ Terminal confirm: aString",
  21943. referencedClasses: ["Terminal"],
  21944. messageSends: ["deprecatedAPI:", "confirm:"]
  21945. }),
  21946. $globals.PlatformInterface.klass);
  21947. $core.addMethod(
  21948. $core.method({
  21949. selector: "existsGlobal:",
  21950. protocol: 'actions',
  21951. fn: function (aString){
  21952. var self=this;
  21953. function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  21954. return $core.withContext(function($ctx1) {
  21955. self._deprecatedAPI_("Use Smalltalk existsJsGlobal:");
  21956. return $recv($recv($PlatformInterface())._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  21957. return true;
  21958. }),(function(){
  21959. return false;
  21960. }));
  21961. }, function($ctx1) {$ctx1.fill(self,"existsGlobal:",{aString:aString},$globals.PlatformInterface.klass)});
  21962. },
  21963. args: ["aString"],
  21964. 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 ]",
  21965. referencedClasses: ["PlatformInterface"],
  21966. messageSends: ["deprecatedAPI:", "at:ifPresent:ifAbsent:", "globals"]
  21967. }),
  21968. $globals.PlatformInterface.klass);
  21969. $core.addMethod(
  21970. $core.method({
  21971. selector: "globals",
  21972. protocol: 'accessing',
  21973. fn: function (){
  21974. var self=this;
  21975. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  21976. return $core.withContext(function($ctx1) {
  21977. self._deprecatedAPI_("Use Platform globals");
  21978. return $recv($Platform())._globals();
  21979. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.PlatformInterface.klass)});
  21980. },
  21981. args: [],
  21982. source: "globals\x0a\x09self deprecatedAPI: 'Use Platform globals'.\x0a\x09^ Platform globals",
  21983. referencedClasses: ["Platform"],
  21984. messageSends: ["deprecatedAPI:", "globals"]
  21985. }),
  21986. $globals.PlatformInterface.klass);
  21987. $core.addMethod(
  21988. $core.method({
  21989. selector: "newXhr",
  21990. protocol: 'actions',
  21991. fn: function (){
  21992. var self=this;
  21993. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  21994. return $core.withContext(function($ctx1) {
  21995. self._deprecatedAPI_("Use Platform newXhr");
  21996. return $recv($Platform())._newXhr();
  21997. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.PlatformInterface.klass)});
  21998. },
  21999. args: [],
  22000. source: "newXhr\x0a\x09self deprecatedAPI: 'Use Platform newXhr'.\x0a\x09^ Platform newXhr",
  22001. referencedClasses: ["Platform"],
  22002. messageSends: ["deprecatedAPI:", "newXhr"]
  22003. }),
  22004. $globals.PlatformInterface.klass);
  22005. $core.addMethod(
  22006. $core.method({
  22007. selector: "prompt:",
  22008. protocol: 'actions',
  22009. fn: function (aString){
  22010. var self=this;
  22011. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  22012. return $core.withContext(function($ctx1) {
  22013. self._deprecatedAPI_("Use Terminal prompt:");
  22014. return $recv($Terminal())._prompt_(aString);
  22015. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.PlatformInterface.klass)});
  22016. },
  22017. args: ["aString"],
  22018. source: "prompt: aString\x0a\x09self deprecatedAPI: 'Use Terminal prompt:'.\x0a\x09^ Terminal prompt: aString",
  22019. referencedClasses: ["Terminal"],
  22020. messageSends: ["deprecatedAPI:", "prompt:"]
  22021. }),
  22022. $globals.PlatformInterface.klass);
  22023. $core.addMethod(
  22024. $core.method({
  22025. selector: "prompt:default:",
  22026. protocol: 'actions',
  22027. fn: function (aString,defaultString){
  22028. var self=this;
  22029. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  22030. return $core.withContext(function($ctx1) {
  22031. self._deprecatedAPI_("Use Terminal prompt:default:");
  22032. return $recv($Terminal())._prompt_default_(aString,defaultString);
  22033. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.PlatformInterface.klass)});
  22034. },
  22035. args: ["aString", "defaultString"],
  22036. source: "prompt: aString default: defaultString\x0a\x09self deprecatedAPI: 'Use Terminal prompt:default:'.\x0a\x09^ Terminal prompt: aString default: defaultString",
  22037. referencedClasses: ["Terminal"],
  22038. messageSends: ["deprecatedAPI:", "prompt:default:"]
  22039. }),
  22040. $globals.PlatformInterface.klass);
  22041. $core.addClass('Service', $globals.Object, [], 'Platform-Services');
  22042. $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.";
  22043. $globals.Service.klass.iVarNames = ['current'];
  22044. $core.addMethod(
  22045. $core.method({
  22046. selector: "current",
  22047. protocol: 'accessing',
  22048. fn: function (){
  22049. var self=this;
  22050. return self["@current"];
  22051. },
  22052. args: [],
  22053. source: "current\x0a\x09^ current",
  22054. referencedClasses: [],
  22055. messageSends: []
  22056. }),
  22057. $globals.Service.klass);
  22058. $core.addMethod(
  22059. $core.method({
  22060. selector: "new",
  22061. protocol: 'instance creation',
  22062. fn: function (){
  22063. var self=this;
  22064. return $core.withContext(function($ctx1) {
  22065. self._shouldNotImplement();
  22066. return self;
  22067. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.klass)});
  22068. },
  22069. args: [],
  22070. source: "new\x0a\x09self shouldNotImplement",
  22071. referencedClasses: [],
  22072. messageSends: ["shouldNotImplement"]
  22073. }),
  22074. $globals.Service.klass);
  22075. $core.addMethod(
  22076. $core.method({
  22077. selector: "register:",
  22078. protocol: 'registration',
  22079. fn: function (anObject){
  22080. var self=this;
  22081. self["@current"]=anObject;
  22082. return self;
  22083. },
  22084. args: ["anObject"],
  22085. source: "register: anObject\x0a\x09current := anObject",
  22086. referencedClasses: [],
  22087. messageSends: []
  22088. }),
  22089. $globals.Service.klass);
  22090. $core.addMethod(
  22091. $core.method({
  22092. selector: "registerIfNone:",
  22093. protocol: 'registration',
  22094. fn: function (anObject){
  22095. var self=this;
  22096. return $core.withContext(function($ctx1) {
  22097. var $1,$receiver;
  22098. $1=self._current();
  22099. if(($receiver = $1) == null || $receiver.isNil){
  22100. self._register_(anObject);
  22101. } else {
  22102. $1;
  22103. };
  22104. return self;
  22105. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.klass)});
  22106. },
  22107. args: ["anObject"],
  22108. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  22109. referencedClasses: [],
  22110. messageSends: ["ifNil:", "current", "register:"]
  22111. }),
  22112. $globals.Service.klass);
  22113. $core.addClass('ErrorHandler', $globals.Service, [], 'Platform-Services');
  22114. $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.";
  22115. $core.addMethod(
  22116. $core.method({
  22117. selector: "handleError:",
  22118. protocol: 'error handling',
  22119. fn: function (anError){
  22120. var self=this;
  22121. return $core.withContext(function($ctx1) {
  22122. self._handleUnhandledError_(anError);
  22123. return self;
  22124. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.klass)});
  22125. },
  22126. args: ["anError"],
  22127. source: "handleError: anError\x0a\x09self handleUnhandledError: anError",
  22128. referencedClasses: [],
  22129. messageSends: ["handleUnhandledError:"]
  22130. }),
  22131. $globals.ErrorHandler.klass);
  22132. $core.addMethod(
  22133. $core.method({
  22134. selector: "handleUnhandledError:",
  22135. protocol: 'error handling',
  22136. fn: function (anError){
  22137. var self=this;
  22138. return $core.withContext(function($ctx1) {
  22139. var $1;
  22140. $1=$recv(anError)._wasHandled();
  22141. if($core.assert($1)){
  22142. return self;
  22143. };
  22144. return $recv(self._current())._handleError_(anError);
  22145. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.klass)});
  22146. },
  22147. args: ["anError"],
  22148. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifTrue: [ ^ self ].\x0a\x09\x0a\x09^ self current handleError: anError",
  22149. referencedClasses: [],
  22150. messageSends: ["ifTrue:", "wasHandled", "handleError:", "current"]
  22151. }),
  22152. $globals.ErrorHandler.klass);
  22153. $core.addClass('Finder', $globals.Service, [], 'Platform-Services');
  22154. $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.";
  22155. $core.addMethod(
  22156. $core.method({
  22157. selector: "findClass:",
  22158. protocol: 'finding',
  22159. fn: function (aClass){
  22160. var self=this;
  22161. return $core.withContext(function($ctx1) {
  22162. return $recv(self._current())._findClass_(aClass);
  22163. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.klass)});
  22164. },
  22165. args: ["aClass"],
  22166. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  22167. referencedClasses: [],
  22168. messageSends: ["findClass:", "current"]
  22169. }),
  22170. $globals.Finder.klass);
  22171. $core.addMethod(
  22172. $core.method({
  22173. selector: "findMethod:",
  22174. protocol: 'finding',
  22175. fn: function (aCompiledMethod){
  22176. var self=this;
  22177. return $core.withContext(function($ctx1) {
  22178. return $recv(self._current())._findMethod_(aCompiledMethod);
  22179. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.klass)});
  22180. },
  22181. args: ["aCompiledMethod"],
  22182. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  22183. referencedClasses: [],
  22184. messageSends: ["findMethod:", "current"]
  22185. }),
  22186. $globals.Finder.klass);
  22187. $core.addMethod(
  22188. $core.method({
  22189. selector: "findString:",
  22190. protocol: 'finding',
  22191. fn: function (aString){
  22192. var self=this;
  22193. return $core.withContext(function($ctx1) {
  22194. return $recv(self._current())._findString_(aString);
  22195. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.klass)});
  22196. },
  22197. args: ["aString"],
  22198. source: "findString: aString\x0a\x09^ self current findString: aString",
  22199. referencedClasses: [],
  22200. messageSends: ["findString:", "current"]
  22201. }),
  22202. $globals.Finder.klass);
  22203. $core.addClass('Inspector', $globals.Service, [], 'Platform-Services');
  22204. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  22205. $core.addMethod(
  22206. $core.method({
  22207. selector: "inspect:",
  22208. protocol: 'inspecting',
  22209. fn: function (anObject){
  22210. var self=this;
  22211. return $core.withContext(function($ctx1) {
  22212. return $recv(self._current())._inspect_(anObject);
  22213. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.klass)});
  22214. },
  22215. args: ["anObject"],
  22216. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  22217. referencedClasses: [],
  22218. messageSends: ["inspect:", "current"]
  22219. }),
  22220. $globals.Inspector.klass);
  22221. $core.addClass('Platform', $globals.Service, [], 'Platform-Services');
  22222. $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";
  22223. $core.addMethod(
  22224. $core.method({
  22225. selector: "globals",
  22226. protocol: 'accessing',
  22227. fn: function (){
  22228. var self=this;
  22229. return $core.withContext(function($ctx1) {
  22230. return $recv(self._current())._globals();
  22231. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.klass)});
  22232. },
  22233. args: [],
  22234. source: "globals\x0a\x09^ self current globals",
  22235. referencedClasses: [],
  22236. messageSends: ["globals", "current"]
  22237. }),
  22238. $globals.Platform.klass);
  22239. $core.addMethod(
  22240. $core.method({
  22241. selector: "newXhr",
  22242. protocol: 'accessing',
  22243. fn: function (){
  22244. var self=this;
  22245. return $core.withContext(function($ctx1) {
  22246. return $recv(self._current())._newXhr();
  22247. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.klass)});
  22248. },
  22249. args: [],
  22250. source: "newXhr\x0a\x09^ self current newXhr",
  22251. referencedClasses: [],
  22252. messageSends: ["newXhr", "current"]
  22253. }),
  22254. $globals.Platform.klass);
  22255. $core.addClass('ProgressHandler', $globals.Service, [], 'Platform-Services');
  22256. $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`.";
  22257. $core.addMethod(
  22258. $core.method({
  22259. selector: "do:on:displaying:",
  22260. protocol: 'progress handling',
  22261. fn: function (aBlock,aCollection,aString){
  22262. var self=this;
  22263. return $core.withContext(function($ctx1) {
  22264. $recv(self._current())._do_on_displaying_(aBlock,aCollection,aString);
  22265. return self;
  22266. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.klass)});
  22267. },
  22268. args: ["aBlock", "aCollection", "aString"],
  22269. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  22270. referencedClasses: [],
  22271. messageSends: ["do:on:displaying:", "current"]
  22272. }),
  22273. $globals.ProgressHandler.klass);
  22274. $core.addClass('Terminal', $globals.Service, [], 'Platform-Services');
  22275. $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:'.";
  22276. $core.addMethod(
  22277. $core.method({
  22278. selector: "alert:",
  22279. protocol: 'dialogs',
  22280. fn: function (aString){
  22281. var self=this;
  22282. return $core.withContext(function($ctx1) {
  22283. return $recv(self._current())._alert_(aString);
  22284. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.klass)});
  22285. },
  22286. args: ["aString"],
  22287. source: "alert: aString\x0a\x09^ self current alert: aString",
  22288. referencedClasses: [],
  22289. messageSends: ["alert:", "current"]
  22290. }),
  22291. $globals.Terminal.klass);
  22292. $core.addMethod(
  22293. $core.method({
  22294. selector: "confirm:",
  22295. protocol: 'dialogs',
  22296. fn: function (aString){
  22297. var self=this;
  22298. return $core.withContext(function($ctx1) {
  22299. return $recv(self._current())._confirm_(aString);
  22300. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.klass)});
  22301. },
  22302. args: ["aString"],
  22303. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  22304. referencedClasses: [],
  22305. messageSends: ["confirm:", "current"]
  22306. }),
  22307. $globals.Terminal.klass);
  22308. $core.addMethod(
  22309. $core.method({
  22310. selector: "prompt:",
  22311. protocol: 'dialogs',
  22312. fn: function (aString){
  22313. var self=this;
  22314. return $core.withContext(function($ctx1) {
  22315. return $recv(self._current())._prompt_(aString);
  22316. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.klass)});
  22317. },
  22318. args: ["aString"],
  22319. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  22320. referencedClasses: [],
  22321. messageSends: ["prompt:", "current"]
  22322. }),
  22323. $globals.Terminal.klass);
  22324. $core.addMethod(
  22325. $core.method({
  22326. selector: "prompt:default:",
  22327. protocol: 'dialogs',
  22328. fn: function (aString,defaultString){
  22329. var self=this;
  22330. return $core.withContext(function($ctx1) {
  22331. return $recv(self._current())._prompt_default_(aString,defaultString);
  22332. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.klass)});
  22333. },
  22334. args: ["aString", "defaultString"],
  22335. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  22336. referencedClasses: [],
  22337. messageSends: ["prompt:default:", "current"]
  22338. }),
  22339. $globals.Terminal.klass);
  22340. $core.addClass('Transcript', $globals.Service, [], 'Platform-Services');
  22341. $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.";
  22342. $core.addMethod(
  22343. $core.method({
  22344. selector: "clear",
  22345. protocol: 'printing',
  22346. fn: function (){
  22347. var self=this;
  22348. return $core.withContext(function($ctx1) {
  22349. $recv(self._current())._clear();
  22350. return self;
  22351. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.klass)});
  22352. },
  22353. args: [],
  22354. source: "clear\x0a\x09self current clear",
  22355. referencedClasses: [],
  22356. messageSends: ["clear", "current"]
  22357. }),
  22358. $globals.Transcript.klass);
  22359. $core.addMethod(
  22360. $core.method({
  22361. selector: "cr",
  22362. protocol: 'printing',
  22363. fn: function (){
  22364. var self=this;
  22365. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  22366. return $core.withContext(function($ctx1) {
  22367. $recv(self._current())._show_($recv($String())._cr());
  22368. return self;
  22369. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.klass)});
  22370. },
  22371. args: [],
  22372. source: "cr\x0a\x09self current show: String cr",
  22373. referencedClasses: ["String"],
  22374. messageSends: ["show:", "current", "cr"]
  22375. }),
  22376. $globals.Transcript.klass);
  22377. $core.addMethod(
  22378. $core.method({
  22379. selector: "inspect:",
  22380. protocol: 'printing',
  22381. fn: function (anObject){
  22382. var self=this;
  22383. return $core.withContext(function($ctx1) {
  22384. self._show_(anObject);
  22385. return self;
  22386. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.klass)});
  22387. },
  22388. args: ["anObject"],
  22389. source: "inspect: anObject\x0a\x09self show: anObject",
  22390. referencedClasses: [],
  22391. messageSends: ["show:"]
  22392. }),
  22393. $globals.Transcript.klass);
  22394. $core.addMethod(
  22395. $core.method({
  22396. selector: "open",
  22397. protocol: 'instance creation',
  22398. fn: function (){
  22399. var self=this;
  22400. return $core.withContext(function($ctx1) {
  22401. $recv(self._current())._open();
  22402. return self;
  22403. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.klass)});
  22404. },
  22405. args: [],
  22406. source: "open\x0a\x09self current open",
  22407. referencedClasses: [],
  22408. messageSends: ["open", "current"]
  22409. }),
  22410. $globals.Transcript.klass);
  22411. $core.addMethod(
  22412. $core.method({
  22413. selector: "show:",
  22414. protocol: 'printing',
  22415. fn: function (anObject){
  22416. var self=this;
  22417. return $core.withContext(function($ctx1) {
  22418. $recv(self._current())._show_(anObject);
  22419. return self;
  22420. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.klass)});
  22421. },
  22422. args: ["anObject"],
  22423. source: "show: anObject\x0a\x09self current show: anObject",
  22424. referencedClasses: [],
  22425. messageSends: ["show:", "current"]
  22426. }),
  22427. $globals.Transcript.klass);
  22428. $core.addMethod(
  22429. $core.method({
  22430. selector: "inspectOn:",
  22431. protocol: '*Platform-Services',
  22432. fn: function (anInspector){
  22433. var self=this;
  22434. var variables;
  22435. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  22436. return $core.withContext(function($ctx1) {
  22437. variables=$recv($Dictionary())._new();
  22438. $recv(variables)._at_put_("#self",self);
  22439. $ctx1.sendIdx["at:put:"]=1;
  22440. $recv(variables)._at_put_("#keys",self._keys());
  22441. $ctx1.sendIdx["at:put:"]=2;
  22442. self._keysAndValuesDo_((function(key,value){
  22443. return $core.withContext(function($ctx2) {
  22444. return $recv(variables)._at_put_(key,value);
  22445. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  22446. }));
  22447. $recv(anInspector)._setLabel_(self._printString());
  22448. $recv(anInspector)._setVariables_(variables);
  22449. return self;
  22450. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  22451. },
  22452. args: ["anInspector"],
  22453. 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",
  22454. referencedClasses: ["Dictionary"],
  22455. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  22456. }),
  22457. $globals.AssociativeCollection);
  22458. $core.addMethod(
  22459. $core.method({
  22460. selector: "inspectOn:",
  22461. protocol: '*Platform-Services',
  22462. fn: function (anInspector){
  22463. var self=this;
  22464. var variables;
  22465. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  22466. return $core.withContext(function($ctx1) {
  22467. variables=$recv($Dictionary())._new();
  22468. $recv(variables)._at_put_("#self",self);
  22469. $ctx1.sendIdx["at:put:"]=1;
  22470. self._withIndexDo_((function(each,i){
  22471. return $core.withContext(function($ctx2) {
  22472. return $recv(variables)._at_put_(i,each);
  22473. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  22474. }));
  22475. $recv(anInspector)._setLabel_(self._printString());
  22476. $recv(anInspector)._setVariables_(variables);
  22477. return self;
  22478. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  22479. },
  22480. args: ["anInspector"],
  22481. 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",
  22482. referencedClasses: ["Dictionary"],
  22483. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  22484. }),
  22485. $globals.Collection);
  22486. $core.addMethod(
  22487. $core.method({
  22488. selector: "inspectOn:",
  22489. protocol: '*Platform-Services',
  22490. fn: function (anInspector){
  22491. var self=this;
  22492. var variables;
  22493. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  22494. return $core.withContext(function($ctx1) {
  22495. variables=$recv($Dictionary())._new();
  22496. $recv(variables)._at_put_("#self",self);
  22497. $ctx1.sendIdx["at:put:"]=1;
  22498. $recv(variables)._at_put_("#year",self._year());
  22499. $ctx1.sendIdx["at:put:"]=2;
  22500. $recv(variables)._at_put_("#month",self._month());
  22501. $ctx1.sendIdx["at:put:"]=3;
  22502. $recv(variables)._at_put_("#day",self._day());
  22503. $ctx1.sendIdx["at:put:"]=4;
  22504. $recv(variables)._at_put_("#hours",self._hours());
  22505. $ctx1.sendIdx["at:put:"]=5;
  22506. $recv(variables)._at_put_("#minutes",self._minutes());
  22507. $ctx1.sendIdx["at:put:"]=6;
  22508. $recv(variables)._at_put_("#seconds",self._seconds());
  22509. $ctx1.sendIdx["at:put:"]=7;
  22510. $recv(variables)._at_put_("#milliseconds",self._milliseconds());
  22511. $recv(anInspector)._setLabel_(self._printString());
  22512. $recv(anInspector)._setVariables_(variables);
  22513. return self;
  22514. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  22515. },
  22516. args: ["anInspector"],
  22517. 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",
  22518. referencedClasses: ["Dictionary"],
  22519. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  22520. }),
  22521. $globals.Date);
  22522. $core.addMethod(
  22523. $core.method({
  22524. selector: "inspectOn:",
  22525. protocol: '*Platform-Services',
  22526. fn: function (anInspector){
  22527. var self=this;
  22528. var variables;
  22529. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  22530. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  22531. return $core.withContext(function($ctx1) {
  22532. variables=$recv($Dictionary())._new();
  22533. $recv(variables)._at_put_("#self",self._jsObject());
  22534. $recv(anInspector)._setLabel_(self._printString());
  22535. $recv($JSObjectProxy())._addObjectVariablesTo_ofProxy_(variables,self);
  22536. $recv(anInspector)._setVariables_(variables);
  22537. return self;
  22538. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  22539. },
  22540. args: ["anInspector"],
  22541. 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",
  22542. referencedClasses: ["Dictionary", "JSObjectProxy"],
  22543. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  22544. }),
  22545. $globals.JSObjectProxy);
  22546. $core.addMethod(
  22547. $core.method({
  22548. selector: "inspectOn:",
  22549. protocol: '*Platform-Services',
  22550. fn: function (anInspector){
  22551. var self=this;
  22552. var variables;
  22553. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  22554. return $core.withContext(function($ctx1) {
  22555. variables=$recv($Dictionary())._new();
  22556. $recv(variables)._at_put_("#self",self);
  22557. $ctx1.sendIdx["at:put:"]=1;
  22558. $recv(variables)._at_put_("#home",self._home());
  22559. $ctx1.sendIdx["at:put:"]=2;
  22560. $recv(variables)._at_put_("#receiver",self._receiver());
  22561. $ctx1.sendIdx["at:put:"]=3;
  22562. $recv(variables)._at_put_("#selector",self._selector());
  22563. $ctx1.sendIdx["at:put:"]=4;
  22564. $recv(variables)._at_put_("#locals",self._locals());
  22565. $ctx1.sendIdx["at:put:"]=5;
  22566. $recv($recv(self._class())._instanceVariableNames())._do_((function(each){
  22567. return $core.withContext(function($ctx2) {
  22568. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  22569. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22570. }));
  22571. $recv(anInspector)._setLabel_(self._printString());
  22572. $recv(anInspector)._setVariables_(variables);
  22573. return self;
  22574. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  22575. },
  22576. args: ["anInspector"],
  22577. 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",
  22578. referencedClasses: ["Dictionary"],
  22579. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  22580. }),
  22581. $globals.MethodContext);
  22582. $core.addMethod(
  22583. $core.method({
  22584. selector: "inspectOn:",
  22585. protocol: '*Platform-Services',
  22586. fn: function (anInspector){
  22587. var self=this;
  22588. var variables;
  22589. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  22590. return $core.withContext(function($ctx1) {
  22591. variables=$recv($Dictionary())._new();
  22592. $recv(variables)._at_put_("#self",self);
  22593. $ctx1.sendIdx["at:put:"]=1;
  22594. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  22595. return $core.withContext(function($ctx2) {
  22596. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  22597. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22598. }));
  22599. $recv(anInspector)._setLabel_(self._printString());
  22600. $recv(anInspector)._setVariables_(variables);
  22601. return self;
  22602. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  22603. },
  22604. args: ["anInspector"],
  22605. 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",
  22606. referencedClasses: ["Dictionary"],
  22607. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  22608. }),
  22609. $globals.Object);
  22610. $core.addMethod(
  22611. $core.method({
  22612. selector: "do:displayingProgress:",
  22613. protocol: '*Platform-Services',
  22614. fn: function (aBlock,aString){
  22615. var self=this;
  22616. function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  22617. return $core.withContext(function($ctx1) {
  22618. $recv($ProgressHandler())._do_on_displaying_(aBlock,self,aString);
  22619. return self;
  22620. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  22621. },
  22622. args: ["aBlock", "aString"],
  22623. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  22624. referencedClasses: ["ProgressHandler"],
  22625. messageSends: ["do:on:displaying:"]
  22626. }),
  22627. $globals.SequenceableCollection);
  22628. $core.addMethod(
  22629. $core.method({
  22630. selector: "inspectOn:",
  22631. protocol: '*Platform-Services',
  22632. fn: function (anInspector){
  22633. var self=this;
  22634. var variables,i;
  22635. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  22636. return $core.withContext(function($ctx1) {
  22637. variables=$recv($Dictionary())._new();
  22638. $recv(variables)._at_put_("#self",self);
  22639. $ctx1.sendIdx["at:put:"]=1;
  22640. i=(1);
  22641. self._do_((function(each){
  22642. return $core.withContext(function($ctx2) {
  22643. $recv(variables)._at_put_(i,each);
  22644. i=$recv(i).__plus((1));
  22645. return i;
  22646. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22647. }));
  22648. $recv(anInspector)._setLabel_(self._printString());
  22649. $recv(anInspector)._setVariables_(variables);
  22650. return self;
  22651. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  22652. },
  22653. args: ["anInspector"],
  22654. 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",
  22655. referencedClasses: ["Dictionary"],
  22656. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  22657. }),
  22658. $globals.Set);
  22659. $core.addMethod(
  22660. $core.method({
  22661. selector: "inspectOn:",
  22662. protocol: '*Platform-Services',
  22663. fn: function (anInspector){
  22664. var self=this;
  22665. var label;
  22666. return $core.withContext(function($ctx1) {
  22667. var $3,$2,$1,$5,$4;
  22668. (
  22669. $ctx1.supercall = true,
  22670. ($globals.String.superclass||$boot.dnu).fn.prototype._inspectOn_.apply($recv(self), [anInspector]));
  22671. $ctx1.supercall = false;
  22672. $3=self._printString();
  22673. $ctx1.sendIdx["printString"]=1;
  22674. $2=$recv($3)._size();
  22675. $1=$recv($2).__gt((30));
  22676. if($core.assert($1)){
  22677. $5=self._printString();
  22678. $ctx1.sendIdx["printString"]=2;
  22679. $4=$recv($5)._copyFrom_to_((1),(30));
  22680. label=$recv($4).__comma("...'");
  22681. label;
  22682. } else {
  22683. label=self._printString();
  22684. label;
  22685. };
  22686. $recv(anInspector)._setLabel_(label);
  22687. return self;
  22688. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  22689. },
  22690. args: ["anInspector"],
  22691. 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",
  22692. referencedClasses: [],
  22693. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  22694. }),
  22695. $globals.String);
  22696. });
  22697. define("amber_core/Platform-Node", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  22698. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  22699. $core.addPackage('Platform-Node');
  22700. $core.packages["Platform-Node"].innerEval = function (expr) { return eval(expr); };
  22701. $core.packages["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
  22702. $core.addClass('NodePlatform', $globals.Object, [], 'Platform-Node');
  22703. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  22704. $core.addMethod(
  22705. $core.method({
  22706. selector: "globals",
  22707. protocol: 'accessing',
  22708. fn: function (){
  22709. var self=this;
  22710. return global;
  22711. },
  22712. args: [],
  22713. source: "globals\x0a\x09^ global",
  22714. referencedClasses: [],
  22715. messageSends: []
  22716. }),
  22717. $globals.NodePlatform);
  22718. $core.addMethod(
  22719. $core.method({
  22720. selector: "newXhr",
  22721. protocol: 'accessing',
  22722. fn: function (){
  22723. var self=this;
  22724. function $XMLHttpRequest(){return $globals.XMLHttpRequest||(typeof XMLHttpRequest=="undefined"?nil:XMLHttpRequest)}
  22725. return $core.withContext(function($ctx1) {
  22726. var $receiver;
  22727. if(($receiver = $XMLHttpRequest()) == null || $receiver.isNil){
  22728. self._error_("XMLHttpRequest not available.");
  22729. } else {
  22730. return $recv($XMLHttpRequest())._new();
  22731. };
  22732. return self;
  22733. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  22734. },
  22735. args: [],
  22736. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  22737. referencedClasses: ["XMLHttpRequest"],
  22738. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  22739. }),
  22740. $globals.NodePlatform);
  22741. $core.addMethod(
  22742. $core.method({
  22743. selector: "initialize",
  22744. protocol: 'testing',
  22745. fn: function (){
  22746. var self=this;
  22747. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  22748. return $core.withContext(function($ctx1) {
  22749. var $1;
  22750. $1=self._isFeasible();
  22751. if($core.assert($1)){
  22752. $recv($Platform())._registerIfNone_(self._new());
  22753. };
  22754. return self;
  22755. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.klass)});
  22756. },
  22757. args: [],
  22758. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  22759. referencedClasses: ["Platform"],
  22760. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  22761. }),
  22762. $globals.NodePlatform.klass);
  22763. $core.addMethod(
  22764. $core.method({
  22765. selector: "isFeasible",
  22766. protocol: 'testing',
  22767. fn: function (){
  22768. var self=this;
  22769. return $core.withContext(function($ctx1) {
  22770. return typeof global !== "undefined";
  22771. return self;
  22772. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.klass)});
  22773. },
  22774. args: [],
  22775. source: "isFeasible\x0a<return typeof global !== \x22undefined\x22>",
  22776. referencedClasses: [],
  22777. messageSends: []
  22778. }),
  22779. $globals.NodePlatform.klass);
  22780. });
  22781. define('amber/deploy',[
  22782. './helpers',
  22783. // --- packages of the core Amber begin here ---
  22784. 'amber_core/Kernel-Objects',
  22785. 'amber_core/Kernel-Classes',
  22786. 'amber_core/Kernel-Methods',
  22787. 'amber_core/Kernel-Collections',
  22788. 'amber_core/Kernel-Infrastructure',
  22789. 'amber_core/Kernel-Exceptions',
  22790. 'amber_core/Kernel-Announcements',
  22791. 'amber_core/Platform-Services',
  22792. 'amber/Platform'
  22793. // --- packages of the core Amber end here ---
  22794. ], function (amber) { return amber; });
  22795. define('amber/parser',['./boot'], function($boot) {
  22796. var $globals = $boot.globals, nil = $boot.nil;
  22797. $globals.SmalltalkParser = (function() {
  22798. "use strict";
  22799. /*
  22800. * Generated by PEG.js 0.9.0.
  22801. *
  22802. * http://pegjs.org/
  22803. */
  22804. function peg$subclass(child, parent) {
  22805. function ctor() { this.constructor = child; }
  22806. ctor.prototype = parent.prototype;
  22807. child.prototype = new ctor();
  22808. }
  22809. function peg$SyntaxError(message, expected, found, location) {
  22810. this.message = message;
  22811. this.expected = expected;
  22812. this.found = found;
  22813. this.location = location;
  22814. this.name = "SyntaxError";
  22815. if (typeof Error.captureStackTrace === "function") {
  22816. Error.captureStackTrace(this, peg$SyntaxError);
  22817. }
  22818. }
  22819. peg$subclass(peg$SyntaxError, Error);
  22820. function peg$parse(input) {
  22821. var options = arguments.length > 1 ? arguments[1] : {},
  22822. parser = this,
  22823. peg$FAILED = {},
  22824. peg$startRuleFunctions = { start: peg$parsestart },
  22825. peg$startRuleFunction = peg$parsestart,
  22826. peg$c0 = /^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/,
  22827. peg$c1 = { type: "class", value: "[ \\t\\v\\f\\u00A0\\uFEFF\\n\\r\\u2028\\u2029]", description: "[ \\t\\v\\f\\u00A0\\uFEFF\\n\\r\\u2028\\u2029]" },
  22828. peg$c2 = "\"",
  22829. peg$c3 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  22830. peg$c4 = /^[^"]/,
  22831. peg$c5 = { type: "class", value: "[^\"]", description: "[^\"]" },
  22832. peg$c6 = ".",
  22833. peg$c7 = { type: "literal", value: ".", description: "\".\"" },
  22834. peg$c8 = /^[a-zA-Z]/,
  22835. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  22836. peg$c10 = /^[a-zA-Z0-9]/,
  22837. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  22838. peg$c12 = function(first, others) {return first + others.join("");},
  22839. peg$c13 = ":",
  22840. peg$c14 = { type: "literal", value: ":", description: "\":\"" },
  22841. peg$c15 = function(first, last) {return first + last;},
  22842. peg$c16 = /^[a-zA-Z0-9:]/,
  22843. peg$c17 = { type: "class", value: "[a-zA-Z0-9\\:]", description: "[a-zA-Z0-9\\:]" },
  22844. peg$c18 = /^[A-Z]/,
  22845. peg$c19 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  22846. peg$c20 = "'",
  22847. peg$c21 = { type: "literal", value: "'", description: "\"'\"" },
  22848. peg$c22 = "''",
  22849. peg$c23 = { type: "literal", value: "''", description: "\"''\"" },
  22850. peg$c24 = function() {return "'";},
  22851. peg$c25 = /^[^']/,
  22852. peg$c26 = { type: "class", value: "[^']", description: "[^']" },
  22853. peg$c27 = function(val) {
  22854. return $globals.ValueNode._new()
  22855. ._location_(location())
  22856. ._source_(text())
  22857. ._value_(val.join(""));
  22858. },
  22859. peg$c28 = "$",
  22860. peg$c29 = { type: "literal", value: "$", description: "\"$\"" },
  22861. peg$c30 = { type: "any", description: "any character" },
  22862. peg$c31 = function(char) {
  22863. return $globals.ValueNode._new()
  22864. ._location_(location())
  22865. ._source_(text())
  22866. ._value_(char);
  22867. },
  22868. peg$c32 = "#",
  22869. peg$c33 = { type: "literal", value: "#", description: "\"#\"" },
  22870. peg$c34 = function(rest) {return rest;},
  22871. peg$c35 = function(node) {return node._value();},
  22872. peg$c36 = function(val) {
  22873. return $globals.ValueNode._new()
  22874. ._location_(location())
  22875. ._source_(text())
  22876. ._value_(val);
  22877. },
  22878. peg$c37 = function(n) {
  22879. return $globals.ValueNode._new()
  22880. ._location_(location())
  22881. ._source_(text())
  22882. ._value_(n);
  22883. },
  22884. peg$c38 = "e",
  22885. peg$c39 = { type: "literal", value: "e", description: "\"e\"" },
  22886. peg$c40 = function(n) {return parseFloat(n.join(""));},
  22887. peg$c41 = "-",
  22888. peg$c42 = { type: "literal", value: "-", description: "\"-\"" },
  22889. peg$c43 = "16r",
  22890. peg$c44 = { type: "literal", value: "16r", description: "\"16r\"" },
  22891. peg$c45 = /^[0-9a-fA-F]/,
  22892. peg$c46 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  22893. peg$c47 = function(neg, num) {return parseInt(((neg || '') + num.join("")), 16);},
  22894. peg$c48 = /^[0-9]/,
  22895. peg$c49 = { type: "class", value: "[0-9]", description: "[0-9]" },
  22896. peg$c50 = function(neg, digits, dec) {return parseFloat(((neg || '') + digits.join("") + "." + dec.join("")), 10);},
  22897. peg$c51 = function(neg, digits) {return (parseInt((neg || '') + digits.join(""), 10));},
  22898. peg$c52 = "#(",
  22899. peg$c53 = { type: "literal", value: "#(", description: "\"#(\"" },
  22900. peg$c54 = ")",
  22901. peg$c55 = { type: "literal", value: ")", description: "\")\"" },
  22902. peg$c56 = function(rest) {
  22903. return rest
  22904. ._location_(location())
  22905. ._source_(text());
  22906. },
  22907. peg$c57 = "(",
  22908. peg$c58 = { type: "literal", value: "(", description: "\"(\"" },
  22909. peg$c59 = function(lit) {return lit._value();},
  22910. peg$c60 = function(lits) {
  22911. return $globals.ValueNode._new()
  22912. ._value_(lits);
  22913. },
  22914. peg$c61 = "{",
  22915. peg$c62 = { type: "literal", value: "{", description: "\"{\"" },
  22916. peg$c63 = "}",
  22917. peg$c64 = { type: "literal", value: "}", description: "\"}\"" },
  22918. peg$c65 = function(expressions) {
  22919. return $globals.DynamicArrayNode._new()
  22920. ._location_(location())
  22921. ._source_(text())
  22922. ._nodes_(expressions || []);
  22923. },
  22924. peg$c66 = "#{",
  22925. peg$c67 = { type: "literal", value: "#{", description: "\"#{\"" },
  22926. peg$c68 = function(expressions) {
  22927. return $globals.DynamicDictionaryNode._new()
  22928. ._location_(location())
  22929. ._source_(text())
  22930. ._nodes_(expressions || []);
  22931. },
  22932. peg$c69 = "true",
  22933. peg$c70 = { type: "literal", value: "true", description: "\"true\"" },
  22934. peg$c71 = function() {return true;},
  22935. peg$c72 = "false",
  22936. peg$c73 = { type: "literal", value: "false", description: "\"false\"" },
  22937. peg$c74 = function() {return false;},
  22938. peg$c75 = "nil",
  22939. peg$c76 = { type: "literal", value: "nil", description: "\"nil\"" },
  22940. peg$c77 = function() {return nil;},
  22941. peg$c78 = function(val) {
  22942. return $globals.ValueNode._new()
  22943. ._location_(location())
  22944. ._source_(text())
  22945. ._value_(val);
  22946. },
  22947. peg$c79 = function(identifier) {
  22948. return $globals.VariableNode._new()
  22949. ._location_(location())
  22950. ._source_(text())
  22951. ._value_(identifier);
  22952. },
  22953. peg$c80 = /^[\\+*\/=><,@%~|&\-]/,
  22954. peg$c81 = { type: "class", value: "[\\\\+*/=><,@%~|&-]", description: "[\\\\+*/=><,@%~|&-]" },
  22955. peg$c82 = function(bin) {return bin.join("");},
  22956. peg$c83 = function(key, arg) {return {key:key, arg:arg};},
  22957. peg$c84 = function(pairs) {
  22958. var selector = "";
  22959. var params = [];
  22960. for(var i = 0; i < pairs.length; i++){
  22961. selector += pairs[i].key;
  22962. params.push(pairs[i].arg);
  22963. }
  22964. return [selector, params];
  22965. },
  22966. peg$c85 = function(selector, arg) {return [selector, [arg]];},
  22967. peg$c86 = function(selector) {return [selector, []];},
  22968. peg$c87 = function(expression) {return expression;},
  22969. peg$c88 = function(first, others) { return [first].concat(others); },
  22970. peg$c89 = ":=",
  22971. peg$c90 = { type: "literal", value: ":=", description: "\":=\"" },
  22972. peg$c91 = function(variable, expression) {
  22973. return $globals.AssignmentNode._new()
  22974. ._location_(location())
  22975. ._source_(text())
  22976. ._left_(variable)
  22977. ._right_(expression);
  22978. },
  22979. peg$c92 = "^",
  22980. peg$c93 = { type: "literal", value: "^", description: "\"^\"" },
  22981. peg$c94 = function(expression) {
  22982. return $globals.ReturnNode._new()
  22983. ._location_(location())
  22984. ._source_(text())
  22985. ._nodes_([expression]);
  22986. },
  22987. peg$c95 = "|",
  22988. peg$c96 = { type: "literal", value: "|", description: "\"|\"" },
  22989. peg$c97 = function(variable) {return variable;},
  22990. peg$c98 = function(vars) {return vars;},
  22991. peg$c99 = function(param) {return param;},
  22992. peg$c100 = function(params) {return params;},
  22993. peg$c101 = function(ret) {return [ret];},
  22994. peg$c102 = function(exps, ret) {
  22995. var expressions = exps;
  22996. expressions.push(ret);
  22997. return expressions;
  22998. },
  22999. peg$c103 = function(expressions) {
  23000. return expressions || [];
  23001. },
  23002. peg$c104 = function(js) { return js; },
  23003. peg$c105 = function(temps, statements) {
  23004. return $globals.SequenceNode._new()
  23005. ._location_(location())
  23006. ._source_(text())
  23007. ._temps_(temps || [])
  23008. ._nodes_(statements || []);
  23009. },
  23010. peg$c106 = "[",
  23011. peg$c107 = { type: "literal", value: "[", description: "\"[\"" },
  23012. peg$c108 = "]",
  23013. peg$c109 = { type: "literal", value: "]", description: "\"]\"" },
  23014. peg$c110 = function(params, sequence) {
  23015. return $globals.BlockNode._new()
  23016. ._location_(location())
  23017. ._source_(text())
  23018. ._parameters_(params || [])
  23019. ._nodes_([sequence._asBlockSequenceNode()]);
  23020. },
  23021. peg$c111 = function(selector) {
  23022. return $globals.SendNode._new()
  23023. ._location_(location())
  23024. ._source_(text())
  23025. ._selector_(selector);
  23026. },
  23027. peg$c112 = function(message, tail) {
  23028. if(tail) {
  23029. return tail._valueForReceiver_(message);
  23030. }
  23031. else {
  23032. return message;
  23033. }
  23034. },
  23035. peg$c113 = function(receiver, tail) {
  23036. if(tail) {
  23037. return tail._valueForReceiver_(receiver);
  23038. }
  23039. else {
  23040. return receiver;
  23041. }
  23042. },
  23043. peg$c114 = function(selector, arg) {
  23044. return $globals.SendNode._new()
  23045. ._location_(location())
  23046. ._source_(text())
  23047. ._selector_(selector)
  23048. ._arguments_([arg]);
  23049. },
  23050. peg$c115 = function(message, tail) {
  23051. if(tail) {
  23052. return tail._valueForReceiver_(message);
  23053. }
  23054. else {
  23055. return message;
  23056. }
  23057. },
  23058. peg$c116 = function(pairs) {
  23059. var selector = "";
  23060. var args = [];
  23061. for(var i = 0; i < pairs.length; i++) {
  23062. selector += pairs[i].key;
  23063. args.push(pairs[i].arg);
  23064. }
  23065. return $globals.SendNode._new()
  23066. ._location_(location())
  23067. ._source_(text())
  23068. ._selector_(selector)
  23069. ._arguments_(args);
  23070. },
  23071. peg$c117 = function(send) { return send._isSendNode(); },
  23072. peg$c118 = ";",
  23073. peg$c119 = { type: "literal", value: ";", description: "\";\"" },
  23074. peg$c120 = function(send, mess) {return mess;},
  23075. peg$c121 = function(send, messages) {
  23076. messages.unshift(send);
  23077. return $globals.CascadeNode._new()
  23078. ._location_(location())
  23079. ._source_(text())
  23080. ._nodes_(messages);
  23081. },
  23082. peg$c122 = "<",
  23083. peg$c123 = { type: "literal", value: "<", description: "\"<\"" },
  23084. peg$c124 = ">>",
  23085. peg$c125 = { type: "literal", value: ">>", description: "\">>\"" },
  23086. peg$c126 = function() {return ">";},
  23087. peg$c127 = /^[^>]/,
  23088. peg$c128 = { type: "class", value: "[^>]", description: "[^>]" },
  23089. peg$c129 = ">",
  23090. peg$c130 = { type: "literal", value: ">", description: "\">\"" },
  23091. peg$c131 = function(val) {
  23092. return $globals.JSStatementNode._new()
  23093. ._location_(location())
  23094. ._source_(val.join(""))
  23095. },
  23096. peg$c132 = function(pattern, sequence) {
  23097. return $globals.MethodNode._new()
  23098. ._location_(location())
  23099. ._source_(text())
  23100. ._selector_(pattern[0])
  23101. ._arguments_(pattern[1])
  23102. ._nodes_([sequence]);
  23103. },
  23104. peg$c133 = function(send) { return send._isSendNode() && send._selector() === "->" },
  23105. peg$c134 = function(send) { return [send._receiver(), send._arguments()[0]]; },
  23106. peg$c135 = function(first, others) { return first.concat.apply(first, others); },
  23107. peg$currPos = 0,
  23108. peg$savedPos = 0,
  23109. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  23110. peg$maxFailPos = 0,
  23111. peg$maxFailExpected = [],
  23112. peg$silentFails = 0,
  23113. peg$resultsCache = {},
  23114. peg$result;
  23115. if ("startRule" in options) {
  23116. if (!(options.startRule in peg$startRuleFunctions)) {
  23117. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  23118. }
  23119. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  23120. }
  23121. function text() {
  23122. return input.substring(peg$savedPos, peg$currPos);
  23123. }
  23124. function location() {
  23125. return peg$computeLocation(peg$savedPos, peg$currPos);
  23126. }
  23127. function expected(description) {
  23128. throw peg$buildException(
  23129. null,
  23130. [{ type: "other", description: description }],
  23131. input.substring(peg$savedPos, peg$currPos),
  23132. peg$computeLocation(peg$savedPos, peg$currPos)
  23133. );
  23134. }
  23135. function error(message) {
  23136. throw peg$buildException(
  23137. message,
  23138. null,
  23139. input.substring(peg$savedPos, peg$currPos),
  23140. peg$computeLocation(peg$savedPos, peg$currPos)
  23141. );
  23142. }
  23143. function peg$computePosDetails(pos) {
  23144. var details = peg$posDetailsCache[pos],
  23145. p, ch;
  23146. if (details) {
  23147. return details;
  23148. } else {
  23149. p = pos - 1;
  23150. while (!peg$posDetailsCache[p]) {
  23151. p--;
  23152. }
  23153. details = peg$posDetailsCache[p];
  23154. details = {
  23155. line: details.line,
  23156. column: details.column,
  23157. seenCR: details.seenCR
  23158. };
  23159. while (p < pos) {
  23160. ch = input.charAt(p);
  23161. if (ch === "\n") {
  23162. if (!details.seenCR) { details.line++; }
  23163. details.column = 1;
  23164. details.seenCR = false;
  23165. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  23166. details.line++;
  23167. details.column = 1;
  23168. details.seenCR = true;
  23169. } else {
  23170. details.column++;
  23171. details.seenCR = false;
  23172. }
  23173. p++;
  23174. }
  23175. peg$posDetailsCache[pos] = details;
  23176. return details;
  23177. }
  23178. }
  23179. function peg$computeLocation(startPos, endPos) {
  23180. var startPosDetails = peg$computePosDetails(startPos),
  23181. endPosDetails = peg$computePosDetails(endPos);
  23182. return {
  23183. start: {
  23184. offset: startPos,
  23185. line: startPosDetails.line,
  23186. column: startPosDetails.column
  23187. },
  23188. end: {
  23189. offset: endPos,
  23190. line: endPosDetails.line,
  23191. column: endPosDetails.column
  23192. }
  23193. };
  23194. }
  23195. function peg$fail(expected) {
  23196. if (peg$currPos < peg$maxFailPos) { return; }
  23197. if (peg$currPos > peg$maxFailPos) {
  23198. peg$maxFailPos = peg$currPos;
  23199. peg$maxFailExpected = [];
  23200. }
  23201. peg$maxFailExpected.push(expected);
  23202. }
  23203. function peg$buildException(message, expected, found, location) {
  23204. function cleanupExpected(expected) {
  23205. var i = 1;
  23206. expected.sort(function(a, b) {
  23207. if (a.description < b.description) {
  23208. return -1;
  23209. } else if (a.description > b.description) {
  23210. return 1;
  23211. } else {
  23212. return 0;
  23213. }
  23214. });
  23215. while (i < expected.length) {
  23216. if (expected[i - 1] === expected[i]) {
  23217. expected.splice(i, 1);
  23218. } else {
  23219. i++;
  23220. }
  23221. }
  23222. }
  23223. function buildMessage(expected, found) {
  23224. function stringEscape(s) {
  23225. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  23226. return s
  23227. .replace(/\\/g, '\\\\')
  23228. .replace(/"/g, '\\"')
  23229. .replace(/\x08/g, '\\b')
  23230. .replace(/\t/g, '\\t')
  23231. .replace(/\n/g, '\\n')
  23232. .replace(/\f/g, '\\f')
  23233. .replace(/\r/g, '\\r')
  23234. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  23235. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  23236. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  23237. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  23238. }
  23239. var expectedDescs = new Array(expected.length),
  23240. expectedDesc, foundDesc, i;
  23241. for (i = 0; i < expected.length; i++) {
  23242. expectedDescs[i] = expected[i].description;
  23243. }
  23244. expectedDesc = expected.length > 1
  23245. ? expectedDescs.slice(0, -1).join(", ")
  23246. + " or "
  23247. + expectedDescs[expected.length - 1]
  23248. : expectedDescs[0];
  23249. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  23250. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  23251. }
  23252. if (expected !== null) {
  23253. cleanupExpected(expected);
  23254. }
  23255. return new peg$SyntaxError(
  23256. message !== null ? message : buildMessage(expected, found),
  23257. expected,
  23258. found,
  23259. location
  23260. );
  23261. }
  23262. function peg$parsestart() {
  23263. var s0;
  23264. var key = peg$currPos * 61 + 0,
  23265. cached = peg$resultsCache[key];
  23266. if (cached) {
  23267. peg$currPos = cached.nextPos;
  23268. return cached.result;
  23269. }
  23270. s0 = peg$parsemethod();
  23271. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23272. return s0;
  23273. }
  23274. function peg$parseseparator() {
  23275. var s0, s1;
  23276. var key = peg$currPos * 61 + 1,
  23277. cached = peg$resultsCache[key];
  23278. if (cached) {
  23279. peg$currPos = cached.nextPos;
  23280. return cached.result;
  23281. }
  23282. s0 = [];
  23283. if (peg$c0.test(input.charAt(peg$currPos))) {
  23284. s1 = input.charAt(peg$currPos);
  23285. peg$currPos++;
  23286. } else {
  23287. s1 = peg$FAILED;
  23288. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  23289. }
  23290. if (s1 !== peg$FAILED) {
  23291. while (s1 !== peg$FAILED) {
  23292. s0.push(s1);
  23293. if (peg$c0.test(input.charAt(peg$currPos))) {
  23294. s1 = input.charAt(peg$currPos);
  23295. peg$currPos++;
  23296. } else {
  23297. s1 = peg$FAILED;
  23298. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  23299. }
  23300. }
  23301. } else {
  23302. s0 = peg$FAILED;
  23303. }
  23304. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23305. return s0;
  23306. }
  23307. function peg$parsecomments() {
  23308. var s0, s1, s2, s3, s4;
  23309. var key = peg$currPos * 61 + 2,
  23310. cached = peg$resultsCache[key];
  23311. if (cached) {
  23312. peg$currPos = cached.nextPos;
  23313. return cached.result;
  23314. }
  23315. s0 = [];
  23316. s1 = peg$currPos;
  23317. if (input.charCodeAt(peg$currPos) === 34) {
  23318. s2 = peg$c2;
  23319. peg$currPos++;
  23320. } else {
  23321. s2 = peg$FAILED;
  23322. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  23323. }
  23324. if (s2 !== peg$FAILED) {
  23325. s3 = [];
  23326. if (peg$c4.test(input.charAt(peg$currPos))) {
  23327. s4 = input.charAt(peg$currPos);
  23328. peg$currPos++;
  23329. } else {
  23330. s4 = peg$FAILED;
  23331. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  23332. }
  23333. while (s4 !== peg$FAILED) {
  23334. s3.push(s4);
  23335. if (peg$c4.test(input.charAt(peg$currPos))) {
  23336. s4 = input.charAt(peg$currPos);
  23337. peg$currPos++;
  23338. } else {
  23339. s4 = peg$FAILED;
  23340. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  23341. }
  23342. }
  23343. if (s3 !== peg$FAILED) {
  23344. if (input.charCodeAt(peg$currPos) === 34) {
  23345. s4 = peg$c2;
  23346. peg$currPos++;
  23347. } else {
  23348. s4 = peg$FAILED;
  23349. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  23350. }
  23351. if (s4 !== peg$FAILED) {
  23352. s2 = [s2, s3, s4];
  23353. s1 = s2;
  23354. } else {
  23355. peg$currPos = s1;
  23356. s1 = peg$FAILED;
  23357. }
  23358. } else {
  23359. peg$currPos = s1;
  23360. s1 = peg$FAILED;
  23361. }
  23362. } else {
  23363. peg$currPos = s1;
  23364. s1 = peg$FAILED;
  23365. }
  23366. if (s1 !== peg$FAILED) {
  23367. while (s1 !== peg$FAILED) {
  23368. s0.push(s1);
  23369. s1 = peg$currPos;
  23370. if (input.charCodeAt(peg$currPos) === 34) {
  23371. s2 = peg$c2;
  23372. peg$currPos++;
  23373. } else {
  23374. s2 = peg$FAILED;
  23375. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  23376. }
  23377. if (s2 !== peg$FAILED) {
  23378. s3 = [];
  23379. if (peg$c4.test(input.charAt(peg$currPos))) {
  23380. s4 = input.charAt(peg$currPos);
  23381. peg$currPos++;
  23382. } else {
  23383. s4 = peg$FAILED;
  23384. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  23385. }
  23386. while (s4 !== peg$FAILED) {
  23387. s3.push(s4);
  23388. if (peg$c4.test(input.charAt(peg$currPos))) {
  23389. s4 = input.charAt(peg$currPos);
  23390. peg$currPos++;
  23391. } else {
  23392. s4 = peg$FAILED;
  23393. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  23394. }
  23395. }
  23396. if (s3 !== peg$FAILED) {
  23397. if (input.charCodeAt(peg$currPos) === 34) {
  23398. s4 = peg$c2;
  23399. peg$currPos++;
  23400. } else {
  23401. s4 = peg$FAILED;
  23402. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  23403. }
  23404. if (s4 !== peg$FAILED) {
  23405. s2 = [s2, s3, s4];
  23406. s1 = s2;
  23407. } else {
  23408. peg$currPos = s1;
  23409. s1 = peg$FAILED;
  23410. }
  23411. } else {
  23412. peg$currPos = s1;
  23413. s1 = peg$FAILED;
  23414. }
  23415. } else {
  23416. peg$currPos = s1;
  23417. s1 = peg$FAILED;
  23418. }
  23419. }
  23420. } else {
  23421. s0 = peg$FAILED;
  23422. }
  23423. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23424. return s0;
  23425. }
  23426. function peg$parsews() {
  23427. var s0, s1;
  23428. var key = peg$currPos * 61 + 3,
  23429. cached = peg$resultsCache[key];
  23430. if (cached) {
  23431. peg$currPos = cached.nextPos;
  23432. return cached.result;
  23433. }
  23434. s0 = [];
  23435. s1 = peg$parseseparator();
  23436. if (s1 === peg$FAILED) {
  23437. s1 = peg$parsecomments();
  23438. }
  23439. while (s1 !== peg$FAILED) {
  23440. s0.push(s1);
  23441. s1 = peg$parseseparator();
  23442. if (s1 === peg$FAILED) {
  23443. s1 = peg$parsecomments();
  23444. }
  23445. }
  23446. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23447. return s0;
  23448. }
  23449. function peg$parsemaybeDotsWs() {
  23450. var s0, s1;
  23451. var key = peg$currPos * 61 + 4,
  23452. cached = peg$resultsCache[key];
  23453. if (cached) {
  23454. peg$currPos = cached.nextPos;
  23455. return cached.result;
  23456. }
  23457. s0 = [];
  23458. if (input.charCodeAt(peg$currPos) === 46) {
  23459. s1 = peg$c6;
  23460. peg$currPos++;
  23461. } else {
  23462. s1 = peg$FAILED;
  23463. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  23464. }
  23465. if (s1 === peg$FAILED) {
  23466. s1 = peg$parseseparator();
  23467. if (s1 === peg$FAILED) {
  23468. s1 = peg$parsecomments();
  23469. }
  23470. }
  23471. while (s1 !== peg$FAILED) {
  23472. s0.push(s1);
  23473. if (input.charCodeAt(peg$currPos) === 46) {
  23474. s1 = peg$c6;
  23475. peg$currPos++;
  23476. } else {
  23477. s1 = peg$FAILED;
  23478. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  23479. }
  23480. if (s1 === peg$FAILED) {
  23481. s1 = peg$parseseparator();
  23482. if (s1 === peg$FAILED) {
  23483. s1 = peg$parsecomments();
  23484. }
  23485. }
  23486. }
  23487. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23488. return s0;
  23489. }
  23490. function peg$parseidentifier() {
  23491. var s0, s1, s2, s3;
  23492. var key = peg$currPos * 61 + 5,
  23493. cached = peg$resultsCache[key];
  23494. if (cached) {
  23495. peg$currPos = cached.nextPos;
  23496. return cached.result;
  23497. }
  23498. s0 = peg$currPos;
  23499. if (peg$c8.test(input.charAt(peg$currPos))) {
  23500. s1 = input.charAt(peg$currPos);
  23501. peg$currPos++;
  23502. } else {
  23503. s1 = peg$FAILED;
  23504. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  23505. }
  23506. if (s1 !== peg$FAILED) {
  23507. s2 = [];
  23508. if (peg$c10.test(input.charAt(peg$currPos))) {
  23509. s3 = input.charAt(peg$currPos);
  23510. peg$currPos++;
  23511. } else {
  23512. s3 = peg$FAILED;
  23513. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  23514. }
  23515. while (s3 !== peg$FAILED) {
  23516. s2.push(s3);
  23517. if (peg$c10.test(input.charAt(peg$currPos))) {
  23518. s3 = input.charAt(peg$currPos);
  23519. peg$currPos++;
  23520. } else {
  23521. s3 = peg$FAILED;
  23522. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  23523. }
  23524. }
  23525. if (s2 !== peg$FAILED) {
  23526. peg$savedPos = s0;
  23527. s1 = peg$c12(s1, s2);
  23528. s0 = s1;
  23529. } else {
  23530. peg$currPos = s0;
  23531. s0 = peg$FAILED;
  23532. }
  23533. } else {
  23534. peg$currPos = s0;
  23535. s0 = peg$FAILED;
  23536. }
  23537. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23538. return s0;
  23539. }
  23540. function peg$parsekeyword() {
  23541. var s0, s1, s2;
  23542. var key = peg$currPos * 61 + 6,
  23543. cached = peg$resultsCache[key];
  23544. if (cached) {
  23545. peg$currPos = cached.nextPos;
  23546. return cached.result;
  23547. }
  23548. s0 = peg$currPos;
  23549. s1 = peg$parseidentifier();
  23550. if (s1 !== peg$FAILED) {
  23551. if (input.charCodeAt(peg$currPos) === 58) {
  23552. s2 = peg$c13;
  23553. peg$currPos++;
  23554. } else {
  23555. s2 = peg$FAILED;
  23556. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  23557. }
  23558. if (s2 !== peg$FAILED) {
  23559. peg$savedPos = s0;
  23560. s1 = peg$c15(s1, s2);
  23561. s0 = s1;
  23562. } else {
  23563. peg$currPos = s0;
  23564. s0 = peg$FAILED;
  23565. }
  23566. } else {
  23567. peg$currPos = s0;
  23568. s0 = peg$FAILED;
  23569. }
  23570. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23571. return s0;
  23572. }
  23573. function peg$parseselector() {
  23574. var s0, s1, s2, s3;
  23575. var key = peg$currPos * 61 + 7,
  23576. cached = peg$resultsCache[key];
  23577. if (cached) {
  23578. peg$currPos = cached.nextPos;
  23579. return cached.result;
  23580. }
  23581. s0 = peg$currPos;
  23582. if (peg$c8.test(input.charAt(peg$currPos))) {
  23583. s1 = input.charAt(peg$currPos);
  23584. peg$currPos++;
  23585. } else {
  23586. s1 = peg$FAILED;
  23587. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  23588. }
  23589. if (s1 !== peg$FAILED) {
  23590. s2 = [];
  23591. if (peg$c16.test(input.charAt(peg$currPos))) {
  23592. s3 = input.charAt(peg$currPos);
  23593. peg$currPos++;
  23594. } else {
  23595. s3 = peg$FAILED;
  23596. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  23597. }
  23598. while (s3 !== peg$FAILED) {
  23599. s2.push(s3);
  23600. if (peg$c16.test(input.charAt(peg$currPos))) {
  23601. s3 = input.charAt(peg$currPos);
  23602. peg$currPos++;
  23603. } else {
  23604. s3 = peg$FAILED;
  23605. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  23606. }
  23607. }
  23608. if (s2 !== peg$FAILED) {
  23609. peg$savedPos = s0;
  23610. s1 = peg$c12(s1, s2);
  23611. s0 = s1;
  23612. } else {
  23613. peg$currPos = s0;
  23614. s0 = peg$FAILED;
  23615. }
  23616. } else {
  23617. peg$currPos = s0;
  23618. s0 = peg$FAILED;
  23619. }
  23620. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23621. return s0;
  23622. }
  23623. function peg$parseclassName() {
  23624. var s0, s1, s2, s3;
  23625. var key = peg$currPos * 61 + 8,
  23626. cached = peg$resultsCache[key];
  23627. if (cached) {
  23628. peg$currPos = cached.nextPos;
  23629. return cached.result;
  23630. }
  23631. s0 = peg$currPos;
  23632. if (peg$c18.test(input.charAt(peg$currPos))) {
  23633. s1 = input.charAt(peg$currPos);
  23634. peg$currPos++;
  23635. } else {
  23636. s1 = peg$FAILED;
  23637. if (peg$silentFails === 0) { peg$fail(peg$c19); }
  23638. }
  23639. if (s1 !== peg$FAILED) {
  23640. s2 = [];
  23641. if (peg$c10.test(input.charAt(peg$currPos))) {
  23642. s3 = input.charAt(peg$currPos);
  23643. peg$currPos++;
  23644. } else {
  23645. s3 = peg$FAILED;
  23646. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  23647. }
  23648. while (s3 !== peg$FAILED) {
  23649. s2.push(s3);
  23650. if (peg$c10.test(input.charAt(peg$currPos))) {
  23651. s3 = input.charAt(peg$currPos);
  23652. peg$currPos++;
  23653. } else {
  23654. s3 = peg$FAILED;
  23655. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  23656. }
  23657. }
  23658. if (s2 !== peg$FAILED) {
  23659. peg$savedPos = s0;
  23660. s1 = peg$c12(s1, s2);
  23661. s0 = s1;
  23662. } else {
  23663. peg$currPos = s0;
  23664. s0 = peg$FAILED;
  23665. }
  23666. } else {
  23667. peg$currPos = s0;
  23668. s0 = peg$FAILED;
  23669. }
  23670. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23671. return s0;
  23672. }
  23673. function peg$parsestring() {
  23674. var s0, s1, s2, s3, s4;
  23675. var key = peg$currPos * 61 + 9,
  23676. cached = peg$resultsCache[key];
  23677. if (cached) {
  23678. peg$currPos = cached.nextPos;
  23679. return cached.result;
  23680. }
  23681. s0 = peg$currPos;
  23682. if (input.charCodeAt(peg$currPos) === 39) {
  23683. s1 = peg$c20;
  23684. peg$currPos++;
  23685. } else {
  23686. s1 = peg$FAILED;
  23687. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  23688. }
  23689. if (s1 !== peg$FAILED) {
  23690. s2 = [];
  23691. s3 = peg$currPos;
  23692. if (input.substr(peg$currPos, 2) === peg$c22) {
  23693. s4 = peg$c22;
  23694. peg$currPos += 2;
  23695. } else {
  23696. s4 = peg$FAILED;
  23697. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  23698. }
  23699. if (s4 !== peg$FAILED) {
  23700. peg$savedPos = s3;
  23701. s4 = peg$c24();
  23702. }
  23703. s3 = s4;
  23704. if (s3 === peg$FAILED) {
  23705. if (peg$c25.test(input.charAt(peg$currPos))) {
  23706. s3 = input.charAt(peg$currPos);
  23707. peg$currPos++;
  23708. } else {
  23709. s3 = peg$FAILED;
  23710. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  23711. }
  23712. }
  23713. while (s3 !== peg$FAILED) {
  23714. s2.push(s3);
  23715. s3 = peg$currPos;
  23716. if (input.substr(peg$currPos, 2) === peg$c22) {
  23717. s4 = peg$c22;
  23718. peg$currPos += 2;
  23719. } else {
  23720. s4 = peg$FAILED;
  23721. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  23722. }
  23723. if (s4 !== peg$FAILED) {
  23724. peg$savedPos = s3;
  23725. s4 = peg$c24();
  23726. }
  23727. s3 = s4;
  23728. if (s3 === peg$FAILED) {
  23729. if (peg$c25.test(input.charAt(peg$currPos))) {
  23730. s3 = input.charAt(peg$currPos);
  23731. peg$currPos++;
  23732. } else {
  23733. s3 = peg$FAILED;
  23734. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  23735. }
  23736. }
  23737. }
  23738. if (s2 !== peg$FAILED) {
  23739. if (input.charCodeAt(peg$currPos) === 39) {
  23740. s3 = peg$c20;
  23741. peg$currPos++;
  23742. } else {
  23743. s3 = peg$FAILED;
  23744. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  23745. }
  23746. if (s3 !== peg$FAILED) {
  23747. peg$savedPos = s0;
  23748. s1 = peg$c27(s2);
  23749. s0 = s1;
  23750. } else {
  23751. peg$currPos = s0;
  23752. s0 = peg$FAILED;
  23753. }
  23754. } else {
  23755. peg$currPos = s0;
  23756. s0 = peg$FAILED;
  23757. }
  23758. } else {
  23759. peg$currPos = s0;
  23760. s0 = peg$FAILED;
  23761. }
  23762. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23763. return s0;
  23764. }
  23765. function peg$parsecharacter() {
  23766. var s0, s1, s2;
  23767. var key = peg$currPos * 61 + 10,
  23768. cached = peg$resultsCache[key];
  23769. if (cached) {
  23770. peg$currPos = cached.nextPos;
  23771. return cached.result;
  23772. }
  23773. s0 = peg$currPos;
  23774. if (input.charCodeAt(peg$currPos) === 36) {
  23775. s1 = peg$c28;
  23776. peg$currPos++;
  23777. } else {
  23778. s1 = peg$FAILED;
  23779. if (peg$silentFails === 0) { peg$fail(peg$c29); }
  23780. }
  23781. if (s1 !== peg$FAILED) {
  23782. if (input.length > peg$currPos) {
  23783. s2 = input.charAt(peg$currPos);
  23784. peg$currPos++;
  23785. } else {
  23786. s2 = peg$FAILED;
  23787. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  23788. }
  23789. if (s2 !== peg$FAILED) {
  23790. peg$savedPos = s0;
  23791. s1 = peg$c31(s2);
  23792. s0 = s1;
  23793. } else {
  23794. peg$currPos = s0;
  23795. s0 = peg$FAILED;
  23796. }
  23797. } else {
  23798. peg$currPos = s0;
  23799. s0 = peg$FAILED;
  23800. }
  23801. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23802. return s0;
  23803. }
  23804. function peg$parsesymbol() {
  23805. var s0, s1, s2;
  23806. var key = peg$currPos * 61 + 11,
  23807. cached = peg$resultsCache[key];
  23808. if (cached) {
  23809. peg$currPos = cached.nextPos;
  23810. return cached.result;
  23811. }
  23812. s0 = peg$currPos;
  23813. if (input.charCodeAt(peg$currPos) === 35) {
  23814. s1 = peg$c32;
  23815. peg$currPos++;
  23816. } else {
  23817. s1 = peg$FAILED;
  23818. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  23819. }
  23820. if (s1 !== peg$FAILED) {
  23821. s2 = peg$parsebareSymbol();
  23822. if (s2 !== peg$FAILED) {
  23823. peg$savedPos = s0;
  23824. s1 = peg$c34(s2);
  23825. s0 = s1;
  23826. } else {
  23827. peg$currPos = s0;
  23828. s0 = peg$FAILED;
  23829. }
  23830. } else {
  23831. peg$currPos = s0;
  23832. s0 = peg$FAILED;
  23833. }
  23834. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23835. return s0;
  23836. }
  23837. function peg$parsebareSymbol() {
  23838. var s0, s1, s2;
  23839. var key = peg$currPos * 61 + 12,
  23840. cached = peg$resultsCache[key];
  23841. if (cached) {
  23842. peg$currPos = cached.nextPos;
  23843. return cached.result;
  23844. }
  23845. s0 = peg$currPos;
  23846. s1 = peg$parseselector();
  23847. if (s1 === peg$FAILED) {
  23848. s1 = peg$parsebinarySelector();
  23849. if (s1 === peg$FAILED) {
  23850. s1 = peg$currPos;
  23851. s2 = peg$parsestring();
  23852. if (s2 !== peg$FAILED) {
  23853. peg$savedPos = s1;
  23854. s2 = peg$c35(s2);
  23855. }
  23856. s1 = s2;
  23857. }
  23858. }
  23859. if (s1 !== peg$FAILED) {
  23860. peg$savedPos = s0;
  23861. s1 = peg$c36(s1);
  23862. }
  23863. s0 = s1;
  23864. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23865. return s0;
  23866. }
  23867. function peg$parsenumber() {
  23868. var s0, s1;
  23869. var key = peg$currPos * 61 + 13,
  23870. cached = peg$resultsCache[key];
  23871. if (cached) {
  23872. peg$currPos = cached.nextPos;
  23873. return cached.result;
  23874. }
  23875. s0 = peg$currPos;
  23876. s1 = peg$parsenumberExp();
  23877. if (s1 === peg$FAILED) {
  23878. s1 = peg$parsehex();
  23879. if (s1 === peg$FAILED) {
  23880. s1 = peg$parsefloat();
  23881. if (s1 === peg$FAILED) {
  23882. s1 = peg$parseinteger();
  23883. }
  23884. }
  23885. }
  23886. if (s1 !== peg$FAILED) {
  23887. peg$savedPos = s0;
  23888. s1 = peg$c37(s1);
  23889. }
  23890. s0 = s1;
  23891. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23892. return s0;
  23893. }
  23894. function peg$parsenumberExp() {
  23895. var s0, s1, s2, s3, s4;
  23896. var key = peg$currPos * 61 + 14,
  23897. cached = peg$resultsCache[key];
  23898. if (cached) {
  23899. peg$currPos = cached.nextPos;
  23900. return cached.result;
  23901. }
  23902. s0 = peg$currPos;
  23903. s1 = peg$currPos;
  23904. s2 = peg$parsefloat();
  23905. if (s2 === peg$FAILED) {
  23906. s2 = peg$parseinteger();
  23907. }
  23908. if (s2 !== peg$FAILED) {
  23909. if (input.charCodeAt(peg$currPos) === 101) {
  23910. s3 = peg$c38;
  23911. peg$currPos++;
  23912. } else {
  23913. s3 = peg$FAILED;
  23914. if (peg$silentFails === 0) { peg$fail(peg$c39); }
  23915. }
  23916. if (s3 !== peg$FAILED) {
  23917. s4 = peg$parseinteger();
  23918. if (s4 !== peg$FAILED) {
  23919. s2 = [s2, s3, s4];
  23920. s1 = s2;
  23921. } else {
  23922. peg$currPos = s1;
  23923. s1 = peg$FAILED;
  23924. }
  23925. } else {
  23926. peg$currPos = s1;
  23927. s1 = peg$FAILED;
  23928. }
  23929. } else {
  23930. peg$currPos = s1;
  23931. s1 = peg$FAILED;
  23932. }
  23933. if (s1 !== peg$FAILED) {
  23934. peg$savedPos = s0;
  23935. s1 = peg$c40(s1);
  23936. }
  23937. s0 = s1;
  23938. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23939. return s0;
  23940. }
  23941. function peg$parsehex() {
  23942. var s0, s1, s2, s3, s4;
  23943. var key = peg$currPos * 61 + 15,
  23944. cached = peg$resultsCache[key];
  23945. if (cached) {
  23946. peg$currPos = cached.nextPos;
  23947. return cached.result;
  23948. }
  23949. s0 = peg$currPos;
  23950. if (input.charCodeAt(peg$currPos) === 45) {
  23951. s1 = peg$c41;
  23952. peg$currPos++;
  23953. } else {
  23954. s1 = peg$FAILED;
  23955. if (peg$silentFails === 0) { peg$fail(peg$c42); }
  23956. }
  23957. if (s1 === peg$FAILED) {
  23958. s1 = null;
  23959. }
  23960. if (s1 !== peg$FAILED) {
  23961. if (input.substr(peg$currPos, 3) === peg$c43) {
  23962. s2 = peg$c43;
  23963. peg$currPos += 3;
  23964. } else {
  23965. s2 = peg$FAILED;
  23966. if (peg$silentFails === 0) { peg$fail(peg$c44); }
  23967. }
  23968. if (s2 !== peg$FAILED) {
  23969. s3 = [];
  23970. if (peg$c45.test(input.charAt(peg$currPos))) {
  23971. s4 = input.charAt(peg$currPos);
  23972. peg$currPos++;
  23973. } else {
  23974. s4 = peg$FAILED;
  23975. if (peg$silentFails === 0) { peg$fail(peg$c46); }
  23976. }
  23977. if (s4 !== peg$FAILED) {
  23978. while (s4 !== peg$FAILED) {
  23979. s3.push(s4);
  23980. if (peg$c45.test(input.charAt(peg$currPos))) {
  23981. s4 = input.charAt(peg$currPos);
  23982. peg$currPos++;
  23983. } else {
  23984. s4 = peg$FAILED;
  23985. if (peg$silentFails === 0) { peg$fail(peg$c46); }
  23986. }
  23987. }
  23988. } else {
  23989. s3 = peg$FAILED;
  23990. }
  23991. if (s3 !== peg$FAILED) {
  23992. peg$savedPos = s0;
  23993. s1 = peg$c47(s1, s3);
  23994. s0 = s1;
  23995. } else {
  23996. peg$currPos = s0;
  23997. s0 = peg$FAILED;
  23998. }
  23999. } else {
  24000. peg$currPos = s0;
  24001. s0 = peg$FAILED;
  24002. }
  24003. } else {
  24004. peg$currPos = s0;
  24005. s0 = peg$FAILED;
  24006. }
  24007. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24008. return s0;
  24009. }
  24010. function peg$parsefloat() {
  24011. var s0, s1, s2, s3, s4, s5;
  24012. var key = peg$currPos * 61 + 16,
  24013. cached = peg$resultsCache[key];
  24014. if (cached) {
  24015. peg$currPos = cached.nextPos;
  24016. return cached.result;
  24017. }
  24018. s0 = peg$currPos;
  24019. if (input.charCodeAt(peg$currPos) === 45) {
  24020. s1 = peg$c41;
  24021. peg$currPos++;
  24022. } else {
  24023. s1 = peg$FAILED;
  24024. if (peg$silentFails === 0) { peg$fail(peg$c42); }
  24025. }
  24026. if (s1 === peg$FAILED) {
  24027. s1 = null;
  24028. }
  24029. if (s1 !== peg$FAILED) {
  24030. s2 = [];
  24031. if (peg$c48.test(input.charAt(peg$currPos))) {
  24032. s3 = input.charAt(peg$currPos);
  24033. peg$currPos++;
  24034. } else {
  24035. s3 = peg$FAILED;
  24036. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24037. }
  24038. if (s3 !== peg$FAILED) {
  24039. while (s3 !== peg$FAILED) {
  24040. s2.push(s3);
  24041. if (peg$c48.test(input.charAt(peg$currPos))) {
  24042. s3 = input.charAt(peg$currPos);
  24043. peg$currPos++;
  24044. } else {
  24045. s3 = peg$FAILED;
  24046. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24047. }
  24048. }
  24049. } else {
  24050. s2 = peg$FAILED;
  24051. }
  24052. if (s2 !== peg$FAILED) {
  24053. if (input.charCodeAt(peg$currPos) === 46) {
  24054. s3 = peg$c6;
  24055. peg$currPos++;
  24056. } else {
  24057. s3 = peg$FAILED;
  24058. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24059. }
  24060. if (s3 !== peg$FAILED) {
  24061. s4 = [];
  24062. if (peg$c48.test(input.charAt(peg$currPos))) {
  24063. s5 = input.charAt(peg$currPos);
  24064. peg$currPos++;
  24065. } else {
  24066. s5 = peg$FAILED;
  24067. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24068. }
  24069. if (s5 !== peg$FAILED) {
  24070. while (s5 !== peg$FAILED) {
  24071. s4.push(s5);
  24072. if (peg$c48.test(input.charAt(peg$currPos))) {
  24073. s5 = input.charAt(peg$currPos);
  24074. peg$currPos++;
  24075. } else {
  24076. s5 = peg$FAILED;
  24077. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24078. }
  24079. }
  24080. } else {
  24081. s4 = peg$FAILED;
  24082. }
  24083. if (s4 !== peg$FAILED) {
  24084. peg$savedPos = s0;
  24085. s1 = peg$c50(s1, s2, s4);
  24086. s0 = s1;
  24087. } else {
  24088. peg$currPos = s0;
  24089. s0 = peg$FAILED;
  24090. }
  24091. } else {
  24092. peg$currPos = s0;
  24093. s0 = peg$FAILED;
  24094. }
  24095. } else {
  24096. peg$currPos = s0;
  24097. s0 = peg$FAILED;
  24098. }
  24099. } else {
  24100. peg$currPos = s0;
  24101. s0 = peg$FAILED;
  24102. }
  24103. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24104. return s0;
  24105. }
  24106. function peg$parseinteger() {
  24107. var s0, s1, s2, s3;
  24108. var key = peg$currPos * 61 + 17,
  24109. cached = peg$resultsCache[key];
  24110. if (cached) {
  24111. peg$currPos = cached.nextPos;
  24112. return cached.result;
  24113. }
  24114. s0 = peg$currPos;
  24115. if (input.charCodeAt(peg$currPos) === 45) {
  24116. s1 = peg$c41;
  24117. peg$currPos++;
  24118. } else {
  24119. s1 = peg$FAILED;
  24120. if (peg$silentFails === 0) { peg$fail(peg$c42); }
  24121. }
  24122. if (s1 === peg$FAILED) {
  24123. s1 = null;
  24124. }
  24125. if (s1 !== peg$FAILED) {
  24126. s2 = [];
  24127. if (peg$c48.test(input.charAt(peg$currPos))) {
  24128. s3 = input.charAt(peg$currPos);
  24129. peg$currPos++;
  24130. } else {
  24131. s3 = peg$FAILED;
  24132. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24133. }
  24134. if (s3 !== peg$FAILED) {
  24135. while (s3 !== peg$FAILED) {
  24136. s2.push(s3);
  24137. if (peg$c48.test(input.charAt(peg$currPos))) {
  24138. s3 = input.charAt(peg$currPos);
  24139. peg$currPos++;
  24140. } else {
  24141. s3 = peg$FAILED;
  24142. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24143. }
  24144. }
  24145. } else {
  24146. s2 = peg$FAILED;
  24147. }
  24148. if (s2 !== peg$FAILED) {
  24149. peg$savedPos = s0;
  24150. s1 = peg$c51(s1, s2);
  24151. s0 = s1;
  24152. } else {
  24153. peg$currPos = s0;
  24154. s0 = peg$FAILED;
  24155. }
  24156. } else {
  24157. peg$currPos = s0;
  24158. s0 = peg$FAILED;
  24159. }
  24160. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24161. return s0;
  24162. }
  24163. function peg$parseliteralArray() {
  24164. var s0, s1, s2, s3, s4;
  24165. var key = peg$currPos * 61 + 18,
  24166. cached = peg$resultsCache[key];
  24167. if (cached) {
  24168. peg$currPos = cached.nextPos;
  24169. return cached.result;
  24170. }
  24171. s0 = peg$currPos;
  24172. if (input.substr(peg$currPos, 2) === peg$c52) {
  24173. s1 = peg$c52;
  24174. peg$currPos += 2;
  24175. } else {
  24176. s1 = peg$FAILED;
  24177. if (peg$silentFails === 0) { peg$fail(peg$c53); }
  24178. }
  24179. if (s1 !== peg$FAILED) {
  24180. s2 = peg$parsewsLiteralArrayContents();
  24181. if (s2 !== peg$FAILED) {
  24182. s3 = peg$parsews();
  24183. if (s3 !== peg$FAILED) {
  24184. if (input.charCodeAt(peg$currPos) === 41) {
  24185. s4 = peg$c54;
  24186. peg$currPos++;
  24187. } else {
  24188. s4 = peg$FAILED;
  24189. if (peg$silentFails === 0) { peg$fail(peg$c55); }
  24190. }
  24191. if (s4 !== peg$FAILED) {
  24192. peg$savedPos = s0;
  24193. s1 = peg$c56(s2);
  24194. s0 = s1;
  24195. } else {
  24196. peg$currPos = s0;
  24197. s0 = peg$FAILED;
  24198. }
  24199. } else {
  24200. peg$currPos = s0;
  24201. s0 = peg$FAILED;
  24202. }
  24203. } else {
  24204. peg$currPos = s0;
  24205. s0 = peg$FAILED;
  24206. }
  24207. } else {
  24208. peg$currPos = s0;
  24209. s0 = peg$FAILED;
  24210. }
  24211. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24212. return s0;
  24213. }
  24214. function peg$parsebareLiteralArray() {
  24215. var s0, s1, s2, s3, s4;
  24216. var key = peg$currPos * 61 + 19,
  24217. cached = peg$resultsCache[key];
  24218. if (cached) {
  24219. peg$currPos = cached.nextPos;
  24220. return cached.result;
  24221. }
  24222. s0 = peg$currPos;
  24223. if (input.charCodeAt(peg$currPos) === 40) {
  24224. s1 = peg$c57;
  24225. peg$currPos++;
  24226. } else {
  24227. s1 = peg$FAILED;
  24228. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  24229. }
  24230. if (s1 !== peg$FAILED) {
  24231. s2 = peg$parsewsLiteralArrayContents();
  24232. if (s2 !== peg$FAILED) {
  24233. s3 = peg$parsews();
  24234. if (s3 !== peg$FAILED) {
  24235. if (input.charCodeAt(peg$currPos) === 41) {
  24236. s4 = peg$c54;
  24237. peg$currPos++;
  24238. } else {
  24239. s4 = peg$FAILED;
  24240. if (peg$silentFails === 0) { peg$fail(peg$c55); }
  24241. }
  24242. if (s4 !== peg$FAILED) {
  24243. peg$savedPos = s0;
  24244. s1 = peg$c56(s2);
  24245. s0 = s1;
  24246. } else {
  24247. peg$currPos = s0;
  24248. s0 = peg$FAILED;
  24249. }
  24250. } else {
  24251. peg$currPos = s0;
  24252. s0 = peg$FAILED;
  24253. }
  24254. } else {
  24255. peg$currPos = s0;
  24256. s0 = peg$FAILED;
  24257. }
  24258. } else {
  24259. peg$currPos = s0;
  24260. s0 = peg$FAILED;
  24261. }
  24262. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24263. return s0;
  24264. }
  24265. function peg$parseliteralArrayElement() {
  24266. var s0;
  24267. var key = peg$currPos * 61 + 20,
  24268. cached = peg$resultsCache[key];
  24269. if (cached) {
  24270. peg$currPos = cached.nextPos;
  24271. return cached.result;
  24272. }
  24273. s0 = peg$parseparseTimeLiteral();
  24274. if (s0 === peg$FAILED) {
  24275. s0 = peg$parsebareLiteralArray();
  24276. if (s0 === peg$FAILED) {
  24277. s0 = peg$parsebareSymbol();
  24278. }
  24279. }
  24280. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24281. return s0;
  24282. }
  24283. function peg$parsewsLiteralArrayContents() {
  24284. var s0, s1, s2, s3, s4;
  24285. var key = peg$currPos * 61 + 21,
  24286. cached = peg$resultsCache[key];
  24287. if (cached) {
  24288. peg$currPos = cached.nextPos;
  24289. return cached.result;
  24290. }
  24291. s0 = peg$currPos;
  24292. s1 = [];
  24293. s2 = peg$currPos;
  24294. s3 = peg$parsews();
  24295. if (s3 !== peg$FAILED) {
  24296. s4 = peg$parseliteralArrayElement();
  24297. if (s4 !== peg$FAILED) {
  24298. peg$savedPos = s2;
  24299. s3 = peg$c59(s4);
  24300. s2 = s3;
  24301. } else {
  24302. peg$currPos = s2;
  24303. s2 = peg$FAILED;
  24304. }
  24305. } else {
  24306. peg$currPos = s2;
  24307. s2 = peg$FAILED;
  24308. }
  24309. while (s2 !== peg$FAILED) {
  24310. s1.push(s2);
  24311. s2 = peg$currPos;
  24312. s3 = peg$parsews();
  24313. if (s3 !== peg$FAILED) {
  24314. s4 = peg$parseliteralArrayElement();
  24315. if (s4 !== peg$FAILED) {
  24316. peg$savedPos = s2;
  24317. s3 = peg$c59(s4);
  24318. s2 = s3;
  24319. } else {
  24320. peg$currPos = s2;
  24321. s2 = peg$FAILED;
  24322. }
  24323. } else {
  24324. peg$currPos = s2;
  24325. s2 = peg$FAILED;
  24326. }
  24327. }
  24328. if (s1 !== peg$FAILED) {
  24329. peg$savedPos = s0;
  24330. s1 = peg$c60(s1);
  24331. }
  24332. s0 = s1;
  24333. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24334. return s0;
  24335. }
  24336. function peg$parsedynamicArray() {
  24337. var s0, s1, s2, s3, s4, s5;
  24338. var key = peg$currPos * 61 + 22,
  24339. cached = peg$resultsCache[key];
  24340. if (cached) {
  24341. peg$currPos = cached.nextPos;
  24342. return cached.result;
  24343. }
  24344. s0 = peg$currPos;
  24345. if (input.charCodeAt(peg$currPos) === 123) {
  24346. s1 = peg$c61;
  24347. peg$currPos++;
  24348. } else {
  24349. s1 = peg$FAILED;
  24350. if (peg$silentFails === 0) { peg$fail(peg$c62); }
  24351. }
  24352. if (s1 !== peg$FAILED) {
  24353. s2 = peg$parsews();
  24354. if (s2 !== peg$FAILED) {
  24355. s3 = peg$parseexpressions();
  24356. if (s3 === peg$FAILED) {
  24357. s3 = null;
  24358. }
  24359. if (s3 !== peg$FAILED) {
  24360. s4 = peg$parsemaybeDotsWs();
  24361. if (s4 !== peg$FAILED) {
  24362. if (input.charCodeAt(peg$currPos) === 125) {
  24363. s5 = peg$c63;
  24364. peg$currPos++;
  24365. } else {
  24366. s5 = peg$FAILED;
  24367. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  24368. }
  24369. if (s5 !== peg$FAILED) {
  24370. peg$savedPos = s0;
  24371. s1 = peg$c65(s3);
  24372. s0 = s1;
  24373. } else {
  24374. peg$currPos = s0;
  24375. s0 = peg$FAILED;
  24376. }
  24377. } else {
  24378. peg$currPos = s0;
  24379. s0 = peg$FAILED;
  24380. }
  24381. } else {
  24382. peg$currPos = s0;
  24383. s0 = peg$FAILED;
  24384. }
  24385. } else {
  24386. peg$currPos = s0;
  24387. s0 = peg$FAILED;
  24388. }
  24389. } else {
  24390. peg$currPos = s0;
  24391. s0 = peg$FAILED;
  24392. }
  24393. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24394. return s0;
  24395. }
  24396. function peg$parsedynamicDictionary() {
  24397. var s0, s1, s2, s3, s4, s5;
  24398. var key = peg$currPos * 61 + 23,
  24399. cached = peg$resultsCache[key];
  24400. if (cached) {
  24401. peg$currPos = cached.nextPos;
  24402. return cached.result;
  24403. }
  24404. s0 = peg$currPos;
  24405. if (input.substr(peg$currPos, 2) === peg$c66) {
  24406. s1 = peg$c66;
  24407. peg$currPos += 2;
  24408. } else {
  24409. s1 = peg$FAILED;
  24410. if (peg$silentFails === 0) { peg$fail(peg$c67); }
  24411. }
  24412. if (s1 !== peg$FAILED) {
  24413. s2 = peg$parsews();
  24414. if (s2 !== peg$FAILED) {
  24415. s3 = peg$parseassociations();
  24416. if (s3 === peg$FAILED) {
  24417. s3 = null;
  24418. }
  24419. if (s3 !== peg$FAILED) {
  24420. s4 = peg$parsemaybeDotsWs();
  24421. if (s4 !== peg$FAILED) {
  24422. if (input.charCodeAt(peg$currPos) === 125) {
  24423. s5 = peg$c63;
  24424. peg$currPos++;
  24425. } else {
  24426. s5 = peg$FAILED;
  24427. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  24428. }
  24429. if (s5 !== peg$FAILED) {
  24430. peg$savedPos = s0;
  24431. s1 = peg$c68(s3);
  24432. s0 = s1;
  24433. } else {
  24434. peg$currPos = s0;
  24435. s0 = peg$FAILED;
  24436. }
  24437. } else {
  24438. peg$currPos = s0;
  24439. s0 = peg$FAILED;
  24440. }
  24441. } else {
  24442. peg$currPos = s0;
  24443. s0 = peg$FAILED;
  24444. }
  24445. } else {
  24446. peg$currPos = s0;
  24447. s0 = peg$FAILED;
  24448. }
  24449. } else {
  24450. peg$currPos = s0;
  24451. s0 = peg$FAILED;
  24452. }
  24453. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24454. return s0;
  24455. }
  24456. function peg$parsepseudoVariable() {
  24457. var s0, s1, s2;
  24458. var key = peg$currPos * 61 + 24,
  24459. cached = peg$resultsCache[key];
  24460. if (cached) {
  24461. peg$currPos = cached.nextPos;
  24462. return cached.result;
  24463. }
  24464. s0 = peg$currPos;
  24465. s1 = peg$currPos;
  24466. if (input.substr(peg$currPos, 4) === peg$c69) {
  24467. s2 = peg$c69;
  24468. peg$currPos += 4;
  24469. } else {
  24470. s2 = peg$FAILED;
  24471. if (peg$silentFails === 0) { peg$fail(peg$c70); }
  24472. }
  24473. if (s2 !== peg$FAILED) {
  24474. peg$savedPos = s1;
  24475. s2 = peg$c71();
  24476. }
  24477. s1 = s2;
  24478. if (s1 === peg$FAILED) {
  24479. s1 = peg$currPos;
  24480. if (input.substr(peg$currPos, 5) === peg$c72) {
  24481. s2 = peg$c72;
  24482. peg$currPos += 5;
  24483. } else {
  24484. s2 = peg$FAILED;
  24485. if (peg$silentFails === 0) { peg$fail(peg$c73); }
  24486. }
  24487. if (s2 !== peg$FAILED) {
  24488. peg$savedPos = s1;
  24489. s2 = peg$c74();
  24490. }
  24491. s1 = s2;
  24492. if (s1 === peg$FAILED) {
  24493. s1 = peg$currPos;
  24494. if (input.substr(peg$currPos, 3) === peg$c75) {
  24495. s2 = peg$c75;
  24496. peg$currPos += 3;
  24497. } else {
  24498. s2 = peg$FAILED;
  24499. if (peg$silentFails === 0) { peg$fail(peg$c76); }
  24500. }
  24501. if (s2 !== peg$FAILED) {
  24502. peg$savedPos = s1;
  24503. s2 = peg$c77();
  24504. }
  24505. s1 = s2;
  24506. }
  24507. }
  24508. if (s1 !== peg$FAILED) {
  24509. peg$savedPos = s0;
  24510. s1 = peg$c78(s1);
  24511. }
  24512. s0 = s1;
  24513. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24514. return s0;
  24515. }
  24516. function peg$parseparseTimeLiteral() {
  24517. var s0;
  24518. var key = peg$currPos * 61 + 25,
  24519. cached = peg$resultsCache[key];
  24520. if (cached) {
  24521. peg$currPos = cached.nextPos;
  24522. return cached.result;
  24523. }
  24524. s0 = peg$parsepseudoVariable();
  24525. if (s0 === peg$FAILED) {
  24526. s0 = peg$parsenumber();
  24527. if (s0 === peg$FAILED) {
  24528. s0 = peg$parseliteralArray();
  24529. if (s0 === peg$FAILED) {
  24530. s0 = peg$parsestring();
  24531. if (s0 === peg$FAILED) {
  24532. s0 = peg$parsesymbol();
  24533. if (s0 === peg$FAILED) {
  24534. s0 = peg$parsecharacter();
  24535. }
  24536. }
  24537. }
  24538. }
  24539. }
  24540. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24541. return s0;
  24542. }
  24543. function peg$parseruntimeLiteral() {
  24544. var s0;
  24545. var key = peg$currPos * 61 + 26,
  24546. cached = peg$resultsCache[key];
  24547. if (cached) {
  24548. peg$currPos = cached.nextPos;
  24549. return cached.result;
  24550. }
  24551. s0 = peg$parsedynamicDictionary();
  24552. if (s0 === peg$FAILED) {
  24553. s0 = peg$parsedynamicArray();
  24554. if (s0 === peg$FAILED) {
  24555. s0 = peg$parseblock();
  24556. }
  24557. }
  24558. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24559. return s0;
  24560. }
  24561. function peg$parseliteral() {
  24562. var s0;
  24563. var key = peg$currPos * 61 + 27,
  24564. cached = peg$resultsCache[key];
  24565. if (cached) {
  24566. peg$currPos = cached.nextPos;
  24567. return cached.result;
  24568. }
  24569. s0 = peg$parseruntimeLiteral();
  24570. if (s0 === peg$FAILED) {
  24571. s0 = peg$parseparseTimeLiteral();
  24572. }
  24573. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24574. return s0;
  24575. }
  24576. function peg$parsevariable() {
  24577. var s0, s1;
  24578. var key = peg$currPos * 61 + 28,
  24579. cached = peg$resultsCache[key];
  24580. if (cached) {
  24581. peg$currPos = cached.nextPos;
  24582. return cached.result;
  24583. }
  24584. s0 = peg$currPos;
  24585. s1 = peg$parseidentifier();
  24586. if (s1 !== peg$FAILED) {
  24587. peg$savedPos = s0;
  24588. s1 = peg$c79(s1);
  24589. }
  24590. s0 = s1;
  24591. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24592. return s0;
  24593. }
  24594. function peg$parsebinarySelector() {
  24595. var s0, s1, s2;
  24596. var key = peg$currPos * 61 + 29,
  24597. cached = peg$resultsCache[key];
  24598. if (cached) {
  24599. peg$currPos = cached.nextPos;
  24600. return cached.result;
  24601. }
  24602. s0 = peg$currPos;
  24603. s1 = [];
  24604. if (peg$c80.test(input.charAt(peg$currPos))) {
  24605. s2 = input.charAt(peg$currPos);
  24606. peg$currPos++;
  24607. } else {
  24608. s2 = peg$FAILED;
  24609. if (peg$silentFails === 0) { peg$fail(peg$c81); }
  24610. }
  24611. if (s2 !== peg$FAILED) {
  24612. while (s2 !== peg$FAILED) {
  24613. s1.push(s2);
  24614. if (peg$c80.test(input.charAt(peg$currPos))) {
  24615. s2 = input.charAt(peg$currPos);
  24616. peg$currPos++;
  24617. } else {
  24618. s2 = peg$FAILED;
  24619. if (peg$silentFails === 0) { peg$fail(peg$c81); }
  24620. }
  24621. }
  24622. } else {
  24623. s1 = peg$FAILED;
  24624. }
  24625. if (s1 !== peg$FAILED) {
  24626. peg$savedPos = s0;
  24627. s1 = peg$c82(s1);
  24628. }
  24629. s0 = s1;
  24630. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24631. return s0;
  24632. }
  24633. function peg$parsewsKeywordPattern() {
  24634. var s0, s1, s2, s3, s4, s5, s6;
  24635. var key = peg$currPos * 61 + 30,
  24636. cached = peg$resultsCache[key];
  24637. if (cached) {
  24638. peg$currPos = cached.nextPos;
  24639. return cached.result;
  24640. }
  24641. s0 = peg$currPos;
  24642. s1 = [];
  24643. s2 = peg$currPos;
  24644. s3 = peg$parsews();
  24645. if (s3 !== peg$FAILED) {
  24646. s4 = peg$parsekeyword();
  24647. if (s4 !== peg$FAILED) {
  24648. s5 = peg$parsews();
  24649. if (s5 !== peg$FAILED) {
  24650. s6 = peg$parseidentifier();
  24651. if (s6 !== peg$FAILED) {
  24652. peg$savedPos = s2;
  24653. s3 = peg$c83(s4, s6);
  24654. s2 = s3;
  24655. } else {
  24656. peg$currPos = s2;
  24657. s2 = peg$FAILED;
  24658. }
  24659. } else {
  24660. peg$currPos = s2;
  24661. s2 = peg$FAILED;
  24662. }
  24663. } else {
  24664. peg$currPos = s2;
  24665. s2 = peg$FAILED;
  24666. }
  24667. } else {
  24668. peg$currPos = s2;
  24669. s2 = peg$FAILED;
  24670. }
  24671. if (s2 !== peg$FAILED) {
  24672. while (s2 !== peg$FAILED) {
  24673. s1.push(s2);
  24674. s2 = peg$currPos;
  24675. s3 = peg$parsews();
  24676. if (s3 !== peg$FAILED) {
  24677. s4 = peg$parsekeyword();
  24678. if (s4 !== peg$FAILED) {
  24679. s5 = peg$parsews();
  24680. if (s5 !== peg$FAILED) {
  24681. s6 = peg$parseidentifier();
  24682. if (s6 !== peg$FAILED) {
  24683. peg$savedPos = s2;
  24684. s3 = peg$c83(s4, s6);
  24685. s2 = s3;
  24686. } else {
  24687. peg$currPos = s2;
  24688. s2 = peg$FAILED;
  24689. }
  24690. } else {
  24691. peg$currPos = s2;
  24692. s2 = peg$FAILED;
  24693. }
  24694. } else {
  24695. peg$currPos = s2;
  24696. s2 = peg$FAILED;
  24697. }
  24698. } else {
  24699. peg$currPos = s2;
  24700. s2 = peg$FAILED;
  24701. }
  24702. }
  24703. } else {
  24704. s1 = peg$FAILED;
  24705. }
  24706. if (s1 !== peg$FAILED) {
  24707. peg$savedPos = s0;
  24708. s1 = peg$c84(s1);
  24709. }
  24710. s0 = s1;
  24711. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24712. return s0;
  24713. }
  24714. function peg$parsewsBinaryPattern() {
  24715. var s0, s1, s2, s3, s4;
  24716. var key = peg$currPos * 61 + 31,
  24717. cached = peg$resultsCache[key];
  24718. if (cached) {
  24719. peg$currPos = cached.nextPos;
  24720. return cached.result;
  24721. }
  24722. s0 = peg$currPos;
  24723. s1 = peg$parsews();
  24724. if (s1 !== peg$FAILED) {
  24725. s2 = peg$parsebinarySelector();
  24726. if (s2 !== peg$FAILED) {
  24727. s3 = peg$parsews();
  24728. if (s3 !== peg$FAILED) {
  24729. s4 = peg$parseidentifier();
  24730. if (s4 !== peg$FAILED) {
  24731. peg$savedPos = s0;
  24732. s1 = peg$c85(s2, s4);
  24733. s0 = s1;
  24734. } else {
  24735. peg$currPos = s0;
  24736. s0 = peg$FAILED;
  24737. }
  24738. } else {
  24739. peg$currPos = s0;
  24740. s0 = peg$FAILED;
  24741. }
  24742. } else {
  24743. peg$currPos = s0;
  24744. s0 = peg$FAILED;
  24745. }
  24746. } else {
  24747. peg$currPos = s0;
  24748. s0 = peg$FAILED;
  24749. }
  24750. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24751. return s0;
  24752. }
  24753. function peg$parsewsUnaryPattern() {
  24754. var s0, s1, s2;
  24755. var key = peg$currPos * 61 + 32,
  24756. cached = peg$resultsCache[key];
  24757. if (cached) {
  24758. peg$currPos = cached.nextPos;
  24759. return cached.result;
  24760. }
  24761. s0 = peg$currPos;
  24762. s1 = peg$parsews();
  24763. if (s1 !== peg$FAILED) {
  24764. s2 = peg$parseidentifier();
  24765. if (s2 !== peg$FAILED) {
  24766. peg$savedPos = s0;
  24767. s1 = peg$c86(s2);
  24768. s0 = s1;
  24769. } else {
  24770. peg$currPos = s0;
  24771. s0 = peg$FAILED;
  24772. }
  24773. } else {
  24774. peg$currPos = s0;
  24775. s0 = peg$FAILED;
  24776. }
  24777. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24778. return s0;
  24779. }
  24780. function peg$parseexpression() {
  24781. var s0;
  24782. var key = peg$currPos * 61 + 33,
  24783. cached = peg$resultsCache[key];
  24784. if (cached) {
  24785. peg$currPos = cached.nextPos;
  24786. return cached.result;
  24787. }
  24788. s0 = peg$parseassignment();
  24789. if (s0 === peg$FAILED) {
  24790. s0 = peg$parsecascade();
  24791. if (s0 === peg$FAILED) {
  24792. s0 = peg$parsekeywordSend();
  24793. }
  24794. }
  24795. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24796. return s0;
  24797. }
  24798. function peg$parsewsExpressionsRest() {
  24799. var s0, s1, s2, s3, s4;
  24800. var key = peg$currPos * 61 + 34,
  24801. cached = peg$resultsCache[key];
  24802. if (cached) {
  24803. peg$currPos = cached.nextPos;
  24804. return cached.result;
  24805. }
  24806. s0 = peg$currPos;
  24807. s1 = peg$parsews();
  24808. if (s1 !== peg$FAILED) {
  24809. if (input.charCodeAt(peg$currPos) === 46) {
  24810. s2 = peg$c6;
  24811. peg$currPos++;
  24812. } else {
  24813. s2 = peg$FAILED;
  24814. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24815. }
  24816. if (s2 !== peg$FAILED) {
  24817. s3 = peg$parsemaybeDotsWs();
  24818. if (s3 !== peg$FAILED) {
  24819. s4 = peg$parseexpression();
  24820. if (s4 !== peg$FAILED) {
  24821. peg$savedPos = s0;
  24822. s1 = peg$c87(s4);
  24823. s0 = s1;
  24824. } else {
  24825. peg$currPos = s0;
  24826. s0 = peg$FAILED;
  24827. }
  24828. } else {
  24829. peg$currPos = s0;
  24830. s0 = peg$FAILED;
  24831. }
  24832. } else {
  24833. peg$currPos = s0;
  24834. s0 = peg$FAILED;
  24835. }
  24836. } else {
  24837. peg$currPos = s0;
  24838. s0 = peg$FAILED;
  24839. }
  24840. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24841. return s0;
  24842. }
  24843. function peg$parseexpressions() {
  24844. var s0, s1, s2, s3;
  24845. var key = peg$currPos * 61 + 35,
  24846. cached = peg$resultsCache[key];
  24847. if (cached) {
  24848. peg$currPos = cached.nextPos;
  24849. return cached.result;
  24850. }
  24851. s0 = peg$currPos;
  24852. s1 = peg$parseexpression();
  24853. if (s1 !== peg$FAILED) {
  24854. s2 = [];
  24855. s3 = peg$parsewsExpressionsRest();
  24856. while (s3 !== peg$FAILED) {
  24857. s2.push(s3);
  24858. s3 = peg$parsewsExpressionsRest();
  24859. }
  24860. if (s2 !== peg$FAILED) {
  24861. peg$savedPos = s0;
  24862. s1 = peg$c88(s1, s2);
  24863. s0 = s1;
  24864. } else {
  24865. peg$currPos = s0;
  24866. s0 = peg$FAILED;
  24867. }
  24868. } else {
  24869. peg$currPos = s0;
  24870. s0 = peg$FAILED;
  24871. }
  24872. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24873. return s0;
  24874. }
  24875. function peg$parseassignment() {
  24876. var s0, s1, s2, s3, s4, s5;
  24877. var key = peg$currPos * 61 + 36,
  24878. cached = peg$resultsCache[key];
  24879. if (cached) {
  24880. peg$currPos = cached.nextPos;
  24881. return cached.result;
  24882. }
  24883. s0 = peg$currPos;
  24884. s1 = peg$parsevariable();
  24885. if (s1 !== peg$FAILED) {
  24886. s2 = peg$parsews();
  24887. if (s2 !== peg$FAILED) {
  24888. if (input.substr(peg$currPos, 2) === peg$c89) {
  24889. s3 = peg$c89;
  24890. peg$currPos += 2;
  24891. } else {
  24892. s3 = peg$FAILED;
  24893. if (peg$silentFails === 0) { peg$fail(peg$c90); }
  24894. }
  24895. if (s3 !== peg$FAILED) {
  24896. s4 = peg$parsews();
  24897. if (s4 !== peg$FAILED) {
  24898. s5 = peg$parseexpression();
  24899. if (s5 !== peg$FAILED) {
  24900. peg$savedPos = s0;
  24901. s1 = peg$c91(s1, s5);
  24902. s0 = s1;
  24903. } else {
  24904. peg$currPos = s0;
  24905. s0 = peg$FAILED;
  24906. }
  24907. } else {
  24908. peg$currPos = s0;
  24909. s0 = peg$FAILED;
  24910. }
  24911. } else {
  24912. peg$currPos = s0;
  24913. s0 = peg$FAILED;
  24914. }
  24915. } else {
  24916. peg$currPos = s0;
  24917. s0 = peg$FAILED;
  24918. }
  24919. } else {
  24920. peg$currPos = s0;
  24921. s0 = peg$FAILED;
  24922. }
  24923. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24924. return s0;
  24925. }
  24926. function peg$parseret() {
  24927. var s0, s1, s2, s3;
  24928. var key = peg$currPos * 61 + 37,
  24929. cached = peg$resultsCache[key];
  24930. if (cached) {
  24931. peg$currPos = cached.nextPos;
  24932. return cached.result;
  24933. }
  24934. s0 = peg$currPos;
  24935. if (input.charCodeAt(peg$currPos) === 94) {
  24936. s1 = peg$c92;
  24937. peg$currPos++;
  24938. } else {
  24939. s1 = peg$FAILED;
  24940. if (peg$silentFails === 0) { peg$fail(peg$c93); }
  24941. }
  24942. if (s1 !== peg$FAILED) {
  24943. s2 = peg$parsews();
  24944. if (s2 !== peg$FAILED) {
  24945. s3 = peg$parseexpression();
  24946. if (s3 !== peg$FAILED) {
  24947. peg$savedPos = s0;
  24948. s1 = peg$c94(s3);
  24949. s0 = s1;
  24950. } else {
  24951. peg$currPos = s0;
  24952. s0 = peg$FAILED;
  24953. }
  24954. } else {
  24955. peg$currPos = s0;
  24956. s0 = peg$FAILED;
  24957. }
  24958. } else {
  24959. peg$currPos = s0;
  24960. s0 = peg$FAILED;
  24961. }
  24962. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24963. return s0;
  24964. }
  24965. function peg$parsetemps() {
  24966. var s0, s1, s2, s3, s4, s5;
  24967. var key = peg$currPos * 61 + 38,
  24968. cached = peg$resultsCache[key];
  24969. if (cached) {
  24970. peg$currPos = cached.nextPos;
  24971. return cached.result;
  24972. }
  24973. s0 = peg$currPos;
  24974. if (input.charCodeAt(peg$currPos) === 124) {
  24975. s1 = peg$c95;
  24976. peg$currPos++;
  24977. } else {
  24978. s1 = peg$FAILED;
  24979. if (peg$silentFails === 0) { peg$fail(peg$c96); }
  24980. }
  24981. if (s1 !== peg$FAILED) {
  24982. s2 = [];
  24983. s3 = peg$currPos;
  24984. s4 = peg$parsews();
  24985. if (s4 !== peg$FAILED) {
  24986. s5 = peg$parseidentifier();
  24987. if (s5 !== peg$FAILED) {
  24988. peg$savedPos = s3;
  24989. s4 = peg$c97(s5);
  24990. s3 = s4;
  24991. } else {
  24992. peg$currPos = s3;
  24993. s3 = peg$FAILED;
  24994. }
  24995. } else {
  24996. peg$currPos = s3;
  24997. s3 = peg$FAILED;
  24998. }
  24999. while (s3 !== peg$FAILED) {
  25000. s2.push(s3);
  25001. s3 = peg$currPos;
  25002. s4 = peg$parsews();
  25003. if (s4 !== peg$FAILED) {
  25004. s5 = peg$parseidentifier();
  25005. if (s5 !== peg$FAILED) {
  25006. peg$savedPos = s3;
  25007. s4 = peg$c97(s5);
  25008. s3 = s4;
  25009. } else {
  25010. peg$currPos = s3;
  25011. s3 = peg$FAILED;
  25012. }
  25013. } else {
  25014. peg$currPos = s3;
  25015. s3 = peg$FAILED;
  25016. }
  25017. }
  25018. if (s2 !== peg$FAILED) {
  25019. s3 = peg$parsews();
  25020. if (s3 !== peg$FAILED) {
  25021. if (input.charCodeAt(peg$currPos) === 124) {
  25022. s4 = peg$c95;
  25023. peg$currPos++;
  25024. } else {
  25025. s4 = peg$FAILED;
  25026. if (peg$silentFails === 0) { peg$fail(peg$c96); }
  25027. }
  25028. if (s4 !== peg$FAILED) {
  25029. peg$savedPos = s0;
  25030. s1 = peg$c98(s2);
  25031. s0 = s1;
  25032. } else {
  25033. peg$currPos = s0;
  25034. s0 = peg$FAILED;
  25035. }
  25036. } else {
  25037. peg$currPos = s0;
  25038. s0 = peg$FAILED;
  25039. }
  25040. } else {
  25041. peg$currPos = s0;
  25042. s0 = peg$FAILED;
  25043. }
  25044. } else {
  25045. peg$currPos = s0;
  25046. s0 = peg$FAILED;
  25047. }
  25048. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25049. return s0;
  25050. }
  25051. function peg$parsewsBlockParamList() {
  25052. var s0, s1, s2, s3, s4, s5, s6;
  25053. var key = peg$currPos * 61 + 39,
  25054. cached = peg$resultsCache[key];
  25055. if (cached) {
  25056. peg$currPos = cached.nextPos;
  25057. return cached.result;
  25058. }
  25059. s0 = peg$currPos;
  25060. s1 = [];
  25061. s2 = peg$currPos;
  25062. s3 = peg$parsews();
  25063. if (s3 !== peg$FAILED) {
  25064. if (input.charCodeAt(peg$currPos) === 58) {
  25065. s4 = peg$c13;
  25066. peg$currPos++;
  25067. } else {
  25068. s4 = peg$FAILED;
  25069. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  25070. }
  25071. if (s4 !== peg$FAILED) {
  25072. s5 = peg$parsews();
  25073. if (s5 !== peg$FAILED) {
  25074. s6 = peg$parseidentifier();
  25075. if (s6 !== peg$FAILED) {
  25076. peg$savedPos = s2;
  25077. s3 = peg$c99(s6);
  25078. s2 = s3;
  25079. } else {
  25080. peg$currPos = s2;
  25081. s2 = peg$FAILED;
  25082. }
  25083. } else {
  25084. peg$currPos = s2;
  25085. s2 = peg$FAILED;
  25086. }
  25087. } else {
  25088. peg$currPos = s2;
  25089. s2 = peg$FAILED;
  25090. }
  25091. } else {
  25092. peg$currPos = s2;
  25093. s2 = peg$FAILED;
  25094. }
  25095. if (s2 !== peg$FAILED) {
  25096. while (s2 !== peg$FAILED) {
  25097. s1.push(s2);
  25098. s2 = peg$currPos;
  25099. s3 = peg$parsews();
  25100. if (s3 !== peg$FAILED) {
  25101. if (input.charCodeAt(peg$currPos) === 58) {
  25102. s4 = peg$c13;
  25103. peg$currPos++;
  25104. } else {
  25105. s4 = peg$FAILED;
  25106. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  25107. }
  25108. if (s4 !== peg$FAILED) {
  25109. s5 = peg$parsews();
  25110. if (s5 !== peg$FAILED) {
  25111. s6 = peg$parseidentifier();
  25112. if (s6 !== peg$FAILED) {
  25113. peg$savedPos = s2;
  25114. s3 = peg$c99(s6);
  25115. s2 = s3;
  25116. } else {
  25117. peg$currPos = s2;
  25118. s2 = peg$FAILED;
  25119. }
  25120. } else {
  25121. peg$currPos = s2;
  25122. s2 = peg$FAILED;
  25123. }
  25124. } else {
  25125. peg$currPos = s2;
  25126. s2 = peg$FAILED;
  25127. }
  25128. } else {
  25129. peg$currPos = s2;
  25130. s2 = peg$FAILED;
  25131. }
  25132. }
  25133. } else {
  25134. s1 = peg$FAILED;
  25135. }
  25136. if (s1 !== peg$FAILED) {
  25137. s2 = peg$parsews();
  25138. if (s2 !== peg$FAILED) {
  25139. if (input.charCodeAt(peg$currPos) === 124) {
  25140. s3 = peg$c95;
  25141. peg$currPos++;
  25142. } else {
  25143. s3 = peg$FAILED;
  25144. if (peg$silentFails === 0) { peg$fail(peg$c96); }
  25145. }
  25146. if (s3 !== peg$FAILED) {
  25147. peg$savedPos = s0;
  25148. s1 = peg$c100(s1);
  25149. s0 = s1;
  25150. } else {
  25151. peg$currPos = s0;
  25152. s0 = peg$FAILED;
  25153. }
  25154. } else {
  25155. peg$currPos = s0;
  25156. s0 = peg$FAILED;
  25157. }
  25158. } else {
  25159. peg$currPos = s0;
  25160. s0 = peg$FAILED;
  25161. }
  25162. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25163. return s0;
  25164. }
  25165. function peg$parsesubexpression() {
  25166. var s0, s1, s2, s3, s4, s5;
  25167. var key = peg$currPos * 61 + 40,
  25168. cached = peg$resultsCache[key];
  25169. if (cached) {
  25170. peg$currPos = cached.nextPos;
  25171. return cached.result;
  25172. }
  25173. s0 = peg$currPos;
  25174. if (input.charCodeAt(peg$currPos) === 40) {
  25175. s1 = peg$c57;
  25176. peg$currPos++;
  25177. } else {
  25178. s1 = peg$FAILED;
  25179. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  25180. }
  25181. if (s1 !== peg$FAILED) {
  25182. s2 = peg$parsews();
  25183. if (s2 !== peg$FAILED) {
  25184. s3 = peg$parseexpression();
  25185. if (s3 !== peg$FAILED) {
  25186. s4 = peg$parsews();
  25187. if (s4 !== peg$FAILED) {
  25188. if (input.charCodeAt(peg$currPos) === 41) {
  25189. s5 = peg$c54;
  25190. peg$currPos++;
  25191. } else {
  25192. s5 = peg$FAILED;
  25193. if (peg$silentFails === 0) { peg$fail(peg$c55); }
  25194. }
  25195. if (s5 !== peg$FAILED) {
  25196. peg$savedPos = s0;
  25197. s1 = peg$c87(s3);
  25198. s0 = s1;
  25199. } else {
  25200. peg$currPos = s0;
  25201. s0 = peg$FAILED;
  25202. }
  25203. } else {
  25204. peg$currPos = s0;
  25205. s0 = peg$FAILED;
  25206. }
  25207. } else {
  25208. peg$currPos = s0;
  25209. s0 = peg$FAILED;
  25210. }
  25211. } else {
  25212. peg$currPos = s0;
  25213. s0 = peg$FAILED;
  25214. }
  25215. } else {
  25216. peg$currPos = s0;
  25217. s0 = peg$FAILED;
  25218. }
  25219. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25220. return s0;
  25221. }
  25222. function peg$parsestatementsWs() {
  25223. var s0, s1, s2, s3, s4, s5, s6;
  25224. var key = peg$currPos * 61 + 41,
  25225. cached = peg$resultsCache[key];
  25226. if (cached) {
  25227. peg$currPos = cached.nextPos;
  25228. return cached.result;
  25229. }
  25230. s0 = peg$currPos;
  25231. s1 = peg$parseret();
  25232. if (s1 !== peg$FAILED) {
  25233. s2 = peg$parsemaybeDotsWs();
  25234. if (s2 !== peg$FAILED) {
  25235. peg$savedPos = s0;
  25236. s1 = peg$c101(s1);
  25237. s0 = s1;
  25238. } else {
  25239. peg$currPos = s0;
  25240. s0 = peg$FAILED;
  25241. }
  25242. } else {
  25243. peg$currPos = s0;
  25244. s0 = peg$FAILED;
  25245. }
  25246. if (s0 === peg$FAILED) {
  25247. s0 = peg$currPos;
  25248. s1 = peg$parseexpressions();
  25249. if (s1 !== peg$FAILED) {
  25250. s2 = peg$parsews();
  25251. if (s2 !== peg$FAILED) {
  25252. if (input.charCodeAt(peg$currPos) === 46) {
  25253. s3 = peg$c6;
  25254. peg$currPos++;
  25255. } else {
  25256. s3 = peg$FAILED;
  25257. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  25258. }
  25259. if (s3 !== peg$FAILED) {
  25260. s4 = peg$parsemaybeDotsWs();
  25261. if (s4 !== peg$FAILED) {
  25262. s5 = peg$parseret();
  25263. if (s5 !== peg$FAILED) {
  25264. s6 = peg$parsemaybeDotsWs();
  25265. if (s6 !== peg$FAILED) {
  25266. peg$savedPos = s0;
  25267. s1 = peg$c102(s1, s5);
  25268. s0 = s1;
  25269. } else {
  25270. peg$currPos = s0;
  25271. s0 = peg$FAILED;
  25272. }
  25273. } else {
  25274. peg$currPos = s0;
  25275. s0 = peg$FAILED;
  25276. }
  25277. } else {
  25278. peg$currPos = s0;
  25279. s0 = peg$FAILED;
  25280. }
  25281. } else {
  25282. peg$currPos = s0;
  25283. s0 = peg$FAILED;
  25284. }
  25285. } else {
  25286. peg$currPos = s0;
  25287. s0 = peg$FAILED;
  25288. }
  25289. } else {
  25290. peg$currPos = s0;
  25291. s0 = peg$FAILED;
  25292. }
  25293. if (s0 === peg$FAILED) {
  25294. s0 = peg$currPos;
  25295. s1 = peg$parseexpressions();
  25296. if (s1 === peg$FAILED) {
  25297. s1 = null;
  25298. }
  25299. if (s1 !== peg$FAILED) {
  25300. s2 = peg$parsemaybeDotsWs();
  25301. if (s2 !== peg$FAILED) {
  25302. peg$savedPos = s0;
  25303. s1 = peg$c103(s1);
  25304. s0 = s1;
  25305. } else {
  25306. peg$currPos = s0;
  25307. s0 = peg$FAILED;
  25308. }
  25309. } else {
  25310. peg$currPos = s0;
  25311. s0 = peg$FAILED;
  25312. }
  25313. }
  25314. }
  25315. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25316. return s0;
  25317. }
  25318. function peg$parsewsSequenceWs() {
  25319. var s0, s1, s2, s3;
  25320. var key = peg$currPos * 61 + 42,
  25321. cached = peg$resultsCache[key];
  25322. if (cached) {
  25323. peg$currPos = cached.nextPos;
  25324. return cached.result;
  25325. }
  25326. s0 = peg$currPos;
  25327. s1 = peg$parsews();
  25328. if (s1 !== peg$FAILED) {
  25329. s2 = peg$parsejsStatement();
  25330. if (s2 !== peg$FAILED) {
  25331. s3 = peg$parsews();
  25332. if (s3 !== peg$FAILED) {
  25333. peg$savedPos = s0;
  25334. s1 = peg$c104(s2);
  25335. s0 = s1;
  25336. } else {
  25337. peg$currPos = s0;
  25338. s0 = peg$FAILED;
  25339. }
  25340. } else {
  25341. peg$currPos = s0;
  25342. s0 = peg$FAILED;
  25343. }
  25344. } else {
  25345. peg$currPos = s0;
  25346. s0 = peg$FAILED;
  25347. }
  25348. if (s0 === peg$FAILED) {
  25349. s0 = peg$parsewsStSequenceWs();
  25350. }
  25351. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25352. return s0;
  25353. }
  25354. function peg$parsewsStSequenceWs() {
  25355. var s0, s1, s2, s3, s4;
  25356. var key = peg$currPos * 61 + 43,
  25357. cached = peg$resultsCache[key];
  25358. if (cached) {
  25359. peg$currPos = cached.nextPos;
  25360. return cached.result;
  25361. }
  25362. s0 = peg$currPos;
  25363. s1 = peg$parsews();
  25364. if (s1 !== peg$FAILED) {
  25365. s2 = peg$parsetemps();
  25366. if (s2 === peg$FAILED) {
  25367. s2 = null;
  25368. }
  25369. if (s2 !== peg$FAILED) {
  25370. s3 = peg$parsemaybeDotsWs();
  25371. if (s3 !== peg$FAILED) {
  25372. s4 = peg$parsestatementsWs();
  25373. if (s4 === peg$FAILED) {
  25374. s4 = null;
  25375. }
  25376. if (s4 !== peg$FAILED) {
  25377. peg$savedPos = s0;
  25378. s1 = peg$c105(s2, s4);
  25379. s0 = s1;
  25380. } else {
  25381. peg$currPos = s0;
  25382. s0 = peg$FAILED;
  25383. }
  25384. } else {
  25385. peg$currPos = s0;
  25386. s0 = peg$FAILED;
  25387. }
  25388. } else {
  25389. peg$currPos = s0;
  25390. s0 = peg$FAILED;
  25391. }
  25392. } else {
  25393. peg$currPos = s0;
  25394. s0 = peg$FAILED;
  25395. }
  25396. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25397. return s0;
  25398. }
  25399. function peg$parseblock() {
  25400. var s0, s1, s2, s3, s4;
  25401. var key = peg$currPos * 61 + 44,
  25402. cached = peg$resultsCache[key];
  25403. if (cached) {
  25404. peg$currPos = cached.nextPos;
  25405. return cached.result;
  25406. }
  25407. s0 = peg$currPos;
  25408. if (input.charCodeAt(peg$currPos) === 91) {
  25409. s1 = peg$c106;
  25410. peg$currPos++;
  25411. } else {
  25412. s1 = peg$FAILED;
  25413. if (peg$silentFails === 0) { peg$fail(peg$c107); }
  25414. }
  25415. if (s1 !== peg$FAILED) {
  25416. s2 = peg$parsewsBlockParamList();
  25417. if (s2 === peg$FAILED) {
  25418. s2 = null;
  25419. }
  25420. if (s2 !== peg$FAILED) {
  25421. s3 = peg$parsewsSequenceWs();
  25422. if (s3 === peg$FAILED) {
  25423. s3 = null;
  25424. }
  25425. if (s3 !== peg$FAILED) {
  25426. if (input.charCodeAt(peg$currPos) === 93) {
  25427. s4 = peg$c108;
  25428. peg$currPos++;
  25429. } else {
  25430. s4 = peg$FAILED;
  25431. if (peg$silentFails === 0) { peg$fail(peg$c109); }
  25432. }
  25433. if (s4 !== peg$FAILED) {
  25434. peg$savedPos = s0;
  25435. s1 = peg$c110(s2, s3);
  25436. s0 = s1;
  25437. } else {
  25438. peg$currPos = s0;
  25439. s0 = peg$FAILED;
  25440. }
  25441. } else {
  25442. peg$currPos = s0;
  25443. s0 = peg$FAILED;
  25444. }
  25445. } else {
  25446. peg$currPos = s0;
  25447. s0 = peg$FAILED;
  25448. }
  25449. } else {
  25450. peg$currPos = s0;
  25451. s0 = peg$FAILED;
  25452. }
  25453. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25454. return s0;
  25455. }
  25456. function peg$parseoperand() {
  25457. var s0;
  25458. var key = peg$currPos * 61 + 45,
  25459. cached = peg$resultsCache[key];
  25460. if (cached) {
  25461. peg$currPos = cached.nextPos;
  25462. return cached.result;
  25463. }
  25464. s0 = peg$parseliteral();
  25465. if (s0 === peg$FAILED) {
  25466. s0 = peg$parsevariable();
  25467. if (s0 === peg$FAILED) {
  25468. s0 = peg$parsesubexpression();
  25469. }
  25470. }
  25471. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25472. return s0;
  25473. }
  25474. function peg$parsewsUnaryMessage() {
  25475. var s0, s1, s2, s3, s4;
  25476. var key = peg$currPos * 61 + 46,
  25477. cached = peg$resultsCache[key];
  25478. if (cached) {
  25479. peg$currPos = cached.nextPos;
  25480. return cached.result;
  25481. }
  25482. s0 = peg$currPos;
  25483. s1 = peg$parsews();
  25484. if (s1 !== peg$FAILED) {
  25485. s2 = peg$parseidentifier();
  25486. if (s2 !== peg$FAILED) {
  25487. s3 = peg$currPos;
  25488. peg$silentFails++;
  25489. if (input.charCodeAt(peg$currPos) === 58) {
  25490. s4 = peg$c13;
  25491. peg$currPos++;
  25492. } else {
  25493. s4 = peg$FAILED;
  25494. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  25495. }
  25496. peg$silentFails--;
  25497. if (s4 === peg$FAILED) {
  25498. s3 = void 0;
  25499. } else {
  25500. peg$currPos = s3;
  25501. s3 = peg$FAILED;
  25502. }
  25503. if (s3 !== peg$FAILED) {
  25504. peg$savedPos = s0;
  25505. s1 = peg$c111(s2);
  25506. s0 = s1;
  25507. } else {
  25508. peg$currPos = s0;
  25509. s0 = peg$FAILED;
  25510. }
  25511. } else {
  25512. peg$currPos = s0;
  25513. s0 = peg$FAILED;
  25514. }
  25515. } else {
  25516. peg$currPos = s0;
  25517. s0 = peg$FAILED;
  25518. }
  25519. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25520. return s0;
  25521. }
  25522. function peg$parsewsUnaryTail() {
  25523. var s0, s1, s2;
  25524. var key = peg$currPos * 61 + 47,
  25525. cached = peg$resultsCache[key];
  25526. if (cached) {
  25527. peg$currPos = cached.nextPos;
  25528. return cached.result;
  25529. }
  25530. s0 = peg$currPos;
  25531. s1 = peg$parsewsUnaryMessage();
  25532. if (s1 !== peg$FAILED) {
  25533. s2 = peg$parsewsUnaryTail();
  25534. if (s2 === peg$FAILED) {
  25535. s2 = null;
  25536. }
  25537. if (s2 !== peg$FAILED) {
  25538. peg$savedPos = s0;
  25539. s1 = peg$c112(s1, s2);
  25540. s0 = s1;
  25541. } else {
  25542. peg$currPos = s0;
  25543. s0 = peg$FAILED;
  25544. }
  25545. } else {
  25546. peg$currPos = s0;
  25547. s0 = peg$FAILED;
  25548. }
  25549. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25550. return s0;
  25551. }
  25552. function peg$parseunarySend() {
  25553. var s0, s1, s2;
  25554. var key = peg$currPos * 61 + 48,
  25555. cached = peg$resultsCache[key];
  25556. if (cached) {
  25557. peg$currPos = cached.nextPos;
  25558. return cached.result;
  25559. }
  25560. s0 = peg$currPos;
  25561. s1 = peg$parseoperand();
  25562. if (s1 !== peg$FAILED) {
  25563. s2 = peg$parsewsUnaryTail();
  25564. if (s2 === peg$FAILED) {
  25565. s2 = null;
  25566. }
  25567. if (s2 !== peg$FAILED) {
  25568. peg$savedPos = s0;
  25569. s1 = peg$c113(s1, s2);
  25570. s0 = s1;
  25571. } else {
  25572. peg$currPos = s0;
  25573. s0 = peg$FAILED;
  25574. }
  25575. } else {
  25576. peg$currPos = s0;
  25577. s0 = peg$FAILED;
  25578. }
  25579. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25580. return s0;
  25581. }
  25582. function peg$parsewsBinaryMessage() {
  25583. var s0, s1, s2, s3, s4;
  25584. var key = peg$currPos * 61 + 49,
  25585. cached = peg$resultsCache[key];
  25586. if (cached) {
  25587. peg$currPos = cached.nextPos;
  25588. return cached.result;
  25589. }
  25590. s0 = peg$currPos;
  25591. s1 = peg$parsews();
  25592. if (s1 !== peg$FAILED) {
  25593. s2 = peg$parsebinarySelector();
  25594. if (s2 !== peg$FAILED) {
  25595. s3 = peg$parsews();
  25596. if (s3 !== peg$FAILED) {
  25597. s4 = peg$parseunarySend();
  25598. if (s4 !== peg$FAILED) {
  25599. peg$savedPos = s0;
  25600. s1 = peg$c114(s2, s4);
  25601. s0 = s1;
  25602. } else {
  25603. peg$currPos = s0;
  25604. s0 = peg$FAILED;
  25605. }
  25606. } else {
  25607. peg$currPos = s0;
  25608. s0 = peg$FAILED;
  25609. }
  25610. } else {
  25611. peg$currPos = s0;
  25612. s0 = peg$FAILED;
  25613. }
  25614. } else {
  25615. peg$currPos = s0;
  25616. s0 = peg$FAILED;
  25617. }
  25618. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25619. return s0;
  25620. }
  25621. function peg$parsewsBinaryTail() {
  25622. var s0, s1, s2;
  25623. var key = peg$currPos * 61 + 50,
  25624. cached = peg$resultsCache[key];
  25625. if (cached) {
  25626. peg$currPos = cached.nextPos;
  25627. return cached.result;
  25628. }
  25629. s0 = peg$currPos;
  25630. s1 = peg$parsewsBinaryMessage();
  25631. if (s1 !== peg$FAILED) {
  25632. s2 = peg$parsewsBinaryTail();
  25633. if (s2 === peg$FAILED) {
  25634. s2 = null;
  25635. }
  25636. if (s2 !== peg$FAILED) {
  25637. peg$savedPos = s0;
  25638. s1 = peg$c115(s1, s2);
  25639. s0 = s1;
  25640. } else {
  25641. peg$currPos = s0;
  25642. s0 = peg$FAILED;
  25643. }
  25644. } else {
  25645. peg$currPos = s0;
  25646. s0 = peg$FAILED;
  25647. }
  25648. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25649. return s0;
  25650. }
  25651. function peg$parsebinarySend() {
  25652. var s0, s1, s2;
  25653. var key = peg$currPos * 61 + 51,
  25654. cached = peg$resultsCache[key];
  25655. if (cached) {
  25656. peg$currPos = cached.nextPos;
  25657. return cached.result;
  25658. }
  25659. s0 = peg$currPos;
  25660. s1 = peg$parseunarySend();
  25661. if (s1 !== peg$FAILED) {
  25662. s2 = peg$parsewsBinaryTail();
  25663. if (s2 === peg$FAILED) {
  25664. s2 = null;
  25665. }
  25666. if (s2 !== peg$FAILED) {
  25667. peg$savedPos = s0;
  25668. s1 = peg$c113(s1, s2);
  25669. s0 = s1;
  25670. } else {
  25671. peg$currPos = s0;
  25672. s0 = peg$FAILED;
  25673. }
  25674. } else {
  25675. peg$currPos = s0;
  25676. s0 = peg$FAILED;
  25677. }
  25678. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25679. return s0;
  25680. }
  25681. function peg$parsewsKeywordMessage() {
  25682. var s0, s1, s2, s3, s4, s5, s6;
  25683. var key = peg$currPos * 61 + 52,
  25684. cached = peg$resultsCache[key];
  25685. if (cached) {
  25686. peg$currPos = cached.nextPos;
  25687. return cached.result;
  25688. }
  25689. s0 = peg$currPos;
  25690. s1 = [];
  25691. s2 = peg$currPos;
  25692. s3 = peg$parsews();
  25693. if (s3 !== peg$FAILED) {
  25694. s4 = peg$parsekeyword();
  25695. if (s4 !== peg$FAILED) {
  25696. s5 = peg$parsews();
  25697. if (s5 !== peg$FAILED) {
  25698. s6 = peg$parsebinarySend();
  25699. if (s6 !== peg$FAILED) {
  25700. peg$savedPos = s2;
  25701. s3 = peg$c83(s4, s6);
  25702. s2 = s3;
  25703. } else {
  25704. peg$currPos = s2;
  25705. s2 = peg$FAILED;
  25706. }
  25707. } else {
  25708. peg$currPos = s2;
  25709. s2 = peg$FAILED;
  25710. }
  25711. } else {
  25712. peg$currPos = s2;
  25713. s2 = peg$FAILED;
  25714. }
  25715. } else {
  25716. peg$currPos = s2;
  25717. s2 = peg$FAILED;
  25718. }
  25719. if (s2 !== peg$FAILED) {
  25720. while (s2 !== peg$FAILED) {
  25721. s1.push(s2);
  25722. s2 = peg$currPos;
  25723. s3 = peg$parsews();
  25724. if (s3 !== peg$FAILED) {
  25725. s4 = peg$parsekeyword();
  25726. if (s4 !== peg$FAILED) {
  25727. s5 = peg$parsews();
  25728. if (s5 !== peg$FAILED) {
  25729. s6 = peg$parsebinarySend();
  25730. if (s6 !== peg$FAILED) {
  25731. peg$savedPos = s2;
  25732. s3 = peg$c83(s4, s6);
  25733. s2 = s3;
  25734. } else {
  25735. peg$currPos = s2;
  25736. s2 = peg$FAILED;
  25737. }
  25738. } else {
  25739. peg$currPos = s2;
  25740. s2 = peg$FAILED;
  25741. }
  25742. } else {
  25743. peg$currPos = s2;
  25744. s2 = peg$FAILED;
  25745. }
  25746. } else {
  25747. peg$currPos = s2;
  25748. s2 = peg$FAILED;
  25749. }
  25750. }
  25751. } else {
  25752. s1 = peg$FAILED;
  25753. }
  25754. if (s1 !== peg$FAILED) {
  25755. peg$savedPos = s0;
  25756. s1 = peg$c116(s1);
  25757. }
  25758. s0 = s1;
  25759. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25760. return s0;
  25761. }
  25762. function peg$parsekeywordSend() {
  25763. var s0, s1, s2;
  25764. var key = peg$currPos * 61 + 53,
  25765. cached = peg$resultsCache[key];
  25766. if (cached) {
  25767. peg$currPos = cached.nextPos;
  25768. return cached.result;
  25769. }
  25770. s0 = peg$currPos;
  25771. s1 = peg$parsebinarySend();
  25772. if (s1 !== peg$FAILED) {
  25773. s2 = peg$parsewsKeywordMessage();
  25774. if (s2 === peg$FAILED) {
  25775. s2 = null;
  25776. }
  25777. if (s2 !== peg$FAILED) {
  25778. peg$savedPos = s0;
  25779. s1 = peg$c113(s1, s2);
  25780. s0 = s1;
  25781. } else {
  25782. peg$currPos = s0;
  25783. s0 = peg$FAILED;
  25784. }
  25785. } else {
  25786. peg$currPos = s0;
  25787. s0 = peg$FAILED;
  25788. }
  25789. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25790. return s0;
  25791. }
  25792. function peg$parsewsMessage() {
  25793. var s0;
  25794. var key = peg$currPos * 61 + 54,
  25795. cached = peg$resultsCache[key];
  25796. if (cached) {
  25797. peg$currPos = cached.nextPos;
  25798. return cached.result;
  25799. }
  25800. s0 = peg$parsewsBinaryMessage();
  25801. if (s0 === peg$FAILED) {
  25802. s0 = peg$parsewsUnaryMessage();
  25803. if (s0 === peg$FAILED) {
  25804. s0 = peg$parsewsKeywordMessage();
  25805. }
  25806. }
  25807. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25808. return s0;
  25809. }
  25810. function peg$parsecascade() {
  25811. var s0, s1, s2, s3, s4, s5, s6, s7;
  25812. var key = peg$currPos * 61 + 55,
  25813. cached = peg$resultsCache[key];
  25814. if (cached) {
  25815. peg$currPos = cached.nextPos;
  25816. return cached.result;
  25817. }
  25818. s0 = peg$currPos;
  25819. s1 = peg$parsekeywordSend();
  25820. if (s1 !== peg$FAILED) {
  25821. peg$savedPos = peg$currPos;
  25822. s2 = peg$c117(s1);
  25823. if (s2) {
  25824. s2 = void 0;
  25825. } else {
  25826. s2 = peg$FAILED;
  25827. }
  25828. if (s2 !== peg$FAILED) {
  25829. s3 = [];
  25830. s4 = peg$currPos;
  25831. s5 = peg$parsews();
  25832. if (s5 !== peg$FAILED) {
  25833. if (input.charCodeAt(peg$currPos) === 59) {
  25834. s6 = peg$c118;
  25835. peg$currPos++;
  25836. } else {
  25837. s6 = peg$FAILED;
  25838. if (peg$silentFails === 0) { peg$fail(peg$c119); }
  25839. }
  25840. if (s6 !== peg$FAILED) {
  25841. s7 = peg$parsewsMessage();
  25842. if (s7 !== peg$FAILED) {
  25843. peg$savedPos = s4;
  25844. s5 = peg$c120(s1, s7);
  25845. s4 = s5;
  25846. } else {
  25847. peg$currPos = s4;
  25848. s4 = peg$FAILED;
  25849. }
  25850. } else {
  25851. peg$currPos = s4;
  25852. s4 = peg$FAILED;
  25853. }
  25854. } else {
  25855. peg$currPos = s4;
  25856. s4 = peg$FAILED;
  25857. }
  25858. if (s4 !== peg$FAILED) {
  25859. while (s4 !== peg$FAILED) {
  25860. s3.push(s4);
  25861. s4 = peg$currPos;
  25862. s5 = peg$parsews();
  25863. if (s5 !== peg$FAILED) {
  25864. if (input.charCodeAt(peg$currPos) === 59) {
  25865. s6 = peg$c118;
  25866. peg$currPos++;
  25867. } else {
  25868. s6 = peg$FAILED;
  25869. if (peg$silentFails === 0) { peg$fail(peg$c119); }
  25870. }
  25871. if (s6 !== peg$FAILED) {
  25872. s7 = peg$parsewsMessage();
  25873. if (s7 !== peg$FAILED) {
  25874. peg$savedPos = s4;
  25875. s5 = peg$c120(s1, s7);
  25876. s4 = s5;
  25877. } else {
  25878. peg$currPos = s4;
  25879. s4 = peg$FAILED;
  25880. }
  25881. } else {
  25882. peg$currPos = s4;
  25883. s4 = peg$FAILED;
  25884. }
  25885. } else {
  25886. peg$currPos = s4;
  25887. s4 = peg$FAILED;
  25888. }
  25889. }
  25890. } else {
  25891. s3 = peg$FAILED;
  25892. }
  25893. if (s3 !== peg$FAILED) {
  25894. peg$savedPos = s0;
  25895. s1 = peg$c121(s1, s3);
  25896. s0 = s1;
  25897. } else {
  25898. peg$currPos = s0;
  25899. s0 = peg$FAILED;
  25900. }
  25901. } else {
  25902. peg$currPos = s0;
  25903. s0 = peg$FAILED;
  25904. }
  25905. } else {
  25906. peg$currPos = s0;
  25907. s0 = peg$FAILED;
  25908. }
  25909. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25910. return s0;
  25911. }
  25912. function peg$parsejsStatement() {
  25913. var s0, s1, s2, s3, s4;
  25914. var key = peg$currPos * 61 + 56,
  25915. cached = peg$resultsCache[key];
  25916. if (cached) {
  25917. peg$currPos = cached.nextPos;
  25918. return cached.result;
  25919. }
  25920. s0 = peg$currPos;
  25921. if (input.charCodeAt(peg$currPos) === 60) {
  25922. s1 = peg$c122;
  25923. peg$currPos++;
  25924. } else {
  25925. s1 = peg$FAILED;
  25926. if (peg$silentFails === 0) { peg$fail(peg$c123); }
  25927. }
  25928. if (s1 !== peg$FAILED) {
  25929. s2 = [];
  25930. s3 = peg$currPos;
  25931. if (input.substr(peg$currPos, 2) === peg$c124) {
  25932. s4 = peg$c124;
  25933. peg$currPos += 2;
  25934. } else {
  25935. s4 = peg$FAILED;
  25936. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  25937. }
  25938. if (s4 !== peg$FAILED) {
  25939. peg$savedPos = s3;
  25940. s4 = peg$c126();
  25941. }
  25942. s3 = s4;
  25943. if (s3 === peg$FAILED) {
  25944. if (peg$c127.test(input.charAt(peg$currPos))) {
  25945. s3 = input.charAt(peg$currPos);
  25946. peg$currPos++;
  25947. } else {
  25948. s3 = peg$FAILED;
  25949. if (peg$silentFails === 0) { peg$fail(peg$c128); }
  25950. }
  25951. }
  25952. while (s3 !== peg$FAILED) {
  25953. s2.push(s3);
  25954. s3 = peg$currPos;
  25955. if (input.substr(peg$currPos, 2) === peg$c124) {
  25956. s4 = peg$c124;
  25957. peg$currPos += 2;
  25958. } else {
  25959. s4 = peg$FAILED;
  25960. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  25961. }
  25962. if (s4 !== peg$FAILED) {
  25963. peg$savedPos = s3;
  25964. s4 = peg$c126();
  25965. }
  25966. s3 = s4;
  25967. if (s3 === peg$FAILED) {
  25968. if (peg$c127.test(input.charAt(peg$currPos))) {
  25969. s3 = input.charAt(peg$currPos);
  25970. peg$currPos++;
  25971. } else {
  25972. s3 = peg$FAILED;
  25973. if (peg$silentFails === 0) { peg$fail(peg$c128); }
  25974. }
  25975. }
  25976. }
  25977. if (s2 !== peg$FAILED) {
  25978. if (input.charCodeAt(peg$currPos) === 62) {
  25979. s3 = peg$c129;
  25980. peg$currPos++;
  25981. } else {
  25982. s3 = peg$FAILED;
  25983. if (peg$silentFails === 0) { peg$fail(peg$c130); }
  25984. }
  25985. if (s3 !== peg$FAILED) {
  25986. peg$savedPos = s0;
  25987. s1 = peg$c131(s2);
  25988. s0 = s1;
  25989. } else {
  25990. peg$currPos = s0;
  25991. s0 = peg$FAILED;
  25992. }
  25993. } else {
  25994. peg$currPos = s0;
  25995. s0 = peg$FAILED;
  25996. }
  25997. } else {
  25998. peg$currPos = s0;
  25999. s0 = peg$FAILED;
  26000. }
  26001. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26002. return s0;
  26003. }
  26004. function peg$parsemethod() {
  26005. var s0, s1, s2;
  26006. var key = peg$currPos * 61 + 57,
  26007. cached = peg$resultsCache[key];
  26008. if (cached) {
  26009. peg$currPos = cached.nextPos;
  26010. return cached.result;
  26011. }
  26012. s0 = peg$currPos;
  26013. s1 = peg$parsewsKeywordPattern();
  26014. if (s1 === peg$FAILED) {
  26015. s1 = peg$parsewsBinaryPattern();
  26016. if (s1 === peg$FAILED) {
  26017. s1 = peg$parsewsUnaryPattern();
  26018. }
  26019. }
  26020. if (s1 !== peg$FAILED) {
  26021. s2 = peg$parsewsSequenceWs();
  26022. if (s2 === peg$FAILED) {
  26023. s2 = null;
  26024. }
  26025. if (s2 !== peg$FAILED) {
  26026. peg$savedPos = s0;
  26027. s1 = peg$c132(s1, s2);
  26028. s0 = s1;
  26029. } else {
  26030. peg$currPos = s0;
  26031. s0 = peg$FAILED;
  26032. }
  26033. } else {
  26034. peg$currPos = s0;
  26035. s0 = peg$FAILED;
  26036. }
  26037. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26038. return s0;
  26039. }
  26040. function peg$parseassociationSend() {
  26041. var s0, s1, s2;
  26042. var key = peg$currPos * 61 + 58,
  26043. cached = peg$resultsCache[key];
  26044. if (cached) {
  26045. peg$currPos = cached.nextPos;
  26046. return cached.result;
  26047. }
  26048. s0 = peg$currPos;
  26049. s1 = peg$parsebinarySend();
  26050. if (s1 !== peg$FAILED) {
  26051. peg$savedPos = peg$currPos;
  26052. s2 = peg$c133(s1);
  26053. if (s2) {
  26054. s2 = void 0;
  26055. } else {
  26056. s2 = peg$FAILED;
  26057. }
  26058. if (s2 !== peg$FAILED) {
  26059. peg$savedPos = s0;
  26060. s1 = peg$c134(s1);
  26061. s0 = s1;
  26062. } else {
  26063. peg$currPos = s0;
  26064. s0 = peg$FAILED;
  26065. }
  26066. } else {
  26067. peg$currPos = s0;
  26068. s0 = peg$FAILED;
  26069. }
  26070. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26071. return s0;
  26072. }
  26073. function peg$parsewsAssociationsRest() {
  26074. var s0, s1, s2, s3, s4;
  26075. var key = peg$currPos * 61 + 59,
  26076. cached = peg$resultsCache[key];
  26077. if (cached) {
  26078. peg$currPos = cached.nextPos;
  26079. return cached.result;
  26080. }
  26081. s0 = peg$currPos;
  26082. s1 = peg$parsews();
  26083. if (s1 !== peg$FAILED) {
  26084. if (input.charCodeAt(peg$currPos) === 46) {
  26085. s2 = peg$c6;
  26086. peg$currPos++;
  26087. } else {
  26088. s2 = peg$FAILED;
  26089. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  26090. }
  26091. if (s2 !== peg$FAILED) {
  26092. s3 = peg$parsemaybeDotsWs();
  26093. if (s3 !== peg$FAILED) {
  26094. s4 = peg$parseassociationSend();
  26095. if (s4 !== peg$FAILED) {
  26096. peg$savedPos = s0;
  26097. s1 = peg$c87(s4);
  26098. s0 = s1;
  26099. } else {
  26100. peg$currPos = s0;
  26101. s0 = peg$FAILED;
  26102. }
  26103. } else {
  26104. peg$currPos = s0;
  26105. s0 = peg$FAILED;
  26106. }
  26107. } else {
  26108. peg$currPos = s0;
  26109. s0 = peg$FAILED;
  26110. }
  26111. } else {
  26112. peg$currPos = s0;
  26113. s0 = peg$FAILED;
  26114. }
  26115. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26116. return s0;
  26117. }
  26118. function peg$parseassociations() {
  26119. var s0, s1, s2, s3;
  26120. var key = peg$currPos * 61 + 60,
  26121. cached = peg$resultsCache[key];
  26122. if (cached) {
  26123. peg$currPos = cached.nextPos;
  26124. return cached.result;
  26125. }
  26126. s0 = peg$currPos;
  26127. s1 = peg$parseassociationSend();
  26128. if (s1 !== peg$FAILED) {
  26129. s2 = [];
  26130. s3 = peg$parsewsAssociationsRest();
  26131. while (s3 !== peg$FAILED) {
  26132. s2.push(s3);
  26133. s3 = peg$parsewsAssociationsRest();
  26134. }
  26135. if (s2 !== peg$FAILED) {
  26136. peg$savedPos = s0;
  26137. s1 = peg$c135(s1, s2);
  26138. s0 = s1;
  26139. } else {
  26140. peg$currPos = s0;
  26141. s0 = peg$FAILED;
  26142. }
  26143. } else {
  26144. peg$currPos = s0;
  26145. s0 = peg$FAILED;
  26146. }
  26147. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26148. return s0;
  26149. }
  26150. peg$result = peg$startRuleFunction();
  26151. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  26152. return peg$result;
  26153. } else {
  26154. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  26155. peg$fail({ type: "end", description: "end of input" });
  26156. }
  26157. throw peg$buildException(
  26158. null,
  26159. peg$maxFailExpected,
  26160. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  26161. peg$maxFailPos < input.length
  26162. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  26163. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  26164. );
  26165. }
  26166. }
  26167. return {
  26168. SyntaxError: peg$SyntaxError,
  26169. parse: peg$parse
  26170. };
  26171. })();
  26172. });
  26173. define("amber_core/Platform-ImportExport", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Platform-Services", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Classes"], function($boot){"use strict";
  26174. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  26175. $core.addPackage('Platform-ImportExport');
  26176. $core.packages["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
  26177. $core.packages["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  26178. $core.addClass('AbstractExporter', $globals.Object, [], 'Platform-ImportExport');
  26179. $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.";
  26180. $core.addMethod(
  26181. $core.method({
  26182. selector: "classNameFor:",
  26183. protocol: 'convenience',
  26184. fn: function (aClass){
  26185. var self=this;
  26186. return $core.withContext(function($ctx1) {
  26187. var $2,$3,$4,$1;
  26188. $2=$recv(aClass)._isMetaclass();
  26189. if($core.assert($2)){
  26190. $3=$recv($recv(aClass)._instanceClass())._name();
  26191. $ctx1.sendIdx["name"]=1;
  26192. $1=$recv($3).__comma(" class");
  26193. } else {
  26194. $4=$recv(aClass)._isNil();
  26195. if($core.assert($4)){
  26196. $1="nil";
  26197. } else {
  26198. $1=$recv(aClass)._name();
  26199. };
  26200. };
  26201. return $1;
  26202. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractExporter)});
  26203. },
  26204. args: ["aClass"],
  26205. 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 ] ]",
  26206. referencedClasses: [],
  26207. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"]
  26208. }),
  26209. $globals.AbstractExporter);
  26210. $core.addMethod(
  26211. $core.method({
  26212. selector: "exportPackage:on:",
  26213. protocol: 'output',
  26214. fn: function (aPackage,aStream){
  26215. var self=this;
  26216. return $core.withContext(function($ctx1) {
  26217. self._subclassResponsibility();
  26218. return self;
  26219. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  26220. },
  26221. args: ["aPackage", "aStream"],
  26222. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  26223. referencedClasses: [],
  26224. messageSends: ["subclassResponsibility"]
  26225. }),
  26226. $globals.AbstractExporter);
  26227. $core.addMethod(
  26228. $core.method({
  26229. selector: "extensionMethodsOfPackage:",
  26230. protocol: 'accessing',
  26231. fn: function (aPackage){
  26232. var self=this;
  26233. var result;
  26234. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  26235. return $core.withContext(function($ctx1) {
  26236. result=$recv($OrderedCollection())._new();
  26237. $recv(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  26238. return $core.withContext(function($ctx2) {
  26239. return $recv(result)._addAll_($recv(each)._methods());
  26240. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26241. }));
  26242. return result;
  26243. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  26244. },
  26245. args: ["aPackage"],
  26246. 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",
  26247. referencedClasses: ["OrderedCollection"],
  26248. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "methods"]
  26249. }),
  26250. $globals.AbstractExporter);
  26251. $core.addMethod(
  26252. $core.method({
  26253. selector: "extensionProtocolsOfPackage:",
  26254. protocol: 'accessing',
  26255. fn: function (aPackage){
  26256. var self=this;
  26257. var extensionName,result;
  26258. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  26259. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  26260. function $ExportMethodProtocol(){return $globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  26261. return $core.withContext(function($ctx1) {
  26262. var $1,$2,$3;
  26263. $1=$recv(aPackage)._name();
  26264. $ctx1.sendIdx["name"]=1;
  26265. extensionName="*".__comma($1);
  26266. result=$recv($OrderedCollection())._new();
  26267. $recv($recv($recv($recv($Smalltalk())._classes())._asArray())._sorted_((function(a,b){
  26268. return $core.withContext(function($ctx2) {
  26269. $2=$recv(a)._name();
  26270. $ctx2.sendIdx["name"]=2;
  26271. return $recv($2).__lt($recv(b)._name());
  26272. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  26273. })))._do_((function(each){
  26274. return $core.withContext(function($ctx2) {
  26275. return $recv([each,$recv(each)._class()])._do_((function(behavior){
  26276. return $core.withContext(function($ctx3) {
  26277. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  26278. if($core.assert($3)){
  26279. return $recv(result)._add_($recv($ExportMethodProtocol())._name_theClass_(extensionName,behavior));
  26280. };
  26281. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  26282. }));
  26283. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  26284. }));
  26285. $ctx1.sendIdx["do:"]=1;
  26286. return result;
  26287. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  26288. },
  26289. args: ["aPackage"],
  26290. 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",
  26291. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  26292. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "class", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  26293. }),
  26294. $globals.AbstractExporter);
  26295. $core.addClass('ChunkExporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
  26296. $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.";
  26297. $core.addMethod(
  26298. $core.method({
  26299. selector: "chunkEscape:",
  26300. protocol: 'convenience',
  26301. fn: function (aString){
  26302. var self=this;
  26303. return $core.withContext(function($ctx1) {
  26304. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  26305. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  26306. },
  26307. args: ["aString"],
  26308. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  26309. referencedClasses: [],
  26310. messageSends: ["trimBoth", "replace:with:"]
  26311. }),
  26312. $globals.ChunkExporter);
  26313. $core.addMethod(
  26314. $core.method({
  26315. selector: "exportCategoryEpilogueOf:on:",
  26316. protocol: 'output',
  26317. fn: function (aCategory,aStream){
  26318. var self=this;
  26319. return $core.withContext(function($ctx1) {
  26320. $recv(aStream)._nextPutAll_(" !");
  26321. $recv(aStream)._lf();
  26322. $ctx1.sendIdx["lf"]=1;
  26323. $recv(aStream)._lf();
  26324. return self;
  26325. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  26326. },
  26327. args: ["aCategory", "aStream"],
  26328. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  26329. referencedClasses: [],
  26330. messageSends: ["nextPutAll:", "lf"]
  26331. }),
  26332. $globals.ChunkExporter);
  26333. $core.addMethod(
  26334. $core.method({
  26335. selector: "exportCategoryPrologueOf:on:",
  26336. protocol: 'output',
  26337. fn: function (aCategory,aStream){
  26338. var self=this;
  26339. return $core.withContext(function($ctx1) {
  26340. var $1,$2;
  26341. $1="!".__comma(self._classNameFor_($recv(aCategory)._theClass()));
  26342. $ctx1.sendIdx[","]=1;
  26343. $recv(aStream)._nextPutAll_($1);
  26344. $ctx1.sendIdx["nextPutAll:"]=1;
  26345. $2=$recv(" methodsFor: '".__comma($recv(aCategory)._name())).__comma("'!");
  26346. $ctx1.sendIdx[","]=2;
  26347. $recv(aStream)._nextPutAll_($2);
  26348. return self;
  26349. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  26350. },
  26351. args: ["aCategory", "aStream"],
  26352. source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aCategory theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aCategory name, '''!'",
  26353. referencedClasses: [],
  26354. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  26355. }),
  26356. $globals.ChunkExporter);
  26357. $core.addMethod(
  26358. $core.method({
  26359. selector: "exportDefinitionOf:on:",
  26360. protocol: 'output',
  26361. fn: function (aClass,aStream){
  26362. var self=this;
  26363. return $core.withContext(function($ctx1) {
  26364. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$11,$10,$12;
  26365. $1=self._classNameFor_($recv(aClass)._superclass());
  26366. $ctx1.sendIdx["classNameFor:"]=1;
  26367. $recv(aStream)._nextPutAll_($1);
  26368. $ctx1.sendIdx["nextPutAll:"]=1;
  26369. $3=self._classNameFor_(aClass);
  26370. $ctx1.sendIdx["classNameFor:"]=2;
  26371. $2=" subclass: #".__comma($3);
  26372. $ctx1.sendIdx[","]=1;
  26373. $recv(aStream)._nextPutAll_($2);
  26374. $ctx1.sendIdx["nextPutAll:"]=2;
  26375. $recv(aStream)._lf();
  26376. $ctx1.sendIdx["lf"]=1;
  26377. $recv(aStream)._tab();
  26378. $ctx1.sendIdx["tab"]=1;
  26379. $4=$recv(aStream)._nextPutAll_("instanceVariableNames: '");
  26380. $ctx1.sendIdx["nextPutAll:"]=3;
  26381. $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  26382. return $core.withContext(function($ctx2) {
  26383. return $recv(aStream)._nextPutAll_(each);
  26384. $ctx2.sendIdx["nextPutAll:"]=4;
  26385. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26386. }),(function(){
  26387. return $core.withContext(function($ctx2) {
  26388. return $recv(aStream)._nextPutAll_(" ");
  26389. $ctx2.sendIdx["nextPutAll:"]=5;
  26390. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  26391. }));
  26392. $recv(aStream)._nextPutAll_("'");
  26393. $ctx1.sendIdx["nextPutAll:"]=6;
  26394. $recv(aStream)._lf();
  26395. $ctx1.sendIdx["lf"]=2;
  26396. $recv(aStream)._tab();
  26397. $6="package: '".__comma($recv(aClass)._category());
  26398. $ctx1.sendIdx[","]=3;
  26399. $5=$recv($6).__comma("'!");
  26400. $ctx1.sendIdx[","]=2;
  26401. $recv(aStream)._nextPutAll_($5);
  26402. $ctx1.sendIdx["nextPutAll:"]=7;
  26403. $7=$recv(aStream)._lf();
  26404. $ctx1.sendIdx["lf"]=3;
  26405. $9=$recv(aClass)._comment();
  26406. $ctx1.sendIdx["comment"]=1;
  26407. $8=$recv($9)._notEmpty();
  26408. if($core.assert($8)){
  26409. $11="!".__comma(self._classNameFor_(aClass));
  26410. $ctx1.sendIdx[","]=5;
  26411. $10=$recv($11).__comma(" commentStamp!");
  26412. $ctx1.sendIdx[","]=4;
  26413. $recv(aStream)._nextPutAll_($10);
  26414. $ctx1.sendIdx["nextPutAll:"]=8;
  26415. $recv(aStream)._lf();
  26416. $ctx1.sendIdx["lf"]=4;
  26417. $recv(aStream)._nextPutAll_($recv(self._chunkEscape_($recv(aClass)._comment())).__comma("!"));
  26418. $12=$recv(aStream)._lf();
  26419. $ctx1.sendIdx["lf"]=5;
  26420. $12;
  26421. };
  26422. $recv(aStream)._lf();
  26423. return self;
  26424. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  26425. },
  26426. args: ["aClass", "aStream"],
  26427. 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",
  26428. referencedClasses: [],
  26429. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "chunkEscape:"]
  26430. }),
  26431. $globals.ChunkExporter);
  26432. $core.addMethod(
  26433. $core.method({
  26434. selector: "exportMetaDefinitionOf:on:",
  26435. protocol: 'output',
  26436. fn: function (aClass,aStream){
  26437. var self=this;
  26438. return $core.withContext(function($ctx1) {
  26439. var $3,$2,$1,$5,$4,$6;
  26440. $3=$recv(aClass)._class();
  26441. $ctx1.sendIdx["class"]=1;
  26442. $2=$recv($3)._instanceVariableNames();
  26443. $ctx1.sendIdx["instanceVariableNames"]=1;
  26444. $1=$recv($2)._isEmpty();
  26445. if(!$core.assert($1)){
  26446. $5=$recv(aClass)._class();
  26447. $ctx1.sendIdx["class"]=2;
  26448. $4=self._classNameFor_($5);
  26449. $recv(aStream)._nextPutAll_($4);
  26450. $ctx1.sendIdx["nextPutAll:"]=1;
  26451. $6=$recv(aStream)._nextPutAll_(" instanceVariableNames: '");
  26452. $ctx1.sendIdx["nextPutAll:"]=2;
  26453. $6;
  26454. $recv($recv($recv(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  26455. return $core.withContext(function($ctx2) {
  26456. return $recv(aStream)._nextPutAll_(each);
  26457. $ctx2.sendIdx["nextPutAll:"]=3;
  26458. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  26459. }),(function(){
  26460. return $core.withContext(function($ctx2) {
  26461. return $recv(aStream)._nextPutAll_(" ");
  26462. $ctx2.sendIdx["nextPutAll:"]=4;
  26463. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  26464. }));
  26465. $recv(aStream)._nextPutAll_("'!");
  26466. $recv(aStream)._lf();
  26467. $ctx1.sendIdx["lf"]=1;
  26468. $recv(aStream)._lf();
  26469. };
  26470. return self;
  26471. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  26472. },
  26473. args: ["aClass", "aStream"],
  26474. 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 ]",
  26475. referencedClasses: [],
  26476. messageSends: ["ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "classNameFor:", "do:separatedBy:", "lf"]
  26477. }),
  26478. $globals.ChunkExporter);
  26479. $core.addMethod(
  26480. $core.method({
  26481. selector: "exportMethod:on:",
  26482. protocol: 'output',
  26483. fn: function (aMethod,aStream){
  26484. var self=this;
  26485. return $core.withContext(function($ctx1) {
  26486. $recv(aStream)._lf();
  26487. $ctx1.sendIdx["lf"]=1;
  26488. $recv(aStream)._lf();
  26489. $ctx1.sendIdx["lf"]=2;
  26490. $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aMethod)._source()));
  26491. $ctx1.sendIdx["nextPutAll:"]=1;
  26492. $recv(aStream)._lf();
  26493. $recv(aStream)._nextPutAll_("!");
  26494. return self;
  26495. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  26496. },
  26497. args: ["aMethod", "aStream"],
  26498. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
  26499. referencedClasses: [],
  26500. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"]
  26501. }),
  26502. $globals.ChunkExporter);
  26503. $core.addMethod(
  26504. $core.method({
  26505. selector: "exportPackage:on:",
  26506. protocol: 'output',
  26507. fn: function (aPackage,aStream){
  26508. var self=this;
  26509. return $core.withContext(function($ctx1) {
  26510. var $1;
  26511. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  26512. self._exportPackageImportsOf_on_(aPackage,aStream);
  26513. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  26514. return $core.withContext(function($ctx2) {
  26515. self._exportDefinitionOf_on_(each,aStream);
  26516. $1=self._ownMethodProtocolsOfClass_(each);
  26517. $ctx2.sendIdx["ownMethodProtocolsOfClass:"]=1;
  26518. self._exportProtocols_on_($1,aStream);
  26519. $ctx2.sendIdx["exportProtocols:on:"]=1;
  26520. self._exportMetaDefinitionOf_on_(each,aStream);
  26521. return self._exportProtocols_on_(self._ownMethodProtocolsOfClass_($recv(each)._class()),aStream);
  26522. $ctx2.sendIdx["exportProtocols:on:"]=2;
  26523. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26524. }));
  26525. self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream);
  26526. return self;
  26527. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  26528. },
  26529. args: ["aPackage", "aStream"],
  26530. 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",
  26531. referencedClasses: [],
  26532. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "exportProtocols:on:", "ownMethodProtocolsOfClass:", "exportMetaDefinitionOf:on:", "class", "extensionProtocolsOfPackage:"]
  26533. }),
  26534. $globals.ChunkExporter);
  26535. $core.addMethod(
  26536. $core.method({
  26537. selector: "exportPackageDefinitionOf:on:",
  26538. protocol: 'output',
  26539. fn: function (aPackage,aStream){
  26540. var self=this;
  26541. return $core.withContext(function($ctx1) {
  26542. var $1;
  26543. $1=$recv("Smalltalk createPackage: '".__comma($recv(aPackage)._name())).__comma("'!");
  26544. $ctx1.sendIdx[","]=1;
  26545. $recv(aStream)._nextPutAll_($1);
  26546. $recv(aStream)._lf();
  26547. return self;
  26548. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  26549. },
  26550. args: ["aPackage", "aStream"],
  26551. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf",
  26552. referencedClasses: [],
  26553. messageSends: ["nextPutAll:", ",", "name", "lf"]
  26554. }),
  26555. $globals.ChunkExporter);
  26556. $core.addMethod(
  26557. $core.method({
  26558. selector: "exportPackageImportsOf:on:",
  26559. protocol: 'output',
  26560. fn: function (aPackage,aStream){
  26561. var self=this;
  26562. return $core.withContext(function($ctx1) {
  26563. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  26564. return $core.withContext(function($ctx2) {
  26565. $recv(aStream)._nextPutAll_("(Smalltalk packageAt: '");
  26566. $ctx2.sendIdx["nextPutAll:"]=1;
  26567. $recv(aStream)._nextPutAll_($recv(aPackage)._name());
  26568. $ctx2.sendIdx["nextPutAll:"]=2;
  26569. $recv(aStream)._nextPutAll_("') imports: ");
  26570. $ctx2.sendIdx["nextPutAll:"]=3;
  26571. $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aPackage)._importsDefinition()));
  26572. $ctx2.sendIdx["nextPutAll:"]=4;
  26573. $recv(aStream)._nextPutAll_("!");
  26574. return $recv(aStream)._lf();
  26575. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  26576. }));
  26577. return self;
  26578. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  26579. },
  26580. args: ["aPackage", "aStream"],
  26581. 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 ]",
  26582. referencedClasses: [],
  26583. messageSends: ["ifNotEmpty:", "imports", "nextPutAll:", "name", "chunkEscape:", "importsDefinition", "lf"]
  26584. }),
  26585. $globals.ChunkExporter);
  26586. $core.addMethod(
  26587. $core.method({
  26588. selector: "exportProtocol:on:",
  26589. protocol: 'output',
  26590. fn: function (aProtocol,aStream){
  26591. var self=this;
  26592. return $core.withContext(function($ctx1) {
  26593. self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  26594. $recv($recv(aProtocol)._methods())._do_((function(method){
  26595. return $core.withContext(function($ctx2) {
  26596. return self._exportMethod_on_(method,aStream);
  26597. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  26598. }));
  26599. self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  26600. return self;
  26601. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  26602. },
  26603. args: ["aProtocol", "aStream"],
  26604. 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",
  26605. referencedClasses: [],
  26606. messageSends: ["exportProtocolPrologueOf:on:", "do:", "methods", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  26607. }),
  26608. $globals.ChunkExporter);
  26609. $core.addMethod(
  26610. $core.method({
  26611. selector: "exportProtocolEpilogueOf:on:",
  26612. protocol: 'output',
  26613. fn: function (aProtocol,aStream){
  26614. var self=this;
  26615. return $core.withContext(function($ctx1) {
  26616. $recv(aStream)._nextPutAll_(" !");
  26617. $recv(aStream)._lf();
  26618. $ctx1.sendIdx["lf"]=1;
  26619. $recv(aStream)._lf();
  26620. return self;
  26621. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  26622. },
  26623. args: ["aProtocol", "aStream"],
  26624. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  26625. referencedClasses: [],
  26626. messageSends: ["nextPutAll:", "lf"]
  26627. }),
  26628. $globals.ChunkExporter);
  26629. $core.addMethod(
  26630. $core.method({
  26631. selector: "exportProtocolPrologueOf:on:",
  26632. protocol: 'output',
  26633. fn: function (aProtocol,aStream){
  26634. var self=this;
  26635. return $core.withContext(function($ctx1) {
  26636. var $1,$2;
  26637. $1="!".__comma(self._classNameFor_($recv(aProtocol)._theClass()));
  26638. $ctx1.sendIdx[","]=1;
  26639. $recv(aStream)._nextPutAll_($1);
  26640. $ctx1.sendIdx["nextPutAll:"]=1;
  26641. $2=$recv(" methodsFor: '".__comma($recv(aProtocol)._name())).__comma("'!");
  26642. $ctx1.sendIdx[","]=2;
  26643. $recv(aStream)._nextPutAll_($2);
  26644. return self;
  26645. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  26646. },
  26647. args: ["aProtocol", "aStream"],
  26648. source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aProtocol theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aProtocol name, '''!'",
  26649. referencedClasses: [],
  26650. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  26651. }),
  26652. $globals.ChunkExporter);
  26653. $core.addMethod(
  26654. $core.method({
  26655. selector: "exportProtocols:on:",
  26656. protocol: 'output',
  26657. fn: function (aCollection,aStream){
  26658. var self=this;
  26659. return $core.withContext(function($ctx1) {
  26660. $recv(aCollection)._do_((function(each){
  26661. return $core.withContext(function($ctx2) {
  26662. return self._exportProtocol_on_(each,aStream);
  26663. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26664. }));
  26665. return self;
  26666. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  26667. },
  26668. args: ["aCollection", "aStream"],
  26669. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  26670. referencedClasses: [],
  26671. messageSends: ["do:", "exportProtocol:on:"]
  26672. }),
  26673. $globals.ChunkExporter);
  26674. $core.addMethod(
  26675. $core.method({
  26676. selector: "extensionCategoriesOfPackage:",
  26677. protocol: 'accessing',
  26678. fn: function (aPackage){
  26679. var self=this;
  26680. var name,map,result;
  26681. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  26682. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  26683. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  26684. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  26685. function $MethodCategory(){return $globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  26686. return $core.withContext(function($ctx1) {
  26687. var $1;
  26688. name=$recv(aPackage)._name();
  26689. result=$recv($OrderedCollection())._new();
  26690. $ctx1.sendIdx["new"]=1;
  26691. $recv($recv($Package())._sortedClasses_($recv($Smalltalk())._classes()))._do_((function(each){
  26692. return $core.withContext(function($ctx2) {
  26693. return $recv([each,$recv(each)._class()])._do_((function(aClass){
  26694. return $core.withContext(function($ctx3) {
  26695. map=$recv($Dictionary())._new();
  26696. map;
  26697. $recv(aClass)._protocolsDo_((function(category,methods){
  26698. return $core.withContext(function($ctx4) {
  26699. $1=$recv(category).__eq("*".__comma(name));
  26700. if($core.assert($1)){
  26701. return $recv(map)._at_put_(category,methods);
  26702. };
  26703. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  26704. }));
  26705. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  26706. return $core.withContext(function($ctx4) {
  26707. return $recv(a).__lt_eq(b);
  26708. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  26709. })))._collect_((function(category){
  26710. return $core.withContext(function($ctx4) {
  26711. return $recv($MethodCategory())._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  26712. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  26713. })));
  26714. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  26715. }));
  26716. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26717. }));
  26718. $ctx1.sendIdx["do:"]=1;
  26719. return result;
  26720. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  26721. },
  26722. args: ["aPackage"],
  26723. 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",
  26724. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  26725. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "class", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  26726. }),
  26727. $globals.ChunkExporter);
  26728. $core.addMethod(
  26729. $core.method({
  26730. selector: "ownCategoriesOfClass:",
  26731. protocol: 'accessing',
  26732. fn: function (aClass){
  26733. var self=this;
  26734. var map;
  26735. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  26736. function $MethodCategory(){return $globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  26737. return $core.withContext(function($ctx1) {
  26738. var $1;
  26739. map=$recv($Dictionary())._new();
  26740. $recv(aClass)._protocolsDo_((function(each,methods){
  26741. return $core.withContext(function($ctx2) {
  26742. $1=$recv(each)._match_("^\x5c*");
  26743. if(!$core.assert($1)){
  26744. return $recv(map)._at_put_(each,methods);
  26745. };
  26746. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  26747. }));
  26748. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  26749. return $core.withContext(function($ctx2) {
  26750. return $recv(a).__lt_eq(b);
  26751. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  26752. })))._collect_((function(each){
  26753. return $core.withContext(function($ctx2) {
  26754. return $recv($MethodCategory())._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  26755. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  26756. }));
  26757. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  26758. },
  26759. args: ["aClass"],
  26760. 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) ]",
  26761. referencedClasses: ["Dictionary", "MethodCategory"],
  26762. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  26763. }),
  26764. $globals.ChunkExporter);
  26765. $core.addMethod(
  26766. $core.method({
  26767. selector: "ownCategoriesOfMetaClass:",
  26768. protocol: 'accessing',
  26769. fn: function (aClass){
  26770. var self=this;
  26771. return $core.withContext(function($ctx1) {
  26772. return self._ownCategoriesOfClass_($recv(aClass)._class());
  26773. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  26774. },
  26775. args: ["aClass"],
  26776. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass class",
  26777. referencedClasses: [],
  26778. messageSends: ["ownCategoriesOfClass:", "class"]
  26779. }),
  26780. $globals.ChunkExporter);
  26781. $core.addMethod(
  26782. $core.method({
  26783. selector: "ownMethodProtocolsOfClass:",
  26784. protocol: 'accessing',
  26785. fn: function (aClass){
  26786. var self=this;
  26787. function $ExportMethodProtocol(){return $globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  26788. return $core.withContext(function($ctx1) {
  26789. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  26790. return $core.withContext(function($ctx2) {
  26791. return $recv($ExportMethodProtocol())._name_theClass_(each,aClass);
  26792. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26793. }));
  26794. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  26795. },
  26796. args: ["aClass"],
  26797. 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 ]",
  26798. referencedClasses: ["ExportMethodProtocol"],
  26799. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  26800. }),
  26801. $globals.ChunkExporter);
  26802. $core.addClass('Exporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
  26803. $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.).";
  26804. $core.addMethod(
  26805. $core.method({
  26806. selector: "exportDefinitionOf:on:",
  26807. protocol: 'output',
  26808. fn: function (aClass,aStream){
  26809. var self=this;
  26810. return $core.withContext(function($ctx1) {
  26811. var $2,$1,$3,$4,$6,$5,$7,$9,$8;
  26812. $recv(aStream)._lf();
  26813. $ctx1.sendIdx["lf"]=1;
  26814. $recv(aStream)._nextPutAll_("$core.addClass(");
  26815. $ctx1.sendIdx["nextPutAll:"]=1;
  26816. $2="'".__comma(self._classNameFor_(aClass));
  26817. $ctx1.sendIdx[","]=2;
  26818. $1=$recv($2).__comma("', ");
  26819. $ctx1.sendIdx[","]=1;
  26820. $recv(aStream)._nextPutAll_($1);
  26821. $ctx1.sendIdx["nextPutAll:"]=2;
  26822. $3=self._jsClassNameFor_($recv(aClass)._superclass());
  26823. $ctx1.sendIdx["jsClassNameFor:"]=1;
  26824. $recv(aStream)._nextPutAll_($3);
  26825. $ctx1.sendIdx["nextPutAll:"]=3;
  26826. $4=$recv(aStream)._nextPutAll_(", [");
  26827. $ctx1.sendIdx["nextPutAll:"]=4;
  26828. $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  26829. return $core.withContext(function($ctx2) {
  26830. $6="'".__comma(each);
  26831. $ctx2.sendIdx[","]=4;
  26832. $5=$recv($6).__comma("'");
  26833. $ctx2.sendIdx[","]=3;
  26834. return $recv(aStream)._nextPutAll_($5);
  26835. $ctx2.sendIdx["nextPutAll:"]=5;
  26836. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26837. }),(function(){
  26838. return $core.withContext(function($ctx2) {
  26839. return $recv(aStream)._nextPutAll_(", ");
  26840. $ctx2.sendIdx["nextPutAll:"]=6;
  26841. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  26842. }));
  26843. $recv(aStream)._nextPutAll_("], '");
  26844. $ctx1.sendIdx["nextPutAll:"]=7;
  26845. $recv(aStream)._nextPutAll_($recv($recv(aClass)._category()).__comma("'"));
  26846. $ctx1.sendIdx["nextPutAll:"]=8;
  26847. $7=$recv(aStream)._nextPutAll_(");");
  26848. $ctx1.sendIdx["nextPutAll:"]=9;
  26849. $9=$recv(aClass)._comment();
  26850. $ctx1.sendIdx["comment"]=1;
  26851. $8=$recv($9)._notEmpty();
  26852. if($core.assert($8)){
  26853. $recv(aStream)._lf();
  26854. $ctx1.sendIdx["lf"]=2;
  26855. $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  26856. $ctx1.sendIdx["nextPutAll:"]=10;
  26857. $recv(aStream)._lf();
  26858. $ctx1.sendIdx["lf"]=3;
  26859. $recv(aStream)._nextPutAll_(self._jsClassNameFor_(aClass));
  26860. $ctx1.sendIdx["nextPutAll:"]=11;
  26861. $recv(aStream)._nextPutAll_(".comment=");
  26862. $ctx1.sendIdx["nextPutAll:"]=12;
  26863. $recv(aStream)._nextPutAll_($recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavascript());
  26864. $ctx1.sendIdx["nextPutAll:"]=13;
  26865. $recv(aStream)._nextPutAll_(";");
  26866. $ctx1.sendIdx["nextPutAll:"]=14;
  26867. $recv(aStream)._lf();
  26868. $ctx1.sendIdx["lf"]=4;
  26869. $recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  26870. };
  26871. $recv(aStream)._lf();
  26872. return self;
  26873. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  26874. },
  26875. args: ["aClass", "aStream"],
  26876. 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",
  26877. referencedClasses: [],
  26878. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "jsClassNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "asJavascript", "crlfSanitized"]
  26879. }),
  26880. $globals.Exporter);
  26881. $core.addMethod(
  26882. $core.method({
  26883. selector: "exportMetaDefinitionOf:on:",
  26884. protocol: 'output',
  26885. fn: function (aClass,aStream){
  26886. var self=this;
  26887. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  26888. return $core.withContext(function($ctx1) {
  26889. var $3,$2,$1,$5,$4,$6,$8,$7;
  26890. $recv(aStream)._lf();
  26891. $ctx1.sendIdx["lf"]=1;
  26892. $3=$recv(aClass)._class();
  26893. $ctx1.sendIdx["class"]=1;
  26894. $2=$recv($3)._instanceVariableNames();
  26895. $ctx1.sendIdx["instanceVariableNames"]=1;
  26896. $1=$recv($2)._isEmpty();
  26897. if(!$core.assert($1)){
  26898. $5=$recv(aClass)._class();
  26899. $ctx1.sendIdx["class"]=2;
  26900. $4=self._jsClassNameFor_($5);
  26901. $recv(aStream)._nextPutAll_($4);
  26902. $ctx1.sendIdx["nextPutAll:"]=1;
  26903. $6=$recv(aStream)._nextPutAll_(".iVarNames = [");
  26904. $ctx1.sendIdx["nextPutAll:"]=2;
  26905. $6;
  26906. $recv($recv($recv(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  26907. return $core.withContext(function($ctx2) {
  26908. $8="'".__comma(each);
  26909. $ctx2.sendIdx[","]=2;
  26910. $7=$recv($8).__comma("'");
  26911. $ctx2.sendIdx[","]=1;
  26912. return $recv(aStream)._nextPutAll_($7);
  26913. $ctx2.sendIdx["nextPutAll:"]=3;
  26914. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  26915. }),(function(){
  26916. return $core.withContext(function($ctx2) {
  26917. return $recv(aStream)._nextPutAll_(",");
  26918. $ctx2.sendIdx["nextPutAll:"]=4;
  26919. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  26920. }));
  26921. $recv(aStream)._nextPutAll_("];".__comma($recv($String())._lf()));
  26922. };
  26923. return self;
  26924. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  26925. },
  26926. args: ["aClass", "aStream"],
  26927. 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 ]",
  26928. referencedClasses: ["String"],
  26929. messageSends: ["lf", "ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "jsClassNameFor:", "do:separatedBy:", ","]
  26930. }),
  26931. $globals.Exporter);
  26932. $core.addMethod(
  26933. $core.method({
  26934. selector: "exportMethod:on:",
  26935. protocol: 'output',
  26936. fn: function (aMethod,aStream){
  26937. var self=this;
  26938. return $core.withContext(function($ctx1) {
  26939. var $3,$2,$1,$5,$4,$7,$6,$10,$9,$8,$13,$12,$11,$16,$15,$14;
  26940. $recv(aStream)._nextPutAll_("$core.addMethod(");
  26941. $ctx1.sendIdx["nextPutAll:"]=1;
  26942. $recv(aStream)._lf();
  26943. $ctx1.sendIdx["lf"]=1;
  26944. $recv(aStream)._nextPutAll_("$core.method({");
  26945. $ctx1.sendIdx["nextPutAll:"]=2;
  26946. $recv(aStream)._lf();
  26947. $ctx1.sendIdx["lf"]=2;
  26948. $3=$recv($recv(aMethod)._selector())._asJavascript();
  26949. $ctx1.sendIdx["asJavascript"]=1;
  26950. $2="selector: ".__comma($3);
  26951. $ctx1.sendIdx[","]=2;
  26952. $1=$recv($2).__comma(",");
  26953. $ctx1.sendIdx[","]=1;
  26954. $recv(aStream)._nextPutAll_($1);
  26955. $ctx1.sendIdx["nextPutAll:"]=3;
  26956. $recv(aStream)._lf();
  26957. $ctx1.sendIdx["lf"]=3;
  26958. $5="protocol: '".__comma($recv(aMethod)._protocol());
  26959. $ctx1.sendIdx[","]=4;
  26960. $4=$recv($5).__comma("',");
  26961. $ctx1.sendIdx[","]=3;
  26962. $recv(aStream)._nextPutAll_($4);
  26963. $ctx1.sendIdx["nextPutAll:"]=4;
  26964. $recv(aStream)._lf();
  26965. $ctx1.sendIdx["lf"]=4;
  26966. $7="fn: ".__comma($recv($recv(aMethod)._fn())._compiledSource());
  26967. $ctx1.sendIdx[","]=6;
  26968. $6=$recv($7).__comma(",");
  26969. $ctx1.sendIdx[","]=5;
  26970. $recv(aStream)._nextPutAll_($6);
  26971. $ctx1.sendIdx["nextPutAll:"]=5;
  26972. $recv(aStream)._lf();
  26973. $ctx1.sendIdx["lf"]=5;
  26974. $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  26975. $ctx1.sendIdx["nextPutAll:"]=6;
  26976. $recv(aStream)._lf();
  26977. $ctx1.sendIdx["lf"]=6;
  26978. $10=$recv($recv(aMethod)._arguments())._asJavascript();
  26979. $ctx1.sendIdx["asJavascript"]=2;
  26980. $9="args: ".__comma($10);
  26981. $ctx1.sendIdx[","]=8;
  26982. $8=$recv($9).__comma(",");
  26983. $ctx1.sendIdx[","]=7;
  26984. $recv(aStream)._nextPutAll_($8);
  26985. $ctx1.sendIdx["nextPutAll:"]=7;
  26986. $recv(aStream)._lf();
  26987. $ctx1.sendIdx["lf"]=7;
  26988. $13=$recv($recv(aMethod)._source())._asJavascript();
  26989. $ctx1.sendIdx["asJavascript"]=3;
  26990. $12="source: ".__comma($13);
  26991. $ctx1.sendIdx[","]=10;
  26992. $11=$recv($12).__comma(",");
  26993. $ctx1.sendIdx[","]=9;
  26994. $recv(aStream)._nextPutAll_($11);
  26995. $ctx1.sendIdx["nextPutAll:"]=8;
  26996. $recv(aStream)._lf();
  26997. $ctx1.sendIdx["lf"]=8;
  26998. $16=$recv($recv(aMethod)._referencedClasses())._asJavascript();
  26999. $ctx1.sendIdx["asJavascript"]=4;
  27000. $15="referencedClasses: ".__comma($16);
  27001. $ctx1.sendIdx[","]=12;
  27002. $14=$recv($15).__comma(",");
  27003. $ctx1.sendIdx[","]=11;
  27004. $recv(aStream)._nextPutAll_($14);
  27005. $ctx1.sendIdx["nextPutAll:"]=9;
  27006. $recv(aStream)._lf();
  27007. $ctx1.sendIdx["lf"]=9;
  27008. $recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  27009. $ctx1.sendIdx["nextPutAll:"]=10;
  27010. $recv(aStream)._lf();
  27011. $ctx1.sendIdx["lf"]=10;
  27012. $recv(aStream)._nextPutAll_("messageSends: ".__comma($recv($recv(aMethod)._messageSends())._asJavascript()));
  27013. $ctx1.sendIdx["nextPutAll:"]=11;
  27014. $recv(aStream)._lf();
  27015. $ctx1.sendIdx["lf"]=11;
  27016. $recv(aStream)._nextPutAll_("}),");
  27017. $ctx1.sendIdx["nextPutAll:"]=12;
  27018. $recv(aStream)._lf();
  27019. $ctx1.sendIdx["lf"]=12;
  27020. $recv(aStream)._nextPutAll_(self._jsClassNameFor_($recv(aMethod)._methodClass()));
  27021. $ctx1.sendIdx["nextPutAll:"]=13;
  27022. $recv(aStream)._nextPutAll_(");");
  27023. $recv(aStream)._lf();
  27024. $ctx1.sendIdx["lf"]=13;
  27025. $recv(aStream)._lf();
  27026. return self;
  27027. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  27028. },
  27029. args: ["aMethod", "aStream"],
  27030. 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",
  27031. referencedClasses: [],
  27032. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "jsClassNameFor:", "methodClass"]
  27033. }),
  27034. $globals.Exporter);
  27035. $core.addMethod(
  27036. $core.method({
  27037. selector: "exportPackage:on:",
  27038. protocol: 'output',
  27039. fn: function (aPackage,aStream){
  27040. var self=this;
  27041. return $core.withContext(function($ctx1) {
  27042. var $1;
  27043. self._exportPackagePrologueOf_on_(aPackage,aStream);
  27044. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  27045. self._exportPackageContextOf_on_(aPackage,aStream);
  27046. self._exportPackageImportsOf_on_(aPackage,aStream);
  27047. self._exportPackageTransportOf_on_(aPackage,aStream);
  27048. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  27049. return $core.withContext(function($ctx2) {
  27050. self._exportDefinitionOf_on_(each,aStream);
  27051. $1=$recv(each)._ownMethods();
  27052. $ctx2.sendIdx["ownMethods"]=1;
  27053. $recv($1)._do_((function(method){
  27054. return $core.withContext(function($ctx3) {
  27055. return self._exportMethod_on_(method,aStream);
  27056. $ctx3.sendIdx["exportMethod:on:"]=1;
  27057. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  27058. }));
  27059. $ctx2.sendIdx["do:"]=2;
  27060. self._exportMetaDefinitionOf_on_(each,aStream);
  27061. return $recv($recv($recv(each)._class())._ownMethods())._do_((function(method){
  27062. return $core.withContext(function($ctx3) {
  27063. return self._exportMethod_on_(method,aStream);
  27064. $ctx3.sendIdx["exportMethod:on:"]=2;
  27065. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,3)});
  27066. }));
  27067. $ctx2.sendIdx["do:"]=3;
  27068. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27069. }));
  27070. $ctx1.sendIdx["do:"]=1;
  27071. $recv(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  27072. return $core.withContext(function($ctx2) {
  27073. return self._exportMethod_on_(each,aStream);
  27074. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  27075. }));
  27076. self._exportPackageEpilogueOf_on_(aPackage,aStream);
  27077. return self;
  27078. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27079. },
  27080. args: ["aPackage", "aStream"],
  27081. 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",
  27082. referencedClasses: [],
  27083. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "ownMethods", "exportMethod:on:", "exportMetaDefinitionOf:on:", "class", "extensionMethodsOfPackage:", "exportPackageEpilogueOf:on:"]
  27084. }),
  27085. $globals.Exporter);
  27086. $core.addMethod(
  27087. $core.method({
  27088. selector: "exportPackageContextOf:on:",
  27089. protocol: 'output',
  27090. fn: function (aPackage,aStream){
  27091. var self=this;
  27092. return $core.withContext(function($ctx1) {
  27093. $recv(aStream)._nextPutAll_("$core.packages[");
  27094. $ctx1.sendIdx["nextPutAll:"]=1;
  27095. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
  27096. $ctx1.sendIdx["nextPutAll:"]=2;
  27097. $recv(aStream)._nextPutAll_("].innerEval = ");
  27098. $ctx1.sendIdx["nextPutAll:"]=3;
  27099. $recv(aStream)._nextPutAll_("function (expr) { return eval(expr); }");
  27100. $ctx1.sendIdx["nextPutAll:"]=4;
  27101. $recv(aStream)._nextPutAll_(";");
  27102. $recv(aStream)._lf();
  27103. return self;
  27104. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27105. },
  27106. args: ["aPackage", "aStream"],
  27107. 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",
  27108. referencedClasses: [],
  27109. messageSends: ["nextPutAll:", "asJavascript", "name", "lf"]
  27110. }),
  27111. $globals.Exporter);
  27112. $core.addMethod(
  27113. $core.method({
  27114. selector: "exportPackageDefinitionOf:on:",
  27115. protocol: 'output',
  27116. fn: function (aPackage,aStream){
  27117. var self=this;
  27118. return $core.withContext(function($ctx1) {
  27119. var $1;
  27120. $recv(aStream)._nextPutAll_("$core.addPackage(");
  27121. $ctx1.sendIdx["nextPutAll:"]=1;
  27122. $1=$recv("'".__comma($recv(aPackage)._name())).__comma("');");
  27123. $ctx1.sendIdx[","]=1;
  27124. $recv(aStream)._nextPutAll_($1);
  27125. $recv(aStream)._lf();
  27126. return self;
  27127. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27128. },
  27129. args: ["aPackage", "aStream"],
  27130. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.addPackage(';\x0a\x09\x09nextPutAll: '''', aPackage name, ''');';\x0a\x09\x09lf",
  27131. referencedClasses: [],
  27132. messageSends: ["nextPutAll:", ",", "name", "lf"]
  27133. }),
  27134. $globals.Exporter);
  27135. $core.addMethod(
  27136. $core.method({
  27137. selector: "exportPackageEpilogueOf:on:",
  27138. protocol: 'output',
  27139. fn: function (aPackage,aStream){
  27140. var self=this;
  27141. return $core.withContext(function($ctx1) {
  27142. self._subclassResponsibility();
  27143. return self;
  27144. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27145. },
  27146. args: ["aPackage", "aStream"],
  27147. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  27148. referencedClasses: [],
  27149. messageSends: ["subclassResponsibility"]
  27150. }),
  27151. $globals.Exporter);
  27152. $core.addMethod(
  27153. $core.method({
  27154. selector: "exportPackageImportsOf:on:",
  27155. protocol: 'output',
  27156. fn: function (aPackage,aStream){
  27157. var self=this;
  27158. return $core.withContext(function($ctx1) {
  27159. var $1;
  27160. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  27161. return $core.withContext(function($ctx2) {
  27162. $recv(aStream)._nextPutAll_("$core.packages[");
  27163. $ctx2.sendIdx["nextPutAll:"]=1;
  27164. $1=$recv($recv(aPackage)._name())._asJavascript();
  27165. $ctx2.sendIdx["asJavascript"]=1;
  27166. $recv(aStream)._nextPutAll_($1);
  27167. $ctx2.sendIdx["nextPutAll:"]=2;
  27168. $recv(aStream)._nextPutAll_("].imports = ");
  27169. $ctx2.sendIdx["nextPutAll:"]=3;
  27170. $recv(aStream)._nextPutAll_($recv(imports)._asJavascript());
  27171. $ctx2.sendIdx["nextPutAll:"]=4;
  27172. $recv(aStream)._nextPutAll_(";");
  27173. return $recv(aStream)._lf();
  27174. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  27175. }));
  27176. return self;
  27177. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27178. },
  27179. args: ["aPackage", "aStream"],
  27180. 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 ]",
  27181. referencedClasses: [],
  27182. messageSends: ["ifNotEmpty:", "importsAsJson", "nextPutAll:", "asJavascript", "name", "lf"]
  27183. }),
  27184. $globals.Exporter);
  27185. $core.addMethod(
  27186. $core.method({
  27187. selector: "exportPackagePrologueOf:on:",
  27188. protocol: 'output',
  27189. fn: function (aPackage,aStream){
  27190. var self=this;
  27191. return $core.withContext(function($ctx1) {
  27192. self._subclassResponsibility();
  27193. return self;
  27194. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27195. },
  27196. args: ["aPackage", "aStream"],
  27197. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  27198. referencedClasses: [],
  27199. messageSends: ["subclassResponsibility"]
  27200. }),
  27201. $globals.Exporter);
  27202. $core.addMethod(
  27203. $core.method({
  27204. selector: "exportPackageTransportOf:on:",
  27205. protocol: 'output',
  27206. fn: function (aPackage,aStream){
  27207. var self=this;
  27208. return $core.withContext(function($ctx1) {
  27209. $recv(aStream)._nextPutAll_("$core.packages[");
  27210. $ctx1.sendIdx["nextPutAll:"]=1;
  27211. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
  27212. $ctx1.sendIdx["nextPutAll:"]=2;
  27213. $recv(aStream)._nextPutAll_("].transport = ");
  27214. $ctx1.sendIdx["nextPutAll:"]=3;
  27215. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._transport())._asJSONString());
  27216. $ctx1.sendIdx["nextPutAll:"]=4;
  27217. $recv(aStream)._nextPutAll_(";");
  27218. $recv(aStream)._lf();
  27219. return self;
  27220. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27221. },
  27222. args: ["aPackage", "aStream"],
  27223. 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",
  27224. referencedClasses: [],
  27225. messageSends: ["nextPutAll:", "asJavascript", "name", "asJSONString", "transport", "lf"]
  27226. }),
  27227. $globals.Exporter);
  27228. $core.addMethod(
  27229. $core.method({
  27230. selector: "jsClassNameFor:",
  27231. protocol: 'convenience',
  27232. fn: function (aClass){
  27233. var self=this;
  27234. return $core.withContext(function($ctx1) {
  27235. var $1,$receiver;
  27236. $1=$recv(aClass)._isMetaclass();
  27237. if($core.assert($1)){
  27238. return $recv(self._jsClassNameFor_($recv(aClass)._instanceClass())).__comma(".klass");
  27239. $ctx1.sendIdx[","]=1;
  27240. } else {
  27241. if(($receiver = aClass) == null || $receiver.isNil){
  27242. return "null";
  27243. } else {
  27244. return "$globals.".__comma($recv(aClass)._name());
  27245. };
  27246. };
  27247. }, function($ctx1) {$ctx1.fill(self,"jsClassNameFor:",{aClass:aClass},$globals.Exporter)});
  27248. },
  27249. args: ["aClass"],
  27250. 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 ] ]",
  27251. referencedClasses: [],
  27252. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "jsClassNameFor:", "instanceClass", "ifNil:ifNotNil:", "name"]
  27253. }),
  27254. $globals.Exporter);
  27255. $core.addMethod(
  27256. $core.method({
  27257. selector: "ownMethodsOfClass:",
  27258. protocol: 'accessing',
  27259. fn: function (aClass){
  27260. var self=this;
  27261. return $core.withContext(function($ctx1) {
  27262. var $1;
  27263. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  27264. return $core.withContext(function($ctx2) {
  27265. $1=$recv(a)._selector();
  27266. $ctx2.sendIdx["selector"]=1;
  27267. return $recv($1).__lt_eq($recv(b)._selector());
  27268. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  27269. })))._reject_((function(each){
  27270. return $core.withContext(function($ctx2) {
  27271. return $recv($recv(each)._protocol())._match_("^\x5c*");
  27272. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27273. }));
  27274. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  27275. },
  27276. args: ["aClass"],
  27277. 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*') ]",
  27278. referencedClasses: [],
  27279. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  27280. }),
  27281. $globals.Exporter);
  27282. $core.addMethod(
  27283. $core.method({
  27284. selector: "ownMethodsOfMetaClass:",
  27285. protocol: 'accessing',
  27286. fn: function (aClass){
  27287. var self=this;
  27288. return $core.withContext(function($ctx1) {
  27289. return self._ownMethodsOfClass_($recv(aClass)._class());
  27290. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  27291. },
  27292. args: ["aClass"],
  27293. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass class",
  27294. referencedClasses: [],
  27295. messageSends: ["ownMethodsOfClass:", "class"]
  27296. }),
  27297. $globals.Exporter);
  27298. $core.addClass('AmdExporter', $globals.Exporter, ['namespace'], 'Platform-ImportExport');
  27299. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  27300. $core.addMethod(
  27301. $core.method({
  27302. selector: "amdNamesOfPackages:",
  27303. protocol: 'private',
  27304. fn: function (anArray){
  27305. var self=this;
  27306. return $core.withContext(function($ctx1) {
  27307. var $1;
  27308. return $recv($recv(anArray)._select_((function(each){
  27309. return $core.withContext(function($ctx2) {
  27310. $1=self._amdNamespaceOfPackage_(each);
  27311. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  27312. return $recv($1)._notNil();
  27313. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27314. })))._collect_((function(each){
  27315. return $core.withContext(function($ctx2) {
  27316. return $recv($recv(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  27317. $ctx2.sendIdx[","]=1;
  27318. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27319. }));
  27320. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  27321. },
  27322. args: ["anArray"],
  27323. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  27324. referencedClasses: [],
  27325. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  27326. }),
  27327. $globals.AmdExporter);
  27328. $core.addMethod(
  27329. $core.method({
  27330. selector: "amdNamespaceOfPackage:",
  27331. protocol: 'private',
  27332. fn: function (aPackage){
  27333. var self=this;
  27334. return $core.withContext(function($ctx1) {
  27335. var $3,$2,$1;
  27336. $3=$recv(aPackage)._transport();
  27337. $ctx1.sendIdx["transport"]=1;
  27338. $2=$recv($3)._type();
  27339. $1=$recv($2).__eq("amd");
  27340. if($core.assert($1)){
  27341. return $recv($recv(aPackage)._transport())._namespace();
  27342. } else {
  27343. return nil;
  27344. };
  27345. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  27346. },
  27347. args: ["aPackage"],
  27348. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  27349. referencedClasses: [],
  27350. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  27351. }),
  27352. $globals.AmdExporter);
  27353. $core.addMethod(
  27354. $core.method({
  27355. selector: "exportPackageEpilogueOf:on:",
  27356. protocol: 'output',
  27357. fn: function (aPackage,aStream){
  27358. var self=this;
  27359. return $core.withContext(function($ctx1) {
  27360. $recv(aStream)._nextPutAll_("});");
  27361. $recv(aStream)._lf();
  27362. return self;
  27363. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  27364. },
  27365. args: ["aPackage", "aStream"],
  27366. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf",
  27367. referencedClasses: [],
  27368. messageSends: ["nextPutAll:", "lf"]
  27369. }),
  27370. $globals.AmdExporter);
  27371. $core.addMethod(
  27372. $core.method({
  27373. selector: "exportPackagePrologueOf:on:",
  27374. protocol: 'output',
  27375. fn: function (aPackage,aStream){
  27376. var self=this;
  27377. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  27378. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  27379. return $core.withContext(function($ctx1) {
  27380. var $1,$3,$2,$4,$6,$5,$7,$13,$12,$11,$10,$9,$8,$17,$16,$15,$14;
  27381. pragmaStart="";
  27382. pragmaEnd="";
  27383. importsForOutput=self._importsForOutput_(aPackage);
  27384. loadDependencies=self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  27385. $1=$recv(importsForOutput)._value();
  27386. $ctx1.sendIdx["value"]=1;
  27387. $recv($1)._ifNotEmpty_((function(){
  27388. return $core.withContext(function($ctx2) {
  27389. $3=$recv($String())._lf();
  27390. $ctx2.sendIdx["lf"]=1;
  27391. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  27392. $ctx2.sendIdx[","]=2;
  27393. $4=$recv($String())._lf();
  27394. $ctx2.sendIdx["lf"]=2;
  27395. pragmaStart=$recv($2).__comma($4);
  27396. $ctx2.sendIdx[","]=1;
  27397. pragmaStart;
  27398. $6=$recv($String())._lf();
  27399. $ctx2.sendIdx["lf"]=3;
  27400. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  27401. $ctx2.sendIdx[","]=4;
  27402. $7=$recv($String())._lf();
  27403. $ctx2.sendIdx["lf"]=4;
  27404. pragmaEnd=$recv($5).__comma($7);
  27405. $ctx2.sendIdx[","]=3;
  27406. return pragmaEnd;
  27407. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  27408. }));
  27409. $recv(aStream)._nextPutAll_("define(\x22");
  27410. $ctx1.sendIdx["nextPutAll:"]=1;
  27411. $recv(aStream)._nextPutAll_(self._amdNamespaceOfPackage_(aPackage));
  27412. $ctx1.sendIdx["nextPutAll:"]=2;
  27413. $recv(aStream)._nextPutAll_("/");
  27414. $ctx1.sendIdx["nextPutAll:"]=3;
  27415. $recv(aStream)._nextPutAll_($recv(aPackage)._name());
  27416. $ctx1.sendIdx["nextPutAll:"]=4;
  27417. $recv(aStream)._nextPutAll_("\x22, ");
  27418. $ctx1.sendIdx["nextPutAll:"]=5;
  27419. $13=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  27420. $ctx1.sendIdx[","]=7;
  27421. $12=$recv($13).__comma([":2:"]);
  27422. $ctx1.sendIdx[","]=6;
  27423. $11=$recv($12).__comma(loadDependencies);
  27424. $ctx1.sendIdx[","]=5;
  27425. $10=$recv($11)._asJavascript();
  27426. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  27427. $ctx1.sendIdx["replace:with:"]=2;
  27428. $8=$recv($9)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  27429. $ctx1.sendIdx["replace:with:"]=1;
  27430. $recv(aStream)._nextPutAll_($8);
  27431. $ctx1.sendIdx["nextPutAll:"]=6;
  27432. $recv(aStream)._nextPutAll_(", function(");
  27433. $ctx1.sendIdx["nextPutAll:"]=7;
  27434. $17=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  27435. $ctx1.sendIdx[","]=8;
  27436. $16=$recv($17)._join_(",");
  27437. $15=$recv($16)._replace_with_(",\x5cs*:1:",pragmaStart);
  27438. $14=$recv($15)._replace_with_(",\x5cs*:2:",pragmaEnd);
  27439. $ctx1.sendIdx["replace:with:"]=3;
  27440. $recv(aStream)._nextPutAll_($14);
  27441. $ctx1.sendIdx["nextPutAll:"]=8;
  27442. $recv(aStream)._nextPutAll_("){\x22use strict\x22;");
  27443. $ctx1.sendIdx["nextPutAll:"]=9;
  27444. $recv(aStream)._lf();
  27445. $ctx1.sendIdx["lf"]=5;
  27446. $recv(aStream)._nextPutAll_("var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;");
  27447. $recv(aStream)._lf();
  27448. return self;
  27449. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  27450. },
  27451. args: ["aPackage", "aStream"],
  27452. 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",
  27453. referencedClasses: ["String"],
  27454. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "nextPutAll:", "amdNamespaceOfPackage:", "name", "replace:with:", "asJavascript", "join:", "key"]
  27455. }),
  27456. $globals.AmdExporter);
  27457. $core.addMethod(
  27458. $core.method({
  27459. selector: "importsForOutput:",
  27460. protocol: 'private',
  27461. fn: function (aPackage){
  27462. var self=this;
  27463. var namedImports,anonImports,importVarNames;
  27464. return $core.withContext(function($ctx1) {
  27465. var $1;
  27466. namedImports=[];
  27467. anonImports=[];
  27468. importVarNames=[];
  27469. $recv($recv(aPackage)._imports())._do_((function(each){
  27470. return $core.withContext(function($ctx2) {
  27471. $1=$recv(each)._isString();
  27472. if($core.assert($1)){
  27473. return $recv(anonImports)._add_(each);
  27474. $ctx2.sendIdx["add:"]=1;
  27475. } else {
  27476. $recv(namedImports)._add_($recv(each)._value());
  27477. $ctx2.sendIdx["add:"]=2;
  27478. return $recv(importVarNames)._add_($recv(each)._key());
  27479. };
  27480. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27481. }));
  27482. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  27483. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  27484. },
  27485. args: ["aPackage"],
  27486. 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)",
  27487. referencedClasses: [],
  27488. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  27489. }),
  27490. $globals.AmdExporter);
  27491. $core.addClass('ChunkParser', $globals.Object, ['stream', 'last'], 'Platform-ImportExport');
  27492. $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";
  27493. $core.addMethod(
  27494. $core.method({
  27495. selector: "last",
  27496. protocol: 'accessing',
  27497. fn: function (){
  27498. var self=this;
  27499. return self["@last"];
  27500. },
  27501. args: [],
  27502. source: "last\x0a\x09^ last",
  27503. referencedClasses: [],
  27504. messageSends: []
  27505. }),
  27506. $globals.ChunkParser);
  27507. $core.addMethod(
  27508. $core.method({
  27509. selector: "nextChunk",
  27510. protocol: 'reading',
  27511. fn: function (){
  27512. var self=this;
  27513. var char,result,chunk;
  27514. return $core.withContext(function($ctx1) {
  27515. var $1,$2,$3,$4;
  27516. var $early={};
  27517. try {
  27518. result=""._writeStream();
  27519. $recv((function(){
  27520. return $core.withContext(function($ctx2) {
  27521. char=$recv(self["@stream"])._next();
  27522. $ctx2.sendIdx["next"]=1;
  27523. char;
  27524. return $recv(char)._notNil();
  27525. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  27526. }))._whileTrue_((function(){
  27527. return $core.withContext(function($ctx2) {
  27528. $1=$recv(char).__eq("!");
  27529. $ctx2.sendIdx["="]=1;
  27530. if($core.assert($1)){
  27531. $2=$recv($recv(self["@stream"])._peek()).__eq("!");
  27532. if($core.assert($2)){
  27533. $recv(self["@stream"])._next();
  27534. } else {
  27535. self["@last"]=$recv($recv(result)._contents())._trimBoth();
  27536. $3=self["@last"];
  27537. throw $early=[$3];
  27538. };
  27539. };
  27540. return $recv(result)._nextPut_(char);
  27541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  27542. }));
  27543. self["@last"]=nil;
  27544. $4=self["@last"];
  27545. return $4;
  27546. }
  27547. catch(e) {if(e===$early)return e[0]; throw e}
  27548. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  27549. },
  27550. args: [],
  27551. 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",
  27552. referencedClasses: [],
  27553. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  27554. }),
  27555. $globals.ChunkParser);
  27556. $core.addMethod(
  27557. $core.method({
  27558. selector: "stream:",
  27559. protocol: 'accessing',
  27560. fn: function (aStream){
  27561. var self=this;
  27562. self["@stream"]=aStream;
  27563. return self;
  27564. },
  27565. args: ["aStream"],
  27566. source: "stream: aStream\x0a\x09stream := aStream",
  27567. referencedClasses: [],
  27568. messageSends: []
  27569. }),
  27570. $globals.ChunkParser);
  27571. $core.addMethod(
  27572. $core.method({
  27573. selector: "on:",
  27574. protocol: 'instance creation',
  27575. fn: function (aStream){
  27576. var self=this;
  27577. return $core.withContext(function($ctx1) {
  27578. return $recv(self._new())._stream_(aStream);
  27579. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.klass)});
  27580. },
  27581. args: ["aStream"],
  27582. source: "on: aStream\x0a\x09^ self new stream: aStream",
  27583. referencedClasses: [],
  27584. messageSends: ["stream:", "new"]
  27585. }),
  27586. $globals.ChunkParser.klass);
  27587. $core.addClass('ClassCommentReader', $globals.Object, ['class'], 'Platform-ImportExport');
  27588. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  27589. $core.addMethod(
  27590. $core.method({
  27591. selector: "class:",
  27592. protocol: 'accessing',
  27593. fn: function (aClass){
  27594. var self=this;
  27595. self["@class"]=aClass;
  27596. return self;
  27597. },
  27598. args: ["aClass"],
  27599. source: "class: aClass\x0a\x09class := aClass",
  27600. referencedClasses: [],
  27601. messageSends: []
  27602. }),
  27603. $globals.ClassCommentReader);
  27604. $core.addMethod(
  27605. $core.method({
  27606. selector: "initialize",
  27607. protocol: 'initialization',
  27608. fn: function (){
  27609. var self=this;
  27610. return $core.withContext(function($ctx1) {
  27611. (
  27612. $ctx1.supercall = true,
  27613. ($globals.ClassCommentReader.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  27614. $ctx1.supercall = false;
  27615. return self;
  27616. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  27617. },
  27618. args: [],
  27619. source: "initialize\x0a\x09super initialize.",
  27620. referencedClasses: [],
  27621. messageSends: ["initialize"]
  27622. }),
  27623. $globals.ClassCommentReader);
  27624. $core.addMethod(
  27625. $core.method({
  27626. selector: "scanFrom:",
  27627. protocol: 'fileIn',
  27628. fn: function (aChunkParser){
  27629. var self=this;
  27630. var chunk;
  27631. return $core.withContext(function($ctx1) {
  27632. var $1;
  27633. chunk=$recv(aChunkParser)._nextChunk();
  27634. $1=$recv(chunk)._isEmpty();
  27635. if(!$core.assert($1)){
  27636. self._setComment_(chunk);
  27637. };
  27638. return self;
  27639. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  27640. },
  27641. args: ["aChunkParser"],
  27642. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk ].",
  27643. referencedClasses: [],
  27644. messageSends: ["nextChunk", "ifFalse:", "isEmpty", "setComment:"]
  27645. }),
  27646. $globals.ClassCommentReader);
  27647. $core.addMethod(
  27648. $core.method({
  27649. selector: "setComment:",
  27650. protocol: 'private',
  27651. fn: function (aString){
  27652. var self=this;
  27653. return $core.withContext(function($ctx1) {
  27654. $recv(self["@class"])._comment_(aString);
  27655. return self;
  27656. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  27657. },
  27658. args: ["aString"],
  27659. source: "setComment: aString\x0a\x09class comment: aString",
  27660. referencedClasses: [],
  27661. messageSends: ["comment:"]
  27662. }),
  27663. $globals.ClassCommentReader);
  27664. $core.addClass('ClassProtocolReader', $globals.Object, ['class', 'category'], 'Platform-ImportExport');
  27665. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  27666. $core.addMethod(
  27667. $core.method({
  27668. selector: "class:category:",
  27669. protocol: 'accessing',
  27670. fn: function (aClass,aString){
  27671. var self=this;
  27672. self["@class"]=aClass;
  27673. self["@category"]=aString;
  27674. return self;
  27675. },
  27676. args: ["aClass", "aString"],
  27677. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  27678. referencedClasses: [],
  27679. messageSends: []
  27680. }),
  27681. $globals.ClassProtocolReader);
  27682. $core.addMethod(
  27683. $core.method({
  27684. selector: "compileMethod:",
  27685. protocol: 'private',
  27686. fn: function (aString){
  27687. var self=this;
  27688. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  27689. return $core.withContext(function($ctx1) {
  27690. $recv($recv($Compiler())._new())._install_forClass_protocol_(aString,self["@class"],self["@category"]);
  27691. return self;
  27692. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  27693. },
  27694. args: ["aString"],
  27695. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  27696. referencedClasses: ["Compiler"],
  27697. messageSends: ["install:forClass:protocol:", "new"]
  27698. }),
  27699. $globals.ClassProtocolReader);
  27700. $core.addMethod(
  27701. $core.method({
  27702. selector: "initialize",
  27703. protocol: 'initialization',
  27704. fn: function (){
  27705. var self=this;
  27706. return $core.withContext(function($ctx1) {
  27707. (
  27708. $ctx1.supercall = true,
  27709. ($globals.ClassProtocolReader.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  27710. $ctx1.supercall = false;
  27711. return self;
  27712. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  27713. },
  27714. args: [],
  27715. source: "initialize\x0a\x09super initialize.",
  27716. referencedClasses: [],
  27717. messageSends: ["initialize"]
  27718. }),
  27719. $globals.ClassProtocolReader);
  27720. $core.addMethod(
  27721. $core.method({
  27722. selector: "scanFrom:",
  27723. protocol: 'fileIn',
  27724. fn: function (aChunkParser){
  27725. var self=this;
  27726. var chunk;
  27727. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  27728. return $core.withContext(function($ctx1) {
  27729. $recv((function(){
  27730. return $core.withContext(function($ctx2) {
  27731. chunk=$recv(aChunkParser)._nextChunk();
  27732. chunk;
  27733. return $recv(chunk)._isEmpty();
  27734. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  27735. }))._whileFalse_((function(){
  27736. return $core.withContext(function($ctx2) {
  27737. return self._compileMethod_(chunk);
  27738. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  27739. }));
  27740. $recv($recv($ClassBuilder())._new())._setupClass_(self["@class"]);
  27741. return self;
  27742. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  27743. },
  27744. args: ["aChunkParser"],
  27745. 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",
  27746. referencedClasses: ["ClassBuilder"],
  27747. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:", "setupClass:", "new"]
  27748. }),
  27749. $globals.ClassProtocolReader);
  27750. $core.addClass('ExportMethodProtocol', $globals.Object, ['name', 'theClass'], 'Platform-ImportExport');
  27751. $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.";
  27752. $core.addMethod(
  27753. $core.method({
  27754. selector: "methods",
  27755. protocol: 'accessing',
  27756. fn: function (){
  27757. var self=this;
  27758. return $core.withContext(function($ctx1) {
  27759. var $1;
  27760. return $recv($recv(self._theClass())._methodsInProtocol_(self._name()))._sorted_((function(a,b){
  27761. return $core.withContext(function($ctx2) {
  27762. $1=$recv(a)._selector();
  27763. $ctx2.sendIdx["selector"]=1;
  27764. return $recv($1).__lt_eq($recv(b)._selector());
  27765. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  27766. }));
  27767. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  27768. },
  27769. args: [],
  27770. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  27771. referencedClasses: [],
  27772. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  27773. }),
  27774. $globals.ExportMethodProtocol);
  27775. $core.addMethod(
  27776. $core.method({
  27777. selector: "name",
  27778. protocol: 'accessing',
  27779. fn: function (){
  27780. var self=this;
  27781. return self["@name"];
  27782. },
  27783. args: [],
  27784. source: "name\x0a\x09^ name",
  27785. referencedClasses: [],
  27786. messageSends: []
  27787. }),
  27788. $globals.ExportMethodProtocol);
  27789. $core.addMethod(
  27790. $core.method({
  27791. selector: "name:",
  27792. protocol: 'accessing',
  27793. fn: function (aString){
  27794. var self=this;
  27795. self["@name"]=aString;
  27796. return self;
  27797. },
  27798. args: ["aString"],
  27799. source: "name: aString\x0a\x09name := aString",
  27800. referencedClasses: [],
  27801. messageSends: []
  27802. }),
  27803. $globals.ExportMethodProtocol);
  27804. $core.addMethod(
  27805. $core.method({
  27806. selector: "theClass",
  27807. protocol: 'accessing',
  27808. fn: function (){
  27809. var self=this;
  27810. return self["@theClass"];
  27811. },
  27812. args: [],
  27813. source: "theClass\x0a\x09^ theClass",
  27814. referencedClasses: [],
  27815. messageSends: []
  27816. }),
  27817. $globals.ExportMethodProtocol);
  27818. $core.addMethod(
  27819. $core.method({
  27820. selector: "theClass:",
  27821. protocol: 'accessing',
  27822. fn: function (aClass){
  27823. var self=this;
  27824. self["@theClass"]=aClass;
  27825. return self;
  27826. },
  27827. args: ["aClass"],
  27828. source: "theClass: aClass\x0a\x09theClass := aClass",
  27829. referencedClasses: [],
  27830. messageSends: []
  27831. }),
  27832. $globals.ExportMethodProtocol);
  27833. $core.addMethod(
  27834. $core.method({
  27835. selector: "name:theClass:",
  27836. protocol: 'instance creation',
  27837. fn: function (aString,aClass){
  27838. var self=this;
  27839. return $core.withContext(function($ctx1) {
  27840. var $1;
  27841. $1=self._new();
  27842. $recv($1)._name_(aString);
  27843. $recv($1)._theClass_(aClass);
  27844. return $recv($1)._yourself();
  27845. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.klass)});
  27846. },
  27847. args: ["aString", "aClass"],
  27848. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  27849. referencedClasses: [],
  27850. messageSends: ["name:", "new", "theClass:", "yourself"]
  27851. }),
  27852. $globals.ExportMethodProtocol.klass);
  27853. $core.addClass('Importer', $globals.Object, ['lastSection', 'lastChunk'], 'Platform-ImportExport');
  27854. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  27855. $core.addMethod(
  27856. $core.method({
  27857. selector: "import:",
  27858. protocol: 'fileIn',
  27859. fn: function (aStream){
  27860. var self=this;
  27861. var chunk,result,parser,lastEmpty;
  27862. function $ChunkParser(){return $globals.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)}
  27863. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  27864. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  27865. return $core.withContext(function($ctx1) {
  27866. var $1,$2;
  27867. parser=$recv($ChunkParser())._on_(aStream);
  27868. lastEmpty=false;
  27869. self["@lastSection"]="n/a, not started";
  27870. self["@lastChunk"]=nil;
  27871. $recv((function(){
  27872. return $core.withContext(function($ctx2) {
  27873. $recv((function(){
  27874. return $core.withContext(function($ctx3) {
  27875. chunk=$recv(parser)._nextChunk();
  27876. chunk;
  27877. return $recv(chunk)._isNil();
  27878. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  27879. }))._whileFalse_((function(){
  27880. return $core.withContext(function($ctx3) {
  27881. $1=$recv(chunk)._isEmpty();
  27882. if($core.assert($1)){
  27883. lastEmpty=true;
  27884. return lastEmpty;
  27885. } else {
  27886. self["@lastSection"]=chunk;
  27887. self["@lastSection"];
  27888. result=$recv($recv($Compiler())._new())._evaluateExpression_(chunk);
  27889. result;
  27890. $2=lastEmpty;
  27891. if($core.assert($2)){
  27892. lastEmpty=false;
  27893. lastEmpty;
  27894. return $recv(result)._scanFrom_(parser);
  27895. };
  27896. };
  27897. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  27898. }));
  27899. self["@lastSection"]="n/a, finished";
  27900. return self["@lastSection"];
  27901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  27902. }))._on_do_($Error(),(function(e){
  27903. return $core.withContext(function($ctx2) {
  27904. self["@lastChunk"]=$recv(parser)._last();
  27905. self["@lastChunk"];
  27906. return $recv(e)._resignal();
  27907. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  27908. }));
  27909. return self;
  27910. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  27911. },
  27912. args: ["aStream"],
  27913. 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 ].",
  27914. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  27915. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifTrue:ifFalse:", "isEmpty", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "resignal"]
  27916. }),
  27917. $globals.Importer);
  27918. $core.addMethod(
  27919. $core.method({
  27920. selector: "lastChunk",
  27921. protocol: 'accessing',
  27922. fn: function (){
  27923. var self=this;
  27924. return self["@lastChunk"];
  27925. },
  27926. args: [],
  27927. source: "lastChunk\x0a\x09^ lastChunk",
  27928. referencedClasses: [],
  27929. messageSends: []
  27930. }),
  27931. $globals.Importer);
  27932. $core.addMethod(
  27933. $core.method({
  27934. selector: "lastSection",
  27935. protocol: 'accessing',
  27936. fn: function (){
  27937. var self=this;
  27938. return self["@lastSection"];
  27939. },
  27940. args: [],
  27941. source: "lastSection\x0a\x09^ lastSection",
  27942. referencedClasses: [],
  27943. messageSends: []
  27944. }),
  27945. $globals.Importer);
  27946. $core.addClass('PackageCommitError', $globals.Error, [], 'Platform-ImportExport');
  27947. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  27948. $core.addClass('PackageHandler', $globals.InterfacingObject, [], 'Platform-ImportExport');
  27949. $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.";
  27950. $core.addMethod(
  27951. $core.method({
  27952. selector: "ajaxPutAt:data:onSuccess:onError:",
  27953. protocol: 'private',
  27954. fn: function (aURL,aString,aBlock,anotherBlock){
  27955. var self=this;
  27956. var xhr;
  27957. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  27958. return $core.withContext(function($ctx1) {
  27959. var $1,$4,$3,$2;
  27960. xhr=$recv($Platform())._newXhr();
  27961. $recv(xhr)._open_url_async_("PUT",aURL,true);
  27962. $recv(xhr)._onreadystatechange_((function(){
  27963. return $core.withContext(function($ctx2) {
  27964. $1=$recv($recv(xhr)._readyState()).__eq((4));
  27965. if($core.assert($1)){
  27966. $4=$recv(xhr)._status();
  27967. $ctx2.sendIdx["status"]=1;
  27968. $3=$recv($4).__gt_eq((200));
  27969. $2=$recv($3)._and_((function(){
  27970. return $core.withContext(function($ctx3) {
  27971. return $recv($recv(xhr)._status()).__lt((300));
  27972. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  27973. }));
  27974. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  27975. };
  27976. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  27977. }));
  27978. $recv(xhr)._send_(aString);
  27979. return self;
  27980. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  27981. },
  27982. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  27983. 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",
  27984. referencedClasses: ["Platform"],
  27985. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  27986. }),
  27987. $globals.PackageHandler);
  27988. $core.addMethod(
  27989. $core.method({
  27990. selector: "chunkContentsFor:",
  27991. protocol: 'accessing',
  27992. fn: function (aPackage){
  27993. var self=this;
  27994. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  27995. return $core.withContext(function($ctx1) {
  27996. return $recv($String())._streamContents_((function(str){
  27997. return $core.withContext(function($ctx2) {
  27998. return $recv(self._chunkExporter())._exportPackage_on_(aPackage,str);
  27999. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  28000. }));
  28001. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28002. },
  28003. args: ["aPackage"],
  28004. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  28005. referencedClasses: ["String"],
  28006. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  28007. }),
  28008. $globals.PackageHandler);
  28009. $core.addMethod(
  28010. $core.method({
  28011. selector: "chunkExporter",
  28012. protocol: 'factory',
  28013. fn: function (){
  28014. var self=this;
  28015. return $core.withContext(function($ctx1) {
  28016. return $recv(self._chunkExporterClass())._new();
  28017. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  28018. },
  28019. args: [],
  28020. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  28021. referencedClasses: [],
  28022. messageSends: ["new", "chunkExporterClass"]
  28023. }),
  28024. $globals.PackageHandler);
  28025. $core.addMethod(
  28026. $core.method({
  28027. selector: "chunkExporterClass",
  28028. protocol: 'accessing',
  28029. fn: function (){
  28030. var self=this;
  28031. function $ChunkExporter(){return $globals.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  28032. return $ChunkExporter();
  28033. },
  28034. args: [],
  28035. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  28036. referencedClasses: ["ChunkExporter"],
  28037. messageSends: []
  28038. }),
  28039. $globals.PackageHandler);
  28040. $core.addMethod(
  28041. $core.method({
  28042. selector: "commit:",
  28043. protocol: 'committing',
  28044. fn: function (aPackage){
  28045. var self=this;
  28046. function $PackageCommitError(){return $globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)}
  28047. return $core.withContext(function($ctx1) {
  28048. var $1,$2;
  28049. self._commit_onSuccess_onError_(aPackage,(function(){
  28050. }),(function(error){
  28051. return $core.withContext(function($ctx2) {
  28052. $1=$recv($PackageCommitError())._new();
  28053. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  28054. $ctx2.sendIdx[","]=1;
  28055. $recv($1)._messageText_($2);
  28056. return $recv($1)._signal();
  28057. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  28058. }));
  28059. return self;
  28060. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  28061. },
  28062. args: ["aPackage"],
  28063. 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 ]",
  28064. referencedClasses: ["PackageCommitError"],
  28065. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  28066. }),
  28067. $globals.PackageHandler);
  28068. $core.addMethod(
  28069. $core.method({
  28070. selector: "commit:onSuccess:onError:",
  28071. protocol: 'committing',
  28072. fn: function (aPackage,aBlock,anotherBlock){
  28073. var self=this;
  28074. return $core.withContext(function($ctx1) {
  28075. self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  28076. return $core.withContext(function($ctx2) {
  28077. return self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  28078. return $core.withContext(function($ctx3) {
  28079. $recv(aPackage)._beClean();
  28080. return $recv(aBlock)._value();
  28081. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28082. }),anotherBlock);
  28083. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28084. }),anotherBlock);
  28085. return self;
  28086. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28087. },
  28088. args: ["aPackage", "aBlock", "anotherBlock"],
  28089. 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",
  28090. referencedClasses: [],
  28091. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  28092. }),
  28093. $globals.PackageHandler);
  28094. $core.addMethod(
  28095. $core.method({
  28096. selector: "commitJsFileFor:onSuccess:onError:",
  28097. protocol: 'committing',
  28098. fn: function (aPackage,aBlock,anotherBlock){
  28099. var self=this;
  28100. return $core.withContext(function($ctx1) {
  28101. var $2,$1;
  28102. $2=$recv($recv(self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  28103. $ctx1.sendIdx[","]=2;
  28104. $1=$recv($2).__comma(".js");
  28105. $ctx1.sendIdx[","]=1;
  28106. self._ajaxPutAt_data_onSuccess_onError_($1,self._contentsFor_(aPackage),aBlock,anotherBlock);
  28107. return self;
  28108. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28109. },
  28110. args: ["aPackage", "aBlock", "anotherBlock"],
  28111. 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",
  28112. referencedClasses: [],
  28113. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  28114. }),
  28115. $globals.PackageHandler);
  28116. $core.addMethod(
  28117. $core.method({
  28118. selector: "commitPathJsFor:",
  28119. protocol: 'accessing',
  28120. fn: function (aPackage){
  28121. var self=this;
  28122. return $core.withContext(function($ctx1) {
  28123. self._subclassResponsibility();
  28124. return self;
  28125. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28126. },
  28127. args: ["aPackage"],
  28128. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  28129. referencedClasses: [],
  28130. messageSends: ["subclassResponsibility"]
  28131. }),
  28132. $globals.PackageHandler);
  28133. $core.addMethod(
  28134. $core.method({
  28135. selector: "commitPathStFor:",
  28136. protocol: 'accessing',
  28137. fn: function (aPackage){
  28138. var self=this;
  28139. return $core.withContext(function($ctx1) {
  28140. self._subclassResponsibility();
  28141. return self;
  28142. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28143. },
  28144. args: ["aPackage"],
  28145. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  28146. referencedClasses: [],
  28147. messageSends: ["subclassResponsibility"]
  28148. }),
  28149. $globals.PackageHandler);
  28150. $core.addMethod(
  28151. $core.method({
  28152. selector: "commitStFileFor:onSuccess:onError:",
  28153. protocol: 'committing',
  28154. fn: function (aPackage,aBlock,anotherBlock){
  28155. var self=this;
  28156. return $core.withContext(function($ctx1) {
  28157. var $2,$1;
  28158. $2=$recv($recv(self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  28159. $ctx1.sendIdx[","]=2;
  28160. $1=$recv($2).__comma(".st");
  28161. $ctx1.sendIdx[","]=1;
  28162. self._ajaxPutAt_data_onSuccess_onError_($1,self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  28163. return self;
  28164. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28165. },
  28166. args: ["aPackage", "aBlock", "anotherBlock"],
  28167. 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",
  28168. referencedClasses: [],
  28169. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  28170. }),
  28171. $globals.PackageHandler);
  28172. $core.addMethod(
  28173. $core.method({
  28174. selector: "contentsFor:",
  28175. protocol: 'accessing',
  28176. fn: function (aPackage){
  28177. var self=this;
  28178. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  28179. return $core.withContext(function($ctx1) {
  28180. return $recv($String())._streamContents_((function(str){
  28181. return $core.withContext(function($ctx2) {
  28182. return $recv(self._exporter())._exportPackage_on_(aPackage,str);
  28183. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  28184. }));
  28185. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28186. },
  28187. args: ["aPackage"],
  28188. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  28189. referencedClasses: ["String"],
  28190. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  28191. }),
  28192. $globals.PackageHandler);
  28193. $core.addMethod(
  28194. $core.method({
  28195. selector: "exporter",
  28196. protocol: 'factory',
  28197. fn: function (){
  28198. var self=this;
  28199. return $core.withContext(function($ctx1) {
  28200. return $recv(self._exporterClass())._new();
  28201. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  28202. },
  28203. args: [],
  28204. source: "exporter\x0a\x09^ self exporterClass new",
  28205. referencedClasses: [],
  28206. messageSends: ["new", "exporterClass"]
  28207. }),
  28208. $globals.PackageHandler);
  28209. $core.addMethod(
  28210. $core.method({
  28211. selector: "exporterClass",
  28212. protocol: 'accessing',
  28213. fn: function (){
  28214. var self=this;
  28215. return $core.withContext(function($ctx1) {
  28216. self._subclassResponsibility();
  28217. return self;
  28218. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  28219. },
  28220. args: [],
  28221. source: "exporterClass\x0a\x09self subclassResponsibility",
  28222. referencedClasses: [],
  28223. messageSends: ["subclassResponsibility"]
  28224. }),
  28225. $globals.PackageHandler);
  28226. $core.addMethod(
  28227. $core.method({
  28228. selector: "load:",
  28229. protocol: 'loading',
  28230. fn: function (aPackage){
  28231. var self=this;
  28232. return $core.withContext(function($ctx1) {
  28233. self._subclassResponsibility();
  28234. return self;
  28235. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  28236. },
  28237. args: ["aPackage"],
  28238. source: "load: aPackage\x0a\x09self subclassResponsibility",
  28239. referencedClasses: [],
  28240. messageSends: ["subclassResponsibility"]
  28241. }),
  28242. $globals.PackageHandler);
  28243. $core.addMethod(
  28244. $core.method({
  28245. selector: "onCommitError:",
  28246. protocol: 'error handling',
  28247. fn: function (anError){
  28248. var self=this;
  28249. function $PackageCommitError(){return $globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)}
  28250. return $core.withContext(function($ctx1) {
  28251. var $1,$2;
  28252. $1=$recv($PackageCommitError())._new();
  28253. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  28254. $ctx1.sendIdx[","]=1;
  28255. $recv($1)._messageText_($2);
  28256. $recv($1)._signal();
  28257. return self;
  28258. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  28259. },
  28260. args: ["anError"],
  28261. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  28262. referencedClasses: ["PackageCommitError"],
  28263. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  28264. }),
  28265. $globals.PackageHandler);
  28266. $core.addClass('AmdPackageHandler', $globals.PackageHandler, [], 'Platform-ImportExport');
  28267. $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.";
  28268. $core.addMethod(
  28269. $core.method({
  28270. selector: "commitPathJsFor:",
  28271. protocol: 'accessing',
  28272. fn: function (aPackage){
  28273. var self=this;
  28274. return $core.withContext(function($ctx1) {
  28275. return self._toUrl_(self._namespaceFor_(aPackage));
  28276. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  28277. },
  28278. args: ["aPackage"],
  28279. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  28280. referencedClasses: [],
  28281. messageSends: ["toUrl:", "namespaceFor:"]
  28282. }),
  28283. $globals.AmdPackageHandler);
  28284. $core.addMethod(
  28285. $core.method({
  28286. selector: "commitPathStFor:",
  28287. protocol: 'accessing',
  28288. fn: function (aPackage){
  28289. var self=this;
  28290. var path,pathWithout;
  28291. return $core.withContext(function($ctx1) {
  28292. var $1,$2;
  28293. $1=$recv(self._namespaceFor_(aPackage)).__comma("/_source");
  28294. $ctx1.sendIdx[","]=1;
  28295. path=self._toUrl_($1);
  28296. pathWithout=self._commitPathJsFor_(aPackage);
  28297. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  28298. if($core.assert($2)){
  28299. return pathWithout;
  28300. } else {
  28301. return path;
  28302. };
  28303. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  28304. },
  28305. args: ["aPackage"],
  28306. 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 ]",
  28307. referencedClasses: [],
  28308. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  28309. }),
  28310. $globals.AmdPackageHandler);
  28311. $core.addMethod(
  28312. $core.method({
  28313. selector: "exporterClass",
  28314. protocol: 'accessing',
  28315. fn: function (){
  28316. var self=this;
  28317. function $AmdExporter(){return $globals.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)}
  28318. return $AmdExporter();
  28319. },
  28320. args: [],
  28321. source: "exporterClass\x0a\x09^ AmdExporter",
  28322. referencedClasses: ["AmdExporter"],
  28323. messageSends: []
  28324. }),
  28325. $globals.AmdPackageHandler);
  28326. $core.addMethod(
  28327. $core.method({
  28328. selector: "load:",
  28329. protocol: 'loading',
  28330. fn: function (aPackage){
  28331. var self=this;
  28332. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  28333. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  28334. return $core.withContext(function($ctx1) {
  28335. var $1,$3,$2,$receiver;
  28336. $1=$recv($Smalltalk())._amdRequire();
  28337. if(($receiver = $1) == null || $receiver.isNil){
  28338. self._error_("AMD loader not present");
  28339. } else {
  28340. var require;
  28341. require=$receiver;
  28342. $3=$recv($recv(self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  28343. $ctx1.sendIdx[","]=1;
  28344. $2=$recv($Array())._with_($3);
  28345. $recv(require)._value_($2);
  28346. };
  28347. return self;
  28348. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  28349. },
  28350. args: ["aPackage"],
  28351. 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 ) ]",
  28352. referencedClasses: ["Smalltalk", "Array"],
  28353. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "with:", ",", "namespaceFor:", "name"]
  28354. }),
  28355. $globals.AmdPackageHandler);
  28356. $core.addMethod(
  28357. $core.method({
  28358. selector: "namespaceFor:",
  28359. protocol: 'committing',
  28360. fn: function (aPackage){
  28361. var self=this;
  28362. return $core.withContext(function($ctx1) {
  28363. return $recv($recv(aPackage)._transport())._namespace();
  28364. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  28365. },
  28366. args: ["aPackage"],
  28367. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  28368. referencedClasses: [],
  28369. messageSends: ["namespace", "transport"]
  28370. }),
  28371. $globals.AmdPackageHandler);
  28372. $core.addMethod(
  28373. $core.method({
  28374. selector: "toUrl:",
  28375. protocol: 'private',
  28376. fn: function (aString){
  28377. var self=this;
  28378. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  28379. return $core.withContext(function($ctx1) {
  28380. var $1,$receiver;
  28381. $1=$recv($Smalltalk())._amdRequire();
  28382. if(($receiver = $1) == null || $receiver.isNil){
  28383. return self._error_("AMD loader not present");
  28384. } else {
  28385. var require;
  28386. require=$receiver;
  28387. return $recv($recv(require)._basicAt_("toUrl"))._value_(aString);
  28388. };
  28389. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  28390. },
  28391. args: ["aString"],
  28392. 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 ]",
  28393. referencedClasses: ["Smalltalk"],
  28394. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"]
  28395. }),
  28396. $globals.AmdPackageHandler);
  28397. $core.addMethod(
  28398. $core.method({
  28399. selector: "defaultNamespace",
  28400. protocol: 'commit paths',
  28401. fn: function (){
  28402. var self=this;
  28403. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  28404. return $core.withContext(function($ctx1) {
  28405. return $recv($Smalltalk())._defaultAmdNamespace();
  28406. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.klass)});
  28407. },
  28408. args: [],
  28409. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  28410. referencedClasses: ["Smalltalk"],
  28411. messageSends: ["defaultAmdNamespace"]
  28412. }),
  28413. $globals.AmdPackageHandler.klass);
  28414. $core.addMethod(
  28415. $core.method({
  28416. selector: "defaultNamespace:",
  28417. protocol: 'commit paths',
  28418. fn: function (aString){
  28419. var self=this;
  28420. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  28421. return $core.withContext(function($ctx1) {
  28422. $recv($Smalltalk())._defaultAmdNamespace_(aString);
  28423. return self;
  28424. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.klass)});
  28425. },
  28426. args: ["aString"],
  28427. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  28428. referencedClasses: ["Smalltalk"],
  28429. messageSends: ["defaultAmdNamespace:"]
  28430. }),
  28431. $globals.AmdPackageHandler.klass);
  28432. $core.addClass('PackageTransport', $globals.Object, ['package'], 'Platform-ImportExport');
  28433. $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.";
  28434. $core.addMethod(
  28435. $core.method({
  28436. selector: "asJSON",
  28437. protocol: 'converting',
  28438. fn: function (){
  28439. var self=this;
  28440. return $core.withContext(function($ctx1) {
  28441. return $globals.HashedCollection._newFromPairs_(["type",self._type()]);
  28442. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.PackageTransport)});
  28443. },
  28444. args: [],
  28445. source: "asJSON\x0a\x09^ #{ 'type' -> self type }",
  28446. referencedClasses: [],
  28447. messageSends: ["type"]
  28448. }),
  28449. $globals.PackageTransport);
  28450. $core.addMethod(
  28451. $core.method({
  28452. selector: "commit",
  28453. protocol: 'committing',
  28454. fn: function (){
  28455. var self=this;
  28456. return $core.withContext(function($ctx1) {
  28457. $recv(self._commitHandler())._commit_(self._package());
  28458. return self;
  28459. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  28460. },
  28461. args: [],
  28462. source: "commit\x0a\x09self commitHandler commit: self package",
  28463. referencedClasses: [],
  28464. messageSends: ["commit:", "commitHandler", "package"]
  28465. }),
  28466. $globals.PackageTransport);
  28467. $core.addMethod(
  28468. $core.method({
  28469. selector: "commitHandler",
  28470. protocol: 'factory',
  28471. fn: function (){
  28472. var self=this;
  28473. return $core.withContext(function($ctx1) {
  28474. return $recv(self._commitHandlerClass())._new();
  28475. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  28476. },
  28477. args: [],
  28478. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  28479. referencedClasses: [],
  28480. messageSends: ["new", "commitHandlerClass"]
  28481. }),
  28482. $globals.PackageTransport);
  28483. $core.addMethod(
  28484. $core.method({
  28485. selector: "commitHandlerClass",
  28486. protocol: 'accessing',
  28487. fn: function (){
  28488. var self=this;
  28489. return $core.withContext(function($ctx1) {
  28490. self._subclassResponsibility();
  28491. return self;
  28492. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  28493. },
  28494. args: [],
  28495. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  28496. referencedClasses: [],
  28497. messageSends: ["subclassResponsibility"]
  28498. }),
  28499. $globals.PackageTransport);
  28500. $core.addMethod(
  28501. $core.method({
  28502. selector: "commitOnSuccess:onError:",
  28503. protocol: 'committing',
  28504. fn: function (aBlock,anotherBlock){
  28505. var self=this;
  28506. return $core.withContext(function($ctx1) {
  28507. $recv(self._commitHandler())._commit_onSuccess_onError_(self._package(),aBlock,anotherBlock);
  28508. return self;
  28509. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  28510. },
  28511. args: ["aBlock", "anotherBlock"],
  28512. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  28513. referencedClasses: [],
  28514. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  28515. }),
  28516. $globals.PackageTransport);
  28517. $core.addMethod(
  28518. $core.method({
  28519. selector: "definition",
  28520. protocol: 'accessing',
  28521. fn: function (){
  28522. var self=this;
  28523. return "";
  28524. },
  28525. args: [],
  28526. source: "definition\x0a\x09^ ''",
  28527. referencedClasses: [],
  28528. messageSends: []
  28529. }),
  28530. $globals.PackageTransport);
  28531. $core.addMethod(
  28532. $core.method({
  28533. selector: "load",
  28534. protocol: 'loading',
  28535. fn: function (){
  28536. var self=this;
  28537. return $core.withContext(function($ctx1) {
  28538. $recv(self._commitHandler())._load_(self._package());
  28539. return self;
  28540. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  28541. },
  28542. args: [],
  28543. source: "load\x0a\x09self commitHandler load: self package",
  28544. referencedClasses: [],
  28545. messageSends: ["load:", "commitHandler", "package"]
  28546. }),
  28547. $globals.PackageTransport);
  28548. $core.addMethod(
  28549. $core.method({
  28550. selector: "package",
  28551. protocol: 'accessing',
  28552. fn: function (){
  28553. var self=this;
  28554. return self["@package"];
  28555. },
  28556. args: [],
  28557. source: "package\x0a\x09^ package",
  28558. referencedClasses: [],
  28559. messageSends: []
  28560. }),
  28561. $globals.PackageTransport);
  28562. $core.addMethod(
  28563. $core.method({
  28564. selector: "package:",
  28565. protocol: 'accessing',
  28566. fn: function (aPackage){
  28567. var self=this;
  28568. self["@package"]=aPackage;
  28569. return self;
  28570. },
  28571. args: ["aPackage"],
  28572. source: "package: aPackage\x0a\x09package := aPackage",
  28573. referencedClasses: [],
  28574. messageSends: []
  28575. }),
  28576. $globals.PackageTransport);
  28577. $core.addMethod(
  28578. $core.method({
  28579. selector: "setupFromJson:",
  28580. protocol: 'initialization',
  28581. fn: function (anObject){
  28582. var self=this;
  28583. return self;
  28584. },
  28585. args: ["anObject"],
  28586. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  28587. referencedClasses: [],
  28588. messageSends: []
  28589. }),
  28590. $globals.PackageTransport);
  28591. $core.addMethod(
  28592. $core.method({
  28593. selector: "type",
  28594. protocol: 'accessing',
  28595. fn: function (){
  28596. var self=this;
  28597. return $core.withContext(function($ctx1) {
  28598. return $recv(self._class())._type();
  28599. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  28600. },
  28601. args: [],
  28602. source: "type\x0a\x09^ self class type",
  28603. referencedClasses: [],
  28604. messageSends: ["type", "class"]
  28605. }),
  28606. $globals.PackageTransport);
  28607. $globals.PackageTransport.klass.iVarNames = ['registry'];
  28608. $core.addMethod(
  28609. $core.method({
  28610. selector: "classRegisteredFor:",
  28611. protocol: 'accessing',
  28612. fn: function (aString){
  28613. var self=this;
  28614. return $core.withContext(function($ctx1) {
  28615. return $recv(self["@registry"])._at_(aString);
  28616. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.klass)});
  28617. },
  28618. args: ["aString"],
  28619. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  28620. referencedClasses: [],
  28621. messageSends: ["at:"]
  28622. }),
  28623. $globals.PackageTransport.klass);
  28624. $core.addMethod(
  28625. $core.method({
  28626. selector: "defaultType",
  28627. protocol: 'accessing',
  28628. fn: function (){
  28629. var self=this;
  28630. function $AmdPackageTransport(){return $globals.AmdPackageTransport||(typeof AmdPackageTransport=="undefined"?nil:AmdPackageTransport)}
  28631. return $core.withContext(function($ctx1) {
  28632. return $recv($AmdPackageTransport())._type();
  28633. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.klass)});
  28634. },
  28635. args: [],
  28636. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  28637. referencedClasses: ["AmdPackageTransport"],
  28638. messageSends: ["type"]
  28639. }),
  28640. $globals.PackageTransport.klass);
  28641. $core.addMethod(
  28642. $core.method({
  28643. selector: "for:",
  28644. protocol: 'instance creation',
  28645. fn: function (aString){
  28646. var self=this;
  28647. return $core.withContext(function($ctx1) {
  28648. return $recv(self._classRegisteredFor_(aString))._new();
  28649. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.klass)});
  28650. },
  28651. args: ["aString"],
  28652. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  28653. referencedClasses: [],
  28654. messageSends: ["new", "classRegisteredFor:"]
  28655. }),
  28656. $globals.PackageTransport.klass);
  28657. $core.addMethod(
  28658. $core.method({
  28659. selector: "fromJson:",
  28660. protocol: 'instance creation',
  28661. fn: function (anObject){
  28662. var self=this;
  28663. return $core.withContext(function($ctx1) {
  28664. var $1,$2,$receiver;
  28665. if(($receiver = anObject) == null || $receiver.isNil){
  28666. $1=self._for_(self._defaultType());
  28667. $ctx1.sendIdx["for:"]=1;
  28668. return $1;
  28669. } else {
  28670. anObject;
  28671. };
  28672. $2=self._for_($recv(anObject)._type());
  28673. $recv($2)._setupFromJson_(anObject);
  28674. return $recv($2)._yourself();
  28675. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.klass)});
  28676. },
  28677. args: ["anObject"],
  28678. 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",
  28679. referencedClasses: [],
  28680. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  28681. }),
  28682. $globals.PackageTransport.klass);
  28683. $core.addMethod(
  28684. $core.method({
  28685. selector: "initialize",
  28686. protocol: 'initialization',
  28687. fn: function (){
  28688. var self=this;
  28689. function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  28690. return $core.withContext(function($ctx1) {
  28691. var $1;
  28692. (
  28693. $ctx1.supercall = true,
  28694. ($globals.PackageTransport.klass.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  28695. $ctx1.supercall = false;
  28696. $1=self.__eq_eq($PackageTransport());
  28697. if($core.assert($1)){
  28698. self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  28699. self["@registry"];
  28700. } else {
  28701. self._register();
  28702. };
  28703. return self;
  28704. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.klass)});
  28705. },
  28706. args: [],
  28707. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  28708. referencedClasses: ["PackageTransport"],
  28709. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  28710. }),
  28711. $globals.PackageTransport.klass);
  28712. $core.addMethod(
  28713. $core.method({
  28714. selector: "register",
  28715. protocol: 'registration',
  28716. fn: function (){
  28717. var self=this;
  28718. function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  28719. return $core.withContext(function($ctx1) {
  28720. $recv($PackageTransport())._register_(self);
  28721. return self;
  28722. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.klass)});
  28723. },
  28724. args: [],
  28725. source: "register\x0a\x09PackageTransport register: self",
  28726. referencedClasses: ["PackageTransport"],
  28727. messageSends: ["register:"]
  28728. }),
  28729. $globals.PackageTransport.klass);
  28730. $core.addMethod(
  28731. $core.method({
  28732. selector: "register:",
  28733. protocol: 'registration',
  28734. fn: function (aClass){
  28735. var self=this;
  28736. return $core.withContext(function($ctx1) {
  28737. var $1,$receiver;
  28738. $1=$recv(aClass)._type();
  28739. $ctx1.sendIdx["type"]=1;
  28740. if(($receiver = $1) == null || $receiver.isNil){
  28741. $1;
  28742. } else {
  28743. $recv(self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  28744. };
  28745. return self;
  28746. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.klass)});
  28747. },
  28748. args: ["aClass"],
  28749. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  28750. referencedClasses: [],
  28751. messageSends: ["ifNotNil:", "type", "at:put:"]
  28752. }),
  28753. $globals.PackageTransport.klass);
  28754. $core.addMethod(
  28755. $core.method({
  28756. selector: "type",
  28757. protocol: 'accessing',
  28758. fn: function (){
  28759. var self=this;
  28760. return nil;
  28761. },
  28762. args: [],
  28763. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  28764. referencedClasses: [],
  28765. messageSends: []
  28766. }),
  28767. $globals.PackageTransport.klass);
  28768. $core.addClass('AmdPackageTransport', $globals.PackageTransport, ['namespace'], 'Platform-ImportExport');
  28769. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  28770. $core.addMethod(
  28771. $core.method({
  28772. selector: "asJSON",
  28773. protocol: 'converting',
  28774. fn: function (){
  28775. var self=this;
  28776. return $core.withContext(function($ctx1) {
  28777. var $1;
  28778. $1=(
  28779. $ctx1.supercall = true,
  28780. ($globals.AmdPackageTransport.superclass||$boot.dnu).fn.prototype._asJSON.apply($recv(self), []));
  28781. $ctx1.supercall = false;
  28782. $recv($1)._at_put_("amdNamespace",self._namespace());
  28783. return $recv($1)._yourself();
  28784. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.AmdPackageTransport)});
  28785. },
  28786. args: [],
  28787. source: "asJSON\x0a\x09^ super asJSON\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  28788. referencedClasses: [],
  28789. messageSends: ["at:put:", "asJSON", "namespace", "yourself"]
  28790. }),
  28791. $globals.AmdPackageTransport);
  28792. $core.addMethod(
  28793. $core.method({
  28794. selector: "commitHandlerClass",
  28795. protocol: 'accessing',
  28796. fn: function (){
  28797. var self=this;
  28798. function $AmdPackageHandler(){return $globals.AmdPackageHandler||(typeof AmdPackageHandler=="undefined"?nil:AmdPackageHandler)}
  28799. return $AmdPackageHandler();
  28800. },
  28801. args: [],
  28802. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  28803. referencedClasses: ["AmdPackageHandler"],
  28804. messageSends: []
  28805. }),
  28806. $globals.AmdPackageTransport);
  28807. $core.addMethod(
  28808. $core.method({
  28809. selector: "defaultNamespace",
  28810. protocol: 'defaults',
  28811. fn: function (){
  28812. var self=this;
  28813. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  28814. return $core.withContext(function($ctx1) {
  28815. return $recv($Smalltalk())._defaultAmdNamespace();
  28816. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  28817. },
  28818. args: [],
  28819. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  28820. referencedClasses: ["Smalltalk"],
  28821. messageSends: ["defaultAmdNamespace"]
  28822. }),
  28823. $globals.AmdPackageTransport);
  28824. $core.addMethod(
  28825. $core.method({
  28826. selector: "definition",
  28827. protocol: 'accessing',
  28828. fn: function (){
  28829. var self=this;
  28830. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  28831. return $core.withContext(function($ctx1) {
  28832. var $1;
  28833. return $recv($String())._streamContents_((function(stream){
  28834. return $core.withContext(function($ctx2) {
  28835. $recv(stream)._nextPutAll_($recv(self._class())._name());
  28836. $ctx2.sendIdx["nextPutAll:"]=1;
  28837. $recv(stream)._nextPutAll_(" namespace: ");
  28838. $ctx2.sendIdx["nextPutAll:"]=2;
  28839. $1=$recv("'".__comma(self._namespace())).__comma("'");
  28840. $ctx2.sendIdx[","]=1;
  28841. return $recv(stream)._nextPutAll_($1);
  28842. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  28843. }));
  28844. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  28845. },
  28846. args: [],
  28847. 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, '''' ]",
  28848. referencedClasses: ["String"],
  28849. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "namespace"]
  28850. }),
  28851. $globals.AmdPackageTransport);
  28852. $core.addMethod(
  28853. $core.method({
  28854. selector: "namespace",
  28855. protocol: 'accessing',
  28856. fn: function (){
  28857. var self=this;
  28858. return $core.withContext(function($ctx1) {
  28859. var $1,$receiver;
  28860. $1=self["@namespace"];
  28861. if(($receiver = $1) == null || $receiver.isNil){
  28862. return self._defaultNamespace();
  28863. } else {
  28864. return $1;
  28865. };
  28866. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  28867. },
  28868. args: [],
  28869. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  28870. referencedClasses: [],
  28871. messageSends: ["ifNil:", "defaultNamespace"]
  28872. }),
  28873. $globals.AmdPackageTransport);
  28874. $core.addMethod(
  28875. $core.method({
  28876. selector: "namespace:",
  28877. protocol: 'accessing',
  28878. fn: function (aString){
  28879. var self=this;
  28880. self["@namespace"]=aString;
  28881. return self;
  28882. },
  28883. args: ["aString"],
  28884. source: "namespace: aString\x0a\x09namespace := aString",
  28885. referencedClasses: [],
  28886. messageSends: []
  28887. }),
  28888. $globals.AmdPackageTransport);
  28889. $core.addMethod(
  28890. $core.method({
  28891. selector: "printOn:",
  28892. protocol: 'printing',
  28893. fn: function (aStream){
  28894. var self=this;
  28895. return $core.withContext(function($ctx1) {
  28896. (
  28897. $ctx1.supercall = true,
  28898. ($globals.AmdPackageTransport.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  28899. $ctx1.supercall = false;
  28900. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  28901. $ctx1.sendIdx["nextPutAll:"]=1;
  28902. $recv(aStream)._nextPutAll_(self._namespace());
  28903. $ctx1.sendIdx["nextPutAll:"]=2;
  28904. $recv(aStream)._nextPutAll_(")");
  28905. return self;
  28906. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  28907. },
  28908. args: ["aStream"],
  28909. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  28910. referencedClasses: [],
  28911. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  28912. }),
  28913. $globals.AmdPackageTransport);
  28914. $core.addMethod(
  28915. $core.method({
  28916. selector: "setPath:",
  28917. protocol: 'actions',
  28918. fn: function (aString){
  28919. var self=this;
  28920. return $core.withContext(function($ctx1) {
  28921. $recv($recv(require)._basicAt_("config"))._value_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([self._namespace(),aString])]));
  28922. return self;
  28923. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  28924. },
  28925. args: ["aString"],
  28926. 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}.",
  28927. referencedClasses: [],
  28928. messageSends: ["value:", "basicAt:", "namespace"]
  28929. }),
  28930. $globals.AmdPackageTransport);
  28931. $core.addMethod(
  28932. $core.method({
  28933. selector: "setupFromJson:",
  28934. protocol: 'initialization',
  28935. fn: function (anObject){
  28936. var self=this;
  28937. return $core.withContext(function($ctx1) {
  28938. self._namespace_($recv(anObject)._at_("amdNamespace"));
  28939. return self;
  28940. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  28941. },
  28942. args: ["anObject"],
  28943. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  28944. referencedClasses: [],
  28945. messageSends: ["namespace:", "at:"]
  28946. }),
  28947. $globals.AmdPackageTransport);
  28948. $core.addMethod(
  28949. $core.method({
  28950. selector: "namespace:",
  28951. protocol: 'instance creation',
  28952. fn: function (aString){
  28953. var self=this;
  28954. return $core.withContext(function($ctx1) {
  28955. var $1;
  28956. $1=self._new();
  28957. $recv($1)._namespace_(aString);
  28958. return $recv($1)._yourself();
  28959. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.klass)});
  28960. },
  28961. args: ["aString"],
  28962. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  28963. referencedClasses: [],
  28964. messageSends: ["namespace:", "new", "yourself"]
  28965. }),
  28966. $globals.AmdPackageTransport.klass);
  28967. $core.addMethod(
  28968. $core.method({
  28969. selector: "type",
  28970. protocol: 'accessing',
  28971. fn: function (){
  28972. var self=this;
  28973. return "amd";
  28974. },
  28975. args: [],
  28976. source: "type\x0a\x09^ 'amd'",
  28977. referencedClasses: [],
  28978. messageSends: []
  28979. }),
  28980. $globals.AmdPackageTransport.klass);
  28981. $core.addMethod(
  28982. $core.method({
  28983. selector: "commentStamp",
  28984. protocol: '*Platform-ImportExport',
  28985. fn: function (){
  28986. var self=this;
  28987. function $ClassCommentReader(){return $globals.ClassCommentReader||(typeof ClassCommentReader=="undefined"?nil:ClassCommentReader)}
  28988. return $core.withContext(function($ctx1) {
  28989. var $1;
  28990. $1=$recv($ClassCommentReader())._new();
  28991. $recv($1)._class_(self);
  28992. return $recv($1)._yourself();
  28993. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.Behavior)});
  28994. },
  28995. args: [],
  28996. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  28997. referencedClasses: ["ClassCommentReader"],
  28998. messageSends: ["class:", "new", "yourself"]
  28999. }),
  29000. $globals.Behavior);
  29001. $core.addMethod(
  29002. $core.method({
  29003. selector: "commentStamp:prior:",
  29004. protocol: '*Platform-ImportExport',
  29005. fn: function (aStamp,prior){
  29006. var self=this;
  29007. return $core.withContext(function($ctx1) {
  29008. return self._commentStamp();
  29009. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.Behavior)});
  29010. },
  29011. args: ["aStamp", "prior"],
  29012. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  29013. referencedClasses: [],
  29014. messageSends: ["commentStamp"]
  29015. }),
  29016. $globals.Behavior);
  29017. $core.addMethod(
  29018. $core.method({
  29019. selector: "methodsFor:",
  29020. protocol: '*Platform-ImportExport',
  29021. fn: function (aString){
  29022. var self=this;
  29023. function $ClassProtocolReader(){return $globals.ClassProtocolReader||(typeof ClassProtocolReader=="undefined"?nil:ClassProtocolReader)}
  29024. return $core.withContext(function($ctx1) {
  29025. var $1;
  29026. $1=$recv($ClassProtocolReader())._new();
  29027. $recv($1)._class_category_(self,aString);
  29028. return $recv($1)._yourself();
  29029. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.Behavior)});
  29030. },
  29031. args: ["aString"],
  29032. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  29033. referencedClasses: ["ClassProtocolReader"],
  29034. messageSends: ["class:category:", "new", "yourself"]
  29035. }),
  29036. $globals.Behavior);
  29037. $core.addMethod(
  29038. $core.method({
  29039. selector: "methodsFor:stamp:",
  29040. protocol: '*Platform-ImportExport',
  29041. fn: function (aString,aStamp){
  29042. var self=this;
  29043. return $core.withContext(function($ctx1) {
  29044. return self._methodsFor_(aString);
  29045. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.Behavior)});
  29046. },
  29047. args: ["aString", "aStamp"],
  29048. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  29049. referencedClasses: [],
  29050. messageSends: ["methodsFor:"]
  29051. }),
  29052. $globals.Behavior);
  29053. $core.addMethod(
  29054. $core.method({
  29055. selector: "commit",
  29056. protocol: '*Platform-ImportExport',
  29057. fn: function (){
  29058. var self=this;
  29059. return $core.withContext(function($ctx1) {
  29060. return $recv(self._transport())._commit();
  29061. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  29062. },
  29063. args: [],
  29064. source: "commit\x0a\x09^ self transport commit",
  29065. referencedClasses: [],
  29066. messageSends: ["commit", "transport"]
  29067. }),
  29068. $globals.Package);
  29069. $core.addMethod(
  29070. $core.method({
  29071. selector: "load",
  29072. protocol: '*Platform-ImportExport',
  29073. fn: function (){
  29074. var self=this;
  29075. return $core.withContext(function($ctx1) {
  29076. return $recv(self._transport())._load();
  29077. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  29078. },
  29079. args: [],
  29080. source: "load\x0a\x09^ self transport load",
  29081. referencedClasses: [],
  29082. messageSends: ["load", "transport"]
  29083. }),
  29084. $globals.Package);
  29085. $core.addMethod(
  29086. $core.method({
  29087. selector: "loadFromNamespace:",
  29088. protocol: '*Platform-ImportExport',
  29089. fn: function (aString){
  29090. var self=this;
  29091. return $core.withContext(function($ctx1) {
  29092. var $1;
  29093. $1=self._transport();
  29094. $recv($1)._namespace_(aString);
  29095. return $recv($1)._load();
  29096. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  29097. },
  29098. args: ["aString"],
  29099. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  29100. referencedClasses: [],
  29101. messageSends: ["namespace:", "transport", "load"]
  29102. }),
  29103. $globals.Package);
  29104. $core.addMethod(
  29105. $core.method({
  29106. selector: "load:",
  29107. protocol: '*Platform-ImportExport',
  29108. fn: function (aPackageName){
  29109. var self=this;
  29110. return $core.withContext(function($ctx1) {
  29111. $recv(self._named_(aPackageName))._load();
  29112. return self;
  29113. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.klass)});
  29114. },
  29115. args: ["aPackageName"],
  29116. source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
  29117. referencedClasses: [],
  29118. messageSends: ["load", "named:"]
  29119. }),
  29120. $globals.Package.klass);
  29121. $core.addMethod(
  29122. $core.method({
  29123. selector: "load:fromNamespace:",
  29124. protocol: '*Platform-ImportExport',
  29125. fn: function (aPackageName,aString){
  29126. var self=this;
  29127. return $core.withContext(function($ctx1) {
  29128. $recv(self._named_(aPackageName))._loadFromNamespace_(aString);
  29129. return self;
  29130. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.klass)});
  29131. },
  29132. args: ["aPackageName", "aString"],
  29133. source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
  29134. referencedClasses: [],
  29135. messageSends: ["loadFromNamespace:", "named:"]
  29136. }),
  29137. $globals.Package.klass);
  29138. });
  29139. define("amber_core/Compiler-Core", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Platform-Services", "amber_core/Kernel-Collections"], function($boot){"use strict";
  29140. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  29141. $core.addPackage('Compiler-Core');
  29142. $core.packages["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
  29143. $core.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  29144. $core.addClass('AbstractCodeGenerator', $globals.Object, ['currentClass', 'currentPackage', 'source'], 'Compiler-Core');
  29145. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  29146. $core.addMethod(
  29147. $core.method({
  29148. selector: "classNameFor:",
  29149. protocol: 'accessing',
  29150. fn: function (aClass){
  29151. var self=this;
  29152. return $core.withContext(function($ctx1) {
  29153. var $2,$3,$4,$1;
  29154. $2=$recv(aClass)._isMetaclass();
  29155. if($core.assert($2)){
  29156. $3=$recv($recv(aClass)._instanceClass())._name();
  29157. $ctx1.sendIdx["name"]=1;
  29158. $1=$recv($3).__comma(".klass");
  29159. } else {
  29160. $4=$recv(aClass)._isNil();
  29161. if($core.assert($4)){
  29162. $1="nil";
  29163. } else {
  29164. $1=$recv(aClass)._name();
  29165. };
  29166. };
  29167. return $1;
  29168. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractCodeGenerator)});
  29169. },
  29170. args: ["aClass"],
  29171. 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 ]]",
  29172. referencedClasses: [],
  29173. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"]
  29174. }),
  29175. $globals.AbstractCodeGenerator);
  29176. $core.addMethod(
  29177. $core.method({
  29178. selector: "compileNode:",
  29179. protocol: 'compiling',
  29180. fn: function (aNode){
  29181. var self=this;
  29182. return $core.withContext(function($ctx1) {
  29183. self._subclassResponsibility();
  29184. return self;
  29185. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  29186. },
  29187. args: ["aNode"],
  29188. source: "compileNode: aNode\x0a\x09self subclassResponsibility",
  29189. referencedClasses: [],
  29190. messageSends: ["subclassResponsibility"]
  29191. }),
  29192. $globals.AbstractCodeGenerator);
  29193. $core.addMethod(
  29194. $core.method({
  29195. selector: "currentClass",
  29196. protocol: 'accessing',
  29197. fn: function (){
  29198. var self=this;
  29199. return self["@currentClass"];
  29200. },
  29201. args: [],
  29202. source: "currentClass\x0a\x09^ currentClass",
  29203. referencedClasses: [],
  29204. messageSends: []
  29205. }),
  29206. $globals.AbstractCodeGenerator);
  29207. $core.addMethod(
  29208. $core.method({
  29209. selector: "currentClass:",
  29210. protocol: 'accessing',
  29211. fn: function (aClass){
  29212. var self=this;
  29213. self["@currentClass"]=aClass;
  29214. return self;
  29215. },
  29216. args: ["aClass"],
  29217. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  29218. referencedClasses: [],
  29219. messageSends: []
  29220. }),
  29221. $globals.AbstractCodeGenerator);
  29222. $core.addMethod(
  29223. $core.method({
  29224. selector: "currentPackage",
  29225. protocol: 'accessing',
  29226. fn: function (){
  29227. var self=this;
  29228. return self["@currentPackage"];
  29229. },
  29230. args: [],
  29231. source: "currentPackage\x0a\x09^ currentPackage",
  29232. referencedClasses: [],
  29233. messageSends: []
  29234. }),
  29235. $globals.AbstractCodeGenerator);
  29236. $core.addMethod(
  29237. $core.method({
  29238. selector: "currentPackage:",
  29239. protocol: 'accessing',
  29240. fn: function (anObject){
  29241. var self=this;
  29242. self["@currentPackage"]=anObject;
  29243. return self;
  29244. },
  29245. args: ["anObject"],
  29246. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  29247. referencedClasses: [],
  29248. messageSends: []
  29249. }),
  29250. $globals.AbstractCodeGenerator);
  29251. $core.addMethod(
  29252. $core.method({
  29253. selector: "pseudoVariables",
  29254. protocol: 'accessing',
  29255. fn: function (){
  29256. var self=this;
  29257. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29258. return $core.withContext(function($ctx1) {
  29259. return $recv($Smalltalk())._pseudoVariableNames();
  29260. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  29261. },
  29262. args: [],
  29263. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  29264. referencedClasses: ["Smalltalk"],
  29265. messageSends: ["pseudoVariableNames"]
  29266. }),
  29267. $globals.AbstractCodeGenerator);
  29268. $core.addMethod(
  29269. $core.method({
  29270. selector: "source",
  29271. protocol: 'accessing',
  29272. fn: function (){
  29273. var self=this;
  29274. return $core.withContext(function($ctx1) {
  29275. var $1,$receiver;
  29276. $1=self["@source"];
  29277. if(($receiver = $1) == null || $receiver.isNil){
  29278. return "";
  29279. } else {
  29280. return $1;
  29281. };
  29282. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  29283. },
  29284. args: [],
  29285. source: "source\x0a\x09^ source ifNil: [ '' ]",
  29286. referencedClasses: [],
  29287. messageSends: ["ifNil:"]
  29288. }),
  29289. $globals.AbstractCodeGenerator);
  29290. $core.addMethod(
  29291. $core.method({
  29292. selector: "source:",
  29293. protocol: 'accessing',
  29294. fn: function (aString){
  29295. var self=this;
  29296. self["@source"]=aString;
  29297. return self;
  29298. },
  29299. args: ["aString"],
  29300. source: "source: aString\x0a\x09source := aString",
  29301. referencedClasses: [],
  29302. messageSends: []
  29303. }),
  29304. $globals.AbstractCodeGenerator);
  29305. $core.addClass('CodeGenerator', $globals.AbstractCodeGenerator, [], 'Compiler-Core');
  29306. $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.";
  29307. $core.addMethod(
  29308. $core.method({
  29309. selector: "compileNode:",
  29310. protocol: 'compiling',
  29311. fn: function (aNode){
  29312. var self=this;
  29313. var ir,stream;
  29314. return $core.withContext(function($ctx1) {
  29315. var $1;
  29316. $recv(self._semanticAnalyzer())._visit_(aNode);
  29317. $ctx1.sendIdx["visit:"]=1;
  29318. ir=$recv(self._translator())._visit_(aNode);
  29319. $ctx1.sendIdx["visit:"]=2;
  29320. $1=self._irTranslator();
  29321. $recv($1)._currentClass_(self._currentClass());
  29322. $recv($1)._visit_(ir);
  29323. return $recv($1)._contents();
  29324. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.CodeGenerator)});
  29325. },
  29326. args: ["aNode"],
  29327. 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",
  29328. referencedClasses: [],
  29329. messageSends: ["visit:", "semanticAnalyzer", "translator", "currentClass:", "irTranslator", "currentClass", "contents"]
  29330. }),
  29331. $globals.CodeGenerator);
  29332. $core.addMethod(
  29333. $core.method({
  29334. selector: "irTranslator",
  29335. protocol: 'compiling',
  29336. fn: function (){
  29337. var self=this;
  29338. function $IRJSTranslator(){return $globals.IRJSTranslator||(typeof IRJSTranslator=="undefined"?nil:IRJSTranslator)}
  29339. return $core.withContext(function($ctx1) {
  29340. return $recv($IRJSTranslator())._new();
  29341. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  29342. },
  29343. args: [],
  29344. source: "irTranslator\x0a\x09^ IRJSTranslator new",
  29345. referencedClasses: ["IRJSTranslator"],
  29346. messageSends: ["new"]
  29347. }),
  29348. $globals.CodeGenerator);
  29349. $core.addMethod(
  29350. $core.method({
  29351. selector: "semanticAnalyzer",
  29352. protocol: 'compiling',
  29353. fn: function (){
  29354. var self=this;
  29355. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  29356. return $core.withContext(function($ctx1) {
  29357. var $1;
  29358. $1=$recv($SemanticAnalyzer())._on_(self._currentClass());
  29359. $recv($1)._thePackage_(self._currentPackage());
  29360. return $recv($1)._yourself();
  29361. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  29362. },
  29363. args: [],
  29364. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  29365. referencedClasses: ["SemanticAnalyzer"],
  29366. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  29367. }),
  29368. $globals.CodeGenerator);
  29369. $core.addMethod(
  29370. $core.method({
  29371. selector: "translator",
  29372. protocol: 'compiling',
  29373. fn: function (){
  29374. var self=this;
  29375. function $IRASTTranslator(){return $globals.IRASTTranslator||(typeof IRASTTranslator=="undefined"?nil:IRASTTranslator)}
  29376. return $core.withContext(function($ctx1) {
  29377. var $1;
  29378. $1=$recv($IRASTTranslator())._new();
  29379. $recv($1)._source_(self._source());
  29380. $recv($1)._theClass_(self._currentClass());
  29381. return $recv($1)._yourself();
  29382. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  29383. },
  29384. args: [],
  29385. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  29386. referencedClasses: ["IRASTTranslator"],
  29387. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  29388. }),
  29389. $globals.CodeGenerator);
  29390. $core.addClass('Compiler', $globals.Object, ['currentClass', 'currentPackage', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
  29391. $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`";
  29392. $core.addMethod(
  29393. $core.method({
  29394. selector: "codeGeneratorClass",
  29395. protocol: 'accessing',
  29396. fn: function (){
  29397. var self=this;
  29398. function $InliningCodeGenerator(){return $globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  29399. return $core.withContext(function($ctx1) {
  29400. var $1,$receiver;
  29401. $1=self["@codeGeneratorClass"];
  29402. if(($receiver = $1) == null || $receiver.isNil){
  29403. return $InliningCodeGenerator();
  29404. } else {
  29405. return $1;
  29406. };
  29407. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  29408. },
  29409. args: [],
  29410. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  29411. referencedClasses: ["InliningCodeGenerator"],
  29412. messageSends: ["ifNil:"]
  29413. }),
  29414. $globals.Compiler);
  29415. $core.addMethod(
  29416. $core.method({
  29417. selector: "codeGeneratorClass:",
  29418. protocol: 'accessing',
  29419. fn: function (aClass){
  29420. var self=this;
  29421. self["@codeGeneratorClass"]=aClass;
  29422. return self;
  29423. },
  29424. args: ["aClass"],
  29425. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  29426. referencedClasses: [],
  29427. messageSends: []
  29428. }),
  29429. $globals.Compiler);
  29430. $core.addMethod(
  29431. $core.method({
  29432. selector: "compile:forClass:protocol:",
  29433. protocol: 'compiling',
  29434. fn: function (aString,aClass,anotherString){
  29435. var self=this;
  29436. return $core.withContext(function($ctx1) {
  29437. self._source_(aString);
  29438. return self._compileNode_forClass_package_(self._parse_(aString),aClass,$recv(aClass)._packageOfProtocol_(anotherString));
  29439. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  29440. },
  29441. args: ["aString", "aClass", "anotherString"],
  29442. 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)",
  29443. referencedClasses: [],
  29444. messageSends: ["source:", "compileNode:forClass:package:", "parse:", "packageOfProtocol:"]
  29445. }),
  29446. $globals.Compiler);
  29447. $core.addMethod(
  29448. $core.method({
  29449. selector: "compileExpression:on:",
  29450. protocol: 'compiling',
  29451. fn: function (aString,anObject){
  29452. var self=this;
  29453. return $core.withContext(function($ctx1) {
  29454. var $1;
  29455. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  29456. $ctx1.sendIdx[","]=1;
  29457. return self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  29458. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  29459. },
  29460. args: ["aString", "anObject"],
  29461. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  29462. referencedClasses: [],
  29463. messageSends: ["compile:forClass:protocol:", ",", "class"]
  29464. }),
  29465. $globals.Compiler);
  29466. $core.addMethod(
  29467. $core.method({
  29468. selector: "compileNode:",
  29469. protocol: 'compiling',
  29470. fn: function (aNode){
  29471. var self=this;
  29472. var generator,result;
  29473. return $core.withContext(function($ctx1) {
  29474. var $1;
  29475. generator=$recv(self._codeGeneratorClass())._new();
  29476. $1=generator;
  29477. $recv($1)._source_(self._source());
  29478. $recv($1)._currentClass_(self._currentClass());
  29479. $recv($1)._currentPackage_(self._currentPackage());
  29480. result=$recv(generator)._compileNode_(aNode);
  29481. self._unknownVariables_([]);
  29482. return result;
  29483. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},$globals.Compiler)});
  29484. },
  29485. args: ["aNode"],
  29486. 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",
  29487. referencedClasses: [],
  29488. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "compileNode:", "unknownVariables:"]
  29489. }),
  29490. $globals.Compiler);
  29491. $core.addMethod(
  29492. $core.method({
  29493. selector: "compileNode:forClass:package:",
  29494. protocol: 'compiling',
  29495. fn: function (aNode,aClass,aPackage){
  29496. var self=this;
  29497. return $core.withContext(function($ctx1) {
  29498. self._currentClass_(aClass);
  29499. self._currentPackage_(aPackage);
  29500. return self._compileNode_(aNode);
  29501. }, function($ctx1) {$ctx1.fill(self,"compileNode:forClass:package:",{aNode:aNode,aClass:aClass,aPackage:aPackage},$globals.Compiler)});
  29502. },
  29503. args: ["aNode", "aClass", "aPackage"],
  29504. source: "compileNode: aNode forClass: aClass package: aPackage\x0a\x09^ self\x0a\x09\x09currentClass: aClass;\x0a\x09\x09currentPackage: aPackage;\x0a\x09\x09compileNode: aNode",
  29505. referencedClasses: [],
  29506. messageSends: ["currentClass:", "currentPackage:", "compileNode:"]
  29507. }),
  29508. $globals.Compiler);
  29509. $core.addMethod(
  29510. $core.method({
  29511. selector: "currentClass",
  29512. protocol: 'accessing',
  29513. fn: function (){
  29514. var self=this;
  29515. return self["@currentClass"];
  29516. },
  29517. args: [],
  29518. source: "currentClass\x0a\x09^ currentClass",
  29519. referencedClasses: [],
  29520. messageSends: []
  29521. }),
  29522. $globals.Compiler);
  29523. $core.addMethod(
  29524. $core.method({
  29525. selector: "currentClass:",
  29526. protocol: 'accessing',
  29527. fn: function (aClass){
  29528. var self=this;
  29529. self["@currentClass"]=aClass;
  29530. return self;
  29531. },
  29532. args: ["aClass"],
  29533. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  29534. referencedClasses: [],
  29535. messageSends: []
  29536. }),
  29537. $globals.Compiler);
  29538. $core.addMethod(
  29539. $core.method({
  29540. selector: "currentPackage",
  29541. protocol: 'accessing',
  29542. fn: function (){
  29543. var self=this;
  29544. return self["@currentPackage"];
  29545. },
  29546. args: [],
  29547. source: "currentPackage\x0a\x09^ currentPackage",
  29548. referencedClasses: [],
  29549. messageSends: []
  29550. }),
  29551. $globals.Compiler);
  29552. $core.addMethod(
  29553. $core.method({
  29554. selector: "currentPackage:",
  29555. protocol: 'accessing',
  29556. fn: function (anObject){
  29557. var self=this;
  29558. self["@currentPackage"]=anObject;
  29559. return self;
  29560. },
  29561. args: ["anObject"],
  29562. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  29563. referencedClasses: [],
  29564. messageSends: []
  29565. }),
  29566. $globals.Compiler);
  29567. $core.addMethod(
  29568. $core.method({
  29569. selector: "eval:",
  29570. protocol: 'compiling',
  29571. fn: function (aString){
  29572. var self=this;
  29573. return $core.withContext(function($ctx1) {
  29574. return eval(aString);
  29575. return self;
  29576. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  29577. },
  29578. args: ["aString"],
  29579. source: "eval: aString\x0a\x09<return eval(aString)>",
  29580. referencedClasses: [],
  29581. messageSends: []
  29582. }),
  29583. $globals.Compiler);
  29584. $core.addMethod(
  29585. $core.method({
  29586. selector: "eval:forPackage:",
  29587. protocol: 'compiling',
  29588. fn: function (aString,aPackage){
  29589. var self=this;
  29590. return $core.withContext(function($ctx1) {
  29591. return aPackage && aPackage.innerEval
  29592. ? aPackage.innerEval(aString)
  29593. : eval(aString);
  29594. return self;
  29595. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  29596. },
  29597. args: ["aString", "aPackage"],
  29598. source: "eval: aString forPackage: aPackage\x0a\x09<return aPackage && aPackage.innerEval\x0a\x09\x09? aPackage.innerEval(aString)\x0a\x09\x09: eval(aString)>",
  29599. referencedClasses: [],
  29600. messageSends: []
  29601. }),
  29602. $globals.Compiler);
  29603. $core.addMethod(
  29604. $core.method({
  29605. selector: "evaluateExpression:",
  29606. protocol: 'compiling',
  29607. fn: function (aString){
  29608. var self=this;
  29609. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  29610. return $core.withContext(function($ctx1) {
  29611. return self._evaluateExpression_on_(aString,$recv($DoIt())._new());
  29612. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  29613. },
  29614. args: ["aString"],
  29615. 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",
  29616. referencedClasses: ["DoIt"],
  29617. messageSends: ["evaluateExpression:on:", "new"]
  29618. }),
  29619. $globals.Compiler);
  29620. $core.addMethod(
  29621. $core.method({
  29622. selector: "evaluateExpression:on:",
  29623. protocol: 'compiling',
  29624. fn: function (aString,anObject){
  29625. var self=this;
  29626. var result,method;
  29627. return $core.withContext(function($ctx1) {
  29628. var $1;
  29629. method=self._eval_(self._compileExpression_on_(aString,anObject));
  29630. $recv(method)._protocol_("**xxxDoIt");
  29631. $1=$recv(anObject)._class();
  29632. $ctx1.sendIdx["class"]=1;
  29633. $recv($1)._addCompiledMethod_(method);
  29634. result=$recv(anObject)._xxxDoIt();
  29635. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  29636. return result;
  29637. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  29638. },
  29639. args: ["aString", "anObject"],
  29640. 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",
  29641. referencedClasses: [],
  29642. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  29643. }),
  29644. $globals.Compiler);
  29645. $core.addMethod(
  29646. $core.method({
  29647. selector: "install:forClass:protocol:",
  29648. protocol: 'compiling',
  29649. fn: function (aString,aBehavior,anotherString){
  29650. var self=this;
  29651. var compiledMethod;
  29652. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  29653. return $core.withContext(function($ctx1) {
  29654. compiledMethod=self._eval_forPackage_(self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  29655. return $recv($recv($ClassBuilder())._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  29656. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  29657. },
  29658. args: ["aString", "aBehavior", "anotherString"],
  29659. 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",
  29660. referencedClasses: ["ClassBuilder"],
  29661. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  29662. }),
  29663. $globals.Compiler);
  29664. $core.addMethod(
  29665. $core.method({
  29666. selector: "parse:",
  29667. protocol: 'compiling',
  29668. fn: function (aString){
  29669. var self=this;
  29670. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29671. return $core.withContext(function($ctx1) {
  29672. return $recv($Smalltalk())._parse_(aString);
  29673. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  29674. },
  29675. args: ["aString"],
  29676. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  29677. referencedClasses: ["Smalltalk"],
  29678. messageSends: ["parse:"]
  29679. }),
  29680. $globals.Compiler);
  29681. $core.addMethod(
  29682. $core.method({
  29683. selector: "parseExpression:",
  29684. protocol: 'compiling',
  29685. fn: function (aString){
  29686. var self=this;
  29687. return $core.withContext(function($ctx1) {
  29688. var $1;
  29689. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  29690. $ctx1.sendIdx[","]=1;
  29691. return self._parse_($1);
  29692. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  29693. },
  29694. args: ["aString"],
  29695. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  29696. referencedClasses: [],
  29697. messageSends: ["parse:", ","]
  29698. }),
  29699. $globals.Compiler);
  29700. $core.addMethod(
  29701. $core.method({
  29702. selector: "recompile:",
  29703. protocol: 'compiling',
  29704. fn: function (aClass){
  29705. var self=this;
  29706. return $core.withContext(function($ctx1) {
  29707. var $1;
  29708. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  29709. return $core.withContext(function($ctx2) {
  29710. return self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  29711. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29712. }),"Recompiling ".__comma($recv(aClass)._name()));
  29713. $1=$recv(aClass)._isMetaclass();
  29714. if(!$core.assert($1)){
  29715. self._recompile_($recv(aClass)._class());
  29716. };
  29717. return self;
  29718. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  29719. },
  29720. args: ["aClass"],
  29721. 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 ]",
  29722. referencedClasses: [],
  29723. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifFalse:", "isMetaclass", "recompile:", "class"]
  29724. }),
  29725. $globals.Compiler);
  29726. $core.addMethod(
  29727. $core.method({
  29728. selector: "recompileAll",
  29729. protocol: 'compiling',
  29730. fn: function (){
  29731. var self=this;
  29732. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29733. return $core.withContext(function($ctx1) {
  29734. $recv($recv($Smalltalk())._classes())._do_displayingProgress_((function(each){
  29735. return $core.withContext(function($ctx2) {
  29736. return self._recompile_(each);
  29737. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29738. }),"Compiling all classes...");
  29739. return self;
  29740. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  29741. },
  29742. args: [],
  29743. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  29744. referencedClasses: ["Smalltalk"],
  29745. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  29746. }),
  29747. $globals.Compiler);
  29748. $core.addMethod(
  29749. $core.method({
  29750. selector: "source",
  29751. protocol: 'accessing',
  29752. fn: function (){
  29753. var self=this;
  29754. return $core.withContext(function($ctx1) {
  29755. var $1,$receiver;
  29756. $1=self["@source"];
  29757. if(($receiver = $1) == null || $receiver.isNil){
  29758. return "";
  29759. } else {
  29760. return $1;
  29761. };
  29762. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  29763. },
  29764. args: [],
  29765. source: "source\x0a\x09^ source ifNil: [ '' ]",
  29766. referencedClasses: [],
  29767. messageSends: ["ifNil:"]
  29768. }),
  29769. $globals.Compiler);
  29770. $core.addMethod(
  29771. $core.method({
  29772. selector: "source:",
  29773. protocol: 'accessing',
  29774. fn: function (aString){
  29775. var self=this;
  29776. self["@source"]=aString;
  29777. return self;
  29778. },
  29779. args: ["aString"],
  29780. source: "source: aString\x0a\x09source := aString",
  29781. referencedClasses: [],
  29782. messageSends: []
  29783. }),
  29784. $globals.Compiler);
  29785. $core.addMethod(
  29786. $core.method({
  29787. selector: "unknownVariables",
  29788. protocol: 'accessing',
  29789. fn: function (){
  29790. var self=this;
  29791. return self["@unknownVariables"];
  29792. },
  29793. args: [],
  29794. source: "unknownVariables\x0a\x09^ unknownVariables",
  29795. referencedClasses: [],
  29796. messageSends: []
  29797. }),
  29798. $globals.Compiler);
  29799. $core.addMethod(
  29800. $core.method({
  29801. selector: "unknownVariables:",
  29802. protocol: 'accessing',
  29803. fn: function (aCollection){
  29804. var self=this;
  29805. self["@unknownVariables"]=aCollection;
  29806. return self;
  29807. },
  29808. args: ["aCollection"],
  29809. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  29810. referencedClasses: [],
  29811. messageSends: []
  29812. }),
  29813. $globals.Compiler);
  29814. $core.addMethod(
  29815. $core.method({
  29816. selector: "recompile:",
  29817. protocol: 'compiling',
  29818. fn: function (aClass){
  29819. var self=this;
  29820. return $core.withContext(function($ctx1) {
  29821. $recv(self._new())._recompile_(aClass);
  29822. return self;
  29823. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.klass)});
  29824. },
  29825. args: ["aClass"],
  29826. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  29827. referencedClasses: [],
  29828. messageSends: ["recompile:", "new"]
  29829. }),
  29830. $globals.Compiler.klass);
  29831. $core.addMethod(
  29832. $core.method({
  29833. selector: "recompileAll",
  29834. protocol: 'compiling',
  29835. fn: function (){
  29836. var self=this;
  29837. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29838. return $core.withContext(function($ctx1) {
  29839. $recv($recv($Smalltalk())._classes())._do_((function(each){
  29840. return $core.withContext(function($ctx2) {
  29841. return self._recompile_(each);
  29842. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29843. }));
  29844. return self;
  29845. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.klass)});
  29846. },
  29847. args: [],
  29848. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  29849. referencedClasses: ["Smalltalk"],
  29850. messageSends: ["do:", "classes", "recompile:"]
  29851. }),
  29852. $globals.Compiler.klass);
  29853. $core.addClass('CompilerError', $globals.Error, [], 'Compiler-Core');
  29854. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  29855. $core.addClass('DoIt', $globals.Object, [], 'Compiler-Core');
  29856. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  29857. $core.addClass('Evaluator', $globals.InterfacingObject, [], 'Compiler-Core');
  29858. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  29859. $core.addMethod(
  29860. $core.method({
  29861. selector: "evaluate:context:",
  29862. protocol: 'evaluating',
  29863. fn: function (aString,aContext){
  29864. var self=this;
  29865. var compiler,ast;
  29866. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  29867. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  29868. function $AISemanticAnalyzer(){return $globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)}
  29869. return $core.withContext(function($ctx1) {
  29870. var $1;
  29871. var $early={};
  29872. try {
  29873. compiler=$recv($Compiler())._new();
  29874. $recv((function(){
  29875. return $core.withContext(function($ctx2) {
  29876. ast=$recv(compiler)._parseExpression_(aString);
  29877. return ast;
  29878. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  29879. }))._on_do_($Error(),(function(ex){
  29880. return $core.withContext(function($ctx2) {
  29881. throw $early=[self._alert_($recv(ex)._messageText())];
  29882. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  29883. }));
  29884. $1=$recv($AISemanticAnalyzer())._on_($recv($recv(aContext)._receiver())._class());
  29885. $recv($1)._context_(aContext);
  29886. $recv($1)._visit_(ast);
  29887. return $recv(aContext)._evaluateNode_(ast);
  29888. }
  29889. catch(e) {if(e===$early)return e[0]; throw e}
  29890. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  29891. },
  29892. args: ["aString", "aContext"],
  29893. 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",
  29894. referencedClasses: ["Compiler", "Error", "AISemanticAnalyzer"],
  29895. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  29896. }),
  29897. $globals.Evaluator);
  29898. $core.addMethod(
  29899. $core.method({
  29900. selector: "evaluate:for:",
  29901. protocol: 'evaluating',
  29902. fn: function (aString,anObject){
  29903. var self=this;
  29904. return $core.withContext(function($ctx1) {
  29905. return $recv(anObject)._evaluate_on_(aString,self);
  29906. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  29907. },
  29908. args: ["aString", "anObject"],
  29909. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  29910. referencedClasses: [],
  29911. messageSends: ["evaluate:on:"]
  29912. }),
  29913. $globals.Evaluator);
  29914. $core.addMethod(
  29915. $core.method({
  29916. selector: "evaluate:receiver:",
  29917. protocol: 'evaluating',
  29918. fn: function (aString,anObject){
  29919. var self=this;
  29920. var compiler;
  29921. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  29922. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  29923. return $core.withContext(function($ctx1) {
  29924. var $early={};
  29925. try {
  29926. compiler=$recv($Compiler())._new();
  29927. $recv((function(){
  29928. return $core.withContext(function($ctx2) {
  29929. return $recv(compiler)._parseExpression_(aString);
  29930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  29931. }))._on_do_($Error(),(function(ex){
  29932. return $core.withContext(function($ctx2) {
  29933. throw $early=[self._alert_($recv(ex)._messageText())];
  29934. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  29935. }));
  29936. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  29937. }
  29938. catch(e) {if(e===$early)return e[0]; throw e}
  29939. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  29940. },
  29941. args: ["aString", "anObject"],
  29942. 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",
  29943. referencedClasses: ["Compiler", "Error"],
  29944. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  29945. }),
  29946. $globals.Evaluator);
  29947. $core.addMethod(
  29948. $core.method({
  29949. selector: "evaluate:for:",
  29950. protocol: 'instance creation',
  29951. fn: function (aString,anObject){
  29952. var self=this;
  29953. return $core.withContext(function($ctx1) {
  29954. return $recv(self._new())._evaluate_for_(aString,anObject);
  29955. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.klass)});
  29956. },
  29957. args: ["aString", "anObject"],
  29958. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  29959. referencedClasses: [],
  29960. messageSends: ["evaluate:for:", "new"]
  29961. }),
  29962. $globals.Evaluator.klass);
  29963. $core.addMethod(
  29964. $core.method({
  29965. selector: "asVariableName",
  29966. protocol: '*Compiler-Core',
  29967. fn: function (){
  29968. var self=this;
  29969. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29970. return $core.withContext(function($ctx1) {
  29971. var $1;
  29972. $1=$recv($recv($Smalltalk())._reservedWords())._includes_(self);
  29973. if($core.assert($1)){
  29974. return self.__comma("_");
  29975. } else {
  29976. return self;
  29977. };
  29978. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  29979. },
  29980. args: [],
  29981. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  29982. referencedClasses: ["Smalltalk"],
  29983. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  29984. }),
  29985. $globals.String);
  29986. });
  29987. define("amber_core/Compiler-AST", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){"use strict";
  29988. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  29989. $core.addPackage('Compiler-AST');
  29990. $core.packages["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
  29991. $core.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  29992. $core.addClass('Node', $globals.Object, ['parent', 'position', 'source', 'nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST');
  29993. $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.";
  29994. $core.addMethod(
  29995. $core.method({
  29996. selector: "accept:",
  29997. protocol: 'visiting',
  29998. fn: function (aVisitor){
  29999. var self=this;
  30000. return $core.withContext(function($ctx1) {
  30001. return $recv(aVisitor)._visitNode_(self);
  30002. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.Node)});
  30003. },
  30004. args: ["aVisitor"],
  30005. source: "accept: aVisitor\x0a\x09^ aVisitor visitNode: self",
  30006. referencedClasses: [],
  30007. messageSends: ["visitNode:"]
  30008. }),
  30009. $globals.Node);
  30010. $core.addMethod(
  30011. $core.method({
  30012. selector: "addNode:",
  30013. protocol: 'accessing',
  30014. fn: function (aNode){
  30015. var self=this;
  30016. return $core.withContext(function($ctx1) {
  30017. $recv(self._nodes())._add_(aNode);
  30018. $recv(aNode)._parent_(self);
  30019. return self;
  30020. }, function($ctx1) {$ctx1.fill(self,"addNode:",{aNode:aNode},$globals.Node)});
  30021. },
  30022. args: ["aNode"],
  30023. source: "addNode: aNode\x0a\x09self nodes add: aNode.\x0a\x09aNode parent: self",
  30024. referencedClasses: [],
  30025. messageSends: ["add:", "nodes", "parent:"]
  30026. }),
  30027. $globals.Node);
  30028. $core.addMethod(
  30029. $core.method({
  30030. selector: "allNodes",
  30031. protocol: 'accessing',
  30032. fn: function (){
  30033. var self=this;
  30034. var allNodes;
  30035. return $core.withContext(function($ctx1) {
  30036. var $1;
  30037. $1=self._nodes();
  30038. $ctx1.sendIdx["nodes"]=1;
  30039. allNodes=$recv($1)._asSet();
  30040. $recv(self._nodes())._do_((function(each){
  30041. return $core.withContext(function($ctx2) {
  30042. return $recv(allNodes)._addAll_($recv(each)._allNodes());
  30043. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30044. }));
  30045. return allNodes;
  30046. }, function($ctx1) {$ctx1.fill(self,"allNodes",{allNodes:allNodes},$globals.Node)});
  30047. },
  30048. args: [],
  30049. 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",
  30050. referencedClasses: [],
  30051. messageSends: ["asSet", "nodes", "do:", "addAll:", "allNodes"]
  30052. }),
  30053. $globals.Node);
  30054. $core.addMethod(
  30055. $core.method({
  30056. selector: "inPosition:",
  30057. protocol: 'testing',
  30058. fn: function (aPoint){
  30059. var self=this;
  30060. return $core.withContext(function($ctx1) {
  30061. return $recv($recv(self._positionStart()).__lt_eq(aPoint))._and_((function(){
  30062. return $core.withContext(function($ctx2) {
  30063. return $recv(self._positionEnd()).__gt_eq(aPoint);
  30064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30065. }));
  30066. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.Node)});
  30067. },
  30068. args: ["aPoint"],
  30069. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  30070. referencedClasses: [],
  30071. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  30072. }),
  30073. $globals.Node);
  30074. $core.addMethod(
  30075. $core.method({
  30076. selector: "isAssignmentNode",
  30077. protocol: 'testing',
  30078. fn: function (){
  30079. var self=this;
  30080. return false;
  30081. },
  30082. args: [],
  30083. source: "isAssignmentNode\x0a\x09^ false",
  30084. referencedClasses: [],
  30085. messageSends: []
  30086. }),
  30087. $globals.Node);
  30088. $core.addMethod(
  30089. $core.method({
  30090. selector: "isBlockNode",
  30091. protocol: 'testing',
  30092. fn: function (){
  30093. var self=this;
  30094. return false;
  30095. },
  30096. args: [],
  30097. source: "isBlockNode\x0a\x09^ false",
  30098. referencedClasses: [],
  30099. messageSends: []
  30100. }),
  30101. $globals.Node);
  30102. $core.addMethod(
  30103. $core.method({
  30104. selector: "isBlockSequenceNode",
  30105. protocol: 'testing',
  30106. fn: function (){
  30107. var self=this;
  30108. return false;
  30109. },
  30110. args: [],
  30111. source: "isBlockSequenceNode\x0a\x09^ false",
  30112. referencedClasses: [],
  30113. messageSends: []
  30114. }),
  30115. $globals.Node);
  30116. $core.addMethod(
  30117. $core.method({
  30118. selector: "isCascadeNode",
  30119. protocol: 'testing',
  30120. fn: function (){
  30121. var self=this;
  30122. return false;
  30123. },
  30124. args: [],
  30125. source: "isCascadeNode\x0a\x09^ false",
  30126. referencedClasses: [],
  30127. messageSends: []
  30128. }),
  30129. $globals.Node);
  30130. $core.addMethod(
  30131. $core.method({
  30132. selector: "isImmutable",
  30133. protocol: 'testing',
  30134. fn: function (){
  30135. var self=this;
  30136. return false;
  30137. },
  30138. args: [],
  30139. source: "isImmutable\x0a\x09^ false",
  30140. referencedClasses: [],
  30141. messageSends: []
  30142. }),
  30143. $globals.Node);
  30144. $core.addMethod(
  30145. $core.method({
  30146. selector: "isJSStatementNode",
  30147. protocol: 'testing',
  30148. fn: function (){
  30149. var self=this;
  30150. return false;
  30151. },
  30152. args: [],
  30153. source: "isJSStatementNode\x0a\x09^ false",
  30154. referencedClasses: [],
  30155. messageSends: []
  30156. }),
  30157. $globals.Node);
  30158. $core.addMethod(
  30159. $core.method({
  30160. selector: "isLastChild",
  30161. protocol: 'testing',
  30162. fn: function (){
  30163. var self=this;
  30164. return $core.withContext(function($ctx1) {
  30165. return $recv($recv($recv(self._parent())._nodes())._last()).__eq(self);
  30166. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.Node)});
  30167. },
  30168. args: [],
  30169. source: "isLastChild\x0a\x09^ self parent nodes last = self",
  30170. referencedClasses: [],
  30171. messageSends: ["=", "last", "nodes", "parent"]
  30172. }),
  30173. $globals.Node);
  30174. $core.addMethod(
  30175. $core.method({
  30176. selector: "isNavigationNode",
  30177. protocol: 'testing',
  30178. fn: function (){
  30179. var self=this;
  30180. return false;
  30181. },
  30182. args: [],
  30183. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  30184. referencedClasses: [],
  30185. messageSends: []
  30186. }),
  30187. $globals.Node);
  30188. $core.addMethod(
  30189. $core.method({
  30190. selector: "isNode",
  30191. protocol: 'testing',
  30192. fn: function (){
  30193. var self=this;
  30194. return true;
  30195. },
  30196. args: [],
  30197. source: "isNode\x0a\x09^ true",
  30198. referencedClasses: [],
  30199. messageSends: []
  30200. }),
  30201. $globals.Node);
  30202. $core.addMethod(
  30203. $core.method({
  30204. selector: "isReferenced",
  30205. protocol: 'testing',
  30206. fn: function (){
  30207. var self=this;
  30208. return $core.withContext(function($ctx1) {
  30209. var $3,$2,$1;
  30210. $3=self._parent();
  30211. $ctx1.sendIdx["parent"]=1;
  30212. $2=$recv($3)._isSequenceNode();
  30213. $1=$recv($2)._or_((function(){
  30214. return $core.withContext(function($ctx2) {
  30215. return $recv(self._parent())._isAssignmentNode();
  30216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30217. }));
  30218. return $recv($1)._not();
  30219. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.Node)});
  30220. },
  30221. args: [],
  30222. 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",
  30223. referencedClasses: [],
  30224. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  30225. }),
  30226. $globals.Node);
  30227. $core.addMethod(
  30228. $core.method({
  30229. selector: "isReturnNode",
  30230. protocol: 'testing',
  30231. fn: function (){
  30232. var self=this;
  30233. return false;
  30234. },
  30235. args: [],
  30236. source: "isReturnNode\x0a\x09^ false",
  30237. referencedClasses: [],
  30238. messageSends: []
  30239. }),
  30240. $globals.Node);
  30241. $core.addMethod(
  30242. $core.method({
  30243. selector: "isSendNode",
  30244. protocol: 'testing',
  30245. fn: function (){
  30246. var self=this;
  30247. return false;
  30248. },
  30249. args: [],
  30250. source: "isSendNode\x0a\x09^ false",
  30251. referencedClasses: [],
  30252. messageSends: []
  30253. }),
  30254. $globals.Node);
  30255. $core.addMethod(
  30256. $core.method({
  30257. selector: "isSequenceNode",
  30258. protocol: 'testing',
  30259. fn: function (){
  30260. var self=this;
  30261. return false;
  30262. },
  30263. args: [],
  30264. source: "isSequenceNode\x0a\x09^ false",
  30265. referencedClasses: [],
  30266. messageSends: []
  30267. }),
  30268. $globals.Node);
  30269. $core.addMethod(
  30270. $core.method({
  30271. selector: "isValueNode",
  30272. protocol: 'testing',
  30273. fn: function (){
  30274. var self=this;
  30275. return false;
  30276. },
  30277. args: [],
  30278. source: "isValueNode\x0a\x09^ false",
  30279. referencedClasses: [],
  30280. messageSends: []
  30281. }),
  30282. $globals.Node);
  30283. $core.addMethod(
  30284. $core.method({
  30285. selector: "isVariableNode",
  30286. protocol: 'testing',
  30287. fn: function (){
  30288. var self=this;
  30289. return false;
  30290. },
  30291. args: [],
  30292. source: "isVariableNode\x0a\x09^ false",
  30293. referencedClasses: [],
  30294. messageSends: []
  30295. }),
  30296. $globals.Node);
  30297. $core.addMethod(
  30298. $core.method({
  30299. selector: "location:",
  30300. protocol: 'accessing',
  30301. fn: function (aLocation){
  30302. var self=this;
  30303. return $core.withContext(function($ctx1) {
  30304. var $3,$2,$1;
  30305. $3=$recv(aLocation)._start();
  30306. $ctx1.sendIdx["start"]=1;
  30307. $2=$recv($3)._line();
  30308. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  30309. self._position_($1);
  30310. return self;
  30311. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation},$globals.Node)});
  30312. },
  30313. args: ["aLocation"],
  30314. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  30315. referencedClasses: [],
  30316. messageSends: ["position:", "@", "line", "start", "column"]
  30317. }),
  30318. $globals.Node);
  30319. $core.addMethod(
  30320. $core.method({
  30321. selector: "method",
  30322. protocol: 'accessing',
  30323. fn: function (){
  30324. var self=this;
  30325. return $core.withContext(function($ctx1) {
  30326. var $1,$receiver;
  30327. $1=self._parent();
  30328. if(($receiver = $1) == null || $receiver.isNil){
  30329. return $1;
  30330. } else {
  30331. var node;
  30332. node=$receiver;
  30333. return $recv(node)._method();
  30334. };
  30335. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.Node)});
  30336. },
  30337. args: [],
  30338. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  30339. referencedClasses: [],
  30340. messageSends: ["ifNotNil:", "parent", "method"]
  30341. }),
  30342. $globals.Node);
  30343. $core.addMethod(
  30344. $core.method({
  30345. selector: "navigationNodeAt:ifAbsent:",
  30346. protocol: 'accessing',
  30347. fn: function (aPoint,aBlock){
  30348. var self=this;
  30349. var children;
  30350. return $core.withContext(function($ctx1) {
  30351. var $2,$1;
  30352. var $early={};
  30353. try {
  30354. children=$recv(self._allNodes())._select_((function(each){
  30355. return $core.withContext(function($ctx2) {
  30356. return $recv($recv(each)._isNavigationNode())._and_((function(){
  30357. return $core.withContext(function($ctx3) {
  30358. return $recv(each)._inPosition_(aPoint);
  30359. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  30360. }));
  30361. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30362. }));
  30363. $recv(children)._ifEmpty_((function(){
  30364. return $core.withContext(function($ctx2) {
  30365. throw $early=[$recv(aBlock)._value()];
  30366. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  30367. }));
  30368. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  30369. return $core.withContext(function($ctx2) {
  30370. $2=$recv(a)._positionStart();
  30371. $ctx2.sendIdx["positionStart"]=1;
  30372. $1=$recv($2)._dist_(aPoint);
  30373. $ctx2.sendIdx["dist:"]=1;
  30374. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  30375. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  30376. })))._first();
  30377. }
  30378. catch(e) {if(e===$early)return e[0]; throw e}
  30379. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.Node)});
  30380. },
  30381. args: ["aPoint", "aBlock"],
  30382. 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",
  30383. referencedClasses: [],
  30384. messageSends: ["select:", "allNodes", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  30385. }),
  30386. $globals.Node);
  30387. $core.addMethod(
  30388. $core.method({
  30389. selector: "nodes",
  30390. protocol: 'accessing',
  30391. fn: function (){
  30392. var self=this;
  30393. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  30394. return $core.withContext(function($ctx1) {
  30395. var $1,$receiver;
  30396. $1=self["@nodes"];
  30397. if(($receiver = $1) == null || $receiver.isNil){
  30398. self["@nodes"]=$recv($Array())._new();
  30399. return self["@nodes"];
  30400. } else {
  30401. return $1;
  30402. };
  30403. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.Node)});
  30404. },
  30405. args: [],
  30406. source: "nodes\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  30407. referencedClasses: ["Array"],
  30408. messageSends: ["ifNil:", "new"]
  30409. }),
  30410. $globals.Node);
  30411. $core.addMethod(
  30412. $core.method({
  30413. selector: "nodes:",
  30414. protocol: 'building',
  30415. fn: function (aCollection){
  30416. var self=this;
  30417. return $core.withContext(function($ctx1) {
  30418. self["@nodes"]=aCollection;
  30419. $recv(aCollection)._do_((function(each){
  30420. return $core.withContext(function($ctx2) {
  30421. return $recv(each)._parent_(self);
  30422. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30423. }));
  30424. return self;
  30425. }, function($ctx1) {$ctx1.fill(self,"nodes:",{aCollection:aCollection},$globals.Node)});
  30426. },
  30427. args: ["aCollection"],
  30428. source: "nodes: aCollection\x0a\x09nodes := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  30429. referencedClasses: [],
  30430. messageSends: ["do:", "parent:"]
  30431. }),
  30432. $globals.Node);
  30433. $core.addMethod(
  30434. $core.method({
  30435. selector: "parent",
  30436. protocol: 'accessing',
  30437. fn: function (){
  30438. var self=this;
  30439. return self["@parent"];
  30440. },
  30441. args: [],
  30442. source: "parent\x0a\x09^ parent",
  30443. referencedClasses: [],
  30444. messageSends: []
  30445. }),
  30446. $globals.Node);
  30447. $core.addMethod(
  30448. $core.method({
  30449. selector: "parent:",
  30450. protocol: 'accessing',
  30451. fn: function (aNode){
  30452. var self=this;
  30453. self["@parent"]=aNode;
  30454. return self;
  30455. },
  30456. args: ["aNode"],
  30457. source: "parent: aNode\x0a\x09parent := aNode",
  30458. referencedClasses: [],
  30459. messageSends: []
  30460. }),
  30461. $globals.Node);
  30462. $core.addMethod(
  30463. $core.method({
  30464. selector: "position",
  30465. protocol: 'accessing',
  30466. fn: function (){
  30467. var self=this;
  30468. return $core.withContext(function($ctx1) {
  30469. var $1,$2,$receiver;
  30470. $1=self["@position"];
  30471. if(($receiver = $1) == null || $receiver.isNil){
  30472. $2=self._parent();
  30473. if(($receiver = $2) == null || $receiver.isNil){
  30474. return $2;
  30475. } else {
  30476. var node;
  30477. node=$receiver;
  30478. return $recv(node)._position();
  30479. };
  30480. } else {
  30481. return $1;
  30482. };
  30483. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Node)});
  30484. },
  30485. args: [],
  30486. 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 ] ]",
  30487. referencedClasses: [],
  30488. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  30489. }),
  30490. $globals.Node);
  30491. $core.addMethod(
  30492. $core.method({
  30493. selector: "position:",
  30494. protocol: 'accessing',
  30495. fn: function (aPosition){
  30496. var self=this;
  30497. self["@position"]=aPosition;
  30498. return self;
  30499. },
  30500. args: ["aPosition"],
  30501. source: "position: aPosition\x0a\x09position := aPosition",
  30502. referencedClasses: [],
  30503. messageSends: []
  30504. }),
  30505. $globals.Node);
  30506. $core.addMethod(
  30507. $core.method({
  30508. selector: "positionEnd",
  30509. protocol: 'accessing',
  30510. fn: function (){
  30511. var self=this;
  30512. return $core.withContext(function($ctx1) {
  30513. var $1,$6,$5,$4,$3,$2;
  30514. $1=self._positionStart();
  30515. $6=self._source();
  30516. $ctx1.sendIdx["source"]=1;
  30517. $5=$recv($6)._lines();
  30518. $ctx1.sendIdx["lines"]=1;
  30519. $4=$recv($5)._size();
  30520. $ctx1.sendIdx["size"]=1;
  30521. $3=$recv($4).__minus((1));
  30522. $ctx1.sendIdx["-"]=1;
  30523. $2=$recv($3).__at($recv($recv($recv($recv(self._source())._lines())._last())._size()).__minus((1)));
  30524. return $recv($1).__plus($2);
  30525. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.Node)});
  30526. },
  30527. args: [],
  30528. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  30529. referencedClasses: [],
  30530. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  30531. }),
  30532. $globals.Node);
  30533. $core.addMethod(
  30534. $core.method({
  30535. selector: "positionStart",
  30536. protocol: 'accessing',
  30537. fn: function (){
  30538. var self=this;
  30539. return $core.withContext(function($ctx1) {
  30540. return self._position();
  30541. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.Node)});
  30542. },
  30543. args: [],
  30544. source: "positionStart\x0a\x09^ self position",
  30545. referencedClasses: [],
  30546. messageSends: ["position"]
  30547. }),
  30548. $globals.Node);
  30549. $core.addMethod(
  30550. $core.method({
  30551. selector: "postCopy",
  30552. protocol: 'copying',
  30553. fn: function (){
  30554. var self=this;
  30555. return $core.withContext(function($ctx1) {
  30556. (
  30557. $ctx1.supercall = true,
  30558. ($globals.Node.superclass||$boot.dnu).fn.prototype._postCopy.apply($recv(self), []));
  30559. $ctx1.supercall = false;
  30560. $recv(self._nodes())._do_((function(each){
  30561. return $core.withContext(function($ctx2) {
  30562. return $recv(each)._parent_(self);
  30563. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30564. }));
  30565. return self;
  30566. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.Node)});
  30567. },
  30568. args: [],
  30569. source: "postCopy\x0a\x09super postCopy.\x0a\x09self nodes do: [ :each | each parent: self ]",
  30570. referencedClasses: [],
  30571. messageSends: ["postCopy", "do:", "nodes", "parent:"]
  30572. }),
  30573. $globals.Node);
  30574. $core.addMethod(
  30575. $core.method({
  30576. selector: "requiresSmalltalkContext",
  30577. protocol: 'testing',
  30578. fn: function (){
  30579. var self=this;
  30580. return $core.withContext(function($ctx1) {
  30581. return $recv($recv(self._nodes())._detect_ifNone_((function(each){
  30582. return $core.withContext(function($ctx2) {
  30583. return $recv(each)._requiresSmalltalkContext();
  30584. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30585. }),(function(){
  30586. return nil;
  30587. })))._notNil();
  30588. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.Node)});
  30589. },
  30590. args: [],
  30591. 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",
  30592. referencedClasses: [],
  30593. messageSends: ["notNil", "detect:ifNone:", "nodes", "requiresSmalltalkContext"]
  30594. }),
  30595. $globals.Node);
  30596. $core.addMethod(
  30597. $core.method({
  30598. selector: "shouldBeAliased",
  30599. protocol: 'accessing',
  30600. fn: function (){
  30601. var self=this;
  30602. return $core.withContext(function($ctx1) {
  30603. var $1,$receiver;
  30604. $1=self["@shouldBeAliased"];
  30605. if(($receiver = $1) == null || $receiver.isNil){
  30606. return false;
  30607. } else {
  30608. return $1;
  30609. };
  30610. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.Node)});
  30611. },
  30612. args: [],
  30613. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  30614. referencedClasses: [],
  30615. messageSends: ["ifNil:"]
  30616. }),
  30617. $globals.Node);
  30618. $core.addMethod(
  30619. $core.method({
  30620. selector: "shouldBeAliased:",
  30621. protocol: 'accessing',
  30622. fn: function (aBoolean){
  30623. var self=this;
  30624. self["@shouldBeAliased"]=aBoolean;
  30625. return self;
  30626. },
  30627. args: ["aBoolean"],
  30628. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  30629. referencedClasses: [],
  30630. messageSends: []
  30631. }),
  30632. $globals.Node);
  30633. $core.addMethod(
  30634. $core.method({
  30635. selector: "shouldBeInlined",
  30636. protocol: 'accessing',
  30637. fn: function (){
  30638. var self=this;
  30639. return $core.withContext(function($ctx1) {
  30640. var $1,$receiver;
  30641. $1=self["@shouldBeInlined"];
  30642. if(($receiver = $1) == null || $receiver.isNil){
  30643. return false;
  30644. } else {
  30645. return $1;
  30646. };
  30647. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.Node)});
  30648. },
  30649. args: [],
  30650. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  30651. referencedClasses: [],
  30652. messageSends: ["ifNil:"]
  30653. }),
  30654. $globals.Node);
  30655. $core.addMethod(
  30656. $core.method({
  30657. selector: "shouldBeInlined:",
  30658. protocol: 'accessing',
  30659. fn: function (aBoolean){
  30660. var self=this;
  30661. self["@shouldBeInlined"]=aBoolean;
  30662. return self;
  30663. },
  30664. args: ["aBoolean"],
  30665. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  30666. referencedClasses: [],
  30667. messageSends: []
  30668. }),
  30669. $globals.Node);
  30670. $core.addMethod(
  30671. $core.method({
  30672. selector: "size",
  30673. protocol: 'accessing',
  30674. fn: function (){
  30675. var self=this;
  30676. return $core.withContext(function($ctx1) {
  30677. return $recv(self._source())._size();
  30678. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Node)});
  30679. },
  30680. args: [],
  30681. source: "size\x0a\x09^ self source size",
  30682. referencedClasses: [],
  30683. messageSends: ["size", "source"]
  30684. }),
  30685. $globals.Node);
  30686. $core.addMethod(
  30687. $core.method({
  30688. selector: "source",
  30689. protocol: 'accessing',
  30690. fn: function (){
  30691. var self=this;
  30692. return $core.withContext(function($ctx1) {
  30693. var $1,$receiver;
  30694. $1=self["@source"];
  30695. if(($receiver = $1) == null || $receiver.isNil){
  30696. return "";
  30697. } else {
  30698. return $1;
  30699. };
  30700. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Node)});
  30701. },
  30702. args: [],
  30703. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30704. referencedClasses: [],
  30705. messageSends: ["ifNil:"]
  30706. }),
  30707. $globals.Node);
  30708. $core.addMethod(
  30709. $core.method({
  30710. selector: "source:",
  30711. protocol: 'accessing',
  30712. fn: function (aString){
  30713. var self=this;
  30714. self["@source"]=aString;
  30715. return self;
  30716. },
  30717. args: ["aString"],
  30718. source: "source: aString\x0a\x09source := aString",
  30719. referencedClasses: [],
  30720. messageSends: []
  30721. }),
  30722. $globals.Node);
  30723. $core.addMethod(
  30724. $core.method({
  30725. selector: "subtreeNeedsAliasing",
  30726. protocol: 'testing',
  30727. fn: function (){
  30728. var self=this;
  30729. return $core.withContext(function($ctx1) {
  30730. var $1;
  30731. $1=$recv($recv(self._shouldBeAliased())._or_((function(){
  30732. return $core.withContext(function($ctx2) {
  30733. return self._shouldBeInlined();
  30734. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30735. })))._or_((function(){
  30736. return $core.withContext(function($ctx2) {
  30737. return $recv(self._nodes())._anySatisfy_((function(each){
  30738. return $core.withContext(function($ctx3) {
  30739. return $recv(each)._subtreeNeedsAliasing();
  30740. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  30741. }));
  30742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  30743. }));
  30744. $ctx1.sendIdx["or:"]=1;
  30745. return $1;
  30746. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.Node)});
  30747. },
  30748. args: [],
  30749. source: "subtreeNeedsAliasing\x0a\x09^ (self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a\x09\x09self nodes anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  30750. referencedClasses: [],
  30751. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined", "anySatisfy:", "nodes", "subtreeNeedsAliasing"]
  30752. }),
  30753. $globals.Node);
  30754. $core.addClass('AssignmentNode', $globals.Node, ['left', 'right'], 'Compiler-AST');
  30755. $globals.AssignmentNode.comment="I represent an assignment node.";
  30756. $core.addMethod(
  30757. $core.method({
  30758. selector: "accept:",
  30759. protocol: 'visiting',
  30760. fn: function (aVisitor){
  30761. var self=this;
  30762. return $core.withContext(function($ctx1) {
  30763. return $recv(aVisitor)._visitAssignmentNode_(self);
  30764. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  30765. },
  30766. args: ["aVisitor"],
  30767. source: "accept: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  30768. referencedClasses: [],
  30769. messageSends: ["visitAssignmentNode:"]
  30770. }),
  30771. $globals.AssignmentNode);
  30772. $core.addMethod(
  30773. $core.method({
  30774. selector: "isAssignmentNode",
  30775. protocol: 'testing',
  30776. fn: function (){
  30777. var self=this;
  30778. return true;
  30779. },
  30780. args: [],
  30781. source: "isAssignmentNode\x0a\x09^ true",
  30782. referencedClasses: [],
  30783. messageSends: []
  30784. }),
  30785. $globals.AssignmentNode);
  30786. $core.addMethod(
  30787. $core.method({
  30788. selector: "left",
  30789. protocol: 'accessing',
  30790. fn: function (){
  30791. var self=this;
  30792. return self["@left"];
  30793. },
  30794. args: [],
  30795. source: "left\x0a\x09^ left",
  30796. referencedClasses: [],
  30797. messageSends: []
  30798. }),
  30799. $globals.AssignmentNode);
  30800. $core.addMethod(
  30801. $core.method({
  30802. selector: "left:",
  30803. protocol: 'accessing',
  30804. fn: function (aNode){
  30805. var self=this;
  30806. return $core.withContext(function($ctx1) {
  30807. self["@left"]=aNode;
  30808. $recv(aNode)._parent_(self);
  30809. return self;
  30810. }, function($ctx1) {$ctx1.fill(self,"left:",{aNode:aNode},$globals.AssignmentNode)});
  30811. },
  30812. args: ["aNode"],
  30813. source: "left: aNode\x0a\x09left := aNode.\x0a\x09aNode parent: self",
  30814. referencedClasses: [],
  30815. messageSends: ["parent:"]
  30816. }),
  30817. $globals.AssignmentNode);
  30818. $core.addMethod(
  30819. $core.method({
  30820. selector: "nodes",
  30821. protocol: 'accessing',
  30822. fn: function (){
  30823. var self=this;
  30824. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  30825. return $core.withContext(function($ctx1) {
  30826. return $recv($Array())._with_with_(self._left(),self._right());
  30827. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.AssignmentNode)});
  30828. },
  30829. args: [],
  30830. source: "nodes\x0a\x09^ Array with: self left with: self right",
  30831. referencedClasses: ["Array"],
  30832. messageSends: ["with:with:", "left", "right"]
  30833. }),
  30834. $globals.AssignmentNode);
  30835. $core.addMethod(
  30836. $core.method({
  30837. selector: "right",
  30838. protocol: 'accessing',
  30839. fn: function (){
  30840. var self=this;
  30841. return self["@right"];
  30842. },
  30843. args: [],
  30844. source: "right\x0a\x09^ right",
  30845. referencedClasses: [],
  30846. messageSends: []
  30847. }),
  30848. $globals.AssignmentNode);
  30849. $core.addMethod(
  30850. $core.method({
  30851. selector: "right:",
  30852. protocol: 'accessing',
  30853. fn: function (aNode){
  30854. var self=this;
  30855. return $core.withContext(function($ctx1) {
  30856. self["@right"]=aNode;
  30857. $recv(aNode)._parent_(self);
  30858. return self;
  30859. }, function($ctx1) {$ctx1.fill(self,"right:",{aNode:aNode},$globals.AssignmentNode)});
  30860. },
  30861. args: ["aNode"],
  30862. source: "right: aNode\x0a\x09right := aNode.\x0a\x09aNode parent: self",
  30863. referencedClasses: [],
  30864. messageSends: ["parent:"]
  30865. }),
  30866. $globals.AssignmentNode);
  30867. $core.addMethod(
  30868. $core.method({
  30869. selector: "shouldBeAliased",
  30870. protocol: 'testing',
  30871. fn: function (){
  30872. var self=this;
  30873. return $core.withContext(function($ctx1) {
  30874. var $1;
  30875. $1=(
  30876. $ctx1.supercall = true,
  30877. ($globals.AssignmentNode.superclass||$boot.dnu).fn.prototype._shouldBeAliased.apply($recv(self), []));
  30878. $ctx1.supercall = false;
  30879. return $recv($1)._or_((function(){
  30880. return $core.withContext(function($ctx2) {
  30881. return self._isReferenced();
  30882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30883. }));
  30884. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  30885. },
  30886. args: [],
  30887. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  30888. referencedClasses: [],
  30889. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  30890. }),
  30891. $globals.AssignmentNode);
  30892. $core.addClass('BlockNode', $globals.Node, ['parameters', 'scope'], 'Compiler-AST');
  30893. $globals.BlockNode.comment="I represent an block closure node.";
  30894. $core.addMethod(
  30895. $core.method({
  30896. selector: "accept:",
  30897. protocol: 'visiting',
  30898. fn: function (aVisitor){
  30899. var self=this;
  30900. return $core.withContext(function($ctx1) {
  30901. return $recv(aVisitor)._visitBlockNode_(self);
  30902. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockNode)});
  30903. },
  30904. args: ["aVisitor"],
  30905. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  30906. referencedClasses: [],
  30907. messageSends: ["visitBlockNode:"]
  30908. }),
  30909. $globals.BlockNode);
  30910. $core.addMethod(
  30911. $core.method({
  30912. selector: "isBlockNode",
  30913. protocol: 'testing',
  30914. fn: function (){
  30915. var self=this;
  30916. return true;
  30917. },
  30918. args: [],
  30919. source: "isBlockNode\x0a\x09^ true",
  30920. referencedClasses: [],
  30921. messageSends: []
  30922. }),
  30923. $globals.BlockNode);
  30924. $core.addMethod(
  30925. $core.method({
  30926. selector: "parameters",
  30927. protocol: 'accessing',
  30928. fn: function (){
  30929. var self=this;
  30930. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  30931. return $core.withContext(function($ctx1) {
  30932. var $1,$receiver;
  30933. $1=self["@parameters"];
  30934. if(($receiver = $1) == null || $receiver.isNil){
  30935. self["@parameters"]=$recv($Array())._new();
  30936. return self["@parameters"];
  30937. } else {
  30938. return $1;
  30939. };
  30940. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  30941. },
  30942. args: [],
  30943. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  30944. referencedClasses: ["Array"],
  30945. messageSends: ["ifNil:", "new"]
  30946. }),
  30947. $globals.BlockNode);
  30948. $core.addMethod(
  30949. $core.method({
  30950. selector: "parameters:",
  30951. protocol: 'accessing',
  30952. fn: function (aCollection){
  30953. var self=this;
  30954. self["@parameters"]=aCollection;
  30955. return self;
  30956. },
  30957. args: ["aCollection"],
  30958. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  30959. referencedClasses: [],
  30960. messageSends: []
  30961. }),
  30962. $globals.BlockNode);
  30963. $core.addMethod(
  30964. $core.method({
  30965. selector: "scope",
  30966. protocol: 'accessing',
  30967. fn: function (){
  30968. var self=this;
  30969. return self["@scope"];
  30970. },
  30971. args: [],
  30972. source: "scope\x0a\x09^ scope",
  30973. referencedClasses: [],
  30974. messageSends: []
  30975. }),
  30976. $globals.BlockNode);
  30977. $core.addMethod(
  30978. $core.method({
  30979. selector: "scope:",
  30980. protocol: 'accessing',
  30981. fn: function (aLexicalScope){
  30982. var self=this;
  30983. self["@scope"]=aLexicalScope;
  30984. return self;
  30985. },
  30986. args: ["aLexicalScope"],
  30987. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  30988. referencedClasses: [],
  30989. messageSends: []
  30990. }),
  30991. $globals.BlockNode);
  30992. $core.addMethod(
  30993. $core.method({
  30994. selector: "subtreeNeedsAliasing",
  30995. protocol: 'testing',
  30996. fn: function (){
  30997. var self=this;
  30998. return $core.withContext(function($ctx1) {
  30999. return $recv(self._shouldBeAliased())._or_((function(){
  31000. return $core.withContext(function($ctx2) {
  31001. return self._shouldBeInlined();
  31002. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31003. }));
  31004. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  31005. },
  31006. args: [],
  31007. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [ self shouldBeInlined ]",
  31008. referencedClasses: [],
  31009. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined"]
  31010. }),
  31011. $globals.BlockNode);
  31012. $core.addClass('CascadeNode', $globals.Node, ['receiver'], 'Compiler-AST');
  31013. $globals.CascadeNode.comment="I represent an cascade node.";
  31014. $core.addMethod(
  31015. $core.method({
  31016. selector: "accept:",
  31017. protocol: 'visiting',
  31018. fn: function (aVisitor){
  31019. var self=this;
  31020. return $core.withContext(function($ctx1) {
  31021. return $recv(aVisitor)._visitCascadeNode_(self);
  31022. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.CascadeNode)});
  31023. },
  31024. args: ["aVisitor"],
  31025. source: "accept: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  31026. referencedClasses: [],
  31027. messageSends: ["visitCascadeNode:"]
  31028. }),
  31029. $globals.CascadeNode);
  31030. $core.addMethod(
  31031. $core.method({
  31032. selector: "isCascadeNode",
  31033. protocol: 'testing',
  31034. fn: function (){
  31035. var self=this;
  31036. return true;
  31037. },
  31038. args: [],
  31039. source: "isCascadeNode\x0a\x09^ true",
  31040. referencedClasses: [],
  31041. messageSends: []
  31042. }),
  31043. $globals.CascadeNode);
  31044. $core.addMethod(
  31045. $core.method({
  31046. selector: "receiver",
  31047. protocol: 'accessing',
  31048. fn: function (){
  31049. var self=this;
  31050. return self["@receiver"];
  31051. },
  31052. args: [],
  31053. source: "receiver\x0a\x09^ receiver",
  31054. referencedClasses: [],
  31055. messageSends: []
  31056. }),
  31057. $globals.CascadeNode);
  31058. $core.addMethod(
  31059. $core.method({
  31060. selector: "receiver:",
  31061. protocol: 'accessing',
  31062. fn: function (aNode){
  31063. var self=this;
  31064. self["@receiver"]=aNode;
  31065. return self;
  31066. },
  31067. args: ["aNode"],
  31068. source: "receiver: aNode\x0a\x09receiver := aNode",
  31069. referencedClasses: [],
  31070. messageSends: []
  31071. }),
  31072. $globals.CascadeNode);
  31073. $core.addMethod(
  31074. $core.method({
  31075. selector: "subtreeNeedsAliasing",
  31076. protocol: 'testing',
  31077. fn: function (){
  31078. var self=this;
  31079. return $core.withContext(function($ctx1) {
  31080. return $recv($recv(self._parent())._isSequenceNode())._not();
  31081. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.CascadeNode)});
  31082. },
  31083. args: [],
  31084. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  31085. referencedClasses: [],
  31086. messageSends: ["not", "isSequenceNode", "parent"]
  31087. }),
  31088. $globals.CascadeNode);
  31089. $core.addClass('DynamicArrayNode', $globals.Node, [], 'Compiler-AST');
  31090. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  31091. $core.addMethod(
  31092. $core.method({
  31093. selector: "accept:",
  31094. protocol: 'visiting',
  31095. fn: function (aVisitor){
  31096. var self=this;
  31097. return $core.withContext(function($ctx1) {
  31098. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  31099. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  31100. },
  31101. args: ["aVisitor"],
  31102. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  31103. referencedClasses: [],
  31104. messageSends: ["visitDynamicArrayNode:"]
  31105. }),
  31106. $globals.DynamicArrayNode);
  31107. $core.addClass('DynamicDictionaryNode', $globals.Node, [], 'Compiler-AST');
  31108. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  31109. $core.addMethod(
  31110. $core.method({
  31111. selector: "accept:",
  31112. protocol: 'visiting',
  31113. fn: function (aVisitor){
  31114. var self=this;
  31115. return $core.withContext(function($ctx1) {
  31116. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  31117. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  31118. },
  31119. args: ["aVisitor"],
  31120. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  31121. referencedClasses: [],
  31122. messageSends: ["visitDynamicDictionaryNode:"]
  31123. }),
  31124. $globals.DynamicDictionaryNode);
  31125. $core.addClass('JSStatementNode', $globals.Node, [], 'Compiler-AST');
  31126. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  31127. $core.addMethod(
  31128. $core.method({
  31129. selector: "accept:",
  31130. protocol: 'visiting',
  31131. fn: function (aVisitor){
  31132. var self=this;
  31133. return $core.withContext(function($ctx1) {
  31134. return $recv(aVisitor)._visitJSStatementNode_(self);
  31135. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  31136. },
  31137. args: ["aVisitor"],
  31138. source: "accept: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  31139. referencedClasses: [],
  31140. messageSends: ["visitJSStatementNode:"]
  31141. }),
  31142. $globals.JSStatementNode);
  31143. $core.addMethod(
  31144. $core.method({
  31145. selector: "isJSStatementNode",
  31146. protocol: 'testing',
  31147. fn: function (){
  31148. var self=this;
  31149. return true;
  31150. },
  31151. args: [],
  31152. source: "isJSStatementNode\x0a\x09^ true",
  31153. referencedClasses: [],
  31154. messageSends: []
  31155. }),
  31156. $globals.JSStatementNode);
  31157. $core.addMethod(
  31158. $core.method({
  31159. selector: "requiresSmalltalkContext",
  31160. protocol: 'testing',
  31161. fn: function (){
  31162. var self=this;
  31163. return true;
  31164. },
  31165. args: [],
  31166. source: "requiresSmalltalkContext\x0a\x09^ true",
  31167. referencedClasses: [],
  31168. messageSends: []
  31169. }),
  31170. $globals.JSStatementNode);
  31171. $core.addClass('MethodNode', $globals.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'sendIndexes'], 'Compiler-AST');
  31172. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  31173. $core.addMethod(
  31174. $core.method({
  31175. selector: "accept:",
  31176. protocol: 'visiting',
  31177. fn: function (aVisitor){
  31178. var self=this;
  31179. return $core.withContext(function($ctx1) {
  31180. return $recv(aVisitor)._visitMethodNode_(self);
  31181. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.MethodNode)});
  31182. },
  31183. args: ["aVisitor"],
  31184. source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  31185. referencedClasses: [],
  31186. messageSends: ["visitMethodNode:"]
  31187. }),
  31188. $globals.MethodNode);
  31189. $core.addMethod(
  31190. $core.method({
  31191. selector: "arguments",
  31192. protocol: 'accessing',
  31193. fn: function (){
  31194. var self=this;
  31195. return $core.withContext(function($ctx1) {
  31196. var $1,$receiver;
  31197. $1=self["@arguments"];
  31198. if(($receiver = $1) == null || $receiver.isNil){
  31199. return [];
  31200. } else {
  31201. return $1;
  31202. };
  31203. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  31204. },
  31205. args: [],
  31206. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  31207. referencedClasses: [],
  31208. messageSends: ["ifNil:"]
  31209. }),
  31210. $globals.MethodNode);
  31211. $core.addMethod(
  31212. $core.method({
  31213. selector: "arguments:",
  31214. protocol: 'accessing',
  31215. fn: function (aCollection){
  31216. var self=this;
  31217. self["@arguments"]=aCollection;
  31218. return self;
  31219. },
  31220. args: ["aCollection"],
  31221. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  31222. referencedClasses: [],
  31223. messageSends: []
  31224. }),
  31225. $globals.MethodNode);
  31226. $core.addMethod(
  31227. $core.method({
  31228. selector: "classReferences",
  31229. protocol: 'accessing',
  31230. fn: function (){
  31231. var self=this;
  31232. return self["@classReferences"];
  31233. },
  31234. args: [],
  31235. source: "classReferences\x0a\x09^ classReferences",
  31236. referencedClasses: [],
  31237. messageSends: []
  31238. }),
  31239. $globals.MethodNode);
  31240. $core.addMethod(
  31241. $core.method({
  31242. selector: "classReferences:",
  31243. protocol: 'accessing',
  31244. fn: function (aCollection){
  31245. var self=this;
  31246. self["@classReferences"]=aCollection;
  31247. return self;
  31248. },
  31249. args: ["aCollection"],
  31250. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  31251. referencedClasses: [],
  31252. messageSends: []
  31253. }),
  31254. $globals.MethodNode);
  31255. $core.addMethod(
  31256. $core.method({
  31257. selector: "messageSends",
  31258. protocol: 'accessing',
  31259. fn: function (){
  31260. var self=this;
  31261. return $core.withContext(function($ctx1) {
  31262. return $recv(self._sendIndexes())._keys();
  31263. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  31264. },
  31265. args: [],
  31266. source: "messageSends\x0a\x09^ self sendIndexes keys",
  31267. referencedClasses: [],
  31268. messageSends: ["keys", "sendIndexes"]
  31269. }),
  31270. $globals.MethodNode);
  31271. $core.addMethod(
  31272. $core.method({
  31273. selector: "method",
  31274. protocol: 'accessing',
  31275. fn: function (){
  31276. var self=this;
  31277. return self;
  31278. },
  31279. args: [],
  31280. source: "method\x0a\x09^ self",
  31281. referencedClasses: [],
  31282. messageSends: []
  31283. }),
  31284. $globals.MethodNode);
  31285. $core.addMethod(
  31286. $core.method({
  31287. selector: "scope",
  31288. protocol: 'accessing',
  31289. fn: function (){
  31290. var self=this;
  31291. return self["@scope"];
  31292. },
  31293. args: [],
  31294. source: "scope\x0a\x09^ scope",
  31295. referencedClasses: [],
  31296. messageSends: []
  31297. }),
  31298. $globals.MethodNode);
  31299. $core.addMethod(
  31300. $core.method({
  31301. selector: "scope:",
  31302. protocol: 'accessing',
  31303. fn: function (aMethodScope){
  31304. var self=this;
  31305. self["@scope"]=aMethodScope;
  31306. return self;
  31307. },
  31308. args: ["aMethodScope"],
  31309. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  31310. referencedClasses: [],
  31311. messageSends: []
  31312. }),
  31313. $globals.MethodNode);
  31314. $core.addMethod(
  31315. $core.method({
  31316. selector: "selector",
  31317. protocol: 'accessing',
  31318. fn: function (){
  31319. var self=this;
  31320. return self["@selector"];
  31321. },
  31322. args: [],
  31323. source: "selector\x0a\x09^ selector",
  31324. referencedClasses: [],
  31325. messageSends: []
  31326. }),
  31327. $globals.MethodNode);
  31328. $core.addMethod(
  31329. $core.method({
  31330. selector: "selector:",
  31331. protocol: 'accessing',
  31332. fn: function (aString){
  31333. var self=this;
  31334. self["@selector"]=aString;
  31335. return self;
  31336. },
  31337. args: ["aString"],
  31338. source: "selector: aString\x0a\x09selector := aString",
  31339. referencedClasses: [],
  31340. messageSends: []
  31341. }),
  31342. $globals.MethodNode);
  31343. $core.addMethod(
  31344. $core.method({
  31345. selector: "sendIndexes",
  31346. protocol: 'accessing',
  31347. fn: function (){
  31348. var self=this;
  31349. return self["@sendIndexes"];
  31350. },
  31351. args: [],
  31352. source: "sendIndexes\x0a\x09^ sendIndexes",
  31353. referencedClasses: [],
  31354. messageSends: []
  31355. }),
  31356. $globals.MethodNode);
  31357. $core.addMethod(
  31358. $core.method({
  31359. selector: "sendIndexes:",
  31360. protocol: 'accessing',
  31361. fn: function (aDictionary){
  31362. var self=this;
  31363. self["@sendIndexes"]=aDictionary;
  31364. return self;
  31365. },
  31366. args: ["aDictionary"],
  31367. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  31368. referencedClasses: [],
  31369. messageSends: []
  31370. }),
  31371. $globals.MethodNode);
  31372. $core.addMethod(
  31373. $core.method({
  31374. selector: "sequenceNode",
  31375. protocol: 'accessing',
  31376. fn: function (){
  31377. var self=this;
  31378. return $core.withContext(function($ctx1) {
  31379. var $1;
  31380. var $early={};
  31381. try {
  31382. $recv(self._nodes())._do_((function(each){
  31383. return $core.withContext(function($ctx2) {
  31384. $1=$recv(each)._isSequenceNode();
  31385. if($core.assert($1)){
  31386. throw $early=[each];
  31387. };
  31388. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31389. }));
  31390. return nil;
  31391. }
  31392. catch(e) {if(e===$early)return e[0]; throw e}
  31393. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  31394. },
  31395. args: [],
  31396. source: "sequenceNode\x0a\x09self nodes do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  31397. referencedClasses: [],
  31398. messageSends: ["do:", "nodes", "ifTrue:", "isSequenceNode"]
  31399. }),
  31400. $globals.MethodNode);
  31401. $core.addMethod(
  31402. $core.method({
  31403. selector: "source",
  31404. protocol: 'accessing',
  31405. fn: function (){
  31406. var self=this;
  31407. return self["@source"];
  31408. },
  31409. args: [],
  31410. source: "source\x0a\x09^ source",
  31411. referencedClasses: [],
  31412. messageSends: []
  31413. }),
  31414. $globals.MethodNode);
  31415. $core.addMethod(
  31416. $core.method({
  31417. selector: "source:",
  31418. protocol: 'accessing',
  31419. fn: function (aString){
  31420. var self=this;
  31421. self["@source"]=aString;
  31422. return self;
  31423. },
  31424. args: ["aString"],
  31425. source: "source: aString\x0a\x09source := aString",
  31426. referencedClasses: [],
  31427. messageSends: []
  31428. }),
  31429. $globals.MethodNode);
  31430. $core.addClass('ReturnNode', $globals.Node, ['scope'], 'Compiler-AST');
  31431. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  31432. $core.addMethod(
  31433. $core.method({
  31434. selector: "accept:",
  31435. protocol: 'visiting',
  31436. fn: function (aVisitor){
  31437. var self=this;
  31438. return $core.withContext(function($ctx1) {
  31439. return $recv(aVisitor)._visitReturnNode_(self);
  31440. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ReturnNode)});
  31441. },
  31442. args: ["aVisitor"],
  31443. source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  31444. referencedClasses: [],
  31445. messageSends: ["visitReturnNode:"]
  31446. }),
  31447. $globals.ReturnNode);
  31448. $core.addMethod(
  31449. $core.method({
  31450. selector: "isReturnNode",
  31451. protocol: 'testing',
  31452. fn: function (){
  31453. var self=this;
  31454. return true;
  31455. },
  31456. args: [],
  31457. source: "isReturnNode\x0a\x09^ true",
  31458. referencedClasses: [],
  31459. messageSends: []
  31460. }),
  31461. $globals.ReturnNode);
  31462. $core.addMethod(
  31463. $core.method({
  31464. selector: "nonLocalReturn",
  31465. protocol: 'testing',
  31466. fn: function (){
  31467. var self=this;
  31468. return $core.withContext(function($ctx1) {
  31469. return $recv($recv(self._scope())._isMethodScope())._not();
  31470. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  31471. },
  31472. args: [],
  31473. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  31474. referencedClasses: [],
  31475. messageSends: ["not", "isMethodScope", "scope"]
  31476. }),
  31477. $globals.ReturnNode);
  31478. $core.addMethod(
  31479. $core.method({
  31480. selector: "scope",
  31481. protocol: 'accessing',
  31482. fn: function (){
  31483. var self=this;
  31484. return self["@scope"];
  31485. },
  31486. args: [],
  31487. source: "scope\x0a\x09^ scope",
  31488. referencedClasses: [],
  31489. messageSends: []
  31490. }),
  31491. $globals.ReturnNode);
  31492. $core.addMethod(
  31493. $core.method({
  31494. selector: "scope:",
  31495. protocol: 'accessing',
  31496. fn: function (aLexicalScope){
  31497. var self=this;
  31498. self["@scope"]=aLexicalScope;
  31499. return self;
  31500. },
  31501. args: ["aLexicalScope"],
  31502. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  31503. referencedClasses: [],
  31504. messageSends: []
  31505. }),
  31506. $globals.ReturnNode);
  31507. $core.addClass('SendNode', $globals.Node, ['selector', 'arguments', 'receiver', 'index'], 'Compiler-AST');
  31508. $globals.SendNode.comment="I represent an message send node.";
  31509. $core.addMethod(
  31510. $core.method({
  31511. selector: "accept:",
  31512. protocol: 'visiting',
  31513. fn: function (aVisitor){
  31514. var self=this;
  31515. return $core.withContext(function($ctx1) {
  31516. return $recv(aVisitor)._visitSendNode_(self);
  31517. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SendNode)});
  31518. },
  31519. args: ["aVisitor"],
  31520. source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  31521. referencedClasses: [],
  31522. messageSends: ["visitSendNode:"]
  31523. }),
  31524. $globals.SendNode);
  31525. $core.addMethod(
  31526. $core.method({
  31527. selector: "arguments",
  31528. protocol: 'accessing',
  31529. fn: function (){
  31530. var self=this;
  31531. return $core.withContext(function($ctx1) {
  31532. var $1,$receiver;
  31533. $1=self["@arguments"];
  31534. if(($receiver = $1) == null || $receiver.isNil){
  31535. self["@arguments"]=[];
  31536. return self["@arguments"];
  31537. } else {
  31538. return $1;
  31539. };
  31540. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  31541. },
  31542. args: [],
  31543. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  31544. referencedClasses: [],
  31545. messageSends: ["ifNil:"]
  31546. }),
  31547. $globals.SendNode);
  31548. $core.addMethod(
  31549. $core.method({
  31550. selector: "arguments:",
  31551. protocol: 'accessing',
  31552. fn: function (aCollection){
  31553. var self=this;
  31554. return $core.withContext(function($ctx1) {
  31555. self["@arguments"]=aCollection;
  31556. $recv(aCollection)._do_((function(each){
  31557. return $core.withContext(function($ctx2) {
  31558. return $recv(each)._parent_(self);
  31559. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31560. }));
  31561. return self;
  31562. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.SendNode)});
  31563. },
  31564. args: ["aCollection"],
  31565. source: "arguments: aCollection\x0a\x09arguments := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  31566. referencedClasses: [],
  31567. messageSends: ["do:", "parent:"]
  31568. }),
  31569. $globals.SendNode);
  31570. $core.addMethod(
  31571. $core.method({
  31572. selector: "cascadeNodeWithMessages:",
  31573. protocol: 'accessing',
  31574. fn: function (aCollection){
  31575. var self=this;
  31576. var first;
  31577. function $SendNode(){return $globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  31578. function $CascadeNode(){return $globals.CascadeNode||(typeof CascadeNode=="undefined"?nil:CascadeNode)}
  31579. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  31580. return $core.withContext(function($ctx1) {
  31581. var $1,$2,$3;
  31582. $1=$recv($SendNode())._new();
  31583. $ctx1.sendIdx["new"]=1;
  31584. $recv($1)._selector_(self._selector());
  31585. $recv($1)._arguments_(self._arguments());
  31586. $2=$recv($1)._yourself();
  31587. $ctx1.sendIdx["yourself"]=1;
  31588. first=$2;
  31589. $3=$recv($CascadeNode())._new();
  31590. $recv($3)._receiver_(self._receiver());
  31591. $recv($3)._nodes_($recv($recv($Array())._with_(first)).__comma(aCollection));
  31592. return $recv($3)._yourself();
  31593. }, function($ctx1) {$ctx1.fill(self,"cascadeNodeWithMessages:",{aCollection:aCollection,first:first},$globals.SendNode)});
  31594. },
  31595. args: ["aCollection"],
  31596. 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",
  31597. referencedClasses: ["SendNode", "CascadeNode", "Array"],
  31598. messageSends: ["selector:", "new", "selector", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"]
  31599. }),
  31600. $globals.SendNode);
  31601. $core.addMethod(
  31602. $core.method({
  31603. selector: "index",
  31604. protocol: 'accessing',
  31605. fn: function (){
  31606. var self=this;
  31607. return self["@index"];
  31608. },
  31609. args: [],
  31610. source: "index\x0a\x09^ index",
  31611. referencedClasses: [],
  31612. messageSends: []
  31613. }),
  31614. $globals.SendNode);
  31615. $core.addMethod(
  31616. $core.method({
  31617. selector: "index:",
  31618. protocol: 'accessing',
  31619. fn: function (anInteger){
  31620. var self=this;
  31621. self["@index"]=anInteger;
  31622. return self;
  31623. },
  31624. args: ["anInteger"],
  31625. source: "index: anInteger\x0a\x09index := anInteger",
  31626. referencedClasses: [],
  31627. messageSends: []
  31628. }),
  31629. $globals.SendNode);
  31630. $core.addMethod(
  31631. $core.method({
  31632. selector: "isCascadeSendNode",
  31633. protocol: 'testing',
  31634. fn: function (){
  31635. var self=this;
  31636. return $core.withContext(function($ctx1) {
  31637. return $recv(self._parent())._isCascadeNode();
  31638. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  31639. },
  31640. args: [],
  31641. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  31642. referencedClasses: [],
  31643. messageSends: ["isCascadeNode", "parent"]
  31644. }),
  31645. $globals.SendNode);
  31646. $core.addMethod(
  31647. $core.method({
  31648. selector: "isNavigationNode",
  31649. protocol: 'testing',
  31650. fn: function (){
  31651. var self=this;
  31652. return true;
  31653. },
  31654. args: [],
  31655. source: "isNavigationNode\x0a\x09^ true",
  31656. referencedClasses: [],
  31657. messageSends: []
  31658. }),
  31659. $globals.SendNode);
  31660. $core.addMethod(
  31661. $core.method({
  31662. selector: "isSendNode",
  31663. protocol: 'testing',
  31664. fn: function (){
  31665. var self=this;
  31666. return true;
  31667. },
  31668. args: [],
  31669. source: "isSendNode\x0a\x09^ true",
  31670. referencedClasses: [],
  31671. messageSends: []
  31672. }),
  31673. $globals.SendNode);
  31674. $core.addMethod(
  31675. $core.method({
  31676. selector: "navigationLink",
  31677. protocol: 'accessing',
  31678. fn: function (){
  31679. var self=this;
  31680. return $core.withContext(function($ctx1) {
  31681. return self._selector();
  31682. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  31683. },
  31684. args: [],
  31685. source: "navigationLink\x0a\x09^ self selector",
  31686. referencedClasses: [],
  31687. messageSends: ["selector"]
  31688. }),
  31689. $globals.SendNode);
  31690. $core.addMethod(
  31691. $core.method({
  31692. selector: "nodes",
  31693. protocol: 'accessing',
  31694. fn: function (){
  31695. var self=this;
  31696. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  31697. return $core.withContext(function($ctx1) {
  31698. var $1,$2,$3,$receiver;
  31699. $1=self._receiver();
  31700. $ctx1.sendIdx["receiver"]=1;
  31701. if(($receiver = $1) == null || $receiver.isNil){
  31702. $2=self._arguments();
  31703. $ctx1.sendIdx["arguments"]=1;
  31704. return $recv($2)._copy();
  31705. } else {
  31706. $1;
  31707. };
  31708. $3=$recv($Array())._with_(self._receiver());
  31709. $recv($3)._addAll_(self._arguments());
  31710. return $recv($3)._yourself();
  31711. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.SendNode)});
  31712. },
  31713. args: [],
  31714. 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",
  31715. referencedClasses: ["Array"],
  31716. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  31717. }),
  31718. $globals.SendNode);
  31719. $core.addMethod(
  31720. $core.method({
  31721. selector: "receiver",
  31722. protocol: 'accessing',
  31723. fn: function (){
  31724. var self=this;
  31725. return self["@receiver"];
  31726. },
  31727. args: [],
  31728. source: "receiver\x0a\x09^ receiver",
  31729. referencedClasses: [],
  31730. messageSends: []
  31731. }),
  31732. $globals.SendNode);
  31733. $core.addMethod(
  31734. $core.method({
  31735. selector: "receiver:",
  31736. protocol: 'accessing',
  31737. fn: function (aNode){
  31738. var self=this;
  31739. return $core.withContext(function($ctx1) {
  31740. var $1;
  31741. self["@receiver"]=aNode;
  31742. $1=$recv(aNode)._isNode();
  31743. if($core.assert($1)){
  31744. $recv(aNode)._parent_(self);
  31745. };
  31746. return self;
  31747. }, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},$globals.SendNode)});
  31748. },
  31749. args: ["aNode"],
  31750. source: "receiver: aNode\x0a\x09receiver := aNode.\x0a\x09aNode isNode ifTrue: [\x0a\x09\x09aNode parent: self ]",
  31751. referencedClasses: [],
  31752. messageSends: ["ifTrue:", "isNode", "parent:"]
  31753. }),
  31754. $globals.SendNode);
  31755. $core.addMethod(
  31756. $core.method({
  31757. selector: "requiresSmalltalkContext",
  31758. protocol: 'testing',
  31759. fn: function (){
  31760. var self=this;
  31761. return true;
  31762. },
  31763. args: [],
  31764. source: "requiresSmalltalkContext\x0a\x09^ true",
  31765. referencedClasses: [],
  31766. messageSends: []
  31767. }),
  31768. $globals.SendNode);
  31769. $core.addMethod(
  31770. $core.method({
  31771. selector: "selector",
  31772. protocol: 'accessing',
  31773. fn: function (){
  31774. var self=this;
  31775. return self["@selector"];
  31776. },
  31777. args: [],
  31778. source: "selector\x0a\x09^ selector",
  31779. referencedClasses: [],
  31780. messageSends: []
  31781. }),
  31782. $globals.SendNode);
  31783. $core.addMethod(
  31784. $core.method({
  31785. selector: "selector:",
  31786. protocol: 'accessing',
  31787. fn: function (aString){
  31788. var self=this;
  31789. self["@selector"]=aString;
  31790. return self;
  31791. },
  31792. args: ["aString"],
  31793. source: "selector: aString\x0a\x09selector := aString",
  31794. referencedClasses: [],
  31795. messageSends: []
  31796. }),
  31797. $globals.SendNode);
  31798. $core.addMethod(
  31799. $core.method({
  31800. selector: "shouldBeAliased",
  31801. protocol: 'testing',
  31802. fn: function (){
  31803. var self=this;
  31804. var sends;
  31805. return $core.withContext(function($ctx1) {
  31806. var $2,$1;
  31807. sends=$recv($recv($recv(self._method())._sendIndexes())._at_(self._selector()))._size();
  31808. $2=(
  31809. $ctx1.supercall = true,
  31810. ($globals.SendNode.superclass||$boot.dnu).fn.prototype._shouldBeAliased.apply($recv(self), []));
  31811. $ctx1.supercall = false;
  31812. $1=$recv($2)._or_((function(){
  31813. return $core.withContext(function($ctx2) {
  31814. return $recv(self._isReferenced())._and_((function(){
  31815. return $core.withContext(function($ctx3) {
  31816. return $recv($recv($recv(sends).__gt((1)))._and_((function(){
  31817. return $core.withContext(function($ctx4) {
  31818. return $recv(self._index()).__lt(sends);
  31819. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  31820. })))._or_((function(){
  31821. return $core.withContext(function($ctx4) {
  31822. return self._superSend();
  31823. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  31824. }));
  31825. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  31826. }));
  31827. $ctx2.sendIdx["and:"]=1;
  31828. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31829. }));
  31830. $ctx1.sendIdx["or:"]=1;
  31831. return $1;
  31832. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  31833. },
  31834. args: [],
  31835. 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 ] ] ])",
  31836. referencedClasses: [],
  31837. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", ">", "<", "index", "superSend"]
  31838. }),
  31839. $globals.SendNode);
  31840. $core.addMethod(
  31841. $core.method({
  31842. selector: "superSend",
  31843. protocol: 'accessing',
  31844. fn: function (){
  31845. var self=this;
  31846. return $core.withContext(function($ctx1) {
  31847. return $recv($recv(self._receiver())._value()).__eq("super");
  31848. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  31849. },
  31850. args: [],
  31851. source: "superSend\x0a\x09^ self receiver value = 'super'",
  31852. referencedClasses: [],
  31853. messageSends: ["=", "value", "receiver"]
  31854. }),
  31855. $globals.SendNode);
  31856. $core.addMethod(
  31857. $core.method({
  31858. selector: "valueForReceiver:",
  31859. protocol: 'building',
  31860. fn: function (anObject){
  31861. var self=this;
  31862. function $SendNode(){return $globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  31863. return $core.withContext(function($ctx1) {
  31864. var $1,$3,$2,$receiver;
  31865. $1=$recv($SendNode())._new();
  31866. $recv($1)._position_(self._position());
  31867. $recv($1)._source_(self._source());
  31868. $3=self._receiver();
  31869. $ctx1.sendIdx["receiver"]=1;
  31870. if(($receiver = $3) == null || $receiver.isNil){
  31871. $2=anObject;
  31872. } else {
  31873. $2=$recv(self._receiver())._valueForReceiver_(anObject);
  31874. };
  31875. $recv($1)._receiver_($2);
  31876. $recv($1)._selector_(self._selector());
  31877. $recv($1)._arguments_(self._arguments());
  31878. return $recv($1)._yourself();
  31879. }, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},$globals.SendNode)});
  31880. },
  31881. args: ["anObject"],
  31882. 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",
  31883. referencedClasses: ["SendNode"],
  31884. messageSends: ["position:", "new", "position", "source:", "source", "receiver:", "ifNil:ifNotNil:", "receiver", "valueForReceiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  31885. }),
  31886. $globals.SendNode);
  31887. $core.addClass('SequenceNode', $globals.Node, ['temps', 'scope'], 'Compiler-AST');
  31888. $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).";
  31889. $core.addMethod(
  31890. $core.method({
  31891. selector: "accept:",
  31892. protocol: 'visiting',
  31893. fn: function (aVisitor){
  31894. var self=this;
  31895. return $core.withContext(function($ctx1) {
  31896. return $recv(aVisitor)._visitSequenceNode_(self);
  31897. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SequenceNode)});
  31898. },
  31899. args: ["aVisitor"],
  31900. source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  31901. referencedClasses: [],
  31902. messageSends: ["visitSequenceNode:"]
  31903. }),
  31904. $globals.SequenceNode);
  31905. $core.addMethod(
  31906. $core.method({
  31907. selector: "asBlockSequenceNode",
  31908. protocol: 'building',
  31909. fn: function (){
  31910. var self=this;
  31911. function $BlockSequenceNode(){return $globals.BlockSequenceNode||(typeof BlockSequenceNode=="undefined"?nil:BlockSequenceNode)}
  31912. return $core.withContext(function($ctx1) {
  31913. var $1;
  31914. $1=$recv($BlockSequenceNode())._new();
  31915. $recv($1)._position_(self._position());
  31916. $recv($1)._source_(self._source());
  31917. $recv($1)._nodes_(self._nodes());
  31918. $recv($1)._temps_(self._temps());
  31919. return $recv($1)._yourself();
  31920. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  31921. },
  31922. args: [],
  31923. 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",
  31924. referencedClasses: ["BlockSequenceNode"],
  31925. messageSends: ["position:", "new", "position", "source:", "source", "nodes:", "nodes", "temps:", "temps", "yourself"]
  31926. }),
  31927. $globals.SequenceNode);
  31928. $core.addMethod(
  31929. $core.method({
  31930. selector: "isSequenceNode",
  31931. protocol: 'testing',
  31932. fn: function (){
  31933. var self=this;
  31934. return true;
  31935. },
  31936. args: [],
  31937. source: "isSequenceNode\x0a\x09^ true",
  31938. referencedClasses: [],
  31939. messageSends: []
  31940. }),
  31941. $globals.SequenceNode);
  31942. $core.addMethod(
  31943. $core.method({
  31944. selector: "scope",
  31945. protocol: 'accessing',
  31946. fn: function (){
  31947. var self=this;
  31948. return self["@scope"];
  31949. },
  31950. args: [],
  31951. source: "scope\x0a\x09^ scope",
  31952. referencedClasses: [],
  31953. messageSends: []
  31954. }),
  31955. $globals.SequenceNode);
  31956. $core.addMethod(
  31957. $core.method({
  31958. selector: "scope:",
  31959. protocol: 'accessing',
  31960. fn: function (aLexicalScope){
  31961. var self=this;
  31962. self["@scope"]=aLexicalScope;
  31963. return self;
  31964. },
  31965. args: ["aLexicalScope"],
  31966. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  31967. referencedClasses: [],
  31968. messageSends: []
  31969. }),
  31970. $globals.SequenceNode);
  31971. $core.addMethod(
  31972. $core.method({
  31973. selector: "temps",
  31974. protocol: 'accessing',
  31975. fn: function (){
  31976. var self=this;
  31977. return $core.withContext(function($ctx1) {
  31978. var $1,$receiver;
  31979. $1=self["@temps"];
  31980. if(($receiver = $1) == null || $receiver.isNil){
  31981. return [];
  31982. } else {
  31983. return $1;
  31984. };
  31985. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  31986. },
  31987. args: [],
  31988. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  31989. referencedClasses: [],
  31990. messageSends: ["ifNil:"]
  31991. }),
  31992. $globals.SequenceNode);
  31993. $core.addMethod(
  31994. $core.method({
  31995. selector: "temps:",
  31996. protocol: 'accessing',
  31997. fn: function (aCollection){
  31998. var self=this;
  31999. self["@temps"]=aCollection;
  32000. return self;
  32001. },
  32002. args: ["aCollection"],
  32003. source: "temps: aCollection\x0a\x09temps := aCollection",
  32004. referencedClasses: [],
  32005. messageSends: []
  32006. }),
  32007. $globals.SequenceNode);
  32008. $core.addClass('BlockSequenceNode', $globals.SequenceNode, [], 'Compiler-AST');
  32009. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  32010. $core.addMethod(
  32011. $core.method({
  32012. selector: "accept:",
  32013. protocol: 'visiting',
  32014. fn: function (aVisitor){
  32015. var self=this;
  32016. return $core.withContext(function($ctx1) {
  32017. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  32018. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  32019. },
  32020. args: ["aVisitor"],
  32021. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  32022. referencedClasses: [],
  32023. messageSends: ["visitBlockSequenceNode:"]
  32024. }),
  32025. $globals.BlockSequenceNode);
  32026. $core.addMethod(
  32027. $core.method({
  32028. selector: "isBlockSequenceNode",
  32029. protocol: 'testing',
  32030. fn: function (){
  32031. var self=this;
  32032. return true;
  32033. },
  32034. args: [],
  32035. source: "isBlockSequenceNode\x0a\x09^ true",
  32036. referencedClasses: [],
  32037. messageSends: []
  32038. }),
  32039. $globals.BlockSequenceNode);
  32040. $core.addClass('ValueNode', $globals.Node, ['value'], 'Compiler-AST');
  32041. $globals.ValueNode.comment="I represent a value node.";
  32042. $core.addMethod(
  32043. $core.method({
  32044. selector: "accept:",
  32045. protocol: 'visiting',
  32046. fn: function (aVisitor){
  32047. var self=this;
  32048. return $core.withContext(function($ctx1) {
  32049. return $recv(aVisitor)._visitValueNode_(self);
  32050. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ValueNode)});
  32051. },
  32052. args: ["aVisitor"],
  32053. source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  32054. referencedClasses: [],
  32055. messageSends: ["visitValueNode:"]
  32056. }),
  32057. $globals.ValueNode);
  32058. $core.addMethod(
  32059. $core.method({
  32060. selector: "isImmutable",
  32061. protocol: 'testing',
  32062. fn: function (){
  32063. var self=this;
  32064. return $core.withContext(function($ctx1) {
  32065. return $recv(self._value())._isImmutable();
  32066. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  32067. },
  32068. args: [],
  32069. source: "isImmutable\x0a\x09^ self value isImmutable",
  32070. referencedClasses: [],
  32071. messageSends: ["isImmutable", "value"]
  32072. }),
  32073. $globals.ValueNode);
  32074. $core.addMethod(
  32075. $core.method({
  32076. selector: "isValueNode",
  32077. protocol: 'testing',
  32078. fn: function (){
  32079. var self=this;
  32080. return true;
  32081. },
  32082. args: [],
  32083. source: "isValueNode\x0a\x09^ true",
  32084. referencedClasses: [],
  32085. messageSends: []
  32086. }),
  32087. $globals.ValueNode);
  32088. $core.addMethod(
  32089. $core.method({
  32090. selector: "value",
  32091. protocol: 'accessing',
  32092. fn: function (){
  32093. var self=this;
  32094. return self["@value"];
  32095. },
  32096. args: [],
  32097. source: "value\x0a\x09^ value",
  32098. referencedClasses: [],
  32099. messageSends: []
  32100. }),
  32101. $globals.ValueNode);
  32102. $core.addMethod(
  32103. $core.method({
  32104. selector: "value:",
  32105. protocol: 'accessing',
  32106. fn: function (anObject){
  32107. var self=this;
  32108. self["@value"]=anObject;
  32109. return self;
  32110. },
  32111. args: ["anObject"],
  32112. source: "value: anObject\x0a\x09value := anObject",
  32113. referencedClasses: [],
  32114. messageSends: []
  32115. }),
  32116. $globals.ValueNode);
  32117. $core.addClass('VariableNode', $globals.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
  32118. $globals.VariableNode.comment="I represent an variable node.";
  32119. $core.addMethod(
  32120. $core.method({
  32121. selector: "accept:",
  32122. protocol: 'visiting',
  32123. fn: function (aVisitor){
  32124. var self=this;
  32125. return $core.withContext(function($ctx1) {
  32126. return $recv(aVisitor)._visitVariableNode_(self);
  32127. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.VariableNode)});
  32128. },
  32129. args: ["aVisitor"],
  32130. source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  32131. referencedClasses: [],
  32132. messageSends: ["visitVariableNode:"]
  32133. }),
  32134. $globals.VariableNode);
  32135. $core.addMethod(
  32136. $core.method({
  32137. selector: "alias",
  32138. protocol: 'accessing',
  32139. fn: function (){
  32140. var self=this;
  32141. return $core.withContext(function($ctx1) {
  32142. return $recv(self._binding())._alias();
  32143. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  32144. },
  32145. args: [],
  32146. source: "alias\x0a\x09^ self binding alias",
  32147. referencedClasses: [],
  32148. messageSends: ["alias", "binding"]
  32149. }),
  32150. $globals.VariableNode);
  32151. $core.addMethod(
  32152. $core.method({
  32153. selector: "assigned",
  32154. protocol: 'accessing',
  32155. fn: function (){
  32156. var self=this;
  32157. return $core.withContext(function($ctx1) {
  32158. var $1,$receiver;
  32159. $1=self["@assigned"];
  32160. if(($receiver = $1) == null || $receiver.isNil){
  32161. return false;
  32162. } else {
  32163. return $1;
  32164. };
  32165. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  32166. },
  32167. args: [],
  32168. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  32169. referencedClasses: [],
  32170. messageSends: ["ifNil:"]
  32171. }),
  32172. $globals.VariableNode);
  32173. $core.addMethod(
  32174. $core.method({
  32175. selector: "assigned:",
  32176. protocol: 'accessing',
  32177. fn: function (aBoolean){
  32178. var self=this;
  32179. self["@assigned"]=aBoolean;
  32180. return self;
  32181. },
  32182. args: ["aBoolean"],
  32183. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  32184. referencedClasses: [],
  32185. messageSends: []
  32186. }),
  32187. $globals.VariableNode);
  32188. $core.addMethod(
  32189. $core.method({
  32190. selector: "beAssigned",
  32191. protocol: 'accessing',
  32192. fn: function (){
  32193. var self=this;
  32194. return $core.withContext(function($ctx1) {
  32195. $recv(self._binding())._validateAssignment();
  32196. self["@assigned"]=true;
  32197. return self;
  32198. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  32199. },
  32200. args: [],
  32201. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  32202. referencedClasses: [],
  32203. messageSends: ["validateAssignment", "binding"]
  32204. }),
  32205. $globals.VariableNode);
  32206. $core.addMethod(
  32207. $core.method({
  32208. selector: "binding",
  32209. protocol: 'accessing',
  32210. fn: function (){
  32211. var self=this;
  32212. return self["@binding"];
  32213. },
  32214. args: [],
  32215. source: "binding\x0a\x09^ binding",
  32216. referencedClasses: [],
  32217. messageSends: []
  32218. }),
  32219. $globals.VariableNode);
  32220. $core.addMethod(
  32221. $core.method({
  32222. selector: "binding:",
  32223. protocol: 'accessing',
  32224. fn: function (aScopeVar){
  32225. var self=this;
  32226. self["@binding"]=aScopeVar;
  32227. return self;
  32228. },
  32229. args: ["aScopeVar"],
  32230. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  32231. referencedClasses: [],
  32232. messageSends: []
  32233. }),
  32234. $globals.VariableNode);
  32235. $core.addMethod(
  32236. $core.method({
  32237. selector: "isArgument",
  32238. protocol: 'testing',
  32239. fn: function (){
  32240. var self=this;
  32241. return $core.withContext(function($ctx1) {
  32242. return $recv(self._binding())._isArgVar();
  32243. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  32244. },
  32245. args: [],
  32246. source: "isArgument\x0a\x09^ self binding isArgVar",
  32247. referencedClasses: [],
  32248. messageSends: ["isArgVar", "binding"]
  32249. }),
  32250. $globals.VariableNode);
  32251. $core.addMethod(
  32252. $core.method({
  32253. selector: "isImmutable",
  32254. protocol: 'testing',
  32255. fn: function (){
  32256. var self=this;
  32257. return $core.withContext(function($ctx1) {
  32258. return $recv(self._binding())._isImmutable();
  32259. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  32260. },
  32261. args: [],
  32262. source: "isImmutable\x0a\x09^ self binding isImmutable",
  32263. referencedClasses: [],
  32264. messageSends: ["isImmutable", "binding"]
  32265. }),
  32266. $globals.VariableNode);
  32267. $core.addMethod(
  32268. $core.method({
  32269. selector: "isNavigationNode",
  32270. protocol: 'testing',
  32271. fn: function (){
  32272. var self=this;
  32273. return true;
  32274. },
  32275. args: [],
  32276. source: "isNavigationNode\x0a\x09^ true",
  32277. referencedClasses: [],
  32278. messageSends: []
  32279. }),
  32280. $globals.VariableNode);
  32281. $core.addMethod(
  32282. $core.method({
  32283. selector: "isVariableNode",
  32284. protocol: 'testing',
  32285. fn: function (){
  32286. var self=this;
  32287. return true;
  32288. },
  32289. args: [],
  32290. source: "isVariableNode\x0a\x09^ true",
  32291. referencedClasses: [],
  32292. messageSends: []
  32293. }),
  32294. $globals.VariableNode);
  32295. $core.addMethod(
  32296. $core.method({
  32297. selector: "navigationLink",
  32298. protocol: 'accessing',
  32299. fn: function (){
  32300. var self=this;
  32301. return $core.withContext(function($ctx1) {
  32302. return self._value();
  32303. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  32304. },
  32305. args: [],
  32306. source: "navigationLink\x0a\x09^ self value",
  32307. referencedClasses: [],
  32308. messageSends: ["value"]
  32309. }),
  32310. $globals.VariableNode);
  32311. $core.addClass('NodeVisitor', $globals.Object, [], 'Compiler-AST');
  32312. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  32313. $core.addMethod(
  32314. $core.method({
  32315. selector: "visit:",
  32316. protocol: 'visiting',
  32317. fn: function (aNode){
  32318. var self=this;
  32319. return $core.withContext(function($ctx1) {
  32320. return $recv(aNode)._accept_(self);
  32321. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.NodeVisitor)});
  32322. },
  32323. args: ["aNode"],
  32324. source: "visit: aNode\x0a\x09^ aNode accept: self",
  32325. referencedClasses: [],
  32326. messageSends: ["accept:"]
  32327. }),
  32328. $globals.NodeVisitor);
  32329. $core.addMethod(
  32330. $core.method({
  32331. selector: "visitAll:",
  32332. protocol: 'visiting',
  32333. fn: function (aCollection){
  32334. var self=this;
  32335. return $core.withContext(function($ctx1) {
  32336. return $recv(aCollection)._collect_((function(each){
  32337. return $core.withContext(function($ctx2) {
  32338. return self._visit_(each);
  32339. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32340. }));
  32341. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.NodeVisitor)});
  32342. },
  32343. args: ["aCollection"],
  32344. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  32345. referencedClasses: [],
  32346. messageSends: ["collect:", "visit:"]
  32347. }),
  32348. $globals.NodeVisitor);
  32349. $core.addMethod(
  32350. $core.method({
  32351. selector: "visitAssignmentNode:",
  32352. protocol: 'visiting',
  32353. fn: function (aNode){
  32354. var self=this;
  32355. return $core.withContext(function($ctx1) {
  32356. return self._visitNode_(aNode);
  32357. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  32358. },
  32359. args: ["aNode"],
  32360. source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
  32361. referencedClasses: [],
  32362. messageSends: ["visitNode:"]
  32363. }),
  32364. $globals.NodeVisitor);
  32365. $core.addMethod(
  32366. $core.method({
  32367. selector: "visitBlockNode:",
  32368. protocol: 'visiting',
  32369. fn: function (aNode){
  32370. var self=this;
  32371. return $core.withContext(function($ctx1) {
  32372. return self._visitNode_(aNode);
  32373. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  32374. },
  32375. args: ["aNode"],
  32376. source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
  32377. referencedClasses: [],
  32378. messageSends: ["visitNode:"]
  32379. }),
  32380. $globals.NodeVisitor);
  32381. $core.addMethod(
  32382. $core.method({
  32383. selector: "visitBlockSequenceNode:",
  32384. protocol: 'visiting',
  32385. fn: function (aNode){
  32386. var self=this;
  32387. return $core.withContext(function($ctx1) {
  32388. return self._visitSequenceNode_(aNode);
  32389. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  32390. },
  32391. args: ["aNode"],
  32392. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  32393. referencedClasses: [],
  32394. messageSends: ["visitSequenceNode:"]
  32395. }),
  32396. $globals.NodeVisitor);
  32397. $core.addMethod(
  32398. $core.method({
  32399. selector: "visitCascadeNode:",
  32400. protocol: 'visiting',
  32401. fn: function (aNode){
  32402. var self=this;
  32403. return $core.withContext(function($ctx1) {
  32404. return self._visitNode_(aNode);
  32405. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  32406. },
  32407. args: ["aNode"],
  32408. source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
  32409. referencedClasses: [],
  32410. messageSends: ["visitNode:"]
  32411. }),
  32412. $globals.NodeVisitor);
  32413. $core.addMethod(
  32414. $core.method({
  32415. selector: "visitDynamicArrayNode:",
  32416. protocol: 'visiting',
  32417. fn: function (aNode){
  32418. var self=this;
  32419. return $core.withContext(function($ctx1) {
  32420. return self._visitNode_(aNode);
  32421. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  32422. },
  32423. args: ["aNode"],
  32424. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
  32425. referencedClasses: [],
  32426. messageSends: ["visitNode:"]
  32427. }),
  32428. $globals.NodeVisitor);
  32429. $core.addMethod(
  32430. $core.method({
  32431. selector: "visitDynamicDictionaryNode:",
  32432. protocol: 'visiting',
  32433. fn: function (aNode){
  32434. var self=this;
  32435. return $core.withContext(function($ctx1) {
  32436. return self._visitNode_(aNode);
  32437. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  32438. },
  32439. args: ["aNode"],
  32440. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
  32441. referencedClasses: [],
  32442. messageSends: ["visitNode:"]
  32443. }),
  32444. $globals.NodeVisitor);
  32445. $core.addMethod(
  32446. $core.method({
  32447. selector: "visitJSStatementNode:",
  32448. protocol: 'visiting',
  32449. fn: function (aNode){
  32450. var self=this;
  32451. return $core.withContext(function($ctx1) {
  32452. return self._visitNode_(aNode);
  32453. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  32454. },
  32455. args: ["aNode"],
  32456. source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
  32457. referencedClasses: [],
  32458. messageSends: ["visitNode:"]
  32459. }),
  32460. $globals.NodeVisitor);
  32461. $core.addMethod(
  32462. $core.method({
  32463. selector: "visitMethodNode:",
  32464. protocol: 'visiting',
  32465. fn: function (aNode){
  32466. var self=this;
  32467. return $core.withContext(function($ctx1) {
  32468. return self._visitNode_(aNode);
  32469. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  32470. },
  32471. args: ["aNode"],
  32472. source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
  32473. referencedClasses: [],
  32474. messageSends: ["visitNode:"]
  32475. }),
  32476. $globals.NodeVisitor);
  32477. $core.addMethod(
  32478. $core.method({
  32479. selector: "visitNode:",
  32480. protocol: 'visiting',
  32481. fn: function (aNode){
  32482. var self=this;
  32483. return $core.withContext(function($ctx1) {
  32484. return self._visitAll_($recv(aNode)._nodes());
  32485. }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},$globals.NodeVisitor)});
  32486. },
  32487. args: ["aNode"],
  32488. source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
  32489. referencedClasses: [],
  32490. messageSends: ["visitAll:", "nodes"]
  32491. }),
  32492. $globals.NodeVisitor);
  32493. $core.addMethod(
  32494. $core.method({
  32495. selector: "visitReturnNode:",
  32496. protocol: 'visiting',
  32497. fn: function (aNode){
  32498. var self=this;
  32499. return $core.withContext(function($ctx1) {
  32500. return self._visitNode_(aNode);
  32501. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  32502. },
  32503. args: ["aNode"],
  32504. source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
  32505. referencedClasses: [],
  32506. messageSends: ["visitNode:"]
  32507. }),
  32508. $globals.NodeVisitor);
  32509. $core.addMethod(
  32510. $core.method({
  32511. selector: "visitSendNode:",
  32512. protocol: 'visiting',
  32513. fn: function (aNode){
  32514. var self=this;
  32515. return $core.withContext(function($ctx1) {
  32516. return self._visitNode_(aNode);
  32517. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  32518. },
  32519. args: ["aNode"],
  32520. source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
  32521. referencedClasses: [],
  32522. messageSends: ["visitNode:"]
  32523. }),
  32524. $globals.NodeVisitor);
  32525. $core.addMethod(
  32526. $core.method({
  32527. selector: "visitSequenceNode:",
  32528. protocol: 'visiting',
  32529. fn: function (aNode){
  32530. var self=this;
  32531. return $core.withContext(function($ctx1) {
  32532. return self._visitNode_(aNode);
  32533. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  32534. },
  32535. args: ["aNode"],
  32536. source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
  32537. referencedClasses: [],
  32538. messageSends: ["visitNode:"]
  32539. }),
  32540. $globals.NodeVisitor);
  32541. $core.addMethod(
  32542. $core.method({
  32543. selector: "visitValueNode:",
  32544. protocol: 'visiting',
  32545. fn: function (aNode){
  32546. var self=this;
  32547. return $core.withContext(function($ctx1) {
  32548. return self._visitNode_(aNode);
  32549. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  32550. },
  32551. args: ["aNode"],
  32552. source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
  32553. referencedClasses: [],
  32554. messageSends: ["visitNode:"]
  32555. }),
  32556. $globals.NodeVisitor);
  32557. $core.addMethod(
  32558. $core.method({
  32559. selector: "visitVariableNode:",
  32560. protocol: 'visiting',
  32561. fn: function (aNode){
  32562. var self=this;
  32563. return $core.withContext(function($ctx1) {
  32564. return self._visitNode_(aNode);
  32565. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  32566. },
  32567. args: ["aNode"],
  32568. source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
  32569. referencedClasses: [],
  32570. messageSends: ["visitNode:"]
  32571. }),
  32572. $globals.NodeVisitor);
  32573. $core.addMethod(
  32574. $core.method({
  32575. selector: "ast",
  32576. protocol: '*Compiler-AST',
  32577. fn: function (){
  32578. var self=this;
  32579. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  32580. return $core.withContext(function($ctx1) {
  32581. var $1;
  32582. $1=self._source();
  32583. $ctx1.sendIdx["source"]=1;
  32584. $recv($1)._ifEmpty_((function(){
  32585. return $core.withContext(function($ctx2) {
  32586. return self._error_("Method source is empty");
  32587. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32588. }));
  32589. return $recv($Smalltalk())._parse_(self._source());
  32590. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  32591. },
  32592. args: [],
  32593. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  32594. referencedClasses: ["Smalltalk"],
  32595. messageSends: ["ifEmpty:", "source", "error:", "parse:"]
  32596. }),
  32597. $globals.CompiledMethod);
  32598. $core.addMethod(
  32599. $core.method({
  32600. selector: "isNode",
  32601. protocol: '*Compiler-AST',
  32602. fn: function (){
  32603. var self=this;
  32604. return false;
  32605. },
  32606. args: [],
  32607. source: "isNode\x0a\x09^ false",
  32608. referencedClasses: [],
  32609. messageSends: []
  32610. }),
  32611. $globals.Object);
  32612. });
  32613. define("amber_core/Compiler-Semantic", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Compiler-AST", "amber_core/Compiler-Core"], function($boot){"use strict";
  32614. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  32615. $core.addPackage('Compiler-Semantic');
  32616. $core.packages["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  32617. $core.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  32618. $core.addClass('LexicalScope', $globals.Object, ['node', 'instruction', 'temps', 'args', 'outerScope', 'blockIndex'], 'Compiler-Semantic');
  32619. $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.";
  32620. $core.addMethod(
  32621. $core.method({
  32622. selector: "addArg:",
  32623. protocol: 'adding',
  32624. fn: function (aString){
  32625. var self=this;
  32626. function $ArgVar(){return $globals.ArgVar||(typeof ArgVar=="undefined"?nil:ArgVar)}
  32627. return $core.withContext(function($ctx1) {
  32628. var $1;
  32629. $1=self._args();
  32630. $ctx1.sendIdx["args"]=1;
  32631. $recv($1)._at_put_(aString,$recv($ArgVar())._on_(aString));
  32632. $recv($recv(self._args())._at_(aString))._scope_(self);
  32633. return self;
  32634. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  32635. },
  32636. args: ["aString"],
  32637. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  32638. referencedClasses: ["ArgVar"],
  32639. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  32640. }),
  32641. $globals.LexicalScope);
  32642. $core.addMethod(
  32643. $core.method({
  32644. selector: "addTemp:",
  32645. protocol: 'adding',
  32646. fn: function (aString){
  32647. var self=this;
  32648. function $TempVar(){return $globals.TempVar||(typeof TempVar=="undefined"?nil:TempVar)}
  32649. return $core.withContext(function($ctx1) {
  32650. var $1;
  32651. $1=self._temps();
  32652. $ctx1.sendIdx["temps"]=1;
  32653. $recv($1)._at_put_(aString,$recv($TempVar())._on_(aString));
  32654. $recv($recv(self._temps())._at_(aString))._scope_(self);
  32655. return self;
  32656. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  32657. },
  32658. args: ["aString"],
  32659. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  32660. referencedClasses: ["TempVar"],
  32661. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  32662. }),
  32663. $globals.LexicalScope);
  32664. $core.addMethod(
  32665. $core.method({
  32666. selector: "alias",
  32667. protocol: 'accessing',
  32668. fn: function (){
  32669. var self=this;
  32670. return $core.withContext(function($ctx1) {
  32671. return "$ctx".__comma($recv(self._scopeLevel())._asString());
  32672. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  32673. },
  32674. args: [],
  32675. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  32676. referencedClasses: [],
  32677. messageSends: [",", "asString", "scopeLevel"]
  32678. }),
  32679. $globals.LexicalScope);
  32680. $core.addMethod(
  32681. $core.method({
  32682. selector: "allVariableNames",
  32683. protocol: 'accessing',
  32684. fn: function (){
  32685. var self=this;
  32686. return $core.withContext(function($ctx1) {
  32687. var $1;
  32688. $1=$recv(self._args())._keys();
  32689. $ctx1.sendIdx["keys"]=1;
  32690. return $recv($1).__comma($recv(self._temps())._keys());
  32691. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  32692. },
  32693. args: [],
  32694. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  32695. referencedClasses: [],
  32696. messageSends: [",", "keys", "args", "temps"]
  32697. }),
  32698. $globals.LexicalScope);
  32699. $core.addMethod(
  32700. $core.method({
  32701. selector: "args",
  32702. protocol: 'accessing',
  32703. fn: function (){
  32704. var self=this;
  32705. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  32706. return $core.withContext(function($ctx1) {
  32707. var $1,$receiver;
  32708. $1=self["@args"];
  32709. if(($receiver = $1) == null || $receiver.isNil){
  32710. self["@args"]=$recv($Dictionary())._new();
  32711. return self["@args"];
  32712. } else {
  32713. return $1;
  32714. };
  32715. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  32716. },
  32717. args: [],
  32718. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  32719. referencedClasses: ["Dictionary"],
  32720. messageSends: ["ifNil:", "new"]
  32721. }),
  32722. $globals.LexicalScope);
  32723. $core.addMethod(
  32724. $core.method({
  32725. selector: "bindingFor:",
  32726. protocol: 'accessing',
  32727. fn: function (aStringOrNode){
  32728. var self=this;
  32729. return $core.withContext(function($ctx1) {
  32730. var $2,$3,$4,$5,$1;
  32731. $2=self._pseudoVars();
  32732. $3=$recv(aStringOrNode)._value();
  32733. $ctx1.sendIdx["value"]=1;
  32734. $1=$recv($2)._at_ifAbsent_($3,(function(){
  32735. return $core.withContext(function($ctx2) {
  32736. $4=self._args();
  32737. $5=$recv(aStringOrNode)._value();
  32738. $ctx2.sendIdx["value"]=2;
  32739. return $recv($4)._at_ifAbsent_($5,(function(){
  32740. return $core.withContext(function($ctx3) {
  32741. return $recv(self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  32742. return nil;
  32743. }));
  32744. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32745. }));
  32746. $ctx2.sendIdx["at:ifAbsent:"]=2;
  32747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32748. }));
  32749. $ctx1.sendIdx["at:ifAbsent:"]=1;
  32750. return $1;
  32751. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  32752. },
  32753. args: ["aStringOrNode"],
  32754. 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 ]]]",
  32755. referencedClasses: [],
  32756. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  32757. }),
  32758. $globals.LexicalScope);
  32759. $core.addMethod(
  32760. $core.method({
  32761. selector: "blockIndex",
  32762. protocol: 'accessing',
  32763. fn: function (){
  32764. var self=this;
  32765. return $core.withContext(function($ctx1) {
  32766. var $1,$receiver;
  32767. $1=self["@blockIndex"];
  32768. if(($receiver = $1) == null || $receiver.isNil){
  32769. return (0);
  32770. } else {
  32771. return $1;
  32772. };
  32773. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  32774. },
  32775. args: [],
  32776. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  32777. referencedClasses: [],
  32778. messageSends: ["ifNil:"]
  32779. }),
  32780. $globals.LexicalScope);
  32781. $core.addMethod(
  32782. $core.method({
  32783. selector: "blockIndex:",
  32784. protocol: 'accessing',
  32785. fn: function (anInteger){
  32786. var self=this;
  32787. self["@blockIndex"]=anInteger;
  32788. return self;
  32789. },
  32790. args: ["anInteger"],
  32791. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  32792. referencedClasses: [],
  32793. messageSends: []
  32794. }),
  32795. $globals.LexicalScope);
  32796. $core.addMethod(
  32797. $core.method({
  32798. selector: "canInlineNonLocalReturns",
  32799. protocol: 'testing',
  32800. fn: function (){
  32801. var self=this;
  32802. return $core.withContext(function($ctx1) {
  32803. return $recv(self._isInlined())._and_((function(){
  32804. return $core.withContext(function($ctx2) {
  32805. return $recv(self._outerScope())._canInlineNonLocalReturns();
  32806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32807. }));
  32808. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  32809. },
  32810. args: [],
  32811. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  32812. referencedClasses: [],
  32813. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  32814. }),
  32815. $globals.LexicalScope);
  32816. $core.addMethod(
  32817. $core.method({
  32818. selector: "instruction",
  32819. protocol: 'accessing',
  32820. fn: function (){
  32821. var self=this;
  32822. return self["@instruction"];
  32823. },
  32824. args: [],
  32825. source: "instruction\x0a\x09^ instruction",
  32826. referencedClasses: [],
  32827. messageSends: []
  32828. }),
  32829. $globals.LexicalScope);
  32830. $core.addMethod(
  32831. $core.method({
  32832. selector: "instruction:",
  32833. protocol: 'accessing',
  32834. fn: function (anIRInstruction){
  32835. var self=this;
  32836. self["@instruction"]=anIRInstruction;
  32837. return self;
  32838. },
  32839. args: ["anIRInstruction"],
  32840. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  32841. referencedClasses: [],
  32842. messageSends: []
  32843. }),
  32844. $globals.LexicalScope);
  32845. $core.addMethod(
  32846. $core.method({
  32847. selector: "isBlockScope",
  32848. protocol: 'testing',
  32849. fn: function (){
  32850. var self=this;
  32851. return $core.withContext(function($ctx1) {
  32852. return $recv(self._isMethodScope())._not();
  32853. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  32854. },
  32855. args: [],
  32856. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  32857. referencedClasses: [],
  32858. messageSends: ["not", "isMethodScope"]
  32859. }),
  32860. $globals.LexicalScope);
  32861. $core.addMethod(
  32862. $core.method({
  32863. selector: "isInlined",
  32864. protocol: 'testing',
  32865. fn: function (){
  32866. var self=this;
  32867. return $core.withContext(function($ctx1) {
  32868. var $2,$1;
  32869. $2=self._instruction();
  32870. $ctx1.sendIdx["instruction"]=1;
  32871. $1=$recv($2)._notNil();
  32872. return $recv($1)._and_((function(){
  32873. return $core.withContext(function($ctx2) {
  32874. return $recv(self._instruction())._isInlined();
  32875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32876. }));
  32877. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  32878. },
  32879. args: [],
  32880. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  32881. referencedClasses: [],
  32882. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  32883. }),
  32884. $globals.LexicalScope);
  32885. $core.addMethod(
  32886. $core.method({
  32887. selector: "isMethodScope",
  32888. protocol: 'testing',
  32889. fn: function (){
  32890. var self=this;
  32891. return false;
  32892. },
  32893. args: [],
  32894. source: "isMethodScope\x0a\x09^ false",
  32895. referencedClasses: [],
  32896. messageSends: []
  32897. }),
  32898. $globals.LexicalScope);
  32899. $core.addMethod(
  32900. $core.method({
  32901. selector: "lookupVariable:",
  32902. protocol: 'accessing',
  32903. fn: function (aNode){
  32904. var self=this;
  32905. var lookup;
  32906. return $core.withContext(function($ctx1) {
  32907. var $1,$2,$receiver;
  32908. lookup=self._bindingFor_(aNode);
  32909. $1=lookup;
  32910. if(($receiver = $1) == null || $receiver.isNil){
  32911. $2=self._outerScope();
  32912. $ctx1.sendIdx["outerScope"]=1;
  32913. if(($receiver = $2) == null || $receiver.isNil){
  32914. lookup=$2;
  32915. } else {
  32916. lookup=$recv(self._outerScope())._lookupVariable_(aNode);
  32917. };
  32918. lookup;
  32919. } else {
  32920. $1;
  32921. };
  32922. return lookup;
  32923. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  32924. },
  32925. args: ["aNode"],
  32926. 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",
  32927. referencedClasses: [],
  32928. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  32929. }),
  32930. $globals.LexicalScope);
  32931. $core.addMethod(
  32932. $core.method({
  32933. selector: "methodScope",
  32934. protocol: 'accessing',
  32935. fn: function (){
  32936. var self=this;
  32937. return $core.withContext(function($ctx1) {
  32938. var $1,$receiver;
  32939. $1=self._outerScope();
  32940. $ctx1.sendIdx["outerScope"]=1;
  32941. if(($receiver = $1) == null || $receiver.isNil){
  32942. return $1;
  32943. } else {
  32944. return $recv(self._outerScope())._methodScope();
  32945. };
  32946. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  32947. },
  32948. args: [],
  32949. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  32950. referencedClasses: [],
  32951. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  32952. }),
  32953. $globals.LexicalScope);
  32954. $core.addMethod(
  32955. $core.method({
  32956. selector: "node",
  32957. protocol: 'accessing',
  32958. fn: function (){
  32959. var self=this;
  32960. return self["@node"];
  32961. },
  32962. args: [],
  32963. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  32964. referencedClasses: [],
  32965. messageSends: []
  32966. }),
  32967. $globals.LexicalScope);
  32968. $core.addMethod(
  32969. $core.method({
  32970. selector: "node:",
  32971. protocol: 'accessing',
  32972. fn: function (aNode){
  32973. var self=this;
  32974. self["@node"]=aNode;
  32975. return self;
  32976. },
  32977. args: ["aNode"],
  32978. source: "node: aNode\x0a\x09node := aNode",
  32979. referencedClasses: [],
  32980. messageSends: []
  32981. }),
  32982. $globals.LexicalScope);
  32983. $core.addMethod(
  32984. $core.method({
  32985. selector: "outerScope",
  32986. protocol: 'accessing',
  32987. fn: function (){
  32988. var self=this;
  32989. return self["@outerScope"];
  32990. },
  32991. args: [],
  32992. source: "outerScope\x0a\x09^ outerScope",
  32993. referencedClasses: [],
  32994. messageSends: []
  32995. }),
  32996. $globals.LexicalScope);
  32997. $core.addMethod(
  32998. $core.method({
  32999. selector: "outerScope:",
  33000. protocol: 'accessing',
  33001. fn: function (aLexicalScope){
  33002. var self=this;
  33003. self["@outerScope"]=aLexicalScope;
  33004. return self;
  33005. },
  33006. args: ["aLexicalScope"],
  33007. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  33008. referencedClasses: [],
  33009. messageSends: []
  33010. }),
  33011. $globals.LexicalScope);
  33012. $core.addMethod(
  33013. $core.method({
  33014. selector: "pseudoVars",
  33015. protocol: 'accessing',
  33016. fn: function (){
  33017. var self=this;
  33018. return $core.withContext(function($ctx1) {
  33019. return $recv(self._methodScope())._pseudoVars();
  33020. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  33021. },
  33022. args: [],
  33023. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  33024. referencedClasses: [],
  33025. messageSends: ["pseudoVars", "methodScope"]
  33026. }),
  33027. $globals.LexicalScope);
  33028. $core.addMethod(
  33029. $core.method({
  33030. selector: "scopeLevel",
  33031. protocol: 'accessing',
  33032. fn: function (){
  33033. var self=this;
  33034. return $core.withContext(function($ctx1) {
  33035. var $1,$2,$4,$3,$receiver;
  33036. $1=self._outerScope();
  33037. $ctx1.sendIdx["outerScope"]=1;
  33038. if(($receiver = $1) == null || $receiver.isNil){
  33039. return (1);
  33040. } else {
  33041. $1;
  33042. };
  33043. $2=self._isInlined();
  33044. if($core.assert($2)){
  33045. $4=self._outerScope();
  33046. $ctx1.sendIdx["outerScope"]=2;
  33047. $3=$recv($4)._scopeLevel();
  33048. $ctx1.sendIdx["scopeLevel"]=1;
  33049. return $3;
  33050. };
  33051. return $recv($recv(self._outerScope())._scopeLevel()).__plus((1));
  33052. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  33053. },
  33054. args: [],
  33055. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  33056. referencedClasses: [],
  33057. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  33058. }),
  33059. $globals.LexicalScope);
  33060. $core.addMethod(
  33061. $core.method({
  33062. selector: "temps",
  33063. protocol: 'accessing',
  33064. fn: function (){
  33065. var self=this;
  33066. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  33067. return $core.withContext(function($ctx1) {
  33068. var $1,$receiver;
  33069. $1=self["@temps"];
  33070. if(($receiver = $1) == null || $receiver.isNil){
  33071. self["@temps"]=$recv($Dictionary())._new();
  33072. return self["@temps"];
  33073. } else {
  33074. return $1;
  33075. };
  33076. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  33077. },
  33078. args: [],
  33079. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  33080. referencedClasses: ["Dictionary"],
  33081. messageSends: ["ifNil:", "new"]
  33082. }),
  33083. $globals.LexicalScope);
  33084. $core.addClass('MethodLexicalScope', $globals.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
  33085. $globals.MethodLexicalScope.comment="I represent a method scope.";
  33086. $core.addMethod(
  33087. $core.method({
  33088. selector: "addIVar:",
  33089. protocol: 'adding',
  33090. fn: function (aString){
  33091. var self=this;
  33092. function $InstanceVar(){return $globals.InstanceVar||(typeof InstanceVar=="undefined"?nil:InstanceVar)}
  33093. return $core.withContext(function($ctx1) {
  33094. var $1;
  33095. $1=self._iVars();
  33096. $ctx1.sendIdx["iVars"]=1;
  33097. $recv($1)._at_put_(aString,$recv($InstanceVar())._on_(aString));
  33098. $recv($recv(self._iVars())._at_(aString))._scope_(self);
  33099. return self;
  33100. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  33101. },
  33102. args: ["aString"],
  33103. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  33104. referencedClasses: ["InstanceVar"],
  33105. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  33106. }),
  33107. $globals.MethodLexicalScope);
  33108. $core.addMethod(
  33109. $core.method({
  33110. selector: "addNonLocalReturn:",
  33111. protocol: 'adding',
  33112. fn: function (aScope){
  33113. var self=this;
  33114. return $core.withContext(function($ctx1) {
  33115. $recv(self._nonLocalReturns())._add_(aScope);
  33116. return self;
  33117. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  33118. },
  33119. args: ["aScope"],
  33120. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  33121. referencedClasses: [],
  33122. messageSends: ["add:", "nonLocalReturns"]
  33123. }),
  33124. $globals.MethodLexicalScope);
  33125. $core.addMethod(
  33126. $core.method({
  33127. selector: "allVariableNames",
  33128. protocol: 'accessing',
  33129. fn: function (){
  33130. var self=this;
  33131. return $core.withContext(function($ctx1) {
  33132. var $1;
  33133. $1=(
  33134. $ctx1.supercall = true,
  33135. ($globals.MethodLexicalScope.superclass||$boot.dnu).fn.prototype._allVariableNames.apply($recv(self), []));
  33136. $ctx1.supercall = false;
  33137. return $recv($1).__comma($recv(self._iVars())._keys());
  33138. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  33139. },
  33140. args: [],
  33141. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  33142. referencedClasses: [],
  33143. messageSends: [",", "allVariableNames", "keys", "iVars"]
  33144. }),
  33145. $globals.MethodLexicalScope);
  33146. $core.addMethod(
  33147. $core.method({
  33148. selector: "bindingFor:",
  33149. protocol: 'accessing',
  33150. fn: function (aNode){
  33151. var self=this;
  33152. return $core.withContext(function($ctx1) {
  33153. var $1,$receiver;
  33154. $1=(
  33155. $ctx1.supercall = true,
  33156. ($globals.MethodLexicalScope.superclass||$boot.dnu).fn.prototype._bindingFor_.apply($recv(self), [aNode]));
  33157. $ctx1.supercall = false;
  33158. if(($receiver = $1) == null || $receiver.isNil){
  33159. return $recv(self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  33160. return nil;
  33161. }));
  33162. } else {
  33163. return $1;
  33164. };
  33165. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  33166. },
  33167. args: ["aNode"],
  33168. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  33169. referencedClasses: [],
  33170. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  33171. }),
  33172. $globals.MethodLexicalScope);
  33173. $core.addMethod(
  33174. $core.method({
  33175. selector: "canInlineNonLocalReturns",
  33176. protocol: 'testing',
  33177. fn: function (){
  33178. var self=this;
  33179. return true;
  33180. },
  33181. args: [],
  33182. source: "canInlineNonLocalReturns\x0a\x09^ true",
  33183. referencedClasses: [],
  33184. messageSends: []
  33185. }),
  33186. $globals.MethodLexicalScope);
  33187. $core.addMethod(
  33188. $core.method({
  33189. selector: "hasLocalReturn",
  33190. protocol: 'testing',
  33191. fn: function (){
  33192. var self=this;
  33193. return $core.withContext(function($ctx1) {
  33194. return self._localReturn();
  33195. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  33196. },
  33197. args: [],
  33198. source: "hasLocalReturn\x0a\x09^ self localReturn",
  33199. referencedClasses: [],
  33200. messageSends: ["localReturn"]
  33201. }),
  33202. $globals.MethodLexicalScope);
  33203. $core.addMethod(
  33204. $core.method({
  33205. selector: "hasNonLocalReturn",
  33206. protocol: 'testing',
  33207. fn: function (){
  33208. var self=this;
  33209. return $core.withContext(function($ctx1) {
  33210. return $recv(self._nonLocalReturns())._notEmpty();
  33211. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  33212. },
  33213. args: [],
  33214. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  33215. referencedClasses: [],
  33216. messageSends: ["notEmpty", "nonLocalReturns"]
  33217. }),
  33218. $globals.MethodLexicalScope);
  33219. $core.addMethod(
  33220. $core.method({
  33221. selector: "iVars",
  33222. protocol: 'accessing',
  33223. fn: function (){
  33224. var self=this;
  33225. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  33226. return $core.withContext(function($ctx1) {
  33227. var $1,$receiver;
  33228. $1=self["@iVars"];
  33229. if(($receiver = $1) == null || $receiver.isNil){
  33230. self["@iVars"]=$recv($Dictionary())._new();
  33231. return self["@iVars"];
  33232. } else {
  33233. return $1;
  33234. };
  33235. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  33236. },
  33237. args: [],
  33238. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  33239. referencedClasses: ["Dictionary"],
  33240. messageSends: ["ifNil:", "new"]
  33241. }),
  33242. $globals.MethodLexicalScope);
  33243. $core.addMethod(
  33244. $core.method({
  33245. selector: "isMethodScope",
  33246. protocol: 'testing',
  33247. fn: function (){
  33248. var self=this;
  33249. return true;
  33250. },
  33251. args: [],
  33252. source: "isMethodScope\x0a\x09^ true",
  33253. referencedClasses: [],
  33254. messageSends: []
  33255. }),
  33256. $globals.MethodLexicalScope);
  33257. $core.addMethod(
  33258. $core.method({
  33259. selector: "localReturn",
  33260. protocol: 'accessing',
  33261. fn: function (){
  33262. var self=this;
  33263. return $core.withContext(function($ctx1) {
  33264. var $1,$receiver;
  33265. $1=self["@localReturn"];
  33266. if(($receiver = $1) == null || $receiver.isNil){
  33267. return false;
  33268. } else {
  33269. return $1;
  33270. };
  33271. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  33272. },
  33273. args: [],
  33274. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  33275. referencedClasses: [],
  33276. messageSends: ["ifNil:"]
  33277. }),
  33278. $globals.MethodLexicalScope);
  33279. $core.addMethod(
  33280. $core.method({
  33281. selector: "localReturn:",
  33282. protocol: 'accessing',
  33283. fn: function (aBoolean){
  33284. var self=this;
  33285. self["@localReturn"]=aBoolean;
  33286. return self;
  33287. },
  33288. args: ["aBoolean"],
  33289. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  33290. referencedClasses: [],
  33291. messageSends: []
  33292. }),
  33293. $globals.MethodLexicalScope);
  33294. $core.addMethod(
  33295. $core.method({
  33296. selector: "methodScope",
  33297. protocol: 'accessing',
  33298. fn: function (){
  33299. var self=this;
  33300. return self;
  33301. },
  33302. args: [],
  33303. source: "methodScope\x0a\x09^ self",
  33304. referencedClasses: [],
  33305. messageSends: []
  33306. }),
  33307. $globals.MethodLexicalScope);
  33308. $core.addMethod(
  33309. $core.method({
  33310. selector: "nonLocalReturns",
  33311. protocol: 'accessing',
  33312. fn: function (){
  33313. var self=this;
  33314. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  33315. return $core.withContext(function($ctx1) {
  33316. var $1,$receiver;
  33317. $1=self["@nonLocalReturns"];
  33318. if(($receiver = $1) == null || $receiver.isNil){
  33319. self["@nonLocalReturns"]=$recv($OrderedCollection())._new();
  33320. return self["@nonLocalReturns"];
  33321. } else {
  33322. return $1;
  33323. };
  33324. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  33325. },
  33326. args: [],
  33327. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  33328. referencedClasses: ["OrderedCollection"],
  33329. messageSends: ["ifNil:", "new"]
  33330. }),
  33331. $globals.MethodLexicalScope);
  33332. $core.addMethod(
  33333. $core.method({
  33334. selector: "pseudoVars",
  33335. protocol: 'accessing',
  33336. fn: function (){
  33337. var self=this;
  33338. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  33339. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  33340. function $PseudoVar(){return $globals.PseudoVar||(typeof PseudoVar=="undefined"?nil:PseudoVar)}
  33341. return $core.withContext(function($ctx1) {
  33342. var $1,$2,$4,$3,$receiver;
  33343. $1=self["@pseudoVars"];
  33344. if(($receiver = $1) == null || $receiver.isNil){
  33345. self["@pseudoVars"]=$recv($Dictionary())._new();
  33346. self["@pseudoVars"];
  33347. $recv($recv($Smalltalk())._pseudoVariableNames())._do_((function(each){
  33348. return $core.withContext(function($ctx2) {
  33349. $2=self["@pseudoVars"];
  33350. $4=$recv($PseudoVar())._on_(each);
  33351. $recv($4)._scope_(self._methodScope());
  33352. $3=$recv($4)._yourself();
  33353. return $recv($2)._at_put_(each,$3);
  33354. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  33355. }));
  33356. } else {
  33357. $1;
  33358. };
  33359. return self["@pseudoVars"];
  33360. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  33361. },
  33362. args: [],
  33363. 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",
  33364. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  33365. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  33366. }),
  33367. $globals.MethodLexicalScope);
  33368. $core.addMethod(
  33369. $core.method({
  33370. selector: "removeNonLocalReturn:",
  33371. protocol: 'adding',
  33372. fn: function (aScope){
  33373. var self=this;
  33374. return $core.withContext(function($ctx1) {
  33375. $recv(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  33376. }));
  33377. return self;
  33378. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  33379. },
  33380. args: ["aScope"],
  33381. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  33382. referencedClasses: [],
  33383. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  33384. }),
  33385. $globals.MethodLexicalScope);
  33386. $core.addMethod(
  33387. $core.method({
  33388. selector: "unknownVariables",
  33389. protocol: 'accessing',
  33390. fn: function (){
  33391. var self=this;
  33392. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  33393. return $core.withContext(function($ctx1) {
  33394. var $1,$receiver;
  33395. $1=self["@unknownVariables"];
  33396. if(($receiver = $1) == null || $receiver.isNil){
  33397. self["@unknownVariables"]=$recv($OrderedCollection())._new();
  33398. return self["@unknownVariables"];
  33399. } else {
  33400. return $1;
  33401. };
  33402. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  33403. },
  33404. args: [],
  33405. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  33406. referencedClasses: ["OrderedCollection"],
  33407. messageSends: ["ifNil:", "new"]
  33408. }),
  33409. $globals.MethodLexicalScope);
  33410. $core.addClass('ScopeVar', $globals.Object, ['scope', 'name'], 'Compiler-Semantic');
  33411. $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.";
  33412. $core.addMethod(
  33413. $core.method({
  33414. selector: "alias",
  33415. protocol: 'accessing',
  33416. fn: function (){
  33417. var self=this;
  33418. return $core.withContext(function($ctx1) {
  33419. return $recv(self._name())._asVariableName();
  33420. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  33421. },
  33422. args: [],
  33423. source: "alias\x0a\x09^ self name asVariableName",
  33424. referencedClasses: [],
  33425. messageSends: ["asVariableName", "name"]
  33426. }),
  33427. $globals.ScopeVar);
  33428. $core.addMethod(
  33429. $core.method({
  33430. selector: "isArgVar",
  33431. protocol: 'testing',
  33432. fn: function (){
  33433. var self=this;
  33434. return false;
  33435. },
  33436. args: [],
  33437. source: "isArgVar\x0a\x09^ false",
  33438. referencedClasses: [],
  33439. messageSends: []
  33440. }),
  33441. $globals.ScopeVar);
  33442. $core.addMethod(
  33443. $core.method({
  33444. selector: "isClassRefVar",
  33445. protocol: 'testing',
  33446. fn: function (){
  33447. var self=this;
  33448. return false;
  33449. },
  33450. args: [],
  33451. source: "isClassRefVar\x0a\x09^ false",
  33452. referencedClasses: [],
  33453. messageSends: []
  33454. }),
  33455. $globals.ScopeVar);
  33456. $core.addMethod(
  33457. $core.method({
  33458. selector: "isImmutable",
  33459. protocol: 'testing',
  33460. fn: function (){
  33461. var self=this;
  33462. return false;
  33463. },
  33464. args: [],
  33465. source: "isImmutable\x0a\x09^ false",
  33466. referencedClasses: [],
  33467. messageSends: []
  33468. }),
  33469. $globals.ScopeVar);
  33470. $core.addMethod(
  33471. $core.method({
  33472. selector: "isInstanceVar",
  33473. protocol: 'testing',
  33474. fn: function (){
  33475. var self=this;
  33476. return false;
  33477. },
  33478. args: [],
  33479. source: "isInstanceVar\x0a\x09^ false",
  33480. referencedClasses: [],
  33481. messageSends: []
  33482. }),
  33483. $globals.ScopeVar);
  33484. $core.addMethod(
  33485. $core.method({
  33486. selector: "isPseudoVar",
  33487. protocol: 'testing',
  33488. fn: function (){
  33489. var self=this;
  33490. return false;
  33491. },
  33492. args: [],
  33493. source: "isPseudoVar\x0a\x09^ false",
  33494. referencedClasses: [],
  33495. messageSends: []
  33496. }),
  33497. $globals.ScopeVar);
  33498. $core.addMethod(
  33499. $core.method({
  33500. selector: "isTempVar",
  33501. protocol: 'testing',
  33502. fn: function (){
  33503. var self=this;
  33504. return false;
  33505. },
  33506. args: [],
  33507. source: "isTempVar\x0a\x09^ false",
  33508. referencedClasses: [],
  33509. messageSends: []
  33510. }),
  33511. $globals.ScopeVar);
  33512. $core.addMethod(
  33513. $core.method({
  33514. selector: "isUnknownVar",
  33515. protocol: 'testing',
  33516. fn: function (){
  33517. var self=this;
  33518. return false;
  33519. },
  33520. args: [],
  33521. source: "isUnknownVar\x0a\x09^ false",
  33522. referencedClasses: [],
  33523. messageSends: []
  33524. }),
  33525. $globals.ScopeVar);
  33526. $core.addMethod(
  33527. $core.method({
  33528. selector: "name",
  33529. protocol: 'accessing',
  33530. fn: function (){
  33531. var self=this;
  33532. return self["@name"];
  33533. },
  33534. args: [],
  33535. source: "name\x0a\x09^ name",
  33536. referencedClasses: [],
  33537. messageSends: []
  33538. }),
  33539. $globals.ScopeVar);
  33540. $core.addMethod(
  33541. $core.method({
  33542. selector: "name:",
  33543. protocol: 'accessing',
  33544. fn: function (aString){
  33545. var self=this;
  33546. self["@name"]=aString;
  33547. return self;
  33548. },
  33549. args: ["aString"],
  33550. source: "name: aString\x0a\x09name := aString",
  33551. referencedClasses: [],
  33552. messageSends: []
  33553. }),
  33554. $globals.ScopeVar);
  33555. $core.addMethod(
  33556. $core.method({
  33557. selector: "scope",
  33558. protocol: 'accessing',
  33559. fn: function (){
  33560. var self=this;
  33561. return self["@scope"];
  33562. },
  33563. args: [],
  33564. source: "scope\x0a\x09^ scope",
  33565. referencedClasses: [],
  33566. messageSends: []
  33567. }),
  33568. $globals.ScopeVar);
  33569. $core.addMethod(
  33570. $core.method({
  33571. selector: "scope:",
  33572. protocol: 'accessing',
  33573. fn: function (aScope){
  33574. var self=this;
  33575. self["@scope"]=aScope;
  33576. return self;
  33577. },
  33578. args: ["aScope"],
  33579. source: "scope: aScope\x0a\x09scope := aScope",
  33580. referencedClasses: [],
  33581. messageSends: []
  33582. }),
  33583. $globals.ScopeVar);
  33584. $core.addMethod(
  33585. $core.method({
  33586. selector: "validateAssignment",
  33587. protocol: 'testing',
  33588. fn: function (){
  33589. var self=this;
  33590. function $InvalidAssignmentError(){return $globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  33591. return $core.withContext(function($ctx1) {
  33592. var $1,$2;
  33593. $1=$recv(self._isArgVar())._or_((function(){
  33594. return $core.withContext(function($ctx2) {
  33595. return self._isPseudoVar();
  33596. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33597. }));
  33598. if($core.assert($1)){
  33599. $2=$recv($InvalidAssignmentError())._new();
  33600. $recv($2)._variableName_(self._name());
  33601. $recv($2)._signal();
  33602. };
  33603. return self;
  33604. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  33605. },
  33606. args: [],
  33607. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  33608. referencedClasses: ["InvalidAssignmentError"],
  33609. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  33610. }),
  33611. $globals.ScopeVar);
  33612. $core.addMethod(
  33613. $core.method({
  33614. selector: "on:",
  33615. protocol: 'instance creation',
  33616. fn: function (aString){
  33617. var self=this;
  33618. return $core.withContext(function($ctx1) {
  33619. var $1;
  33620. $1=self._new();
  33621. $recv($1)._name_(aString);
  33622. return $recv($1)._yourself();
  33623. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.klass)});
  33624. },
  33625. args: ["aString"],
  33626. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  33627. referencedClasses: [],
  33628. messageSends: ["name:", "new", "yourself"]
  33629. }),
  33630. $globals.ScopeVar.klass);
  33631. $core.addClass('AliasVar', $globals.ScopeVar, ['node'], 'Compiler-Semantic');
  33632. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  33633. $core.addMethod(
  33634. $core.method({
  33635. selector: "isImmutable",
  33636. protocol: 'testing',
  33637. fn: function (){
  33638. var self=this;
  33639. return true;
  33640. },
  33641. args: [],
  33642. source: "isImmutable\x0a\x09^ true",
  33643. referencedClasses: [],
  33644. messageSends: []
  33645. }),
  33646. $globals.AliasVar);
  33647. $core.addMethod(
  33648. $core.method({
  33649. selector: "node",
  33650. protocol: 'accessing',
  33651. fn: function (){
  33652. var self=this;
  33653. return self["@node"];
  33654. },
  33655. args: [],
  33656. source: "node\x0a\x09^ node",
  33657. referencedClasses: [],
  33658. messageSends: []
  33659. }),
  33660. $globals.AliasVar);
  33661. $core.addMethod(
  33662. $core.method({
  33663. selector: "node:",
  33664. protocol: 'accessing',
  33665. fn: function (aNode){
  33666. var self=this;
  33667. self["@node"]=aNode;
  33668. return self;
  33669. },
  33670. args: ["aNode"],
  33671. source: "node: aNode\x0a\x09node := aNode",
  33672. referencedClasses: [],
  33673. messageSends: []
  33674. }),
  33675. $globals.AliasVar);
  33676. $core.addClass('ArgVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  33677. $globals.ArgVar.comment="I am an argument of a method or block.";
  33678. $core.addMethod(
  33679. $core.method({
  33680. selector: "isArgVar",
  33681. protocol: 'testing',
  33682. fn: function (){
  33683. var self=this;
  33684. return true;
  33685. },
  33686. args: [],
  33687. source: "isArgVar\x0a\x09^ true",
  33688. referencedClasses: [],
  33689. messageSends: []
  33690. }),
  33691. $globals.ArgVar);
  33692. $core.addMethod(
  33693. $core.method({
  33694. selector: "isImmutable",
  33695. protocol: 'testing',
  33696. fn: function (){
  33697. var self=this;
  33698. return true;
  33699. },
  33700. args: [],
  33701. source: "isImmutable\x0a\x09^ true",
  33702. referencedClasses: [],
  33703. messageSends: []
  33704. }),
  33705. $globals.ArgVar);
  33706. $core.addClass('ClassRefVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  33707. $globals.ClassRefVar.comment="I am an class reference variable";
  33708. $core.addMethod(
  33709. $core.method({
  33710. selector: "alias",
  33711. protocol: 'accessing',
  33712. fn: function (){
  33713. var self=this;
  33714. return $core.withContext(function($ctx1) {
  33715. var $1;
  33716. $1=$recv("$".__comma(self._name())).__comma("()");
  33717. $ctx1.sendIdx[","]=1;
  33718. return $1;
  33719. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  33720. },
  33721. args: [],
  33722. 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, '()'",
  33723. referencedClasses: [],
  33724. messageSends: [",", "name"]
  33725. }),
  33726. $globals.ClassRefVar);
  33727. $core.addMethod(
  33728. $core.method({
  33729. selector: "isClassRefVar",
  33730. protocol: 'testing',
  33731. fn: function (){
  33732. var self=this;
  33733. return true;
  33734. },
  33735. args: [],
  33736. source: "isClassRefVar\x0a\x09^ true",
  33737. referencedClasses: [],
  33738. messageSends: []
  33739. }),
  33740. $globals.ClassRefVar);
  33741. $core.addMethod(
  33742. $core.method({
  33743. selector: "isImmutable",
  33744. protocol: 'testing',
  33745. fn: function (){
  33746. var self=this;
  33747. return true;
  33748. },
  33749. args: [],
  33750. source: "isImmutable\x0a\x09^ true",
  33751. referencedClasses: [],
  33752. messageSends: []
  33753. }),
  33754. $globals.ClassRefVar);
  33755. $core.addClass('InstanceVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  33756. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  33757. $core.addMethod(
  33758. $core.method({
  33759. selector: "alias",
  33760. protocol: 'testing',
  33761. fn: function (){
  33762. var self=this;
  33763. return $core.withContext(function($ctx1) {
  33764. var $1;
  33765. $1=$recv("self[\x22@".__comma(self._name())).__comma("\x22]");
  33766. $ctx1.sendIdx[","]=1;
  33767. return $1;
  33768. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  33769. },
  33770. args: [],
  33771. source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
  33772. referencedClasses: [],
  33773. messageSends: [",", "name"]
  33774. }),
  33775. $globals.InstanceVar);
  33776. $core.addMethod(
  33777. $core.method({
  33778. selector: "isInstanceVar",
  33779. protocol: 'testing',
  33780. fn: function (){
  33781. var self=this;
  33782. return true;
  33783. },
  33784. args: [],
  33785. source: "isInstanceVar\x0a\x09^ true",
  33786. referencedClasses: [],
  33787. messageSends: []
  33788. }),
  33789. $globals.InstanceVar);
  33790. $core.addClass('PseudoVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  33791. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  33792. $core.addMethod(
  33793. $core.method({
  33794. selector: "alias",
  33795. protocol: 'accessing',
  33796. fn: function (){
  33797. var self=this;
  33798. return $core.withContext(function($ctx1) {
  33799. return self._name();
  33800. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  33801. },
  33802. args: [],
  33803. source: "alias\x0a\x09^ self name",
  33804. referencedClasses: [],
  33805. messageSends: ["name"]
  33806. }),
  33807. $globals.PseudoVar);
  33808. $core.addMethod(
  33809. $core.method({
  33810. selector: "isImmutable",
  33811. protocol: 'testing',
  33812. fn: function (){
  33813. var self=this;
  33814. return true;
  33815. },
  33816. args: [],
  33817. source: "isImmutable\x0a\x09^ true",
  33818. referencedClasses: [],
  33819. messageSends: []
  33820. }),
  33821. $globals.PseudoVar);
  33822. $core.addMethod(
  33823. $core.method({
  33824. selector: "isPseudoVar",
  33825. protocol: 'testing',
  33826. fn: function (){
  33827. var self=this;
  33828. return true;
  33829. },
  33830. args: [],
  33831. source: "isPseudoVar\x0a\x09^ true",
  33832. referencedClasses: [],
  33833. messageSends: []
  33834. }),
  33835. $globals.PseudoVar);
  33836. $core.addClass('TempVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  33837. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  33838. $core.addMethod(
  33839. $core.method({
  33840. selector: "isTempVar",
  33841. protocol: 'testing',
  33842. fn: function (){
  33843. var self=this;
  33844. return true;
  33845. },
  33846. args: [],
  33847. source: "isTempVar\x0a\x09^ true",
  33848. referencedClasses: [],
  33849. messageSends: []
  33850. }),
  33851. $globals.TempVar);
  33852. $core.addClass('UnknownVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  33853. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  33854. $core.addMethod(
  33855. $core.method({
  33856. selector: "isUnknownVar",
  33857. protocol: 'testing',
  33858. fn: function (){
  33859. var self=this;
  33860. return true;
  33861. },
  33862. args: [],
  33863. source: "isUnknownVar\x0a\x09^ true",
  33864. referencedClasses: [],
  33865. messageSends: []
  33866. }),
  33867. $globals.UnknownVar);
  33868. $core.addClass('SemanticAnalyzer', $globals.NodeVisitor, ['currentScope', 'blockIndex', 'thePackage', 'theClass', 'classReferences', 'messageSends'], 'Compiler-Semantic');
  33869. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  33870. $core.addMethod(
  33871. $core.method({
  33872. selector: "classReferences",
  33873. protocol: 'accessing',
  33874. fn: function (){
  33875. var self=this;
  33876. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  33877. return $core.withContext(function($ctx1) {
  33878. var $1,$receiver;
  33879. $1=self["@classReferences"];
  33880. if(($receiver = $1) == null || $receiver.isNil){
  33881. self["@classReferences"]=$recv($Set())._new();
  33882. return self["@classReferences"];
  33883. } else {
  33884. return $1;
  33885. };
  33886. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  33887. },
  33888. args: [],
  33889. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  33890. referencedClasses: ["Set"],
  33891. messageSends: ["ifNil:", "new"]
  33892. }),
  33893. $globals.SemanticAnalyzer);
  33894. $core.addMethod(
  33895. $core.method({
  33896. selector: "errorShadowingVariable:",
  33897. protocol: 'error handling',
  33898. fn: function (aString){
  33899. var self=this;
  33900. function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  33901. return $core.withContext(function($ctx1) {
  33902. var $1;
  33903. $1=$recv($ShadowingVariableError())._new();
  33904. $recv($1)._variableName_(aString);
  33905. $recv($1)._signal();
  33906. return self;
  33907. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  33908. },
  33909. args: ["aString"],
  33910. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  33911. referencedClasses: ["ShadowingVariableError"],
  33912. messageSends: ["variableName:", "new", "signal"]
  33913. }),
  33914. $globals.SemanticAnalyzer);
  33915. $core.addMethod(
  33916. $core.method({
  33917. selector: "errorUnknownVariable:",
  33918. protocol: 'error handling',
  33919. fn: function (aNode){
  33920. var self=this;
  33921. var identifier;
  33922. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  33923. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  33924. return $core.withContext(function($ctx1) {
  33925. var $1,$2,$3;
  33926. identifier=$recv(aNode)._value();
  33927. $ctx1.sendIdx["value"]=1;
  33928. $1=$recv($recv($recv($recv($Smalltalk())._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  33929. return $core.withContext(function($ctx2) {
  33930. return self._isVariableUndefined_inPackage_(identifier,self._thePackage());
  33931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33932. }));
  33933. if($core.assert($1)){
  33934. $2=$recv($UnknownVariableError())._new();
  33935. $3=$recv(aNode)._value();
  33936. $ctx1.sendIdx["value"]=2;
  33937. $recv($2)._variableName_($3);
  33938. $recv($2)._signal();
  33939. } else {
  33940. $recv($recv($recv(self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  33941. };
  33942. return self;
  33943. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  33944. },
  33945. args: ["aNode"],
  33946. 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 ]",
  33947. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  33948. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  33949. }),
  33950. $globals.SemanticAnalyzer);
  33951. $core.addMethod(
  33952. $core.method({
  33953. selector: "isVariableUndefined:inPackage:",
  33954. protocol: 'testing',
  33955. fn: function (aString,aPackage){
  33956. var self=this;
  33957. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  33958. return $core.withContext(function($ctx1) {
  33959. var $1,$2,$3,$receiver;
  33960. if(($receiver = aPackage) == null || $receiver.isNil){
  33961. aPackage;
  33962. } else {
  33963. var packageKnownVars;
  33964. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  33965. packageKnownVars;
  33966. $1=$recv(packageKnownVars)._includes_(aString);
  33967. if($core.assert($1)){
  33968. return false;
  33969. };
  33970. };
  33971. $2=$recv($Compiler())._new();
  33972. $3=$recv("typeof ".__comma(aString)).__comma(" == \x22undefined\x22");
  33973. $ctx1.sendIdx[","]=1;
  33974. return $recv($2)._eval_($3);
  33975. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  33976. },
  33977. args: ["aString", "aPackage"],
  33978. 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'",
  33979. referencedClasses: ["Compiler"],
  33980. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", "new", ","]
  33981. }),
  33982. $globals.SemanticAnalyzer);
  33983. $core.addMethod(
  33984. $core.method({
  33985. selector: "messageSends",
  33986. protocol: 'accessing',
  33987. fn: function (){
  33988. var self=this;
  33989. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  33990. return $core.withContext(function($ctx1) {
  33991. var $1,$receiver;
  33992. $1=self["@messageSends"];
  33993. if(($receiver = $1) == null || $receiver.isNil){
  33994. self["@messageSends"]=$recv($Dictionary())._new();
  33995. return self["@messageSends"];
  33996. } else {
  33997. return $1;
  33998. };
  33999. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  34000. },
  34001. args: [],
  34002. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  34003. referencedClasses: ["Dictionary"],
  34004. messageSends: ["ifNil:", "new"]
  34005. }),
  34006. $globals.SemanticAnalyzer);
  34007. $core.addMethod(
  34008. $core.method({
  34009. selector: "newBlockScope",
  34010. protocol: 'factory',
  34011. fn: function (){
  34012. var self=this;
  34013. function $LexicalScope(){return $globals.LexicalScope||(typeof LexicalScope=="undefined"?nil:LexicalScope)}
  34014. return $core.withContext(function($ctx1) {
  34015. return self._newScopeOfClass_($LexicalScope());
  34016. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  34017. },
  34018. args: [],
  34019. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  34020. referencedClasses: ["LexicalScope"],
  34021. messageSends: ["newScopeOfClass:"]
  34022. }),
  34023. $globals.SemanticAnalyzer);
  34024. $core.addMethod(
  34025. $core.method({
  34026. selector: "newMethodScope",
  34027. protocol: 'factory',
  34028. fn: function (){
  34029. var self=this;
  34030. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  34031. return $core.withContext(function($ctx1) {
  34032. return self._newScopeOfClass_($MethodLexicalScope());
  34033. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  34034. },
  34035. args: [],
  34036. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  34037. referencedClasses: ["MethodLexicalScope"],
  34038. messageSends: ["newScopeOfClass:"]
  34039. }),
  34040. $globals.SemanticAnalyzer);
  34041. $core.addMethod(
  34042. $core.method({
  34043. selector: "newScopeOfClass:",
  34044. protocol: 'factory',
  34045. fn: function (aLexicalScopeClass){
  34046. var self=this;
  34047. return $core.withContext(function($ctx1) {
  34048. var $1;
  34049. $1=$recv(aLexicalScopeClass)._new();
  34050. $recv($1)._outerScope_(self["@currentScope"]);
  34051. return $recv($1)._yourself();
  34052. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  34053. },
  34054. args: ["aLexicalScopeClass"],
  34055. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  34056. referencedClasses: [],
  34057. messageSends: ["outerScope:", "new", "yourself"]
  34058. }),
  34059. $globals.SemanticAnalyzer);
  34060. $core.addMethod(
  34061. $core.method({
  34062. selector: "nextBlockIndex",
  34063. protocol: 'private',
  34064. fn: function (){
  34065. var self=this;
  34066. return $core.withContext(function($ctx1) {
  34067. var $1,$receiver;
  34068. $1=self["@blockIndex"];
  34069. if(($receiver = $1) == null || $receiver.isNil){
  34070. self["@blockIndex"]=(0);
  34071. self["@blockIndex"];
  34072. } else {
  34073. $1;
  34074. };
  34075. self["@blockIndex"]=$recv(self["@blockIndex"]).__plus((1));
  34076. return self["@blockIndex"];
  34077. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  34078. },
  34079. args: [],
  34080. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  34081. referencedClasses: [],
  34082. messageSends: ["ifNil:", "+"]
  34083. }),
  34084. $globals.SemanticAnalyzer);
  34085. $core.addMethod(
  34086. $core.method({
  34087. selector: "popScope",
  34088. protocol: 'scope',
  34089. fn: function (){
  34090. var self=this;
  34091. return $core.withContext(function($ctx1) {
  34092. var $1,$receiver;
  34093. $1=self["@currentScope"];
  34094. if(($receiver = $1) == null || $receiver.isNil){
  34095. $1;
  34096. } else {
  34097. self["@currentScope"]=$recv(self["@currentScope"])._outerScope();
  34098. self["@currentScope"];
  34099. };
  34100. return self;
  34101. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  34102. },
  34103. args: [],
  34104. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  34105. referencedClasses: [],
  34106. messageSends: ["ifNotNil:", "outerScope"]
  34107. }),
  34108. $globals.SemanticAnalyzer);
  34109. $core.addMethod(
  34110. $core.method({
  34111. selector: "pushScope:",
  34112. protocol: 'scope',
  34113. fn: function (aScope){
  34114. var self=this;
  34115. return $core.withContext(function($ctx1) {
  34116. $recv(aScope)._outerScope_(self["@currentScope"]);
  34117. self["@currentScope"]=aScope;
  34118. return self;
  34119. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  34120. },
  34121. args: ["aScope"],
  34122. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  34123. referencedClasses: [],
  34124. messageSends: ["outerScope:"]
  34125. }),
  34126. $globals.SemanticAnalyzer);
  34127. $core.addMethod(
  34128. $core.method({
  34129. selector: "theClass",
  34130. protocol: 'accessing',
  34131. fn: function (){
  34132. var self=this;
  34133. return self["@theClass"];
  34134. },
  34135. args: [],
  34136. source: "theClass\x0a\x09^ theClass",
  34137. referencedClasses: [],
  34138. messageSends: []
  34139. }),
  34140. $globals.SemanticAnalyzer);
  34141. $core.addMethod(
  34142. $core.method({
  34143. selector: "theClass:",
  34144. protocol: 'accessing',
  34145. fn: function (aClass){
  34146. var self=this;
  34147. self["@theClass"]=aClass;
  34148. return self;
  34149. },
  34150. args: ["aClass"],
  34151. source: "theClass: aClass\x0a\x09theClass := aClass",
  34152. referencedClasses: [],
  34153. messageSends: []
  34154. }),
  34155. $globals.SemanticAnalyzer);
  34156. $core.addMethod(
  34157. $core.method({
  34158. selector: "thePackage",
  34159. protocol: 'accessing',
  34160. fn: function (){
  34161. var self=this;
  34162. return self["@thePackage"];
  34163. },
  34164. args: [],
  34165. source: "thePackage\x0a\x09^ thePackage",
  34166. referencedClasses: [],
  34167. messageSends: []
  34168. }),
  34169. $globals.SemanticAnalyzer);
  34170. $core.addMethod(
  34171. $core.method({
  34172. selector: "thePackage:",
  34173. protocol: 'accessing',
  34174. fn: function (aPackage){
  34175. var self=this;
  34176. self["@thePackage"]=aPackage;
  34177. return self;
  34178. },
  34179. args: ["aPackage"],
  34180. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  34181. referencedClasses: [],
  34182. messageSends: []
  34183. }),
  34184. $globals.SemanticAnalyzer);
  34185. $core.addMethod(
  34186. $core.method({
  34187. selector: "validateVariableScope:",
  34188. protocol: 'scope',
  34189. fn: function (aString){
  34190. var self=this;
  34191. return $core.withContext(function($ctx1) {
  34192. var $1,$receiver;
  34193. $1=$recv(self["@currentScope"])._lookupVariable_(aString);
  34194. if(($receiver = $1) == null || $receiver.isNil){
  34195. $1;
  34196. } else {
  34197. self._errorShadowingVariable_(aString);
  34198. };
  34199. return self;
  34200. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  34201. },
  34202. args: ["aString"],
  34203. 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 ]",
  34204. referencedClasses: [],
  34205. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  34206. }),
  34207. $globals.SemanticAnalyzer);
  34208. $core.addMethod(
  34209. $core.method({
  34210. selector: "visitAssignmentNode:",
  34211. protocol: 'visiting',
  34212. fn: function (aNode){
  34213. var self=this;
  34214. return $core.withContext(function($ctx1) {
  34215. (
  34216. $ctx1.supercall = true,
  34217. ($globals.SemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitAssignmentNode_.apply($recv(self), [aNode]));
  34218. $ctx1.supercall = false;
  34219. $recv($recv(aNode)._left())._beAssigned();
  34220. return self;
  34221. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34222. },
  34223. args: ["aNode"],
  34224. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  34225. referencedClasses: [],
  34226. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  34227. }),
  34228. $globals.SemanticAnalyzer);
  34229. $core.addMethod(
  34230. $core.method({
  34231. selector: "visitBlockNode:",
  34232. protocol: 'visiting',
  34233. fn: function (aNode){
  34234. var self=this;
  34235. return $core.withContext(function($ctx1) {
  34236. self._pushScope_(self._newBlockScope());
  34237. $recv(aNode)._scope_(self["@currentScope"]);
  34238. $recv(self["@currentScope"])._node_(aNode);
  34239. $recv(self["@currentScope"])._blockIndex_(self._nextBlockIndex());
  34240. $recv($recv(aNode)._parameters())._do_((function(each){
  34241. return $core.withContext(function($ctx2) {
  34242. self._validateVariableScope_(each);
  34243. return $recv(self["@currentScope"])._addArg_(each);
  34244. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34245. }));
  34246. (
  34247. $ctx1.supercall = true,
  34248. ($globals.SemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitBlockNode_.apply($recv(self), [aNode]));
  34249. $ctx1.supercall = false;
  34250. self._popScope();
  34251. return self;
  34252. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34253. },
  34254. args: ["aNode"],
  34255. 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",
  34256. referencedClasses: [],
  34257. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  34258. }),
  34259. $globals.SemanticAnalyzer);
  34260. $core.addMethod(
  34261. $core.method({
  34262. selector: "visitCascadeNode:",
  34263. protocol: 'visiting',
  34264. fn: function (aNode){
  34265. var self=this;
  34266. return $core.withContext(function($ctx1) {
  34267. $recv(aNode)._receiver_($recv($recv($recv(aNode)._nodes())._first())._receiver());
  34268. (
  34269. $ctx1.supercall = true,
  34270. ($globals.SemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitCascadeNode_.apply($recv(self), [aNode]));
  34271. $ctx1.supercall = false;
  34272. return self;
  34273. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34274. },
  34275. args: ["aNode"],
  34276. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode nodes first receiver.\x0a\x09super visitCascadeNode: aNode",
  34277. referencedClasses: [],
  34278. messageSends: ["receiver:", "receiver", "first", "nodes", "visitCascadeNode:"]
  34279. }),
  34280. $globals.SemanticAnalyzer);
  34281. $core.addMethod(
  34282. $core.method({
  34283. selector: "visitMethodNode:",
  34284. protocol: 'visiting',
  34285. fn: function (aNode){
  34286. var self=this;
  34287. return $core.withContext(function($ctx1) {
  34288. self._pushScope_(self._newMethodScope());
  34289. $recv(aNode)._scope_(self["@currentScope"]);
  34290. $recv(self["@currentScope"])._node_(aNode);
  34291. $recv($recv(self._theClass())._allInstanceVariableNames())._do_((function(each){
  34292. return $core.withContext(function($ctx2) {
  34293. return $recv(self["@currentScope"])._addIVar_(each);
  34294. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34295. }));
  34296. $ctx1.sendIdx["do:"]=1;
  34297. $recv($recv(aNode)._arguments())._do_((function(each){
  34298. return $core.withContext(function($ctx2) {
  34299. self._validateVariableScope_(each);
  34300. return $recv(self["@currentScope"])._addArg_(each);
  34301. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  34302. }));
  34303. (
  34304. $ctx1.supercall = true,
  34305. ($globals.SemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitMethodNode_.apply($recv(self), [aNode]));
  34306. $ctx1.supercall = false;
  34307. $recv(aNode)._classReferences_(self._classReferences());
  34308. $recv(aNode)._sendIndexes_(self._messageSends());
  34309. self._popScope();
  34310. return self;
  34311. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34312. },
  34313. args: ["aNode"],
  34314. source: "visitMethodNode: aNode\x0a\x09self pushScope: self newMethodScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x0a\x09self theClass allInstanceVariableNames do: [ :each |\x0a\x09\x09currentScope addIVar: each ].\x0a\x09aNode arguments do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitMethodNode: aNode.\x0a\x0a\x09aNode\x0a\x09\x09classReferences: self classReferences;\x0a\x09\x09sendIndexes: self messageSends.\x0a\x09self popScope",
  34315. referencedClasses: [],
  34316. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  34317. }),
  34318. $globals.SemanticAnalyzer);
  34319. $core.addMethod(
  34320. $core.method({
  34321. selector: "visitReturnNode:",
  34322. protocol: 'visiting',
  34323. fn: function (aNode){
  34324. var self=this;
  34325. return $core.withContext(function($ctx1) {
  34326. var $1;
  34327. $recv(aNode)._scope_(self["@currentScope"]);
  34328. $1=$recv(self["@currentScope"])._isMethodScope();
  34329. if($core.assert($1)){
  34330. $recv(self["@currentScope"])._localReturn_(true);
  34331. } else {
  34332. $recv($recv(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  34333. };
  34334. (
  34335. $ctx1.supercall = true,
  34336. ($globals.SemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitReturnNode_.apply($recv(self), [aNode]));
  34337. $ctx1.supercall = false;
  34338. return self;
  34339. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34340. },
  34341. args: ["aNode"],
  34342. 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",
  34343. referencedClasses: [],
  34344. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  34345. }),
  34346. $globals.SemanticAnalyzer);
  34347. $core.addMethod(
  34348. $core.method({
  34349. selector: "visitSendNode:",
  34350. protocol: 'visiting',
  34351. fn: function (aNode){
  34352. var self=this;
  34353. function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  34354. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  34355. return $core.withContext(function($ctx1) {
  34356. var $3,$2,$1,$5,$6,$4,$7,$8,$9,$11,$12,$10,$receiver;
  34357. $3=$recv(aNode)._receiver();
  34358. $ctx1.sendIdx["receiver"]=1;
  34359. $2=$recv($3)._value();
  34360. $1=$recv($2).__eq("super");
  34361. if(!$core.assert($1)){
  34362. $5=$recv($IRSendInliner())._inlinedSelectors();
  34363. $6=$recv(aNode)._selector();
  34364. $ctx1.sendIdx["selector"]=1;
  34365. $4=$recv($5)._includes_($6);
  34366. if($core.assert($4)){
  34367. $recv(aNode)._shouldBeInlined_(true);
  34368. $7=$recv(aNode)._receiver();
  34369. if(($receiver = $7) == null || $receiver.isNil){
  34370. $7;
  34371. } else {
  34372. var receiver;
  34373. receiver=$receiver;
  34374. $recv(receiver)._shouldBeAliased_(true);
  34375. };
  34376. };
  34377. };
  34378. $8=self._messageSends();
  34379. $ctx1.sendIdx["messageSends"]=1;
  34380. $9=$recv(aNode)._selector();
  34381. $ctx1.sendIdx["selector"]=2;
  34382. $recv($8)._at_ifAbsentPut_($9,(function(){
  34383. return $core.withContext(function($ctx2) {
  34384. return $recv($Set())._new();
  34385. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  34386. }));
  34387. $11=self._messageSends();
  34388. $ctx1.sendIdx["messageSends"]=2;
  34389. $12=$recv(aNode)._selector();
  34390. $ctx1.sendIdx["selector"]=3;
  34391. $10=$recv($11)._at_($12);
  34392. $ctx1.sendIdx["at:"]=1;
  34393. $recv($10)._add_(aNode);
  34394. $recv(aNode)._index_($recv($recv(self._messageSends())._at_($recv(aNode)._selector()))._size());
  34395. (
  34396. $ctx1.supercall = true,
  34397. ($globals.SemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  34398. $ctx1.supercall = false;
  34399. return self;
  34400. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34401. },
  34402. args: ["aNode"],
  34403. source: "visitSendNode: aNode\x0a\x0a\x09aNode receiver value = 'super'\x0a\x09\x09ifFalse: [ (IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeInlined: true.\x0a\x09\x09\x09aNode receiver ifNotNil: [ :receiver |\x0a\x09\x09\x09\x09receiver shouldBeAliased: true ] ] ].\x0a\x0a\x09self messageSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09(self messageSends at: aNode selector) add: aNode.\x0a\x0a\x09aNode index: (self messageSends at: aNode selector) size.\x0a\x0a\x09super visitSendNode: aNode",
  34404. referencedClasses: ["IRSendInliner", "Set"],
  34405. messageSends: ["ifFalse:", "=", "value", "receiver", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "shouldBeAliased:", "at:ifAbsentPut:", "messageSends", "new", "add:", "at:", "index:", "size", "visitSendNode:"]
  34406. }),
  34407. $globals.SemanticAnalyzer);
  34408. $core.addMethod(
  34409. $core.method({
  34410. selector: "visitSequenceNode:",
  34411. protocol: 'visiting',
  34412. fn: function (aNode){
  34413. var self=this;
  34414. return $core.withContext(function($ctx1) {
  34415. $recv($recv(aNode)._temps())._do_((function(each){
  34416. return $core.withContext(function($ctx2) {
  34417. self._validateVariableScope_(each);
  34418. return $recv(self["@currentScope"])._addTemp_(each);
  34419. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34420. }));
  34421. (
  34422. $ctx1.supercall = true,
  34423. ($globals.SemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  34424. $ctx1.supercall = false;
  34425. return self;
  34426. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34427. },
  34428. args: ["aNode"],
  34429. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  34430. referencedClasses: [],
  34431. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  34432. }),
  34433. $globals.SemanticAnalyzer);
  34434. $core.addMethod(
  34435. $core.method({
  34436. selector: "visitVariableNode:",
  34437. protocol: 'visiting',
  34438. fn: function (aNode){
  34439. var self=this;
  34440. var binding;
  34441. function $ClassRefVar(){return $globals.ClassRefVar||(typeof ClassRefVar=="undefined"?nil:ClassRefVar)}
  34442. function $UnknownVar(){return $globals.UnknownVar||(typeof UnknownVar=="undefined"?nil:UnknownVar)}
  34443. return $core.withContext(function($ctx1) {
  34444. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$receiver;
  34445. binding=$recv(self["@currentScope"])._lookupVariable_(aNode);
  34446. $1=binding;
  34447. if(($receiver = $1) == null || $receiver.isNil){
  34448. $3=$recv(aNode)._value();
  34449. $ctx1.sendIdx["value"]=1;
  34450. $2=$recv($3)._isCapitalized();
  34451. if($core.assert($2)){
  34452. $4=$recv($ClassRefVar())._new();
  34453. $ctx1.sendIdx["new"]=1;
  34454. $5=$recv(aNode)._value();
  34455. $ctx1.sendIdx["value"]=2;
  34456. $recv($4)._name_($5);
  34457. $ctx1.sendIdx["name:"]=1;
  34458. $6=$recv($4)._yourself();
  34459. $ctx1.sendIdx["yourself"]=1;
  34460. binding=$6;
  34461. binding;
  34462. $7=self._classReferences();
  34463. $8=$recv(aNode)._value();
  34464. $ctx1.sendIdx["value"]=3;
  34465. $recv($7)._add_($8);
  34466. } else {
  34467. self._errorUnknownVariable_(aNode);
  34468. $9=$recv($UnknownVar())._new();
  34469. $recv($9)._name_($recv(aNode)._value());
  34470. binding=$recv($9)._yourself();
  34471. binding;
  34472. };
  34473. } else {
  34474. $1;
  34475. };
  34476. $recv(aNode)._binding_(binding);
  34477. return self;
  34478. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  34479. },
  34480. args: ["aNode"],
  34481. 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.",
  34482. referencedClasses: ["ClassRefVar", "UnknownVar"],
  34483. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  34484. }),
  34485. $globals.SemanticAnalyzer);
  34486. $core.addMethod(
  34487. $core.method({
  34488. selector: "on:",
  34489. protocol: 'instance creation',
  34490. fn: function (aClass){
  34491. var self=this;
  34492. return $core.withContext(function($ctx1) {
  34493. var $1;
  34494. $1=self._new();
  34495. $recv($1)._theClass_(aClass);
  34496. return $recv($1)._yourself();
  34497. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.klass)});
  34498. },
  34499. args: ["aClass"],
  34500. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  34501. referencedClasses: [],
  34502. messageSends: ["theClass:", "new", "yourself"]
  34503. }),
  34504. $globals.SemanticAnalyzer.klass);
  34505. $core.addClass('SemanticError', $globals.CompilerError, [], 'Compiler-Semantic');
  34506. $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";
  34507. $core.addClass('InvalidAssignmentError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
  34508. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  34509. $core.addMethod(
  34510. $core.method({
  34511. selector: "messageText",
  34512. protocol: 'accessing',
  34513. fn: function (){
  34514. var self=this;
  34515. return $core.withContext(function($ctx1) {
  34516. return " Invalid assignment to variable: ".__comma(self._variableName());
  34517. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  34518. },
  34519. args: [],
  34520. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  34521. referencedClasses: [],
  34522. messageSends: [",", "variableName"]
  34523. }),
  34524. $globals.InvalidAssignmentError);
  34525. $core.addMethod(
  34526. $core.method({
  34527. selector: "variableName",
  34528. protocol: 'accessing',
  34529. fn: function (){
  34530. var self=this;
  34531. return self["@variableName"];
  34532. },
  34533. args: [],
  34534. source: "variableName\x0a\x09^ variableName",
  34535. referencedClasses: [],
  34536. messageSends: []
  34537. }),
  34538. $globals.InvalidAssignmentError);
  34539. $core.addMethod(
  34540. $core.method({
  34541. selector: "variableName:",
  34542. protocol: 'accessing',
  34543. fn: function (aString){
  34544. var self=this;
  34545. self["@variableName"]=aString;
  34546. return self;
  34547. },
  34548. args: ["aString"],
  34549. source: "variableName: aString\x0a\x09variableName := aString",
  34550. referencedClasses: [],
  34551. messageSends: []
  34552. }),
  34553. $globals.InvalidAssignmentError);
  34554. $core.addClass('ShadowingVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
  34555. $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.";
  34556. $core.addMethod(
  34557. $core.method({
  34558. selector: "messageText",
  34559. protocol: 'accessing',
  34560. fn: function (){
  34561. var self=this;
  34562. return $core.withContext(function($ctx1) {
  34563. var $1;
  34564. $1=$recv("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
  34565. $ctx1.sendIdx[","]=1;
  34566. return $1;
  34567. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  34568. },
  34569. args: [],
  34570. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  34571. referencedClasses: [],
  34572. messageSends: [",", "variableName"]
  34573. }),
  34574. $globals.ShadowingVariableError);
  34575. $core.addMethod(
  34576. $core.method({
  34577. selector: "variableName",
  34578. protocol: 'accessing',
  34579. fn: function (){
  34580. var self=this;
  34581. return self["@variableName"];
  34582. },
  34583. args: [],
  34584. source: "variableName\x0a\x09^ variableName",
  34585. referencedClasses: [],
  34586. messageSends: []
  34587. }),
  34588. $globals.ShadowingVariableError);
  34589. $core.addMethod(
  34590. $core.method({
  34591. selector: "variableName:",
  34592. protocol: 'accessing',
  34593. fn: function (aString){
  34594. var self=this;
  34595. self["@variableName"]=aString;
  34596. return self;
  34597. },
  34598. args: ["aString"],
  34599. source: "variableName: aString\x0a\x09variableName := aString",
  34600. referencedClasses: [],
  34601. messageSends: []
  34602. }),
  34603. $globals.ShadowingVariableError);
  34604. $core.addClass('UnknownVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
  34605. $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.";
  34606. $core.addMethod(
  34607. $core.method({
  34608. selector: "messageText",
  34609. protocol: 'accessing',
  34610. fn: function (){
  34611. var self=this;
  34612. return $core.withContext(function($ctx1) {
  34613. var $1;
  34614. $1=$recv("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
  34615. $ctx1.sendIdx[","]=1;
  34616. return $1;
  34617. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  34618. },
  34619. args: [],
  34620. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  34621. referencedClasses: [],
  34622. messageSends: [",", "variableName"]
  34623. }),
  34624. $globals.UnknownVariableError);
  34625. $core.addMethod(
  34626. $core.method({
  34627. selector: "variableName",
  34628. protocol: 'accessing',
  34629. fn: function (){
  34630. var self=this;
  34631. return self["@variableName"];
  34632. },
  34633. args: [],
  34634. source: "variableName\x0a\x09^ variableName",
  34635. referencedClasses: [],
  34636. messageSends: []
  34637. }),
  34638. $globals.UnknownVariableError);
  34639. $core.addMethod(
  34640. $core.method({
  34641. selector: "variableName:",
  34642. protocol: 'accessing',
  34643. fn: function (aString){
  34644. var self=this;
  34645. self["@variableName"]=aString;
  34646. return self;
  34647. },
  34648. args: ["aString"],
  34649. source: "variableName: aString\x0a\x09variableName := aString",
  34650. referencedClasses: [],
  34651. messageSends: []
  34652. }),
  34653. $globals.UnknownVariableError);
  34654. });
  34655. define("amber_core/Compiler-IR", ["amber/boot", "amber_core/Compiler-AST", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){"use strict";
  34656. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  34657. $core.addPackage('Compiler-IR');
  34658. $core.packages["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
  34659. $core.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  34660. $core.addClass('IRASTTranslator', $globals.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  34661. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  34662. $core.addMethod(
  34663. $core.method({
  34664. selector: "alias:",
  34665. protocol: 'visiting',
  34666. fn: function (aNode){
  34667. var self=this;
  34668. var variable;
  34669. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  34670. function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  34671. function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  34672. return $core.withContext(function($ctx1) {
  34673. var $1,$2,$3,$5,$4,$6,$7,$9,$8;
  34674. $1=$recv(aNode)._isImmutable();
  34675. if($core.assert($1)){
  34676. $2=self._visit_(aNode);
  34677. $ctx1.sendIdx["visit:"]=1;
  34678. return $2;
  34679. };
  34680. $3=$recv($IRVariable())._new();
  34681. $ctx1.sendIdx["new"]=1;
  34682. $5=$recv($AliasVar())._new();
  34683. $ctx1.sendIdx["new"]=2;
  34684. $4=$recv($5)._name_("$".__comma(self._nextAlias()));
  34685. $recv($3)._variable_($4);
  34686. $6=$recv($3)._yourself();
  34687. $ctx1.sendIdx["yourself"]=1;
  34688. variable=$6;
  34689. $7=self._sequence();
  34690. $9=$recv($IRAssignment())._new();
  34691. $recv($9)._add_(variable);
  34692. $ctx1.sendIdx["add:"]=2;
  34693. $recv($9)._add_(self._visit_(aNode));
  34694. $ctx1.sendIdx["add:"]=3;
  34695. $8=$recv($9)._yourself();
  34696. $recv($7)._add_($8);
  34697. $ctx1.sendIdx["add:"]=1;
  34698. $recv($recv(self._method())._internalVariables())._add_(variable);
  34699. return variable;
  34700. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  34701. },
  34702. args: ["aNode"],
  34703. 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",
  34704. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  34705. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"]
  34706. }),
  34707. $globals.IRASTTranslator);
  34708. $core.addMethod(
  34709. $core.method({
  34710. selector: "aliasTemporally:",
  34711. protocol: 'visiting',
  34712. fn: function (aCollection){
  34713. var self=this;
  34714. var threshold,result;
  34715. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  34716. return $core.withContext(function($ctx1) {
  34717. var $1,$2,$4,$3;
  34718. threshold=(0);
  34719. $recv(aCollection)._withIndexDo_((function(each,i){
  34720. return $core.withContext(function($ctx2) {
  34721. $1=$recv(each)._subtreeNeedsAliasing();
  34722. if($core.assert($1)){
  34723. threshold=i;
  34724. return threshold;
  34725. };
  34726. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  34727. }));
  34728. $ctx1.sendIdx["withIndexDo:"]=1;
  34729. result=$recv($OrderedCollection())._new();
  34730. $recv(aCollection)._withIndexDo_((function(each,i){
  34731. return $core.withContext(function($ctx2) {
  34732. $2=result;
  34733. $4=$recv(i).__lt_eq(threshold);
  34734. if($core.assert($4)){
  34735. $3=self._alias_(each);
  34736. } else {
  34737. $3=self._visit_(each);
  34738. };
  34739. return $recv($2)._add_($3);
  34740. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  34741. }));
  34742. return result;
  34743. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  34744. },
  34745. args: ["aCollection"],
  34746. 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",
  34747. referencedClasses: ["OrderedCollection"],
  34748. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  34749. }),
  34750. $globals.IRASTTranslator);
  34751. $core.addMethod(
  34752. $core.method({
  34753. selector: "method",
  34754. protocol: 'accessing',
  34755. fn: function (){
  34756. var self=this;
  34757. return self["@method"];
  34758. },
  34759. args: [],
  34760. source: "method\x0a\x09^ method",
  34761. referencedClasses: [],
  34762. messageSends: []
  34763. }),
  34764. $globals.IRASTTranslator);
  34765. $core.addMethod(
  34766. $core.method({
  34767. selector: "method:",
  34768. protocol: 'accessing',
  34769. fn: function (anIRMethod){
  34770. var self=this;
  34771. self["@method"]=anIRMethod;
  34772. return self;
  34773. },
  34774. args: ["anIRMethod"],
  34775. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  34776. referencedClasses: [],
  34777. messageSends: []
  34778. }),
  34779. $globals.IRASTTranslator);
  34780. $core.addMethod(
  34781. $core.method({
  34782. selector: "nextAlias",
  34783. protocol: 'accessing',
  34784. fn: function (){
  34785. var self=this;
  34786. return $core.withContext(function($ctx1) {
  34787. var $1,$receiver;
  34788. $1=self["@nextAlias"];
  34789. if(($receiver = $1) == null || $receiver.isNil){
  34790. self["@nextAlias"]=(0);
  34791. self["@nextAlias"];
  34792. } else {
  34793. $1;
  34794. };
  34795. self["@nextAlias"]=$recv(self["@nextAlias"]).__plus((1));
  34796. return $recv(self["@nextAlias"])._asString();
  34797. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  34798. },
  34799. args: [],
  34800. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  34801. referencedClasses: [],
  34802. messageSends: ["ifNil:", "+", "asString"]
  34803. }),
  34804. $globals.IRASTTranslator);
  34805. $core.addMethod(
  34806. $core.method({
  34807. selector: "sequence",
  34808. protocol: 'accessing',
  34809. fn: function (){
  34810. var self=this;
  34811. return self["@sequence"];
  34812. },
  34813. args: [],
  34814. source: "sequence\x0a\x09^ sequence",
  34815. referencedClasses: [],
  34816. messageSends: []
  34817. }),
  34818. $globals.IRASTTranslator);
  34819. $core.addMethod(
  34820. $core.method({
  34821. selector: "sequence:",
  34822. protocol: 'accessing',
  34823. fn: function (anIRSequence){
  34824. var self=this;
  34825. self["@sequence"]=anIRSequence;
  34826. return self;
  34827. },
  34828. args: ["anIRSequence"],
  34829. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  34830. referencedClasses: [],
  34831. messageSends: []
  34832. }),
  34833. $globals.IRASTTranslator);
  34834. $core.addMethod(
  34835. $core.method({
  34836. selector: "source",
  34837. protocol: 'accessing',
  34838. fn: function (){
  34839. var self=this;
  34840. return self["@source"];
  34841. },
  34842. args: [],
  34843. source: "source\x0a\x09^ source",
  34844. referencedClasses: [],
  34845. messageSends: []
  34846. }),
  34847. $globals.IRASTTranslator);
  34848. $core.addMethod(
  34849. $core.method({
  34850. selector: "source:",
  34851. protocol: 'accessing',
  34852. fn: function (aString){
  34853. var self=this;
  34854. self["@source"]=aString;
  34855. return self;
  34856. },
  34857. args: ["aString"],
  34858. source: "source: aString\x0a\x09source := aString",
  34859. referencedClasses: [],
  34860. messageSends: []
  34861. }),
  34862. $globals.IRASTTranslator);
  34863. $core.addMethod(
  34864. $core.method({
  34865. selector: "theClass",
  34866. protocol: 'accessing',
  34867. fn: function (){
  34868. var self=this;
  34869. return self["@theClass"];
  34870. },
  34871. args: [],
  34872. source: "theClass\x0a\x09^ theClass",
  34873. referencedClasses: [],
  34874. messageSends: []
  34875. }),
  34876. $globals.IRASTTranslator);
  34877. $core.addMethod(
  34878. $core.method({
  34879. selector: "theClass:",
  34880. protocol: 'accessing',
  34881. fn: function (aClass){
  34882. var self=this;
  34883. self["@theClass"]=aClass;
  34884. return self;
  34885. },
  34886. args: ["aClass"],
  34887. source: "theClass: aClass\x0a\x09theClass := aClass",
  34888. referencedClasses: [],
  34889. messageSends: []
  34890. }),
  34891. $globals.IRASTTranslator);
  34892. $core.addMethod(
  34893. $core.method({
  34894. selector: "visitAssignmentNode:",
  34895. protocol: 'visiting',
  34896. fn: function (aNode){
  34897. var self=this;
  34898. var left,right,assignment;
  34899. function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  34900. return $core.withContext(function($ctx1) {
  34901. var $1,$3,$2;
  34902. right=self._visit_($recv(aNode)._right());
  34903. $ctx1.sendIdx["visit:"]=1;
  34904. left=self._visit_($recv(aNode)._left());
  34905. $1=self._sequence();
  34906. $3=$recv($IRAssignment())._new();
  34907. $recv($3)._add_(left);
  34908. $ctx1.sendIdx["add:"]=2;
  34909. $recv($3)._add_(right);
  34910. $2=$recv($3)._yourself();
  34911. $recv($1)._add_($2);
  34912. $ctx1.sendIdx["add:"]=1;
  34913. return left;
  34914. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  34915. },
  34916. args: ["aNode"],
  34917. 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",
  34918. referencedClasses: ["IRAssignment"],
  34919. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"]
  34920. }),
  34921. $globals.IRASTTranslator);
  34922. $core.addMethod(
  34923. $core.method({
  34924. selector: "visitBlockNode:",
  34925. protocol: 'visiting',
  34926. fn: function (aNode){
  34927. var self=this;
  34928. var closure;
  34929. function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  34930. function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  34931. return $core.withContext(function($ctx1) {
  34932. var $1,$2,$3,$5,$4,$6,$8,$7;
  34933. $1=$recv($IRClosure())._new();
  34934. $ctx1.sendIdx["new"]=1;
  34935. $recv($1)._arguments_($recv(aNode)._parameters());
  34936. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  34937. $2=$recv(aNode)._scope();
  34938. $ctx1.sendIdx["scope"]=1;
  34939. $recv($1)._scope_($2);
  34940. $ctx1.sendIdx["scope:"]=1;
  34941. $3=$recv($1)._yourself();
  34942. $ctx1.sendIdx["yourself"]=1;
  34943. closure=$3;
  34944. $5=$recv(aNode)._scope();
  34945. $ctx1.sendIdx["scope"]=2;
  34946. $4=$recv($5)._temps();
  34947. $recv($4)._do_((function(each){
  34948. return $core.withContext(function($ctx2) {
  34949. $6=closure;
  34950. $8=$recv($IRTempDeclaration())._new();
  34951. $recv($8)._name_($recv(each)._name());
  34952. $recv($8)._scope_($recv(aNode)._scope());
  34953. $7=$recv($8)._yourself();
  34954. return $recv($6)._add_($7);
  34955. $ctx2.sendIdx["add:"]=1;
  34956. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34957. }));
  34958. $ctx1.sendIdx["do:"]=1;
  34959. $recv($recv(aNode)._nodes())._do_((function(each){
  34960. return $core.withContext(function($ctx2) {
  34961. return $recv(closure)._add_(self._visit_(each));
  34962. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  34963. }));
  34964. return closure;
  34965. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  34966. },
  34967. args: ["aNode"],
  34968. 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",
  34969. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  34970. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"]
  34971. }),
  34972. $globals.IRASTTranslator);
  34973. $core.addMethod(
  34974. $core.method({
  34975. selector: "visitBlockSequenceNode:",
  34976. protocol: 'visiting',
  34977. fn: function (aNode){
  34978. var self=this;
  34979. function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  34980. function $IRBlockReturn(){return $globals.IRBlockReturn||(typeof IRBlockReturn=="undefined"?nil:IRBlockReturn)}
  34981. return $core.withContext(function($ctx1) {
  34982. var $1,$2,$4,$3,$5,$6,$9,$8,$7,$10,$12,$15,$14,$13,$11;
  34983. $1=$recv($IRBlockSequence())._new();
  34984. $ctx1.sendIdx["new"]=1;
  34985. return self._withSequence_do_($1,(function(){
  34986. return $core.withContext(function($ctx2) {
  34987. $2=$recv(aNode)._nodes();
  34988. $ctx2.sendIdx["nodes"]=1;
  34989. return $recv($2)._ifNotEmpty_((function(){
  34990. return $core.withContext(function($ctx3) {
  34991. $4=$recv(aNode)._nodes();
  34992. $ctx3.sendIdx["nodes"]=2;
  34993. $3=$recv($4)._allButLast();
  34994. $recv($3)._do_((function(each){
  34995. return $core.withContext(function($ctx4) {
  34996. $5=self._sequence();
  34997. $ctx4.sendIdx["sequence"]=1;
  34998. $6=self._visitOrAlias_(each);
  34999. $ctx4.sendIdx["visitOrAlias:"]=1;
  35000. return $recv($5)._add_($6);
  35001. $ctx4.sendIdx["add:"]=1;
  35002. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  35003. }));
  35004. $9=$recv(aNode)._nodes();
  35005. $ctx3.sendIdx["nodes"]=3;
  35006. $8=$recv($9)._last();
  35007. $ctx3.sendIdx["last"]=1;
  35008. $7=$recv($8)._isReturnNode();
  35009. if($core.assert($7)){
  35010. return $recv(self._sequence())._add_(self._visitOrAlias_($recv($recv(aNode)._nodes())._last()));
  35011. } else {
  35012. $10=self._sequence();
  35013. $ctx3.sendIdx["sequence"]=2;
  35014. $12=$recv($IRBlockReturn())._new();
  35015. $15=$recv(aNode)._nodes();
  35016. $ctx3.sendIdx["nodes"]=4;
  35017. $14=$recv($15)._last();
  35018. $ctx3.sendIdx["last"]=2;
  35019. $13=self._visitOrAlias_($14);
  35020. $ctx3.sendIdx["visitOrAlias:"]=2;
  35021. $recv($12)._add_($13);
  35022. $ctx3.sendIdx["add:"]=3;
  35023. $11=$recv($12)._yourself();
  35024. return $recv($10)._add_($11);
  35025. $ctx3.sendIdx["add:"]=2;
  35026. };
  35027. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  35028. }));
  35029. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35030. }));
  35031. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35032. },
  35033. args: ["aNode"],
  35034. 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) ] ]]",
  35035. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  35036. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "nodes", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"]
  35037. }),
  35038. $globals.IRASTTranslator);
  35039. $core.addMethod(
  35040. $core.method({
  35041. selector: "visitCascadeNode:",
  35042. protocol: 'visiting',
  35043. fn: function (aNode){
  35044. var self=this;
  35045. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  35046. return $core.withContext(function($ctx1) {
  35047. var $1,$2,$4,$3;
  35048. $1=$recv(aNode)._nodes();
  35049. $ctx1.sendIdx["nodes"]=1;
  35050. $recv($1)._inject_into_($recv(aNode)._receiver(),(function(previous,each){
  35051. var receiver;
  35052. return $core.withContext(function($ctx2) {
  35053. $2=$recv(previous)._isImmutable();
  35054. if($core.assert($2)){
  35055. receiver=previous;
  35056. } else {
  35057. var alias;
  35058. alias=self._alias_(previous);
  35059. alias;
  35060. receiver=$recv($recv($VariableNode())._new())._binding_($recv(alias)._variable());
  35061. };
  35062. receiver;
  35063. $recv(each)._receiver_(receiver);
  35064. return receiver;
  35065. }, function($ctx2) {$ctx2.fillBlock({previous:previous,each:each,receiver:receiver},$ctx1,1)});
  35066. }));
  35067. $4=$recv(aNode)._nodes();
  35068. $ctx1.sendIdx["nodes"]=2;
  35069. $3=$recv($4)._allButLast();
  35070. $recv($3)._do_((function(each){
  35071. return $core.withContext(function($ctx2) {
  35072. return $recv(self._sequence())._add_(self._visit_(each));
  35073. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  35074. }));
  35075. return self._visitOrAlias_($recv($recv(aNode)._nodes())._last());
  35076. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35077. },
  35078. args: ["aNode"],
  35079. source: "visitCascadeNode: aNode\x0a\x09aNode nodes inject: aNode receiver into: [ :previous :each |\x0a\x09\x09| receiver |\x0a\x09\x09receiver := previous isImmutable \x0a\x09\x09\x09ifTrue: [ previous ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09| alias |\x0a\x09\x09\x09\x09alias := self alias: previous.\x0a\x09\x09\x09\x09VariableNode new binding: alias variable ].\x0a\x09\x09each receiver: receiver.\x0a\x09\x09receiver ].\x0a\x0a\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self visitOrAlias: aNode nodes last",
  35080. referencedClasses: ["VariableNode"],
  35081. messageSends: ["inject:into:", "nodes", "receiver", "ifTrue:ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "receiver:", "do:", "allButLast", "add:", "sequence", "visit:", "visitOrAlias:", "last"]
  35082. }),
  35083. $globals.IRASTTranslator);
  35084. $core.addMethod(
  35085. $core.method({
  35086. selector: "visitDynamicArrayNode:",
  35087. protocol: 'visiting',
  35088. fn: function (aNode){
  35089. var self=this;
  35090. var array;
  35091. function $IRDynamicArray(){return $globals.IRDynamicArray||(typeof IRDynamicArray=="undefined"?nil:IRDynamicArray)}
  35092. return $core.withContext(function($ctx1) {
  35093. array=$recv($IRDynamicArray())._new();
  35094. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  35095. return $core.withContext(function($ctx2) {
  35096. return $recv(array)._add_(each);
  35097. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35098. }));
  35099. return array;
  35100. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  35101. },
  35102. args: ["aNode"],
  35103. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | array add: each ].\x0a\x09^ array",
  35104. referencedClasses: ["IRDynamicArray"],
  35105. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
  35106. }),
  35107. $globals.IRASTTranslator);
  35108. $core.addMethod(
  35109. $core.method({
  35110. selector: "visitDynamicDictionaryNode:",
  35111. protocol: 'visiting',
  35112. fn: function (aNode){
  35113. var self=this;
  35114. var dictionary;
  35115. function $IRDynamicDictionary(){return $globals.IRDynamicDictionary||(typeof IRDynamicDictionary=="undefined"?nil:IRDynamicDictionary)}
  35116. return $core.withContext(function($ctx1) {
  35117. dictionary=$recv($IRDynamicDictionary())._new();
  35118. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  35119. return $core.withContext(function($ctx2) {
  35120. return $recv(dictionary)._add_(each);
  35121. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35122. }));
  35123. return dictionary;
  35124. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  35125. },
  35126. args: ["aNode"],
  35127. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  35128. referencedClasses: ["IRDynamicDictionary"],
  35129. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
  35130. }),
  35131. $globals.IRASTTranslator);
  35132. $core.addMethod(
  35133. $core.method({
  35134. selector: "visitJSStatementNode:",
  35135. protocol: 'visiting',
  35136. fn: function (aNode){
  35137. var self=this;
  35138. function $IRVerbatim(){return $globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
  35139. return $core.withContext(function($ctx1) {
  35140. var $1;
  35141. $1=$recv($IRVerbatim())._new();
  35142. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  35143. return $recv($1)._yourself();
  35144. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35145. },
  35146. args: ["aNode"],
  35147. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  35148. referencedClasses: ["IRVerbatim"],
  35149. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  35150. }),
  35151. $globals.IRASTTranslator);
  35152. $core.addMethod(
  35153. $core.method({
  35154. selector: "visitMethodNode:",
  35155. protocol: 'visiting',
  35156. fn: function (aNode){
  35157. var self=this;
  35158. function $IRMethod(){return $globals.IRMethod||(typeof IRMethod=="undefined"?nil:IRMethod)}
  35159. function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  35160. function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  35161. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  35162. function $IRVerbatim(){return $globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
  35163. return $core.withContext(function($ctx1) {
  35164. var $2,$3,$4,$1,$6,$5,$7,$9,$10,$11,$8,$12,$14,$13,$15,$17,$19,$20,$18,$21,$16,$23,$22;
  35165. $2=$recv($IRMethod())._new();
  35166. $ctx1.sendIdx["new"]=1;
  35167. $recv($2)._source_($recv(self._source())._crlfSanitized());
  35168. $ctx1.sendIdx["source:"]=1;
  35169. $recv($2)._theClass_(self._theClass());
  35170. $recv($2)._arguments_($recv(aNode)._arguments());
  35171. $recv($2)._selector_($recv(aNode)._selector());
  35172. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  35173. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  35174. $recv($2)._classReferences_($recv(aNode)._classReferences());
  35175. $3=$recv(aNode)._scope();
  35176. $ctx1.sendIdx["scope"]=1;
  35177. $recv($2)._scope_($3);
  35178. $ctx1.sendIdx["scope:"]=1;
  35179. $4=$recv($2)._yourself();
  35180. $ctx1.sendIdx["yourself"]=1;
  35181. $1=$4;
  35182. self._method_($1);
  35183. $6=$recv(aNode)._scope();
  35184. $ctx1.sendIdx["scope"]=2;
  35185. $5=$recv($6)._temps();
  35186. $recv($5)._do_((function(each){
  35187. return $core.withContext(function($ctx2) {
  35188. $7=self._method();
  35189. $ctx2.sendIdx["method"]=1;
  35190. $9=$recv($IRTempDeclaration())._new();
  35191. $ctx2.sendIdx["new"]=2;
  35192. $recv($9)._name_($recv(each)._name());
  35193. $10=$recv(aNode)._scope();
  35194. $ctx2.sendIdx["scope"]=3;
  35195. $recv($9)._scope_($10);
  35196. $11=$recv($9)._yourself();
  35197. $ctx2.sendIdx["yourself"]=2;
  35198. $8=$11;
  35199. return $recv($7)._add_($8);
  35200. $ctx2.sendIdx["add:"]=1;
  35201. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35202. }));
  35203. $ctx1.sendIdx["do:"]=1;
  35204. $recv($recv(aNode)._nodes())._do_((function(each){
  35205. return $core.withContext(function($ctx2) {
  35206. $12=self._method();
  35207. $ctx2.sendIdx["method"]=2;
  35208. return $recv($12)._add_(self._visit_(each));
  35209. $ctx2.sendIdx["add:"]=2;
  35210. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35211. }));
  35212. $14=$recv(aNode)._scope();
  35213. $ctx1.sendIdx["scope"]=4;
  35214. $13=$recv($14)._hasLocalReturn();
  35215. if(!$core.assert($13)){
  35216. $15=self._method();
  35217. $ctx1.sendIdx["method"]=3;
  35218. $17=$recv($IRReturn())._new();
  35219. $ctx1.sendIdx["new"]=3;
  35220. $19=$recv($IRVariable())._new();
  35221. $ctx1.sendIdx["new"]=4;
  35222. $recv($19)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  35223. $20=$recv($19)._yourself();
  35224. $ctx1.sendIdx["yourself"]=3;
  35225. $18=$20;
  35226. $recv($17)._add_($18);
  35227. $ctx1.sendIdx["add:"]=4;
  35228. $21=$recv($17)._yourself();
  35229. $ctx1.sendIdx["yourself"]=4;
  35230. $16=$21;
  35231. $recv($15)._add_($16);
  35232. $ctx1.sendIdx["add:"]=3;
  35233. $23=$recv($IRVerbatim())._new();
  35234. $recv($23)._source_("");
  35235. $22=$recv($23)._yourself();
  35236. $recv($15)._add_($22);
  35237. };
  35238. return self._method();
  35239. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35240. },
  35241. args: ["aNode"],
  35242. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode nodes do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ''; yourself) ].\x0a\x0a\x09^ self method",
  35243. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"],
  35244. messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "sendIndexes:", "sendIndexes", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "nodes", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars"]
  35245. }),
  35246. $globals.IRASTTranslator);
  35247. $core.addMethod(
  35248. $core.method({
  35249. selector: "visitOrAlias:",
  35250. protocol: 'visiting',
  35251. fn: function (aNode){
  35252. var self=this;
  35253. return $core.withContext(function($ctx1) {
  35254. var $1;
  35255. $1=$recv(aNode)._shouldBeAliased();
  35256. if($core.assert($1)){
  35257. return self._alias_(aNode);
  35258. } else {
  35259. return self._visit_(aNode);
  35260. };
  35261. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  35262. },
  35263. args: ["aNode"],
  35264. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  35265. referencedClasses: [],
  35266. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  35267. }),
  35268. $globals.IRASTTranslator);
  35269. $core.addMethod(
  35270. $core.method({
  35271. selector: "visitReturnNode:",
  35272. protocol: 'visiting',
  35273. fn: function (aNode){
  35274. var self=this;
  35275. var return_;
  35276. function $IRNonLocalReturn(){return $globals.IRNonLocalReturn||(typeof IRNonLocalReturn=="undefined"?nil:IRNonLocalReturn)}
  35277. function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  35278. return $core.withContext(function($ctx1) {
  35279. var $1;
  35280. $1=$recv(aNode)._nonLocalReturn();
  35281. if($core.assert($1)){
  35282. return_=$recv($IRNonLocalReturn())._new();
  35283. $ctx1.sendIdx["new"]=1;
  35284. } else {
  35285. return_=$recv($IRReturn())._new();
  35286. };
  35287. $recv(return_)._scope_($recv(aNode)._scope());
  35288. $recv($recv(aNode)._nodes())._do_((function(each){
  35289. return $core.withContext(function($ctx2) {
  35290. return $recv(return_)._add_(self._visitOrAlias_(each));
  35291. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  35292. }));
  35293. return return_;
  35294. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  35295. },
  35296. args: ["aNode"],
  35297. source: "visitReturnNode: aNode\x0a\x09| return |\x0a\x09return := aNode nonLocalReturn\x0a\x09\x09ifTrue: [ IRNonLocalReturn new ]\x0a\x09\x09ifFalse: [ IRReturn new ].\x0a\x09return scope: aNode scope.\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09return add: (self visitOrAlias: each) ].\x0a\x09^ return",
  35298. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  35299. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "nodes", "add:", "visitOrAlias:"]
  35300. }),
  35301. $globals.IRASTTranslator);
  35302. $core.addMethod(
  35303. $core.method({
  35304. selector: "visitSendNode:",
  35305. protocol: 'visiting',
  35306. fn: function (aNode){
  35307. var self=this;
  35308. var send;
  35309. function $IRSend(){return $globals.IRSend||(typeof IRSend=="undefined"?nil:IRSend)}
  35310. return $core.withContext(function($ctx1) {
  35311. var $1;
  35312. send=$recv($IRSend())._new();
  35313. $1=send;
  35314. $recv($1)._selector_($recv(aNode)._selector());
  35315. $recv($1)._index_($recv(aNode)._index());
  35316. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  35317. return $core.withContext(function($ctx2) {
  35318. return $recv(send)._add_(each);
  35319. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35320. }));
  35321. return send;
  35322. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send},$globals.IRASTTranslator)});
  35323. },
  35324. args: ["aNode"],
  35325. source: "visitSendNode: aNode\x0a\x09| send |\x0a\x09send := IRSend new.\x0a\x09send\x0a\x09\x09selector: aNode selector;\x0a\x09\x09index: aNode index.\x0a\x09\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | send add: each ].\x0a\x0a\x09^ send",
  35326. referencedClasses: ["IRSend"],
  35327. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "nodes", "add:"]
  35328. }),
  35329. $globals.IRASTTranslator);
  35330. $core.addMethod(
  35331. $core.method({
  35332. selector: "visitSequenceNode:",
  35333. protocol: 'visiting',
  35334. fn: function (aNode){
  35335. var self=this;
  35336. function $IRSequence(){return $globals.IRSequence||(typeof IRSequence=="undefined"?nil:IRSequence)}
  35337. return $core.withContext(function($ctx1) {
  35338. var $1;
  35339. return self._withSequence_do_($recv($IRSequence())._new(),(function(){
  35340. return $core.withContext(function($ctx2) {
  35341. return $recv($recv(aNode)._nodes())._do_((function(each){
  35342. var instruction;
  35343. return $core.withContext(function($ctx3) {
  35344. instruction=self._visitOrAlias_(each);
  35345. instruction;
  35346. $1=$recv(instruction)._isVariable();
  35347. if(!$core.assert($1)){
  35348. return $recv(self._sequence())._add_(instruction);
  35349. };
  35350. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)});
  35351. }));
  35352. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35353. }));
  35354. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35355. },
  35356. args: ["aNode"],
  35357. 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 ] ]]",
  35358. referencedClasses: ["IRSequence"],
  35359. messageSends: ["withSequence:do:", "new", "do:", "nodes", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"]
  35360. }),
  35361. $globals.IRASTTranslator);
  35362. $core.addMethod(
  35363. $core.method({
  35364. selector: "visitValueNode:",
  35365. protocol: 'visiting',
  35366. fn: function (aNode){
  35367. var self=this;
  35368. function $IRValue(){return $globals.IRValue||(typeof IRValue=="undefined"?nil:IRValue)}
  35369. return $core.withContext(function($ctx1) {
  35370. var $1;
  35371. $1=$recv($IRValue())._new();
  35372. $recv($1)._value_($recv(aNode)._value());
  35373. return $recv($1)._yourself();
  35374. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35375. },
  35376. args: ["aNode"],
  35377. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  35378. referencedClasses: ["IRValue"],
  35379. messageSends: ["value:", "new", "value", "yourself"]
  35380. }),
  35381. $globals.IRASTTranslator);
  35382. $core.addMethod(
  35383. $core.method({
  35384. selector: "visitVariableNode:",
  35385. protocol: 'visiting',
  35386. fn: function (aNode){
  35387. var self=this;
  35388. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  35389. return $core.withContext(function($ctx1) {
  35390. var $1;
  35391. $1=$recv($IRVariable())._new();
  35392. $recv($1)._variable_($recv(aNode)._binding());
  35393. return $recv($1)._yourself();
  35394. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35395. },
  35396. args: ["aNode"],
  35397. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  35398. referencedClasses: ["IRVariable"],
  35399. messageSends: ["variable:", "new", "binding", "yourself"]
  35400. }),
  35401. $globals.IRASTTranslator);
  35402. $core.addMethod(
  35403. $core.method({
  35404. selector: "withSequence:do:",
  35405. protocol: 'accessing',
  35406. fn: function (aSequence,aBlock){
  35407. var self=this;
  35408. var outerSequence;
  35409. return $core.withContext(function($ctx1) {
  35410. outerSequence=self._sequence();
  35411. self._sequence_(aSequence);
  35412. $ctx1.sendIdx["sequence:"]=1;
  35413. $recv(aBlock)._value();
  35414. self._sequence_(outerSequence);
  35415. return aSequence;
  35416. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  35417. },
  35418. args: ["aSequence", "aBlock"],
  35419. 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",
  35420. referencedClasses: [],
  35421. messageSends: ["sequence", "sequence:", "value"]
  35422. }),
  35423. $globals.IRASTTranslator);
  35424. $core.addClass('IRInstruction', $globals.Object, ['parent', 'instructions'], 'Compiler-IR');
  35425. $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.";
  35426. $core.addMethod(
  35427. $core.method({
  35428. selector: "accept:",
  35429. protocol: 'visiting',
  35430. fn: function (aVisitor){
  35431. var self=this;
  35432. return $core.withContext(function($ctx1) {
  35433. return $recv(aVisitor)._visitIRInstruction_(self);
  35434. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInstruction)});
  35435. },
  35436. args: ["aVisitor"],
  35437. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
  35438. referencedClasses: [],
  35439. messageSends: ["visitIRInstruction:"]
  35440. }),
  35441. $globals.IRInstruction);
  35442. $core.addMethod(
  35443. $core.method({
  35444. selector: "add:",
  35445. protocol: 'building',
  35446. fn: function (anObject){
  35447. var self=this;
  35448. return $core.withContext(function($ctx1) {
  35449. $recv(anObject)._parent_(self);
  35450. return $recv(self._instructions())._add_(anObject);
  35451. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  35452. },
  35453. args: ["anObject"],
  35454. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
  35455. referencedClasses: [],
  35456. messageSends: ["parent:", "add:", "instructions"]
  35457. }),
  35458. $globals.IRInstruction);
  35459. $core.addMethod(
  35460. $core.method({
  35461. selector: "canBeAssigned",
  35462. protocol: 'testing',
  35463. fn: function (){
  35464. var self=this;
  35465. return true;
  35466. },
  35467. args: [],
  35468. source: "canBeAssigned\x0a\x09^ true",
  35469. referencedClasses: [],
  35470. messageSends: []
  35471. }),
  35472. $globals.IRInstruction);
  35473. $core.addMethod(
  35474. $core.method({
  35475. selector: "instructions",
  35476. protocol: 'accessing',
  35477. fn: function (){
  35478. var self=this;
  35479. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  35480. return $core.withContext(function($ctx1) {
  35481. var $1,$receiver;
  35482. $1=self["@instructions"];
  35483. if(($receiver = $1) == null || $receiver.isNil){
  35484. self["@instructions"]=$recv($OrderedCollection())._new();
  35485. return self["@instructions"];
  35486. } else {
  35487. return $1;
  35488. };
  35489. }, function($ctx1) {$ctx1.fill(self,"instructions",{},$globals.IRInstruction)});
  35490. },
  35491. args: [],
  35492. source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
  35493. referencedClasses: ["OrderedCollection"],
  35494. messageSends: ["ifNil:", "new"]
  35495. }),
  35496. $globals.IRInstruction);
  35497. $core.addMethod(
  35498. $core.method({
  35499. selector: "isClosure",
  35500. protocol: 'testing',
  35501. fn: function (){
  35502. var self=this;
  35503. return false;
  35504. },
  35505. args: [],
  35506. source: "isClosure\x0a\x09^ false",
  35507. referencedClasses: [],
  35508. messageSends: []
  35509. }),
  35510. $globals.IRInstruction);
  35511. $core.addMethod(
  35512. $core.method({
  35513. selector: "isInlined",
  35514. protocol: 'testing',
  35515. fn: function (){
  35516. var self=this;
  35517. return false;
  35518. },
  35519. args: [],
  35520. source: "isInlined\x0a\x09^ false",
  35521. referencedClasses: [],
  35522. messageSends: []
  35523. }),
  35524. $globals.IRInstruction);
  35525. $core.addMethod(
  35526. $core.method({
  35527. selector: "isLocalReturn",
  35528. protocol: 'testing',
  35529. fn: function (){
  35530. var self=this;
  35531. return false;
  35532. },
  35533. args: [],
  35534. source: "isLocalReturn\x0a\x09^ false",
  35535. referencedClasses: [],
  35536. messageSends: []
  35537. }),
  35538. $globals.IRInstruction);
  35539. $core.addMethod(
  35540. $core.method({
  35541. selector: "isMethod",
  35542. protocol: 'testing',
  35543. fn: function (){
  35544. var self=this;
  35545. return false;
  35546. },
  35547. args: [],
  35548. source: "isMethod\x0a\x09^ false",
  35549. referencedClasses: [],
  35550. messageSends: []
  35551. }),
  35552. $globals.IRInstruction);
  35553. $core.addMethod(
  35554. $core.method({
  35555. selector: "isReturn",
  35556. protocol: 'testing',
  35557. fn: function (){
  35558. var self=this;
  35559. return false;
  35560. },
  35561. args: [],
  35562. source: "isReturn\x0a\x09^ false",
  35563. referencedClasses: [],
  35564. messageSends: []
  35565. }),
  35566. $globals.IRInstruction);
  35567. $core.addMethod(
  35568. $core.method({
  35569. selector: "isSend",
  35570. protocol: 'testing',
  35571. fn: function (){
  35572. var self=this;
  35573. return false;
  35574. },
  35575. args: [],
  35576. source: "isSend\x0a\x09^ false",
  35577. referencedClasses: [],
  35578. messageSends: []
  35579. }),
  35580. $globals.IRInstruction);
  35581. $core.addMethod(
  35582. $core.method({
  35583. selector: "isSequence",
  35584. protocol: 'testing',
  35585. fn: function (){
  35586. var self=this;
  35587. return false;
  35588. },
  35589. args: [],
  35590. source: "isSequence\x0a\x09^ false",
  35591. referencedClasses: [],
  35592. messageSends: []
  35593. }),
  35594. $globals.IRInstruction);
  35595. $core.addMethod(
  35596. $core.method({
  35597. selector: "isTempDeclaration",
  35598. protocol: 'testing',
  35599. fn: function (){
  35600. var self=this;
  35601. return false;
  35602. },
  35603. args: [],
  35604. source: "isTempDeclaration\x0a\x09^ false",
  35605. referencedClasses: [],
  35606. messageSends: []
  35607. }),
  35608. $globals.IRInstruction);
  35609. $core.addMethod(
  35610. $core.method({
  35611. selector: "isVariable",
  35612. protocol: 'testing',
  35613. fn: function (){
  35614. var self=this;
  35615. return false;
  35616. },
  35617. args: [],
  35618. source: "isVariable\x0a\x09^ false",
  35619. referencedClasses: [],
  35620. messageSends: []
  35621. }),
  35622. $globals.IRInstruction);
  35623. $core.addMethod(
  35624. $core.method({
  35625. selector: "method",
  35626. protocol: 'accessing',
  35627. fn: function (){
  35628. var self=this;
  35629. return $core.withContext(function($ctx1) {
  35630. return $recv(self._parent())._method();
  35631. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  35632. },
  35633. args: [],
  35634. source: "method\x0a\x09^ self parent method",
  35635. referencedClasses: [],
  35636. messageSends: ["method", "parent"]
  35637. }),
  35638. $globals.IRInstruction);
  35639. $core.addMethod(
  35640. $core.method({
  35641. selector: "needsBoxingAsReceiver",
  35642. protocol: 'testing',
  35643. fn: function (){
  35644. var self=this;
  35645. return true;
  35646. },
  35647. args: [],
  35648. source: "needsBoxingAsReceiver\x0a\x09^ true",
  35649. referencedClasses: [],
  35650. messageSends: []
  35651. }),
  35652. $globals.IRInstruction);
  35653. $core.addMethod(
  35654. $core.method({
  35655. selector: "parent",
  35656. protocol: 'accessing',
  35657. fn: function (){
  35658. var self=this;
  35659. return self["@parent"];
  35660. },
  35661. args: [],
  35662. source: "parent\x0a\x09^ parent",
  35663. referencedClasses: [],
  35664. messageSends: []
  35665. }),
  35666. $globals.IRInstruction);
  35667. $core.addMethod(
  35668. $core.method({
  35669. selector: "parent:",
  35670. protocol: 'accessing',
  35671. fn: function (anIRInstruction){
  35672. var self=this;
  35673. self["@parent"]=anIRInstruction;
  35674. return self;
  35675. },
  35676. args: ["anIRInstruction"],
  35677. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  35678. referencedClasses: [],
  35679. messageSends: []
  35680. }),
  35681. $globals.IRInstruction);
  35682. $core.addMethod(
  35683. $core.method({
  35684. selector: "remove",
  35685. protocol: 'building',
  35686. fn: function (){
  35687. var self=this;
  35688. return $core.withContext(function($ctx1) {
  35689. $recv(self._parent())._remove_(self);
  35690. return self;
  35691. }, function($ctx1) {$ctx1.fill(self,"remove",{},$globals.IRInstruction)});
  35692. },
  35693. args: [],
  35694. source: "remove\x0a\x09self parent remove: self",
  35695. referencedClasses: [],
  35696. messageSends: ["remove:", "parent"]
  35697. }),
  35698. $globals.IRInstruction);
  35699. $core.addMethod(
  35700. $core.method({
  35701. selector: "remove:",
  35702. protocol: 'building',
  35703. fn: function (anIRInstruction){
  35704. var self=this;
  35705. return $core.withContext(function($ctx1) {
  35706. $recv(self._instructions())._remove_(anIRInstruction);
  35707. return self;
  35708. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  35709. },
  35710. args: ["anIRInstruction"],
  35711. source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
  35712. referencedClasses: [],
  35713. messageSends: ["remove:", "instructions"]
  35714. }),
  35715. $globals.IRInstruction);
  35716. $core.addMethod(
  35717. $core.method({
  35718. selector: "replace:with:",
  35719. protocol: 'building',
  35720. fn: function (anIRInstruction,anotherIRInstruction){
  35721. var self=this;
  35722. return $core.withContext(function($ctx1) {
  35723. var $1;
  35724. $recv(anotherIRInstruction)._parent_(self);
  35725. $1=self._instructions();
  35726. $ctx1.sendIdx["instructions"]=1;
  35727. $recv($1)._at_put_($recv(self._instructions())._indexOf_(anIRInstruction),anotherIRInstruction);
  35728. return self;
  35729. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  35730. },
  35731. args: ["anIRInstruction", "anotherIRInstruction"],
  35732. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions\x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  35733. referencedClasses: [],
  35734. messageSends: ["parent:", "at:put:", "instructions", "indexOf:"]
  35735. }),
  35736. $globals.IRInstruction);
  35737. $core.addMethod(
  35738. $core.method({
  35739. selector: "replaceWith:",
  35740. protocol: 'building',
  35741. fn: function (anIRInstruction){
  35742. var self=this;
  35743. return $core.withContext(function($ctx1) {
  35744. $recv(self._parent())._replace_with_(self,anIRInstruction);
  35745. return self;
  35746. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  35747. },
  35748. args: ["anIRInstruction"],
  35749. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  35750. referencedClasses: [],
  35751. messageSends: ["replace:with:", "parent"]
  35752. }),
  35753. $globals.IRInstruction);
  35754. $core.addMethod(
  35755. $core.method({
  35756. selector: "scope",
  35757. protocol: 'accessing',
  35758. fn: function (){
  35759. var self=this;
  35760. return $core.withContext(function($ctx1) {
  35761. var $1,$receiver;
  35762. $1=self._parent();
  35763. if(($receiver = $1) == null || $receiver.isNil){
  35764. return $1;
  35765. } else {
  35766. var node;
  35767. node=$receiver;
  35768. return $recv(node)._scope();
  35769. };
  35770. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  35771. },
  35772. args: [],
  35773. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  35774. referencedClasses: [],
  35775. messageSends: ["ifNotNil:", "parent", "scope"]
  35776. }),
  35777. $globals.IRInstruction);
  35778. $core.addMethod(
  35779. $core.method({
  35780. selector: "on:",
  35781. protocol: 'instance creation',
  35782. fn: function (aBuilder){
  35783. var self=this;
  35784. return $core.withContext(function($ctx1) {
  35785. var $1;
  35786. $1=self._new();
  35787. $recv($1)._builder_(aBuilder);
  35788. return $recv($1)._yourself();
  35789. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.klass)});
  35790. },
  35791. args: ["aBuilder"],
  35792. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  35793. referencedClasses: [],
  35794. messageSends: ["builder:", "new", "yourself"]
  35795. }),
  35796. $globals.IRInstruction.klass);
  35797. $core.addClass('IRAssignment', $globals.IRInstruction, [], 'Compiler-IR');
  35798. $core.addMethod(
  35799. $core.method({
  35800. selector: "accept:",
  35801. protocol: 'visiting',
  35802. fn: function (aVisitor){
  35803. var self=this;
  35804. return $core.withContext(function($ctx1) {
  35805. return $recv(aVisitor)._visitIRAssignment_(self);
  35806. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRAssignment)});
  35807. },
  35808. args: ["aVisitor"],
  35809. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  35810. referencedClasses: [],
  35811. messageSends: ["visitIRAssignment:"]
  35812. }),
  35813. $globals.IRAssignment);
  35814. $core.addClass('IRDynamicArray', $globals.IRInstruction, [], 'Compiler-IR');
  35815. $core.addMethod(
  35816. $core.method({
  35817. selector: "accept:",
  35818. protocol: 'visiting',
  35819. fn: function (aVisitor){
  35820. var self=this;
  35821. return $core.withContext(function($ctx1) {
  35822. return $recv(aVisitor)._visitIRDynamicArray_(self);
  35823. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  35824. },
  35825. args: ["aVisitor"],
  35826. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  35827. referencedClasses: [],
  35828. messageSends: ["visitIRDynamicArray:"]
  35829. }),
  35830. $globals.IRDynamicArray);
  35831. $core.addClass('IRDynamicDictionary', $globals.IRInstruction, [], 'Compiler-IR');
  35832. $core.addMethod(
  35833. $core.method({
  35834. selector: "accept:",
  35835. protocol: 'visiting',
  35836. fn: function (aVisitor){
  35837. var self=this;
  35838. return $core.withContext(function($ctx1) {
  35839. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  35840. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  35841. },
  35842. args: ["aVisitor"],
  35843. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  35844. referencedClasses: [],
  35845. messageSends: ["visitIRDynamicDictionary:"]
  35846. }),
  35847. $globals.IRDynamicDictionary);
  35848. $core.addClass('IRScopedInstruction', $globals.IRInstruction, ['scope'], 'Compiler-IR');
  35849. $core.addMethod(
  35850. $core.method({
  35851. selector: "scope",
  35852. protocol: 'accessing',
  35853. fn: function (){
  35854. var self=this;
  35855. return self["@scope"];
  35856. },
  35857. args: [],
  35858. source: "scope\x0a\x09^ scope",
  35859. referencedClasses: [],
  35860. messageSends: []
  35861. }),
  35862. $globals.IRScopedInstruction);
  35863. $core.addMethod(
  35864. $core.method({
  35865. selector: "scope:",
  35866. protocol: 'accessing',
  35867. fn: function (aScope){
  35868. var self=this;
  35869. self["@scope"]=aScope;
  35870. return self;
  35871. },
  35872. args: ["aScope"],
  35873. source: "scope: aScope\x0a\x09scope := aScope",
  35874. referencedClasses: [],
  35875. messageSends: []
  35876. }),
  35877. $globals.IRScopedInstruction);
  35878. $core.addClass('IRClosureInstruction', $globals.IRScopedInstruction, ['arguments', 'requiresSmalltalkContext'], 'Compiler-IR');
  35879. $core.addMethod(
  35880. $core.method({
  35881. selector: "arguments",
  35882. protocol: 'accessing',
  35883. fn: function (){
  35884. var self=this;
  35885. return $core.withContext(function($ctx1) {
  35886. var $1,$receiver;
  35887. $1=self["@arguments"];
  35888. if(($receiver = $1) == null || $receiver.isNil){
  35889. return [];
  35890. } else {
  35891. return $1;
  35892. };
  35893. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  35894. },
  35895. args: [],
  35896. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  35897. referencedClasses: [],
  35898. messageSends: ["ifNil:"]
  35899. }),
  35900. $globals.IRClosureInstruction);
  35901. $core.addMethod(
  35902. $core.method({
  35903. selector: "arguments:",
  35904. protocol: 'accessing',
  35905. fn: function (aCollection){
  35906. var self=this;
  35907. self["@arguments"]=aCollection;
  35908. return self;
  35909. },
  35910. args: ["aCollection"],
  35911. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  35912. referencedClasses: [],
  35913. messageSends: []
  35914. }),
  35915. $globals.IRClosureInstruction);
  35916. $core.addMethod(
  35917. $core.method({
  35918. selector: "locals",
  35919. protocol: 'accessing',
  35920. fn: function (){
  35921. var self=this;
  35922. return $core.withContext(function($ctx1) {
  35923. var $1;
  35924. $1=$recv(self._arguments())._copy();
  35925. $recv($1)._addAll_($recv(self._tempDeclarations())._collect_((function(each){
  35926. return $core.withContext(function($ctx2) {
  35927. return $recv(each)._name();
  35928. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35929. })));
  35930. return $recv($1)._yourself();
  35931. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  35932. },
  35933. args: [],
  35934. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  35935. referencedClasses: [],
  35936. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  35937. }),
  35938. $globals.IRClosureInstruction);
  35939. $core.addMethod(
  35940. $core.method({
  35941. selector: "requiresSmalltalkContext",
  35942. protocol: 'accessing',
  35943. fn: function (){
  35944. var self=this;
  35945. return $core.withContext(function($ctx1) {
  35946. var $1,$receiver;
  35947. $1=self["@requiresSmalltalkContext"];
  35948. if(($receiver = $1) == null || $receiver.isNil){
  35949. return false;
  35950. } else {
  35951. return $1;
  35952. };
  35953. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  35954. },
  35955. args: [],
  35956. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  35957. referencedClasses: [],
  35958. messageSends: ["ifNil:"]
  35959. }),
  35960. $globals.IRClosureInstruction);
  35961. $core.addMethod(
  35962. $core.method({
  35963. selector: "requiresSmalltalkContext:",
  35964. protocol: 'accessing',
  35965. fn: function (anObject){
  35966. var self=this;
  35967. self["@requiresSmalltalkContext"]=anObject;
  35968. return self;
  35969. },
  35970. args: ["anObject"],
  35971. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  35972. referencedClasses: [],
  35973. messageSends: []
  35974. }),
  35975. $globals.IRClosureInstruction);
  35976. $core.addMethod(
  35977. $core.method({
  35978. selector: "scope:",
  35979. protocol: 'accessing',
  35980. fn: function (aScope){
  35981. var self=this;
  35982. return $core.withContext(function($ctx1) {
  35983. (
  35984. $ctx1.supercall = true,
  35985. ($globals.IRClosureInstruction.superclass||$boot.dnu).fn.prototype._scope_.apply($recv(self), [aScope]));
  35986. $ctx1.supercall = false;
  35987. $recv(aScope)._instruction_(self);
  35988. return self;
  35989. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  35990. },
  35991. args: ["aScope"],
  35992. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  35993. referencedClasses: [],
  35994. messageSends: ["scope:", "instruction:"]
  35995. }),
  35996. $globals.IRClosureInstruction);
  35997. $core.addMethod(
  35998. $core.method({
  35999. selector: "tempDeclarations",
  36000. protocol: 'accessing',
  36001. fn: function (){
  36002. var self=this;
  36003. return $core.withContext(function($ctx1) {
  36004. return $recv(self._instructions())._select_((function(each){
  36005. return $core.withContext(function($ctx2) {
  36006. return $recv(each)._isTempDeclaration();
  36007. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36008. }));
  36009. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  36010. },
  36011. args: [],
  36012. source: "tempDeclarations\x0a\x09^ self instructions select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  36013. referencedClasses: [],
  36014. messageSends: ["select:", "instructions", "isTempDeclaration"]
  36015. }),
  36016. $globals.IRClosureInstruction);
  36017. $core.addClass('IRClosure', $globals.IRClosureInstruction, [], 'Compiler-IR');
  36018. $core.addMethod(
  36019. $core.method({
  36020. selector: "accept:",
  36021. protocol: 'visiting',
  36022. fn: function (aVisitor){
  36023. var self=this;
  36024. return $core.withContext(function($ctx1) {
  36025. return $recv(aVisitor)._visitIRClosure_(self);
  36026. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRClosure)});
  36027. },
  36028. args: ["aVisitor"],
  36029. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  36030. referencedClasses: [],
  36031. messageSends: ["visitIRClosure:"]
  36032. }),
  36033. $globals.IRClosure);
  36034. $core.addMethod(
  36035. $core.method({
  36036. selector: "isClosure",
  36037. protocol: 'testing',
  36038. fn: function (){
  36039. var self=this;
  36040. return true;
  36041. },
  36042. args: [],
  36043. source: "isClosure\x0a\x09^ true",
  36044. referencedClasses: [],
  36045. messageSends: []
  36046. }),
  36047. $globals.IRClosure);
  36048. $core.addMethod(
  36049. $core.method({
  36050. selector: "sequence",
  36051. protocol: 'accessing',
  36052. fn: function (){
  36053. var self=this;
  36054. return $core.withContext(function($ctx1) {
  36055. return $recv(self._instructions())._last();
  36056. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  36057. },
  36058. args: [],
  36059. source: "sequence\x0a\x09^ self instructions last",
  36060. referencedClasses: [],
  36061. messageSends: ["last", "instructions"]
  36062. }),
  36063. $globals.IRClosure);
  36064. $core.addClass('IRMethod', $globals.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'sendIndexes', 'requiresSmalltalkContext', 'internalVariables'], 'Compiler-IR');
  36065. $globals.IRMethod.comment="I am a method instruction";
  36066. $core.addMethod(
  36067. $core.method({
  36068. selector: "accept:",
  36069. protocol: 'visiting',
  36070. fn: function (aVisitor){
  36071. var self=this;
  36072. return $core.withContext(function($ctx1) {
  36073. return $recv(aVisitor)._visitIRMethod_(self);
  36074. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRMethod)});
  36075. },
  36076. args: ["aVisitor"],
  36077. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  36078. referencedClasses: [],
  36079. messageSends: ["visitIRMethod:"]
  36080. }),
  36081. $globals.IRMethod);
  36082. $core.addMethod(
  36083. $core.method({
  36084. selector: "classReferences",
  36085. protocol: 'accessing',
  36086. fn: function (){
  36087. var self=this;
  36088. return self["@classReferences"];
  36089. },
  36090. args: [],
  36091. source: "classReferences\x0a\x09^ classReferences",
  36092. referencedClasses: [],
  36093. messageSends: []
  36094. }),
  36095. $globals.IRMethod);
  36096. $core.addMethod(
  36097. $core.method({
  36098. selector: "classReferences:",
  36099. protocol: 'accessing',
  36100. fn: function (aCollection){
  36101. var self=this;
  36102. self["@classReferences"]=aCollection;
  36103. return self;
  36104. },
  36105. args: ["aCollection"],
  36106. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  36107. referencedClasses: [],
  36108. messageSends: []
  36109. }),
  36110. $globals.IRMethod);
  36111. $core.addMethod(
  36112. $core.method({
  36113. selector: "internalVariables",
  36114. protocol: 'accessing',
  36115. fn: function (){
  36116. var self=this;
  36117. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  36118. return $core.withContext(function($ctx1) {
  36119. var $1,$receiver;
  36120. $1=self["@internalVariables"];
  36121. if(($receiver = $1) == null || $receiver.isNil){
  36122. self["@internalVariables"]=$recv($Set())._new();
  36123. return self["@internalVariables"];
  36124. } else {
  36125. return $1;
  36126. };
  36127. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  36128. },
  36129. args: [],
  36130. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  36131. referencedClasses: ["Set"],
  36132. messageSends: ["ifNil:", "new"]
  36133. }),
  36134. $globals.IRMethod);
  36135. $core.addMethod(
  36136. $core.method({
  36137. selector: "isMethod",
  36138. protocol: 'accessing',
  36139. fn: function (){
  36140. var self=this;
  36141. return true;
  36142. },
  36143. args: [],
  36144. source: "isMethod\x0a\x09^ true",
  36145. referencedClasses: [],
  36146. messageSends: []
  36147. }),
  36148. $globals.IRMethod);
  36149. $core.addMethod(
  36150. $core.method({
  36151. selector: "messageSends",
  36152. protocol: 'accessing',
  36153. fn: function (){
  36154. var self=this;
  36155. return $core.withContext(function($ctx1) {
  36156. return $recv(self._sendIndexes())._keys();
  36157. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  36158. },
  36159. args: [],
  36160. source: "messageSends\x0a\x09^ self sendIndexes keys",
  36161. referencedClasses: [],
  36162. messageSends: ["keys", "sendIndexes"]
  36163. }),
  36164. $globals.IRMethod);
  36165. $core.addMethod(
  36166. $core.method({
  36167. selector: "method",
  36168. protocol: 'accessing',
  36169. fn: function (){
  36170. var self=this;
  36171. return self;
  36172. },
  36173. args: [],
  36174. source: "method\x0a\x09^ self",
  36175. referencedClasses: [],
  36176. messageSends: []
  36177. }),
  36178. $globals.IRMethod);
  36179. $core.addMethod(
  36180. $core.method({
  36181. selector: "selector",
  36182. protocol: 'accessing',
  36183. fn: function (){
  36184. var self=this;
  36185. return self["@selector"];
  36186. },
  36187. args: [],
  36188. source: "selector\x0a\x09^ selector",
  36189. referencedClasses: [],
  36190. messageSends: []
  36191. }),
  36192. $globals.IRMethod);
  36193. $core.addMethod(
  36194. $core.method({
  36195. selector: "selector:",
  36196. protocol: 'accessing',
  36197. fn: function (aString){
  36198. var self=this;
  36199. self["@selector"]=aString;
  36200. return self;
  36201. },
  36202. args: ["aString"],
  36203. source: "selector: aString\x0a\x09selector := aString",
  36204. referencedClasses: [],
  36205. messageSends: []
  36206. }),
  36207. $globals.IRMethod);
  36208. $core.addMethod(
  36209. $core.method({
  36210. selector: "sendIndexes",
  36211. protocol: 'accessing',
  36212. fn: function (){
  36213. var self=this;
  36214. return self["@sendIndexes"];
  36215. },
  36216. args: [],
  36217. source: "sendIndexes\x0a\x09^ sendIndexes",
  36218. referencedClasses: [],
  36219. messageSends: []
  36220. }),
  36221. $globals.IRMethod);
  36222. $core.addMethod(
  36223. $core.method({
  36224. selector: "sendIndexes:",
  36225. protocol: 'accessing',
  36226. fn: function (aDictionary){
  36227. var self=this;
  36228. self["@sendIndexes"]=aDictionary;
  36229. return self;
  36230. },
  36231. args: ["aDictionary"],
  36232. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  36233. referencedClasses: [],
  36234. messageSends: []
  36235. }),
  36236. $globals.IRMethod);
  36237. $core.addMethod(
  36238. $core.method({
  36239. selector: "source",
  36240. protocol: 'accessing',
  36241. fn: function (){
  36242. var self=this;
  36243. return self["@source"];
  36244. },
  36245. args: [],
  36246. source: "source\x0a\x09^ source",
  36247. referencedClasses: [],
  36248. messageSends: []
  36249. }),
  36250. $globals.IRMethod);
  36251. $core.addMethod(
  36252. $core.method({
  36253. selector: "source:",
  36254. protocol: 'accessing',
  36255. fn: function (aString){
  36256. var self=this;
  36257. self["@source"]=aString;
  36258. return self;
  36259. },
  36260. args: ["aString"],
  36261. source: "source: aString\x0a\x09source := aString",
  36262. referencedClasses: [],
  36263. messageSends: []
  36264. }),
  36265. $globals.IRMethod);
  36266. $core.addMethod(
  36267. $core.method({
  36268. selector: "theClass",
  36269. protocol: 'accessing',
  36270. fn: function (){
  36271. var self=this;
  36272. return self["@theClass"];
  36273. },
  36274. args: [],
  36275. source: "theClass\x0a\x09^ theClass",
  36276. referencedClasses: [],
  36277. messageSends: []
  36278. }),
  36279. $globals.IRMethod);
  36280. $core.addMethod(
  36281. $core.method({
  36282. selector: "theClass:",
  36283. protocol: 'accessing',
  36284. fn: function (aClass){
  36285. var self=this;
  36286. self["@theClass"]=aClass;
  36287. return self;
  36288. },
  36289. args: ["aClass"],
  36290. source: "theClass: aClass\x0a\x09theClass := aClass",
  36291. referencedClasses: [],
  36292. messageSends: []
  36293. }),
  36294. $globals.IRMethod);
  36295. $core.addClass('IRReturn', $globals.IRScopedInstruction, [], 'Compiler-IR');
  36296. $globals.IRReturn.comment="I am a local return instruction.";
  36297. $core.addMethod(
  36298. $core.method({
  36299. selector: "accept:",
  36300. protocol: 'visiting',
  36301. fn: function (aVisitor){
  36302. var self=this;
  36303. return $core.withContext(function($ctx1) {
  36304. return $recv(aVisitor)._visitIRReturn_(self);
  36305. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRReturn)});
  36306. },
  36307. args: ["aVisitor"],
  36308. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  36309. referencedClasses: [],
  36310. messageSends: ["visitIRReturn:"]
  36311. }),
  36312. $globals.IRReturn);
  36313. $core.addMethod(
  36314. $core.method({
  36315. selector: "canBeAssigned",
  36316. protocol: 'testing',
  36317. fn: function (){
  36318. var self=this;
  36319. return false;
  36320. },
  36321. args: [],
  36322. source: "canBeAssigned\x0a\x09^ false",
  36323. referencedClasses: [],
  36324. messageSends: []
  36325. }),
  36326. $globals.IRReturn);
  36327. $core.addMethod(
  36328. $core.method({
  36329. selector: "isBlockReturn",
  36330. protocol: 'testing',
  36331. fn: function (){
  36332. var self=this;
  36333. return false;
  36334. },
  36335. args: [],
  36336. source: "isBlockReturn\x0a\x09^ false",
  36337. referencedClasses: [],
  36338. messageSends: []
  36339. }),
  36340. $globals.IRReturn);
  36341. $core.addMethod(
  36342. $core.method({
  36343. selector: "isLocalReturn",
  36344. protocol: 'testing',
  36345. fn: function (){
  36346. var self=this;
  36347. return true;
  36348. },
  36349. args: [],
  36350. source: "isLocalReturn\x0a\x09^ true",
  36351. referencedClasses: [],
  36352. messageSends: []
  36353. }),
  36354. $globals.IRReturn);
  36355. $core.addMethod(
  36356. $core.method({
  36357. selector: "isNonLocalReturn",
  36358. protocol: 'testing',
  36359. fn: function (){
  36360. var self=this;
  36361. return $core.withContext(function($ctx1) {
  36362. return $recv(self._isLocalReturn())._not();
  36363. }, function($ctx1) {$ctx1.fill(self,"isNonLocalReturn",{},$globals.IRReturn)});
  36364. },
  36365. args: [],
  36366. source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
  36367. referencedClasses: [],
  36368. messageSends: ["not", "isLocalReturn"]
  36369. }),
  36370. $globals.IRReturn);
  36371. $core.addMethod(
  36372. $core.method({
  36373. selector: "isReturn",
  36374. protocol: 'testing',
  36375. fn: function (){
  36376. var self=this;
  36377. return true;
  36378. },
  36379. args: [],
  36380. source: "isReturn\x0a\x09^ true",
  36381. referencedClasses: [],
  36382. messageSends: []
  36383. }),
  36384. $globals.IRReturn);
  36385. $core.addMethod(
  36386. $core.method({
  36387. selector: "scope",
  36388. protocol: 'accessing',
  36389. fn: function (){
  36390. var self=this;
  36391. return $core.withContext(function($ctx1) {
  36392. var $1,$receiver;
  36393. $1=self["@scope"];
  36394. if(($receiver = $1) == null || $receiver.isNil){
  36395. return $recv(self._parent())._scope();
  36396. } else {
  36397. return $1;
  36398. };
  36399. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  36400. },
  36401. args: [],
  36402. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  36403. referencedClasses: [],
  36404. messageSends: ["ifNil:", "scope", "parent"]
  36405. }),
  36406. $globals.IRReturn);
  36407. $core.addClass('IRBlockReturn', $globals.IRReturn, [], 'Compiler-IR');
  36408. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  36409. $core.addMethod(
  36410. $core.method({
  36411. selector: "accept:",
  36412. protocol: 'visiting',
  36413. fn: function (aVisitor){
  36414. var self=this;
  36415. return $core.withContext(function($ctx1) {
  36416. return $recv(aVisitor)._visitIRBlockReturn_(self);
  36417. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  36418. },
  36419. args: ["aVisitor"],
  36420. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  36421. referencedClasses: [],
  36422. messageSends: ["visitIRBlockReturn:"]
  36423. }),
  36424. $globals.IRBlockReturn);
  36425. $core.addMethod(
  36426. $core.method({
  36427. selector: "isBlockReturn",
  36428. protocol: 'testing',
  36429. fn: function (){
  36430. var self=this;
  36431. return true;
  36432. },
  36433. args: [],
  36434. source: "isBlockReturn\x0a\x09^ true",
  36435. referencedClasses: [],
  36436. messageSends: []
  36437. }),
  36438. $globals.IRBlockReturn);
  36439. $core.addClass('IRNonLocalReturn', $globals.IRReturn, [], 'Compiler-IR');
  36440. $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.";
  36441. $core.addMethod(
  36442. $core.method({
  36443. selector: "accept:",
  36444. protocol: 'visiting',
  36445. fn: function (aVisitor){
  36446. var self=this;
  36447. return $core.withContext(function($ctx1) {
  36448. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  36449. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  36450. },
  36451. args: ["aVisitor"],
  36452. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  36453. referencedClasses: [],
  36454. messageSends: ["visitIRNonLocalReturn:"]
  36455. }),
  36456. $globals.IRNonLocalReturn);
  36457. $core.addMethod(
  36458. $core.method({
  36459. selector: "isLocalReturn",
  36460. protocol: 'testing',
  36461. fn: function (){
  36462. var self=this;
  36463. return false;
  36464. },
  36465. args: [],
  36466. source: "isLocalReturn\x0a\x09^ false",
  36467. referencedClasses: [],
  36468. messageSends: []
  36469. }),
  36470. $globals.IRNonLocalReturn);
  36471. $core.addClass('IRTempDeclaration', $globals.IRScopedInstruction, ['name'], 'Compiler-IR');
  36472. $core.addMethod(
  36473. $core.method({
  36474. selector: "accept:",
  36475. protocol: 'visiting',
  36476. fn: function (aVisitor){
  36477. var self=this;
  36478. return $core.withContext(function($ctx1) {
  36479. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  36480. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  36481. },
  36482. args: ["aVisitor"],
  36483. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  36484. referencedClasses: [],
  36485. messageSends: ["visitIRTempDeclaration:"]
  36486. }),
  36487. $globals.IRTempDeclaration);
  36488. $core.addMethod(
  36489. $core.method({
  36490. selector: "isTempDeclaration",
  36491. protocol: 'testing',
  36492. fn: function (){
  36493. var self=this;
  36494. return true;
  36495. },
  36496. args: [],
  36497. source: "isTempDeclaration\x0a\x09^ true",
  36498. referencedClasses: [],
  36499. messageSends: []
  36500. }),
  36501. $globals.IRTempDeclaration);
  36502. $core.addMethod(
  36503. $core.method({
  36504. selector: "name",
  36505. protocol: 'accessing',
  36506. fn: function (){
  36507. var self=this;
  36508. return self["@name"];
  36509. },
  36510. args: [],
  36511. source: "name\x0a\x09^ name",
  36512. referencedClasses: [],
  36513. messageSends: []
  36514. }),
  36515. $globals.IRTempDeclaration);
  36516. $core.addMethod(
  36517. $core.method({
  36518. selector: "name:",
  36519. protocol: 'accessing',
  36520. fn: function (aString){
  36521. var self=this;
  36522. self["@name"]=aString;
  36523. return self;
  36524. },
  36525. args: ["aString"],
  36526. source: "name: aString\x0a\x09name := aString",
  36527. referencedClasses: [],
  36528. messageSends: []
  36529. }),
  36530. $globals.IRTempDeclaration);
  36531. $core.addClass('IRSend', $globals.IRInstruction, ['selector', 'index'], 'Compiler-IR');
  36532. $globals.IRSend.comment="I am a message send instruction.";
  36533. $core.addMethod(
  36534. $core.method({
  36535. selector: "accept:",
  36536. protocol: 'visiting',
  36537. fn: function (aVisitor){
  36538. var self=this;
  36539. return $core.withContext(function($ctx1) {
  36540. return $recv(aVisitor)._visitIRSend_(self);
  36541. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSend)});
  36542. },
  36543. args: ["aVisitor"],
  36544. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  36545. referencedClasses: [],
  36546. messageSends: ["visitIRSend:"]
  36547. }),
  36548. $globals.IRSend);
  36549. $core.addMethod(
  36550. $core.method({
  36551. selector: "index",
  36552. protocol: 'accessing',
  36553. fn: function (){
  36554. var self=this;
  36555. return self["@index"];
  36556. },
  36557. args: [],
  36558. source: "index\x0a\x09^ index",
  36559. referencedClasses: [],
  36560. messageSends: []
  36561. }),
  36562. $globals.IRSend);
  36563. $core.addMethod(
  36564. $core.method({
  36565. selector: "index:",
  36566. protocol: 'accessing',
  36567. fn: function (anInteger){
  36568. var self=this;
  36569. self["@index"]=anInteger;
  36570. return self;
  36571. },
  36572. args: ["anInteger"],
  36573. source: "index: anInteger\x0a\x09index := anInteger",
  36574. referencedClasses: [],
  36575. messageSends: []
  36576. }),
  36577. $globals.IRSend);
  36578. $core.addMethod(
  36579. $core.method({
  36580. selector: "isSend",
  36581. protocol: 'testing',
  36582. fn: function (){
  36583. var self=this;
  36584. return true;
  36585. },
  36586. args: [],
  36587. source: "isSend\x0a\x09^ true",
  36588. referencedClasses: [],
  36589. messageSends: []
  36590. }),
  36591. $globals.IRSend);
  36592. $core.addMethod(
  36593. $core.method({
  36594. selector: "isSuperSend",
  36595. protocol: 'accessing',
  36596. fn: function (){
  36597. var self=this;
  36598. var receiver;
  36599. return $core.withContext(function($ctx1) {
  36600. receiver=$recv(self._instructions())._first();
  36601. return $recv($recv(receiver)._isVariable())._and_((function(){
  36602. return $core.withContext(function($ctx2) {
  36603. return $recv($recv($recv(receiver)._variable())._name()).__eq("super");
  36604. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36605. }));
  36606. }, function($ctx1) {$ctx1.fill(self,"isSuperSend",{receiver:receiver},$globals.IRSend)});
  36607. },
  36608. args: [],
  36609. source: "isSuperSend\x0a\x09| receiver |\x0a\x09receiver := self instructions first.\x0a\x09^ receiver isVariable and: [ receiver variable name = 'super' ]",
  36610. referencedClasses: [],
  36611. messageSends: ["first", "instructions", "and:", "isVariable", "=", "name", "variable"]
  36612. }),
  36613. $globals.IRSend);
  36614. $core.addMethod(
  36615. $core.method({
  36616. selector: "selector",
  36617. protocol: 'accessing',
  36618. fn: function (){
  36619. var self=this;
  36620. return self["@selector"];
  36621. },
  36622. args: [],
  36623. source: "selector\x0a\x09^ selector",
  36624. referencedClasses: [],
  36625. messageSends: []
  36626. }),
  36627. $globals.IRSend);
  36628. $core.addMethod(
  36629. $core.method({
  36630. selector: "selector:",
  36631. protocol: 'accessing',
  36632. fn: function (aString){
  36633. var self=this;
  36634. self["@selector"]=aString;
  36635. return self;
  36636. },
  36637. args: ["aString"],
  36638. source: "selector: aString\x0a\x09selector := aString",
  36639. referencedClasses: [],
  36640. messageSends: []
  36641. }),
  36642. $globals.IRSend);
  36643. $core.addClass('IRSequence', $globals.IRInstruction, [], 'Compiler-IR');
  36644. $core.addMethod(
  36645. $core.method({
  36646. selector: "accept:",
  36647. protocol: 'visiting',
  36648. fn: function (aVisitor){
  36649. var self=this;
  36650. return $core.withContext(function($ctx1) {
  36651. return $recv(aVisitor)._visitIRSequence_(self);
  36652. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSequence)});
  36653. },
  36654. args: ["aVisitor"],
  36655. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  36656. referencedClasses: [],
  36657. messageSends: ["visitIRSequence:"]
  36658. }),
  36659. $globals.IRSequence);
  36660. $core.addMethod(
  36661. $core.method({
  36662. selector: "isSequence",
  36663. protocol: 'testing',
  36664. fn: function (){
  36665. var self=this;
  36666. return true;
  36667. },
  36668. args: [],
  36669. source: "isSequence\x0a\x09^ true",
  36670. referencedClasses: [],
  36671. messageSends: []
  36672. }),
  36673. $globals.IRSequence);
  36674. $core.addClass('IRBlockSequence', $globals.IRSequence, [], 'Compiler-IR');
  36675. $core.addMethod(
  36676. $core.method({
  36677. selector: "accept:",
  36678. protocol: 'visiting',
  36679. fn: function (aVisitor){
  36680. var self=this;
  36681. return $core.withContext(function($ctx1) {
  36682. return $recv(aVisitor)._visitIRBlockSequence_(self);
  36683. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  36684. },
  36685. args: ["aVisitor"],
  36686. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  36687. referencedClasses: [],
  36688. messageSends: ["visitIRBlockSequence:"]
  36689. }),
  36690. $globals.IRBlockSequence);
  36691. $core.addClass('IRValue', $globals.IRInstruction, ['value'], 'Compiler-IR');
  36692. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  36693. $core.addMethod(
  36694. $core.method({
  36695. selector: "accept:",
  36696. protocol: 'visiting',
  36697. fn: function (aVisitor){
  36698. var self=this;
  36699. return $core.withContext(function($ctx1) {
  36700. return $recv(aVisitor)._visitIRValue_(self);
  36701. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRValue)});
  36702. },
  36703. args: ["aVisitor"],
  36704. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  36705. referencedClasses: [],
  36706. messageSends: ["visitIRValue:"]
  36707. }),
  36708. $globals.IRValue);
  36709. $core.addMethod(
  36710. $core.method({
  36711. selector: "needsBoxingAsReceiver",
  36712. protocol: 'testing',
  36713. fn: function (){
  36714. var self=this;
  36715. return false;
  36716. },
  36717. args: [],
  36718. source: "needsBoxingAsReceiver\x0a\x09^ false",
  36719. referencedClasses: [],
  36720. messageSends: []
  36721. }),
  36722. $globals.IRValue);
  36723. $core.addMethod(
  36724. $core.method({
  36725. selector: "value",
  36726. protocol: 'accessing',
  36727. fn: function (){
  36728. var self=this;
  36729. return self["@value"];
  36730. },
  36731. args: [],
  36732. source: "value\x0a\x09^ value",
  36733. referencedClasses: [],
  36734. messageSends: []
  36735. }),
  36736. $globals.IRValue);
  36737. $core.addMethod(
  36738. $core.method({
  36739. selector: "value:",
  36740. protocol: 'accessing',
  36741. fn: function (aString){
  36742. var self=this;
  36743. self["@value"]=aString;
  36744. return self;
  36745. },
  36746. args: ["aString"],
  36747. source: "value: aString\x0a\x09value := aString",
  36748. referencedClasses: [],
  36749. messageSends: []
  36750. }),
  36751. $globals.IRValue);
  36752. $core.addClass('IRVariable', $globals.IRInstruction, ['variable'], 'Compiler-IR');
  36753. $globals.IRVariable.comment="I am a variable instruction.";
  36754. $core.addMethod(
  36755. $core.method({
  36756. selector: "accept:",
  36757. protocol: 'visiting',
  36758. fn: function (aVisitor){
  36759. var self=this;
  36760. return $core.withContext(function($ctx1) {
  36761. return $recv(aVisitor)._visitIRVariable_(self);
  36762. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVariable)});
  36763. },
  36764. args: ["aVisitor"],
  36765. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  36766. referencedClasses: [],
  36767. messageSends: ["visitIRVariable:"]
  36768. }),
  36769. $globals.IRVariable);
  36770. $core.addMethod(
  36771. $core.method({
  36772. selector: "isVariable",
  36773. protocol: 'testing',
  36774. fn: function (){
  36775. var self=this;
  36776. return true;
  36777. },
  36778. args: [],
  36779. source: "isVariable\x0a\x09^ true",
  36780. referencedClasses: [],
  36781. messageSends: []
  36782. }),
  36783. $globals.IRVariable);
  36784. $core.addMethod(
  36785. $core.method({
  36786. selector: "needsBoxingAsReceiver",
  36787. protocol: 'testing',
  36788. fn: function (){
  36789. var self=this;
  36790. return $core.withContext(function($ctx1) {
  36791. return $recv($recv(self._variable())._isPseudoVar())._not();
  36792. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  36793. },
  36794. args: [],
  36795. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  36796. referencedClasses: [],
  36797. messageSends: ["not", "isPseudoVar", "variable"]
  36798. }),
  36799. $globals.IRVariable);
  36800. $core.addMethod(
  36801. $core.method({
  36802. selector: "variable",
  36803. protocol: 'accessing',
  36804. fn: function (){
  36805. var self=this;
  36806. return self["@variable"];
  36807. },
  36808. args: [],
  36809. source: "variable\x0a\x09^ variable",
  36810. referencedClasses: [],
  36811. messageSends: []
  36812. }),
  36813. $globals.IRVariable);
  36814. $core.addMethod(
  36815. $core.method({
  36816. selector: "variable:",
  36817. protocol: 'accessing',
  36818. fn: function (aScopeVariable){
  36819. var self=this;
  36820. self["@variable"]=aScopeVariable;
  36821. return self;
  36822. },
  36823. args: ["aScopeVariable"],
  36824. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  36825. referencedClasses: [],
  36826. messageSends: []
  36827. }),
  36828. $globals.IRVariable);
  36829. $core.addClass('IRVerbatim', $globals.IRInstruction, ['source'], 'Compiler-IR');
  36830. $core.addMethod(
  36831. $core.method({
  36832. selector: "accept:",
  36833. protocol: 'visiting',
  36834. fn: function (aVisitor){
  36835. var self=this;
  36836. return $core.withContext(function($ctx1) {
  36837. return $recv(aVisitor)._visitIRVerbatim_(self);
  36838. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  36839. },
  36840. args: ["aVisitor"],
  36841. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  36842. referencedClasses: [],
  36843. messageSends: ["visitIRVerbatim:"]
  36844. }),
  36845. $globals.IRVerbatim);
  36846. $core.addMethod(
  36847. $core.method({
  36848. selector: "source",
  36849. protocol: 'accessing',
  36850. fn: function (){
  36851. var self=this;
  36852. return self["@source"];
  36853. },
  36854. args: [],
  36855. source: "source\x0a\x09^ source",
  36856. referencedClasses: [],
  36857. messageSends: []
  36858. }),
  36859. $globals.IRVerbatim);
  36860. $core.addMethod(
  36861. $core.method({
  36862. selector: "source:",
  36863. protocol: 'accessing',
  36864. fn: function (aString){
  36865. var self=this;
  36866. self["@source"]=aString;
  36867. return self;
  36868. },
  36869. args: ["aString"],
  36870. source: "source: aString\x0a\x09source := aString",
  36871. referencedClasses: [],
  36872. messageSends: []
  36873. }),
  36874. $globals.IRVerbatim);
  36875. $core.addClass('IRVisitor', $globals.Object, [], 'Compiler-IR');
  36876. $core.addMethod(
  36877. $core.method({
  36878. selector: "visit:",
  36879. protocol: 'visiting',
  36880. fn: function (anIRInstruction){
  36881. var self=this;
  36882. return $core.withContext(function($ctx1) {
  36883. return $recv(anIRInstruction)._accept_(self);
  36884. }, function($ctx1) {$ctx1.fill(self,"visit:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)});
  36885. },
  36886. args: ["anIRInstruction"],
  36887. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  36888. referencedClasses: [],
  36889. messageSends: ["accept:"]
  36890. }),
  36891. $globals.IRVisitor);
  36892. $core.addMethod(
  36893. $core.method({
  36894. selector: "visitIRAssignment:",
  36895. protocol: 'visiting',
  36896. fn: function (anIRAssignment){
  36897. var self=this;
  36898. return $core.withContext(function($ctx1) {
  36899. return self._visitIRInstruction_(anIRAssignment);
  36900. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  36901. },
  36902. args: ["anIRAssignment"],
  36903. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  36904. referencedClasses: [],
  36905. messageSends: ["visitIRInstruction:"]
  36906. }),
  36907. $globals.IRVisitor);
  36908. $core.addMethod(
  36909. $core.method({
  36910. selector: "visitIRBlockReturn:",
  36911. protocol: 'visiting',
  36912. fn: function (anIRBlockReturn){
  36913. var self=this;
  36914. return $core.withContext(function($ctx1) {
  36915. return self._visitIRReturn_(anIRBlockReturn);
  36916. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  36917. },
  36918. args: ["anIRBlockReturn"],
  36919. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  36920. referencedClasses: [],
  36921. messageSends: ["visitIRReturn:"]
  36922. }),
  36923. $globals.IRVisitor);
  36924. $core.addMethod(
  36925. $core.method({
  36926. selector: "visitIRBlockSequence:",
  36927. protocol: 'visiting',
  36928. fn: function (anIRBlockSequence){
  36929. var self=this;
  36930. return $core.withContext(function($ctx1) {
  36931. return self._visitIRSequence_(anIRBlockSequence);
  36932. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  36933. },
  36934. args: ["anIRBlockSequence"],
  36935. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  36936. referencedClasses: [],
  36937. messageSends: ["visitIRSequence:"]
  36938. }),
  36939. $globals.IRVisitor);
  36940. $core.addMethod(
  36941. $core.method({
  36942. selector: "visitIRClosure:",
  36943. protocol: 'visiting',
  36944. fn: function (anIRClosure){
  36945. var self=this;
  36946. return $core.withContext(function($ctx1) {
  36947. return self._visitIRInstruction_(anIRClosure);
  36948. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  36949. },
  36950. args: ["anIRClosure"],
  36951. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  36952. referencedClasses: [],
  36953. messageSends: ["visitIRInstruction:"]
  36954. }),
  36955. $globals.IRVisitor);
  36956. $core.addMethod(
  36957. $core.method({
  36958. selector: "visitIRDynamicArray:",
  36959. protocol: 'visiting',
  36960. fn: function (anIRDynamicArray){
  36961. var self=this;
  36962. return $core.withContext(function($ctx1) {
  36963. return self._visitIRInstruction_(anIRDynamicArray);
  36964. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  36965. },
  36966. args: ["anIRDynamicArray"],
  36967. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
  36968. referencedClasses: [],
  36969. messageSends: ["visitIRInstruction:"]
  36970. }),
  36971. $globals.IRVisitor);
  36972. $core.addMethod(
  36973. $core.method({
  36974. selector: "visitIRDynamicDictionary:",
  36975. protocol: 'visiting',
  36976. fn: function (anIRDynamicDictionary){
  36977. var self=this;
  36978. return $core.withContext(function($ctx1) {
  36979. return self._visitIRInstruction_(anIRDynamicDictionary);
  36980. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  36981. },
  36982. args: ["anIRDynamicDictionary"],
  36983. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
  36984. referencedClasses: [],
  36985. messageSends: ["visitIRInstruction:"]
  36986. }),
  36987. $globals.IRVisitor);
  36988. $core.addMethod(
  36989. $core.method({
  36990. selector: "visitIRInlinedClosure:",
  36991. protocol: 'visiting',
  36992. fn: function (anIRInlinedClosure){
  36993. var self=this;
  36994. return $core.withContext(function($ctx1) {
  36995. return self._visitIRClosure_(anIRInlinedClosure);
  36996. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  36997. },
  36998. args: ["anIRInlinedClosure"],
  36999. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  37000. referencedClasses: [],
  37001. messageSends: ["visitIRClosure:"]
  37002. }),
  37003. $globals.IRVisitor);
  37004. $core.addMethod(
  37005. $core.method({
  37006. selector: "visitIRInlinedSequence:",
  37007. protocol: 'visiting',
  37008. fn: function (anIRInlinedSequence){
  37009. var self=this;
  37010. return $core.withContext(function($ctx1) {
  37011. return self._visitIRSequence_(anIRInlinedSequence);
  37012. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  37013. },
  37014. args: ["anIRInlinedSequence"],
  37015. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  37016. referencedClasses: [],
  37017. messageSends: ["visitIRSequence:"]
  37018. }),
  37019. $globals.IRVisitor);
  37020. $core.addMethod(
  37021. $core.method({
  37022. selector: "visitIRInstruction:",
  37023. protocol: 'visiting',
  37024. fn: function (anIRInstruction){
  37025. var self=this;
  37026. return $core.withContext(function($ctx1) {
  37027. $recv($recv(anIRInstruction)._instructions())._do_((function(each){
  37028. return $core.withContext(function($ctx2) {
  37029. return self._visit_(each);
  37030. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37031. }));
  37032. return anIRInstruction;
  37033. }, function($ctx1) {$ctx1.fill(self,"visitIRInstruction:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)});
  37034. },
  37035. args: ["anIRInstruction"],
  37036. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  37037. referencedClasses: [],
  37038. messageSends: ["do:", "instructions", "visit:"]
  37039. }),
  37040. $globals.IRVisitor);
  37041. $core.addMethod(
  37042. $core.method({
  37043. selector: "visitIRMethod:",
  37044. protocol: 'visiting',
  37045. fn: function (anIRMethod){
  37046. var self=this;
  37047. return $core.withContext(function($ctx1) {
  37048. return self._visitIRInstruction_(anIRMethod);
  37049. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  37050. },
  37051. args: ["anIRMethod"],
  37052. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  37053. referencedClasses: [],
  37054. messageSends: ["visitIRInstruction:"]
  37055. }),
  37056. $globals.IRVisitor);
  37057. $core.addMethod(
  37058. $core.method({
  37059. selector: "visitIRNonLocalReturn:",
  37060. protocol: 'visiting',
  37061. fn: function (anIRNonLocalReturn){
  37062. var self=this;
  37063. return $core.withContext(function($ctx1) {
  37064. return self._visitIRInstruction_(anIRNonLocalReturn);
  37065. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  37066. },
  37067. args: ["anIRNonLocalReturn"],
  37068. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  37069. referencedClasses: [],
  37070. messageSends: ["visitIRInstruction:"]
  37071. }),
  37072. $globals.IRVisitor);
  37073. $core.addMethod(
  37074. $core.method({
  37075. selector: "visitIRNonLocalReturnHandling:",
  37076. protocol: 'visiting',
  37077. fn: function (anIRNonLocalReturnHandling){
  37078. var self=this;
  37079. return $core.withContext(function($ctx1) {
  37080. return self._visitIRInstruction_(anIRNonLocalReturnHandling);
  37081. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  37082. },
  37083. args: ["anIRNonLocalReturnHandling"],
  37084. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  37085. referencedClasses: [],
  37086. messageSends: ["visitIRInstruction:"]
  37087. }),
  37088. $globals.IRVisitor);
  37089. $core.addMethod(
  37090. $core.method({
  37091. selector: "visitIRReturn:",
  37092. protocol: 'visiting',
  37093. fn: function (anIRReturn){
  37094. var self=this;
  37095. return $core.withContext(function($ctx1) {
  37096. return self._visitIRInstruction_(anIRReturn);
  37097. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  37098. },
  37099. args: ["anIRReturn"],
  37100. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  37101. referencedClasses: [],
  37102. messageSends: ["visitIRInstruction:"]
  37103. }),
  37104. $globals.IRVisitor);
  37105. $core.addMethod(
  37106. $core.method({
  37107. selector: "visitIRSend:",
  37108. protocol: 'visiting',
  37109. fn: function (anIRSend){
  37110. var self=this;
  37111. return $core.withContext(function($ctx1) {
  37112. return self._visitIRInstruction_(anIRSend);
  37113. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  37114. },
  37115. args: ["anIRSend"],
  37116. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  37117. referencedClasses: [],
  37118. messageSends: ["visitIRInstruction:"]
  37119. }),
  37120. $globals.IRVisitor);
  37121. $core.addMethod(
  37122. $core.method({
  37123. selector: "visitIRSequence:",
  37124. protocol: 'visiting',
  37125. fn: function (anIRSequence){
  37126. var self=this;
  37127. return $core.withContext(function($ctx1) {
  37128. return self._visitIRInstruction_(anIRSequence);
  37129. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  37130. },
  37131. args: ["anIRSequence"],
  37132. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  37133. referencedClasses: [],
  37134. messageSends: ["visitIRInstruction:"]
  37135. }),
  37136. $globals.IRVisitor);
  37137. $core.addMethod(
  37138. $core.method({
  37139. selector: "visitIRTempDeclaration:",
  37140. protocol: 'visiting',
  37141. fn: function (anIRTempDeclaration){
  37142. var self=this;
  37143. return $core.withContext(function($ctx1) {
  37144. return self._visitIRInstruction_(anIRTempDeclaration);
  37145. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  37146. },
  37147. args: ["anIRTempDeclaration"],
  37148. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  37149. referencedClasses: [],
  37150. messageSends: ["visitIRInstruction:"]
  37151. }),
  37152. $globals.IRVisitor);
  37153. $core.addMethod(
  37154. $core.method({
  37155. selector: "visitIRValue:",
  37156. protocol: 'visiting',
  37157. fn: function (anIRValue){
  37158. var self=this;
  37159. return $core.withContext(function($ctx1) {
  37160. return self._visitIRInstruction_(anIRValue);
  37161. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  37162. },
  37163. args: ["anIRValue"],
  37164. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  37165. referencedClasses: [],
  37166. messageSends: ["visitIRInstruction:"]
  37167. }),
  37168. $globals.IRVisitor);
  37169. $core.addMethod(
  37170. $core.method({
  37171. selector: "visitIRVariable:",
  37172. protocol: 'visiting',
  37173. fn: function (anIRVariable){
  37174. var self=this;
  37175. return $core.withContext(function($ctx1) {
  37176. return self._visitIRInstruction_(anIRVariable);
  37177. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  37178. },
  37179. args: ["anIRVariable"],
  37180. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  37181. referencedClasses: [],
  37182. messageSends: ["visitIRInstruction:"]
  37183. }),
  37184. $globals.IRVisitor);
  37185. $core.addMethod(
  37186. $core.method({
  37187. selector: "visitIRVerbatim:",
  37188. protocol: 'visiting',
  37189. fn: function (anIRVerbatim){
  37190. var self=this;
  37191. return $core.withContext(function($ctx1) {
  37192. return self._visitIRInstruction_(anIRVerbatim);
  37193. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  37194. },
  37195. args: ["anIRVerbatim"],
  37196. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  37197. referencedClasses: [],
  37198. messageSends: ["visitIRInstruction:"]
  37199. }),
  37200. $globals.IRVisitor);
  37201. $core.addClass('IRJSTranslator', $globals.IRVisitor, ['stream', 'currentClass'], 'Compiler-IR');
  37202. $core.addMethod(
  37203. $core.method({
  37204. selector: "contents",
  37205. protocol: 'accessing',
  37206. fn: function (){
  37207. var self=this;
  37208. return $core.withContext(function($ctx1) {
  37209. return $recv(self._stream())._contents();
  37210. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  37211. },
  37212. args: [],
  37213. source: "contents\x0a\x09^ self stream contents",
  37214. referencedClasses: [],
  37215. messageSends: ["contents", "stream"]
  37216. }),
  37217. $globals.IRJSTranslator);
  37218. $core.addMethod(
  37219. $core.method({
  37220. selector: "currentClass",
  37221. protocol: 'accessing',
  37222. fn: function (){
  37223. var self=this;
  37224. return self["@currentClass"];
  37225. },
  37226. args: [],
  37227. source: "currentClass\x0a\x09^ currentClass",
  37228. referencedClasses: [],
  37229. messageSends: []
  37230. }),
  37231. $globals.IRJSTranslator);
  37232. $core.addMethod(
  37233. $core.method({
  37234. selector: "currentClass:",
  37235. protocol: 'accessing',
  37236. fn: function (aClass){
  37237. var self=this;
  37238. self["@currentClass"]=aClass;
  37239. return self;
  37240. },
  37241. args: ["aClass"],
  37242. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  37243. referencedClasses: [],
  37244. messageSends: []
  37245. }),
  37246. $globals.IRJSTranslator);
  37247. $core.addMethod(
  37248. $core.method({
  37249. selector: "initialize",
  37250. protocol: 'initialization',
  37251. fn: function (){
  37252. var self=this;
  37253. function $JSStream(){return $globals.JSStream||(typeof JSStream=="undefined"?nil:JSStream)}
  37254. return $core.withContext(function($ctx1) {
  37255. (
  37256. $ctx1.supercall = true,
  37257. ($globals.IRJSTranslator.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  37258. $ctx1.supercall = false;
  37259. self["@stream"]=$recv($JSStream())._new();
  37260. return self;
  37261. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  37262. },
  37263. args: [],
  37264. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  37265. referencedClasses: ["JSStream"],
  37266. messageSends: ["initialize", "new"]
  37267. }),
  37268. $globals.IRJSTranslator);
  37269. $core.addMethod(
  37270. $core.method({
  37271. selector: "stream",
  37272. protocol: 'accessing',
  37273. fn: function (){
  37274. var self=this;
  37275. return self["@stream"];
  37276. },
  37277. args: [],
  37278. source: "stream\x0a\x09^ stream",
  37279. referencedClasses: [],
  37280. messageSends: []
  37281. }),
  37282. $globals.IRJSTranslator);
  37283. $core.addMethod(
  37284. $core.method({
  37285. selector: "stream:",
  37286. protocol: 'accessing',
  37287. fn: function (aStream){
  37288. var self=this;
  37289. self["@stream"]=aStream;
  37290. return self;
  37291. },
  37292. args: ["aStream"],
  37293. source: "stream: aStream\x0a\x09stream := aStream",
  37294. referencedClasses: [],
  37295. messageSends: []
  37296. }),
  37297. $globals.IRJSTranslator);
  37298. $core.addMethod(
  37299. $core.method({
  37300. selector: "visitIRAssignment:",
  37301. protocol: 'visiting',
  37302. fn: function (anIRAssignment){
  37303. var self=this;
  37304. return $core.withContext(function($ctx1) {
  37305. var $2,$1;
  37306. $recv(self._stream())._nextPutAssignLhs_rhs_((function(){
  37307. return $core.withContext(function($ctx2) {
  37308. $2=$recv(anIRAssignment)._instructions();
  37309. $ctx2.sendIdx["instructions"]=1;
  37310. $1=$recv($2)._first();
  37311. return self._visit_($1);
  37312. $ctx2.sendIdx["visit:"]=1;
  37313. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37314. }),(function(){
  37315. return $core.withContext(function($ctx2) {
  37316. return self._visit_($recv($recv(anIRAssignment)._instructions())._last());
  37317. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  37318. }));
  37319. return self;
  37320. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  37321. },
  37322. args: ["anIRAssignment"],
  37323. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment instructions first]\x0a\x09\x09rhs: [self visit: anIRAssignment instructions last].",
  37324. referencedClasses: [],
  37325. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "first", "instructions", "last"]
  37326. }),
  37327. $globals.IRJSTranslator);
  37328. $core.addMethod(
  37329. $core.method({
  37330. selector: "visitIRClosure:",
  37331. protocol: 'visiting',
  37332. fn: function (anIRClosure){
  37333. var self=this;
  37334. return $core.withContext(function($ctx1) {
  37335. var $1,$2;
  37336. $1=self._stream();
  37337. $ctx1.sendIdx["stream"]=1;
  37338. $recv($1)._nextPutClosureWith_arguments_((function(){
  37339. return $core.withContext(function($ctx2) {
  37340. $2=self._stream();
  37341. $ctx2.sendIdx["stream"]=2;
  37342. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  37343. return $core.withContext(function($ctx3) {
  37344. return $recv($recv(each)._name())._asVariableName();
  37345. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  37346. })));
  37347. return $recv(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  37348. return $core.withContext(function($ctx3) {
  37349. return (
  37350. $ctx3.supercall = true,
  37351. ($globals.IRJSTranslator.superclass||$boot.dnu).fn.prototype._visitIRClosure_.apply($recv(self), [anIRClosure]));
  37352. $ctx3.supercall = false;
  37353. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  37354. }));
  37355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37356. }),$recv(anIRClosure)._arguments());
  37357. return self;
  37358. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  37359. },
  37360. args: ["anIRClosure"],
  37361. 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",
  37362. referencedClasses: [],
  37363. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  37364. }),
  37365. $globals.IRJSTranslator);
  37366. $core.addMethod(
  37367. $core.method({
  37368. selector: "visitIRDynamicArray:",
  37369. protocol: 'visiting',
  37370. fn: function (anIRDynamicArray){
  37371. var self=this;
  37372. return $core.withContext(function($ctx1) {
  37373. self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._instructions(),"[","]");
  37374. return self;
  37375. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  37376. },
  37377. args: ["anIRDynamicArray"],
  37378. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray instructions\x0a\x09\x09enclosedBetween: '[' and: ']'",
  37379. referencedClasses: [],
  37380. messageSends: ["visitInstructionList:enclosedBetween:and:", "instructions"]
  37381. }),
  37382. $globals.IRJSTranslator);
  37383. $core.addMethod(
  37384. $core.method({
  37385. selector: "visitIRDynamicDictionary:",
  37386. protocol: 'visiting',
  37387. fn: function (anIRDynamicDictionary){
  37388. var self=this;
  37389. return $core.withContext(function($ctx1) {
  37390. self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._instructions(),"$globals.HashedCollection._newFromPairs_([","])");
  37391. return self;
  37392. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  37393. },
  37394. args: ["anIRDynamicDictionary"],
  37395. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary instructions\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  37396. referencedClasses: [],
  37397. messageSends: ["visitInstructionList:enclosedBetween:and:", "instructions"]
  37398. }),
  37399. $globals.IRJSTranslator);
  37400. $core.addMethod(
  37401. $core.method({
  37402. selector: "visitIRMethod:",
  37403. protocol: 'visiting',
  37404. fn: function (anIRMethod){
  37405. var self=this;
  37406. return $core.withContext(function($ctx1) {
  37407. var $1,$2,$3,$4,$5,$6,$8,$7,$9,$10;
  37408. $1=self._stream();
  37409. $ctx1.sendIdx["stream"]=1;
  37410. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  37411. return $core.withContext(function($ctx2) {
  37412. $2=self._stream();
  37413. $ctx2.sendIdx["stream"]=2;
  37414. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  37415. return $core.withContext(function($ctx3) {
  37416. $3=self._stream();
  37417. $ctx3.sendIdx["stream"]=3;
  37418. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  37419. return $core.withContext(function($ctx4) {
  37420. return $recv($recv(each)._name())._asVariableName();
  37421. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  37422. }));
  37423. $ctx3.sendIdx["collect:"]=1;
  37424. $recv($3)._nextPutVars_($4);
  37425. $ctx3.sendIdx["nextPutVars:"]=1;
  37426. $recv($recv(anIRMethod)._classReferences())._do_((function(each){
  37427. return $core.withContext(function($ctx4) {
  37428. $5=self._stream();
  37429. $ctx4.sendIdx["stream"]=4;
  37430. return $recv($5)._nextPutClassRefFunction_(each);
  37431. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,4)});
  37432. }));
  37433. $6=self._stream();
  37434. $ctx3.sendIdx["stream"]=5;
  37435. return $recv($6)._nextPutContextFor_during_(anIRMethod,(function(){
  37436. return $core.withContext(function($ctx4) {
  37437. $8=$recv(anIRMethod)._internalVariables();
  37438. $ctx4.sendIdx["internalVariables"]=1;
  37439. $7=$recv($8)._notEmpty();
  37440. if($core.assert($7)){
  37441. $9=self._stream();
  37442. $ctx4.sendIdx["stream"]=6;
  37443. $recv($9)._nextPutVars_($recv($recv($recv(anIRMethod)._internalVariables())._asSet())._collect_((function(each){
  37444. return $core.withContext(function($ctx5) {
  37445. return $recv($recv(each)._variable())._alias();
  37446. }, function($ctx5) {$ctx5.fillBlock({each:each},$ctx4,7)});
  37447. })));
  37448. };
  37449. $10=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  37450. if($core.assert($10)){
  37451. return $recv(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  37452. return $core.withContext(function($ctx5) {
  37453. return (
  37454. $ctx5.supercall = true,
  37455. ($globals.IRJSTranslator.superclass||$boot.dnu).fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  37456. $ctx5.supercall = false;
  37457. $ctx5.sendIdx["visitIRMethod:"]=1;
  37458. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,9)});
  37459. }));
  37460. } else {
  37461. return (
  37462. $ctx4.supercall = true,
  37463. ($globals.IRJSTranslator.superclass||$boot.dnu).fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  37464. $ctx4.supercall = false;
  37465. };
  37466. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  37467. }));
  37468. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  37469. }),$recv(anIRMethod)._arguments());
  37470. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37471. }));
  37472. return self;
  37473. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  37474. },
  37475. args: ["anIRMethod"],
  37476. 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 ]",
  37477. referencedClasses: [],
  37478. 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"]
  37479. }),
  37480. $globals.IRJSTranslator);
  37481. $core.addMethod(
  37482. $core.method({
  37483. selector: "visitIRNonLocalReturn:",
  37484. protocol: 'visiting',
  37485. fn: function (anIRNonLocalReturn){
  37486. var self=this;
  37487. return $core.withContext(function($ctx1) {
  37488. $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
  37489. return $core.withContext(function($ctx2) {
  37490. return (
  37491. $ctx2.supercall = true,
  37492. ($globals.IRJSTranslator.superclass||$boot.dnu).fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  37493. $ctx2.supercall = false;
  37494. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37495. }));
  37496. return self;
  37497. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  37498. },
  37499. args: ["anIRNonLocalReturn"],
  37500. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  37501. referencedClasses: [],
  37502. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  37503. }),
  37504. $globals.IRJSTranslator);
  37505. $core.addMethod(
  37506. $core.method({
  37507. selector: "visitIRReturn:",
  37508. protocol: 'visiting',
  37509. fn: function (anIRReturn){
  37510. var self=this;
  37511. return $core.withContext(function($ctx1) {
  37512. $recv(self._stream())._nextPutReturnWith_((function(){
  37513. return $core.withContext(function($ctx2) {
  37514. return (
  37515. $ctx2.supercall = true,
  37516. ($globals.IRJSTranslator.superclass||$boot.dnu).fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  37517. $ctx2.supercall = false;
  37518. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37519. }));
  37520. return self;
  37521. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  37522. },
  37523. args: ["anIRReturn"],
  37524. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  37525. referencedClasses: [],
  37526. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  37527. }),
  37528. $globals.IRJSTranslator);
  37529. $core.addMethod(
  37530. $core.method({
  37531. selector: "visitIRSend:",
  37532. protocol: 'visiting',
  37533. fn: function (anIRSend){
  37534. var self=this;
  37535. var sends,superclass;
  37536. return $core.withContext(function($ctx1) {
  37537. var $1,$2;
  37538. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  37539. $1=$recv(anIRSend)._isSuperSend();
  37540. if($core.assert($1)){
  37541. self._visitSuperSend_(anIRSend);
  37542. } else {
  37543. self._visitSend_(anIRSend);
  37544. };
  37545. $2=$recv($recv(sends).__gt((1)))._and_((function(){
  37546. return $core.withContext(function($ctx2) {
  37547. return $recv($recv(anIRSend)._index()).__lt(sends);
  37548. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  37549. }));
  37550. if($core.assert($2)){
  37551. $recv(self._stream())._nextPutSendIndexFor_(anIRSend);
  37552. };
  37553. return self;
  37554. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass},$globals.IRJSTranslator)});
  37555. },
  37556. args: ["anIRSend"],
  37557. source: "visitIRSend: anIRSend\x0a\x09| sends superclass |\x0a\x09sends := (anIRSend method sendIndexes at: anIRSend selector) size.\x0a\x09\x0a\x09anIRSend isSuperSend\x0a\x09\x09ifTrue: [ self visitSuperSend: anIRSend ]\x0a\x09\x09ifFalse: [ self visitSend: anIRSend ].\x0a\x09\x09\x0a\x09(sends > 1 and: [ anIRSend index < sends ])\x0a\x09\x09ifTrue: [ self stream nextPutSendIndexFor: anIRSend ]",
  37558. referencedClasses: [],
  37559. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuperSend", "visitSuperSend:", "visitSend:", "ifTrue:", "and:", ">", "<", "index", "nextPutSendIndexFor:", "stream"]
  37560. }),
  37561. $globals.IRJSTranslator);
  37562. $core.addMethod(
  37563. $core.method({
  37564. selector: "visitIRSequence:",
  37565. protocol: 'visiting',
  37566. fn: function (anIRSequence){
  37567. var self=this;
  37568. return $core.withContext(function($ctx1) {
  37569. var $1;
  37570. $1=self._stream();
  37571. $ctx1.sendIdx["stream"]=1;
  37572. $recv($1)._nextPutSequenceWith_((function(){
  37573. return $core.withContext(function($ctx2) {
  37574. return $recv($recv(anIRSequence)._instructions())._do_((function(each){
  37575. return $core.withContext(function($ctx3) {
  37576. return $recv(self._stream())._nextPutStatementWith_(self._visit_(each));
  37577. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  37578. }));
  37579. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37580. }));
  37581. return self;
  37582. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  37583. },
  37584. args: ["anIRSequence"],
  37585. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ] ]",
  37586. referencedClasses: [],
  37587. messageSends: ["nextPutSequenceWith:", "stream", "do:", "instructions", "nextPutStatementWith:", "visit:"]
  37588. }),
  37589. $globals.IRJSTranslator);
  37590. $core.addMethod(
  37591. $core.method({
  37592. selector: "visitIRTempDeclaration:",
  37593. protocol: 'visiting',
  37594. fn: function (anIRTempDeclaration){
  37595. var self=this;
  37596. return self;
  37597. },
  37598. args: ["anIRTempDeclaration"],
  37599. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  37600. referencedClasses: [],
  37601. messageSends: []
  37602. }),
  37603. $globals.IRJSTranslator);
  37604. $core.addMethod(
  37605. $core.method({
  37606. selector: "visitIRValue:",
  37607. protocol: 'visiting',
  37608. fn: function (anIRValue){
  37609. var self=this;
  37610. return $core.withContext(function($ctx1) {
  37611. $recv(self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavascript());
  37612. return self;
  37613. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  37614. },
  37615. args: ["anIRValue"],
  37616. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  37617. referencedClasses: [],
  37618. messageSends: ["nextPutAll:", "stream", "asJavascript", "value"]
  37619. }),
  37620. $globals.IRJSTranslator);
  37621. $core.addMethod(
  37622. $core.method({
  37623. selector: "visitIRVariable:",
  37624. protocol: 'visiting',
  37625. fn: function (anIRVariable){
  37626. var self=this;
  37627. return $core.withContext(function($ctx1) {
  37628. var $3,$2,$1,$4;
  37629. $3=$recv(anIRVariable)._variable();
  37630. $ctx1.sendIdx["variable"]=1;
  37631. $2=$recv($3)._name();
  37632. $1=$recv($2).__eq("thisContext");
  37633. if($core.assert($1)){
  37634. $4=self._stream();
  37635. $ctx1.sendIdx["stream"]=1;
  37636. $recv($4)._nextPutAll_("$core.getThisContext()");
  37637. $ctx1.sendIdx["nextPutAll:"]=1;
  37638. } else {
  37639. $recv(self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  37640. };
  37641. return self;
  37642. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  37643. },
  37644. args: ["anIRVariable"],
  37645. 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 ]",
  37646. referencedClasses: [],
  37647. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  37648. }),
  37649. $globals.IRJSTranslator);
  37650. $core.addMethod(
  37651. $core.method({
  37652. selector: "visitIRVerbatim:",
  37653. protocol: 'visiting',
  37654. fn: function (anIRVerbatim){
  37655. var self=this;
  37656. return $core.withContext(function($ctx1) {
  37657. var $1;
  37658. $1=self._stream();
  37659. $ctx1.sendIdx["stream"]=1;
  37660. $recv($1)._nextPutStatementWith_((function(){
  37661. return $core.withContext(function($ctx2) {
  37662. return $recv(self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  37663. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37664. }));
  37665. return self;
  37666. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  37667. },
  37668. args: ["anIRVerbatim"],
  37669. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  37670. referencedClasses: [],
  37671. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"]
  37672. }),
  37673. $globals.IRJSTranslator);
  37674. $core.addMethod(
  37675. $core.method({
  37676. selector: "visitInstructionList:enclosedBetween:and:",
  37677. protocol: 'visiting',
  37678. fn: function (anArray,aString,anotherString){
  37679. var self=this;
  37680. return $core.withContext(function($ctx1) {
  37681. var $1;
  37682. $1=self._stream();
  37683. $ctx1.sendIdx["stream"]=1;
  37684. $recv($1)._nextPutAll_(aString);
  37685. $ctx1.sendIdx["nextPutAll:"]=1;
  37686. $recv(anArray)._do_separatedBy_((function(each){
  37687. return $core.withContext(function($ctx2) {
  37688. return self._visit_(each);
  37689. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37690. }),(function(){
  37691. return $core.withContext(function($ctx2) {
  37692. return $recv(self._stream())._nextPutAll_(",");
  37693. $ctx2.sendIdx["nextPutAll:"]=2;
  37694. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  37695. }));
  37696. $recv(self["@stream"])._nextPutAll_(anotherString);
  37697. return self;
  37698. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString},$globals.IRJSTranslator)});
  37699. },
  37700. args: ["anArray", "aString", "anotherString"],
  37701. source: "visitInstructionList: anArray enclosedBetween: aString and: anotherString\x0a\x09self stream nextPutAll: aString.\x0a\x09anArray\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: anotherString",
  37702. referencedClasses: [],
  37703. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  37704. }),
  37705. $globals.IRJSTranslator);
  37706. $core.addMethod(
  37707. $core.method({
  37708. selector: "visitReceiver:",
  37709. protocol: 'visiting',
  37710. fn: function (anIRInstruction){
  37711. var self=this;
  37712. return $core.withContext(function($ctx1) {
  37713. var $1,$2,$3;
  37714. $1=$recv(anIRInstruction)._needsBoxingAsReceiver();
  37715. if(!$core.assert($1)){
  37716. $2=self._visit_(anIRInstruction);
  37717. $ctx1.sendIdx["visit:"]=1;
  37718. return $2;
  37719. };
  37720. $3=self._stream();
  37721. $ctx1.sendIdx["stream"]=1;
  37722. $recv($3)._nextPutAll_("$recv(");
  37723. $ctx1.sendIdx["nextPutAll:"]=1;
  37724. self._visit_(anIRInstruction);
  37725. $recv(self._stream())._nextPutAll_(")");
  37726. return self;
  37727. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},$globals.IRJSTranslator)});
  37728. },
  37729. args: ["anIRInstruction"],
  37730. 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: ')'",
  37731. referencedClasses: [],
  37732. messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  37733. }),
  37734. $globals.IRJSTranslator);
  37735. $core.addMethod(
  37736. $core.method({
  37737. selector: "visitSend:",
  37738. protocol: 'visiting',
  37739. fn: function (anIRSend){
  37740. var self=this;
  37741. return $core.withContext(function($ctx1) {
  37742. var $2,$1;
  37743. $2=$recv(anIRSend)._instructions();
  37744. $ctx1.sendIdx["instructions"]=1;
  37745. $1=$recv($2)._first();
  37746. self._visitReceiver_($1);
  37747. $recv(self._stream())._nextPutAll_(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()));
  37748. self._visitInstructionList_enclosedBetween_and_($recv($recv(anIRSend)._instructions())._allButFirst(),"(",")");
  37749. return self;
  37750. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  37751. },
  37752. args: ["anIRSend"],
  37753. source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend instructions first.\x0a\x09self stream nextPutAll: '.', anIRSend selector asJavaScriptMethodName.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend instructions allButFirst\x0a\x09\x09enclosedBetween: '(' and: ')'",
  37754. referencedClasses: [],
  37755. messageSends: ["visitReceiver:", "first", "instructions", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "allButFirst"]
  37756. }),
  37757. $globals.IRJSTranslator);
  37758. $core.addMethod(
  37759. $core.method({
  37760. selector: "visitSuperSend:",
  37761. protocol: 'visiting',
  37762. fn: function (anIRSend){
  37763. var self=this;
  37764. return $core.withContext(function($ctx1) {
  37765. var $1,$4,$3,$2,$5,$6,$7,$8;
  37766. $1=self._stream();
  37767. $ctx1.sendIdx["stream"]=1;
  37768. $recv($1)._nextPutAll_("(");
  37769. $ctx1.sendIdx["nextPutAll:"]=1;
  37770. $recv($1)._lf();
  37771. $ctx1.sendIdx["lf"]=1;
  37772. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  37773. $ctx1.sendIdx["nextPutAll:"]=2;
  37774. $recv($1)._lf();
  37775. $ctx1.sendIdx["lf"]=2;
  37776. $4=$recv(anIRSend)._scope();
  37777. $ctx1.sendIdx["scope"]=1;
  37778. $3=$recv($4)._alias();
  37779. $ctx1.sendIdx["alias"]=1;
  37780. $2=$recv($3).__comma(".supercall = true,");
  37781. $ctx1.sendIdx[","]=1;
  37782. $recv($1)._nextPutAll_($2);
  37783. $ctx1.sendIdx["nextPutAll:"]=3;
  37784. $recv($1)._lf();
  37785. $ctx1.sendIdx["lf"]=3;
  37786. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  37787. $ctx1.sendIdx["nextPutAll:"]=4;
  37788. $recv($1)._lf();
  37789. $ctx1.sendIdx["lf"]=4;
  37790. $5="(".__comma($recv(self._currentClass())._asJavascript());
  37791. $ctx1.sendIdx[","]=2;
  37792. $recv($1)._nextPutAll_($5);
  37793. $ctx1.sendIdx["nextPutAll:"]=5;
  37794. $recv($1)._nextPutAll_(".superclass||$boot.dnu).fn.prototype.");
  37795. $ctx1.sendIdx["nextPutAll:"]=6;
  37796. $6=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  37797. $ctx1.sendIdx[","]=3;
  37798. $recv($1)._nextPutAll_($6);
  37799. $ctx1.sendIdx["nextPutAll:"]=7;
  37800. $7=$recv($1)._nextPutAll_("$recv(self), ");
  37801. $ctx1.sendIdx["nextPutAll:"]=8;
  37802. self._visitInstructionList_enclosedBetween_and_($recv($recv(anIRSend)._instructions())._allButFirst(),"[","]");
  37803. $8=self._stream();
  37804. $recv($8)._nextPutAll_("));");
  37805. $ctx1.sendIdx["nextPutAll:"]=9;
  37806. $recv($8)._lf();
  37807. $ctx1.sendIdx["lf"]=5;
  37808. $recv($8)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  37809. $ctx1.sendIdx["nextPutAll:"]=10;
  37810. $recv($8)._lf();
  37811. $ctx1.sendIdx["lf"]=6;
  37812. $recv($8)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  37813. $ctx1.sendIdx["nextPutAll:"]=11;
  37814. $recv($8)._lf();
  37815. $recv($8)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  37816. return self;
  37817. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  37818. },
  37819. args: ["anIRSend"],
  37820. source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: '('; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = true,'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'; lf;\x0a\x09\x09nextPutAll: '(', self currentClass asJavascript;\x0a\x09\x09nextPutAll: '.superclass||$boot.dnu).fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptMethodName, '.apply(';\x0a\x09\x09nextPutAll: '$recv(self), '.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend instructions allButFirst\x0a\x09\x09enclosedBetween: '[' and: ']'.\x0a\x09self stream \x0a\x09\x09nextPutAll: '));'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = false;'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  37821. referencedClasses: [],
  37822. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavascript", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "allButFirst", "instructions"]
  37823. }),
  37824. $globals.IRJSTranslator);
  37825. $core.addClass('JSStream', $globals.Object, ['stream'], 'Compiler-IR');
  37826. $core.addMethod(
  37827. $core.method({
  37828. selector: "contents",
  37829. protocol: 'accessing',
  37830. fn: function (){
  37831. var self=this;
  37832. return $core.withContext(function($ctx1) {
  37833. return $recv(self["@stream"])._contents();
  37834. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  37835. },
  37836. args: [],
  37837. source: "contents\x0a\x09^ stream contents",
  37838. referencedClasses: [],
  37839. messageSends: ["contents"]
  37840. }),
  37841. $globals.JSStream);
  37842. $core.addMethod(
  37843. $core.method({
  37844. selector: "initialize",
  37845. protocol: 'initialization',
  37846. fn: function (){
  37847. var self=this;
  37848. return $core.withContext(function($ctx1) {
  37849. (
  37850. $ctx1.supercall = true,
  37851. ($globals.JSStream.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  37852. $ctx1.supercall = false;
  37853. self["@stream"]=""._writeStream();
  37854. return self;
  37855. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  37856. },
  37857. args: [],
  37858. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  37859. referencedClasses: [],
  37860. messageSends: ["initialize", "writeStream"]
  37861. }),
  37862. $globals.JSStream);
  37863. $core.addMethod(
  37864. $core.method({
  37865. selector: "lf",
  37866. protocol: 'streaming',
  37867. fn: function (){
  37868. var self=this;
  37869. return $core.withContext(function($ctx1) {
  37870. $recv(self["@stream"])._lf();
  37871. return self;
  37872. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  37873. },
  37874. args: [],
  37875. source: "lf\x0a\x09stream lf",
  37876. referencedClasses: [],
  37877. messageSends: ["lf"]
  37878. }),
  37879. $globals.JSStream);
  37880. $core.addMethod(
  37881. $core.method({
  37882. selector: "nextPut:",
  37883. protocol: 'streaming',
  37884. fn: function (aString){
  37885. var self=this;
  37886. return $core.withContext(function($ctx1) {
  37887. $recv(self["@stream"])._nextPut_(aString);
  37888. return self;
  37889. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  37890. },
  37891. args: ["aString"],
  37892. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  37893. referencedClasses: [],
  37894. messageSends: ["nextPut:"]
  37895. }),
  37896. $globals.JSStream);
  37897. $core.addMethod(
  37898. $core.method({
  37899. selector: "nextPutAll:",
  37900. protocol: 'streaming',
  37901. fn: function (aString){
  37902. var self=this;
  37903. return $core.withContext(function($ctx1) {
  37904. $recv(self["@stream"])._nextPutAll_(aString);
  37905. return self;
  37906. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  37907. },
  37908. args: ["aString"],
  37909. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  37910. referencedClasses: [],
  37911. messageSends: ["nextPutAll:"]
  37912. }),
  37913. $globals.JSStream);
  37914. $core.addMethod(
  37915. $core.method({
  37916. selector: "nextPutAssignLhs:rhs:",
  37917. protocol: 'streaming',
  37918. fn: function (aBlock,anotherBlock){
  37919. var self=this;
  37920. return $core.withContext(function($ctx1) {
  37921. $recv(aBlock)._value();
  37922. $ctx1.sendIdx["value"]=1;
  37923. $recv(self["@stream"])._nextPutAll_("=");
  37924. $recv(anotherBlock)._value();
  37925. return self;
  37926. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  37927. },
  37928. args: ["aBlock", "anotherBlock"],
  37929. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  37930. referencedClasses: [],
  37931. messageSends: ["value", "nextPutAll:"]
  37932. }),
  37933. $globals.JSStream);
  37934. $core.addMethod(
  37935. $core.method({
  37936. selector: "nextPutBlockContextFor:during:",
  37937. protocol: 'streaming',
  37938. fn: function (anIRClosure,aBlock){
  37939. var self=this;
  37940. return $core.withContext(function($ctx1) {
  37941. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18;
  37942. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  37943. if(!$core.assert($1)){
  37944. $2=$recv(aBlock)._value();
  37945. $ctx1.sendIdx["value"]=1;
  37946. return $2;
  37947. };
  37948. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  37949. $ctx1.sendIdx["nextPutAll:"]=1;
  37950. self._lf();
  37951. $ctx1.sendIdx["lf"]=1;
  37952. $6=$recv(anIRClosure)._scope();
  37953. $ctx1.sendIdx["scope"]=1;
  37954. $5=$recv($6)._alias();
  37955. $ctx1.sendIdx["alias"]=1;
  37956. $4="return $core.withContext(function(".__comma($5);
  37957. $ctx1.sendIdx[","]=2;
  37958. $3=$recv($4).__comma(") {");
  37959. $ctx1.sendIdx[","]=1;
  37960. self._nextPutAll_($3);
  37961. $ctx1.sendIdx["nextPutAll:"]=2;
  37962. self._lf();
  37963. $ctx1.sendIdx["lf"]=2;
  37964. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  37965. $ctx1.sendIdx["nextPutAll:"]=3;
  37966. $7=self._lf();
  37967. $ctx1.sendIdx["lf"]=3;
  37968. $recv(aBlock)._value();
  37969. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  37970. $ctx1.sendIdx["nextPutAll:"]=4;
  37971. self._lf();
  37972. $ctx1.sendIdx["lf"]=4;
  37973. $11=$recv(anIRClosure)._scope();
  37974. $ctx1.sendIdx["scope"]=2;
  37975. $10=$recv($11)._alias();
  37976. $ctx1.sendIdx["alias"]=2;
  37977. $9="}, function(".__comma($10);
  37978. $ctx1.sendIdx[","]=4;
  37979. $8=$recv($9).__comma(") {");
  37980. $ctx1.sendIdx[","]=3;
  37981. self._nextPutAll_($8);
  37982. $ctx1.sendIdx["nextPutAll:"]=5;
  37983. $15=$recv(anIRClosure)._scope();
  37984. $ctx1.sendIdx["scope"]=3;
  37985. $14=$recv($15)._alias();
  37986. $ctx1.sendIdx["alias"]=3;
  37987. $13=$recv($14).__comma(".fillBlock({");
  37988. $ctx1.sendIdx[","]=5;
  37989. $12=self._nextPutAll_($13);
  37990. $ctx1.sendIdx["nextPutAll:"]=6;
  37991. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  37992. return $core.withContext(function($ctx2) {
  37993. $16=$recv(each)._asVariableName();
  37994. $ctx2.sendIdx["asVariableName"]=1;
  37995. self._nextPutAll_($16);
  37996. $ctx2.sendIdx["nextPutAll:"]=7;
  37997. self._nextPutAll_(":");
  37998. $ctx2.sendIdx["nextPutAll:"]=8;
  37999. $17=self._nextPutAll_($recv(each)._asVariableName());
  38000. $ctx2.sendIdx["nextPutAll:"]=9;
  38001. return $17;
  38002. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38003. }),(function(){
  38004. return $core.withContext(function($ctx2) {
  38005. return self._nextPutAll_(",");
  38006. $ctx2.sendIdx["nextPutAll:"]=10;
  38007. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  38008. }));
  38009. self._nextPutAll_("},");
  38010. $ctx1.sendIdx["nextPutAll:"]=11;
  38011. $23=$recv(anIRClosure)._scope();
  38012. $ctx1.sendIdx["scope"]=4;
  38013. $22=$recv($23)._outerScope();
  38014. $21=$recv($22)._alias();
  38015. $20=$recv($21).__comma(",");
  38016. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  38017. $ctx1.sendIdx[","]=7;
  38018. $18=$recv($19).__comma(")});");
  38019. $ctx1.sendIdx[","]=6;
  38020. self._nextPutAll_($18);
  38021. $ctx1.sendIdx["nextPutAll:"]=12;
  38022. self._lf();
  38023. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38024. return self;
  38025. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  38026. },
  38027. args: ["anIRClosure", "aBlock"],
  38028. 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);'",
  38029. referencedClasses: [],
  38030. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  38031. }),
  38032. $globals.JSStream);
  38033. $core.addMethod(
  38034. $core.method({
  38035. selector: "nextPutClassRefFunction:",
  38036. protocol: 'streaming',
  38037. fn: function (aString){
  38038. var self=this;
  38039. return $core.withContext(function($ctx1) {
  38040. var $1;
  38041. $1=self["@stream"];
  38042. $recv($1)._nextPutAll_("function $");
  38043. $ctx1.sendIdx["nextPutAll:"]=1;
  38044. $recv($1)._nextPutAll_(aString);
  38045. $ctx1.sendIdx["nextPutAll:"]=2;
  38046. $recv($1)._nextPutAll_("(){return $globals.");
  38047. $ctx1.sendIdx["nextPutAll:"]=3;
  38048. $recv($1)._nextPutAll_(aString);
  38049. $ctx1.sendIdx["nextPutAll:"]=4;
  38050. $recv($1)._nextPutAll_("||(typeof ");
  38051. $ctx1.sendIdx["nextPutAll:"]=5;
  38052. $recv($1)._nextPutAll_(aString);
  38053. $ctx1.sendIdx["nextPutAll:"]=6;
  38054. $recv($1)._nextPutAll_("==\x22undefined\x22?nil:");
  38055. $ctx1.sendIdx["nextPutAll:"]=7;
  38056. $recv($1)._nextPutAll_(aString);
  38057. $ctx1.sendIdx["nextPutAll:"]=8;
  38058. $recv($1)._nextPutAll_(")}");
  38059. $recv($1)._lf();
  38060. return self;
  38061. }, function($ctx1) {$ctx1.fill(self,"nextPutClassRefFunction:",{aString:aString},$globals.JSStream)});
  38062. },
  38063. args: ["aString"],
  38064. 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",
  38065. referencedClasses: [],
  38066. messageSends: ["nextPutAll:", "lf"]
  38067. }),
  38068. $globals.JSStream);
  38069. $core.addMethod(
  38070. $core.method({
  38071. selector: "nextPutClosureWith:arguments:",
  38072. protocol: 'streaming',
  38073. fn: function (aBlock,anArray){
  38074. var self=this;
  38075. return $core.withContext(function($ctx1) {
  38076. var $1,$2,$3;
  38077. $recv(self["@stream"])._nextPutAll_("(function(");
  38078. $ctx1.sendIdx["nextPutAll:"]=1;
  38079. $recv(anArray)._do_separatedBy_((function(each){
  38080. return $core.withContext(function($ctx2) {
  38081. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  38082. $ctx2.sendIdx["nextPutAll:"]=2;
  38083. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38084. }),(function(){
  38085. return $core.withContext(function($ctx2) {
  38086. return $recv(self["@stream"])._nextPut_(",");
  38087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38088. }));
  38089. $1=self["@stream"];
  38090. $recv($1)._nextPutAll_("){");
  38091. $ctx1.sendIdx["nextPutAll:"]=3;
  38092. $2=$recv($1)._lf();
  38093. $ctx1.sendIdx["lf"]=1;
  38094. $recv(aBlock)._value();
  38095. $3=self["@stream"];
  38096. $recv($3)._lf();
  38097. $recv($3)._nextPutAll_("})");
  38098. return self;
  38099. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  38100. },
  38101. args: ["aBlock", "anArray"],
  38102. 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: '})'",
  38103. referencedClasses: [],
  38104. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  38105. }),
  38106. $globals.JSStream);
  38107. $core.addMethod(
  38108. $core.method({
  38109. selector: "nextPutContextFor:during:",
  38110. protocol: 'streaming',
  38111. fn: function (aMethod,aBlock){
  38112. var self=this;
  38113. return $core.withContext(function($ctx1) {
  38114. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18;
  38115. $1=$recv(aMethod)._requiresSmalltalkContext();
  38116. if(!$core.assert($1)){
  38117. $2=$recv(aBlock)._value();
  38118. $ctx1.sendIdx["value"]=1;
  38119. return $2;
  38120. };
  38121. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38122. $ctx1.sendIdx["nextPutAll:"]=1;
  38123. self._lf();
  38124. $ctx1.sendIdx["lf"]=1;
  38125. $6=$recv(aMethod)._scope();
  38126. $ctx1.sendIdx["scope"]=1;
  38127. $5=$recv($6)._alias();
  38128. $ctx1.sendIdx["alias"]=1;
  38129. $4="return $core.withContext(function(".__comma($5);
  38130. $ctx1.sendIdx[","]=2;
  38131. $3=$recv($4).__comma(") {");
  38132. $ctx1.sendIdx[","]=1;
  38133. self._nextPutAll_($3);
  38134. $ctx1.sendIdx["nextPutAll:"]=2;
  38135. self._lf();
  38136. $ctx1.sendIdx["lf"]=2;
  38137. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38138. $ctx1.sendIdx["nextPutAll:"]=3;
  38139. $7=self._lf();
  38140. $ctx1.sendIdx["lf"]=3;
  38141. $recv(aBlock)._value();
  38142. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38143. $ctx1.sendIdx["nextPutAll:"]=4;
  38144. self._lf();
  38145. $ctx1.sendIdx["lf"]=4;
  38146. $12=$recv(aMethod)._scope();
  38147. $ctx1.sendIdx["scope"]=2;
  38148. $11=$recv($12)._alias();
  38149. $ctx1.sendIdx["alias"]=2;
  38150. $10="}, function(".__comma($11);
  38151. $ctx1.sendIdx[","]=5;
  38152. $9=$recv($10).__comma(") {");
  38153. $ctx1.sendIdx[","]=4;
  38154. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  38155. $ctx1.sendIdx[","]=3;
  38156. self._nextPutAll_($8);
  38157. $ctx1.sendIdx["nextPutAll:"]=5;
  38158. $16=$recv($recv(aMethod)._selector())._asJavascript();
  38159. $ctx1.sendIdx["asJavascript"]=1;
  38160. $15=".fill(self,".__comma($16);
  38161. $14=$recv($15).__comma(",{");
  38162. $ctx1.sendIdx[","]=6;
  38163. $13=self._nextPutAll_($14);
  38164. $ctx1.sendIdx["nextPutAll:"]=6;
  38165. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  38166. return $core.withContext(function($ctx2) {
  38167. $17=$recv(each)._asVariableName();
  38168. $ctx2.sendIdx["asVariableName"]=1;
  38169. self._nextPutAll_($17);
  38170. $ctx2.sendIdx["nextPutAll:"]=7;
  38171. self._nextPutAll_(":");
  38172. $ctx2.sendIdx["nextPutAll:"]=8;
  38173. $18=self._nextPutAll_($recv(each)._asVariableName());
  38174. $ctx2.sendIdx["nextPutAll:"]=9;
  38175. return $18;
  38176. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38177. }),(function(){
  38178. return $core.withContext(function($ctx2) {
  38179. return self._nextPutAll_(",");
  38180. $ctx2.sendIdx["nextPutAll:"]=10;
  38181. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  38182. }));
  38183. self._nextPutAll_("},");
  38184. $ctx1.sendIdx["nextPutAll:"]=11;
  38185. self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavascript());
  38186. $ctx1.sendIdx["nextPutAll:"]=12;
  38187. self._nextPutAll_(")});");
  38188. $ctx1.sendIdx["nextPutAll:"]=13;
  38189. self._lf();
  38190. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38191. return self;
  38192. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  38193. },
  38194. args: ["aMethod", "aBlock"],
  38195. 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);'",
  38196. referencedClasses: [],
  38197. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavascript", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  38198. }),
  38199. $globals.JSStream);
  38200. $core.addMethod(
  38201. $core.method({
  38202. selector: "nextPutFunctionWith:arguments:",
  38203. protocol: 'streaming',
  38204. fn: function (aBlock,anArray){
  38205. var self=this;
  38206. return $core.withContext(function($ctx1) {
  38207. var $1,$2,$3,$4,$5;
  38208. $recv(self["@stream"])._nextPutAll_("fn: function(");
  38209. $ctx1.sendIdx["nextPutAll:"]=1;
  38210. $recv(anArray)._do_separatedBy_((function(each){
  38211. return $core.withContext(function($ctx2) {
  38212. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  38213. $ctx2.sendIdx["nextPutAll:"]=2;
  38214. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38215. }),(function(){
  38216. return $core.withContext(function($ctx2) {
  38217. return $recv(self["@stream"])._nextPut_(",");
  38218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38219. }));
  38220. $1=self["@stream"];
  38221. $recv($1)._nextPutAll_("){");
  38222. $ctx1.sendIdx["nextPutAll:"]=3;
  38223. $2=$recv($1)._lf();
  38224. $ctx1.sendIdx["lf"]=1;
  38225. $3=self["@stream"];
  38226. $recv($3)._nextPutAll_("var self=this;");
  38227. $ctx1.sendIdx["nextPutAll:"]=4;
  38228. $4=$recv($3)._lf();
  38229. $ctx1.sendIdx["lf"]=2;
  38230. $recv(aBlock)._value();
  38231. $5=self["@stream"];
  38232. $recv($5)._lf();
  38233. $recv($5)._nextPutAll_("}");
  38234. return self;
  38235. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  38236. },
  38237. args: ["aBlock", "anArray"],
  38238. 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: '}'",
  38239. referencedClasses: [],
  38240. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  38241. }),
  38242. $globals.JSStream);
  38243. $core.addMethod(
  38244. $core.method({
  38245. selector: "nextPutIf:then:",
  38246. protocol: 'streaming',
  38247. fn: function (aBlock,anotherBlock){
  38248. var self=this;
  38249. return $core.withContext(function($ctx1) {
  38250. var $1;
  38251. $recv(self["@stream"])._nextPutAll_("if(");
  38252. $ctx1.sendIdx["nextPutAll:"]=1;
  38253. $recv(aBlock)._value();
  38254. $ctx1.sendIdx["value"]=1;
  38255. $1=self["@stream"];
  38256. $recv($1)._nextPutAll_("){");
  38257. $ctx1.sendIdx["nextPutAll:"]=2;
  38258. $recv($1)._lf();
  38259. $recv(anotherBlock)._value();
  38260. $recv(self["@stream"])._nextPutAll_("}");
  38261. return self;
  38262. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  38263. },
  38264. args: ["aBlock", "anotherBlock"],
  38265. source: "nextPutIf: aBlock then: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  38266. referencedClasses: [],
  38267. messageSends: ["nextPutAll:", "value", "lf"]
  38268. }),
  38269. $globals.JSStream);
  38270. $core.addMethod(
  38271. $core.method({
  38272. selector: "nextPutIf:then:else:",
  38273. protocol: 'streaming',
  38274. fn: function (aBlock,ifBlock,elseBlock){
  38275. var self=this;
  38276. return $core.withContext(function($ctx1) {
  38277. var $1,$2,$3;
  38278. $recv(self["@stream"])._nextPutAll_("if(");
  38279. $ctx1.sendIdx["nextPutAll:"]=1;
  38280. $recv(aBlock)._value();
  38281. $ctx1.sendIdx["value"]=1;
  38282. $1=self["@stream"];
  38283. $recv($1)._nextPutAll_("){");
  38284. $ctx1.sendIdx["nextPutAll:"]=2;
  38285. $2=$recv($1)._lf();
  38286. $ctx1.sendIdx["lf"]=1;
  38287. $recv(ifBlock)._value();
  38288. $ctx1.sendIdx["value"]=2;
  38289. $3=self["@stream"];
  38290. $recv($3)._nextPutAll_("} else {");
  38291. $ctx1.sendIdx["nextPutAll:"]=3;
  38292. $recv($3)._lf();
  38293. $recv(elseBlock)._value();
  38294. $recv(self["@stream"])._nextPutAll_("}");
  38295. return self;
  38296. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  38297. },
  38298. args: ["aBlock", "ifBlock", "elseBlock"],
  38299. source: "nextPutIf: aBlock then: ifBlock else: elseBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09ifBlock value.\x0a\x09stream nextPutAll: '} else {'; lf.\x0a\x09elseBlock value.\x0a\x09stream nextPutAll: '}'",
  38300. referencedClasses: [],
  38301. messageSends: ["nextPutAll:", "value", "lf"]
  38302. }),
  38303. $globals.JSStream);
  38304. $core.addMethod(
  38305. $core.method({
  38306. selector: "nextPutMethodDeclaration:with:",
  38307. protocol: 'streaming',
  38308. fn: function (aMethod,aBlock){
  38309. var self=this;
  38310. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  38311. return $core.withContext(function($ctx1) {
  38312. var $1,$4,$3,$2,$7,$6,$5,$8,$9,$12,$11,$10,$15,$14,$13,$18,$17,$16,$19,$20;
  38313. $1=self["@stream"];
  38314. $recv($1)._nextPutAll_("$core.method({");
  38315. $ctx1.sendIdx["nextPutAll:"]=1;
  38316. $recv($1)._lf();
  38317. $ctx1.sendIdx["lf"]=1;
  38318. $4=$recv($recv(aMethod)._selector())._asJavascript();
  38319. $ctx1.sendIdx["asJavascript"]=1;
  38320. $3="selector: ".__comma($4);
  38321. $ctx1.sendIdx[","]=2;
  38322. $2=$recv($3).__comma(",");
  38323. $ctx1.sendIdx[","]=1;
  38324. $recv($1)._nextPutAll_($2);
  38325. $ctx1.sendIdx["nextPutAll:"]=2;
  38326. $recv($1)._lf();
  38327. $ctx1.sendIdx["lf"]=2;
  38328. $7=$recv($recv(aMethod)._source())._asJavascript();
  38329. $ctx1.sendIdx["asJavascript"]=2;
  38330. $6="source: ".__comma($7);
  38331. $ctx1.sendIdx[","]=4;
  38332. $5=$recv($6).__comma(",");
  38333. $ctx1.sendIdx[","]=3;
  38334. $recv($1)._nextPutAll_($5);
  38335. $ctx1.sendIdx["nextPutAll:"]=3;
  38336. $8=$recv($1)._lf();
  38337. $ctx1.sendIdx["lf"]=3;
  38338. $recv(aBlock)._value();
  38339. $ctx1.sendIdx["value"]=1;
  38340. $9=self["@stream"];
  38341. $12=$recv($String())._lf();
  38342. $ctx1.sendIdx["lf"]=4;
  38343. $11=",".__comma($12);
  38344. $ctx1.sendIdx[","]=6;
  38345. $10=$recv($11).__comma("messageSends: ");
  38346. $ctx1.sendIdx[","]=5;
  38347. $recv($9)._nextPutAll_($10);
  38348. $ctx1.sendIdx["nextPutAll:"]=4;
  38349. $15=$recv($recv(aMethod)._messageSends())._asArray();
  38350. $ctx1.sendIdx["asArray"]=1;
  38351. $14=$recv($15)._asJavascript();
  38352. $ctx1.sendIdx["asJavascript"]=3;
  38353. $13=$recv($14).__comma(",");
  38354. $ctx1.sendIdx[","]=7;
  38355. $recv($9)._nextPutAll_($13);
  38356. $ctx1.sendIdx["nextPutAll:"]=5;
  38357. $recv($9)._lf();
  38358. $ctx1.sendIdx["lf"]=5;
  38359. $18=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  38360. return $core.withContext(function($ctx2) {
  38361. return $recv(each)._value();
  38362. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38363. })))._asArray())._asJavascript();
  38364. $ctx1.sendIdx["asJavascript"]=4;
  38365. $17="args: ".__comma($18);
  38366. $16=$recv($17).__comma(",");
  38367. $ctx1.sendIdx[","]=8;
  38368. $recv($9)._nextPutAll_($16);
  38369. $ctx1.sendIdx["nextPutAll:"]=6;
  38370. $recv($9)._lf();
  38371. $19=$recv($9)._nextPutAll_("referencedClasses: [");
  38372. $ctx1.sendIdx["nextPutAll:"]=7;
  38373. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  38374. return $core.withContext(function($ctx2) {
  38375. return $recv(self["@stream"])._nextPutAll_($recv(each)._asJavascript());
  38376. $ctx2.sendIdx["nextPutAll:"]=8;
  38377. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38378. }),(function(){
  38379. return $core.withContext(function($ctx2) {
  38380. return $recv(self["@stream"])._nextPutAll_(",");
  38381. $ctx2.sendIdx["nextPutAll:"]=9;
  38382. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  38383. }));
  38384. $20=self["@stream"];
  38385. $recv($20)._nextPutAll_("]");
  38386. $ctx1.sendIdx["nextPutAll:"]=10;
  38387. $recv($20)._nextPutAll_("})");
  38388. return self;
  38389. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  38390. },
  38391. args: ["aMethod", "aBlock"],
  38392. 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: '})'",
  38393. referencedClasses: ["String"],
  38394. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  38395. }),
  38396. $globals.JSStream);
  38397. $core.addMethod(
  38398. $core.method({
  38399. selector: "nextPutNonLocalReturnHandlingWith:",
  38400. protocol: 'streaming',
  38401. fn: function (aBlock){
  38402. var self=this;
  38403. return $core.withContext(function($ctx1) {
  38404. var $1,$2,$3;
  38405. $1=self["@stream"];
  38406. $recv($1)._nextPutAll_("var $early={};");
  38407. $ctx1.sendIdx["nextPutAll:"]=1;
  38408. $recv($1)._lf();
  38409. $ctx1.sendIdx["lf"]=1;
  38410. $recv($1)._nextPutAll_("try {");
  38411. $ctx1.sendIdx["nextPutAll:"]=2;
  38412. $2=$recv($1)._lf();
  38413. $ctx1.sendIdx["lf"]=2;
  38414. $recv(aBlock)._value();
  38415. $3=self["@stream"];
  38416. $recv($3)._nextPutAll_("}");
  38417. $ctx1.sendIdx["nextPutAll:"]=3;
  38418. $recv($3)._lf();
  38419. $ctx1.sendIdx["lf"]=3;
  38420. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  38421. $recv($3)._lf();
  38422. return self;
  38423. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  38424. },
  38425. args: ["aBlock"],
  38426. 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",
  38427. referencedClasses: [],
  38428. messageSends: ["nextPutAll:", "lf", "value"]
  38429. }),
  38430. $globals.JSStream);
  38431. $core.addMethod(
  38432. $core.method({
  38433. selector: "nextPutNonLocalReturnWith:",
  38434. protocol: 'streaming',
  38435. fn: function (aBlock){
  38436. var self=this;
  38437. return $core.withContext(function($ctx1) {
  38438. $recv(self["@stream"])._nextPutAll_("throw $early=[");
  38439. $ctx1.sendIdx["nextPutAll:"]=1;
  38440. $recv(aBlock)._value();
  38441. $recv(self["@stream"])._nextPutAll_("]");
  38442. return self;
  38443. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  38444. },
  38445. args: ["aBlock"],
  38446. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  38447. referencedClasses: [],
  38448. messageSends: ["nextPutAll:", "value"]
  38449. }),
  38450. $globals.JSStream);
  38451. $core.addMethod(
  38452. $core.method({
  38453. selector: "nextPutReturnWith:",
  38454. protocol: 'streaming',
  38455. fn: function (aBlock){
  38456. var self=this;
  38457. return $core.withContext(function($ctx1) {
  38458. $recv(self["@stream"])._nextPutAll_("return ");
  38459. $recv(aBlock)._value();
  38460. return self;
  38461. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  38462. },
  38463. args: ["aBlock"],
  38464. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  38465. referencedClasses: [],
  38466. messageSends: ["nextPutAll:", "value"]
  38467. }),
  38468. $globals.JSStream);
  38469. $core.addMethod(
  38470. $core.method({
  38471. selector: "nextPutSendIndexFor:",
  38472. protocol: 'streaming',
  38473. fn: function (anIRSend){
  38474. var self=this;
  38475. return $core.withContext(function($ctx1) {
  38476. self._nextPutAll_(";");
  38477. $ctx1.sendIdx["nextPutAll:"]=1;
  38478. self._lf();
  38479. $ctx1.sendIdx["lf"]=1;
  38480. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38481. $ctx1.sendIdx["nextPutAll:"]=2;
  38482. self._lf();
  38483. $ctx1.sendIdx["lf"]=2;
  38484. self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  38485. $ctx1.sendIdx["nextPutAll:"]=3;
  38486. self._nextPutAll_(".sendIdx[");
  38487. $ctx1.sendIdx["nextPutAll:"]=4;
  38488. self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavascript());
  38489. $ctx1.sendIdx["nextPutAll:"]=5;
  38490. self._nextPutAll_("]=");
  38491. $ctx1.sendIdx["nextPutAll:"]=6;
  38492. self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  38493. $ctx1.sendIdx["nextPutAll:"]=7;
  38494. self._nextPutAll_(";");
  38495. $ctx1.sendIdx["nextPutAll:"]=8;
  38496. self._lf();
  38497. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  38498. return self;
  38499. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  38500. },
  38501. args: ["anIRSend"],
  38502. 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)'",
  38503. referencedClasses: [],
  38504. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavascript", "selector", "asString", "index"]
  38505. }),
  38506. $globals.JSStream);
  38507. $core.addMethod(
  38508. $core.method({
  38509. selector: "nextPutSequenceWith:",
  38510. protocol: 'streaming',
  38511. fn: function (aBlock){
  38512. var self=this;
  38513. return $core.withContext(function($ctx1) {
  38514. $recv(aBlock)._value();
  38515. return self;
  38516. }, function($ctx1) {$ctx1.fill(self,"nextPutSequenceWith:",{aBlock:aBlock},$globals.JSStream)});
  38517. },
  38518. args: ["aBlock"],
  38519. 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",
  38520. referencedClasses: [],
  38521. messageSends: ["value"]
  38522. }),
  38523. $globals.JSStream);
  38524. $core.addMethod(
  38525. $core.method({
  38526. selector: "nextPutStatementWith:",
  38527. protocol: 'streaming',
  38528. fn: function (aBlock){
  38529. var self=this;
  38530. return $core.withContext(function($ctx1) {
  38531. var $1;
  38532. $recv(aBlock)._value();
  38533. $1=self["@stream"];
  38534. $recv($1)._nextPutAll_(";");
  38535. $recv($1)._lf();
  38536. return self;
  38537. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  38538. },
  38539. args: ["aBlock"],
  38540. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  38541. referencedClasses: [],
  38542. messageSends: ["value", "nextPutAll:", "lf"]
  38543. }),
  38544. $globals.JSStream);
  38545. $core.addMethod(
  38546. $core.method({
  38547. selector: "nextPutVars:",
  38548. protocol: 'streaming',
  38549. fn: function (aCollection){
  38550. var self=this;
  38551. return $core.withContext(function($ctx1) {
  38552. var $1;
  38553. $recv(aCollection)._ifNotEmpty_((function(){
  38554. return $core.withContext(function($ctx2) {
  38555. $recv(self["@stream"])._nextPutAll_("var ");
  38556. $ctx2.sendIdx["nextPutAll:"]=1;
  38557. $recv(aCollection)._do_separatedBy_((function(each){
  38558. return $core.withContext(function($ctx3) {
  38559. return $recv(self["@stream"])._nextPutAll_(each);
  38560. $ctx3.sendIdx["nextPutAll:"]=2;
  38561. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  38562. }),(function(){
  38563. return $core.withContext(function($ctx3) {
  38564. return $recv(self["@stream"])._nextPutAll_(",");
  38565. $ctx3.sendIdx["nextPutAll:"]=3;
  38566. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  38567. }));
  38568. $1=self["@stream"];
  38569. $recv($1)._nextPutAll_(";");
  38570. return $recv($1)._lf();
  38571. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38572. }));
  38573. return self;
  38574. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  38575. },
  38576. args: ["aCollection"],
  38577. source: "nextPutVars: aCollection\x0a\x09aCollection ifNotEmpty: [\x0a\x09\x09stream nextPutAll: 'var '.\x0a\x09\x09aCollection\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09\x09stream nextPutAll: ';'; lf ]",
  38578. referencedClasses: [],
  38579. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  38580. }),
  38581. $globals.JSStream);
  38582. $core.addMethod(
  38583. $core.method({
  38584. selector: "appendToInstruction:",
  38585. protocol: '*Compiler-IR',
  38586. fn: function (anIRInstruction){
  38587. var self=this;
  38588. return $core.withContext(function($ctx1) {
  38589. $recv(anIRInstruction)._appendBlock_(self);
  38590. return self;
  38591. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  38592. },
  38593. args: ["anIRInstruction"],
  38594. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  38595. referencedClasses: [],
  38596. messageSends: ["appendBlock:"]
  38597. }),
  38598. $globals.BlockClosure);
  38599. });
  38600. define("amber_core/Compiler-Inlining", ["amber/boot", "amber_core/Compiler-IR", "amber_core/Kernel-Objects", "amber_core/Compiler-Core", "amber_core/Compiler-Semantic"], function($boot){"use strict";
  38601. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  38602. $core.addPackage('Compiler-Inlining');
  38603. $core.packages["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
  38604. $core.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  38605. $core.addClass('IRInlinedAssignment', $globals.IRAssignment, [], 'Compiler-Inlining');
  38606. $globals.IRInlinedAssignment.comment="I represent an inlined assignment instruction.";
  38607. $core.addMethod(
  38608. $core.method({
  38609. selector: "accept:",
  38610. protocol: 'visiting',
  38611. fn: function (aVisitor){
  38612. var self=this;
  38613. return $core.withContext(function($ctx1) {
  38614. return $recv(aVisitor)._visitIRInlinedAssignment_(self);
  38615. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedAssignment)});
  38616. },
  38617. args: ["aVisitor"],
  38618. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
  38619. referencedClasses: [],
  38620. messageSends: ["visitIRInlinedAssignment:"]
  38621. }),
  38622. $globals.IRInlinedAssignment);
  38623. $core.addMethod(
  38624. $core.method({
  38625. selector: "isInlined",
  38626. protocol: 'testing',
  38627. fn: function (){
  38628. var self=this;
  38629. return true;
  38630. },
  38631. args: [],
  38632. source: "isInlined\x0a\x09^ true",
  38633. referencedClasses: [],
  38634. messageSends: []
  38635. }),
  38636. $globals.IRInlinedAssignment);
  38637. $core.addClass('IRInlinedClosure', $globals.IRClosure, [], 'Compiler-Inlining');
  38638. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  38639. $core.addMethod(
  38640. $core.method({
  38641. selector: "accept:",
  38642. protocol: 'visiting',
  38643. fn: function (aVisitor){
  38644. var self=this;
  38645. return $core.withContext(function($ctx1) {
  38646. $recv(aVisitor)._visitIRInlinedClosure_(self);
  38647. return self;
  38648. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  38649. },
  38650. args: ["aVisitor"],
  38651. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  38652. referencedClasses: [],
  38653. messageSends: ["visitIRInlinedClosure:"]
  38654. }),
  38655. $globals.IRInlinedClosure);
  38656. $core.addMethod(
  38657. $core.method({
  38658. selector: "isInlined",
  38659. protocol: 'testing',
  38660. fn: function (){
  38661. var self=this;
  38662. return true;
  38663. },
  38664. args: [],
  38665. source: "isInlined\x0a\x09^ true",
  38666. referencedClasses: [],
  38667. messageSends: []
  38668. }),
  38669. $globals.IRInlinedClosure);
  38670. $core.addClass('IRInlinedReturn', $globals.IRReturn, [], 'Compiler-Inlining');
  38671. $globals.IRInlinedReturn.comment="I represent an inlined local return instruction.";
  38672. $core.addMethod(
  38673. $core.method({
  38674. selector: "accept:",
  38675. protocol: 'visiting',
  38676. fn: function (aVisitor){
  38677. var self=this;
  38678. return $core.withContext(function($ctx1) {
  38679. return $recv(aVisitor)._visitIRInlinedReturn_(self);
  38680. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedReturn)});
  38681. },
  38682. args: ["aVisitor"],
  38683. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
  38684. referencedClasses: [],
  38685. messageSends: ["visitIRInlinedReturn:"]
  38686. }),
  38687. $globals.IRInlinedReturn);
  38688. $core.addMethod(
  38689. $core.method({
  38690. selector: "isInlined",
  38691. protocol: 'testing',
  38692. fn: function (){
  38693. var self=this;
  38694. return true;
  38695. },
  38696. args: [],
  38697. source: "isInlined\x0a\x09^ true",
  38698. referencedClasses: [],
  38699. messageSends: []
  38700. }),
  38701. $globals.IRInlinedReturn);
  38702. $core.addClass('IRInlinedSend', $globals.IRSend, [], 'Compiler-Inlining');
  38703. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  38704. $core.addMethod(
  38705. $core.method({
  38706. selector: "accept:",
  38707. protocol: 'visiting',
  38708. fn: function (aVisitor){
  38709. var self=this;
  38710. return $core.withContext(function($ctx1) {
  38711. $recv(aVisitor)._visitInlinedSend_(self);
  38712. return self;
  38713. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  38714. },
  38715. args: ["aVisitor"],
  38716. source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  38717. referencedClasses: [],
  38718. messageSends: ["visitInlinedSend:"]
  38719. }),
  38720. $globals.IRInlinedSend);
  38721. $core.addMethod(
  38722. $core.method({
  38723. selector: "internalVariables",
  38724. protocol: 'accessing',
  38725. fn: function (){
  38726. var self=this;
  38727. return [];
  38728. },
  38729. args: [],
  38730. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  38731. referencedClasses: [],
  38732. messageSends: []
  38733. }),
  38734. $globals.IRInlinedSend);
  38735. $core.addMethod(
  38736. $core.method({
  38737. selector: "isInlined",
  38738. protocol: 'testing',
  38739. fn: function (){
  38740. var self=this;
  38741. return true;
  38742. },
  38743. args: [],
  38744. source: "isInlined\x0a\x09^ true",
  38745. referencedClasses: [],
  38746. messageSends: []
  38747. }),
  38748. $globals.IRInlinedSend);
  38749. $core.addClass('IRInlinedIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  38750. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  38751. $core.addMethod(
  38752. $core.method({
  38753. selector: "accept:",
  38754. protocol: 'visiting',
  38755. fn: function (aVisitor){
  38756. var self=this;
  38757. return $core.withContext(function($ctx1) {
  38758. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  38759. return self;
  38760. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  38761. },
  38762. args: ["aVisitor"],
  38763. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  38764. referencedClasses: [],
  38765. messageSends: ["visitIRInlinedIfFalse:"]
  38766. }),
  38767. $globals.IRInlinedIfFalse);
  38768. $core.addClass('IRInlinedIfNilIfNotNil', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  38769. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  38770. $core.addMethod(
  38771. $core.method({
  38772. selector: "accept:",
  38773. protocol: 'visiting',
  38774. fn: function (aVisitor){
  38775. var self=this;
  38776. return $core.withContext(function($ctx1) {
  38777. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  38778. return self;
  38779. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  38780. },
  38781. args: ["aVisitor"],
  38782. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  38783. referencedClasses: [],
  38784. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  38785. }),
  38786. $globals.IRInlinedIfNilIfNotNil);
  38787. $core.addMethod(
  38788. $core.method({
  38789. selector: "internalVariables",
  38790. protocol: 'accessing',
  38791. fn: function (){
  38792. var self=this;
  38793. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  38794. return $core.withContext(function($ctx1) {
  38795. return $recv($Array())._with_(self._receiverInternalVariable());
  38796. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  38797. },
  38798. args: [],
  38799. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  38800. referencedClasses: ["Array"],
  38801. messageSends: ["with:", "receiverInternalVariable"]
  38802. }),
  38803. $globals.IRInlinedIfNilIfNotNil);
  38804. $core.addMethod(
  38805. $core.method({
  38806. selector: "receiverInternalVariable",
  38807. protocol: 'accessing',
  38808. fn: function (){
  38809. var self=this;
  38810. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  38811. function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  38812. return $core.withContext(function($ctx1) {
  38813. var $1;
  38814. $1=$recv($IRVariable())._new();
  38815. $ctx1.sendIdx["new"]=1;
  38816. $recv($1)._variable_($recv($recv($AliasVar())._new())._name_(self._receiverInternalVariableName()));
  38817. return $recv($1)._yourself();
  38818. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  38819. },
  38820. args: [],
  38821. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  38822. referencedClasses: ["IRVariable", "AliasVar"],
  38823. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  38824. }),
  38825. $globals.IRInlinedIfNilIfNotNil);
  38826. $core.addMethod(
  38827. $core.method({
  38828. selector: "receiverInternalVariableName",
  38829. protocol: 'accessing',
  38830. fn: function (){
  38831. var self=this;
  38832. return "$receiver";
  38833. },
  38834. args: [],
  38835. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  38836. referencedClasses: [],
  38837. messageSends: []
  38838. }),
  38839. $globals.IRInlinedIfNilIfNotNil);
  38840. $core.addClass('IRInlinedIfTrue', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  38841. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  38842. $core.addMethod(
  38843. $core.method({
  38844. selector: "accept:",
  38845. protocol: 'visiting',
  38846. fn: function (aVisitor){
  38847. var self=this;
  38848. return $core.withContext(function($ctx1) {
  38849. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  38850. return self;
  38851. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  38852. },
  38853. args: ["aVisitor"],
  38854. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  38855. referencedClasses: [],
  38856. messageSends: ["visitIRInlinedIfTrue:"]
  38857. }),
  38858. $globals.IRInlinedIfTrue);
  38859. $core.addClass('IRInlinedIfTrueIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  38860. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  38861. $core.addMethod(
  38862. $core.method({
  38863. selector: "accept:",
  38864. protocol: 'visiting',
  38865. fn: function (aVisitor){
  38866. var self=this;
  38867. return $core.withContext(function($ctx1) {
  38868. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  38869. return self;
  38870. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  38871. },
  38872. args: ["aVisitor"],
  38873. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  38874. referencedClasses: [],
  38875. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  38876. }),
  38877. $globals.IRInlinedIfTrueIfFalse);
  38878. $core.addClass('IRInlinedSequence', $globals.IRBlockSequence, [], 'Compiler-Inlining');
  38879. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  38880. $core.addMethod(
  38881. $core.method({
  38882. selector: "accept:",
  38883. protocol: 'visiting',
  38884. fn: function (aVisitor){
  38885. var self=this;
  38886. return $core.withContext(function($ctx1) {
  38887. $recv(aVisitor)._visitIRInlinedSequence_(self);
  38888. return self;
  38889. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  38890. },
  38891. args: ["aVisitor"],
  38892. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  38893. referencedClasses: [],
  38894. messageSends: ["visitIRInlinedSequence:"]
  38895. }),
  38896. $globals.IRInlinedSequence);
  38897. $core.addMethod(
  38898. $core.method({
  38899. selector: "isInlined",
  38900. protocol: 'testing',
  38901. fn: function (){
  38902. var self=this;
  38903. return true;
  38904. },
  38905. args: [],
  38906. source: "isInlined\x0a\x09^ true",
  38907. referencedClasses: [],
  38908. messageSends: []
  38909. }),
  38910. $globals.IRInlinedSequence);
  38911. $core.addClass('IRInliner', $globals.IRVisitor, [], 'Compiler-Inlining');
  38912. $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`";
  38913. $core.addMethod(
  38914. $core.method({
  38915. selector: "assignmentInliner",
  38916. protocol: 'factory',
  38917. fn: function (){
  38918. var self=this;
  38919. function $IRAssignmentInliner(){return $globals.IRAssignmentInliner||(typeof IRAssignmentInliner=="undefined"?nil:IRAssignmentInliner)}
  38920. return $core.withContext(function($ctx1) {
  38921. var $1;
  38922. $1=$recv($IRAssignmentInliner())._new();
  38923. $recv($1)._translator_(self);
  38924. return $recv($1)._yourself();
  38925. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  38926. },
  38927. args: [],
  38928. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  38929. referencedClasses: ["IRAssignmentInliner"],
  38930. messageSends: ["translator:", "new", "yourself"]
  38931. }),
  38932. $globals.IRInliner);
  38933. $core.addMethod(
  38934. $core.method({
  38935. selector: "returnInliner",
  38936. protocol: 'factory',
  38937. fn: function (){
  38938. var self=this;
  38939. function $IRReturnInliner(){return $globals.IRReturnInliner||(typeof IRReturnInliner=="undefined"?nil:IRReturnInliner)}
  38940. return $core.withContext(function($ctx1) {
  38941. var $1;
  38942. $1=$recv($IRReturnInliner())._new();
  38943. $recv($1)._translator_(self);
  38944. return $recv($1)._yourself();
  38945. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  38946. },
  38947. args: [],
  38948. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  38949. referencedClasses: ["IRReturnInliner"],
  38950. messageSends: ["translator:", "new", "yourself"]
  38951. }),
  38952. $globals.IRInliner);
  38953. $core.addMethod(
  38954. $core.method({
  38955. selector: "sendInliner",
  38956. protocol: 'factory',
  38957. fn: function (){
  38958. var self=this;
  38959. function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  38960. return $core.withContext(function($ctx1) {
  38961. var $1;
  38962. $1=$recv($IRSendInliner())._new();
  38963. $recv($1)._translator_(self);
  38964. return $recv($1)._yourself();
  38965. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  38966. },
  38967. args: [],
  38968. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  38969. referencedClasses: ["IRSendInliner"],
  38970. messageSends: ["translator:", "new", "yourself"]
  38971. }),
  38972. $globals.IRInliner);
  38973. $core.addMethod(
  38974. $core.method({
  38975. selector: "shouldInlineAssignment:",
  38976. protocol: 'testing',
  38977. fn: function (anIRAssignment){
  38978. var self=this;
  38979. return $core.withContext(function($ctx1) {
  38980. var $4,$3,$2,$1;
  38981. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  38982. return $core.withContext(function($ctx2) {
  38983. $4=$recv(anIRAssignment)._instructions();
  38984. $ctx2.sendIdx["instructions"]=1;
  38985. $3=$recv($4)._last();
  38986. $ctx2.sendIdx["last"]=1;
  38987. $2=$recv($3)._isSend();
  38988. return $recv($2)._and_((function(){
  38989. return $core.withContext(function($ctx3) {
  38990. return self._shouldInlineSend_($recv($recv(anIRAssignment)._instructions())._last());
  38991. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  38992. }));
  38993. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38994. }));
  38995. $ctx1.sendIdx["and:"]=1;
  38996. return $1;
  38997. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  38998. },
  38999. args: ["anIRAssignment"],
  39000. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment instructions last isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRAssignment instructions last) ]]",
  39001. referencedClasses: [],
  39002. messageSends: ["and:", "not", "isInlined", "isSend", "last", "instructions", "shouldInlineSend:"]
  39003. }),
  39004. $globals.IRInliner);
  39005. $core.addMethod(
  39006. $core.method({
  39007. selector: "shouldInlineReturn:",
  39008. protocol: 'testing',
  39009. fn: function (anIRReturn){
  39010. var self=this;
  39011. return $core.withContext(function($ctx1) {
  39012. var $4,$3,$2,$1;
  39013. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  39014. return $core.withContext(function($ctx2) {
  39015. $4=$recv(anIRReturn)._instructions();
  39016. $ctx2.sendIdx["instructions"]=1;
  39017. $3=$recv($4)._first();
  39018. $ctx2.sendIdx["first"]=1;
  39019. $2=$recv($3)._isSend();
  39020. return $recv($2)._and_((function(){
  39021. return $core.withContext(function($ctx3) {
  39022. return self._shouldInlineSend_($recv($recv(anIRReturn)._instructions())._first());
  39023. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39024. }));
  39025. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39026. }));
  39027. $ctx1.sendIdx["and:"]=1;
  39028. return $1;
  39029. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  39030. },
  39031. args: ["anIRReturn"],
  39032. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn instructions first isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRReturn instructions first) ]]",
  39033. referencedClasses: [],
  39034. messageSends: ["and:", "not", "isInlined", "isSend", "first", "instructions", "shouldInlineSend:"]
  39035. }),
  39036. $globals.IRInliner);
  39037. $core.addMethod(
  39038. $core.method({
  39039. selector: "shouldInlineSend:",
  39040. protocol: 'testing',
  39041. fn: function (anIRSend){
  39042. var self=this;
  39043. function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  39044. return $core.withContext(function($ctx1) {
  39045. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  39046. return $core.withContext(function($ctx2) {
  39047. return $recv($IRSendInliner())._shouldInline_(anIRSend);
  39048. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39049. }));
  39050. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  39051. },
  39052. args: ["anIRSend"],
  39053. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  39054. referencedClasses: ["IRSendInliner"],
  39055. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  39056. }),
  39057. $globals.IRInliner);
  39058. $core.addMethod(
  39059. $core.method({
  39060. selector: "transformNonLocalReturn:",
  39061. protocol: 'visiting',
  39062. fn: function (anIRNonLocalReturn){
  39063. var self=this;
  39064. var localReturn;
  39065. function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  39066. return $core.withContext(function($ctx1) {
  39067. var $2,$1,$4,$3,$5,$6,$7;
  39068. $2=$recv(anIRNonLocalReturn)._scope();
  39069. $ctx1.sendIdx["scope"]=1;
  39070. $1=$recv($2)._canInlineNonLocalReturns();
  39071. if($core.assert($1)){
  39072. $4=$recv(anIRNonLocalReturn)._scope();
  39073. $ctx1.sendIdx["scope"]=2;
  39074. $3=$recv($4)._methodScope();
  39075. $5=$recv(anIRNonLocalReturn)._scope();
  39076. $ctx1.sendIdx["scope"]=3;
  39077. $recv($3)._removeNonLocalReturn_($5);
  39078. $6=$recv($IRReturn())._new();
  39079. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  39080. localReturn=$recv($6)._yourself();
  39081. localReturn;
  39082. $recv($recv(anIRNonLocalReturn)._instructions())._do_((function(each){
  39083. return $core.withContext(function($ctx2) {
  39084. return $recv(localReturn)._add_(each);
  39085. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39086. }));
  39087. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  39088. return localReturn;
  39089. };
  39090. $7=(
  39091. $ctx1.supercall = true,
  39092. ($globals.IRInliner.superclass||$boot.dnu).fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  39093. $ctx1.supercall = false;
  39094. return $7;
  39095. }, function($ctx1) {$ctx1.fill(self,"transformNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  39096. },
  39097. args: ["anIRNonLocalReturn"],
  39098. 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",
  39099. referencedClasses: ["IRReturn"],
  39100. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "instructions", "add:", "replaceWith:", "visitIRNonLocalReturn:"]
  39101. }),
  39102. $globals.IRInliner);
  39103. $core.addMethod(
  39104. $core.method({
  39105. selector: "visitIRAssignment:",
  39106. protocol: 'visiting',
  39107. fn: function (anIRAssignment){
  39108. var self=this;
  39109. return $core.withContext(function($ctx1) {
  39110. var $1;
  39111. $1=self._shouldInlineAssignment_(anIRAssignment);
  39112. if($core.assert($1)){
  39113. return $recv(self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  39114. } else {
  39115. return (
  39116. $ctx1.supercall = true,
  39117. ($globals.IRInliner.superclass||$boot.dnu).fn.prototype._visitIRAssignment_.apply($recv(self), [anIRAssignment]));
  39118. $ctx1.supercall = false;
  39119. };
  39120. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  39121. },
  39122. args: ["anIRAssignment"],
  39123. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  39124. referencedClasses: [],
  39125. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  39126. }),
  39127. $globals.IRInliner);
  39128. $core.addMethod(
  39129. $core.method({
  39130. selector: "visitIRNonLocalReturn:",
  39131. protocol: 'visiting',
  39132. fn: function (anIRNonLocalReturn){
  39133. var self=this;
  39134. return $core.withContext(function($ctx1) {
  39135. return self._transformNonLocalReturn_(anIRNonLocalReturn);
  39136. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRInliner)});
  39137. },
  39138. args: ["anIRNonLocalReturn"],
  39139. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self transformNonLocalReturn: anIRNonLocalReturn",
  39140. referencedClasses: [],
  39141. messageSends: ["transformNonLocalReturn:"]
  39142. }),
  39143. $globals.IRInliner);
  39144. $core.addMethod(
  39145. $core.method({
  39146. selector: "visitIRReturn:",
  39147. protocol: 'visiting',
  39148. fn: function (anIRReturn){
  39149. var self=this;
  39150. return $core.withContext(function($ctx1) {
  39151. var $1;
  39152. $1=self._shouldInlineReturn_(anIRReturn);
  39153. if($core.assert($1)){
  39154. return $recv(self._returnInliner())._inlineReturn_(anIRReturn);
  39155. } else {
  39156. return (
  39157. $ctx1.supercall = true,
  39158. ($globals.IRInliner.superclass||$boot.dnu).fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  39159. $ctx1.supercall = false;
  39160. };
  39161. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  39162. },
  39163. args: ["anIRReturn"],
  39164. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  39165. referencedClasses: [],
  39166. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  39167. }),
  39168. $globals.IRInliner);
  39169. $core.addMethod(
  39170. $core.method({
  39171. selector: "visitIRSend:",
  39172. protocol: 'visiting',
  39173. fn: function (anIRSend){
  39174. var self=this;
  39175. return $core.withContext(function($ctx1) {
  39176. var $1;
  39177. $1=self._shouldInlineSend_(anIRSend);
  39178. if($core.assert($1)){
  39179. return $recv(self._sendInliner())._inlineSend_(anIRSend);
  39180. } else {
  39181. return (
  39182. $ctx1.supercall = true,
  39183. ($globals.IRInliner.superclass||$boot.dnu).fn.prototype._visitIRSend_.apply($recv(self), [anIRSend]));
  39184. $ctx1.supercall = false;
  39185. };
  39186. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  39187. },
  39188. args: ["anIRSend"],
  39189. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  39190. referencedClasses: [],
  39191. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  39192. }),
  39193. $globals.IRInliner);
  39194. $core.addClass('IRInliningJSTranslator', $globals.IRJSTranslator, [], 'Compiler-Inlining');
  39195. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  39196. $core.addMethod(
  39197. $core.method({
  39198. selector: "visitIRInlinedAssignment:",
  39199. protocol: 'visiting',
  39200. fn: function (anIRInlinedAssignment){
  39201. var self=this;
  39202. return $core.withContext(function($ctx1) {
  39203. self._visit_($recv($recv(anIRInlinedAssignment)._instructions())._last());
  39204. return self;
  39205. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},$globals.IRInliningJSTranslator)});
  39206. },
  39207. args: ["anIRInlinedAssignment"],
  39208. source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last",
  39209. referencedClasses: [],
  39210. messageSends: ["visit:", "last", "instructions"]
  39211. }),
  39212. $globals.IRInliningJSTranslator);
  39213. $core.addMethod(
  39214. $core.method({
  39215. selector: "visitIRInlinedClosure:",
  39216. protocol: 'visiting',
  39217. fn: function (anIRInlinedClosure){
  39218. var self=this;
  39219. return $core.withContext(function($ctx1) {
  39220. $recv(self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  39221. return $core.withContext(function($ctx2) {
  39222. return $recv($recv(each)._name())._asVariableName();
  39223. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39224. })));
  39225. $recv($recv(anIRInlinedClosure)._instructions())._do_((function(each){
  39226. return $core.withContext(function($ctx2) {
  39227. return self._visit_(each);
  39228. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39229. }));
  39230. return self;
  39231. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  39232. },
  39233. args: ["anIRInlinedClosure"],
  39234. 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 ]",
  39235. referencedClasses: [],
  39236. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "instructions", "visit:"]
  39237. }),
  39238. $globals.IRInliningJSTranslator);
  39239. $core.addMethod(
  39240. $core.method({
  39241. selector: "visitIRInlinedIfFalse:",
  39242. protocol: 'visiting',
  39243. fn: function (anIRInlinedIfFalse){
  39244. var self=this;
  39245. return $core.withContext(function($ctx1) {
  39246. var $1,$2,$4,$3;
  39247. $1=self._stream();
  39248. $ctx1.sendIdx["stream"]=1;
  39249. $recv($1)._nextPutIf_then_((function(){
  39250. return $core.withContext(function($ctx2) {
  39251. $2=self._stream();
  39252. $ctx2.sendIdx["stream"]=2;
  39253. $recv($2)._nextPutAll_("!$core.assert(");
  39254. $ctx2.sendIdx["nextPutAll:"]=1;
  39255. $4=$recv(anIRInlinedIfFalse)._instructions();
  39256. $ctx2.sendIdx["instructions"]=1;
  39257. $3=$recv($4)._first();
  39258. self._visit_($3);
  39259. $ctx2.sendIdx["visit:"]=1;
  39260. return $recv(self._stream())._nextPutAll_(")");
  39261. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39262. }),(function(){
  39263. return $core.withContext(function($ctx2) {
  39264. return self._visit_($recv($recv(anIRInlinedIfFalse)._instructions())._last());
  39265. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39266. }));
  39267. return self;
  39268. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  39269. },
  39270. args: ["anIRInlinedIfFalse"],
  39271. source: "visitIRInlinedIfFalse: anIRInlinedIfFalse\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '!$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfFalse instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfFalse instructions last ]",
  39272. referencedClasses: [],
  39273. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
  39274. }),
  39275. $globals.IRInliningJSTranslator);
  39276. $core.addMethod(
  39277. $core.method({
  39278. selector: "visitIRInlinedIfNilIfNotNil:",
  39279. protocol: 'visiting',
  39280. fn: function (anIRInlinedIfNilIfNotNil){
  39281. var self=this;
  39282. return $core.withContext(function($ctx1) {
  39283. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  39284. $1=self._stream();
  39285. $ctx1.sendIdx["stream"]=1;
  39286. $recv($1)._nextPutIf_then_else_((function(){
  39287. var recvVarName;
  39288. return $core.withContext(function($ctx2) {
  39289. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  39290. recvVarName;
  39291. $2=self._stream();
  39292. $ctx2.sendIdx["stream"]=2;
  39293. $4="(".__comma(recvVarName);
  39294. $ctx2.sendIdx[","]=2;
  39295. $3=$recv($4).__comma(" = ");
  39296. $ctx2.sendIdx[","]=1;
  39297. $recv($2)._nextPutAll_($3);
  39298. $ctx2.sendIdx["nextPutAll:"]=1;
  39299. $6=$recv(anIRInlinedIfNilIfNotNil)._instructions();
  39300. $ctx2.sendIdx["instructions"]=1;
  39301. $5=$recv($6)._first();
  39302. self._visit_($5);
  39303. $ctx2.sendIdx["visit:"]=1;
  39304. $7=self._stream();
  39305. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".isNil");
  39306. $ctx2.sendIdx[","]=3;
  39307. return $recv($7)._nextPutAll_($8);
  39308. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  39309. }),(function(){
  39310. return $core.withContext(function($ctx2) {
  39311. $10=$recv(anIRInlinedIfNilIfNotNil)._instructions();
  39312. $ctx2.sendIdx["instructions"]=2;
  39313. $9=$recv($10)._second();
  39314. return self._visit_($9);
  39315. $ctx2.sendIdx["visit:"]=2;
  39316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39317. }),(function(){
  39318. return $core.withContext(function($ctx2) {
  39319. return self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._instructions())._third());
  39320. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39321. }));
  39322. return self;
  39323. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  39324. },
  39325. args: ["anIRInlinedIfNilIfNotNil"],
  39326. source: "visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil\x0a\x09self stream\x0a\x09\x09nextPutIf: [\x0a\x09\x09\x09| recvVarName |\x0a\x09\x09\x09recvVarName := anIRInlinedIfNilIfNotNil receiverInternalVariableName.\x0a\x09\x09\x09self stream nextPutAll: '(', recvVarName, ' = '.\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil instructions first.\x0a\x09\x09\x09self stream nextPutAll: ') == null || ', recvVarName, '.isNil' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfNilIfNotNil instructions second ]\x0a\x09\x09else: [ self visit: anIRInlinedIfNilIfNotNil instructions third ]",
  39327. referencedClasses: [],
  39328. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "instructions", "second", "third"]
  39329. }),
  39330. $globals.IRInliningJSTranslator);
  39331. $core.addMethod(
  39332. $core.method({
  39333. selector: "visitIRInlinedIfTrue:",
  39334. protocol: 'visiting',
  39335. fn: function (anIRInlinedIfTrue){
  39336. var self=this;
  39337. return $core.withContext(function($ctx1) {
  39338. var $1,$2,$4,$3;
  39339. $1=self._stream();
  39340. $ctx1.sendIdx["stream"]=1;
  39341. $recv($1)._nextPutIf_then_((function(){
  39342. return $core.withContext(function($ctx2) {
  39343. $2=self._stream();
  39344. $ctx2.sendIdx["stream"]=2;
  39345. $recv($2)._nextPutAll_("$core.assert(");
  39346. $ctx2.sendIdx["nextPutAll:"]=1;
  39347. $4=$recv(anIRInlinedIfTrue)._instructions();
  39348. $ctx2.sendIdx["instructions"]=1;
  39349. $3=$recv($4)._first();
  39350. self._visit_($3);
  39351. $ctx2.sendIdx["visit:"]=1;
  39352. return $recv(self._stream())._nextPutAll_(")");
  39353. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39354. }),(function(){
  39355. return $core.withContext(function($ctx2) {
  39356. return self._visit_($recv($recv(anIRInlinedIfTrue)._instructions())._last());
  39357. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39358. }));
  39359. return self;
  39360. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  39361. },
  39362. args: ["anIRInlinedIfTrue"],
  39363. source: "visitIRInlinedIfTrue: anIRInlinedIfTrue\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfTrue instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfTrue instructions last ]",
  39364. referencedClasses: [],
  39365. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
  39366. }),
  39367. $globals.IRInliningJSTranslator);
  39368. $core.addMethod(
  39369. $core.method({
  39370. selector: "visitIRInlinedIfTrueIfFalse:",
  39371. protocol: 'visiting',
  39372. fn: function (anIRInlinedIfTrueIfFalse){
  39373. var self=this;
  39374. return $core.withContext(function($ctx1) {
  39375. var $1,$2,$4,$3,$6,$5;
  39376. $1=self._stream();
  39377. $ctx1.sendIdx["stream"]=1;
  39378. $recv($1)._nextPutIf_then_else_((function(){
  39379. return $core.withContext(function($ctx2) {
  39380. $2=self._stream();
  39381. $ctx2.sendIdx["stream"]=2;
  39382. $recv($2)._nextPutAll_("$core.assert(");
  39383. $ctx2.sendIdx["nextPutAll:"]=1;
  39384. $4=$recv(anIRInlinedIfTrueIfFalse)._instructions();
  39385. $ctx2.sendIdx["instructions"]=1;
  39386. $3=$recv($4)._first();
  39387. self._visit_($3);
  39388. $ctx2.sendIdx["visit:"]=1;
  39389. return $recv(self._stream())._nextPutAll_(")");
  39390. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39391. }),(function(){
  39392. return $core.withContext(function($ctx2) {
  39393. $6=$recv(anIRInlinedIfTrueIfFalse)._instructions();
  39394. $ctx2.sendIdx["instructions"]=2;
  39395. $5=$recv($6)._second();
  39396. return self._visit_($5);
  39397. $ctx2.sendIdx["visit:"]=2;
  39398. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39399. }),(function(){
  39400. return $core.withContext(function($ctx2) {
  39401. return self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._instructions())._third());
  39402. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39403. }));
  39404. return self;
  39405. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  39406. },
  39407. args: ["anIRInlinedIfTrueIfFalse"],
  39408. source: "visitIRInlinedIfTrueIfFalse: anIRInlinedIfTrueIfFalse\x0a\x09self stream\x0a\x09\x09nextPutIf: [\x0a\x09\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09\x09self visit: anIRInlinedIfTrueIfFalse instructions first.\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfTrueIfFalse instructions second ]\x0a\x09\x09else: [ self visit: anIRInlinedIfTrueIfFalse instructions third ]",
  39409. referencedClasses: [],
  39410. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "instructions", "second", "third"]
  39411. }),
  39412. $globals.IRInliningJSTranslator);
  39413. $core.addMethod(
  39414. $core.method({
  39415. selector: "visitIRInlinedNonLocalReturn:",
  39416. protocol: 'visiting',
  39417. fn: function (anIRInlinedReturn){
  39418. var self=this;
  39419. return $core.withContext(function($ctx1) {
  39420. var $1;
  39421. $1=self._stream();
  39422. $ctx1.sendIdx["stream"]=1;
  39423. $recv($1)._nextPutStatementWith_((function(){
  39424. return $core.withContext(function($ctx2) {
  39425. return self._visit_($recv($recv(anIRInlinedReturn)._instructions())._last());
  39426. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39427. }));
  39428. $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
  39429. }));
  39430. return self;
  39431. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedNonLocalReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)});
  39432. },
  39433. args: ["anIRInlinedReturn"],
  39434. source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]",
  39435. referencedClasses: [],
  39436. messageSends: ["nextPutStatementWith:", "stream", "visit:", "last", "instructions", "nextPutNonLocalReturnWith:"]
  39437. }),
  39438. $globals.IRInliningJSTranslator);
  39439. $core.addMethod(
  39440. $core.method({
  39441. selector: "visitIRInlinedReturn:",
  39442. protocol: 'visiting',
  39443. fn: function (anIRInlinedReturn){
  39444. var self=this;
  39445. return $core.withContext(function($ctx1) {
  39446. self._visit_($recv($recv(anIRInlinedReturn)._instructions())._last());
  39447. return self;
  39448. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)});
  39449. },
  39450. args: ["anIRInlinedReturn"],
  39451. source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last",
  39452. referencedClasses: [],
  39453. messageSends: ["visit:", "last", "instructions"]
  39454. }),
  39455. $globals.IRInliningJSTranslator);
  39456. $core.addMethod(
  39457. $core.method({
  39458. selector: "visitIRInlinedSequence:",
  39459. protocol: 'visiting',
  39460. fn: function (anIRInlinedSequence){
  39461. var self=this;
  39462. return $core.withContext(function($ctx1) {
  39463. $recv($recv(anIRInlinedSequence)._instructions())._do_((function(each){
  39464. return $core.withContext(function($ctx2) {
  39465. return $recv(self._stream())._nextPutStatementWith_((function(){
  39466. return $core.withContext(function($ctx3) {
  39467. return self._visit_(each);
  39468. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39469. }));
  39470. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39471. }));
  39472. return self;
  39473. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRInliningJSTranslator)});
  39474. },
  39475. args: ["anIRInlinedSequence"],
  39476. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
  39477. referencedClasses: [],
  39478. messageSends: ["do:", "instructions", "nextPutStatementWith:", "stream", "visit:"]
  39479. }),
  39480. $globals.IRInliningJSTranslator);
  39481. $core.addClass('IRSendInliner', $globals.Object, ['send', 'translator'], 'Compiler-Inlining');
  39482. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  39483. $core.addMethod(
  39484. $core.method({
  39485. selector: "ifFalse:",
  39486. protocol: 'inlining',
  39487. fn: function (anIRInstruction){
  39488. var self=this;
  39489. function $IRInlinedIfFalse(){return $globals.IRInlinedIfFalse||(typeof IRInlinedIfFalse=="undefined"?nil:IRInlinedIfFalse)}
  39490. return $core.withContext(function($ctx1) {
  39491. return self._inlinedSend_withBlock_($recv($IRInlinedIfFalse())._new(),anIRInstruction);
  39492. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  39493. },
  39494. args: ["anIRInstruction"],
  39495. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  39496. referencedClasses: ["IRInlinedIfFalse"],
  39497. messageSends: ["inlinedSend:withBlock:", "new"]
  39498. }),
  39499. $globals.IRSendInliner);
  39500. $core.addMethod(
  39501. $core.method({
  39502. selector: "ifFalse:ifTrue:",
  39503. protocol: 'inlining',
  39504. fn: function (anIRInstruction,anotherIRInstruction){
  39505. var self=this;
  39506. return $core.withContext(function($ctx1) {
  39507. return self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  39508. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  39509. },
  39510. args: ["anIRInstruction", "anotherIRInstruction"],
  39511. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  39512. referencedClasses: [],
  39513. messageSends: ["perform:withArguments:"]
  39514. }),
  39515. $globals.IRSendInliner);
  39516. $core.addMethod(
  39517. $core.method({
  39518. selector: "ifNil:",
  39519. protocol: 'inlining',
  39520. fn: function (anIRInstruction){
  39521. var self=this;
  39522. function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  39523. function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  39524. function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  39525. return $core.withContext(function($ctx1) {
  39526. var $1,$3,$5,$6,$4,$2;
  39527. $1=$recv($IRInlinedIfNilIfNotNil())._new();
  39528. $ctx1.sendIdx["new"]=1;
  39529. $3=$recv($IRClosure())._new();
  39530. $ctx1.sendIdx["new"]=2;
  39531. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  39532. $5=$recv($IRBlockSequence())._new();
  39533. $recv($5)._add_($recv($recv(self._send())._instructions())._first());
  39534. $6=$recv($5)._yourself();
  39535. $ctx1.sendIdx["yourself"]=1;
  39536. $4=$6;
  39537. $recv($3)._add_($4);
  39538. $ctx1.sendIdx["add:"]=1;
  39539. $2=$recv($3)._yourself();
  39540. return self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  39541. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  39542. },
  39543. args: ["anIRInstruction"],
  39544. source: "ifNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09withBlock: anIRInstruction\x0a\x09\x09withBlock: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)",
  39545. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  39546. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
  39547. }),
  39548. $globals.IRSendInliner);
  39549. $core.addMethod(
  39550. $core.method({
  39551. selector: "ifNil:ifNotNil:",
  39552. protocol: 'inlining',
  39553. fn: function (anIRInstruction,anotherIRInstruction){
  39554. var self=this;
  39555. function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  39556. return $core.withContext(function($ctx1) {
  39557. return self._inlinedSend_withBlock_withBlock_($recv($IRInlinedIfNilIfNotNil())._new(),anIRInstruction,anotherIRInstruction);
  39558. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  39559. },
  39560. args: ["anIRInstruction", "anotherIRInstruction"],
  39561. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  39562. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  39563. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  39564. }),
  39565. $globals.IRSendInliner);
  39566. $core.addMethod(
  39567. $core.method({
  39568. selector: "ifNotNil:",
  39569. protocol: 'inlining',
  39570. fn: function (anIRInstruction){
  39571. var self=this;
  39572. function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  39573. function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  39574. function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  39575. return $core.withContext(function($ctx1) {
  39576. var $1,$3,$5,$6,$4,$2;
  39577. $1=$recv($IRInlinedIfNilIfNotNil())._new();
  39578. $ctx1.sendIdx["new"]=1;
  39579. $3=$recv($IRClosure())._new();
  39580. $ctx1.sendIdx["new"]=2;
  39581. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  39582. $5=$recv($IRBlockSequence())._new();
  39583. $recv($5)._add_($recv($recv(self._send())._instructions())._first());
  39584. $6=$recv($5)._yourself();
  39585. $ctx1.sendIdx["yourself"]=1;
  39586. $4=$6;
  39587. $recv($3)._add_($4);
  39588. $ctx1.sendIdx["add:"]=1;
  39589. $2=$recv($3)._yourself();
  39590. return self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  39591. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  39592. },
  39593. args: ["anIRInstruction"],
  39594. source: "ifNotNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09withBlock: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)\x0a\x09\x09withBlock: anIRInstruction",
  39595. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  39596. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
  39597. }),
  39598. $globals.IRSendInliner);
  39599. $core.addMethod(
  39600. $core.method({
  39601. selector: "ifNotNil:ifNil:",
  39602. protocol: 'inlining',
  39603. fn: function (anIRInstruction,anotherIRInstruction){
  39604. var self=this;
  39605. function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  39606. return $core.withContext(function($ctx1) {
  39607. return self._inlinedSend_withBlock_withBlock_($recv($IRInlinedIfNilIfNotNil())._new(),anotherIRInstruction,anIRInstruction);
  39608. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  39609. },
  39610. args: ["anIRInstruction", "anotherIRInstruction"],
  39611. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  39612. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  39613. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  39614. }),
  39615. $globals.IRSendInliner);
  39616. $core.addMethod(
  39617. $core.method({
  39618. selector: "ifTrue:",
  39619. protocol: 'inlining',
  39620. fn: function (anIRInstruction){
  39621. var self=this;
  39622. function $IRInlinedIfTrue(){return $globals.IRInlinedIfTrue||(typeof IRInlinedIfTrue=="undefined"?nil:IRInlinedIfTrue)}
  39623. return $core.withContext(function($ctx1) {
  39624. return self._inlinedSend_withBlock_($recv($IRInlinedIfTrue())._new(),anIRInstruction);
  39625. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  39626. },
  39627. args: ["anIRInstruction"],
  39628. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  39629. referencedClasses: ["IRInlinedIfTrue"],
  39630. messageSends: ["inlinedSend:withBlock:", "new"]
  39631. }),
  39632. $globals.IRSendInliner);
  39633. $core.addMethod(
  39634. $core.method({
  39635. selector: "ifTrue:ifFalse:",
  39636. protocol: 'inlining',
  39637. fn: function (anIRInstruction,anotherIRInstruction){
  39638. var self=this;
  39639. function $IRInlinedIfTrueIfFalse(){return $globals.IRInlinedIfTrueIfFalse||(typeof IRInlinedIfTrueIfFalse=="undefined"?nil:IRInlinedIfTrueIfFalse)}
  39640. return $core.withContext(function($ctx1) {
  39641. return self._inlinedSend_withBlock_withBlock_($recv($IRInlinedIfTrueIfFalse())._new(),anIRInstruction,anotherIRInstruction);
  39642. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  39643. },
  39644. args: ["anIRInstruction", "anotherIRInstruction"],
  39645. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  39646. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  39647. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  39648. }),
  39649. $globals.IRSendInliner);
  39650. $core.addMethod(
  39651. $core.method({
  39652. selector: "inlineClosure:",
  39653. protocol: 'inlining',
  39654. fn: function (anIRClosure){
  39655. var self=this;
  39656. var inlinedClosure,sequence,statements;
  39657. function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  39658. function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  39659. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  39660. function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  39661. return $core.withContext(function($ctx1) {
  39662. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8,$22,$21,$25,$24,$26,$23,$27,$30,$29,$28;
  39663. inlinedClosure=self._inlinedClosure();
  39664. $1=inlinedClosure;
  39665. $2=$recv(anIRClosure)._scope();
  39666. $ctx1.sendIdx["scope"]=1;
  39667. $recv($1)._scope_($2);
  39668. $ctx1.sendIdx["scope:"]=1;
  39669. $recv($1)._parent_($recv(anIRClosure)._parent());
  39670. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  39671. return $core.withContext(function($ctx2) {
  39672. return $recv(inlinedClosure)._add_(each);
  39673. $ctx2.sendIdx["add:"]=1;
  39674. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39675. }));
  39676. $ctx1.sendIdx["do:"]=1;
  39677. sequence=self._inlinedSequence();
  39678. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  39679. return $core.withContext(function($ctx2) {
  39680. $3=inlinedClosure;
  39681. $5=$recv($IRTempDeclaration())._new();
  39682. $ctx2.sendIdx["new"]=1;
  39683. $recv($5)._name_(each);
  39684. $ctx2.sendIdx["name:"]=1;
  39685. $6=$recv($5)._yourself();
  39686. $ctx2.sendIdx["yourself"]=1;
  39687. $4=$6;
  39688. $recv($3)._add_($4);
  39689. $ctx2.sendIdx["add:"]=2;
  39690. $7=sequence;
  39691. $9=$recv($IRAssignment())._new();
  39692. $ctx2.sendIdx["new"]=2;
  39693. $11=$recv($IRVariable())._new();
  39694. $ctx2.sendIdx["new"]=3;
  39695. $13=$recv($AliasVar())._new();
  39696. $ctx2.sendIdx["new"]=4;
  39697. $14=$recv(inlinedClosure)._scope();
  39698. $ctx2.sendIdx["scope"]=2;
  39699. $recv($13)._scope_($14);
  39700. $ctx2.sendIdx["scope:"]=2;
  39701. $recv($13)._name_(each);
  39702. $ctx2.sendIdx["name:"]=2;
  39703. $15=$recv($13)._yourself();
  39704. $ctx2.sendIdx["yourself"]=2;
  39705. $12=$15;
  39706. $10=$recv($11)._variable_($12);
  39707. $ctx2.sendIdx["variable:"]=1;
  39708. $recv($9)._add_($10);
  39709. $ctx2.sendIdx["add:"]=4;
  39710. $17=$recv($IRVariable())._new();
  39711. $ctx2.sendIdx["new"]=5;
  39712. $19=$recv($AliasVar())._new();
  39713. $recv($19)._scope_($recv(inlinedClosure)._scope());
  39714. $recv($19)._name_("$receiver");
  39715. $20=$recv($19)._yourself();
  39716. $ctx2.sendIdx["yourself"]=3;
  39717. $18=$20;
  39718. $16=$recv($17)._variable_($18);
  39719. $recv($9)._add_($16);
  39720. $ctx2.sendIdx["add:"]=5;
  39721. $8=$recv($9)._yourself();
  39722. return $recv($7)._add_($8);
  39723. $ctx2.sendIdx["add:"]=3;
  39724. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39725. }));
  39726. $ctx1.sendIdx["do:"]=2;
  39727. $recv(inlinedClosure)._add_(sequence);
  39728. $ctx1.sendIdx["add:"]=6;
  39729. $22=$recv(anIRClosure)._instructions();
  39730. $ctx1.sendIdx["instructions"]=2;
  39731. $21=$recv($22)._last();
  39732. $ctx1.sendIdx["last"]=1;
  39733. statements=$recv($21)._instructions();
  39734. $ctx1.sendIdx["instructions"]=1;
  39735. $recv(statements)._ifNotEmpty_((function(){
  39736. return $core.withContext(function($ctx2) {
  39737. $recv($recv(statements)._allButLast())._do_((function(each){
  39738. return $core.withContext(function($ctx3) {
  39739. return $recv(sequence)._add_(each);
  39740. $ctx3.sendIdx["add:"]=7;
  39741. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  39742. }));
  39743. $25=$recv(statements)._last();
  39744. $ctx2.sendIdx["last"]=2;
  39745. $24=$recv($25)._isReturn();
  39746. $23=$recv($24)._and_((function(){
  39747. return $core.withContext(function($ctx3) {
  39748. $26=$recv(statements)._last();
  39749. $ctx3.sendIdx["last"]=3;
  39750. return $recv($26)._isBlockReturn();
  39751. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  39752. }));
  39753. if($core.assert($23)){
  39754. $27=sequence;
  39755. $30=$recv(statements)._last();
  39756. $ctx2.sendIdx["last"]=4;
  39757. $29=$recv($30)._instructions();
  39758. $28=$recv($29)._first();
  39759. return $recv($27)._add_($28);
  39760. $ctx2.sendIdx["add:"]=8;
  39761. } else {
  39762. return $recv(sequence)._add_($recv(statements)._last());
  39763. };
  39764. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39765. }));
  39766. return inlinedClosure;
  39767. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  39768. },
  39769. args: ["anIRClosure"],
  39770. 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",
  39771. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  39772. 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"]
  39773. }),
  39774. $globals.IRSendInliner);
  39775. $core.addMethod(
  39776. $core.method({
  39777. selector: "inlineSend:",
  39778. protocol: 'inlining',
  39779. fn: function (anIRSend){
  39780. var self=this;
  39781. return $core.withContext(function($ctx1) {
  39782. var $2,$1;
  39783. self._send_(anIRSend);
  39784. $2=self._send();
  39785. $ctx1.sendIdx["send"]=1;
  39786. $1=$recv($2)._selector();
  39787. return self._perform_withArguments_($1,$recv($recv(self._send())._instructions())._allButFirst());
  39788. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  39789. },
  39790. args: ["anIRSend"],
  39791. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send instructions allButFirst",
  39792. referencedClasses: [],
  39793. messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"]
  39794. }),
  39795. $globals.IRSendInliner);
  39796. $core.addMethod(
  39797. $core.method({
  39798. selector: "inlinedClosure",
  39799. protocol: 'factory',
  39800. fn: function (){
  39801. var self=this;
  39802. function $IRInlinedClosure(){return $globals.IRInlinedClosure||(typeof IRInlinedClosure=="undefined"?nil:IRInlinedClosure)}
  39803. return $core.withContext(function($ctx1) {
  39804. return $recv($IRInlinedClosure())._new();
  39805. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  39806. },
  39807. args: [],
  39808. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  39809. referencedClasses: ["IRInlinedClosure"],
  39810. messageSends: ["new"]
  39811. }),
  39812. $globals.IRSendInliner);
  39813. $core.addMethod(
  39814. $core.method({
  39815. selector: "inlinedSend:withBlock:",
  39816. protocol: 'inlining',
  39817. fn: function (inlinedSend,anIRInstruction){
  39818. var self=this;
  39819. var inlinedClosure;
  39820. return $core.withContext(function($ctx1) {
  39821. var $1,$2,$5,$4,$3,$6;
  39822. $1=$recv(anIRInstruction)._isClosure();
  39823. if(!$core.assert($1)){
  39824. self._inliningError_("Message argument should be a block");
  39825. $ctx1.sendIdx["inliningError:"]=1;
  39826. };
  39827. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  39828. if(!$core.assert($2)){
  39829. self._inliningError_("Inlined block should have zero argument");
  39830. };
  39831. inlinedClosure=$recv(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  39832. $5=self._send();
  39833. $ctx1.sendIdx["send"]=1;
  39834. $4=$recv($5)._instructions();
  39835. $3=$recv($4)._first();
  39836. $recv(inlinedSend)._add_($3);
  39837. $ctx1.sendIdx["add:"]=1;
  39838. $recv(inlinedSend)._add_(inlinedClosure);
  39839. $recv(self._send())._replaceWith_(inlinedSend);
  39840. $6=$recv($recv(inlinedSend)._method())._internalVariables();
  39841. $ctx1.sendIdx["internalVariables"]=1;
  39842. $recv($6)._addAll_($recv(inlinedSend)._internalVariables());
  39843. return inlinedSend;
  39844. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  39845. },
  39846. args: ["inlinedSend", "anIRInstruction"],
  39847. source: "inlinedSend: inlinedSend withBlock: anIRInstruction\x0a\x09| inlinedClosure |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anIRInstruction arguments size = 0 ifFalse: [ self inliningError: 'Inlined block should have zero argument' ].\x0a\x0a\x09inlinedClosure := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x0a\x09^ inlinedSend",
  39848. referencedClasses: [],
  39849. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  39850. }),
  39851. $globals.IRSendInliner);
  39852. $core.addMethod(
  39853. $core.method({
  39854. selector: "inlinedSend:withBlock:withBlock:",
  39855. protocol: 'inlining',
  39856. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  39857. var self=this;
  39858. var inlinedClosure1,inlinedClosure2;
  39859. return $core.withContext(function($ctx1) {
  39860. var $1,$2,$3,$4,$7,$6,$5,$8;
  39861. $1=$recv(anIRInstruction)._isClosure();
  39862. $ctx1.sendIdx["isClosure"]=1;
  39863. if(!$core.assert($1)){
  39864. self._inliningError_("Message argument should be a block");
  39865. $ctx1.sendIdx["inliningError:"]=1;
  39866. };
  39867. $2=$recv(anotherIRInstruction)._isClosure();
  39868. if(!$core.assert($2)){
  39869. self._inliningError_("Message argument should be a block");
  39870. };
  39871. $3=self._translator();
  39872. $ctx1.sendIdx["translator"]=1;
  39873. $4=self._inlineClosure_(anIRInstruction);
  39874. $ctx1.sendIdx["inlineClosure:"]=1;
  39875. inlinedClosure1=$recv($3)._visit_($4);
  39876. $ctx1.sendIdx["visit:"]=1;
  39877. inlinedClosure2=$recv(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
  39878. $7=self._send();
  39879. $ctx1.sendIdx["send"]=1;
  39880. $6=$recv($7)._instructions();
  39881. $5=$recv($6)._first();
  39882. $recv(inlinedSend)._add_($5);
  39883. $ctx1.sendIdx["add:"]=1;
  39884. $recv(inlinedSend)._add_(inlinedClosure1);
  39885. $ctx1.sendIdx["add:"]=2;
  39886. $recv(inlinedSend)._add_(inlinedClosure2);
  39887. $recv(self._send())._replaceWith_(inlinedSend);
  39888. $8=$recv($recv(inlinedSend)._method())._internalVariables();
  39889. $ctx1.sendIdx["internalVariables"]=1;
  39890. $recv($8)._addAll_($recv(inlinedSend)._internalVariables());
  39891. return inlinedSend;
  39892. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  39893. },
  39894. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  39895. source: "inlinedSend: inlinedSend withBlock: anIRInstruction withBlock: anotherIRInstruction\x0a\x09| inlinedClosure1 inlinedClosure2 |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anotherIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x0a\x09inlinedClosure1 := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x09inlinedClosure2 := self translator visit: (self inlineClosure: anotherIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure1;\x0a\x09\x09add: inlinedClosure2.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x09\x09\x0a\x09^ inlinedSend",
  39896. referencedClasses: [],
  39897. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  39898. }),
  39899. $globals.IRSendInliner);
  39900. $core.addMethod(
  39901. $core.method({
  39902. selector: "inlinedSequence",
  39903. protocol: 'factory',
  39904. fn: function (){
  39905. var self=this;
  39906. function $IRInlinedSequence(){return $globals.IRInlinedSequence||(typeof IRInlinedSequence=="undefined"?nil:IRInlinedSequence)}
  39907. return $core.withContext(function($ctx1) {
  39908. return $recv($IRInlinedSequence())._new();
  39909. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  39910. },
  39911. args: [],
  39912. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  39913. referencedClasses: ["IRInlinedSequence"],
  39914. messageSends: ["new"]
  39915. }),
  39916. $globals.IRSendInliner);
  39917. $core.addMethod(
  39918. $core.method({
  39919. selector: "inliningError:",
  39920. protocol: 'error handling',
  39921. fn: function (aString){
  39922. var self=this;
  39923. function $InliningError(){return $globals.InliningError||(typeof InliningError=="undefined"?nil:InliningError)}
  39924. return $core.withContext(function($ctx1) {
  39925. $recv($InliningError())._signal_(aString);
  39926. return self;
  39927. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  39928. },
  39929. args: ["aString"],
  39930. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  39931. referencedClasses: ["InliningError"],
  39932. messageSends: ["signal:"]
  39933. }),
  39934. $globals.IRSendInliner);
  39935. $core.addMethod(
  39936. $core.method({
  39937. selector: "send",
  39938. protocol: 'accessing',
  39939. fn: function (){
  39940. var self=this;
  39941. return self["@send"];
  39942. },
  39943. args: [],
  39944. source: "send\x0a\x09^ send",
  39945. referencedClasses: [],
  39946. messageSends: []
  39947. }),
  39948. $globals.IRSendInliner);
  39949. $core.addMethod(
  39950. $core.method({
  39951. selector: "send:",
  39952. protocol: 'accessing',
  39953. fn: function (anIRSend){
  39954. var self=this;
  39955. self["@send"]=anIRSend;
  39956. return self;
  39957. },
  39958. args: ["anIRSend"],
  39959. source: "send: anIRSend\x0a\x09send := anIRSend",
  39960. referencedClasses: [],
  39961. messageSends: []
  39962. }),
  39963. $globals.IRSendInliner);
  39964. $core.addMethod(
  39965. $core.method({
  39966. selector: "translator",
  39967. protocol: 'accessing',
  39968. fn: function (){
  39969. var self=this;
  39970. return self["@translator"];
  39971. },
  39972. args: [],
  39973. source: "translator\x0a\x09^ translator",
  39974. referencedClasses: [],
  39975. messageSends: []
  39976. }),
  39977. $globals.IRSendInliner);
  39978. $core.addMethod(
  39979. $core.method({
  39980. selector: "translator:",
  39981. protocol: 'accessing',
  39982. fn: function (anASTTranslator){
  39983. var self=this;
  39984. self["@translator"]=anASTTranslator;
  39985. return self;
  39986. },
  39987. args: ["anASTTranslator"],
  39988. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  39989. referencedClasses: [],
  39990. messageSends: []
  39991. }),
  39992. $globals.IRSendInliner);
  39993. $core.addMethod(
  39994. $core.method({
  39995. selector: "inlinedSelectors",
  39996. protocol: 'accessing',
  39997. fn: function (){
  39998. var self=this;
  39999. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  40000. },
  40001. args: [],
  40002. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  40003. referencedClasses: [],
  40004. messageSends: []
  40005. }),
  40006. $globals.IRSendInliner.klass);
  40007. $core.addMethod(
  40008. $core.method({
  40009. selector: "shouldInline:",
  40010. protocol: 'accessing',
  40011. fn: function (anIRInstruction){
  40012. var self=this;
  40013. return $core.withContext(function($ctx1) {
  40014. var $1;
  40015. $1=$recv(self._inlinedSelectors())._includes_($recv(anIRInstruction)._selector());
  40016. if(!$core.assert($1)){
  40017. return false;
  40018. };
  40019. return $recv($recv($recv(anIRInstruction)._instructions())._allButFirst())._allSatisfy_((function(each){
  40020. return $core.withContext(function($ctx2) {
  40021. return $recv(each)._isClosure();
  40022. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40023. }));
  40024. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner.klass)});
  40025. },
  40026. args: ["anIRInstruction"],
  40027. source: "shouldInline: anIRInstruction\x0a\x09(self inlinedSelectors includes: anIRInstruction selector) ifFalse: [ ^ false ].\x0a\x09^ anIRInstruction instructions allButFirst allSatisfy: [ :each | each isClosure]",
  40028. referencedClasses: [],
  40029. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "allButFirst", "instructions", "isClosure"]
  40030. }),
  40031. $globals.IRSendInliner.klass);
  40032. $core.addClass('IRAssignmentInliner', $globals.IRSendInliner, ['assignment'], 'Compiler-Inlining');
  40033. $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};";
  40034. $core.addMethod(
  40035. $core.method({
  40036. selector: "assignment",
  40037. protocol: 'accessing',
  40038. fn: function (){
  40039. var self=this;
  40040. return self["@assignment"];
  40041. },
  40042. args: [],
  40043. source: "assignment\x0a\x09^ assignment",
  40044. referencedClasses: [],
  40045. messageSends: []
  40046. }),
  40047. $globals.IRAssignmentInliner);
  40048. $core.addMethod(
  40049. $core.method({
  40050. selector: "assignment:",
  40051. protocol: 'accessing',
  40052. fn: function (aNode){
  40053. var self=this;
  40054. self["@assignment"]=aNode;
  40055. return self;
  40056. },
  40057. args: ["aNode"],
  40058. source: "assignment: aNode\x0a\x09assignment := aNode",
  40059. referencedClasses: [],
  40060. messageSends: []
  40061. }),
  40062. $globals.IRAssignmentInliner);
  40063. $core.addMethod(
  40064. $core.method({
  40065. selector: "inlineAssignment:",
  40066. protocol: 'inlining',
  40067. fn: function (anIRAssignment){
  40068. var self=this;
  40069. var inlinedAssignment;
  40070. function $IRInlinedAssignment(){return $globals.IRInlinedAssignment||(typeof IRInlinedAssignment=="undefined"?nil:IRInlinedAssignment)}
  40071. return $core.withContext(function($ctx1) {
  40072. var $1;
  40073. self._assignment_(anIRAssignment);
  40074. inlinedAssignment=$recv($IRInlinedAssignment())._new();
  40075. $1=$recv(anIRAssignment)._instructions();
  40076. $ctx1.sendIdx["instructions"]=1;
  40077. $recv($1)._do_((function(each){
  40078. return $core.withContext(function($ctx2) {
  40079. return $recv(inlinedAssignment)._add_(each);
  40080. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40081. }));
  40082. $recv(anIRAssignment)._replaceWith_(inlinedAssignment);
  40083. self._inlineSend_($recv($recv(inlinedAssignment)._instructions())._last());
  40084. return inlinedAssignment;
  40085. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},$globals.IRAssignmentInliner)});
  40086. },
  40087. args: ["anIRAssignment"],
  40088. 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",
  40089. referencedClasses: ["IRInlinedAssignment"],
  40090. messageSends: ["assignment:", "new", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
  40091. }),
  40092. $globals.IRAssignmentInliner);
  40093. $core.addMethod(
  40094. $core.method({
  40095. selector: "inlineClosure:",
  40096. protocol: 'inlining',
  40097. fn: function (anIRClosure){
  40098. var self=this;
  40099. var inlinedClosure,statements;
  40100. function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  40101. return $core.withContext(function($ctx1) {
  40102. var $2,$1,$4,$3,$5,$7,$6;
  40103. inlinedClosure=(
  40104. $ctx1.supercall = true,
  40105. ($globals.IRAssignmentInliner.superclass||$boot.dnu).fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  40106. $ctx1.supercall = false;
  40107. $2=$recv(inlinedClosure)._instructions();
  40108. $ctx1.sendIdx["instructions"]=2;
  40109. $1=$recv($2)._last();
  40110. $ctx1.sendIdx["last"]=1;
  40111. statements=$recv($1)._instructions();
  40112. $ctx1.sendIdx["instructions"]=1;
  40113. $recv(statements)._ifNotEmpty_((function(){
  40114. return $core.withContext(function($ctx2) {
  40115. $4=$recv(statements)._last();
  40116. $ctx2.sendIdx["last"]=2;
  40117. $3=$recv($4)._canBeAssigned();
  40118. if($core.assert($3)){
  40119. $5=$recv(statements)._last();
  40120. $ctx2.sendIdx["last"]=3;
  40121. $7=$recv($IRAssignment())._new();
  40122. $recv($7)._add_($recv($recv(self._assignment())._instructions())._first());
  40123. $ctx2.sendIdx["add:"]=1;
  40124. $recv($7)._add_($recv($recv(statements)._last())._copy());
  40125. $6=$recv($7)._yourself();
  40126. return $recv($5)._replaceWith_($6);
  40127. };
  40128. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40129. }));
  40130. return inlinedClosure;
  40131. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,statements:statements},$globals.IRAssignmentInliner)});
  40132. },
  40133. args: ["anIRClosure"],
  40134. 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",
  40135. referencedClasses: ["IRAssignment"],
  40136. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "canBeAssigned", "replaceWith:", "add:", "new", "first", "assignment", "copy", "yourself"]
  40137. }),
  40138. $globals.IRAssignmentInliner);
  40139. $core.addClass('IRReturnInliner', $globals.IRSendInliner, [], 'Compiler-Inlining');
  40140. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  40141. $core.addMethod(
  40142. $core.method({
  40143. selector: "inlineClosure:",
  40144. protocol: 'inlining',
  40145. fn: function (anIRClosure){
  40146. var self=this;
  40147. var closure,statements;
  40148. function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  40149. return $core.withContext(function($ctx1) {
  40150. var $1,$3,$2,$4,$6,$5;
  40151. closure=(
  40152. $ctx1.supercall = true,
  40153. ($globals.IRReturnInliner.superclass||$boot.dnu).fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  40154. $ctx1.supercall = false;
  40155. $1=$recv($recv(closure)._instructions())._last();
  40156. $ctx1.sendIdx["last"]=1;
  40157. statements=$recv($1)._instructions();
  40158. $ctx1.sendIdx["instructions"]=1;
  40159. $recv(statements)._ifNotEmpty_((function(){
  40160. return $core.withContext(function($ctx2) {
  40161. $3=$recv(statements)._last();
  40162. $ctx2.sendIdx["last"]=2;
  40163. $2=$recv($3)._isReturn();
  40164. if(!$core.assert($2)){
  40165. $4=$recv(statements)._last();
  40166. $ctx2.sendIdx["last"]=3;
  40167. $6=$recv($IRReturn())._new();
  40168. $recv($6)._add_($recv($recv(statements)._last())._copy());
  40169. $5=$recv($6)._yourself();
  40170. return $recv($4)._replaceWith_($5);
  40171. };
  40172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40173. }));
  40174. return closure;
  40175. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},$globals.IRReturnInliner)});
  40176. },
  40177. args: ["anIRClosure"],
  40178. 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",
  40179. referencedClasses: ["IRReturn"],
  40180. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "isReturn", "replaceWith:", "add:", "new", "copy", "yourself"]
  40181. }),
  40182. $globals.IRReturnInliner);
  40183. $core.addMethod(
  40184. $core.method({
  40185. selector: "inlineReturn:",
  40186. protocol: 'inlining',
  40187. fn: function (anIRReturn){
  40188. var self=this;
  40189. var return_;
  40190. return $core.withContext(function($ctx1) {
  40191. var $1;
  40192. return_=self._inlinedReturn();
  40193. $1=$recv(anIRReturn)._instructions();
  40194. $ctx1.sendIdx["instructions"]=1;
  40195. $recv($1)._do_((function(each){
  40196. return $core.withContext(function($ctx2) {
  40197. return $recv(return_)._add_(each);
  40198. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40199. }));
  40200. $recv(anIRReturn)._replaceWith_(return_);
  40201. self._inlineSend_($recv($recv(return_)._instructions())._last());
  40202. return return_;
  40203. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_},$globals.IRReturnInliner)});
  40204. },
  40205. args: ["anIRReturn"],
  40206. 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",
  40207. referencedClasses: [],
  40208. messageSends: ["inlinedReturn", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
  40209. }),
  40210. $globals.IRReturnInliner);
  40211. $core.addMethod(
  40212. $core.method({
  40213. selector: "inlinedReturn",
  40214. protocol: 'factory',
  40215. fn: function (){
  40216. var self=this;
  40217. function $IRInlinedReturn(){return $globals.IRInlinedReturn||(typeof IRInlinedReturn=="undefined"?nil:IRInlinedReturn)}
  40218. return $core.withContext(function($ctx1) {
  40219. return $recv($IRInlinedReturn())._new();
  40220. }, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{},$globals.IRReturnInliner)});
  40221. },
  40222. args: [],
  40223. source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
  40224. referencedClasses: ["IRInlinedReturn"],
  40225. messageSends: ["new"]
  40226. }),
  40227. $globals.IRReturnInliner);
  40228. $core.addClass('InliningCodeGenerator', $globals.CodeGenerator, [], 'Compiler-Inlining');
  40229. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  40230. $core.addMethod(
  40231. $core.method({
  40232. selector: "compileNode:",
  40233. protocol: 'compiling',
  40234. fn: function (aNode){
  40235. var self=this;
  40236. var ir,stream;
  40237. return $core.withContext(function($ctx1) {
  40238. var $1;
  40239. $recv(self._semanticAnalyzer())._visit_(aNode);
  40240. $ctx1.sendIdx["visit:"]=1;
  40241. ir=$recv(self._translator())._visit_(aNode);
  40242. $ctx1.sendIdx["visit:"]=2;
  40243. $recv(self._inliner())._visit_(ir);
  40244. $ctx1.sendIdx["visit:"]=3;
  40245. $1=self._irTranslator();
  40246. $recv($1)._currentClass_(self._currentClass());
  40247. $recv($1)._visit_(ir);
  40248. return $recv($1)._contents();
  40249. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.InliningCodeGenerator)});
  40250. },
  40251. args: ["aNode"],
  40252. 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",
  40253. referencedClasses: [],
  40254. messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "currentClass:", "irTranslator", "currentClass", "contents"]
  40255. }),
  40256. $globals.InliningCodeGenerator);
  40257. $core.addMethod(
  40258. $core.method({
  40259. selector: "inliner",
  40260. protocol: 'compiling',
  40261. fn: function (){
  40262. var self=this;
  40263. function $IRInliner(){return $globals.IRInliner||(typeof IRInliner=="undefined"?nil:IRInliner)}
  40264. return $core.withContext(function($ctx1) {
  40265. return $recv($IRInliner())._new();
  40266. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  40267. },
  40268. args: [],
  40269. source: "inliner\x0a\x09^ IRInliner new",
  40270. referencedClasses: ["IRInliner"],
  40271. messageSends: ["new"]
  40272. }),
  40273. $globals.InliningCodeGenerator);
  40274. $core.addMethod(
  40275. $core.method({
  40276. selector: "irTranslator",
  40277. protocol: 'compiling',
  40278. fn: function (){
  40279. var self=this;
  40280. function $IRInliningJSTranslator(){return $globals.IRInliningJSTranslator||(typeof IRInliningJSTranslator=="undefined"?nil:IRInliningJSTranslator)}
  40281. return $core.withContext(function($ctx1) {
  40282. return $recv($IRInliningJSTranslator())._new();
  40283. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.InliningCodeGenerator)});
  40284. },
  40285. args: [],
  40286. source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
  40287. referencedClasses: ["IRInliningJSTranslator"],
  40288. messageSends: ["new"]
  40289. }),
  40290. $globals.InliningCodeGenerator);
  40291. $core.addClass('InliningError', $globals.SemanticError, [], 'Compiler-Inlining');
  40292. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  40293. });
  40294. define("amber_core/Compiler-Interpreter", ["amber/boot", "amber_core/Kernel-Methods", "amber_core/Compiler-Semantic", "amber_core/Kernel-Objects", "amber_core/Compiler-AST", "amber_core/Kernel-Exceptions"], function($boot){"use strict";
  40295. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  40296. $core.addPackage('Compiler-Interpreter');
  40297. $core.packages["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  40298. $core.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  40299. $core.addClass('AIBlockClosure', $globals.BlockClosure, ['node', 'outerContext'], 'Compiler-Interpreter');
  40300. $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`).";
  40301. $core.addMethod(
  40302. $core.method({
  40303. selector: "applyTo:arguments:",
  40304. protocol: 'evaluating',
  40305. fn: function (anObject,aCollection){
  40306. var self=this;
  40307. return $core.withContext(function($ctx1) {
  40308. self._interpreterError();
  40309. return self;
  40310. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  40311. },
  40312. args: ["anObject", "aCollection"],
  40313. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  40314. referencedClasses: [],
  40315. messageSends: ["interpreterError"]
  40316. }),
  40317. $globals.AIBlockClosure);
  40318. $core.addMethod(
  40319. $core.method({
  40320. selector: "compiledSource",
  40321. protocol: 'accessing',
  40322. fn: function (){
  40323. var self=this;
  40324. return "[ AST Block closure ]";
  40325. },
  40326. args: [],
  40327. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  40328. referencedClasses: [],
  40329. messageSends: []
  40330. }),
  40331. $globals.AIBlockClosure);
  40332. $core.addMethod(
  40333. $core.method({
  40334. selector: "currySelf",
  40335. protocol: 'converting',
  40336. fn: function (){
  40337. var self=this;
  40338. return $core.withContext(function($ctx1) {
  40339. self._interpreterError();
  40340. return self;
  40341. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  40342. },
  40343. args: [],
  40344. source: "currySelf\x0a\x09self interpreterError",
  40345. referencedClasses: [],
  40346. messageSends: ["interpreterError"]
  40347. }),
  40348. $globals.AIBlockClosure);
  40349. $core.addMethod(
  40350. $core.method({
  40351. selector: "initializeWithContext:node:",
  40352. protocol: 'initialization',
  40353. fn: function (aContext,aNode){
  40354. var self=this;
  40355. self["@node"]=aNode;
  40356. self["@outerContext"]=aContext;
  40357. return self;
  40358. },
  40359. args: ["aContext", "aNode"],
  40360. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  40361. referencedClasses: [],
  40362. messageSends: []
  40363. }),
  40364. $globals.AIBlockClosure);
  40365. $core.addMethod(
  40366. $core.method({
  40367. selector: "interpreterError",
  40368. protocol: 'error handling',
  40369. fn: function (){
  40370. var self=this;
  40371. function $ASTInterpreterError(){return $globals.ASTInterpreterError||(typeof ASTInterpreterError=="undefined"?nil:ASTInterpreterError)}
  40372. return $core.withContext(function($ctx1) {
  40373. $recv($ASTInterpreterError())._signal_("Method cannot be interpreted by the interpreter.");
  40374. return self;
  40375. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  40376. },
  40377. args: [],
  40378. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  40379. referencedClasses: ["ASTInterpreterError"],
  40380. messageSends: ["signal:"]
  40381. }),
  40382. $globals.AIBlockClosure);
  40383. $core.addMethod(
  40384. $core.method({
  40385. selector: "numArgs",
  40386. protocol: 'accessing',
  40387. fn: function (){
  40388. var self=this;
  40389. return $core.withContext(function($ctx1) {
  40390. return $recv($recv(self["@node"])._temps())._size();
  40391. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  40392. },
  40393. args: [],
  40394. source: "numArgs\x0a\x09^ node temps size",
  40395. referencedClasses: [],
  40396. messageSends: ["size", "temps"]
  40397. }),
  40398. $globals.AIBlockClosure);
  40399. $core.addMethod(
  40400. $core.method({
  40401. selector: "value",
  40402. protocol: 'evaluating',
  40403. fn: function (){
  40404. var self=this;
  40405. return $core.withContext(function($ctx1) {
  40406. return self._valueWithPossibleArguments_([]);
  40407. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  40408. },
  40409. args: [],
  40410. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  40411. referencedClasses: [],
  40412. messageSends: ["valueWithPossibleArguments:"]
  40413. }),
  40414. $globals.AIBlockClosure);
  40415. $core.addMethod(
  40416. $core.method({
  40417. selector: "value:",
  40418. protocol: 'evaluating',
  40419. fn: function (anArgument){
  40420. var self=this;
  40421. return $core.withContext(function($ctx1) {
  40422. return self._valueWithPossibleArguments_([anArgument]);
  40423. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  40424. },
  40425. args: ["anArgument"],
  40426. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  40427. referencedClasses: [],
  40428. messageSends: ["valueWithPossibleArguments:"]
  40429. }),
  40430. $globals.AIBlockClosure);
  40431. $core.addMethod(
  40432. $core.method({
  40433. selector: "value:value:",
  40434. protocol: 'evaluating',
  40435. fn: function (firstArgument,secondArgument){
  40436. var self=this;
  40437. return $core.withContext(function($ctx1) {
  40438. return self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  40439. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  40440. },
  40441. args: ["firstArgument", "secondArgument"],
  40442. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  40443. referencedClasses: [],
  40444. messageSends: ["valueWithPossibleArguments:"]
  40445. }),
  40446. $globals.AIBlockClosure);
  40447. $core.addMethod(
  40448. $core.method({
  40449. selector: "value:value:value:",
  40450. protocol: 'evaluating',
  40451. fn: function (firstArgument,secondArgument,thirdArgument){
  40452. var self=this;
  40453. return $core.withContext(function($ctx1) {
  40454. return self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  40455. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  40456. },
  40457. args: ["firstArgument", "secondArgument", "thirdArgument"],
  40458. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  40459. referencedClasses: [],
  40460. messageSends: ["valueWithPossibleArguments:"]
  40461. }),
  40462. $globals.AIBlockClosure);
  40463. $core.addMethod(
  40464. $core.method({
  40465. selector: "valueWithPossibleArguments:",
  40466. protocol: 'evaluating',
  40467. fn: function (aCollection){
  40468. var self=this;
  40469. var context,sequenceNode;
  40470. return $core.withContext(function($ctx1) {
  40471. var $1,$2,$3;
  40472. context=$recv(self["@outerContext"])._newInnerContext();
  40473. $1=$recv($recv($recv(self["@node"])._nodes())._first())._copy();
  40474. $recv($1)._parent_(nil);
  40475. sequenceNode=$recv($1)._yourself();
  40476. $recv($recv(sequenceNode)._temps())._do_((function(each){
  40477. return $core.withContext(function($ctx2) {
  40478. return $recv(context)._defineLocal_(each);
  40479. $ctx2.sendIdx["defineLocal:"]=1;
  40480. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40481. }));
  40482. $recv($recv(self["@node"])._parameters())._withIndexDo_((function(each,index){
  40483. return $core.withContext(function($ctx2) {
  40484. $recv(context)._defineLocal_(each);
  40485. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  40486. return nil;
  40487. })));
  40488. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  40489. }));
  40490. $2=$recv(context)._interpreter();
  40491. $ctx1.sendIdx["interpreter"]=1;
  40492. $recv($2)._node_(sequenceNode);
  40493. $recv($2)._enterNode();
  40494. $recv($2)._proceed();
  40495. $3=$recv(self["@outerContext"])._interpreter();
  40496. $ctx1.sendIdx["interpreter"]=2;
  40497. $recv($3)._setNonLocalReturnFromContext_(context);
  40498. return $recv($recv(context)._interpreter())._pop();
  40499. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  40500. },
  40501. args: ["aCollection"],
  40502. source: "valueWithPossibleArguments: aCollection\x0a\x09| context sequenceNode |\x0a\x09context := outerContext newInnerContext.\x0a\x0a\x09\x22Interpret a copy of the sequence node to avoid creating a new AIBlockClosure\x22\x0a\x09sequenceNode := node nodes first copy\x0a\x09\x09parent: nil;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals in the context\x22\x0a\x09sequenceNode temps do: [ :each |\x0a\x09\x09context defineLocal: each ].\x0a\x09\x09\x0a\x09\x22Populate the arguments into the context locals\x22\x09\x0a\x09node parameters withIndexDo: [ :each :index |\x0a\x09\x09context defineLocal: each.\x0a\x09\x09context localAt: each put: (aCollection at: index ifAbsent: [ nil ]) ].\x0a\x0a\x09\x22Interpret the first node of the BlockSequenceNode\x22\x0a\x09context interpreter\x0a\x09\x09node: sequenceNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed.\x0a\x09\x09\x0a\x09outerContext interpreter\x0a\x09\x09setNonLocalReturnFromContext: context.\x0a\x09\x09\x0a\x09^ context interpreter pop",
  40503. referencedClasses: [],
  40504. messageSends: ["newInnerContext", "parent:", "copy", "first", "nodes", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  40505. }),
  40506. $globals.AIBlockClosure);
  40507. $core.addMethod(
  40508. $core.method({
  40509. selector: "forContext:node:",
  40510. protocol: 'instance creation',
  40511. fn: function (aContext,aNode){
  40512. var self=this;
  40513. return $core.withContext(function($ctx1) {
  40514. var $1;
  40515. $1=self._new();
  40516. $recv($1)._initializeWithContext_node_(aContext,aNode);
  40517. return $recv($1)._yourself();
  40518. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.klass)});
  40519. },
  40520. args: ["aContext", "aNode"],
  40521. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  40522. referencedClasses: [],
  40523. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  40524. }),
  40525. $globals.AIBlockClosure.klass);
  40526. $core.addClass('AIContext', $globals.MethodContext, ['outerContext', 'innerContext', 'pc', 'locals', 'selector', 'index', 'sendIndexes', 'evaluatedSelector', 'ast', 'interpreter', 'supercall'], 'Compiler-Interpreter');
  40527. $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)";
  40528. $core.addMethod(
  40529. $core.method({
  40530. selector: "arguments",
  40531. protocol: 'interpreting',
  40532. fn: function (){
  40533. var self=this;
  40534. return $core.withContext(function($ctx1) {
  40535. return $recv($recv(self._ast())._arguments())._collect_((function(each){
  40536. return $core.withContext(function($ctx2) {
  40537. return self._localAt_ifAbsent_(each,(function(){
  40538. return $core.withContext(function($ctx3) {
  40539. return self._error_("Argument not in context");
  40540. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  40541. }));
  40542. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40543. }));
  40544. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  40545. },
  40546. args: [],
  40547. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  40548. referencedClasses: [],
  40549. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  40550. }),
  40551. $globals.AIContext);
  40552. $core.addMethod(
  40553. $core.method({
  40554. selector: "ast",
  40555. protocol: 'interpreting',
  40556. fn: function (){
  40557. var self=this;
  40558. return $core.withContext(function($ctx1) {
  40559. var $1,$2,$3,$receiver;
  40560. $1=self._isBlockContext();
  40561. if($core.assert($1)){
  40562. $2=self._outerContext();
  40563. return $recv($2)._ifNotNil_((function(context){
  40564. return $core.withContext(function($ctx2) {
  40565. return $recv(context)._ast();
  40566. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,2)});
  40567. }));
  40568. };
  40569. $3=self["@ast"];
  40570. if(($receiver = $3) == null || $receiver.isNil){
  40571. self._initializeAST();
  40572. } else {
  40573. $3;
  40574. };
  40575. return self["@ast"];
  40576. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  40577. },
  40578. args: [],
  40579. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  40580. referencedClasses: [],
  40581. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  40582. }),
  40583. $globals.AIContext);
  40584. $core.addMethod(
  40585. $core.method({
  40586. selector: "basicLocalAt:",
  40587. protocol: 'private',
  40588. fn: function (aString){
  40589. var self=this;
  40590. return $core.withContext(function($ctx1) {
  40591. return $recv(self._locals())._at_(aString);
  40592. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  40593. },
  40594. args: ["aString"],
  40595. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  40596. referencedClasses: [],
  40597. messageSends: ["at:", "locals"]
  40598. }),
  40599. $globals.AIContext);
  40600. $core.addMethod(
  40601. $core.method({
  40602. selector: "basicLocalAt:put:",
  40603. protocol: 'private',
  40604. fn: function (aString,anObject){
  40605. var self=this;
  40606. return $core.withContext(function($ctx1) {
  40607. $recv(self._locals())._at_put_(aString,anObject);
  40608. return self;
  40609. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  40610. },
  40611. args: ["aString", "anObject"],
  40612. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  40613. referencedClasses: [],
  40614. messageSends: ["at:put:", "locals"]
  40615. }),
  40616. $globals.AIContext);
  40617. $core.addMethod(
  40618. $core.method({
  40619. selector: "basicReceiver",
  40620. protocol: 'interpreting',
  40621. fn: function (){
  40622. var self=this;
  40623. return $core.withContext(function($ctx1) {
  40624. return self._localAt_("self");
  40625. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  40626. },
  40627. args: [],
  40628. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  40629. referencedClasses: [],
  40630. messageSends: ["localAt:"]
  40631. }),
  40632. $globals.AIContext);
  40633. $core.addMethod(
  40634. $core.method({
  40635. selector: "defineLocal:",
  40636. protocol: 'accessing',
  40637. fn: function (aString){
  40638. var self=this;
  40639. return $core.withContext(function($ctx1) {
  40640. $recv(self._locals())._at_put_(aString,nil);
  40641. return self;
  40642. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  40643. },
  40644. args: ["aString"],
  40645. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  40646. referencedClasses: [],
  40647. messageSends: ["at:put:", "locals"]
  40648. }),
  40649. $globals.AIContext);
  40650. $core.addMethod(
  40651. $core.method({
  40652. selector: "evaluate:on:",
  40653. protocol: 'evaluating',
  40654. fn: function (aString,anEvaluator){
  40655. var self=this;
  40656. return $core.withContext(function($ctx1) {
  40657. return $recv(anEvaluator)._evaluate_context_(aString,self);
  40658. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  40659. },
  40660. args: ["aString", "anEvaluator"],
  40661. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  40662. referencedClasses: [],
  40663. messageSends: ["evaluate:context:"]
  40664. }),
  40665. $globals.AIContext);
  40666. $core.addMethod(
  40667. $core.method({
  40668. selector: "evaluateNode:",
  40669. protocol: 'evaluating',
  40670. fn: function (aNode){
  40671. var self=this;
  40672. function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  40673. return $core.withContext(function($ctx1) {
  40674. var $1;
  40675. $1=$recv($ASTInterpreter())._new();
  40676. $recv($1)._context_(self);
  40677. $recv($1)._node_(aNode);
  40678. $recv($1)._enterNode();
  40679. $recv($1)._proceed();
  40680. return $recv($1)._result();
  40681. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  40682. },
  40683. args: ["aNode"],
  40684. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  40685. referencedClasses: ["ASTInterpreter"],
  40686. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  40687. }),
  40688. $globals.AIContext);
  40689. $core.addMethod(
  40690. $core.method({
  40691. selector: "evaluatedSelector",
  40692. protocol: 'accessing',
  40693. fn: function (){
  40694. var self=this;
  40695. return self["@evaluatedSelector"];
  40696. },
  40697. args: [],
  40698. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  40699. referencedClasses: [],
  40700. messageSends: []
  40701. }),
  40702. $globals.AIContext);
  40703. $core.addMethod(
  40704. $core.method({
  40705. selector: "evaluatedSelector:",
  40706. protocol: 'accessing',
  40707. fn: function (aString){
  40708. var self=this;
  40709. self["@evaluatedSelector"]=aString;
  40710. return self;
  40711. },
  40712. args: ["aString"],
  40713. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  40714. referencedClasses: [],
  40715. messageSends: []
  40716. }),
  40717. $globals.AIContext);
  40718. $core.addMethod(
  40719. $core.method({
  40720. selector: "index",
  40721. protocol: 'accessing',
  40722. fn: function (){
  40723. var self=this;
  40724. return $core.withContext(function($ctx1) {
  40725. var $1,$receiver;
  40726. $1=self["@index"];
  40727. if(($receiver = $1) == null || $receiver.isNil){
  40728. return (0);
  40729. } else {
  40730. return $1;
  40731. };
  40732. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  40733. },
  40734. args: [],
  40735. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  40736. referencedClasses: [],
  40737. messageSends: ["ifNil:"]
  40738. }),
  40739. $globals.AIContext);
  40740. $core.addMethod(
  40741. $core.method({
  40742. selector: "index:",
  40743. protocol: 'accessing',
  40744. fn: function (anInteger){
  40745. var self=this;
  40746. self["@index"]=anInteger;
  40747. return self;
  40748. },
  40749. args: ["anInteger"],
  40750. source: "index: anInteger\x0a\x09index := anInteger",
  40751. referencedClasses: [],
  40752. messageSends: []
  40753. }),
  40754. $globals.AIContext);
  40755. $core.addMethod(
  40756. $core.method({
  40757. selector: "initializeAST",
  40758. protocol: 'initialization',
  40759. fn: function (){
  40760. var self=this;
  40761. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  40762. return $core.withContext(function($ctx1) {
  40763. var $1;
  40764. $1=self._method();
  40765. $ctx1.sendIdx["method"]=1;
  40766. self["@ast"]=$recv($1)._ast();
  40767. $recv($recv($SemanticAnalyzer())._on_($recv(self._method())._methodClass()))._visit_(self["@ast"]);
  40768. return self;
  40769. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  40770. },
  40771. args: [],
  40772. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  40773. referencedClasses: ["SemanticAnalyzer"],
  40774. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  40775. }),
  40776. $globals.AIContext);
  40777. $core.addMethod(
  40778. $core.method({
  40779. selector: "initializeFromMethodContext:",
  40780. protocol: 'initialization',
  40781. fn: function (aMethodContext){
  40782. var self=this;
  40783. return $core.withContext(function($ctx1) {
  40784. var $1,$2,$3,$receiver;
  40785. self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  40786. self._index_($recv(aMethodContext)._index());
  40787. self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  40788. self._receiver_($recv(aMethodContext)._receiver());
  40789. self._supercall_($recv(aMethodContext)._supercall());
  40790. self._selector_($recv(aMethodContext)._selector());
  40791. $1=$recv(aMethodContext)._outerContext();
  40792. $ctx1.sendIdx["outerContext"]=1;
  40793. if(($receiver = $1) == null || $receiver.isNil){
  40794. $1;
  40795. } else {
  40796. var outer;
  40797. outer=$receiver;
  40798. $2=$recv(outer)._methodContext();
  40799. if(($receiver = $2) == null || $receiver.isNil){
  40800. $2;
  40801. } else {
  40802. self._outerContext_($recv(self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  40803. };
  40804. $3=$recv(aMethodContext)._locals();
  40805. $ctx1.sendIdx["locals"]=1;
  40806. $recv($3)._keysAndValuesDo_((function(key,value){
  40807. return $core.withContext(function($ctx2) {
  40808. return $recv(self._locals())._at_put_(key,value);
  40809. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  40810. }));
  40811. };
  40812. return self;
  40813. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  40814. },
  40815. args: ["aMethodContext"],
  40816. 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 ] ]",
  40817. referencedClasses: [],
  40818. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  40819. }),
  40820. $globals.AIContext);
  40821. $core.addMethod(
  40822. $core.method({
  40823. selector: "initializeInterpreter",
  40824. protocol: 'initialization',
  40825. fn: function (){
  40826. var self=this;
  40827. function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  40828. return $core.withContext(function($ctx1) {
  40829. var $1,$2,$receiver;
  40830. $1=$recv($ASTInterpreter())._new();
  40831. $recv($1)._context_(self);
  40832. self["@interpreter"]=$recv($1)._yourself();
  40833. $2=self._innerContext();
  40834. if(($receiver = $2) == null || $receiver.isNil){
  40835. $2;
  40836. } else {
  40837. self._setupInterpreter_(self["@interpreter"]);
  40838. };
  40839. return self;
  40840. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  40841. },
  40842. args: [],
  40843. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  40844. referencedClasses: ["ASTInterpreter"],
  40845. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  40846. }),
  40847. $globals.AIContext);
  40848. $core.addMethod(
  40849. $core.method({
  40850. selector: "initializeLocals",
  40851. protocol: 'initialization',
  40852. fn: function (){
  40853. var self=this;
  40854. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  40855. return $core.withContext(function($ctx1) {
  40856. self["@locals"]=$recv($Dictionary())._new();
  40857. $recv(self["@locals"])._at_put_("thisContext",self);
  40858. return self;
  40859. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  40860. },
  40861. args: [],
  40862. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  40863. referencedClasses: ["Dictionary"],
  40864. messageSends: ["new", "at:put:"]
  40865. }),
  40866. $globals.AIContext);
  40867. $core.addMethod(
  40868. $core.method({
  40869. selector: "innerContext",
  40870. protocol: 'accessing',
  40871. fn: function (){
  40872. var self=this;
  40873. return self["@innerContext"];
  40874. },
  40875. args: [],
  40876. source: "innerContext\x0a\x09^ innerContext",
  40877. referencedClasses: [],
  40878. messageSends: []
  40879. }),
  40880. $globals.AIContext);
  40881. $core.addMethod(
  40882. $core.method({
  40883. selector: "innerContext:",
  40884. protocol: 'accessing',
  40885. fn: function (anAIContext){
  40886. var self=this;
  40887. self["@innerContext"]=anAIContext;
  40888. return self;
  40889. },
  40890. args: ["anAIContext"],
  40891. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  40892. referencedClasses: [],
  40893. messageSends: []
  40894. }),
  40895. $globals.AIContext);
  40896. $core.addMethod(
  40897. $core.method({
  40898. selector: "interpreter",
  40899. protocol: 'interpreting',
  40900. fn: function (){
  40901. var self=this;
  40902. return $core.withContext(function($ctx1) {
  40903. var $1,$receiver;
  40904. $1=self["@interpreter"];
  40905. if(($receiver = $1) == null || $receiver.isNil){
  40906. self._initializeInterpreter();
  40907. } else {
  40908. $1;
  40909. };
  40910. return self["@interpreter"];
  40911. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  40912. },
  40913. args: [],
  40914. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  40915. referencedClasses: [],
  40916. messageSends: ["ifNil:", "initializeInterpreter"]
  40917. }),
  40918. $globals.AIContext);
  40919. $core.addMethod(
  40920. $core.method({
  40921. selector: "interpreter:",
  40922. protocol: 'interpreting',
  40923. fn: function (anInterpreter){
  40924. var self=this;
  40925. self["@interpreter"]=anInterpreter;
  40926. return self;
  40927. },
  40928. args: ["anInterpreter"],
  40929. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  40930. referencedClasses: [],
  40931. messageSends: []
  40932. }),
  40933. $globals.AIContext);
  40934. $core.addMethod(
  40935. $core.method({
  40936. selector: "isTopContext",
  40937. protocol: 'testing',
  40938. fn: function (){
  40939. var self=this;
  40940. return $core.withContext(function($ctx1) {
  40941. return $recv(self._innerContext())._isNil();
  40942. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  40943. },
  40944. args: [],
  40945. source: "isTopContext\x0a\x09^ self innerContext isNil",
  40946. referencedClasses: [],
  40947. messageSends: ["isNil", "innerContext"]
  40948. }),
  40949. $globals.AIContext);
  40950. $core.addMethod(
  40951. $core.method({
  40952. selector: "localAt:",
  40953. protocol: 'accessing',
  40954. fn: function (aString){
  40955. var self=this;
  40956. var context;
  40957. return $core.withContext(function($ctx1) {
  40958. context=self._lookupContextForLocal_(aString);
  40959. return $recv(context)._basicLocalAt_(aString);
  40960. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  40961. },
  40962. args: ["aString"],
  40963. 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",
  40964. referencedClasses: [],
  40965. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  40966. }),
  40967. $globals.AIContext);
  40968. $core.addMethod(
  40969. $core.method({
  40970. selector: "localAt:ifAbsent:",
  40971. protocol: 'accessing',
  40972. fn: function (aString,aBlock){
  40973. var self=this;
  40974. var context;
  40975. return $core.withContext(function($ctx1) {
  40976. var $early={};
  40977. try {
  40978. context=self._lookupContextForLocal_ifNone_(aString,(function(){
  40979. return $core.withContext(function($ctx2) {
  40980. throw $early=[$recv(aBlock)._value()];
  40981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40982. }));
  40983. return $recv(context)._basicLocalAt_(aString);
  40984. }
  40985. catch(e) {if(e===$early)return e[0]; throw e}
  40986. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  40987. },
  40988. args: ["aString", "aBlock"],
  40989. 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",
  40990. referencedClasses: [],
  40991. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  40992. }),
  40993. $globals.AIContext);
  40994. $core.addMethod(
  40995. $core.method({
  40996. selector: "localAt:put:",
  40997. protocol: 'accessing',
  40998. fn: function (aString,anObject){
  40999. var self=this;
  41000. var context;
  41001. return $core.withContext(function($ctx1) {
  41002. context=self._lookupContextForLocal_(aString);
  41003. $recv(context)._basicLocalAt_put_(aString,anObject);
  41004. return self;
  41005. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  41006. },
  41007. args: ["aString", "anObject"],
  41008. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  41009. referencedClasses: [],
  41010. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  41011. }),
  41012. $globals.AIContext);
  41013. $core.addMethod(
  41014. $core.method({
  41015. selector: "locals",
  41016. protocol: 'accessing',
  41017. fn: function (){
  41018. var self=this;
  41019. return $core.withContext(function($ctx1) {
  41020. var $1,$receiver;
  41021. $1=self["@locals"];
  41022. if(($receiver = $1) == null || $receiver.isNil){
  41023. self._initializeLocals();
  41024. } else {
  41025. $1;
  41026. };
  41027. return self["@locals"];
  41028. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  41029. },
  41030. args: [],
  41031. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  41032. referencedClasses: [],
  41033. messageSends: ["ifNil:", "initializeLocals"]
  41034. }),
  41035. $globals.AIContext);
  41036. $core.addMethod(
  41037. $core.method({
  41038. selector: "lookupContextForLocal:",
  41039. protocol: 'private',
  41040. fn: function (aString){
  41041. var self=this;
  41042. return $core.withContext(function($ctx1) {
  41043. return self._lookupContextForLocal_ifNone_(aString,(function(){
  41044. return $core.withContext(function($ctx2) {
  41045. return self._variableNotFound();
  41046. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41047. }));
  41048. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  41049. },
  41050. args: ["aString"],
  41051. 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 ]",
  41052. referencedClasses: [],
  41053. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  41054. }),
  41055. $globals.AIContext);
  41056. $core.addMethod(
  41057. $core.method({
  41058. selector: "lookupContextForLocal:ifNone:",
  41059. protocol: 'private',
  41060. fn: function (aString,aBlock){
  41061. var self=this;
  41062. return $core.withContext(function($ctx1) {
  41063. var $1;
  41064. return $recv(self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  41065. return self;
  41066. }),(function(){
  41067. return $core.withContext(function($ctx2) {
  41068. $1=self._outerContext();
  41069. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  41070. return $core.withContext(function($ctx3) {
  41071. return $recv(context)._lookupContextForLocal_(aString);
  41072. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  41073. }));
  41074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41075. }));
  41076. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  41077. },
  41078. args: ["aString", "aBlock"],
  41079. 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 ] ]",
  41080. referencedClasses: [],
  41081. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  41082. }),
  41083. $globals.AIContext);
  41084. $core.addMethod(
  41085. $core.method({
  41086. selector: "newInnerContext",
  41087. protocol: 'factory',
  41088. fn: function (){
  41089. var self=this;
  41090. return $core.withContext(function($ctx1) {
  41091. var $1;
  41092. $1=$recv(self._class())._new();
  41093. $recv($1)._outerContext_(self);
  41094. return $recv($1)._yourself();
  41095. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  41096. },
  41097. args: [],
  41098. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  41099. referencedClasses: [],
  41100. messageSends: ["outerContext:", "new", "class", "yourself"]
  41101. }),
  41102. $globals.AIContext);
  41103. $core.addMethod(
  41104. $core.method({
  41105. selector: "outerContext",
  41106. protocol: 'accessing',
  41107. fn: function (){
  41108. var self=this;
  41109. return self["@outerContext"];
  41110. },
  41111. args: [],
  41112. source: "outerContext\x0a\x09^ outerContext",
  41113. referencedClasses: [],
  41114. messageSends: []
  41115. }),
  41116. $globals.AIContext);
  41117. $core.addMethod(
  41118. $core.method({
  41119. selector: "outerContext:",
  41120. protocol: 'accessing',
  41121. fn: function (anAIContext){
  41122. var self=this;
  41123. return $core.withContext(function($ctx1) {
  41124. var $1,$receiver;
  41125. self["@outerContext"]=anAIContext;
  41126. $1=self["@outerContext"];
  41127. if(($receiver = $1) == null || $receiver.isNil){
  41128. $1;
  41129. } else {
  41130. var context;
  41131. context=$receiver;
  41132. $recv(context)._innerContext_(self);
  41133. };
  41134. return self;
  41135. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  41136. },
  41137. args: ["anAIContext"],
  41138. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  41139. referencedClasses: [],
  41140. messageSends: ["ifNotNil:", "innerContext:"]
  41141. }),
  41142. $globals.AIContext);
  41143. $core.addMethod(
  41144. $core.method({
  41145. selector: "receiver:",
  41146. protocol: 'interpreting',
  41147. fn: function (anObject){
  41148. var self=this;
  41149. return $core.withContext(function($ctx1) {
  41150. $recv(self._locals())._at_put_("self",anObject);
  41151. return self;
  41152. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  41153. },
  41154. args: ["anObject"],
  41155. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  41156. referencedClasses: [],
  41157. messageSends: ["at:put:", "locals"]
  41158. }),
  41159. $globals.AIContext);
  41160. $core.addMethod(
  41161. $core.method({
  41162. selector: "selector",
  41163. protocol: 'accessing',
  41164. fn: function (){
  41165. var self=this;
  41166. return self["@selector"];
  41167. },
  41168. args: [],
  41169. source: "selector\x0a\x09^ selector",
  41170. referencedClasses: [],
  41171. messageSends: []
  41172. }),
  41173. $globals.AIContext);
  41174. $core.addMethod(
  41175. $core.method({
  41176. selector: "selector:",
  41177. protocol: 'accessing',
  41178. fn: function (aString){
  41179. var self=this;
  41180. self["@selector"]=aString;
  41181. return self;
  41182. },
  41183. args: ["aString"],
  41184. source: "selector: aString\x0a\x09selector := aString",
  41185. referencedClasses: [],
  41186. messageSends: []
  41187. }),
  41188. $globals.AIContext);
  41189. $core.addMethod(
  41190. $core.method({
  41191. selector: "sendIndexAt:",
  41192. protocol: 'accessing',
  41193. fn: function (aString){
  41194. var self=this;
  41195. return $core.withContext(function($ctx1) {
  41196. return $recv(self._sendIndexes())._at_ifAbsent_(aString,(function(){
  41197. return (0);
  41198. }));
  41199. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  41200. },
  41201. args: ["aString"],
  41202. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  41203. referencedClasses: [],
  41204. messageSends: ["at:ifAbsent:", "sendIndexes"]
  41205. }),
  41206. $globals.AIContext);
  41207. $core.addMethod(
  41208. $core.method({
  41209. selector: "sendIndexes",
  41210. protocol: 'accessing',
  41211. fn: function (){
  41212. var self=this;
  41213. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  41214. return $core.withContext(function($ctx1) {
  41215. var $1,$receiver;
  41216. $1=self["@sendIndexes"];
  41217. if(($receiver = $1) == null || $receiver.isNil){
  41218. return $recv($Dictionary())._new();
  41219. } else {
  41220. return $1;
  41221. };
  41222. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  41223. },
  41224. args: [],
  41225. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  41226. referencedClasses: ["Dictionary"],
  41227. messageSends: ["ifNil:", "new"]
  41228. }),
  41229. $globals.AIContext);
  41230. $core.addMethod(
  41231. $core.method({
  41232. selector: "sendIndexes:",
  41233. protocol: 'accessing',
  41234. fn: function (aDictionary){
  41235. var self=this;
  41236. self["@sendIndexes"]=aDictionary;
  41237. return self;
  41238. },
  41239. args: ["aDictionary"],
  41240. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  41241. referencedClasses: [],
  41242. messageSends: []
  41243. }),
  41244. $globals.AIContext);
  41245. $core.addMethod(
  41246. $core.method({
  41247. selector: "setupInterpreter:",
  41248. protocol: 'interpreting',
  41249. fn: function (anInterpreter){
  41250. var self=this;
  41251. var currentNode;
  41252. function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  41253. return $core.withContext(function($ctx1) {
  41254. var $1,$2,$3,$6,$5,$4,$receiver;
  41255. $1=$recv($ASTPCNodeVisitor())._new();
  41256. $recv($1)._selector_(self._evaluatedSelector());
  41257. $recv($1)._context_(self);
  41258. $2=self._ast();
  41259. $ctx1.sendIdx["ast"]=1;
  41260. $recv($1)._visit_($2);
  41261. currentNode=$recv($1)._currentNode();
  41262. $3=$recv(self._ast())._sequenceNode();
  41263. if(($receiver = $3) == null || $receiver.isNil){
  41264. $3;
  41265. } else {
  41266. var sequence;
  41267. sequence=$receiver;
  41268. $recv($recv(sequence)._temps())._do_((function(each){
  41269. return $core.withContext(function($ctx2) {
  41270. return self._defineLocal_(each);
  41271. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41272. }));
  41273. $ctx1.sendIdx["do:"]=1;
  41274. };
  41275. $recv(anInterpreter)._node_(currentNode);
  41276. $6=self._innerContext();
  41277. $ctx1.sendIdx["innerContext"]=1;
  41278. $5=$recv($6)._arguments();
  41279. $4=$recv($5)._reversed();
  41280. $recv($4)._do_((function(each){
  41281. return $core.withContext(function($ctx2) {
  41282. return $recv(anInterpreter)._push_(each);
  41283. $ctx2.sendIdx["push:"]=1;
  41284. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  41285. }));
  41286. $recv(anInterpreter)._push_($recv(self._innerContext())._receiver());
  41287. return self;
  41288. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  41289. },
  41290. args: ["anInterpreter"],
  41291. 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)",
  41292. referencedClasses: ["ASTPCNodeVisitor"],
  41293. messageSends: ["selector:", "new", "evaluatedSelector", "context:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  41294. }),
  41295. $globals.AIContext);
  41296. $core.addMethod(
  41297. $core.method({
  41298. selector: "supercall",
  41299. protocol: 'interpreting',
  41300. fn: function (){
  41301. var self=this;
  41302. return $core.withContext(function($ctx1) {
  41303. var $1,$receiver;
  41304. $1=self["@supercall"];
  41305. if(($receiver = $1) == null || $receiver.isNil){
  41306. return false;
  41307. } else {
  41308. return $1;
  41309. };
  41310. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  41311. },
  41312. args: [],
  41313. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  41314. referencedClasses: [],
  41315. messageSends: ["ifNil:"]
  41316. }),
  41317. $globals.AIContext);
  41318. $core.addMethod(
  41319. $core.method({
  41320. selector: "supercall:",
  41321. protocol: 'interpreting',
  41322. fn: function (aBoolean){
  41323. var self=this;
  41324. self["@supercall"]=aBoolean;
  41325. return self;
  41326. },
  41327. args: ["aBoolean"],
  41328. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  41329. referencedClasses: [],
  41330. messageSends: []
  41331. }),
  41332. $globals.AIContext);
  41333. $core.addMethod(
  41334. $core.method({
  41335. selector: "variableNotFound",
  41336. protocol: 'error handling',
  41337. fn: function (){
  41338. var self=this;
  41339. return $core.withContext(function($ctx1) {
  41340. self._error_("Variable missing");
  41341. return self;
  41342. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  41343. },
  41344. args: [],
  41345. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  41346. referencedClasses: [],
  41347. messageSends: ["error:"]
  41348. }),
  41349. $globals.AIContext);
  41350. $core.addMethod(
  41351. $core.method({
  41352. selector: "fromMethodContext:",
  41353. protocol: 'instance creation',
  41354. fn: function (aMethodContext){
  41355. var self=this;
  41356. return $core.withContext(function($ctx1) {
  41357. var $1;
  41358. $1=self._new();
  41359. $recv($1)._initializeFromMethodContext_(aMethodContext);
  41360. return $recv($1)._yourself();
  41361. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.klass)});
  41362. },
  41363. args: ["aMethodContext"],
  41364. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  41365. referencedClasses: [],
  41366. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  41367. }),
  41368. $globals.AIContext.klass);
  41369. $core.addClass('AISemanticAnalyzer', $globals.SemanticAnalyzer, ['context'], 'Compiler-Interpreter');
  41370. $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.";
  41371. $core.addMethod(
  41372. $core.method({
  41373. selector: "context",
  41374. protocol: 'accessing',
  41375. fn: function (){
  41376. var self=this;
  41377. return self["@context"];
  41378. },
  41379. args: [],
  41380. source: "context\x0a\x09^ context",
  41381. referencedClasses: [],
  41382. messageSends: []
  41383. }),
  41384. $globals.AISemanticAnalyzer);
  41385. $core.addMethod(
  41386. $core.method({
  41387. selector: "context:",
  41388. protocol: 'accessing',
  41389. fn: function (anAIContext){
  41390. var self=this;
  41391. self["@context"]=anAIContext;
  41392. return self;
  41393. },
  41394. args: ["anAIContext"],
  41395. source: "context: anAIContext\x0a\x09context := anAIContext",
  41396. referencedClasses: [],
  41397. messageSends: []
  41398. }),
  41399. $globals.AISemanticAnalyzer);
  41400. $core.addMethod(
  41401. $core.method({
  41402. selector: "visitVariableNode:",
  41403. protocol: 'visiting',
  41404. fn: function (aNode){
  41405. var self=this;
  41406. function $ASTContextVar(){return $globals.ASTContextVar||(typeof ASTContextVar=="undefined"?nil:ASTContextVar)}
  41407. return $core.withContext(function($ctx1) {
  41408. var $1;
  41409. var $early={};
  41410. try {
  41411. $recv(self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  41412. return $core.withContext(function($ctx2) {
  41413. $1=(
  41414. $ctx2.supercall = true,
  41415. ($globals.AISemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitVariableNode_.apply($recv(self), [aNode]));
  41416. $ctx2.supercall = false;
  41417. throw $early=[$1];
  41418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41419. }));
  41420. $recv(aNode)._binding_($recv($ASTContextVar())._new());
  41421. return self;
  41422. }
  41423. catch(e) {if(e===$early)return e[0]; throw e}
  41424. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  41425. },
  41426. args: ["aNode"],
  41427. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  41428. referencedClasses: ["ASTContextVar"],
  41429. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  41430. }),
  41431. $globals.AISemanticAnalyzer);
  41432. $core.addClass('ASTContextVar', $globals.ScopeVar, ['context'], 'Compiler-Interpreter');
  41433. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  41434. $core.addMethod(
  41435. $core.method({
  41436. selector: "context",
  41437. protocol: 'accessing',
  41438. fn: function (){
  41439. var self=this;
  41440. return self["@context"];
  41441. },
  41442. args: [],
  41443. source: "context\x0a\x09^ context",
  41444. referencedClasses: [],
  41445. messageSends: []
  41446. }),
  41447. $globals.ASTContextVar);
  41448. $core.addMethod(
  41449. $core.method({
  41450. selector: "context:",
  41451. protocol: 'accessing',
  41452. fn: function (anObject){
  41453. var self=this;
  41454. self["@context"]=anObject;
  41455. return self;
  41456. },
  41457. args: ["anObject"],
  41458. source: "context: anObject\x0a\x09context := anObject",
  41459. referencedClasses: [],
  41460. messageSends: []
  41461. }),
  41462. $globals.ASTContextVar);
  41463. $core.addClass('ASTDebugger', $globals.Object, ['interpreter', 'context', 'result'], 'Compiler-Interpreter');
  41464. $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.";
  41465. $core.addMethod(
  41466. $core.method({
  41467. selector: "atEnd",
  41468. protocol: 'testing',
  41469. fn: function (){
  41470. var self=this;
  41471. return $core.withContext(function($ctx1) {
  41472. var $1,$receiver;
  41473. $1=self._context();
  41474. $ctx1.sendIdx["context"]=1;
  41475. if(($receiver = $1) == null || $receiver.isNil){
  41476. return true;
  41477. } else {
  41478. $1;
  41479. };
  41480. return $recv($recv(self._interpreter())._atEnd())._and_((function(){
  41481. return $core.withContext(function($ctx2) {
  41482. return $recv(self._context())._isTopContext();
  41483. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41484. }));
  41485. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  41486. },
  41487. args: [],
  41488. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  41489. referencedClasses: [],
  41490. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  41491. }),
  41492. $globals.ASTDebugger);
  41493. $core.addMethod(
  41494. $core.method({
  41495. selector: "context",
  41496. protocol: 'accessing',
  41497. fn: function (){
  41498. var self=this;
  41499. return self["@context"];
  41500. },
  41501. args: [],
  41502. source: "context\x0a\x09^ context",
  41503. referencedClasses: [],
  41504. messageSends: []
  41505. }),
  41506. $globals.ASTDebugger);
  41507. $core.addMethod(
  41508. $core.method({
  41509. selector: "context:",
  41510. protocol: 'accessing',
  41511. fn: function (aContext){
  41512. var self=this;
  41513. self["@context"]=aContext;
  41514. return self;
  41515. },
  41516. args: ["aContext"],
  41517. source: "context: aContext\x0a\x09context := aContext",
  41518. referencedClasses: [],
  41519. messageSends: []
  41520. }),
  41521. $globals.ASTDebugger);
  41522. $core.addMethod(
  41523. $core.method({
  41524. selector: "flushInnerContexts",
  41525. protocol: 'actions',
  41526. fn: function (){
  41527. var self=this;
  41528. return $core.withContext(function($ctx1) {
  41529. var $1,$receiver;
  41530. $1=self._context();
  41531. if(($receiver = $1) == null || $receiver.isNil){
  41532. $1;
  41533. } else {
  41534. var cxt;
  41535. cxt=$receiver;
  41536. $recv(cxt)._innerContext_(nil);
  41537. };
  41538. return self;
  41539. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  41540. },
  41541. args: [],
  41542. 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 ]",
  41543. referencedClasses: [],
  41544. messageSends: ["ifNotNil:", "context", "innerContext:"]
  41545. }),
  41546. $globals.ASTDebugger);
  41547. $core.addMethod(
  41548. $core.method({
  41549. selector: "interpreter",
  41550. protocol: 'accessing',
  41551. fn: function (){
  41552. var self=this;
  41553. return $core.withContext(function($ctx1) {
  41554. var $1,$receiver;
  41555. $1=self._context();
  41556. if(($receiver = $1) == null || $receiver.isNil){
  41557. return $1;
  41558. } else {
  41559. var ctx;
  41560. ctx=$receiver;
  41561. return $recv(ctx)._interpreter();
  41562. };
  41563. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  41564. },
  41565. args: [],
  41566. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  41567. referencedClasses: [],
  41568. messageSends: ["ifNotNil:", "context", "interpreter"]
  41569. }),
  41570. $globals.ASTDebugger);
  41571. $core.addMethod(
  41572. $core.method({
  41573. selector: "method",
  41574. protocol: 'accessing',
  41575. fn: function (){
  41576. var self=this;
  41577. return $core.withContext(function($ctx1) {
  41578. return $recv(self._context())._method();
  41579. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  41580. },
  41581. args: [],
  41582. source: "method\x0a\x09^ self context method",
  41583. referencedClasses: [],
  41584. messageSends: ["method", "context"]
  41585. }),
  41586. $globals.ASTDebugger);
  41587. $core.addMethod(
  41588. $core.method({
  41589. selector: "node",
  41590. protocol: 'accessing',
  41591. fn: function (){
  41592. var self=this;
  41593. return $core.withContext(function($ctx1) {
  41594. var $1,$receiver;
  41595. $1=self._interpreter();
  41596. $ctx1.sendIdx["interpreter"]=1;
  41597. if(($receiver = $1) == null || $receiver.isNil){
  41598. return $1;
  41599. } else {
  41600. return $recv(self._interpreter())._node();
  41601. };
  41602. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  41603. },
  41604. args: [],
  41605. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  41606. referencedClasses: [],
  41607. messageSends: ["ifNotNil:", "interpreter", "node"]
  41608. }),
  41609. $globals.ASTDebugger);
  41610. $core.addMethod(
  41611. $core.method({
  41612. selector: "onStep",
  41613. protocol: 'private',
  41614. fn: function (){
  41615. var self=this;
  41616. return $core.withContext(function($ctx1) {
  41617. var $1,$3,$2,$4,$6,$5,$receiver;
  41618. $1=self._interpreter();
  41619. $ctx1.sendIdx["interpreter"]=1;
  41620. self["@result"]=$recv($1)._result();
  41621. $3=self._interpreter();
  41622. $ctx1.sendIdx["interpreter"]=2;
  41623. $2=$recv($3)._atEnd();
  41624. $ctx1.sendIdx["atEnd"]=1;
  41625. if($core.assert($2)){
  41626. $4=$recv(self._context())._outerContext();
  41627. if(($receiver = $4) == null || $receiver.isNil){
  41628. $4;
  41629. } else {
  41630. var outerContext;
  41631. outerContext=$receiver;
  41632. self._context_(outerContext);
  41633. };
  41634. $6=self._interpreter();
  41635. $ctx1.sendIdx["interpreter"]=3;
  41636. $5=$recv($6)._atEnd();
  41637. if(!$core.assert($5)){
  41638. $recv(self._interpreter())._skip();
  41639. };
  41640. };
  41641. self._flushInnerContexts();
  41642. return self;
  41643. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  41644. },
  41645. args: [],
  41646. 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",
  41647. referencedClasses: [],
  41648. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  41649. }),
  41650. $globals.ASTDebugger);
  41651. $core.addMethod(
  41652. $core.method({
  41653. selector: "proceed",
  41654. protocol: 'stepping',
  41655. fn: function (){
  41656. var self=this;
  41657. return $core.withContext(function($ctx1) {
  41658. $recv((function(){
  41659. return $core.withContext(function($ctx2) {
  41660. return self._atEnd();
  41661. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41662. }))._whileFalse_((function(){
  41663. return $core.withContext(function($ctx2) {
  41664. return self._stepOver();
  41665. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41666. }));
  41667. return self;
  41668. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  41669. },
  41670. args: [],
  41671. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  41672. referencedClasses: [],
  41673. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  41674. }),
  41675. $globals.ASTDebugger);
  41676. $core.addMethod(
  41677. $core.method({
  41678. selector: "restart",
  41679. protocol: 'stepping',
  41680. fn: function (){
  41681. var self=this;
  41682. return $core.withContext(function($ctx1) {
  41683. $recv(self._interpreter())._restart();
  41684. self._flushInnerContexts();
  41685. return self;
  41686. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  41687. },
  41688. args: [],
  41689. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  41690. referencedClasses: [],
  41691. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  41692. }),
  41693. $globals.ASTDebugger);
  41694. $core.addMethod(
  41695. $core.method({
  41696. selector: "result",
  41697. protocol: 'accessing',
  41698. fn: function (){
  41699. var self=this;
  41700. return self["@result"];
  41701. },
  41702. args: [],
  41703. source: "result\x0a\x09^ result",
  41704. referencedClasses: [],
  41705. messageSends: []
  41706. }),
  41707. $globals.ASTDebugger);
  41708. $core.addMethod(
  41709. $core.method({
  41710. selector: "stepInto",
  41711. protocol: 'stepping',
  41712. fn: function (){
  41713. var self=this;
  41714. return $core.withContext(function($ctx1) {
  41715. self._shouldBeImplemented();
  41716. return self;
  41717. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  41718. },
  41719. args: [],
  41720. source: "stepInto\x0a\x09self shouldBeImplemented",
  41721. referencedClasses: [],
  41722. messageSends: ["shouldBeImplemented"]
  41723. }),
  41724. $globals.ASTDebugger);
  41725. $core.addMethod(
  41726. $core.method({
  41727. selector: "stepOver",
  41728. protocol: 'stepping',
  41729. fn: function (){
  41730. var self=this;
  41731. return $core.withContext(function($ctx1) {
  41732. var $1,$2;
  41733. $1=$recv(self._context())._isTopContext();
  41734. if($core.assert($1)){
  41735. $recv(self._interpreter())._stepOver();
  41736. } else {
  41737. $2=self._interpreter();
  41738. $ctx1.sendIdx["interpreter"]=1;
  41739. $recv($2)._skip();
  41740. };
  41741. self._onStep();
  41742. return self;
  41743. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  41744. },
  41745. args: [],
  41746. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  41747. referencedClasses: [],
  41748. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  41749. }),
  41750. $globals.ASTDebugger);
  41751. $core.addMethod(
  41752. $core.method({
  41753. selector: "context:",
  41754. protocol: 'instance creation',
  41755. fn: function (aContext){
  41756. var self=this;
  41757. return $core.withContext(function($ctx1) {
  41758. var $1;
  41759. $1=self._new();
  41760. $recv($1)._context_(aContext);
  41761. return $recv($1)._yourself();
  41762. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.klass)});
  41763. },
  41764. args: ["aContext"],
  41765. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  41766. referencedClasses: [],
  41767. messageSends: ["context:", "new", "yourself"]
  41768. }),
  41769. $globals.ASTDebugger.klass);
  41770. $core.addClass('ASTEnterNode', $globals.NodeVisitor, ['interpreter'], 'Compiler-Interpreter');
  41771. $core.addMethod(
  41772. $core.method({
  41773. selector: "interpreter",
  41774. protocol: 'accessing',
  41775. fn: function (){
  41776. var self=this;
  41777. return self["@interpreter"];
  41778. },
  41779. args: [],
  41780. source: "interpreter\x0a\x09^ interpreter",
  41781. referencedClasses: [],
  41782. messageSends: []
  41783. }),
  41784. $globals.ASTEnterNode);
  41785. $core.addMethod(
  41786. $core.method({
  41787. selector: "interpreter:",
  41788. protocol: 'accessing',
  41789. fn: function (anObject){
  41790. var self=this;
  41791. self["@interpreter"]=anObject;
  41792. return self;
  41793. },
  41794. args: ["anObject"],
  41795. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  41796. referencedClasses: [],
  41797. messageSends: []
  41798. }),
  41799. $globals.ASTEnterNode);
  41800. $core.addMethod(
  41801. $core.method({
  41802. selector: "visitBlockNode:",
  41803. protocol: 'visiting',
  41804. fn: function (aNode){
  41805. var self=this;
  41806. return aNode;
  41807. },
  41808. args: ["aNode"],
  41809. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  41810. referencedClasses: [],
  41811. messageSends: []
  41812. }),
  41813. $globals.ASTEnterNode);
  41814. $core.addMethod(
  41815. $core.method({
  41816. selector: "visitNode:",
  41817. protocol: 'visiting',
  41818. fn: function (aNode){
  41819. var self=this;
  41820. return $core.withContext(function($ctx1) {
  41821. var $early={};
  41822. try {
  41823. $recv($recv(aNode)._nodes())._ifEmpty_ifNotEmpty_((function(){
  41824. throw $early=[aNode];
  41825. }),(function(nodes){
  41826. return $core.withContext(function($ctx2) {
  41827. throw $early=[self._visit_($recv(nodes)._first())];
  41828. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  41829. }));
  41830. return self;
  41831. }
  41832. catch(e) {if(e===$early)return e[0]; throw e}
  41833. }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},$globals.ASTEnterNode)});
  41834. },
  41835. args: ["aNode"],
  41836. source: "visitNode: aNode\x0a\x09aNode nodes\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
  41837. referencedClasses: [],
  41838. messageSends: ["ifEmpty:ifNotEmpty:", "nodes", "visit:", "first"]
  41839. }),
  41840. $globals.ASTEnterNode);
  41841. $core.addMethod(
  41842. $core.method({
  41843. selector: "visitSequenceNode:",
  41844. protocol: 'visiting',
  41845. fn: function (aNode){
  41846. var self=this;
  41847. return $core.withContext(function($ctx1) {
  41848. var $1;
  41849. $recv($recv(aNode)._temps())._do_((function(each){
  41850. return $core.withContext(function($ctx2) {
  41851. return $recv($recv(self._interpreter())._context())._defineLocal_(each);
  41852. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41853. }));
  41854. $1=(
  41855. $ctx1.supercall = true,
  41856. ($globals.ASTEnterNode.superclass||$boot.dnu).fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  41857. $ctx1.supercall = false;
  41858. return $1;
  41859. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
  41860. },
  41861. args: ["aNode"],
  41862. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  41863. referencedClasses: [],
  41864. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  41865. }),
  41866. $globals.ASTEnterNode);
  41867. $core.addMethod(
  41868. $core.method({
  41869. selector: "on:",
  41870. protocol: 'instance creation',
  41871. fn: function (anInterpreter){
  41872. var self=this;
  41873. return $core.withContext(function($ctx1) {
  41874. var $1;
  41875. $1=self._new();
  41876. $recv($1)._interpreter_(anInterpreter);
  41877. return $recv($1)._yourself();
  41878. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.klass)});
  41879. },
  41880. args: ["anInterpreter"],
  41881. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  41882. referencedClasses: [],
  41883. messageSends: ["interpreter:", "new", "yourself"]
  41884. }),
  41885. $globals.ASTEnterNode.klass);
  41886. $core.addClass('ASTInterpreter', $globals.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned', 'forceAtEnd'], 'Compiler-Interpreter');
  41887. $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";
  41888. $core.addMethod(
  41889. $core.method({
  41890. selector: "assign:to:",
  41891. protocol: 'private',
  41892. fn: function (aNode,anObject){
  41893. var self=this;
  41894. return $core.withContext(function($ctx1) {
  41895. var $1,$3,$2,$4;
  41896. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  41897. if($core.assert($1)){
  41898. $3=self._context();
  41899. $ctx1.sendIdx["context"]=1;
  41900. $2=$recv($3)._receiver();
  41901. $4=$recv(aNode)._value();
  41902. $ctx1.sendIdx["value"]=1;
  41903. $recv($2)._instVarAt_put_($4,anObject);
  41904. } else {
  41905. $recv(self._context())._localAt_put_($recv(aNode)._value(),anObject);
  41906. };
  41907. return self;
  41908. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  41909. },
  41910. args: ["aNode", "anObject"],
  41911. 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 ]",
  41912. referencedClasses: [],
  41913. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  41914. }),
  41915. $globals.ASTInterpreter);
  41916. $core.addMethod(
  41917. $core.method({
  41918. selector: "atEnd",
  41919. protocol: 'testing',
  41920. fn: function (){
  41921. var self=this;
  41922. return $core.withContext(function($ctx1) {
  41923. var $1;
  41924. $1=self["@forceAtEnd"];
  41925. if($core.assert($1)){
  41926. return true;
  41927. };
  41928. return $recv(self._hasReturned())._or_((function(){
  41929. return $core.withContext(function($ctx2) {
  41930. return $recv(self._node())._isNil();
  41931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41932. }));
  41933. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  41934. },
  41935. args: [],
  41936. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  41937. referencedClasses: [],
  41938. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  41939. }),
  41940. $globals.ASTInterpreter);
  41941. $core.addMethod(
  41942. $core.method({
  41943. selector: "context",
  41944. protocol: 'accessing',
  41945. fn: function (){
  41946. var self=this;
  41947. return self["@context"];
  41948. },
  41949. args: [],
  41950. source: "context\x0a\x09^ context",
  41951. referencedClasses: [],
  41952. messageSends: []
  41953. }),
  41954. $globals.ASTInterpreter);
  41955. $core.addMethod(
  41956. $core.method({
  41957. selector: "context:",
  41958. protocol: 'accessing',
  41959. fn: function (aContext){
  41960. var self=this;
  41961. self["@context"]=aContext;
  41962. return self;
  41963. },
  41964. args: ["aContext"],
  41965. source: "context: aContext\x0a\x09context := aContext",
  41966. referencedClasses: [],
  41967. messageSends: []
  41968. }),
  41969. $globals.ASTInterpreter);
  41970. $core.addMethod(
  41971. $core.method({
  41972. selector: "enterNode",
  41973. protocol: 'interpreting',
  41974. fn: function (){
  41975. var self=this;
  41976. function $ASTEnterNode(){return $globals.ASTEnterNode||(typeof ASTEnterNode=="undefined"?nil:ASTEnterNode)}
  41977. return $core.withContext(function($ctx1) {
  41978. self._node_($recv($recv($ASTEnterNode())._on_(self))._visit_(self._node()));
  41979. return self;
  41980. }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
  41981. },
  41982. args: [],
  41983. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  41984. referencedClasses: ["ASTEnterNode"],
  41985. messageSends: ["node:", "visit:", "on:", "node"]
  41986. }),
  41987. $globals.ASTInterpreter);
  41988. $core.addMethod(
  41989. $core.method({
  41990. selector: "eval:",
  41991. protocol: 'private',
  41992. fn: function (aString){
  41993. var self=this;
  41994. var source,function_;
  41995. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  41996. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  41997. return $core.withContext(function($ctx1) {
  41998. var $3,$2,$1;
  41999. source=$recv($String())._streamContents_((function(str){
  42000. return $core.withContext(function($ctx2) {
  42001. $recv(str)._nextPutAll_("0,(function(");
  42002. $ctx2.sendIdx["nextPutAll:"]=1;
  42003. $3=self._context();
  42004. $ctx2.sendIdx["context"]=1;
  42005. $2=$recv($3)._locals();
  42006. $ctx2.sendIdx["locals"]=1;
  42007. $1=$recv($2)._keys();
  42008. $recv($1)._do_separatedBy_((function(each){
  42009. return $core.withContext(function($ctx3) {
  42010. return $recv(str)._nextPutAll_(each);
  42011. $ctx3.sendIdx["nextPutAll:"]=2;
  42012. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42013. }),(function(){
  42014. return $core.withContext(function($ctx3) {
  42015. return $recv(str)._nextPutAll_(",");
  42016. $ctx3.sendIdx["nextPutAll:"]=3;
  42017. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  42018. }));
  42019. $recv(str)._nextPutAll_("){ return (function() {");
  42020. $ctx2.sendIdx["nextPutAll:"]=4;
  42021. $recv(str)._nextPutAll_(aString);
  42022. $ctx2.sendIdx["nextPutAll:"]=5;
  42023. return $recv(str)._nextPutAll_("})()})");
  42024. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  42025. }));
  42026. function_=$recv($recv($Compiler())._new())._eval_(source);
  42027. return $recv(function_)._valueWithPossibleArguments_($recv($recv(self._context())._locals())._values());
  42028. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  42029. },
  42030. args: ["aString"],
  42031. 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",
  42032. referencedClasses: ["String", "Compiler"],
  42033. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"]
  42034. }),
  42035. $globals.ASTInterpreter);
  42036. $core.addMethod(
  42037. $core.method({
  42038. selector: "hasReturned",
  42039. protocol: 'testing',
  42040. fn: function (){
  42041. var self=this;
  42042. return $core.withContext(function($ctx1) {
  42043. var $1,$receiver;
  42044. $1=self["@returned"];
  42045. if(($receiver = $1) == null || $receiver.isNil){
  42046. return false;
  42047. } else {
  42048. return $1;
  42049. };
  42050. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  42051. },
  42052. args: [],
  42053. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  42054. referencedClasses: [],
  42055. messageSends: ["ifNil:"]
  42056. }),
  42057. $globals.ASTInterpreter);
  42058. $core.addMethod(
  42059. $core.method({
  42060. selector: "initialize",
  42061. protocol: 'initialization',
  42062. fn: function (){
  42063. var self=this;
  42064. return $core.withContext(function($ctx1) {
  42065. (
  42066. $ctx1.supercall = true,
  42067. ($globals.ASTInterpreter.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  42068. $ctx1.supercall = false;
  42069. self["@forceAtEnd"]=false;
  42070. return self;
  42071. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  42072. },
  42073. args: [],
  42074. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  42075. referencedClasses: [],
  42076. messageSends: ["initialize"]
  42077. }),
  42078. $globals.ASTInterpreter);
  42079. $core.addMethod(
  42080. $core.method({
  42081. selector: "interpret",
  42082. protocol: 'interpreting',
  42083. fn: function (){
  42084. var self=this;
  42085. return $core.withContext(function($ctx1) {
  42086. self._visit_(self._node());
  42087. return self;
  42088. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  42089. },
  42090. args: [],
  42091. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  42092. referencedClasses: [],
  42093. messageSends: ["visit:", "node"]
  42094. }),
  42095. $globals.ASTInterpreter);
  42096. $core.addMethod(
  42097. $core.method({
  42098. selector: "messageFromSendNode:arguments:",
  42099. protocol: 'private',
  42100. fn: function (aSendNode,aCollection){
  42101. var self=this;
  42102. function $Message(){return $globals.Message||(typeof Message=="undefined"?nil:Message)}
  42103. return $core.withContext(function($ctx1) {
  42104. var $1;
  42105. $1=$recv($Message())._new();
  42106. $recv($1)._selector_($recv(aSendNode)._selector());
  42107. $recv($1)._arguments_(aCollection);
  42108. return $recv($1)._yourself();
  42109. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  42110. },
  42111. args: ["aSendNode", "aCollection"],
  42112. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  42113. referencedClasses: ["Message"],
  42114. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  42115. }),
  42116. $globals.ASTInterpreter);
  42117. $core.addMethod(
  42118. $core.method({
  42119. selector: "messageNotUnderstood:receiver:",
  42120. protocol: 'private',
  42121. fn: function (aMessage,anObject){
  42122. var self=this;
  42123. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  42124. return $core.withContext(function($ctx1) {
  42125. var $1;
  42126. $1=$recv($MessageNotUnderstood())._new();
  42127. $recv($1)._message_(aMessage);
  42128. $recv($1)._receiver_(anObject);
  42129. $recv($1)._signal();
  42130. return self;
  42131. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  42132. },
  42133. args: ["aMessage", "anObject"],
  42134. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  42135. referencedClasses: ["MessageNotUnderstood"],
  42136. messageSends: ["message:", "new", "receiver:", "signal"]
  42137. }),
  42138. $globals.ASTInterpreter);
  42139. $core.addMethod(
  42140. $core.method({
  42141. selector: "next",
  42142. protocol: 'interpreting',
  42143. fn: function (){
  42144. var self=this;
  42145. var nd,nextNode;
  42146. function $ASTEnterNode(){return $globals.ASTEnterNode||(typeof ASTEnterNode=="undefined"?nil:ASTEnterNode)}
  42147. return $core.withContext(function($ctx1) {
  42148. var $1,$2,$receiver;
  42149. nd=self._node();
  42150. $1=$recv(nd)._parent();
  42151. if(($receiver = $1) == null || $receiver.isNil){
  42152. nextNode=$1;
  42153. } else {
  42154. var parent;
  42155. parent=$receiver;
  42156. $2=$recv(parent)._nextSiblingNode_(nd);
  42157. if(($receiver = $2) == null || $receiver.isNil){
  42158. nextNode=parent;
  42159. } else {
  42160. var sibling;
  42161. sibling=$receiver;
  42162. nextNode=$recv($recv($ASTEnterNode())._on_(self))._visit_(sibling);
  42163. };
  42164. };
  42165. self._node_(nextNode);
  42166. return self;
  42167. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
  42168. },
  42169. args: [],
  42170. source: "next\x0a\x09| nd nextNode |\x0a\x09nd := self node.\x0a\x09nextNode := nd parent ifNotNil: [ :parent |\x0a\x09\x09(parent nextSiblingNode: nd)\x0a\x09\x09\x09ifNil: [ parent ]\x0a\x09\x09\x09ifNotNil: [ :sibling | (ASTEnterNode on: self) visit: sibling ] ].\x0a\x09self node: nextNode",
  42171. referencedClasses: ["ASTEnterNode"],
  42172. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  42173. }),
  42174. $globals.ASTInterpreter);
  42175. $core.addMethod(
  42176. $core.method({
  42177. selector: "node",
  42178. protocol: 'accessing',
  42179. fn: function (){
  42180. var self=this;
  42181. return self["@node"];
  42182. },
  42183. args: [],
  42184. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  42185. referencedClasses: [],
  42186. messageSends: []
  42187. }),
  42188. $globals.ASTInterpreter);
  42189. $core.addMethod(
  42190. $core.method({
  42191. selector: "node:",
  42192. protocol: 'accessing',
  42193. fn: function (aNode){
  42194. var self=this;
  42195. self["@node"]=aNode;
  42196. return self;
  42197. },
  42198. args: ["aNode"],
  42199. source: "node: aNode\x0a\x09node := aNode",
  42200. referencedClasses: [],
  42201. messageSends: []
  42202. }),
  42203. $globals.ASTInterpreter);
  42204. $core.addMethod(
  42205. $core.method({
  42206. selector: "peek",
  42207. protocol: 'stack',
  42208. fn: function (){
  42209. var self=this;
  42210. return $core.withContext(function($ctx1) {
  42211. var $1;
  42212. var $early={};
  42213. try {
  42214. $1=self._stack();
  42215. $ctx1.sendIdx["stack"]=1;
  42216. $recv($1)._ifEmpty_((function(){
  42217. throw $early=[nil];
  42218. }));
  42219. return $recv(self._stack())._last();
  42220. }
  42221. catch(e) {if(e===$early)return e[0]; throw e}
  42222. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  42223. },
  42224. args: [],
  42225. 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",
  42226. referencedClasses: [],
  42227. messageSends: ["ifEmpty:", "stack", "last"]
  42228. }),
  42229. $globals.ASTInterpreter);
  42230. $core.addMethod(
  42231. $core.method({
  42232. selector: "pop",
  42233. protocol: 'stack',
  42234. fn: function (){
  42235. var self=this;
  42236. var peekedValue;
  42237. return $core.withContext(function($ctx1) {
  42238. peekedValue=self._peek();
  42239. $recv(self._stack())._removeLast();
  42240. return peekedValue;
  42241. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  42242. },
  42243. args: [],
  42244. 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",
  42245. referencedClasses: [],
  42246. messageSends: ["peek", "removeLast", "stack"]
  42247. }),
  42248. $globals.ASTInterpreter);
  42249. $core.addMethod(
  42250. $core.method({
  42251. selector: "proceed",
  42252. protocol: 'interpreting',
  42253. fn: function (){
  42254. var self=this;
  42255. return $core.withContext(function($ctx1) {
  42256. $recv((function(){
  42257. return $core.withContext(function($ctx2) {
  42258. return self._atEnd();
  42259. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42260. }))._whileFalse_((function(){
  42261. return $core.withContext(function($ctx2) {
  42262. return self._step();
  42263. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42264. }));
  42265. return self;
  42266. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  42267. },
  42268. args: [],
  42269. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  42270. referencedClasses: [],
  42271. messageSends: ["whileFalse:", "atEnd", "step"]
  42272. }),
  42273. $globals.ASTInterpreter);
  42274. $core.addMethod(
  42275. $core.method({
  42276. selector: "push:",
  42277. protocol: 'stack',
  42278. fn: function (anObject){
  42279. var self=this;
  42280. return $core.withContext(function($ctx1) {
  42281. return $recv(self._stack())._add_(anObject);
  42282. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  42283. },
  42284. args: ["anObject"],
  42285. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  42286. referencedClasses: [],
  42287. messageSends: ["add:", "stack"]
  42288. }),
  42289. $globals.ASTInterpreter);
  42290. $core.addMethod(
  42291. $core.method({
  42292. selector: "restart",
  42293. protocol: 'interpreting',
  42294. fn: function (){
  42295. var self=this;
  42296. return $core.withContext(function($ctx1) {
  42297. self._node_($recv(self._context())._ast());
  42298. self._enterNode();
  42299. return self;
  42300. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  42301. },
  42302. args: [],
  42303. source: "restart\x0a\x09self node: self context ast; enterNode",
  42304. referencedClasses: [],
  42305. messageSends: ["node:", "ast", "context", "enterNode"]
  42306. }),
  42307. $globals.ASTInterpreter);
  42308. $core.addMethod(
  42309. $core.method({
  42310. selector: "result",
  42311. protocol: 'accessing',
  42312. fn: function (){
  42313. var self=this;
  42314. return $core.withContext(function($ctx1) {
  42315. var $1;
  42316. $1=self._hasReturned();
  42317. if($core.assert($1)){
  42318. return self._returnValue();
  42319. } else {
  42320. return $recv(self._context())._receiver();
  42321. };
  42322. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  42323. },
  42324. args: [],
  42325. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  42326. referencedClasses: [],
  42327. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  42328. }),
  42329. $globals.ASTInterpreter);
  42330. $core.addMethod(
  42331. $core.method({
  42332. selector: "returnValue",
  42333. protocol: 'accessing',
  42334. fn: function (){
  42335. var self=this;
  42336. return self["@returnValue"];
  42337. },
  42338. args: [],
  42339. source: "returnValue\x0a\x09^ returnValue",
  42340. referencedClasses: [],
  42341. messageSends: []
  42342. }),
  42343. $globals.ASTInterpreter);
  42344. $core.addMethod(
  42345. $core.method({
  42346. selector: "returnValue:",
  42347. protocol: 'accessing',
  42348. fn: function (anObject){
  42349. var self=this;
  42350. self["@returnValue"]=anObject;
  42351. return self;
  42352. },
  42353. args: ["anObject"],
  42354. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  42355. referencedClasses: [],
  42356. messageSends: []
  42357. }),
  42358. $globals.ASTInterpreter);
  42359. $core.addMethod(
  42360. $core.method({
  42361. selector: "sendMessage:to:superSend:",
  42362. protocol: 'private',
  42363. fn: function (aMessage,anObject,aBoolean){
  42364. var self=this;
  42365. var method;
  42366. return $core.withContext(function($ctx1) {
  42367. var $2,$1,$3,$receiver;
  42368. var $early={};
  42369. try {
  42370. if(!$core.assert(aBoolean)){
  42371. return $recv(aMessage)._sendTo_(anObject);
  42372. };
  42373. $2=$recv(anObject)._class();
  42374. $ctx1.sendIdx["class"]=1;
  42375. $1=$recv($2)._superclass();
  42376. $ctx1.sendIdx["superclass"]=1;
  42377. if(($receiver = $1) == null || $receiver.isNil){
  42378. $3=self._messageNotUnderstood_receiver_(aMessage,anObject);
  42379. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  42380. return $3;
  42381. } else {
  42382. $1;
  42383. };
  42384. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  42385. return $core.withContext(function($ctx2) {
  42386. throw $early=[self._messageNotUnderstood_receiver_(aMessage,anObject)];
  42387. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42388. }));
  42389. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  42390. }
  42391. catch(e) {if(e===$early)return e[0]; throw e}
  42392. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  42393. },
  42394. args: ["aMessage", "anObject", "aBoolean"],
  42395. 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",
  42396. referencedClasses: [],
  42397. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  42398. }),
  42399. $globals.ASTInterpreter);
  42400. $core.addMethod(
  42401. $core.method({
  42402. selector: "setNonLocalReturnFromContext:",
  42403. protocol: 'interpreting',
  42404. fn: function (aContext){
  42405. var self=this;
  42406. return $core.withContext(function($ctx1) {
  42407. var $2,$1;
  42408. $2=$recv(aContext)._interpreter();
  42409. $ctx1.sendIdx["interpreter"]=1;
  42410. $1=$recv($2)._hasReturned();
  42411. if($core.assert($1)){
  42412. self["@returned"]=true;
  42413. self["@returned"];
  42414. self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  42415. };
  42416. return self;
  42417. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  42418. },
  42419. args: ["aContext"],
  42420. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  42421. referencedClasses: [],
  42422. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  42423. }),
  42424. $globals.ASTInterpreter);
  42425. $core.addMethod(
  42426. $core.method({
  42427. selector: "skip",
  42428. protocol: 'interpreting',
  42429. fn: function (){
  42430. var self=this;
  42431. return $core.withContext(function($ctx1) {
  42432. self._next();
  42433. return self;
  42434. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  42435. },
  42436. args: [],
  42437. source: "skip\x0a\x09self next",
  42438. referencedClasses: [],
  42439. messageSends: ["next"]
  42440. }),
  42441. $globals.ASTInterpreter);
  42442. $core.addMethod(
  42443. $core.method({
  42444. selector: "stack",
  42445. protocol: 'accessing',
  42446. fn: function (){
  42447. var self=this;
  42448. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  42449. return $core.withContext(function($ctx1) {
  42450. var $1,$receiver;
  42451. $1=self["@stack"];
  42452. if(($receiver = $1) == null || $receiver.isNil){
  42453. self["@stack"]=$recv($OrderedCollection())._new();
  42454. return self["@stack"];
  42455. } else {
  42456. return $1;
  42457. };
  42458. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  42459. },
  42460. args: [],
  42461. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  42462. referencedClasses: ["OrderedCollection"],
  42463. messageSends: ["ifNil:", "new"]
  42464. }),
  42465. $globals.ASTInterpreter);
  42466. $core.addMethod(
  42467. $core.method({
  42468. selector: "step",
  42469. protocol: 'interpreting',
  42470. fn: function (){
  42471. var self=this;
  42472. return $core.withContext(function($ctx1) {
  42473. self._interpret();
  42474. self._next();
  42475. return self;
  42476. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  42477. },
  42478. args: [],
  42479. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  42480. referencedClasses: [],
  42481. messageSends: ["interpret", "next"]
  42482. }),
  42483. $globals.ASTInterpreter);
  42484. $core.addMethod(
  42485. $core.method({
  42486. selector: "stepOver",
  42487. protocol: 'interpreting',
  42488. fn: function (){
  42489. var self=this;
  42490. return $core.withContext(function($ctx1) {
  42491. var $2,$1;
  42492. self._step();
  42493. $ctx1.sendIdx["step"]=1;
  42494. $recv((function(){
  42495. return $core.withContext(function($ctx2) {
  42496. $2=self._node();
  42497. $ctx2.sendIdx["node"]=1;
  42498. $1=$recv($2)._isNil();
  42499. return $recv($1)._or_((function(){
  42500. return $core.withContext(function($ctx3) {
  42501. return $recv(self._node())._isSteppingNode();
  42502. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42503. }));
  42504. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42505. }))._whileFalse_((function(){
  42506. return $core.withContext(function($ctx2) {
  42507. return self._step();
  42508. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42509. }));
  42510. return self;
  42511. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  42512. },
  42513. args: [],
  42514. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  42515. referencedClasses: [],
  42516. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  42517. }),
  42518. $globals.ASTInterpreter);
  42519. $core.addMethod(
  42520. $core.method({
  42521. selector: "visit:",
  42522. protocol: 'visiting',
  42523. fn: function (aNode){
  42524. var self=this;
  42525. return $core.withContext(function($ctx1) {
  42526. var $1;
  42527. $1=self._hasReturned();
  42528. if(!$core.assert($1)){
  42529. (
  42530. $ctx1.supercall = true,
  42531. ($globals.ASTInterpreter.superclass||$boot.dnu).fn.prototype._visit_.apply($recv(self), [aNode]));
  42532. $ctx1.supercall = false;
  42533. };
  42534. return self;
  42535. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  42536. },
  42537. args: ["aNode"],
  42538. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  42539. referencedClasses: [],
  42540. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  42541. }),
  42542. $globals.ASTInterpreter);
  42543. $core.addMethod(
  42544. $core.method({
  42545. selector: "visitAssignmentNode:",
  42546. protocol: 'visiting',
  42547. fn: function (aNode){
  42548. var self=this;
  42549. var poppedValue;
  42550. return $core.withContext(function($ctx1) {
  42551. poppedValue=self._pop();
  42552. $ctx1.sendIdx["pop"]=1;
  42553. self._pop();
  42554. self._push_(poppedValue);
  42555. self._assign_to_($recv(aNode)._left(),poppedValue);
  42556. return self;
  42557. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  42558. },
  42559. args: ["aNode"],
  42560. 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",
  42561. referencedClasses: [],
  42562. messageSends: ["pop", "push:", "assign:to:", "left"]
  42563. }),
  42564. $globals.ASTInterpreter);
  42565. $core.addMethod(
  42566. $core.method({
  42567. selector: "visitBlockNode:",
  42568. protocol: 'visiting',
  42569. fn: function (aNode){
  42570. var self=this;
  42571. var block;
  42572. function $AIBlockClosure(){return $globals.AIBlockClosure||(typeof AIBlockClosure=="undefined"?nil:AIBlockClosure)}
  42573. return $core.withContext(function($ctx1) {
  42574. block=$recv($AIBlockClosure())._forContext_node_(self._context(),aNode);
  42575. self._push_(block);
  42576. return self;
  42577. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  42578. },
  42579. args: ["aNode"],
  42580. 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",
  42581. referencedClasses: ["AIBlockClosure"],
  42582. messageSends: ["forContext:node:", "context", "push:"]
  42583. }),
  42584. $globals.ASTInterpreter);
  42585. $core.addMethod(
  42586. $core.method({
  42587. selector: "visitBlockSequenceNode:",
  42588. protocol: 'visiting',
  42589. fn: function (aNode){
  42590. var self=this;
  42591. return $core.withContext(function($ctx1) {
  42592. (
  42593. $ctx1.supercall = true,
  42594. ($globals.ASTInterpreter.superclass||$boot.dnu).fn.prototype._visitBlockSequenceNode_.apply($recv(self), [aNode]));
  42595. $ctx1.supercall = false;
  42596. self["@forceAtEnd"]=true;
  42597. return self;
  42598. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  42599. },
  42600. args: ["aNode"],
  42601. 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",
  42602. referencedClasses: [],
  42603. messageSends: ["visitBlockSequenceNode:"]
  42604. }),
  42605. $globals.ASTInterpreter);
  42606. $core.addMethod(
  42607. $core.method({
  42608. selector: "visitDynamicArrayNode:",
  42609. protocol: 'visiting',
  42610. fn: function (aNode){
  42611. var self=this;
  42612. var array;
  42613. return $core.withContext(function($ctx1) {
  42614. array=[];
  42615. $recv($recv(aNode)._nodes())._do_((function(each){
  42616. return $core.withContext(function($ctx2) {
  42617. return $recv(array)._addFirst_(self._pop());
  42618. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42619. }));
  42620. self._push_(array);
  42621. return self;
  42622. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  42623. },
  42624. args: ["aNode"],
  42625. 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",
  42626. referencedClasses: [],
  42627. messageSends: ["do:", "nodes", "addFirst:", "pop", "push:"]
  42628. }),
  42629. $globals.ASTInterpreter);
  42630. $core.addMethod(
  42631. $core.method({
  42632. selector: "visitDynamicDictionaryNode:",
  42633. protocol: 'visiting',
  42634. fn: function (aNode){
  42635. var self=this;
  42636. var keyValueList;
  42637. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  42638. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  42639. return $core.withContext(function($ctx1) {
  42640. keyValueList=$recv($OrderedCollection())._new();
  42641. $recv($recv(aNode)._nodes())._do_((function(each){
  42642. return $core.withContext(function($ctx2) {
  42643. return $recv(keyValueList)._add_(self._pop());
  42644. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42645. }));
  42646. self._push_($recv($HashedCollection())._newFromPairs_($recv(keyValueList)._reversed()));
  42647. return self;
  42648. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  42649. },
  42650. args: ["aNode"],
  42651. 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)",
  42652. referencedClasses: ["OrderedCollection", "HashedCollection"],
  42653. messageSends: ["new", "do:", "nodes", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  42654. }),
  42655. $globals.ASTInterpreter);
  42656. $core.addMethod(
  42657. $core.method({
  42658. selector: "visitJSStatementNode:",
  42659. protocol: 'visiting',
  42660. fn: function (aNode){
  42661. var self=this;
  42662. return $core.withContext(function($ctx1) {
  42663. self["@returned"]=true;
  42664. self._returnValue_(self._eval_($recv(aNode)._source()));
  42665. return self;
  42666. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  42667. },
  42668. args: ["aNode"],
  42669. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  42670. referencedClasses: [],
  42671. messageSends: ["returnValue:", "eval:", "source"]
  42672. }),
  42673. $globals.ASTInterpreter);
  42674. $core.addMethod(
  42675. $core.method({
  42676. selector: "visitNode:",
  42677. protocol: 'visiting',
  42678. fn: function (aNode){
  42679. var self=this;
  42680. return self;
  42681. },
  42682. args: ["aNode"],
  42683. source: "visitNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  42684. referencedClasses: [],
  42685. messageSends: []
  42686. }),
  42687. $globals.ASTInterpreter);
  42688. $core.addMethod(
  42689. $core.method({
  42690. selector: "visitReturnNode:",
  42691. protocol: 'visiting',
  42692. fn: function (aNode){
  42693. var self=this;
  42694. return $core.withContext(function($ctx1) {
  42695. self["@returned"]=true;
  42696. self._returnValue_(self._pop());
  42697. return self;
  42698. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  42699. },
  42700. args: ["aNode"],
  42701. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  42702. referencedClasses: [],
  42703. messageSends: ["returnValue:", "pop"]
  42704. }),
  42705. $globals.ASTInterpreter);
  42706. $core.addMethod(
  42707. $core.method({
  42708. selector: "visitSendNode:",
  42709. protocol: 'visiting',
  42710. fn: function (aNode){
  42711. var self=this;
  42712. var receiver,args,message,result;
  42713. return $core.withContext(function($ctx1) {
  42714. var $1;
  42715. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  42716. return $core.withContext(function($ctx2) {
  42717. return self._pop();
  42718. $ctx2.sendIdx["pop"]=1;
  42719. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42720. }));
  42721. receiver=self._peek();
  42722. message=self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  42723. result=self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  42724. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  42725. return $core.withContext(function($ctx2) {
  42726. return $recv($recv(aNode)._isLastChild())._not();
  42727. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42728. }));
  42729. if(!$core.assert($1)){
  42730. self._pop();
  42731. self._push_(result);
  42732. };
  42733. return self;
  42734. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  42735. },
  42736. args: ["aNode"],
  42737. source: "visitSendNode: aNode\x0a\x09| receiver args message result |\x0a\x09\x0a\x09args := aNode arguments collect: [ :each | self pop ].\x0a\x09receiver := self peek.\x0a\x09\x0a\x09message := self\x0a\x09\x09messageFromSendNode: aNode\x0a\x09\x09arguments: args reversed.\x0a\x09\x0a\x09result := self sendMessage: message to: receiver superSend: aNode superSend.\x0a\x09\x0a\x09\x22For cascade sends, push the reciever if the send is not the last one\x22\x0a\x09(aNode isCascadeSendNode and: [ aNode isLastChild not ])\x0a\x09\x09ifFalse: [ self pop; push: result ]",
  42738. referencedClasses: [],
  42739. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  42740. }),
  42741. $globals.ASTInterpreter);
  42742. $core.addMethod(
  42743. $core.method({
  42744. selector: "visitValueNode:",
  42745. protocol: 'visiting',
  42746. fn: function (aNode){
  42747. var self=this;
  42748. return $core.withContext(function($ctx1) {
  42749. self._push_($recv(aNode)._value());
  42750. return self;
  42751. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  42752. },
  42753. args: ["aNode"],
  42754. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  42755. referencedClasses: [],
  42756. messageSends: ["push:", "value"]
  42757. }),
  42758. $globals.ASTInterpreter);
  42759. $core.addMethod(
  42760. $core.method({
  42761. selector: "visitVariableNode:",
  42762. protocol: 'visiting',
  42763. fn: function (aNode){
  42764. var self=this;
  42765. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  42766. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  42767. return $core.withContext(function($ctx1) {
  42768. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  42769. $2=$recv(aNode)._binding();
  42770. $ctx1.sendIdx["binding"]=1;
  42771. $1=$recv($2)._isUnknownVar();
  42772. if($core.assert($1)){
  42773. $5=$recv($Platform())._globals();
  42774. $ctx1.sendIdx["globals"]=1;
  42775. $6=$recv(aNode)._value();
  42776. $ctx1.sendIdx["value"]=1;
  42777. $4=$recv($5)._at_ifAbsent_($6,(function(){
  42778. return $core.withContext(function($ctx2) {
  42779. return self._error_("Unknown variable");
  42780. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42781. }));
  42782. $ctx1.sendIdx["at:ifAbsent:"]=1;
  42783. $3=self._push_($4);
  42784. $ctx1.sendIdx["push:"]=1;
  42785. return $3;
  42786. };
  42787. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  42788. if($core.assert($8)){
  42789. $10=self._context();
  42790. $ctx1.sendIdx["context"]=1;
  42791. $9=$recv($10)._receiver();
  42792. $11=$recv(aNode)._value();
  42793. $ctx1.sendIdx["value"]=2;
  42794. $7=$recv($9)._instVarAt_($11);
  42795. } else {
  42796. $12=self._context();
  42797. $13=$recv(aNode)._value();
  42798. $ctx1.sendIdx["value"]=3;
  42799. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  42800. return $core.withContext(function($ctx2) {
  42801. $15=$recv(aNode)._value();
  42802. $ctx2.sendIdx["value"]=4;
  42803. $14=$recv($15)._isCapitalized();
  42804. if($core.assert($14)){
  42805. $16=$recv($Smalltalk())._globals();
  42806. $ctx2.sendIdx["globals"]=2;
  42807. $17=$recv(aNode)._value();
  42808. $ctx2.sendIdx["value"]=5;
  42809. return $recv($16)._at_ifAbsent_($17,(function(){
  42810. return $core.withContext(function($ctx3) {
  42811. return $recv($recv($Platform())._globals())._at_($recv(aNode)._value());
  42812. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  42813. }));
  42814. };
  42815. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  42816. }));
  42817. };
  42818. self._push_($7);
  42819. return self;
  42820. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  42821. },
  42822. args: ["aNode"],
  42823. 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 ] ] ] ])",
  42824. referencedClasses: ["Platform", "Smalltalk"],
  42825. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  42826. }),
  42827. $globals.ASTInterpreter);
  42828. $core.addClass('ASTInterpreterError', $globals.Error, [], 'Compiler-Interpreter');
  42829. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  42830. $core.addClass('ASTPCNodeVisitor', $globals.NodeVisitor, ['context', 'index', 'selector', 'currentNode'], 'Compiler-Interpreter');
  42831. $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`";
  42832. $core.addMethod(
  42833. $core.method({
  42834. selector: "context",
  42835. protocol: 'accessing',
  42836. fn: function (){
  42837. var self=this;
  42838. return self["@context"];
  42839. },
  42840. args: [],
  42841. source: "context\x0a\x09^ context",
  42842. referencedClasses: [],
  42843. messageSends: []
  42844. }),
  42845. $globals.ASTPCNodeVisitor);
  42846. $core.addMethod(
  42847. $core.method({
  42848. selector: "context:",
  42849. protocol: 'accessing',
  42850. fn: function (aContext){
  42851. var self=this;
  42852. self["@context"]=aContext;
  42853. return self;
  42854. },
  42855. args: ["aContext"],
  42856. source: "context: aContext\x0a\x09context := aContext",
  42857. referencedClasses: [],
  42858. messageSends: []
  42859. }),
  42860. $globals.ASTPCNodeVisitor);
  42861. $core.addMethod(
  42862. $core.method({
  42863. selector: "currentNode",
  42864. protocol: 'accessing',
  42865. fn: function (){
  42866. var self=this;
  42867. return self["@currentNode"];
  42868. },
  42869. args: [],
  42870. source: "currentNode\x0a\x09^ currentNode",
  42871. referencedClasses: [],
  42872. messageSends: []
  42873. }),
  42874. $globals.ASTPCNodeVisitor);
  42875. $core.addMethod(
  42876. $core.method({
  42877. selector: "increaseIndex",
  42878. protocol: 'accessing',
  42879. fn: function (){
  42880. var self=this;
  42881. return $core.withContext(function($ctx1) {
  42882. self["@index"]=$recv(self._index()).__plus((1));
  42883. return self;
  42884. }, function($ctx1) {$ctx1.fill(self,"increaseIndex",{},$globals.ASTPCNodeVisitor)});
  42885. },
  42886. args: [],
  42887. source: "increaseIndex\x0a\x09index := self index + 1",
  42888. referencedClasses: [],
  42889. messageSends: ["+", "index"]
  42890. }),
  42891. $globals.ASTPCNodeVisitor);
  42892. $core.addMethod(
  42893. $core.method({
  42894. selector: "index",
  42895. protocol: 'accessing',
  42896. fn: function (){
  42897. var self=this;
  42898. return $core.withContext(function($ctx1) {
  42899. var $1,$receiver;
  42900. $1=self["@index"];
  42901. if(($receiver = $1) == null || $receiver.isNil){
  42902. self["@index"]=(0);
  42903. return self["@index"];
  42904. } else {
  42905. return $1;
  42906. };
  42907. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.ASTPCNodeVisitor)});
  42908. },
  42909. args: [],
  42910. source: "index\x0a\x09^ index ifNil: [ index := 0 ]",
  42911. referencedClasses: [],
  42912. messageSends: ["ifNil:"]
  42913. }),
  42914. $globals.ASTPCNodeVisitor);
  42915. $core.addMethod(
  42916. $core.method({
  42917. selector: "selector",
  42918. protocol: 'accessing',
  42919. fn: function (){
  42920. var self=this;
  42921. return self["@selector"];
  42922. },
  42923. args: [],
  42924. source: "selector\x0a\x09^ selector",
  42925. referencedClasses: [],
  42926. messageSends: []
  42927. }),
  42928. $globals.ASTPCNodeVisitor);
  42929. $core.addMethod(
  42930. $core.method({
  42931. selector: "selector:",
  42932. protocol: 'accessing',
  42933. fn: function (aString){
  42934. var self=this;
  42935. self["@selector"]=aString;
  42936. return self;
  42937. },
  42938. args: ["aString"],
  42939. source: "selector: aString\x0a\x09selector := aString",
  42940. referencedClasses: [],
  42941. messageSends: []
  42942. }),
  42943. $globals.ASTPCNodeVisitor);
  42944. $core.addMethod(
  42945. $core.method({
  42946. selector: "visitJSStatementNode:",
  42947. protocol: 'visiting',
  42948. fn: function (aNode){
  42949. var self=this;
  42950. self["@currentNode"]=aNode;
  42951. return self;
  42952. },
  42953. args: ["aNode"],
  42954. 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",
  42955. referencedClasses: [],
  42956. messageSends: []
  42957. }),
  42958. $globals.ASTPCNodeVisitor);
  42959. $core.addMethod(
  42960. $core.method({
  42961. selector: "visitSendNode:",
  42962. protocol: 'visiting',
  42963. fn: function (aNode){
  42964. var self=this;
  42965. var sendIndex;
  42966. return $core.withContext(function($ctx1) {
  42967. var $1,$2,$4,$3,$5;
  42968. $1=self._context();
  42969. $2=self._selector();
  42970. $ctx1.sendIdx["selector"]=1;
  42971. sendIndex=$recv($1)._sendIndexAt_($2);
  42972. (
  42973. $ctx1.supercall = true,
  42974. ($globals.ASTPCNodeVisitor.superclass||$boot.dnu).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  42975. $ctx1.supercall = false;
  42976. $4=self._selector();
  42977. $ctx1.sendIdx["selector"]=2;
  42978. $3=$recv($4).__eq($recv(aNode)._selector());
  42979. $ctx1.sendIdx["="]=1;
  42980. if($core.assert($3)){
  42981. $5=$recv(self._index()).__eq(sendIndex);
  42982. if($core.assert($5)){
  42983. self["@currentNode"]=aNode;
  42984. self["@currentNode"];
  42985. };
  42986. self._increaseIndex();
  42987. };
  42988. return self;
  42989. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sendIndex:sendIndex},$globals.ASTPCNodeVisitor)});
  42990. },
  42991. args: ["aNode"],
  42992. 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 ]",
  42993. referencedClasses: [],
  42994. messageSends: ["sendIndexAt:", "context", "selector", "visitSendNode:", "ifTrue:", "=", "index", "increaseIndex"]
  42995. }),
  42996. $globals.ASTPCNodeVisitor);
  42997. $core.addMethod(
  42998. $core.method({
  42999. selector: "isSteppingNode",
  43000. protocol: '*Compiler-Interpreter',
  43001. fn: function (){
  43002. var self=this;
  43003. return true;
  43004. },
  43005. args: [],
  43006. source: "isSteppingNode\x0a\x09^ true",
  43007. referencedClasses: [],
  43008. messageSends: []
  43009. }),
  43010. $globals.AssignmentNode);
  43011. $core.addMethod(
  43012. $core.method({
  43013. selector: "isSteppingNode",
  43014. protocol: '*Compiler-Interpreter',
  43015. fn: function (){
  43016. var self=this;
  43017. return true;
  43018. },
  43019. args: [],
  43020. source: "isSteppingNode\x0a\x09^ true",
  43021. referencedClasses: [],
  43022. messageSends: []
  43023. }),
  43024. $globals.BlockNode);
  43025. $core.addMethod(
  43026. $core.method({
  43027. selector: "nextSiblingNode:",
  43028. protocol: '*Compiler-Interpreter',
  43029. fn: function (aNode){
  43030. var self=this;
  43031. return nil;
  43032. },
  43033. args: ["aNode"],
  43034. source: "nextSiblingNode: aNode\x0a\x09\x22Answer nil as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09\x22In fact, this should not have been called, ever. IMO. -- herby\x22\x0a\x09\x0a\x09^ nil",
  43035. referencedClasses: [],
  43036. messageSends: []
  43037. }),
  43038. $globals.BlockNode);
  43039. $core.addMethod(
  43040. $core.method({
  43041. selector: "isSteppingNode",
  43042. protocol: '*Compiler-Interpreter',
  43043. fn: function (){
  43044. var self=this;
  43045. return true;
  43046. },
  43047. args: [],
  43048. source: "isSteppingNode\x0a\x09^ true",
  43049. referencedClasses: [],
  43050. messageSends: []
  43051. }),
  43052. $globals.DynamicArrayNode);
  43053. $core.addMethod(
  43054. $core.method({
  43055. selector: "isSteppingNode",
  43056. protocol: '*Compiler-Interpreter',
  43057. fn: function (){
  43058. var self=this;
  43059. return true;
  43060. },
  43061. args: [],
  43062. source: "isSteppingNode\x0a\x09^ true",
  43063. referencedClasses: [],
  43064. messageSends: []
  43065. }),
  43066. $globals.DynamicDictionaryNode);
  43067. $core.addMethod(
  43068. $core.method({
  43069. selector: "isSteppingNode",
  43070. protocol: '*Compiler-Interpreter',
  43071. fn: function (){
  43072. var self=this;
  43073. return true;
  43074. },
  43075. args: [],
  43076. source: "isSteppingNode\x0a\x09^ true",
  43077. referencedClasses: [],
  43078. messageSends: []
  43079. }),
  43080. $globals.JSStatementNode);
  43081. $core.addMethod(
  43082. $core.method({
  43083. selector: "isSteppingNode",
  43084. protocol: '*Compiler-Interpreter',
  43085. fn: function (){
  43086. var self=this;
  43087. return false;
  43088. },
  43089. args: [],
  43090. source: "isSteppingNode\x0a\x09^ false",
  43091. referencedClasses: [],
  43092. messageSends: []
  43093. }),
  43094. $globals.Node);
  43095. $core.addMethod(
  43096. $core.method({
  43097. selector: "nextSiblingNode:",
  43098. protocol: '*Compiler-Interpreter',
  43099. fn: function (aNode){
  43100. var self=this;
  43101. return $core.withContext(function($ctx1) {
  43102. var $1;
  43103. var $early={};
  43104. try {
  43105. $1=self._nodes();
  43106. $ctx1.sendIdx["nodes"]=1;
  43107. return $recv($1)._at_ifAbsent_($recv($recv(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){
  43108. throw $early=[nil];
  43109. }));
  43110. }
  43111. catch(e) {if(e===$early)return e[0]; throw e}
  43112. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.Node)});
  43113. },
  43114. args: ["aNode"],
  43115. source: "nextSiblingNode: aNode\x0a\x09\x22Answer the next node after aNode or nil\x22\x0a\x09\x0a\x09^ self nodes \x0a\x09\x09at: (self nodes indexOf: aNode) + 1\x0a\x09\x09ifAbsent: [ ^ nil ]",
  43116. referencedClasses: [],
  43117. messageSends: ["at:ifAbsent:", "nodes", "+", "indexOf:"]
  43118. }),
  43119. $globals.Node);
  43120. $core.addMethod(
  43121. $core.method({
  43122. selector: "isSteppingNode",
  43123. protocol: '*Compiler-Interpreter',
  43124. fn: function (){
  43125. var self=this;
  43126. return true;
  43127. },
  43128. args: [],
  43129. source: "isSteppingNode\x0a\x09^ true",
  43130. referencedClasses: [],
  43131. messageSends: []
  43132. }),
  43133. $globals.SendNode);
  43134. });
  43135. define('amber/lang',[
  43136. './helpers', // pre-fetch, dep of ./deploy
  43137. './deploy',
  43138. './parser',
  43139. // --- packages for the Amber reflection begin here ---
  43140. 'amber_core/Platform-ImportExport',
  43141. 'amber_core/Compiler-Core',
  43142. 'amber_core/Compiler-AST',
  43143. 'amber_core/Compiler-Semantic',
  43144. 'amber_core/Compiler-IR',
  43145. 'amber_core/Compiler-Inlining',
  43146. 'amber_core/Compiler-Interpreter'
  43147. // --- packages for the Amber reflection end here ---
  43148. ], function (amber) { return amber; });
  43149. define("amber_core/SUnit", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Classes"], function($boot){"use strict";
  43150. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  43151. $core.addPackage('SUnit');
  43152. $core.packages["SUnit"].innerEval = function (expr) { return eval(expr); };
  43153. $core.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  43154. $core.addClass('ResultAnnouncement', $globals.Object, ['result'], 'SUnit');
  43155. $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.";
  43156. $core.addMethod(
  43157. $core.method({
  43158. selector: "result",
  43159. protocol: 'accessing',
  43160. fn: function (){
  43161. var self=this;
  43162. return self["@result"];
  43163. },
  43164. args: [],
  43165. source: "result\x0a\x09^ result",
  43166. referencedClasses: [],
  43167. messageSends: []
  43168. }),
  43169. $globals.ResultAnnouncement);
  43170. $core.addMethod(
  43171. $core.method({
  43172. selector: "result:",
  43173. protocol: 'accessing',
  43174. fn: function (aTestResult){
  43175. var self=this;
  43176. self["@result"]=aTestResult;
  43177. return self;
  43178. },
  43179. args: ["aTestResult"],
  43180. source: "result: aTestResult\x0a\x09result := aTestResult",
  43181. referencedClasses: [],
  43182. messageSends: []
  43183. }),
  43184. $globals.ResultAnnouncement);
  43185. $core.addClass('TestCase', $globals.Object, ['testSelector', 'asyncTimeout', 'context'], 'SUnit');
  43186. $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.";
  43187. $core.addMethod(
  43188. $core.method({
  43189. selector: "assert:",
  43190. protocol: 'testing',
  43191. fn: function (aBoolean){
  43192. var self=this;
  43193. return $core.withContext(function($ctx1) {
  43194. self._assert_description_(aBoolean,"Assertion failed");
  43195. return self;
  43196. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  43197. },
  43198. args: ["aBoolean"],
  43199. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  43200. referencedClasses: [],
  43201. messageSends: ["assert:description:"]
  43202. }),
  43203. $globals.TestCase);
  43204. $core.addMethod(
  43205. $core.method({
  43206. selector: "assert:description:",
  43207. protocol: 'testing',
  43208. fn: function (aBoolean,aString){
  43209. var self=this;
  43210. return $core.withContext(function($ctx1) {
  43211. if(!$core.assert(aBoolean)){
  43212. self._signalFailure_(aString);
  43213. };
  43214. return self;
  43215. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  43216. },
  43217. args: ["aBoolean", "aString"],
  43218. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  43219. referencedClasses: [],
  43220. messageSends: ["ifFalse:", "signalFailure:"]
  43221. }),
  43222. $globals.TestCase);
  43223. $core.addMethod(
  43224. $core.method({
  43225. selector: "assert:equals:",
  43226. protocol: 'testing',
  43227. fn: function (actual,expected){
  43228. var self=this;
  43229. return $core.withContext(function($ctx1) {
  43230. var $1,$5,$4,$3,$2;
  43231. $1=$recv(actual).__eq(expected);
  43232. $5=$recv(expected)._printString();
  43233. $ctx1.sendIdx["printString"]=1;
  43234. $4="Expected: ".__comma($5);
  43235. $3=$recv($4).__comma(" but was: ");
  43236. $ctx1.sendIdx[","]=2;
  43237. $2=$recv($3).__comma($recv(actual)._printString());
  43238. $ctx1.sendIdx[","]=1;
  43239. return self._assert_description_($1,$2);
  43240. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  43241. },
  43242. args: ["actual", "expected"],
  43243. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  43244. referencedClasses: [],
  43245. messageSends: ["assert:description:", "=", ",", "printString"]
  43246. }),
  43247. $globals.TestCase);
  43248. $core.addMethod(
  43249. $core.method({
  43250. selector: "async:",
  43251. protocol: 'async',
  43252. fn: function (aBlock){
  43253. var self=this;
  43254. var c;
  43255. return $core.withContext(function($ctx1) {
  43256. var $1;
  43257. self._errorIfNotAsync_("#async");
  43258. c=self["@context"];
  43259. return (function(){
  43260. return $core.withContext(function($ctx2) {
  43261. $1=self._isAsync();
  43262. if($core.assert($1)){
  43263. return $recv(c)._execute_(aBlock);
  43264. };
  43265. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43266. });
  43267. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  43268. },
  43269. args: ["aBlock"],
  43270. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  43271. referencedClasses: [],
  43272. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  43273. }),
  43274. $globals.TestCase);
  43275. $core.addMethod(
  43276. $core.method({
  43277. selector: "context:",
  43278. protocol: 'accessing',
  43279. fn: function (aRunningTestContext){
  43280. var self=this;
  43281. self["@context"]=aRunningTestContext;
  43282. return self;
  43283. },
  43284. args: ["aRunningTestContext"],
  43285. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  43286. referencedClasses: [],
  43287. messageSends: []
  43288. }),
  43289. $globals.TestCase);
  43290. $core.addMethod(
  43291. $core.method({
  43292. selector: "deny:",
  43293. protocol: 'testing',
  43294. fn: function (aBoolean){
  43295. var self=this;
  43296. return $core.withContext(function($ctx1) {
  43297. self._assert_($recv(aBoolean)._not());
  43298. return self;
  43299. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  43300. },
  43301. args: ["aBoolean"],
  43302. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  43303. referencedClasses: [],
  43304. messageSends: ["assert:", "not"]
  43305. }),
  43306. $globals.TestCase);
  43307. $core.addMethod(
  43308. $core.method({
  43309. selector: "errorIfNotAsync:",
  43310. protocol: 'error handling',
  43311. fn: function (aString){
  43312. var self=this;
  43313. return $core.withContext(function($ctx1) {
  43314. var $1;
  43315. $1=self._isAsync();
  43316. if(!$core.assert($1)){
  43317. self._error_($recv(aString).__comma(" used without prior #timeout:"));
  43318. };
  43319. return self;
  43320. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  43321. },
  43322. args: ["aString"],
  43323. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  43324. referencedClasses: [],
  43325. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  43326. }),
  43327. $globals.TestCase);
  43328. $core.addMethod(
  43329. $core.method({
  43330. selector: "finished",
  43331. protocol: 'async',
  43332. fn: function (){
  43333. var self=this;
  43334. return $core.withContext(function($ctx1) {
  43335. self._errorIfNotAsync_("#finished");
  43336. self["@asyncTimeout"]=nil;
  43337. return self;
  43338. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  43339. },
  43340. args: [],
  43341. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  43342. referencedClasses: [],
  43343. messageSends: ["errorIfNotAsync:"]
  43344. }),
  43345. $globals.TestCase);
  43346. $core.addMethod(
  43347. $core.method({
  43348. selector: "isAsync",
  43349. protocol: 'testing',
  43350. fn: function (){
  43351. var self=this;
  43352. return $core.withContext(function($ctx1) {
  43353. return $recv(self["@asyncTimeout"])._notNil();
  43354. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  43355. },
  43356. args: [],
  43357. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  43358. referencedClasses: [],
  43359. messageSends: ["notNil"]
  43360. }),
  43361. $globals.TestCase);
  43362. $core.addMethod(
  43363. $core.method({
  43364. selector: "performTest",
  43365. protocol: 'running',
  43366. fn: function (){
  43367. var self=this;
  43368. return $core.withContext(function($ctx1) {
  43369. self["@asyncTimeout"]=nil;
  43370. self._perform_(self._selector());
  43371. return self;
  43372. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  43373. },
  43374. args: [],
  43375. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  43376. referencedClasses: [],
  43377. messageSends: ["perform:", "selector"]
  43378. }),
  43379. $globals.TestCase);
  43380. $core.addMethod(
  43381. $core.method({
  43382. selector: "runCase",
  43383. protocol: 'running',
  43384. fn: function (){
  43385. var self=this;
  43386. function $TestContext(){return $globals.TestContext||(typeof TestContext=="undefined"?nil:TestContext)}
  43387. return $core.withContext(function($ctx1) {
  43388. $recv($recv($TestContext())._testCase_(self))._start();
  43389. return self;
  43390. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  43391. },
  43392. args: [],
  43393. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  43394. referencedClasses: ["TestContext"],
  43395. messageSends: ["start", "testCase:"]
  43396. }),
  43397. $globals.TestCase);
  43398. $core.addMethod(
  43399. $core.method({
  43400. selector: "selector",
  43401. protocol: 'accessing',
  43402. fn: function (){
  43403. var self=this;
  43404. return self["@testSelector"];
  43405. },
  43406. args: [],
  43407. source: "selector\x0a\x09^ testSelector",
  43408. referencedClasses: [],
  43409. messageSends: []
  43410. }),
  43411. $globals.TestCase);
  43412. $core.addMethod(
  43413. $core.method({
  43414. selector: "setTestSelector:",
  43415. protocol: 'accessing',
  43416. fn: function (aSelector){
  43417. var self=this;
  43418. self["@testSelector"]=aSelector;
  43419. return self;
  43420. },
  43421. args: ["aSelector"],
  43422. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  43423. referencedClasses: [],
  43424. messageSends: []
  43425. }),
  43426. $globals.TestCase);
  43427. $core.addMethod(
  43428. $core.method({
  43429. selector: "setUp",
  43430. protocol: 'running',
  43431. fn: function (){
  43432. var self=this;
  43433. return self;
  43434. },
  43435. args: [],
  43436. source: "setUp",
  43437. referencedClasses: [],
  43438. messageSends: []
  43439. }),
  43440. $globals.TestCase);
  43441. $core.addMethod(
  43442. $core.method({
  43443. selector: "should:",
  43444. protocol: 'testing',
  43445. fn: function (aBlock){
  43446. var self=this;
  43447. return $core.withContext(function($ctx1) {
  43448. self._assert_($recv(aBlock)._value());
  43449. return self;
  43450. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  43451. },
  43452. args: ["aBlock"],
  43453. source: "should: aBlock\x0a\x09self assert: aBlock value",
  43454. referencedClasses: [],
  43455. messageSends: ["assert:", "value"]
  43456. }),
  43457. $globals.TestCase);
  43458. $core.addMethod(
  43459. $core.method({
  43460. selector: "should:raise:",
  43461. protocol: 'testing',
  43462. fn: function (aBlock,anExceptionClass){
  43463. var self=this;
  43464. return $core.withContext(function($ctx1) {
  43465. self._assert_($recv((function(){
  43466. return $core.withContext(function($ctx2) {
  43467. $recv(aBlock)._value();
  43468. return false;
  43469. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43470. }))._on_do_(anExceptionClass,(function(ex){
  43471. return true;
  43472. })));
  43473. return self;
  43474. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  43475. },
  43476. args: ["aBlock", "anExceptionClass"],
  43477. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  43478. referencedClasses: [],
  43479. messageSends: ["assert:", "on:do:", "value"]
  43480. }),
  43481. $globals.TestCase);
  43482. $core.addMethod(
  43483. $core.method({
  43484. selector: "shouldnt:raise:",
  43485. protocol: 'testing',
  43486. fn: function (aBlock,anExceptionClass){
  43487. var self=this;
  43488. return $core.withContext(function($ctx1) {
  43489. self._assert_($recv((function(){
  43490. return $core.withContext(function($ctx2) {
  43491. $recv(aBlock)._value();
  43492. return true;
  43493. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43494. }))._on_do_(anExceptionClass,(function(ex){
  43495. return false;
  43496. })));
  43497. return self;
  43498. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  43499. },
  43500. args: ["aBlock", "anExceptionClass"],
  43501. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  43502. referencedClasses: [],
  43503. messageSends: ["assert:", "on:do:", "value"]
  43504. }),
  43505. $globals.TestCase);
  43506. $core.addMethod(
  43507. $core.method({
  43508. selector: "signalFailure:",
  43509. protocol: 'private',
  43510. fn: function (aString){
  43511. var self=this;
  43512. function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  43513. return $core.withContext(function($ctx1) {
  43514. var $1;
  43515. $1=$recv($TestFailure())._new();
  43516. $recv($1)._messageText_(aString);
  43517. $recv($1)._signal();
  43518. return self;
  43519. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  43520. },
  43521. args: ["aString"],
  43522. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  43523. referencedClasses: ["TestFailure"],
  43524. messageSends: ["messageText:", "new", "signal"]
  43525. }),
  43526. $globals.TestCase);
  43527. $core.addMethod(
  43528. $core.method({
  43529. selector: "tearDown",
  43530. protocol: 'running',
  43531. fn: function (){
  43532. var self=this;
  43533. return self;
  43534. },
  43535. args: [],
  43536. source: "tearDown",
  43537. referencedClasses: [],
  43538. messageSends: []
  43539. }),
  43540. $globals.TestCase);
  43541. $core.addMethod(
  43542. $core.method({
  43543. selector: "timeout:",
  43544. protocol: 'async',
  43545. fn: function (aNumber){
  43546. var self=this;
  43547. return $core.withContext(function($ctx1) {
  43548. var $1,$receiver;
  43549. $1=self["@asyncTimeout"];
  43550. if(($receiver = $1) == null || $receiver.isNil){
  43551. $1;
  43552. } else {
  43553. $recv(self["@asyncTimeout"])._clearTimeout();
  43554. };
  43555. self["@asyncTimeout"]=(0);
  43556. self["@asyncTimeout"]=$recv(self._async_((function(){
  43557. return $core.withContext(function($ctx2) {
  43558. return self._assert_description_(false,"SUnit grace time exhausted");
  43559. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43560. })))._valueWithTimeout_(aNumber);
  43561. return self;
  43562. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  43563. },
  43564. args: ["aNumber"],
  43565. 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",
  43566. referencedClasses: [],
  43567. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  43568. }),
  43569. $globals.TestCase);
  43570. $core.addMethod(
  43571. $core.method({
  43572. selector: "allTestSelectors",
  43573. protocol: 'accessing',
  43574. fn: function (){
  43575. var self=this;
  43576. var selectors;
  43577. return $core.withContext(function($ctx1) {
  43578. var $1;
  43579. selectors=self._testSelectors();
  43580. $1=self._shouldInheritSelectors();
  43581. if($core.assert($1)){
  43582. $recv(selectors)._addAll_($recv(self._superclass())._allTestSelectors());
  43583. };
  43584. return selectors;
  43585. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.klass)});
  43586. },
  43587. args: [],
  43588. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  43589. referencedClasses: [],
  43590. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  43591. }),
  43592. $globals.TestCase.klass);
  43593. $core.addMethod(
  43594. $core.method({
  43595. selector: "buildSuite",
  43596. protocol: 'accessing',
  43597. fn: function (){
  43598. var self=this;
  43599. return $core.withContext(function($ctx1) {
  43600. return $recv(self._allTestSelectors())._collect_((function(each){
  43601. return $core.withContext(function($ctx2) {
  43602. return self._selector_(each);
  43603. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43604. }));
  43605. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.klass)});
  43606. },
  43607. args: [],
  43608. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  43609. referencedClasses: [],
  43610. messageSends: ["collect:", "allTestSelectors", "selector:"]
  43611. }),
  43612. $globals.TestCase.klass);
  43613. $core.addMethod(
  43614. $core.method({
  43615. selector: "classTag",
  43616. protocol: 'accessing',
  43617. fn: function (){
  43618. var self=this;
  43619. return "test";
  43620. },
  43621. args: [],
  43622. 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'",
  43623. referencedClasses: [],
  43624. messageSends: []
  43625. }),
  43626. $globals.TestCase.klass);
  43627. $core.addMethod(
  43628. $core.method({
  43629. selector: "isAbstract",
  43630. protocol: 'testing',
  43631. fn: function (){
  43632. var self=this;
  43633. return $core.withContext(function($ctx1) {
  43634. return $recv(self._name()).__eq("TestCase");
  43635. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.klass)});
  43636. },
  43637. args: [],
  43638. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  43639. referencedClasses: [],
  43640. messageSends: ["=", "name"]
  43641. }),
  43642. $globals.TestCase.klass);
  43643. $core.addMethod(
  43644. $core.method({
  43645. selector: "lookupHierarchyRoot",
  43646. protocol: 'accessing',
  43647. fn: function (){
  43648. var self=this;
  43649. function $TestCase(){return $globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)}
  43650. return $TestCase();
  43651. },
  43652. args: [],
  43653. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  43654. referencedClasses: ["TestCase"],
  43655. messageSends: []
  43656. }),
  43657. $globals.TestCase.klass);
  43658. $core.addMethod(
  43659. $core.method({
  43660. selector: "selector:",
  43661. protocol: 'accessing',
  43662. fn: function (aSelector){
  43663. var self=this;
  43664. return $core.withContext(function($ctx1) {
  43665. var $1;
  43666. $1=self._new();
  43667. $recv($1)._setTestSelector_(aSelector);
  43668. return $recv($1)._yourself();
  43669. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.klass)});
  43670. },
  43671. args: ["aSelector"],
  43672. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  43673. referencedClasses: [],
  43674. messageSends: ["setTestSelector:", "new", "yourself"]
  43675. }),
  43676. $globals.TestCase.klass);
  43677. $core.addMethod(
  43678. $core.method({
  43679. selector: "shouldInheritSelectors",
  43680. protocol: 'testing',
  43681. fn: function (){
  43682. var self=this;
  43683. return $core.withContext(function($ctx1) {
  43684. return self.__tild_eq(self._lookupHierarchyRoot());
  43685. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.klass)});
  43686. },
  43687. args: [],
  43688. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  43689. referencedClasses: [],
  43690. messageSends: ["~=", "lookupHierarchyRoot"]
  43691. }),
  43692. $globals.TestCase.klass);
  43693. $core.addMethod(
  43694. $core.method({
  43695. selector: "testSelectors",
  43696. protocol: 'accessing',
  43697. fn: function (){
  43698. var self=this;
  43699. return $core.withContext(function($ctx1) {
  43700. return $recv($recv(self._methodDictionary())._keys())._select_((function(each){
  43701. return $core.withContext(function($ctx2) {
  43702. return $recv(each)._match_("^test");
  43703. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43704. }));
  43705. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.klass)});
  43706. },
  43707. args: [],
  43708. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  43709. referencedClasses: [],
  43710. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  43711. }),
  43712. $globals.TestCase.klass);
  43713. $core.addClass('TestContext', $globals.Object, ['testCase'], 'SUnit');
  43714. $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).";
  43715. $core.addMethod(
  43716. $core.method({
  43717. selector: "execute:",
  43718. protocol: 'running',
  43719. fn: function (aBlock){
  43720. var self=this;
  43721. var failed;
  43722. return $core.withContext(function($ctx1) {
  43723. var $1,$2;
  43724. $recv(self["@testCase"])._context_(self);
  43725. $ctx1.sendIdx["context:"]=1;
  43726. $recv((function(){
  43727. return $core.withContext(function($ctx2) {
  43728. failed=true;
  43729. failed;
  43730. $recv(aBlock)._value();
  43731. failed=false;
  43732. return failed;
  43733. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43734. }))._ensure_((function(){
  43735. return $core.withContext(function($ctx2) {
  43736. $recv(self["@testCase"])._context_(nil);
  43737. $1=$recv(failed)._and_((function(){
  43738. return $core.withContext(function($ctx3) {
  43739. return $recv(self["@testCase"])._isAsync();
  43740. $ctx3.sendIdx["isAsync"]=1;
  43741. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  43742. }));
  43743. if($core.assert($1)){
  43744. $recv(self["@testCase"])._finished();
  43745. };
  43746. $2=$recv(self["@testCase"])._isAsync();
  43747. if(!$core.assert($2)){
  43748. return $recv(self["@testCase"])._tearDown();
  43749. };
  43750. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43751. }));
  43752. return self;
  43753. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  43754. },
  43755. args: ["aBlock"],
  43756. 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 ] ]",
  43757. referencedClasses: [],
  43758. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  43759. }),
  43760. $globals.TestContext);
  43761. $core.addMethod(
  43762. $core.method({
  43763. selector: "start",
  43764. protocol: 'running',
  43765. fn: function (){
  43766. var self=this;
  43767. return $core.withContext(function($ctx1) {
  43768. self._execute_((function(){
  43769. return $core.withContext(function($ctx2) {
  43770. $recv(self["@testCase"])._setUp();
  43771. return $recv(self["@testCase"])._performTest();
  43772. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43773. }));
  43774. return self;
  43775. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  43776. },
  43777. args: [],
  43778. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  43779. referencedClasses: [],
  43780. messageSends: ["execute:", "setUp", "performTest"]
  43781. }),
  43782. $globals.TestContext);
  43783. $core.addMethod(
  43784. $core.method({
  43785. selector: "testCase:",
  43786. protocol: 'accessing',
  43787. fn: function (aTestCase){
  43788. var self=this;
  43789. self["@testCase"]=aTestCase;
  43790. return self;
  43791. },
  43792. args: ["aTestCase"],
  43793. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  43794. referencedClasses: [],
  43795. messageSends: []
  43796. }),
  43797. $globals.TestContext);
  43798. $core.addMethod(
  43799. $core.method({
  43800. selector: "testCase:",
  43801. protocol: 'instance creation',
  43802. fn: function (aTestCase){
  43803. var self=this;
  43804. return $core.withContext(function($ctx1) {
  43805. var $1;
  43806. $1=self._new();
  43807. $recv($1)._testCase_(aTestCase);
  43808. return $recv($1)._yourself();
  43809. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.klass)});
  43810. },
  43811. args: ["aTestCase"],
  43812. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  43813. referencedClasses: [],
  43814. messageSends: ["testCase:", "new", "yourself"]
  43815. }),
  43816. $globals.TestContext.klass);
  43817. $core.addClass('ReportingTestContext', $globals.TestContext, ['finished', 'result'], 'SUnit');
  43818. $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`.";
  43819. $core.addMethod(
  43820. $core.method({
  43821. selector: "execute:",
  43822. protocol: 'running',
  43823. fn: function (aBlock){
  43824. var self=this;
  43825. return $core.withContext(function($ctx1) {
  43826. var $1;
  43827. $recv((function(){
  43828. return $core.withContext(function($ctx2) {
  43829. return self._withErrorReporting_((function(){
  43830. return $core.withContext(function($ctx3) {
  43831. return (
  43832. $ctx3.supercall = true,
  43833. ($globals.ReportingTestContext.superclass||$boot.dnu).fn.prototype._execute_.apply($recv(self), [aBlock]));
  43834. $ctx3.supercall = false;
  43835. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43836. }));
  43837. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43838. }))._ensure_((function(){
  43839. return $core.withContext(function($ctx2) {
  43840. $1=$recv(self["@testCase"])._isAsync();
  43841. if(!$core.assert($1)){
  43842. $recv(self["@result"])._increaseRuns();
  43843. return $recv(self["@finished"])._value();
  43844. };
  43845. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43846. }));
  43847. return self;
  43848. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  43849. },
  43850. args: ["aBlock"],
  43851. 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 ] ]",
  43852. referencedClasses: [],
  43853. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  43854. }),
  43855. $globals.ReportingTestContext);
  43856. $core.addMethod(
  43857. $core.method({
  43858. selector: "finished:",
  43859. protocol: 'accessing',
  43860. fn: function (aBlock){
  43861. var self=this;
  43862. self["@finished"]=aBlock;
  43863. return self;
  43864. },
  43865. args: ["aBlock"],
  43866. source: "finished: aBlock\x0a\x09finished := aBlock",
  43867. referencedClasses: [],
  43868. messageSends: []
  43869. }),
  43870. $globals.ReportingTestContext);
  43871. $core.addMethod(
  43872. $core.method({
  43873. selector: "result:",
  43874. protocol: 'accessing',
  43875. fn: function (aTestResult){
  43876. var self=this;
  43877. self["@result"]=aTestResult;
  43878. return self;
  43879. },
  43880. args: ["aTestResult"],
  43881. source: "result: aTestResult\x0a\x09result := aTestResult",
  43882. referencedClasses: [],
  43883. messageSends: []
  43884. }),
  43885. $globals.ReportingTestContext);
  43886. $core.addMethod(
  43887. $core.method({
  43888. selector: "withErrorReporting:",
  43889. protocol: 'private',
  43890. fn: function (aBlock){
  43891. var self=this;
  43892. function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  43893. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  43894. return $core.withContext(function($ctx1) {
  43895. $recv((function(){
  43896. return $core.withContext(function($ctx2) {
  43897. return $recv(aBlock)._on_do_($TestFailure(),(function(ex){
  43898. return $core.withContext(function($ctx3) {
  43899. return $recv(self["@result"])._addFailure_(self["@testCase"]);
  43900. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  43901. }));
  43902. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43903. }))._on_do_($Error(),(function(ex){
  43904. return $core.withContext(function($ctx2) {
  43905. return $recv(self["@result"])._addError_(self["@testCase"]);
  43906. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  43907. }));
  43908. $ctx1.sendIdx["on:do:"]=1;
  43909. return self;
  43910. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  43911. },
  43912. args: ["aBlock"],
  43913. 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 ]",
  43914. referencedClasses: ["TestFailure", "Error"],
  43915. messageSends: ["on:do:", "addFailure:", "addError:"]
  43916. }),
  43917. $globals.ReportingTestContext);
  43918. $core.addMethod(
  43919. $core.method({
  43920. selector: "testCase:result:finished:",
  43921. protocol: 'instance creation',
  43922. fn: function (aTestCase,aTestResult,aBlock){
  43923. var self=this;
  43924. return $core.withContext(function($ctx1) {
  43925. var $1;
  43926. $1=(
  43927. $ctx1.supercall = true,
  43928. ($globals.ReportingTestContext.klass.superclass||$boot.dnu).fn.prototype._testCase_.apply($recv(self), [aTestCase]));
  43929. $ctx1.supercall = false;
  43930. $recv($1)._result_(aTestResult);
  43931. $recv($1)._finished_(aBlock);
  43932. return $recv($1)._yourself();
  43933. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.klass)});
  43934. },
  43935. args: ["aTestCase", "aTestResult", "aBlock"],
  43936. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  43937. referencedClasses: [],
  43938. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  43939. }),
  43940. $globals.ReportingTestContext.klass);
  43941. $core.addClass('TestFailure', $globals.Error, [], 'SUnit');
  43942. $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.";
  43943. $core.addClass('TestResult', $globals.Object, ['timestamp', 'runs', 'errors', 'failures', 'total'], 'SUnit');
  43944. $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";
  43945. $core.addMethod(
  43946. $core.method({
  43947. selector: "addError:",
  43948. protocol: 'accessing',
  43949. fn: function (anError){
  43950. var self=this;
  43951. return $core.withContext(function($ctx1) {
  43952. $recv(self._errors())._add_(anError);
  43953. return self;
  43954. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  43955. },
  43956. args: ["anError"],
  43957. source: "addError: anError\x0a\x09self errors add: anError",
  43958. referencedClasses: [],
  43959. messageSends: ["add:", "errors"]
  43960. }),
  43961. $globals.TestResult);
  43962. $core.addMethod(
  43963. $core.method({
  43964. selector: "addFailure:",
  43965. protocol: 'accessing',
  43966. fn: function (aFailure){
  43967. var self=this;
  43968. return $core.withContext(function($ctx1) {
  43969. $recv(self._failures())._add_(aFailure);
  43970. return self;
  43971. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  43972. },
  43973. args: ["aFailure"],
  43974. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  43975. referencedClasses: [],
  43976. messageSends: ["add:", "failures"]
  43977. }),
  43978. $globals.TestResult);
  43979. $core.addMethod(
  43980. $core.method({
  43981. selector: "errors",
  43982. protocol: 'accessing',
  43983. fn: function (){
  43984. var self=this;
  43985. return self["@errors"];
  43986. },
  43987. args: [],
  43988. source: "errors\x0a\x09^ errors",
  43989. referencedClasses: [],
  43990. messageSends: []
  43991. }),
  43992. $globals.TestResult);
  43993. $core.addMethod(
  43994. $core.method({
  43995. selector: "failures",
  43996. protocol: 'accessing',
  43997. fn: function (){
  43998. var self=this;
  43999. return self["@failures"];
  44000. },
  44001. args: [],
  44002. source: "failures\x0a\x09^ failures",
  44003. referencedClasses: [],
  44004. messageSends: []
  44005. }),
  44006. $globals.TestResult);
  44007. $core.addMethod(
  44008. $core.method({
  44009. selector: "increaseRuns",
  44010. protocol: 'accessing',
  44011. fn: function (){
  44012. var self=this;
  44013. return $core.withContext(function($ctx1) {
  44014. self["@runs"]=$recv(self["@runs"]).__plus((1));
  44015. return self;
  44016. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  44017. },
  44018. args: [],
  44019. source: "increaseRuns\x0a\x09runs := runs + 1",
  44020. referencedClasses: [],
  44021. messageSends: ["+"]
  44022. }),
  44023. $globals.TestResult);
  44024. $core.addMethod(
  44025. $core.method({
  44026. selector: "initialize",
  44027. protocol: 'initialization',
  44028. fn: function (){
  44029. var self=this;
  44030. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  44031. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  44032. return $core.withContext(function($ctx1) {
  44033. (
  44034. $ctx1.supercall = true,
  44035. ($globals.TestResult.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  44036. $ctx1.supercall = false;
  44037. self["@timestamp"]=$recv($Date())._now();
  44038. self["@runs"]=(0);
  44039. self["@errors"]=$recv($Array())._new();
  44040. $ctx1.sendIdx["new"]=1;
  44041. self["@failures"]=$recv($Array())._new();
  44042. self["@total"]=(0);
  44043. return self;
  44044. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  44045. },
  44046. args: [],
  44047. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  44048. referencedClasses: ["Date", "Array"],
  44049. messageSends: ["initialize", "now", "new"]
  44050. }),
  44051. $globals.TestResult);
  44052. $core.addMethod(
  44053. $core.method({
  44054. selector: "nextRunDo:",
  44055. protocol: 'running',
  44056. fn: function (aBlock){
  44057. var self=this;
  44058. return $core.withContext(function($ctx1) {
  44059. var $2,$1;
  44060. $2=self._runs();
  44061. $ctx1.sendIdx["runs"]=1;
  44062. $1=$recv($2).__eq_eq(self._total());
  44063. if(!$core.assert($1)){
  44064. return $recv(aBlock)._value_($recv(self._runs()).__plus((1)));
  44065. };
  44066. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  44067. },
  44068. args: ["aBlock"],
  44069. 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 ]",
  44070. referencedClasses: [],
  44071. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  44072. }),
  44073. $globals.TestResult);
  44074. $core.addMethod(
  44075. $core.method({
  44076. selector: "runCase:",
  44077. protocol: 'running',
  44078. fn: function (aTestCase){
  44079. var self=this;
  44080. function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  44081. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  44082. return $core.withContext(function($ctx1) {
  44083. $recv((function(){
  44084. return $core.withContext(function($ctx2) {
  44085. return $recv((function(){
  44086. return $core.withContext(function($ctx3) {
  44087. self._increaseRuns();
  44088. return $recv(aTestCase)._runCase();
  44089. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44090. }))._on_do_($TestFailure(),(function(ex){
  44091. return $core.withContext(function($ctx3) {
  44092. return self._addFailure_(aTestCase);
  44093. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  44094. }));
  44095. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44096. }))._on_do_($Error(),(function(ex){
  44097. return $core.withContext(function($ctx2) {
  44098. return self._addError_(aTestCase);
  44099. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  44100. }));
  44101. $ctx1.sendIdx["on:do:"]=1;
  44102. return self;
  44103. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  44104. },
  44105. args: ["aTestCase"],
  44106. 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 ]",
  44107. referencedClasses: ["TestFailure", "Error"],
  44108. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  44109. }),
  44110. $globals.TestResult);
  44111. $core.addMethod(
  44112. $core.method({
  44113. selector: "runs",
  44114. protocol: 'accessing',
  44115. fn: function (){
  44116. var self=this;
  44117. return self["@runs"];
  44118. },
  44119. args: [],
  44120. source: "runs\x0a\x09^ runs",
  44121. referencedClasses: [],
  44122. messageSends: []
  44123. }),
  44124. $globals.TestResult);
  44125. $core.addMethod(
  44126. $core.method({
  44127. selector: "status",
  44128. protocol: 'accessing',
  44129. fn: function (){
  44130. var self=this;
  44131. return $core.withContext(function($ctx1) {
  44132. var $2,$3,$1;
  44133. $2=$recv(self._errors())._isEmpty();
  44134. $ctx1.sendIdx["isEmpty"]=1;
  44135. if($core.assert($2)){
  44136. $3=$recv(self._failures())._isEmpty();
  44137. if($core.assert($3)){
  44138. $1="success";
  44139. } else {
  44140. $1="failure";
  44141. };
  44142. } else {
  44143. $1="error";
  44144. };
  44145. return $1;
  44146. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  44147. },
  44148. args: [],
  44149. 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' ]",
  44150. referencedClasses: [],
  44151. messageSends: ["ifTrue:ifFalse:", "isEmpty", "errors", "failures"]
  44152. }),
  44153. $globals.TestResult);
  44154. $core.addMethod(
  44155. $core.method({
  44156. selector: "timestamp",
  44157. protocol: 'accessing',
  44158. fn: function (){
  44159. var self=this;
  44160. return self["@timestamp"];
  44161. },
  44162. args: [],
  44163. source: "timestamp\x0a\x09^ timestamp",
  44164. referencedClasses: [],
  44165. messageSends: []
  44166. }),
  44167. $globals.TestResult);
  44168. $core.addMethod(
  44169. $core.method({
  44170. selector: "total",
  44171. protocol: 'accessing',
  44172. fn: function (){
  44173. var self=this;
  44174. return self["@total"];
  44175. },
  44176. args: [],
  44177. source: "total\x0a\x09^ total",
  44178. referencedClasses: [],
  44179. messageSends: []
  44180. }),
  44181. $globals.TestResult);
  44182. $core.addMethod(
  44183. $core.method({
  44184. selector: "total:",
  44185. protocol: 'accessing',
  44186. fn: function (aNumber){
  44187. var self=this;
  44188. self["@total"]=aNumber;
  44189. return self;
  44190. },
  44191. args: ["aNumber"],
  44192. source: "total: aNumber\x0a\x09total := aNumber",
  44193. referencedClasses: [],
  44194. messageSends: []
  44195. }),
  44196. $globals.TestResult);
  44197. $core.addClass('TestSuiteRunner', $globals.Object, ['suite', 'result', 'announcer', 'runNextTest'], 'SUnit');
  44198. $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`.";
  44199. $core.addMethod(
  44200. $core.method({
  44201. selector: "announcer",
  44202. protocol: 'accessing',
  44203. fn: function (){
  44204. var self=this;
  44205. return self["@announcer"];
  44206. },
  44207. args: [],
  44208. source: "announcer\x0a\x09^ announcer",
  44209. referencedClasses: [],
  44210. messageSends: []
  44211. }),
  44212. $globals.TestSuiteRunner);
  44213. $core.addMethod(
  44214. $core.method({
  44215. selector: "contextOf:",
  44216. protocol: 'private',
  44217. fn: function (anInteger){
  44218. var self=this;
  44219. function $ReportingTestContext(){return $globals.ReportingTestContext||(typeof ReportingTestContext=="undefined"?nil:ReportingTestContext)}
  44220. return $core.withContext(function($ctx1) {
  44221. return $recv($ReportingTestContext())._testCase_result_finished_($recv(self["@suite"])._at_(anInteger),self["@result"],(function(){
  44222. return $core.withContext(function($ctx2) {
  44223. return self._resume();
  44224. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44225. }));
  44226. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  44227. },
  44228. args: ["anInteger"],
  44229. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  44230. referencedClasses: ["ReportingTestContext"],
  44231. messageSends: ["testCase:result:finished:", "at:", "resume"]
  44232. }),
  44233. $globals.TestSuiteRunner);
  44234. $core.addMethod(
  44235. $core.method({
  44236. selector: "initialize",
  44237. protocol: 'initialization',
  44238. fn: function (){
  44239. var self=this;
  44240. function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  44241. function $TestResult(){return $globals.TestResult||(typeof TestResult=="undefined"?nil:TestResult)}
  44242. return $core.withContext(function($ctx1) {
  44243. var $1;
  44244. (
  44245. $ctx1.supercall = true,
  44246. ($globals.TestSuiteRunner.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  44247. $ctx1.supercall = false;
  44248. self["@announcer"]=$recv($Announcer())._new();
  44249. $ctx1.sendIdx["new"]=1;
  44250. self["@result"]=$recv($TestResult())._new();
  44251. self["@runNextTest"]=(function(){
  44252. var runs;
  44253. return $core.withContext(function($ctx2) {
  44254. runs=$recv(self["@result"])._runs();
  44255. runs;
  44256. $1=$recv(runs).__lt($recv(self["@result"])._total());
  44257. if($core.assert($1)){
  44258. return $recv(self._contextOf_($recv(runs).__plus((1))))._start();
  44259. };
  44260. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  44261. });
  44262. return self;
  44263. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  44264. },
  44265. args: [],
  44266. 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 ] ].",
  44267. referencedClasses: ["Announcer", "TestResult"],
  44268. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  44269. }),
  44270. $globals.TestSuiteRunner);
  44271. $core.addMethod(
  44272. $core.method({
  44273. selector: "result",
  44274. protocol: 'accessing',
  44275. fn: function (){
  44276. var self=this;
  44277. return self["@result"];
  44278. },
  44279. args: [],
  44280. source: "result\x0a\x09^ result",
  44281. referencedClasses: [],
  44282. messageSends: []
  44283. }),
  44284. $globals.TestSuiteRunner);
  44285. $core.addMethod(
  44286. $core.method({
  44287. selector: "resume",
  44288. protocol: 'actions',
  44289. fn: function (){
  44290. var self=this;
  44291. function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  44292. return $core.withContext(function($ctx1) {
  44293. $recv(self["@runNextTest"])._fork();
  44294. $recv(self["@announcer"])._announce_($recv($recv($ResultAnnouncement())._new())._result_(self["@result"]));
  44295. return self;
  44296. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  44297. },
  44298. args: [],
  44299. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  44300. referencedClasses: ["ResultAnnouncement"],
  44301. messageSends: ["fork", "announce:", "result:", "new"]
  44302. }),
  44303. $globals.TestSuiteRunner);
  44304. $core.addMethod(
  44305. $core.method({
  44306. selector: "run",
  44307. protocol: 'actions',
  44308. fn: function (){
  44309. var self=this;
  44310. return $core.withContext(function($ctx1) {
  44311. $recv(self["@result"])._total_($recv(self["@suite"])._size());
  44312. self._resume();
  44313. return self;
  44314. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  44315. },
  44316. args: [],
  44317. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  44318. referencedClasses: [],
  44319. messageSends: ["total:", "size", "resume"]
  44320. }),
  44321. $globals.TestSuiteRunner);
  44322. $core.addMethod(
  44323. $core.method({
  44324. selector: "suite:",
  44325. protocol: 'accessing',
  44326. fn: function (aCollection){
  44327. var self=this;
  44328. self["@suite"]=aCollection;
  44329. return self;
  44330. },
  44331. args: ["aCollection"],
  44332. source: "suite: aCollection\x0a\x09suite := aCollection",
  44333. referencedClasses: [],
  44334. messageSends: []
  44335. }),
  44336. $globals.TestSuiteRunner);
  44337. $core.addMethod(
  44338. $core.method({
  44339. selector: "new",
  44340. protocol: 'instance creation',
  44341. fn: function (){
  44342. var self=this;
  44343. return $core.withContext(function($ctx1) {
  44344. self._shouldNotImplement();
  44345. return self;
  44346. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.klass)});
  44347. },
  44348. args: [],
  44349. source: "new\x0a\x09self shouldNotImplement",
  44350. referencedClasses: [],
  44351. messageSends: ["shouldNotImplement"]
  44352. }),
  44353. $globals.TestSuiteRunner.klass);
  44354. $core.addMethod(
  44355. $core.method({
  44356. selector: "on:",
  44357. protocol: 'instance creation',
  44358. fn: function (aCollection){
  44359. var self=this;
  44360. return $core.withContext(function($ctx1) {
  44361. var $1;
  44362. $1=(
  44363. $ctx1.supercall = true,
  44364. ($globals.TestSuiteRunner.klass.superclass||$boot.dnu).fn.prototype._new.apply($recv(self), []));
  44365. $ctx1.supercall = false;
  44366. return $recv($1)._suite_(aCollection);
  44367. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.klass)});
  44368. },
  44369. args: ["aCollection"],
  44370. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  44371. referencedClasses: [],
  44372. messageSends: ["suite:", "new"]
  44373. }),
  44374. $globals.TestSuiteRunner.klass);
  44375. $core.addMethod(
  44376. $core.method({
  44377. selector: "isTestClass",
  44378. protocol: '*SUnit',
  44379. fn: function (){
  44380. var self=this;
  44381. function $TestCase(){return $globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)}
  44382. return $core.withContext(function($ctx1) {
  44383. return $recv(self._includesBehavior_($TestCase()))._and_((function(){
  44384. return $core.withContext(function($ctx2) {
  44385. return $recv(self._isAbstract())._not();
  44386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44387. }));
  44388. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.Behavior)});
  44389. },
  44390. args: [],
  44391. source: "isTestClass\x0a\x09^(self includesBehavior: TestCase) and: [ \x0a\x09\x09\x09self isAbstract not ]",
  44392. referencedClasses: ["TestCase"],
  44393. messageSends: ["and:", "includesBehavior:", "not", "isAbstract"]
  44394. }),
  44395. $globals.Behavior);
  44396. $core.addMethod(
  44397. $core.method({
  44398. selector: "isTestPackage",
  44399. protocol: '*SUnit',
  44400. fn: function (){
  44401. var self=this;
  44402. return $core.withContext(function($ctx1) {
  44403. return $recv(self._classes())._anySatisfy_((function(each){
  44404. return $core.withContext(function($ctx2) {
  44405. return $recv(each)._isTestClass();
  44406. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44407. }));
  44408. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  44409. },
  44410. args: [],
  44411. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  44412. referencedClasses: [],
  44413. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  44414. }),
  44415. $globals.Package);
  44416. });
  44417. define("amber_core/Compiler-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  44418. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  44419. $core.addPackage('Compiler-Tests');
  44420. $core.packages["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
  44421. $core.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  44422. $core.addClass('ASTParsingTest', $globals.TestCase, [], 'Compiler-Tests');
  44423. $core.addMethod(
  44424. $core.method({
  44425. selector: "analyze:forClass:",
  44426. protocol: 'convenience',
  44427. fn: function (aNode,aClass){
  44428. var self=this;
  44429. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  44430. return $core.withContext(function($ctx1) {
  44431. $recv($recv($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
  44432. return aNode;
  44433. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTParsingTest)});
  44434. },
  44435. args: ["aNode", "aClass"],
  44436. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  44437. referencedClasses: ["SemanticAnalyzer"],
  44438. messageSends: ["visit:", "on:"]
  44439. }),
  44440. $globals.ASTParsingTest);
  44441. $core.addMethod(
  44442. $core.method({
  44443. selector: "parse:",
  44444. protocol: 'parsing',
  44445. fn: function (aString){
  44446. var self=this;
  44447. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  44448. return $core.withContext(function($ctx1) {
  44449. return $recv($Smalltalk())._parse_(aString);
  44450. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTParsingTest)});
  44451. },
  44452. args: ["aString"],
  44453. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  44454. referencedClasses: ["Smalltalk"],
  44455. messageSends: ["parse:"]
  44456. }),
  44457. $globals.ASTParsingTest);
  44458. $core.addMethod(
  44459. $core.method({
  44460. selector: "parse:forClass:",
  44461. protocol: 'parsing',
  44462. fn: function (aString,aClass){
  44463. var self=this;
  44464. return $core.withContext(function($ctx1) {
  44465. return self._analyze_forClass_(self._parse_(aString),aClass);
  44466. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  44467. },
  44468. args: ["aString", "aClass"],
  44469. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  44470. referencedClasses: [],
  44471. messageSends: ["analyze:forClass:", "parse:"]
  44472. }),
  44473. $globals.ASTParsingTest);
  44474. $core.addClass('ASTPCNodeVisitorTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
  44475. $core.addMethod(
  44476. $core.method({
  44477. selector: "astPCNodeVisitor",
  44478. protocol: 'factory',
  44479. fn: function (){
  44480. var self=this;
  44481. function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  44482. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  44483. return $core.withContext(function($ctx1) {
  44484. var $1,$2;
  44485. $1=$recv($ASTPCNodeVisitor())._new();
  44486. $ctx1.sendIdx["new"]=1;
  44487. $2=$recv($recv($AIContext())._new())._yourself();
  44488. $ctx1.sendIdx["yourself"]=1;
  44489. $recv($1)._context_($2);
  44490. return $recv($1)._yourself();
  44491. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  44492. },
  44493. args: [],
  44494. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  44495. referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
  44496. messageSends: ["context:", "new", "yourself"]
  44497. }),
  44498. $globals.ASTPCNodeVisitorTest);
  44499. $core.addMethod(
  44500. $core.method({
  44501. selector: "astPCNodeVisitorForSelector:",
  44502. protocol: 'factory',
  44503. fn: function (aString){
  44504. var self=this;
  44505. function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  44506. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  44507. return $core.withContext(function($ctx1) {
  44508. var $1,$2;
  44509. $1=$recv($ASTPCNodeVisitor())._new();
  44510. $ctx1.sendIdx["new"]=1;
  44511. $recv($1)._selector_(aString);
  44512. $2=$recv($recv($AIContext())._new())._yourself();
  44513. $ctx1.sendIdx["yourself"]=1;
  44514. $recv($1)._context_($2);
  44515. return $recv($1)._yourself();
  44516. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  44517. },
  44518. args: ["aString"],
  44519. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  44520. referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
  44521. messageSends: ["selector:", "new", "context:", "yourself"]
  44522. }),
  44523. $globals.ASTPCNodeVisitorTest);
  44524. $core.addMethod(
  44525. $core.method({
  44526. selector: "testJSStatementNode",
  44527. protocol: 'tests',
  44528. fn: function (){
  44529. var self=this;
  44530. var ast,visitor;
  44531. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  44532. return $core.withContext(function($ctx1) {
  44533. var $3,$2,$1;
  44534. ast=self._parse_forClass_("foo <consolee.log(1)>",$Object());
  44535. $3=self._astPCNodeVisitor();
  44536. $recv($3)._visit_(ast);
  44537. $2=$recv($3)._currentNode();
  44538. $1=$recv($2)._isJSStatementNode();
  44539. self._assert_($1);
  44540. return self;
  44541. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  44542. },
  44543. args: [],
  44544. 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",
  44545. referencedClasses: ["Object"],
  44546. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  44547. }),
  44548. $globals.ASTPCNodeVisitorTest);
  44549. $core.addMethod(
  44550. $core.method({
  44551. selector: "testMessageSend",
  44552. protocol: 'tests',
  44553. fn: function (){
  44554. var self=this;
  44555. var ast;
  44556. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  44557. return $core.withContext(function($ctx1) {
  44558. var $3,$2,$1;
  44559. ast=self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$Object());
  44560. $3=self._astPCNodeVisitorForSelector_("yourself");
  44561. $recv($3)._visit_(ast);
  44562. $2=$recv($3)._currentNode();
  44563. $1=$recv($2)._selector();
  44564. self._assert_equals_($1,"yourself");
  44565. return self;
  44566. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  44567. },
  44568. args: [],
  44569. 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'",
  44570. referencedClasses: ["Object"],
  44571. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  44572. }),
  44573. $globals.ASTPCNodeVisitorTest);
  44574. $core.addMethod(
  44575. $core.method({
  44576. selector: "testMessageSendWithBlocks",
  44577. protocol: 'tests',
  44578. fn: function (){
  44579. var self=this;
  44580. var ast;
  44581. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  44582. return $core.withContext(function($ctx1) {
  44583. var $3,$2,$1;
  44584. ast=self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$Object());
  44585. $3=self._astPCNodeVisitorForSelector_("yourself");
  44586. $recv($3)._visit_(ast);
  44587. $2=$recv($3)._currentNode();
  44588. $1=$recv($2)._selector();
  44589. self._assert_equals_($1,"yourself");
  44590. return self;
  44591. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  44592. },
  44593. args: [],
  44594. 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'",
  44595. referencedClasses: ["Object"],
  44596. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  44597. }),
  44598. $globals.ASTPCNodeVisitorTest);
  44599. $core.addMethod(
  44600. $core.method({
  44601. selector: "testMessageSendWithInlining",
  44602. protocol: 'tests',
  44603. fn: function (){
  44604. var self=this;
  44605. var ast;
  44606. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  44607. return $core.withContext(function($ctx1) {
  44608. var $3,$4,$2,$1,$7,$6,$5;
  44609. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
  44610. $ctx1.sendIdx["parse:forClass:"]=1;
  44611. $3=self._astPCNodeVisitorForSelector_("yourself");
  44612. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  44613. $recv($3)._visit_(ast);
  44614. $ctx1.sendIdx["visit:"]=1;
  44615. $4=$recv($3)._currentNode();
  44616. $ctx1.sendIdx["currentNode"]=1;
  44617. $2=$4;
  44618. $1=$recv($2)._selector();
  44619. $ctx1.sendIdx["selector"]=1;
  44620. self._assert_equals_($1,"yourself");
  44621. $ctx1.sendIdx["assert:equals:"]=1;
  44622. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
  44623. $7=self._astPCNodeVisitorForSelector_("asBoolean");
  44624. $recv($7)._visit_(ast);
  44625. $6=$recv($7)._currentNode();
  44626. $5=$recv($6)._selector();
  44627. self._assert_equals_($5,"asBoolean");
  44628. return self;
  44629. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  44630. },
  44631. args: [],
  44632. 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'",
  44633. referencedClasses: ["Object"],
  44634. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  44635. }),
  44636. $globals.ASTPCNodeVisitorTest);
  44637. $core.addMethod(
  44638. $core.method({
  44639. selector: "testNoMessageSend",
  44640. protocol: 'tests',
  44641. fn: function (){
  44642. var self=this;
  44643. var ast;
  44644. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  44645. return $core.withContext(function($ctx1) {
  44646. var $3,$2,$1;
  44647. ast=self._parse_forClass_("foo ^ self",$Object());
  44648. $3=self._astPCNodeVisitor();
  44649. $recv($3)._visit_(ast);
  44650. $2=$recv($3)._currentNode();
  44651. $1=$recv($2)._isNil();
  44652. self._assert_($1);
  44653. return self;
  44654. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  44655. },
  44656. args: [],
  44657. 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",
  44658. referencedClasses: ["Object"],
  44659. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  44660. }),
  44661. $globals.ASTPCNodeVisitorTest);
  44662. $core.addMethod(
  44663. $core.method({
  44664. selector: "testPC",
  44665. protocol: 'tests',
  44666. fn: function (){
  44667. var self=this;
  44668. var ast,visitor;
  44669. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  44670. return $core.withContext(function($ctx1) {
  44671. var $3,$2,$1;
  44672. ast=self._parse_forClass_("foo <console.log(1)>",$Object());
  44673. $3=self._astPCNodeVisitor();
  44674. $recv($3)._visit_(ast);
  44675. $2=$recv($3)._currentNode();
  44676. $1=$recv($2)._isJSStatementNode();
  44677. self._assert_($1);
  44678. return self;
  44679. }, function($ctx1) {$ctx1.fill(self,"testPC",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  44680. },
  44681. args: [],
  44682. 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",
  44683. referencedClasses: ["Object"],
  44684. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  44685. }),
  44686. $globals.ASTPCNodeVisitorTest);
  44687. $core.addClass('ASTPositionTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
  44688. $core.addMethod(
  44689. $core.method({
  44690. selector: "testNodeAtPosition",
  44691. protocol: 'tests',
  44692. fn: function (){
  44693. var self=this;
  44694. var node;
  44695. return $core.withContext(function($ctx1) {
  44696. var $3,$4,$2,$1,$7,$8,$6,$5;
  44697. node=self._parse_("yourself\x0a\x09^ self");
  44698. $ctx1.sendIdx["parse:"]=1;
  44699. $3=node;
  44700. $4=(2).__at((4));
  44701. $ctx1.sendIdx["@"]=1;
  44702. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  44703. return nil;
  44704. }));
  44705. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  44706. $1=$recv($2)._source();
  44707. self._assert_equals_($1,"self");
  44708. $ctx1.sendIdx["assert:equals:"]=1;
  44709. node=self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
  44710. $ctx1.sendIdx["parse:"]=2;
  44711. $7=node;
  44712. $8=(2).__at((7));
  44713. $ctx1.sendIdx["@"]=2;
  44714. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  44715. return nil;
  44716. }));
  44717. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  44718. $5=$recv($6)._selector();
  44719. $ctx1.sendIdx["selector"]=1;
  44720. self._assert_equals_($5,"ifTrue:");
  44721. $ctx1.sendIdx["assert:equals:"]=2;
  44722. node=self._parse_("foo\x0a\x09self foo; bar; baz");
  44723. self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  44724. return nil;
  44725. })))._selector(),"foo");
  44726. return self;
  44727. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  44728. },
  44729. args: [],
  44730. 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'",
  44731. referencedClasses: [],
  44732. messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  44733. }),
  44734. $globals.ASTPositionTest);
  44735. $core.addClass('CodeGeneratorTest', $globals.ASTParsingTest, ['receiver'], 'Compiler-Tests');
  44736. $core.addMethod(
  44737. $core.method({
  44738. selector: "codeGeneratorClass",
  44739. protocol: 'accessing',
  44740. fn: function (){
  44741. var self=this;
  44742. function $CodeGenerator(){return $globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  44743. return $CodeGenerator();
  44744. },
  44745. args: [],
  44746. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  44747. referencedClasses: ["CodeGenerator"],
  44748. messageSends: []
  44749. }),
  44750. $globals.CodeGeneratorTest);
  44751. $core.addMethod(
  44752. $core.method({
  44753. selector: "compiler",
  44754. protocol: 'factory',
  44755. fn: function (){
  44756. var self=this;
  44757. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  44758. return $core.withContext(function($ctx1) {
  44759. var $1;
  44760. $1=$recv($Compiler())._new();
  44761. $recv($1)._codeGeneratorClass_(self._codeGeneratorClass());
  44762. return $recv($1)._yourself();
  44763. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  44764. },
  44765. args: [],
  44766. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  44767. referencedClasses: ["Compiler"],
  44768. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  44769. }),
  44770. $globals.CodeGeneratorTest);
  44771. $core.addMethod(
  44772. $core.method({
  44773. selector: "setUp",
  44774. protocol: 'initialization',
  44775. fn: function (){
  44776. var self=this;
  44777. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  44778. return $core.withContext(function($ctx1) {
  44779. self["@receiver"]=$recv($DoIt())._new();
  44780. return self;
  44781. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  44782. },
  44783. args: [],
  44784. source: "setUp\x0a\x09receiver := DoIt new",
  44785. referencedClasses: ["DoIt"],
  44786. messageSends: ["new"]
  44787. }),
  44788. $globals.CodeGeneratorTest);
  44789. $core.addMethod(
  44790. $core.method({
  44791. selector: "should:receiver:raise:",
  44792. protocol: 'testing',
  44793. fn: function (aString,anObject,anErrorClass){
  44794. var self=this;
  44795. var method,result;
  44796. return $core.withContext(function($ctx1) {
  44797. var $1,$2,$3,$receiver;
  44798. self["@receiver"]=anObject;
  44799. $recv((function(){
  44800. return $core.withContext(function($ctx2) {
  44801. return self._should_raise_((function(){
  44802. return $core.withContext(function($ctx3) {
  44803. $1=self._compiler();
  44804. $2=$recv(anObject)._class();
  44805. $ctx3.sendIdx["class"]=1;
  44806. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  44807. method;
  44808. return $recv(self["@receiver"])._perform_($recv(method)._selector());
  44809. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44810. }),anErrorClass);
  44811. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44812. }))._ensure_((function(){
  44813. return $core.withContext(function($ctx2) {
  44814. $3=method;
  44815. if(($receiver = $3) == null || $receiver.isNil){
  44816. return $3;
  44817. } else {
  44818. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  44819. };
  44820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44821. }));
  44822. return self;
  44823. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result},$globals.CodeGeneratorTest)});
  44824. },
  44825. args: ["aString", "anObject", "anErrorClass"],
  44826. source: "should: aString receiver: anObject raise: anErrorClass\x0a\x09| method result |\x0a\x0a\x09receiver := anObject.\x0a\x09[ self should: [\x0a\x09\x09method := self compiler install: aString forClass: anObject class protocol: 'tests'.\x0a\x09\x09receiver perform: method selector ] raise: anErrorClass ]\x0a\x09ensure: [ method ifNotNil: [ anObject class removeCompiledMethod: method ] ]",
  44827. referencedClasses: [],
  44828. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  44829. }),
  44830. $globals.CodeGeneratorTest);
  44831. $core.addMethod(
  44832. $core.method({
  44833. selector: "should:receiver:return:",
  44834. protocol: 'testing',
  44835. fn: function (aString,anObject,aResult){
  44836. var self=this;
  44837. var method,result;
  44838. return $core.withContext(function($ctx1) {
  44839. var $1,$2;
  44840. self["@receiver"]=anObject;
  44841. $1=self._compiler();
  44842. $2=$recv(anObject)._class();
  44843. $ctx1.sendIdx["class"]=1;
  44844. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  44845. result=$recv(self["@receiver"])._perform_($recv(method)._selector());
  44846. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  44847. self._assert_equals_(aResult,result);
  44848. return self;
  44849. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  44850. },
  44851. args: ["aString", "anObject", "aResult"],
  44852. 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",
  44853. referencedClasses: [],
  44854. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  44855. }),
  44856. $globals.CodeGeneratorTest);
  44857. $core.addMethod(
  44858. $core.method({
  44859. selector: "should:return:",
  44860. protocol: 'testing',
  44861. fn: function (aString,anObject){
  44862. var self=this;
  44863. return $core.withContext(function($ctx1) {
  44864. return self._should_receiver_return_(aString,self["@receiver"],anObject);
  44865. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  44866. },
  44867. args: ["aString", "anObject"],
  44868. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  44869. referencedClasses: [],
  44870. messageSends: ["should:receiver:return:"]
  44871. }),
  44872. $globals.CodeGeneratorTest);
  44873. $core.addMethod(
  44874. $core.method({
  44875. selector: "tearDown",
  44876. protocol: 'initialization',
  44877. fn: function (){
  44878. var self=this;
  44879. return self;
  44880. },
  44881. args: [],
  44882. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  44883. referencedClasses: [],
  44884. messageSends: []
  44885. }),
  44886. $globals.CodeGeneratorTest);
  44887. $core.addMethod(
  44888. $core.method({
  44889. selector: "testAssignment",
  44890. protocol: 'tests',
  44891. fn: function (){
  44892. var self=this;
  44893. return $core.withContext(function($ctx1) {
  44894. self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  44895. $ctx1.sendIdx["should:return:"]=1;
  44896. self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  44897. $ctx1.sendIdx["should:return:"]=2;
  44898. self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  44899. return self;
  44900. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  44901. },
  44902. args: [],
  44903. 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",
  44904. referencedClasses: [],
  44905. messageSends: ["should:return:"]
  44906. }),
  44907. $globals.CodeGeneratorTest);
  44908. $core.addMethod(
  44909. $core.method({
  44910. selector: "testBackslashSelectors",
  44911. protocol: 'tests',
  44912. fn: function (){
  44913. var self=this;
  44914. return $core.withContext(function($ctx1) {
  44915. self._should_return_("\x5c arg ^ 4",(4));
  44916. $ctx1.sendIdx["should:return:"]=1;
  44917. self._should_return_("\x5c\x5c arg ^ 42",(42));
  44918. return self;
  44919. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  44920. },
  44921. args: [],
  44922. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  44923. referencedClasses: [],
  44924. messageSends: ["should:return:"]
  44925. }),
  44926. $globals.CodeGeneratorTest);
  44927. $core.addMethod(
  44928. $core.method({
  44929. selector: "testBlockReturn",
  44930. protocol: 'tests',
  44931. fn: function (){
  44932. var self=this;
  44933. return $core.withContext(function($ctx1) {
  44934. self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  44935. $ctx1.sendIdx["should:return:"]=1;
  44936. self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  44937. $ctx1.sendIdx["should:return:"]=2;
  44938. self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  44939. return self;
  44940. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  44941. },
  44942. args: [],
  44943. 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).",
  44944. referencedClasses: [],
  44945. messageSends: ["should:return:"]
  44946. }),
  44947. $globals.CodeGeneratorTest);
  44948. $core.addMethod(
  44949. $core.method({
  44950. selector: "testCascades",
  44951. protocol: 'tests',
  44952. fn: function (){
  44953. var self=this;
  44954. return $core.withContext(function($ctx1) {
  44955. self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  44956. return self;
  44957. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  44958. },
  44959. args: [],
  44960. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  44961. referencedClasses: [],
  44962. messageSends: ["should:return:"]
  44963. }),
  44964. $globals.CodeGeneratorTest);
  44965. $core.addMethod(
  44966. $core.method({
  44967. selector: "testCascadesInDynamicArray",
  44968. protocol: 'tests',
  44969. fn: function (){
  44970. var self=this;
  44971. return $core.withContext(function($ctx1) {
  44972. self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  44973. return self;
  44974. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{},$globals.CodeGeneratorTest)});
  44975. },
  44976. args: [],
  44977. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  44978. referencedClasses: [],
  44979. messageSends: ["should:return:"]
  44980. }),
  44981. $globals.CodeGeneratorTest);
  44982. $core.addMethod(
  44983. $core.method({
  44984. selector: "testCascadesInDynamicDictioary",
  44985. protocol: 'tests',
  44986. fn: function (){
  44987. var self=this;
  44988. return $core.withContext(function($ctx1) {
  44989. self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  44990. return self;
  44991. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{},$globals.CodeGeneratorTest)});
  44992. },
  44993. args: [],
  44994. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  44995. referencedClasses: [],
  44996. messageSends: ["should:return:"]
  44997. }),
  44998. $globals.CodeGeneratorTest);
  44999. $core.addMethod(
  45000. $core.method({
  45001. selector: "testCascadesInSend",
  45002. protocol: 'tests',
  45003. fn: function (){
  45004. var self=this;
  45005. return $core.withContext(function($ctx1) {
  45006. self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  45007. return self;
  45008. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{},$globals.CodeGeneratorTest)});
  45009. },
  45010. args: [],
  45011. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  45012. referencedClasses: [],
  45013. messageSends: ["should:return:"]
  45014. }),
  45015. $globals.CodeGeneratorTest);
  45016. $core.addMethod(
  45017. $core.method({
  45018. selector: "testCascadesWithInlining",
  45019. protocol: 'tests',
  45020. fn: function (){
  45021. var self=this;
  45022. return $core.withContext(function($ctx1) {
  45023. self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  45024. $ctx1.sendIdx["should:return:"]=1;
  45025. self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  45026. return self;
  45027. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  45028. },
  45029. args: [],
  45030. source: "testCascadesWithInlining\x0a\x09\x0a\x09self should: 'foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 2",
  45031. referencedClasses: [],
  45032. messageSends: ["should:return:"]
  45033. }),
  45034. $globals.CodeGeneratorTest);
  45035. $core.addMethod(
  45036. $core.method({
  45037. selector: "testDynamicArrayElementsOrdered",
  45038. protocol: 'tests',
  45039. fn: function (){
  45040. var self=this;
  45041. return $core.withContext(function($ctx1) {
  45042. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  45043. $ctx1.sendIdx["should:return:"]=1;
  45044. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  45045. return self;
  45046. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  45047. },
  45048. args: [],
  45049. 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).",
  45050. referencedClasses: [],
  45051. messageSends: ["should:return:"]
  45052. }),
  45053. $globals.CodeGeneratorTest);
  45054. $core.addMethod(
  45055. $core.method({
  45056. selector: "testDynamicDictionaryElementsOrdered",
  45057. protocol: 'tests',
  45058. fn: function (){
  45059. var self=this;
  45060. return $core.withContext(function($ctx1) {
  45061. 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)]));
  45062. return self;
  45063. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  45064. },
  45065. args: [],
  45066. 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}.",
  45067. referencedClasses: [],
  45068. messageSends: ["should:return:"]
  45069. }),
  45070. $globals.CodeGeneratorTest);
  45071. $core.addMethod(
  45072. $core.method({
  45073. selector: "testDynamicDictionaryWithMoreArrows",
  45074. protocol: 'tests',
  45075. fn: function (){
  45076. var self=this;
  45077. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  45078. return $core.withContext(function($ctx1) {
  45079. var $2,$1;
  45080. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  45081. $ctx1.sendIdx["->"]=1;
  45082. $1=$recv($HashedCollection())._with_($2);
  45083. self._should_return_("foo ^ #{1->2->3}",$1);
  45084. return self;
  45085. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  45086. },
  45087. args: [],
  45088. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  45089. referencedClasses: ["HashedCollection"],
  45090. messageSends: ["should:return:", "with:", "->"]
  45091. }),
  45092. $globals.CodeGeneratorTest);
  45093. $core.addMethod(
  45094. $core.method({
  45095. selector: "testGlobalVar",
  45096. protocol: 'tests',
  45097. fn: function (){
  45098. var self=this;
  45099. function $BlockClosure(){return $globals.BlockClosure||(typeof BlockClosure=="undefined"?nil:BlockClosure)}
  45100. return $core.withContext(function($ctx1) {
  45101. self._should_return_("foo ^ eval class",$BlockClosure());
  45102. $ctx1.sendIdx["should:return:"]=1;
  45103. self._should_return_("foo ^ Math cos: 0",(1));
  45104. $ctx1.sendIdx["should:return:"]=2;
  45105. self._should_return_("foo ^ NonExistingVar",nil);
  45106. return self;
  45107. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  45108. },
  45109. args: [],
  45110. 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",
  45111. referencedClasses: ["BlockClosure"],
  45112. messageSends: ["should:return:"]
  45113. }),
  45114. $globals.CodeGeneratorTest);
  45115. $core.addMethod(
  45116. $core.method({
  45117. selector: "testInnerTemporalDependentElementsOrdered",
  45118. protocol: 'tests',
  45119. fn: function (){
  45120. var self=this;
  45121. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  45122. return $core.withContext(function($ctx1) {
  45123. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  45124. $2="foo".__minus_gt($Array());
  45125. $ctx1.sendIdx["->"]=1;
  45126. $3="bar".__minus_gt((2));
  45127. $ctx1.sendIdx["->"]=2;
  45128. $1=[$2,$3];
  45129. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  45130. $ctx1.sendIdx["should:return:"]=1;
  45131. $5="foo".__minus_gt($Array());
  45132. $ctx1.sendIdx["->"]=3;
  45133. $6="bar".__minus_gt((2));
  45134. $ctx1.sendIdx["->"]=4;
  45135. $4=[$5,$6];
  45136. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  45137. $ctx1.sendIdx["should:return:"]=2;
  45138. $8="foo".__minus_gt((1));
  45139. $ctx1.sendIdx["->"]=5;
  45140. $9="bar".__minus_gt((2));
  45141. $ctx1.sendIdx["->"]=6;
  45142. $7=[$8,$9];
  45143. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  45144. $ctx1.sendIdx["should:return:"]=3;
  45145. $11="foo".__minus_gt((1));
  45146. $ctx1.sendIdx["->"]=7;
  45147. $10=[$11,"bar".__minus_gt((2))];
  45148. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  45149. $ctx1.sendIdx["should:return:"]=4;
  45150. 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)]));
  45151. return self;
  45152. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  45153. },
  45154. args: [],
  45155. 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}.",
  45156. referencedClasses: ["Array"],
  45157. messageSends: ["should:return:", "->"]
  45158. }),
  45159. $globals.CodeGeneratorTest);
  45160. $core.addMethod(
  45161. $core.method({
  45162. selector: "testJSStatement",
  45163. protocol: 'tests',
  45164. fn: function (){
  45165. var self=this;
  45166. return $core.withContext(function($ctx1) {
  45167. self._should_return_("foo <return 2+3>",(5));
  45168. return self;
  45169. }, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},$globals.CodeGeneratorTest)});
  45170. },
  45171. args: [],
  45172. source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
  45173. referencedClasses: [],
  45174. messageSends: ["should:return:"]
  45175. }),
  45176. $globals.CodeGeneratorTest);
  45177. $core.addMethod(
  45178. $core.method({
  45179. selector: "testLexicalScope",
  45180. protocol: 'tests',
  45181. fn: function (){
  45182. var self=this;
  45183. return $core.withContext(function($ctx1) {
  45184. self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  45185. return self;
  45186. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  45187. },
  45188. args: [],
  45189. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  45190. referencedClasses: [],
  45191. messageSends: ["should:return:"]
  45192. }),
  45193. $globals.CodeGeneratorTest);
  45194. $core.addMethod(
  45195. $core.method({
  45196. selector: "testLiterals",
  45197. protocol: 'tests',
  45198. fn: function (){
  45199. var self=this;
  45200. return $core.withContext(function($ctx1) {
  45201. self._should_return_("foo ^ 1",(1));
  45202. $ctx1.sendIdx["should:return:"]=1;
  45203. self._should_return_("foo ^ 'hello'","hello");
  45204. $ctx1.sendIdx["should:return:"]=2;
  45205. self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  45206. $ctx1.sendIdx["should:return:"]=3;
  45207. self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  45208. $ctx1.sendIdx["should:return:"]=4;
  45209. self._should_return_("foo ^ true",true);
  45210. $ctx1.sendIdx["should:return:"]=5;
  45211. self._should_return_("foo ^ false",false);
  45212. $ctx1.sendIdx["should:return:"]=6;
  45213. self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  45214. $ctx1.sendIdx["should:return:"]=7;
  45215. self._should_return_("foo ^ #hello","hello");
  45216. $ctx1.sendIdx["should:return:"]=8;
  45217. self._should_return_("foo ^ $h","h");
  45218. $ctx1.sendIdx["should:return:"]=9;
  45219. self._should_return_("foo ^ -123.456",(-123.456));
  45220. $ctx1.sendIdx["should:return:"]=10;
  45221. self._should_return_("foo ^ -2.5e4",(-25000));
  45222. return self;
  45223. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  45224. },
  45225. args: [],
  45226. 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.",
  45227. referencedClasses: [],
  45228. messageSends: ["should:return:"]
  45229. }),
  45230. $globals.CodeGeneratorTest);
  45231. $core.addMethod(
  45232. $core.method({
  45233. selector: "testLocalReturn",
  45234. protocol: 'tests',
  45235. fn: function (){
  45236. var self=this;
  45237. return $core.withContext(function($ctx1) {
  45238. self._should_return_("foo ^ 1",(1));
  45239. $ctx1.sendIdx["should:return:"]=1;
  45240. self._should_return_("foo ^ 1 + 1",(2));
  45241. $ctx1.sendIdx["should:return:"]=2;
  45242. self._should_return_("foo ",self["@receiver"]);
  45243. $ctx1.sendIdx["should:return:"]=3;
  45244. self._should_return_("foo self asString",self["@receiver"]);
  45245. $ctx1.sendIdx["should:return:"]=4;
  45246. self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  45247. return self;
  45248. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  45249. },
  45250. args: [],
  45251. 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",
  45252. referencedClasses: [],
  45253. messageSends: ["should:return:"]
  45254. }),
  45255. $globals.CodeGeneratorTest);
  45256. $core.addMethod(
  45257. $core.method({
  45258. selector: "testMessageSends",
  45259. protocol: 'tests',
  45260. fn: function (){
  45261. var self=this;
  45262. return $core.withContext(function($ctx1) {
  45263. self._should_return_("foo ^ 1 asString","1");
  45264. $ctx1.sendIdx["should:return:"]=1;
  45265. self._should_return_("foo ^ 1 + 1",(2));
  45266. $ctx1.sendIdx["should:return:"]=2;
  45267. self._should_return_("foo ^ 1 + 2 * 3",(9));
  45268. $ctx1.sendIdx["should:return:"]=3;
  45269. self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  45270. $ctx1.sendIdx["should:return:"]=4;
  45271. self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  45272. return self;
  45273. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  45274. },
  45275. args: [],
  45276. 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)",
  45277. referencedClasses: [],
  45278. messageSends: ["should:return:"]
  45279. }),
  45280. $globals.CodeGeneratorTest);
  45281. $core.addMethod(
  45282. $core.method({
  45283. selector: "testMultipleSequences",
  45284. protocol: 'tests',
  45285. fn: function (){
  45286. var self=this;
  45287. return $core.withContext(function($ctx1) {
  45288. self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  45289. return self;
  45290. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  45291. },
  45292. args: [],
  45293. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  45294. referencedClasses: [],
  45295. messageSends: ["should:return:"]
  45296. }),
  45297. $globals.CodeGeneratorTest);
  45298. $core.addMethod(
  45299. $core.method({
  45300. selector: "testMutableLiterals",
  45301. protocol: 'tests',
  45302. fn: function (){
  45303. var self=this;
  45304. return $core.withContext(function($ctx1) {
  45305. self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  45306. return self;
  45307. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  45308. },
  45309. args: [],
  45310. 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)",
  45311. referencedClasses: [],
  45312. messageSends: ["should:return:"]
  45313. }),
  45314. $globals.CodeGeneratorTest);
  45315. $core.addMethod(
  45316. $core.method({
  45317. selector: "testNestedIfTrue",
  45318. protocol: 'tests',
  45319. fn: function (){
  45320. var self=this;
  45321. return $core.withContext(function($ctx1) {
  45322. self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  45323. $ctx1.sendIdx["should:return:"]=1;
  45324. self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  45325. $ctx1.sendIdx["should:return:"]=2;
  45326. self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  45327. $ctx1.sendIdx["should:return:"]=3;
  45328. self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]);
  45329. return self;
  45330. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  45331. },
  45332. args: [],
  45333. 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.",
  45334. referencedClasses: [],
  45335. messageSends: ["should:return:"]
  45336. }),
  45337. $globals.CodeGeneratorTest);
  45338. $core.addMethod(
  45339. $core.method({
  45340. selector: "testNestedSends",
  45341. protocol: 'tests',
  45342. fn: function (){
  45343. var self=this;
  45344. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  45345. return $core.withContext(function($ctx1) {
  45346. self._should_return_("foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString",$recv($recv($Point())._x_y_((2).__at((3)),(4)))._asString());
  45347. return self;
  45348. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  45349. },
  45350. args: [],
  45351. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  45352. referencedClasses: ["Point"],
  45353. messageSends: ["should:return:", "asString", "x:y:", "@"]
  45354. }),
  45355. $globals.CodeGeneratorTest);
  45356. $core.addMethod(
  45357. $core.method({
  45358. selector: "testNonLocalReturn",
  45359. protocol: 'tests',
  45360. fn: function (){
  45361. var self=this;
  45362. return $core.withContext(function($ctx1) {
  45363. self._should_return_("foo [ ^ 1 ] value",(1));
  45364. $ctx1.sendIdx["should:return:"]=1;
  45365. self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  45366. $ctx1.sendIdx["should:return:"]=2;
  45367. self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  45368. $ctx1.sendIdx["should:return:"]=3;
  45369. self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  45370. return self;
  45371. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  45372. },
  45373. args: [],
  45374. 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",
  45375. referencedClasses: [],
  45376. messageSends: ["should:return:"]
  45377. }),
  45378. $globals.CodeGeneratorTest);
  45379. $core.addMethod(
  45380. $core.method({
  45381. selector: "testPascalCaseGlobal",
  45382. protocol: 'tests',
  45383. fn: function (){
  45384. var self=this;
  45385. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  45386. return $core.withContext(function($ctx1) {
  45387. self._should_return_("foo ^Object",$recv($recv($Smalltalk())._globals())._at_("Object"));
  45388. $ctx1.sendIdx["should:return:"]=1;
  45389. self._should_return_("foo ^NonExistent",nil);
  45390. return self;
  45391. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  45392. },
  45393. args: [],
  45394. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  45395. referencedClasses: ["Smalltalk"],
  45396. messageSends: ["should:return:", "at:", "globals"]
  45397. }),
  45398. $globals.CodeGeneratorTest);
  45399. $core.addMethod(
  45400. $core.method({
  45401. selector: "testRootSuperSend",
  45402. protocol: 'tests',
  45403. fn: function (){
  45404. var self=this;
  45405. function $ProtoObject(){return $globals.ProtoObject||(typeof ProtoObject=="undefined"?nil:ProtoObject)}
  45406. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  45407. return $core.withContext(function($ctx1) {
  45408. self._should_receiver_raise_("foo ^ super class",$recv($ProtoObject())._new(),$MessageNotUnderstood());
  45409. return self;
  45410. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{},$globals.CodeGeneratorTest)});
  45411. },
  45412. args: [],
  45413. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  45414. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  45415. messageSends: ["should:receiver:raise:", "new"]
  45416. }),
  45417. $globals.CodeGeneratorTest);
  45418. $core.addMethod(
  45419. $core.method({
  45420. selector: "testSendReceiverAndArgumentsOrdered",
  45421. protocol: 'tests',
  45422. fn: function (){
  45423. var self=this;
  45424. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  45425. return $core.withContext(function($ctx1) {
  45426. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  45427. $ctx1.sendIdx["should:return:"]=1;
  45428. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$Array(),(2)]);
  45429. return self;
  45430. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  45431. },
  45432. args: [],
  45433. 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}.",
  45434. referencedClasses: ["Array"],
  45435. messageSends: ["should:return:"]
  45436. }),
  45437. $globals.CodeGeneratorTest);
  45438. $core.addMethod(
  45439. $core.method({
  45440. selector: "testSuperSend",
  45441. protocol: 'tests',
  45442. fn: function (){
  45443. var self=this;
  45444. return $core.withContext(function($ctx1) {
  45445. self._should_receiver_return_("foo ^ super isBoolean",true,false);
  45446. return self;
  45447. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  45448. },
  45449. args: [],
  45450. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  45451. referencedClasses: [],
  45452. messageSends: ["should:receiver:return:"]
  45453. }),
  45454. $globals.CodeGeneratorTest);
  45455. $core.addMethod(
  45456. $core.method({
  45457. selector: "testTempVariables",
  45458. protocol: 'tests',
  45459. fn: function (){
  45460. var self=this;
  45461. return $core.withContext(function($ctx1) {
  45462. self._should_return_("foo | a | ^ a",nil);
  45463. $ctx1.sendIdx["should:return:"]=1;
  45464. self._should_return_("foo | AVariable | ^ AVariable",nil);
  45465. $ctx1.sendIdx["should:return:"]=2;
  45466. self._should_return_("foo | a b c | ^ c",nil);
  45467. $ctx1.sendIdx["should:return:"]=3;
  45468. self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  45469. $ctx1.sendIdx["should:return:"]=4;
  45470. self._should_return_("foo | a | a:= 1. ^ a",(1));
  45471. $ctx1.sendIdx["should:return:"]=5;
  45472. self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  45473. return self;
  45474. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  45475. },
  45476. args: [],
  45477. 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.",
  45478. referencedClasses: [],
  45479. messageSends: ["should:return:"]
  45480. }),
  45481. $globals.CodeGeneratorTest);
  45482. $core.addMethod(
  45483. $core.method({
  45484. selector: "testThisContext",
  45485. protocol: 'tests',
  45486. fn: function (){
  45487. var self=this;
  45488. return $core.withContext(function($ctx1) {
  45489. self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  45490. return self;
  45491. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  45492. },
  45493. args: [],
  45494. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  45495. referencedClasses: [],
  45496. messageSends: ["should:return:"]
  45497. }),
  45498. $globals.CodeGeneratorTest);
  45499. $core.addMethod(
  45500. $core.method({
  45501. selector: "testifFalse",
  45502. protocol: 'tests',
  45503. fn: function (){
  45504. var self=this;
  45505. return $core.withContext(function($ctx1) {
  45506. self._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
  45507. $ctx1.sendIdx["should:return:"]=1;
  45508. self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  45509. $ctx1.sendIdx["should:return:"]=2;
  45510. self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  45511. $ctx1.sendIdx["should:return:"]=3;
  45512. self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  45513. return self;
  45514. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  45515. },
  45516. args: [],
  45517. 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.",
  45518. referencedClasses: [],
  45519. messageSends: ["should:return:"]
  45520. }),
  45521. $globals.CodeGeneratorTest);
  45522. $core.addMethod(
  45523. $core.method({
  45524. selector: "testifFalseIfTrue",
  45525. protocol: 'tests',
  45526. fn: function (){
  45527. var self=this;
  45528. return $core.withContext(function($ctx1) {
  45529. self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  45530. $ctx1.sendIdx["should:return:"]=1;
  45531. self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  45532. $ctx1.sendIdx["should:return:"]=2;
  45533. self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  45534. $ctx1.sendIdx["should:return:"]=3;
  45535. self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  45536. return self;
  45537. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  45538. },
  45539. args: [],
  45540. 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.",
  45541. referencedClasses: [],
  45542. messageSends: ["should:return:"]
  45543. }),
  45544. $globals.CodeGeneratorTest);
  45545. $core.addMethod(
  45546. $core.method({
  45547. selector: "testifNil",
  45548. protocol: 'tests',
  45549. fn: function (){
  45550. var self=this;
  45551. return $core.withContext(function($ctx1) {
  45552. self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  45553. $ctx1.sendIdx["should:return:"]=1;
  45554. self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  45555. $ctx1.sendIdx["should:return:"]=2;
  45556. self._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]);
  45557. $ctx1.sendIdx["should:return:"]=3;
  45558. self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  45559. return self;
  45560. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  45561. },
  45562. args: [],
  45563. 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.",
  45564. referencedClasses: [],
  45565. messageSends: ["should:return:"]
  45566. }),
  45567. $globals.CodeGeneratorTest);
  45568. $core.addMethod(
  45569. $core.method({
  45570. selector: "testifNilIfNotNil",
  45571. protocol: 'tests',
  45572. fn: function (){
  45573. var self=this;
  45574. return $core.withContext(function($ctx1) {
  45575. self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  45576. $ctx1.sendIdx["should:return:"]=1;
  45577. self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  45578. $ctx1.sendIdx["should:return:"]=2;
  45579. self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  45580. $ctx1.sendIdx["should:return:"]=3;
  45581. self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  45582. return self;
  45583. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  45584. },
  45585. args: [],
  45586. 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.",
  45587. referencedClasses: [],
  45588. messageSends: ["should:return:"]
  45589. }),
  45590. $globals.CodeGeneratorTest);
  45591. $core.addMethod(
  45592. $core.method({
  45593. selector: "testifNotNil",
  45594. protocol: 'tests',
  45595. fn: function (){
  45596. var self=this;
  45597. return $core.withContext(function($ctx1) {
  45598. self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  45599. $ctx1.sendIdx["should:return:"]=1;
  45600. self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  45601. $ctx1.sendIdx["should:return:"]=2;
  45602. self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  45603. $ctx1.sendIdx["should:return:"]=3;
  45604. self._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]);
  45605. return self;
  45606. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  45607. },
  45608. args: [],
  45609. 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.",
  45610. referencedClasses: [],
  45611. messageSends: ["should:return:"]
  45612. }),
  45613. $globals.CodeGeneratorTest);
  45614. $core.addMethod(
  45615. $core.method({
  45616. selector: "testifNotNilWithArgument",
  45617. protocol: 'tests',
  45618. fn: function (){
  45619. var self=this;
  45620. return $core.withContext(function($ctx1) {
  45621. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  45622. $ctx1.sendIdx["should:return:"]=1;
  45623. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  45624. $ctx1.sendIdx["should:return:"]=2;
  45625. self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  45626. $ctx1.sendIdx["should:return:"]=3;
  45627. self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  45628. $ctx1.sendIdx["should:return:"]=4;
  45629. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  45630. $ctx1.sendIdx["should:return:"]=5;
  45631. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  45632. return self;
  45633. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  45634. },
  45635. args: [],
  45636. 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",
  45637. referencedClasses: [],
  45638. messageSends: ["should:return:"]
  45639. }),
  45640. $globals.CodeGeneratorTest);
  45641. $core.addMethod(
  45642. $core.method({
  45643. selector: "testifTrue",
  45644. protocol: 'tests',
  45645. fn: function (){
  45646. var self=this;
  45647. return $core.withContext(function($ctx1) {
  45648. self._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
  45649. $ctx1.sendIdx["should:return:"]=1;
  45650. self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  45651. $ctx1.sendIdx["should:return:"]=2;
  45652. self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  45653. $ctx1.sendIdx["should:return:"]=3;
  45654. self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  45655. return self;
  45656. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  45657. },
  45658. args: [],
  45659. 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.",
  45660. referencedClasses: [],
  45661. messageSends: ["should:return:"]
  45662. }),
  45663. $globals.CodeGeneratorTest);
  45664. $core.addMethod(
  45665. $core.method({
  45666. selector: "testifTrueIfFalse",
  45667. protocol: 'tests',
  45668. fn: function (){
  45669. var self=this;
  45670. return $core.withContext(function($ctx1) {
  45671. self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  45672. $ctx1.sendIdx["should:return:"]=1;
  45673. self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  45674. $ctx1.sendIdx["should:return:"]=2;
  45675. self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  45676. $ctx1.sendIdx["should:return:"]=3;
  45677. self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  45678. return self;
  45679. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  45680. },
  45681. args: [],
  45682. 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.",
  45683. referencedClasses: [],
  45684. messageSends: ["should:return:"]
  45685. }),
  45686. $globals.CodeGeneratorTest);
  45687. $core.addClass('ASTInterpreterTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
  45688. $core.addMethod(
  45689. $core.method({
  45690. selector: "analyze:forClass:",
  45691. protocol: 'parsing',
  45692. fn: function (aNode,aClass){
  45693. var self=this;
  45694. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  45695. return $core.withContext(function($ctx1) {
  45696. $recv($recv($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
  45697. return aNode;
  45698. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTInterpreterTest)});
  45699. },
  45700. args: ["aNode", "aClass"],
  45701. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  45702. referencedClasses: ["SemanticAnalyzer"],
  45703. messageSends: ["visit:", "on:"]
  45704. }),
  45705. $globals.ASTInterpreterTest);
  45706. $core.addMethod(
  45707. $core.method({
  45708. selector: "interpret:receiver:withArguments:",
  45709. protocol: 'private',
  45710. fn: function (aString,anObject,aDictionary){
  45711. var self=this;
  45712. var ctx,ast,interpreter;
  45713. function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  45714. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  45715. return $core.withContext(function($ctx1) {
  45716. var $1,$2,$3,$receiver;
  45717. interpreter=$recv($ASTInterpreter())._new();
  45718. $ctx1.sendIdx["new"]=1;
  45719. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  45720. $1=$recv($AIContext())._new();
  45721. $recv($1)._receiver_(anObject);
  45722. $recv($1)._interpreter_(interpreter);
  45723. ctx=$recv($1)._yourself();
  45724. $2=$recv(ast)._sequenceNode();
  45725. if(($receiver = $2) == null || $receiver.isNil){
  45726. $2;
  45727. } else {
  45728. var sequence;
  45729. sequence=$receiver;
  45730. $recv($recv(sequence)._temps())._do_((function(each){
  45731. return $core.withContext(function($ctx2) {
  45732. return $recv(ctx)._defineLocal_(each);
  45733. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  45734. }));
  45735. };
  45736. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  45737. return $core.withContext(function($ctx2) {
  45738. return $recv(ctx)._localAt_put_(key,value);
  45739. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  45740. }));
  45741. $3=interpreter;
  45742. $recv($3)._context_(ctx);
  45743. $recv($3)._node_(ast);
  45744. $recv($3)._enterNode();
  45745. $recv($3)._proceed();
  45746. return $recv($3)._result();
  45747. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  45748. },
  45749. args: ["aString", "anObject", "aDictionary"],
  45750. source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx ast interpreter |\x0a\x09\x0a\x09interpreter := ASTInterpreter new.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: interpreter;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09\x0a\x09^ interpreter\x0a\x09\x09context: ctx;\x0a\x09\x09node: ast;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  45751. referencedClasses: ["ASTInterpreter", "AIContext"],
  45752. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "node:", "enterNode", "proceed", "result"]
  45753. }),
  45754. $globals.ASTInterpreterTest);
  45755. $core.addMethod(
  45756. $core.method({
  45757. selector: "parse:",
  45758. protocol: 'parsing',
  45759. fn: function (aString){
  45760. var self=this;
  45761. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  45762. return $core.withContext(function($ctx1) {
  45763. return $recv($Smalltalk())._parse_(aString);
  45764. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTInterpreterTest)});
  45765. },
  45766. args: ["aString"],
  45767. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  45768. referencedClasses: ["Smalltalk"],
  45769. messageSends: ["parse:"]
  45770. }),
  45771. $globals.ASTInterpreterTest);
  45772. $core.addMethod(
  45773. $core.method({
  45774. selector: "parse:forClass:",
  45775. protocol: 'parsing',
  45776. fn: function (aString,aClass){
  45777. var self=this;
  45778. return $core.withContext(function($ctx1) {
  45779. return self._analyze_forClass_(self._parse_(aString),aClass);
  45780. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTInterpreterTest)});
  45781. },
  45782. args: ["aString", "aClass"],
  45783. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  45784. referencedClasses: [],
  45785. messageSends: ["analyze:forClass:", "parse:"]
  45786. }),
  45787. $globals.ASTInterpreterTest);
  45788. $core.addMethod(
  45789. $core.method({
  45790. selector: "should:receiver:return:",
  45791. protocol: 'testing',
  45792. fn: function (aString,anObject,aResult){
  45793. var self=this;
  45794. return $core.withContext(function($ctx1) {
  45795. self["@receiver"]=anObject;
  45796. return self._assert_equals_(self._interpret_receiver_withArguments_(aString,self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  45797. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  45798. },
  45799. args: ["aString", "anObject", "aResult"],
  45800. 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",
  45801. referencedClasses: [],
  45802. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  45803. }),
  45804. $globals.ASTInterpreterTest);
  45805. $core.addClass('ASTDebuggerTest', $globals.ASTInterpreterTest, [], 'Compiler-Tests');
  45806. $core.addMethod(
  45807. $core.method({
  45808. selector: "interpret:receiver:withArguments:",
  45809. protocol: 'private',
  45810. fn: function (aString,anObject,aDictionary){
  45811. var self=this;
  45812. var ctx,ast,debugger_;
  45813. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  45814. function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  45815. function $ASTDebugger(){return $globals.ASTDebugger||(typeof ASTDebugger=="undefined"?nil:ASTDebugger)}
  45816. return $core.withContext(function($ctx1) {
  45817. var $1,$2,$3,$4,$5,$receiver;
  45818. $1=$recv($AIContext())._new();
  45819. $ctx1.sendIdx["new"]=1;
  45820. $recv($1)._receiver_(anObject);
  45821. $recv($1)._interpreter_($recv($ASTInterpreter())._new());
  45822. ctx=$recv($1)._yourself();
  45823. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  45824. $2=$recv(ast)._sequenceNode();
  45825. if(($receiver = $2) == null || $receiver.isNil){
  45826. $2;
  45827. } else {
  45828. var sequence;
  45829. sequence=$receiver;
  45830. $recv($recv(sequence)._temps())._do_((function(each){
  45831. return $core.withContext(function($ctx2) {
  45832. return $recv(ctx)._defineLocal_(each);
  45833. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  45834. }));
  45835. };
  45836. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  45837. return $core.withContext(function($ctx2) {
  45838. return $recv(ctx)._localAt_put_(key,value);
  45839. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  45840. }));
  45841. $3=$recv(ctx)._interpreter();
  45842. $ctx1.sendIdx["interpreter"]=1;
  45843. $recv($3)._context_(ctx);
  45844. $ctx1.sendIdx["context:"]=1;
  45845. $4=$recv(ctx)._interpreter();
  45846. $recv($4)._node_(ast);
  45847. $recv($4)._enterNode();
  45848. debugger_=$recv($ASTDebugger())._context_(ctx);
  45849. $5=debugger_;
  45850. $recv($5)._proceed();
  45851. return $recv($5)._result();
  45852. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  45853. },
  45854. args: ["aString", "anObject", "aDictionary"],
  45855. source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09| ctx ast debugger |\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: ASTInterpreter new;\x0a\x09\x09yourself.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09ctx interpreter context: ctx.\x0a\x09\x0a\x09ctx interpreter node: ast; enterNode.\x0a\x09\x0a\x09debugger := ASTDebugger context: ctx.\x0a\x09\x0a\x09^ debugger \x0a\x09\x09proceed; \x0a\x09\x09result",
  45856. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  45857. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode", "proceed", "result"]
  45858. }),
  45859. $globals.ASTDebuggerTest);
  45860. $core.addClass('InliningCodeGeneratorTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
  45861. $core.addMethod(
  45862. $core.method({
  45863. selector: "codeGeneratorClass",
  45864. protocol: 'accessing',
  45865. fn: function (){
  45866. var self=this;
  45867. function $InliningCodeGenerator(){return $globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  45868. return $InliningCodeGenerator();
  45869. },
  45870. args: [],
  45871. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  45872. referencedClasses: ["InliningCodeGenerator"],
  45873. messageSends: []
  45874. }),
  45875. $globals.InliningCodeGeneratorTest);
  45876. $core.addClass('ScopeVarTest', $globals.TestCase, [], 'Compiler-Tests');
  45877. $core.addMethod(
  45878. $core.method({
  45879. selector: "testClassRefVar",
  45880. protocol: 'tests',
  45881. fn: function (){
  45882. var self=this;
  45883. var node;
  45884. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  45885. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  45886. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  45887. return $core.withContext(function($ctx1) {
  45888. var $1,$2;
  45889. $1=$recv($VariableNode())._new();
  45890. $ctx1.sendIdx["new"]=1;
  45891. $recv($1)._value_("Object");
  45892. node=$recv($1)._yourself();
  45893. $2=$recv($SemanticAnalyzer())._new();
  45894. $ctx1.sendIdx["new"]=2;
  45895. $recv($2)._pushScope_($recv($MethodLexicalScope())._new());
  45896. $recv($2)._visit_(node);
  45897. self._assert_($recv($recv(node)._binding())._isClassRefVar());
  45898. return self;
  45899. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  45900. },
  45901. args: [],
  45902. 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",
  45903. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  45904. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  45905. }),
  45906. $globals.ScopeVarTest);
  45907. $core.addMethod(
  45908. $core.method({
  45909. selector: "testInstanceVar",
  45910. protocol: 'tests',
  45911. fn: function (){
  45912. var self=this;
  45913. var node,scope;
  45914. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  45915. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  45916. return $core.withContext(function($ctx1) {
  45917. var $1;
  45918. $1=$recv($VariableNode())._new();
  45919. $ctx1.sendIdx["new"]=1;
  45920. $recv($1)._value_("bzzz");
  45921. node=$recv($1)._yourself();
  45922. scope=$recv($MethodLexicalScope())._new();
  45923. $recv(scope)._addIVar_("bzzz");
  45924. self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  45925. return self;
  45926. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  45927. },
  45928. args: [],
  45929. 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",
  45930. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  45931. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  45932. }),
  45933. $globals.ScopeVarTest);
  45934. $core.addMethod(
  45935. $core.method({
  45936. selector: "testPseudoVar",
  45937. protocol: 'tests',
  45938. fn: function (){
  45939. var self=this;
  45940. var node,pseudoVars;
  45941. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  45942. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  45943. return $core.withContext(function($ctx1) {
  45944. var $1;
  45945. pseudoVars=["self", "super", "true", "false", "nil"];
  45946. $recv(pseudoVars)._do_((function(each){
  45947. return $core.withContext(function($ctx2) {
  45948. $1=$recv($VariableNode())._new();
  45949. $ctx2.sendIdx["new"]=1;
  45950. $recv($1)._value_(each);
  45951. node=$recv($1)._yourself();
  45952. node;
  45953. return self._assert_($recv($recv($recv($MethodLexicalScope())._new())._bindingFor_(node))._isPseudoVar());
  45954. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45955. }));
  45956. return self;
  45957. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  45958. },
  45959. args: [],
  45960. 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]",
  45961. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  45962. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  45963. }),
  45964. $globals.ScopeVarTest);
  45965. $core.addMethod(
  45966. $core.method({
  45967. selector: "testTempVar",
  45968. protocol: 'tests',
  45969. fn: function (){
  45970. var self=this;
  45971. var node,scope;
  45972. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  45973. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  45974. return $core.withContext(function($ctx1) {
  45975. var $1;
  45976. $1=$recv($VariableNode())._new();
  45977. $ctx1.sendIdx["new"]=1;
  45978. $recv($1)._value_("bzzz");
  45979. node=$recv($1)._yourself();
  45980. scope=$recv($MethodLexicalScope())._new();
  45981. $recv(scope)._addTemp_("bzzz");
  45982. self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  45983. return self;
  45984. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  45985. },
  45986. args: [],
  45987. 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",
  45988. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  45989. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  45990. }),
  45991. $globals.ScopeVarTest);
  45992. $core.addMethod(
  45993. $core.method({
  45994. selector: "testUnknownVar",
  45995. protocol: 'tests',
  45996. fn: function (){
  45997. var self=this;
  45998. var node;
  45999. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  46000. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  46001. return $core.withContext(function($ctx1) {
  46002. var $1;
  46003. $1=$recv($VariableNode())._new();
  46004. $ctx1.sendIdx["new"]=1;
  46005. $recv($1)._value_("bzzz");
  46006. node=$recv($1)._yourself();
  46007. self._assert_($recv($recv($recv($MethodLexicalScope())._new())._bindingFor_(node))._isNil());
  46008. return self;
  46009. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  46010. },
  46011. args: [],
  46012. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  46013. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46014. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  46015. }),
  46016. $globals.ScopeVarTest);
  46017. $core.addClass('SemanticAnalyzerTest', $globals.TestCase, ['analyzer'], 'Compiler-Tests');
  46018. $core.addMethod(
  46019. $core.method({
  46020. selector: "setUp",
  46021. protocol: 'running',
  46022. fn: function (){
  46023. var self=this;
  46024. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  46025. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46026. return $core.withContext(function($ctx1) {
  46027. self["@analyzer"]=$recv($SemanticAnalyzer())._on_($Object());
  46028. return self;
  46029. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  46030. },
  46031. args: [],
  46032. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  46033. referencedClasses: ["SemanticAnalyzer", "Object"],
  46034. messageSends: ["on:"]
  46035. }),
  46036. $globals.SemanticAnalyzerTest);
  46037. $core.addMethod(
  46038. $core.method({
  46039. selector: "testAssignment",
  46040. protocol: 'tests',
  46041. fn: function (){
  46042. var self=this;
  46043. var src,ast;
  46044. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  46045. function $InvalidAssignmentError(){return $globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  46046. return $core.withContext(function($ctx1) {
  46047. src="foo self := 1";
  46048. ast=$recv($Smalltalk())._parse_(src);
  46049. self._should_raise_((function(){
  46050. return $core.withContext(function($ctx2) {
  46051. return $recv(self["@analyzer"])._visit_(ast);
  46052. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46053. }),$InvalidAssignmentError());
  46054. return self;
  46055. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46056. },
  46057. args: [],
  46058. 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",
  46059. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  46060. messageSends: ["parse:", "should:raise:", "visit:"]
  46061. }),
  46062. $globals.SemanticAnalyzerTest);
  46063. $core.addMethod(
  46064. $core.method({
  46065. selector: "testNonLocalReturn",
  46066. protocol: 'tests',
  46067. fn: function (){
  46068. var self=this;
  46069. var src,ast;
  46070. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  46071. return $core.withContext(function($ctx1) {
  46072. src="foo | a | a + 1. ^ a";
  46073. ast=$recv($Smalltalk())._parse_(src);
  46074. $recv(self["@analyzer"])._visit_(ast);
  46075. self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  46076. return self;
  46077. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46078. },
  46079. args: [],
  46080. 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",
  46081. referencedClasses: ["Smalltalk"],
  46082. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  46083. }),
  46084. $globals.SemanticAnalyzerTest);
  46085. $core.addMethod(
  46086. $core.method({
  46087. selector: "testNonLocalReturn2",
  46088. protocol: 'tests',
  46089. fn: function (){
  46090. var self=this;
  46091. var src,ast;
  46092. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  46093. return $core.withContext(function($ctx1) {
  46094. src="foo | a | a + 1. [ [ ^ a] ]";
  46095. ast=$recv($Smalltalk())._parse_(src);
  46096. $recv(self["@analyzer"])._visit_(ast);
  46097. self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  46098. return self;
  46099. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46100. },
  46101. args: [],
  46102. 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",
  46103. referencedClasses: ["Smalltalk"],
  46104. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  46105. }),
  46106. $globals.SemanticAnalyzerTest);
  46107. $core.addMethod(
  46108. $core.method({
  46109. selector: "testScope",
  46110. protocol: 'tests',
  46111. fn: function (){
  46112. var self=this;
  46113. var src,ast;
  46114. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  46115. return $core.withContext(function($ctx1) {
  46116. var $4,$3,$2,$1;
  46117. src="foo | a | a + 1. [ | b | b := a ]";
  46118. ast=$recv($Smalltalk())._parse_(src);
  46119. $recv(self["@analyzer"])._visit_(ast);
  46120. $4=$recv($recv($recv(ast)._nodes())._first())._nodes();
  46121. $ctx1.sendIdx["nodes"]=1;
  46122. $3=$recv($4)._last();
  46123. $2=$recv($3)._scope();
  46124. $ctx1.sendIdx["scope"]=1;
  46125. $1=$recv($2).__eq_eq($recv(ast)._scope());
  46126. self._deny_($1);
  46127. return self;
  46128. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46129. },
  46130. args: [],
  46131. 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.",
  46132. referencedClasses: ["Smalltalk"],
  46133. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "nodes", "first"]
  46134. }),
  46135. $globals.SemanticAnalyzerTest);
  46136. $core.addMethod(
  46137. $core.method({
  46138. selector: "testScope2",
  46139. protocol: 'tests',
  46140. fn: function (){
  46141. var self=this;
  46142. var src,ast;
  46143. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  46144. return $core.withContext(function($ctx1) {
  46145. var $8,$7,$6,$5,$4,$3,$2,$1;
  46146. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  46147. ast=$recv($Smalltalk())._parse_(src);
  46148. $recv(self["@analyzer"])._visit_(ast);
  46149. $8=$recv($recv($recv(ast)._nodes())._first())._nodes();
  46150. $ctx1.sendIdx["nodes"]=3;
  46151. $7=$recv($8)._last();
  46152. $6=$recv($7)._nodes();
  46153. $ctx1.sendIdx["nodes"]=2;
  46154. $5=$recv($6)._first();
  46155. $ctx1.sendIdx["first"]=2;
  46156. $4=$recv($5)._nodes();
  46157. $ctx1.sendIdx["nodes"]=1;
  46158. $3=$recv($4)._first();
  46159. $ctx1.sendIdx["first"]=1;
  46160. $2=$recv($3)._scope();
  46161. $ctx1.sendIdx["scope"]=1;
  46162. $1=$recv($2).__eq_eq($recv(ast)._scope());
  46163. self._deny_($1);
  46164. return self;
  46165. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46166. },
  46167. args: [],
  46168. 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.",
  46169. referencedClasses: ["Smalltalk"],
  46170. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "nodes", "last"]
  46171. }),
  46172. $globals.SemanticAnalyzerTest);
  46173. $core.addMethod(
  46174. $core.method({
  46175. selector: "testScopeLevel",
  46176. protocol: 'tests',
  46177. fn: function (){
  46178. var self=this;
  46179. var src,ast;
  46180. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  46181. return $core.withContext(function($ctx1) {
  46182. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  46183. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  46184. ast=$recv($Smalltalk())._parse_(src);
  46185. $recv(self["@analyzer"])._visit_(ast);
  46186. $2=$recv(ast)._scope();
  46187. $ctx1.sendIdx["scope"]=1;
  46188. $1=$recv($2)._scopeLevel();
  46189. $ctx1.sendIdx["scopeLevel"]=1;
  46190. self._assert_equals_($1,(1));
  46191. $ctx1.sendIdx["assert:equals:"]=1;
  46192. $10=$recv($recv($recv(ast)._nodes())._first())._nodes();
  46193. $ctx1.sendIdx["nodes"]=3;
  46194. $9=$recv($10)._last();
  46195. $8=$recv($9)._nodes();
  46196. $ctx1.sendIdx["nodes"]=2;
  46197. $7=$recv($8)._first();
  46198. $ctx1.sendIdx["first"]=2;
  46199. $6=$recv($7)._nodes();
  46200. $ctx1.sendIdx["nodes"]=1;
  46201. $5=$recv($6)._first();
  46202. $ctx1.sendIdx["first"]=1;
  46203. $4=$recv($5)._scope();
  46204. $3=$recv($4)._scopeLevel();
  46205. self._assert_equals_($3,(3));
  46206. return self;
  46207. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46208. },
  46209. args: [],
  46210. 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",
  46211. referencedClasses: ["Smalltalk"],
  46212. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "nodes", "last"]
  46213. }),
  46214. $globals.SemanticAnalyzerTest);
  46215. $core.addMethod(
  46216. $core.method({
  46217. selector: "testUnknownVariables",
  46218. protocol: 'tests',
  46219. fn: function (){
  46220. var self=this;
  46221. var src,ast;
  46222. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  46223. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  46224. return $core.withContext(function($ctx1) {
  46225. src="foo | a | b + a";
  46226. ast=$recv($Smalltalk())._parse_(src);
  46227. self._should_raise_((function(){
  46228. return $core.withContext(function($ctx2) {
  46229. return $recv(self["@analyzer"])._visit_(ast);
  46230. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46231. }),$UnknownVariableError());
  46232. return self;
  46233. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46234. },
  46235. args: [],
  46236. 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",
  46237. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  46238. messageSends: ["parse:", "should:raise:", "visit:"]
  46239. }),
  46240. $globals.SemanticAnalyzerTest);
  46241. $core.addMethod(
  46242. $core.method({
  46243. selector: "testUnknownVariablesWithScope",
  46244. protocol: 'tests',
  46245. fn: function (){
  46246. var self=this;
  46247. var src,ast;
  46248. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  46249. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  46250. return $core.withContext(function($ctx1) {
  46251. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  46252. ast=$recv($Smalltalk())._parse_(src);
  46253. self._should_raise_((function(){
  46254. return $core.withContext(function($ctx2) {
  46255. return $recv(self["@analyzer"])._visit_(ast);
  46256. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46257. }),$UnknownVariableError());
  46258. return self;
  46259. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46260. },
  46261. args: [],
  46262. 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",
  46263. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  46264. messageSends: ["parse:", "should:raise:", "visit:"]
  46265. }),
  46266. $globals.SemanticAnalyzerTest);
  46267. $core.addMethod(
  46268. $core.method({
  46269. selector: "testVariableShadowing",
  46270. protocol: 'tests',
  46271. fn: function (){
  46272. var self=this;
  46273. var src,ast;
  46274. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  46275. return $core.withContext(function($ctx1) {
  46276. src="foo | a | a + 1";
  46277. ast=$recv($Smalltalk())._parse_(src);
  46278. $recv(self["@analyzer"])._visit_(ast);
  46279. return self;
  46280. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46281. },
  46282. args: [],
  46283. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  46284. referencedClasses: ["Smalltalk"],
  46285. messageSends: ["parse:", "visit:"]
  46286. }),
  46287. $globals.SemanticAnalyzerTest);
  46288. $core.addMethod(
  46289. $core.method({
  46290. selector: "testVariableShadowing2",
  46291. protocol: 'tests',
  46292. fn: function (){
  46293. var self=this;
  46294. var src,ast;
  46295. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  46296. function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  46297. return $core.withContext(function($ctx1) {
  46298. src="foo | a | a + 1. [ | a | a := 2 ]";
  46299. ast=$recv($Smalltalk())._parse_(src);
  46300. self._should_raise_((function(){
  46301. return $core.withContext(function($ctx2) {
  46302. return $recv(self["@analyzer"])._visit_(ast);
  46303. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46304. }),$ShadowingVariableError());
  46305. return self;
  46306. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46307. },
  46308. args: [],
  46309. 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",
  46310. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  46311. messageSends: ["parse:", "should:raise:", "visit:"]
  46312. }),
  46313. $globals.SemanticAnalyzerTest);
  46314. $core.addMethod(
  46315. $core.method({
  46316. selector: "testVariableShadowing3",
  46317. protocol: 'tests',
  46318. fn: function (){
  46319. var self=this;
  46320. var src,ast;
  46321. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  46322. return $core.withContext(function($ctx1) {
  46323. src="foo | a | a + 1. [ | b | b := 2 ]";
  46324. ast=$recv($Smalltalk())._parse_(src);
  46325. $recv(self["@analyzer"])._visit_(ast);
  46326. return self;
  46327. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46328. },
  46329. args: [],
  46330. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  46331. referencedClasses: ["Smalltalk"],
  46332. messageSends: ["parse:", "visit:"]
  46333. }),
  46334. $globals.SemanticAnalyzerTest);
  46335. $core.addMethod(
  46336. $core.method({
  46337. selector: "testVariableShadowing4",
  46338. protocol: 'tests',
  46339. fn: function (){
  46340. var self=this;
  46341. var src,ast;
  46342. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  46343. return $core.withContext(function($ctx1) {
  46344. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  46345. ast=$recv($Smalltalk())._parse_(src);
  46346. $recv(self["@analyzer"])._visit_(ast);
  46347. return self;
  46348. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46349. },
  46350. args: [],
  46351. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  46352. referencedClasses: ["Smalltalk"],
  46353. messageSends: ["parse:", "visit:"]
  46354. }),
  46355. $globals.SemanticAnalyzerTest);
  46356. $core.addMethod(
  46357. $core.method({
  46358. selector: "testVariableShadowing5",
  46359. protocol: 'tests',
  46360. fn: function (){
  46361. var self=this;
  46362. var src,ast;
  46363. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  46364. function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  46365. return $core.withContext(function($ctx1) {
  46366. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  46367. ast=$recv($Smalltalk())._parse_(src);
  46368. self._should_raise_((function(){
  46369. return $core.withContext(function($ctx2) {
  46370. return $recv(self["@analyzer"])._visit_(ast);
  46371. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46372. }),$ShadowingVariableError());
  46373. return self;
  46374. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46375. },
  46376. args: [],
  46377. 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",
  46378. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  46379. messageSends: ["parse:", "should:raise:", "visit:"]
  46380. }),
  46381. $globals.SemanticAnalyzerTest);
  46382. $core.addMethod(
  46383. $core.method({
  46384. selector: "testVariablesLookup",
  46385. protocol: 'tests',
  46386. fn: function (){
  46387. var self=this;
  46388. var src,ast;
  46389. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  46390. return $core.withContext(function($ctx1) {
  46391. 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;
  46392. src="foo | a | a + 1. [ | b | b := a ]";
  46393. ast=$recv($Smalltalk())._parse_(src);
  46394. $recv(self["@analyzer"])._visit_(ast);
  46395. $7=$recv(ast)._nodes();
  46396. $ctx1.sendIdx["nodes"]=2;
  46397. $6=$recv($7)._first();
  46398. $ctx1.sendIdx["first"]=2;
  46399. $5=$recv($6)._nodes();
  46400. $ctx1.sendIdx["nodes"]=1;
  46401. $4=$recv($5)._first();
  46402. $ctx1.sendIdx["first"]=1;
  46403. $3=$recv($4)._receiver();
  46404. $ctx1.sendIdx["receiver"]=1;
  46405. $2=$recv($3)._binding();
  46406. $ctx1.sendIdx["binding"]=1;
  46407. $1=$recv($2)._isTempVar();
  46408. $ctx1.sendIdx["isTempVar"]=1;
  46409. self._assert_($1);
  46410. $ctx1.sendIdx["assert:"]=1;
  46411. $15=$recv(ast)._nodes();
  46412. $ctx1.sendIdx["nodes"]=4;
  46413. $14=$recv($15)._first();
  46414. $ctx1.sendIdx["first"]=4;
  46415. $13=$recv($14)._nodes();
  46416. $ctx1.sendIdx["nodes"]=3;
  46417. $12=$recv($13)._first();
  46418. $ctx1.sendIdx["first"]=3;
  46419. $11=$recv($12)._receiver();
  46420. $10=$recv($11)._binding();
  46421. $ctx1.sendIdx["binding"]=2;
  46422. $9=$recv($10)._scope();
  46423. $ctx1.sendIdx["scope"]=1;
  46424. $16=$recv(ast)._scope();
  46425. $ctx1.sendIdx["scope"]=2;
  46426. $8=$recv($9).__eq_eq($16);
  46427. $ctx1.sendIdx["=="]=1;
  46428. self._assert_($8);
  46429. $ctx1.sendIdx["assert:"]=2;
  46430. $27=$recv(ast)._nodes();
  46431. $ctx1.sendIdx["nodes"]=8;
  46432. $26=$recv($27)._first();
  46433. $ctx1.sendIdx["first"]=7;
  46434. $25=$recv($26)._nodes();
  46435. $ctx1.sendIdx["nodes"]=7;
  46436. $24=$recv($25)._last();
  46437. $ctx1.sendIdx["last"]=1;
  46438. $23=$recv($24)._nodes();
  46439. $ctx1.sendIdx["nodes"]=6;
  46440. $22=$recv($23)._first();
  46441. $ctx1.sendIdx["first"]=6;
  46442. $21=$recv($22)._nodes();
  46443. $ctx1.sendIdx["nodes"]=5;
  46444. $20=$recv($21)._first();
  46445. $ctx1.sendIdx["first"]=5;
  46446. $19=$recv($20)._left();
  46447. $ctx1.sendIdx["left"]=1;
  46448. $18=$recv($19)._binding();
  46449. $ctx1.sendIdx["binding"]=3;
  46450. $17=$recv($18)._isTempVar();
  46451. self._assert_($17);
  46452. $ctx1.sendIdx["assert:"]=3;
  46453. $39=$recv(ast)._nodes();
  46454. $ctx1.sendIdx["nodes"]=12;
  46455. $38=$recv($39)._first();
  46456. $ctx1.sendIdx["first"]=10;
  46457. $37=$recv($38)._nodes();
  46458. $ctx1.sendIdx["nodes"]=11;
  46459. $36=$recv($37)._last();
  46460. $ctx1.sendIdx["last"]=2;
  46461. $35=$recv($36)._nodes();
  46462. $ctx1.sendIdx["nodes"]=10;
  46463. $34=$recv($35)._first();
  46464. $ctx1.sendIdx["first"]=9;
  46465. $33=$recv($34)._nodes();
  46466. $ctx1.sendIdx["nodes"]=9;
  46467. $32=$recv($33)._first();
  46468. $ctx1.sendIdx["first"]=8;
  46469. $31=$recv($32)._left();
  46470. $30=$recv($31)._binding();
  46471. $29=$recv($30)._scope();
  46472. $ctx1.sendIdx["scope"]=3;
  46473. $42=$recv($recv($recv(ast)._nodes())._first())._nodes();
  46474. $ctx1.sendIdx["nodes"]=13;
  46475. $41=$recv($42)._last();
  46476. $40=$recv($41)._scope();
  46477. $28=$recv($29).__eq_eq($40);
  46478. self._assert_($28);
  46479. return self;
  46480. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46481. },
  46482. args: [],
  46483. 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.",
  46484. referencedClasses: ["Smalltalk"],
  46485. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "nodes", "==", "scope", "left", "last"]
  46486. }),
  46487. $globals.SemanticAnalyzerTest);
  46488. $core.addClass('AISemanticAnalyzerTest', $globals.SemanticAnalyzerTest, [], 'Compiler-Tests');
  46489. $core.addMethod(
  46490. $core.method({
  46491. selector: "setUp",
  46492. protocol: 'running',
  46493. fn: function (){
  46494. var self=this;
  46495. function $AISemanticAnalyzer(){return $globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)}
  46496. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46497. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  46498. return $core.withContext(function($ctx1) {
  46499. var $1,$3,$4,$2;
  46500. $1=$recv($AISemanticAnalyzer())._on_($Object());
  46501. $3=$recv($AIContext())._new();
  46502. $recv($3)._defineLocal_("local");
  46503. $recv($3)._localAt_put_("local",(3));
  46504. $4=$recv($3)._yourself();
  46505. $ctx1.sendIdx["yourself"]=1;
  46506. $2=$4;
  46507. $recv($1)._context_($2);
  46508. self["@analyzer"]=$recv($1)._yourself();
  46509. return self;
  46510. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  46511. },
  46512. args: [],
  46513. 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",
  46514. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  46515. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  46516. }),
  46517. $globals.AISemanticAnalyzerTest);
  46518. $core.addMethod(
  46519. $core.method({
  46520. selector: "testContextVariables",
  46521. protocol: 'tests',
  46522. fn: function (){
  46523. var self=this;
  46524. var src,ast;
  46525. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  46526. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  46527. return $core.withContext(function($ctx1) {
  46528. src="foo | a | local + a";
  46529. ast=$recv($Smalltalk())._parse_(src);
  46530. self._shouldnt_raise_((function(){
  46531. return $core.withContext(function($ctx2) {
  46532. return $recv(self["@analyzer"])._visit_(ast);
  46533. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46534. }),$UnknownVariableError());
  46535. return self;
  46536. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  46537. },
  46538. args: [],
  46539. 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",
  46540. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  46541. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  46542. }),
  46543. $globals.AISemanticAnalyzerTest);
  46544. });
  46545. define("amber_core/Kernel-Tests", ["amber/boot", "amber_core/SUnit", "amber_core/Kernel-Objects"], function($boot){"use strict";
  46546. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  46547. $core.addPackage('Kernel-Tests');
  46548. $core.packages["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
  46549. $core.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  46550. $core.addClass('AnnouncementSubscriptionTest', $globals.TestCase, [], 'Kernel-Tests');
  46551. $core.addMethod(
  46552. $core.method({
  46553. selector: "testAddExtensionMethod",
  46554. protocol: 'tests',
  46555. fn: function (){
  46556. var self=this;
  46557. var method,dirty;
  46558. return $core.withContext(function($ctx1) {
  46559. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  46560. $2=self._class();
  46561. $ctx1.sendIdx["class"]=1;
  46562. $1=$recv($2)._package();
  46563. $ctx1.sendIdx["package"]=1;
  46564. dirty=$recv($1)._isDirty();
  46565. $ctx1.sendIdx["isDirty"]=1;
  46566. $4=self._class();
  46567. $ctx1.sendIdx["class"]=2;
  46568. $3=$recv($4)._package();
  46569. $ctx1.sendIdx["package"]=2;
  46570. $recv($3)._beClean();
  46571. $5=self._class();
  46572. $ctx1.sendIdx["class"]=3;
  46573. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  46574. $8=self._class();
  46575. $ctx1.sendIdx["class"]=4;
  46576. $7=$recv($8)._package();
  46577. $ctx1.sendIdx["package"]=3;
  46578. $6=$recv($7)._isDirty();
  46579. self._deny_($6);
  46580. $9=self._class();
  46581. $ctx1.sendIdx["class"]=5;
  46582. $recv($9)._removeCompiledMethod_(method);
  46583. $10=dirty;
  46584. if($core.assert($10)){
  46585. $recv($recv(self._class())._package())._beDirty();
  46586. };
  46587. return self;
  46588. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  46589. },
  46590. args: [],
  46591. 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 ]",
  46592. referencedClasses: [],
  46593. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  46594. }),
  46595. $globals.AnnouncementSubscriptionTest);
  46596. $core.addMethod(
  46597. $core.method({
  46598. selector: "testHandlesAnnouncement",
  46599. protocol: 'tests',
  46600. fn: function (){
  46601. var self=this;
  46602. var subscription,announcementClass1,announcementClass2,classBuilder;
  46603. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  46604. function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  46605. function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  46606. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46607. return $core.withContext(function($ctx1) {
  46608. var $1,$2;
  46609. classBuilder=$recv($ClassBuilder())._new();
  46610. $ctx1.sendIdx["new"]=1;
  46611. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  46612. subscription=$recv($recv($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  46613. $1=$recv(subscription)._handlesAnnouncement_($SystemAnnouncement());
  46614. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  46615. self._assert_equals_($1,true);
  46616. $ctx1.sendIdx["assert:equals:"]=1;
  46617. $2=$recv(subscription)._handlesAnnouncement_(announcementClass1);
  46618. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  46619. self._assert_equals_($2,true);
  46620. $ctx1.sendIdx["assert:equals:"]=2;
  46621. self._assert_equals_($recv(subscription)._handlesAnnouncement_($Object()),false);
  46622. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  46623. return self;
  46624. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  46625. },
  46626. args: [],
  46627. 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.",
  46628. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  46629. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  46630. }),
  46631. $globals.AnnouncementSubscriptionTest);
  46632. $core.addClass('AnnouncerTest', $globals.TestCase, [], 'Kernel-Tests');
  46633. $core.addMethod(
  46634. $core.method({
  46635. selector: "testOnDo",
  46636. protocol: 'tests',
  46637. fn: function (){
  46638. var self=this;
  46639. var counter,announcer;
  46640. function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  46641. function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  46642. return $core.withContext(function($ctx1) {
  46643. var $1,$2;
  46644. counter=(0);
  46645. announcer=$recv($Announcer())._new();
  46646. $ctx1.sendIdx["new"]=1;
  46647. $recv(announcer)._on_do_($SystemAnnouncement(),(function(){
  46648. return $core.withContext(function($ctx2) {
  46649. counter=$recv(counter).__plus((1));
  46650. return counter;
  46651. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46652. }));
  46653. $1=announcer;
  46654. $2=$recv($SystemAnnouncement())._new();
  46655. $ctx1.sendIdx["new"]=2;
  46656. $recv($1)._announce_($2);
  46657. $ctx1.sendIdx["announce:"]=1;
  46658. self._assert_equals_(counter,(1));
  46659. $ctx1.sendIdx["assert:equals:"]=1;
  46660. $recv(announcer)._announce_($recv($SystemAnnouncement())._new());
  46661. self._assert_equals_(counter,(2));
  46662. return self;
  46663. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  46664. },
  46665. args: [],
  46666. 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.",
  46667. referencedClasses: ["Announcer", "SystemAnnouncement"],
  46668. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  46669. }),
  46670. $globals.AnnouncerTest);
  46671. $core.addMethod(
  46672. $core.method({
  46673. selector: "testOnDoFor",
  46674. protocol: 'tests',
  46675. fn: function (){
  46676. var self=this;
  46677. var counter,announcer;
  46678. function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  46679. function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  46680. return $core.withContext(function($ctx1) {
  46681. var $1,$2,$3,$4;
  46682. counter=(0);
  46683. announcer=$recv($Announcer())._new();
  46684. $ctx1.sendIdx["new"]=1;
  46685. $recv(announcer)._on_do_for_($SystemAnnouncement(),(function(){
  46686. return $core.withContext(function($ctx2) {
  46687. counter=$recv(counter).__plus((1));
  46688. return counter;
  46689. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46690. }),self);
  46691. $1=announcer;
  46692. $2=$recv($SystemAnnouncement())._new();
  46693. $ctx1.sendIdx["new"]=2;
  46694. $recv($1)._announce_($2);
  46695. $ctx1.sendIdx["announce:"]=1;
  46696. self._assert_equals_(counter,(1));
  46697. $ctx1.sendIdx["assert:equals:"]=1;
  46698. $3=announcer;
  46699. $4=$recv($SystemAnnouncement())._new();
  46700. $ctx1.sendIdx["new"]=3;
  46701. $recv($3)._announce_($4);
  46702. $ctx1.sendIdx["announce:"]=2;
  46703. self._assert_equals_(counter,(2));
  46704. $ctx1.sendIdx["assert:equals:"]=2;
  46705. $recv(announcer)._unsubscribe_(self);
  46706. $recv(announcer)._announce_($recv($SystemAnnouncement())._new());
  46707. self._assert_equals_(counter,(2));
  46708. return self;
  46709. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  46710. },
  46711. args: [],
  46712. 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.",
  46713. referencedClasses: ["Announcer", "SystemAnnouncement"],
  46714. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  46715. }),
  46716. $globals.AnnouncerTest);
  46717. $core.addMethod(
  46718. $core.method({
  46719. selector: "testOnDoOnce",
  46720. protocol: 'tests',
  46721. fn: function (){
  46722. var self=this;
  46723. var counter,announcer;
  46724. function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  46725. function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  46726. return $core.withContext(function($ctx1) {
  46727. var $1,$2;
  46728. counter=(0);
  46729. announcer=$recv($Announcer())._new();
  46730. $ctx1.sendIdx["new"]=1;
  46731. $recv(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  46732. return $core.withContext(function($ctx2) {
  46733. counter=$recv(counter).__plus((1));
  46734. return counter;
  46735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46736. }));
  46737. $1=announcer;
  46738. $2=$recv($SystemAnnouncement())._new();
  46739. $ctx1.sendIdx["new"]=2;
  46740. $recv($1)._announce_($2);
  46741. $ctx1.sendIdx["announce:"]=1;
  46742. self._assert_equals_(counter,(1));
  46743. $ctx1.sendIdx["assert:equals:"]=1;
  46744. $recv(announcer)._announce_($recv($SystemAnnouncement())._new());
  46745. self._assert_equals_(counter,(1));
  46746. return self;
  46747. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  46748. },
  46749. args: [],
  46750. 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.",
  46751. referencedClasses: ["Announcer", "SystemAnnouncement"],
  46752. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  46753. }),
  46754. $globals.AnnouncerTest);
  46755. $core.addClass('BlockClosureTest', $globals.TestCase, [], 'Kernel-Tests');
  46756. $core.addMethod(
  46757. $core.method({
  46758. selector: "localReturnOnDoCatch",
  46759. protocol: 'fixture',
  46760. fn: function (){
  46761. var self=this;
  46762. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  46763. return $core.withContext(function($ctx1) {
  46764. var $early={};
  46765. try {
  46766. $recv((function(){
  46767. throw $early=[(2)];
  46768. }))._on_do_($Error(),(function(){
  46769. }));
  46770. return (3);
  46771. }
  46772. catch(e) {if(e===$early)return e[0]; throw e}
  46773. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  46774. },
  46775. args: [],
  46776. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  46777. referencedClasses: ["Error"],
  46778. messageSends: ["on:do:"]
  46779. }),
  46780. $globals.BlockClosureTest);
  46781. $core.addMethod(
  46782. $core.method({
  46783. selector: "localReturnOnDoMiss",
  46784. protocol: 'fixture',
  46785. fn: function (){
  46786. var self=this;
  46787. function $Class(){return $globals.Class||(typeof Class=="undefined"?nil:Class)}
  46788. return $core.withContext(function($ctx1) {
  46789. var $early={};
  46790. try {
  46791. $recv((function(){
  46792. throw $early=[(2)];
  46793. }))._on_do_($Class(),(function(){
  46794. }));
  46795. return (3);
  46796. }
  46797. catch(e) {if(e===$early)return e[0]; throw e}
  46798. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  46799. },
  46800. args: [],
  46801. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  46802. referencedClasses: ["Class"],
  46803. messageSends: ["on:do:"]
  46804. }),
  46805. $globals.BlockClosureTest);
  46806. $core.addMethod(
  46807. $core.method({
  46808. selector: "testCanClearInterval",
  46809. protocol: 'tests',
  46810. fn: function (){
  46811. var self=this;
  46812. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  46813. return $core.withContext(function($ctx1) {
  46814. self._shouldnt_raise_((function(){
  46815. return $core.withContext(function($ctx2) {
  46816. return $recv($recv((function(){
  46817. return $core.withContext(function($ctx3) {
  46818. return $recv($recv($Error())._new())._signal();
  46819. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46820. }))._valueWithInterval_((0)))._clearInterval();
  46821. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46822. }),$Error());
  46823. return self;
  46824. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  46825. },
  46826. args: [],
  46827. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  46828. referencedClasses: ["Error"],
  46829. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  46830. }),
  46831. $globals.BlockClosureTest);
  46832. $core.addMethod(
  46833. $core.method({
  46834. selector: "testCanClearTimeout",
  46835. protocol: 'tests',
  46836. fn: function (){
  46837. var self=this;
  46838. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  46839. return $core.withContext(function($ctx1) {
  46840. self._shouldnt_raise_((function(){
  46841. return $core.withContext(function($ctx2) {
  46842. return $recv($recv((function(){
  46843. return $core.withContext(function($ctx3) {
  46844. return $recv($recv($Error())._new())._signal();
  46845. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46846. }))._valueWithTimeout_((0)))._clearTimeout();
  46847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46848. }),$Error());
  46849. return self;
  46850. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  46851. },
  46852. args: [],
  46853. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  46854. referencedClasses: ["Error"],
  46855. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  46856. }),
  46857. $globals.BlockClosureTest);
  46858. $core.addMethod(
  46859. $core.method({
  46860. selector: "testCompiledSource",
  46861. protocol: 'tests',
  46862. fn: function (){
  46863. var self=this;
  46864. return $core.withContext(function($ctx1) {
  46865. self._assert_($recv($recv((function(){
  46866. return $core.withContext(function($ctx2) {
  46867. return (1).__plus((1));
  46868. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46869. }))._compiledSource())._includesSubString_("function"));
  46870. return self;
  46871. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  46872. },
  46873. args: [],
  46874. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  46875. referencedClasses: [],
  46876. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  46877. }),
  46878. $globals.BlockClosureTest);
  46879. $core.addMethod(
  46880. $core.method({
  46881. selector: "testCurrySelf",
  46882. protocol: 'tests',
  46883. fn: function (){
  46884. var self=this;
  46885. var curriedMethod,array;
  46886. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  46887. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  46888. return $core.withContext(function($ctx1) {
  46889. curriedMethod=$recv($recv((function(selfarg,x){
  46890. return $core.withContext(function($ctx2) {
  46891. return $recv(selfarg)._at_(x);
  46892. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  46893. }))._currySelf())._asCompiledMethod_("foo:");
  46894. array=[(3), (1), (4)];
  46895. $recv($recv($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  46896. $recv((function(){
  46897. return $core.withContext(function($ctx2) {
  46898. return self._assert_equals_($recv(array)._foo_((2)),(1));
  46899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46900. }))._ensure_((function(){
  46901. return $core.withContext(function($ctx2) {
  46902. return $recv($Array())._removeCompiledMethod_(curriedMethod);
  46903. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46904. }));
  46905. return self;
  46906. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  46907. },
  46908. args: [],
  46909. 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 ]",
  46910. referencedClasses: ["ClassBuilder", "Array"],
  46911. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  46912. }),
  46913. $globals.BlockClosureTest);
  46914. $core.addMethod(
  46915. $core.method({
  46916. selector: "testEnsure",
  46917. protocol: 'tests',
  46918. fn: function (){
  46919. var self=this;
  46920. return $core.withContext(function($ctx1) {
  46921. self._assert_equals_($recv((function(){
  46922. return (3);
  46923. }))._ensure_((function(){
  46924. return (4);
  46925. })),(3));
  46926. return self;
  46927. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  46928. },
  46929. args: [],
  46930. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  46931. referencedClasses: [],
  46932. messageSends: ["assert:equals:", "ensure:"]
  46933. }),
  46934. $globals.BlockClosureTest);
  46935. $core.addMethod(
  46936. $core.method({
  46937. selector: "testEnsureRaises",
  46938. protocol: 'tests',
  46939. fn: function (){
  46940. var self=this;
  46941. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  46942. return $core.withContext(function($ctx1) {
  46943. self._should_raise_((function(){
  46944. return $core.withContext(function($ctx2) {
  46945. return $recv((function(){
  46946. return $core.withContext(function($ctx3) {
  46947. return $recv($recv($Error())._new())._signal();
  46948. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46949. }))._ensure_((function(){
  46950. return true;
  46951. }));
  46952. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46953. }),$Error());
  46954. return self;
  46955. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  46956. },
  46957. args: [],
  46958. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  46959. referencedClasses: ["Error"],
  46960. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  46961. }),
  46962. $globals.BlockClosureTest);
  46963. $core.addMethod(
  46964. $core.method({
  46965. selector: "testExceptionSemantics",
  46966. protocol: 'tests',
  46967. fn: function (){
  46968. var self=this;
  46969. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  46970. return $core.withContext(function($ctx1) {
  46971. self._timeout_((100));
  46972. $recv(self._async_((function(){
  46973. return $core.withContext(function($ctx2) {
  46974. return $recv((function(){
  46975. return $core.withContext(function($ctx3) {
  46976. self._assert_(true);
  46977. $recv($Error())._signal();
  46978. self._deny_(true);
  46979. return self._finished();
  46980. $ctx3.sendIdx["finished"]=1;
  46981. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46982. }))._on_do_($Error(),(function(ex){
  46983. return $core.withContext(function($ctx3) {
  46984. return self._finished();
  46985. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  46986. }));
  46987. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46988. })))._valueWithTimeout_((0));
  46989. return self;
  46990. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  46991. },
  46992. args: [],
  46993. 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",
  46994. referencedClasses: ["Error"],
  46995. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  46996. }),
  46997. $globals.BlockClosureTest);
  46998. $core.addMethod(
  46999. $core.method({
  47000. selector: "testLocalReturnOnDoCatch",
  47001. protocol: 'tests',
  47002. fn: function (){
  47003. var self=this;
  47004. return $core.withContext(function($ctx1) {
  47005. self._assert_equals_(self._localReturnOnDoCatch(),(2));
  47006. return self;
  47007. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  47008. },
  47009. args: [],
  47010. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  47011. referencedClasses: [],
  47012. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  47013. }),
  47014. $globals.BlockClosureTest);
  47015. $core.addMethod(
  47016. $core.method({
  47017. selector: "testLocalReturnOnDoMiss",
  47018. protocol: 'tests',
  47019. fn: function (){
  47020. var self=this;
  47021. return $core.withContext(function($ctx1) {
  47022. self._assert_equals_(self._localReturnOnDoMiss(),(2));
  47023. return self;
  47024. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  47025. },
  47026. args: [],
  47027. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  47028. referencedClasses: [],
  47029. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  47030. }),
  47031. $globals.BlockClosureTest);
  47032. $core.addMethod(
  47033. $core.method({
  47034. selector: "testNewWithValues",
  47035. protocol: 'tests',
  47036. fn: function (){
  47037. var self=this;
  47038. return $core.withContext(function($ctx1) {
  47039. function TestConstructor(arg1, arg2, arg3) {}
  47040. TestConstructor.prototype.name = 'theTestPrototype';
  47041. var wrappedConstructor = $recv(TestConstructor);
  47042. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  47043. self._assert_(result instanceof TestConstructor);
  47044. self._assert_equals_(result.name, 'theTestPrototype');
  47045. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  47046. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, $globals.Error);;
  47047. return self;
  47048. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  47049. },
  47050. args: [],
  47051. 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>",
  47052. referencedClasses: [],
  47053. messageSends: []
  47054. }),
  47055. $globals.BlockClosureTest);
  47056. $core.addMethod(
  47057. $core.method({
  47058. selector: "testNumArgs",
  47059. protocol: 'tests',
  47060. fn: function (){
  47061. var self=this;
  47062. return $core.withContext(function($ctx1) {
  47063. var $1;
  47064. $1=$recv((function(){
  47065. }))._numArgs();
  47066. $ctx1.sendIdx["numArgs"]=1;
  47067. self._assert_equals_($1,(0));
  47068. $ctx1.sendIdx["assert:equals:"]=1;
  47069. self._assert_equals_($recv((function(a,b){
  47070. }))._numArgs(),(2));
  47071. return self;
  47072. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  47073. },
  47074. args: [],
  47075. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  47076. referencedClasses: [],
  47077. messageSends: ["assert:equals:", "numArgs"]
  47078. }),
  47079. $globals.BlockClosureTest);
  47080. $core.addMethod(
  47081. $core.method({
  47082. selector: "testOnDo",
  47083. protocol: 'tests',
  47084. fn: function (){
  47085. var self=this;
  47086. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  47087. return $core.withContext(function($ctx1) {
  47088. self._assert_($recv((function(){
  47089. return $core.withContext(function($ctx2) {
  47090. return $recv($recv($Error())._new())._signal();
  47091. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47092. }))._on_do_($Error(),(function(ex){
  47093. return true;
  47094. })));
  47095. return self;
  47096. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  47097. },
  47098. args: [],
  47099. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  47100. referencedClasses: ["Error"],
  47101. messageSends: ["assert:", "on:do:", "signal", "new"]
  47102. }),
  47103. $globals.BlockClosureTest);
  47104. $core.addMethod(
  47105. $core.method({
  47106. selector: "testValue",
  47107. protocol: 'tests',
  47108. fn: function (){
  47109. var self=this;
  47110. return $core.withContext(function($ctx1) {
  47111. var $1;
  47112. $1=$recv((function(){
  47113. return $core.withContext(function($ctx2) {
  47114. return (1).__plus((1));
  47115. $ctx2.sendIdx["+"]=1;
  47116. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47117. }))._value();
  47118. $ctx1.sendIdx["value"]=1;
  47119. self._assert_equals_($1,(2));
  47120. $ctx1.sendIdx["assert:equals:"]=1;
  47121. self._assert_equals_($recv((function(x){
  47122. return $core.withContext(function($ctx2) {
  47123. return $recv(x).__plus((1));
  47124. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  47125. }))._value_((2)),(3));
  47126. $ctx1.sendIdx["assert:equals:"]=2;
  47127. self._assert_equals_($recv((function(x,y){
  47128. return $core.withContext(function($ctx2) {
  47129. return $recv(x).__star(y);
  47130. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  47131. }))._value_value_((2),(4)),(8));
  47132. $ctx1.sendIdx["assert:equals:"]=3;
  47133. self._assert_equals_($recv((function(a,b,c){
  47134. return (1);
  47135. }))._value(),(1));
  47136. return self;
  47137. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  47138. },
  47139. args: [],
  47140. 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",
  47141. referencedClasses: [],
  47142. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  47143. }),
  47144. $globals.BlockClosureTest);
  47145. $core.addMethod(
  47146. $core.method({
  47147. selector: "testValueWithPossibleArguments",
  47148. protocol: 'tests',
  47149. fn: function (){
  47150. var self=this;
  47151. return $core.withContext(function($ctx1) {
  47152. var $1,$2;
  47153. $1=$recv((function(){
  47154. return (1);
  47155. }))._valueWithPossibleArguments_([(3), (4)]);
  47156. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  47157. self._assert_equals_($1,(1));
  47158. $ctx1.sendIdx["assert:equals:"]=1;
  47159. $2=$recv((function(a){
  47160. return $core.withContext(function($ctx2) {
  47161. return $recv(a).__plus((4));
  47162. $ctx2.sendIdx["+"]=1;
  47163. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  47164. }))._valueWithPossibleArguments_([(3), (4)]);
  47165. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  47166. self._assert_equals_($2,(7));
  47167. $ctx1.sendIdx["assert:equals:"]=2;
  47168. self._assert_equals_($recv((function(a,b){
  47169. return $core.withContext(function($ctx2) {
  47170. return $recv(a).__plus(b);
  47171. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  47172. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  47173. return self;
  47174. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  47175. },
  47176. args: [],
  47177. 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.",
  47178. referencedClasses: [],
  47179. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  47180. }),
  47181. $globals.BlockClosureTest);
  47182. $core.addMethod(
  47183. $core.method({
  47184. selector: "testWhileFalse",
  47185. protocol: 'tests',
  47186. fn: function (){
  47187. var self=this;
  47188. var i;
  47189. return $core.withContext(function($ctx1) {
  47190. i=(0);
  47191. $recv((function(){
  47192. return $core.withContext(function($ctx2) {
  47193. return $recv(i).__gt((5));
  47194. $ctx2.sendIdx[">"]=1;
  47195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47196. }))._whileFalse_((function(){
  47197. return $core.withContext(function($ctx2) {
  47198. i=$recv(i).__plus((1));
  47199. $ctx2.sendIdx["+"]=1;
  47200. return i;
  47201. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47202. }));
  47203. self._assert_equals_(i,(6));
  47204. $ctx1.sendIdx["assert:equals:"]=1;
  47205. i=(0);
  47206. $recv((function(){
  47207. return $core.withContext(function($ctx2) {
  47208. i=$recv(i).__plus((1));
  47209. i;
  47210. return $recv(i).__gt((5));
  47211. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47212. }))._whileFalse();
  47213. self._assert_equals_(i,(6));
  47214. return self;
  47215. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  47216. },
  47217. args: [],
  47218. 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",
  47219. referencedClasses: [],
  47220. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  47221. }),
  47222. $globals.BlockClosureTest);
  47223. $core.addMethod(
  47224. $core.method({
  47225. selector: "testWhileTrue",
  47226. protocol: 'tests',
  47227. fn: function (){
  47228. var self=this;
  47229. var i;
  47230. return $core.withContext(function($ctx1) {
  47231. i=(0);
  47232. $recv((function(){
  47233. return $core.withContext(function($ctx2) {
  47234. return $recv(i).__lt((5));
  47235. $ctx2.sendIdx["<"]=1;
  47236. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47237. }))._whileTrue_((function(){
  47238. return $core.withContext(function($ctx2) {
  47239. i=$recv(i).__plus((1));
  47240. $ctx2.sendIdx["+"]=1;
  47241. return i;
  47242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47243. }));
  47244. self._assert_equals_(i,(5));
  47245. $ctx1.sendIdx["assert:equals:"]=1;
  47246. i=(0);
  47247. $recv((function(){
  47248. return $core.withContext(function($ctx2) {
  47249. i=$recv(i).__plus((1));
  47250. i;
  47251. return $recv(i).__lt((5));
  47252. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47253. }))._whileTrue();
  47254. self._assert_equals_(i,(5));
  47255. return self;
  47256. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  47257. },
  47258. args: [],
  47259. 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",
  47260. referencedClasses: [],
  47261. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  47262. }),
  47263. $globals.BlockClosureTest);
  47264. $core.addClass('BooleanTest', $globals.TestCase, [], 'Kernel-Tests');
  47265. $core.addMethod(
  47266. $core.method({
  47267. selector: "testEquality",
  47268. protocol: 'tests',
  47269. fn: function (){
  47270. var self=this;
  47271. return $core.withContext(function($ctx1) {
  47272. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  47273. $1=(0).__eq(false);
  47274. $ctx1.sendIdx["="]=1;
  47275. self._deny_($1);
  47276. $ctx1.sendIdx["deny:"]=1;
  47277. $2=false.__eq((0));
  47278. $ctx1.sendIdx["="]=2;
  47279. self._deny_($2);
  47280. $ctx1.sendIdx["deny:"]=2;
  47281. $3="".__eq(false);
  47282. $ctx1.sendIdx["="]=3;
  47283. self._deny_($3);
  47284. $ctx1.sendIdx["deny:"]=3;
  47285. $4=false.__eq("");
  47286. $ctx1.sendIdx["="]=4;
  47287. self._deny_($4);
  47288. $ctx1.sendIdx["deny:"]=4;
  47289. $5=true.__eq(true);
  47290. $ctx1.sendIdx["="]=5;
  47291. self._assert_($5);
  47292. $ctx1.sendIdx["assert:"]=1;
  47293. $6=false.__eq(true);
  47294. $ctx1.sendIdx["="]=6;
  47295. self._deny_($6);
  47296. $ctx1.sendIdx["deny:"]=5;
  47297. $7=true.__eq(false);
  47298. $ctx1.sendIdx["="]=7;
  47299. self._deny_($7);
  47300. $8=false.__eq(false);
  47301. $ctx1.sendIdx["="]=8;
  47302. self._assert_($8);
  47303. $ctx1.sendIdx["assert:"]=2;
  47304. $10=true._yourself();
  47305. $ctx1.sendIdx["yourself"]=1;
  47306. $9=$recv($10).__eq(true);
  47307. $ctx1.sendIdx["="]=9;
  47308. self._assert_($9);
  47309. $ctx1.sendIdx["assert:"]=3;
  47310. $12=true._yourself();
  47311. $ctx1.sendIdx["yourself"]=2;
  47312. $11=$recv($12).__eq(true._yourself());
  47313. self._assert_($11);
  47314. return self;
  47315. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  47316. },
  47317. args: [],
  47318. 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)",
  47319. referencedClasses: [],
  47320. messageSends: ["deny:", "=", "assert:", "yourself"]
  47321. }),
  47322. $globals.BooleanTest);
  47323. $core.addMethod(
  47324. $core.method({
  47325. selector: "testIdentity",
  47326. protocol: 'tests',
  47327. fn: function (){
  47328. var self=this;
  47329. return $core.withContext(function($ctx1) {
  47330. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  47331. $1=(0).__eq_eq(false);
  47332. $ctx1.sendIdx["=="]=1;
  47333. self._deny_($1);
  47334. $ctx1.sendIdx["deny:"]=1;
  47335. $2=false.__eq_eq((0));
  47336. $ctx1.sendIdx["=="]=2;
  47337. self._deny_($2);
  47338. $ctx1.sendIdx["deny:"]=2;
  47339. $3="".__eq_eq(false);
  47340. $ctx1.sendIdx["=="]=3;
  47341. self._deny_($3);
  47342. $ctx1.sendIdx["deny:"]=3;
  47343. $4=false.__eq_eq("");
  47344. $ctx1.sendIdx["=="]=4;
  47345. self._deny_($4);
  47346. $ctx1.sendIdx["deny:"]=4;
  47347. $5=true.__eq_eq(true);
  47348. $ctx1.sendIdx["=="]=5;
  47349. self._assert_($5);
  47350. $ctx1.sendIdx["assert:"]=1;
  47351. $6=false.__eq_eq(true);
  47352. $ctx1.sendIdx["=="]=6;
  47353. self._deny_($6);
  47354. $ctx1.sendIdx["deny:"]=5;
  47355. $7=true.__eq_eq(false);
  47356. $ctx1.sendIdx["=="]=7;
  47357. self._deny_($7);
  47358. $8=false.__eq_eq(false);
  47359. $ctx1.sendIdx["=="]=8;
  47360. self._assert_($8);
  47361. $ctx1.sendIdx["assert:"]=2;
  47362. $10=true._yourself();
  47363. $ctx1.sendIdx["yourself"]=1;
  47364. $9=$recv($10).__eq_eq(true);
  47365. $ctx1.sendIdx["=="]=9;
  47366. self._assert_($9);
  47367. $ctx1.sendIdx["assert:"]=3;
  47368. $12=true._yourself();
  47369. $ctx1.sendIdx["yourself"]=2;
  47370. $11=$recv($12).__eq_eq(true._yourself());
  47371. self._assert_($11);
  47372. return self;
  47373. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  47374. },
  47375. args: [],
  47376. 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",
  47377. referencedClasses: [],
  47378. messageSends: ["deny:", "==", "assert:", "yourself"]
  47379. }),
  47380. $globals.BooleanTest);
  47381. $core.addMethod(
  47382. $core.method({
  47383. selector: "testIfTrueIfFalse",
  47384. protocol: 'tests',
  47385. fn: function (){
  47386. var self=this;
  47387. return $core.withContext(function($ctx1) {
  47388. var $1,$2,$3,$4,$5,$6,$7,$8;
  47389. if($core.assert(true)){
  47390. $1="alternative block";
  47391. };
  47392. self._assert_equals_($1,"alternative block");
  47393. $ctx1.sendIdx["assert:equals:"]=1;
  47394. if(!$core.assert(true)){
  47395. $2="alternative block";
  47396. };
  47397. self._assert_equals_($2,nil);
  47398. $ctx1.sendIdx["assert:equals:"]=2;
  47399. if($core.assert(false)){
  47400. $3="alternative block";
  47401. };
  47402. self._assert_equals_($3,nil);
  47403. $ctx1.sendIdx["assert:equals:"]=3;
  47404. if(!$core.assert(false)){
  47405. $4="alternative block";
  47406. };
  47407. self._assert_equals_($4,"alternative block");
  47408. $ctx1.sendIdx["assert:equals:"]=4;
  47409. if($core.assert(false)){
  47410. $5="alternative block";
  47411. } else {
  47412. $5="alternative block2";
  47413. };
  47414. self._assert_equals_($5,"alternative block2");
  47415. $ctx1.sendIdx["assert:equals:"]=5;
  47416. if($core.assert(false)){
  47417. $6="alternative block2";
  47418. } else {
  47419. $6="alternative block";
  47420. };
  47421. self._assert_equals_($6,"alternative block");
  47422. $ctx1.sendIdx["assert:equals:"]=6;
  47423. if($core.assert(true)){
  47424. $7="alternative block";
  47425. } else {
  47426. $7="alternative block2";
  47427. };
  47428. self._assert_equals_($7,"alternative block");
  47429. $ctx1.sendIdx["assert:equals:"]=7;
  47430. if($core.assert(true)){
  47431. $8="alternative block2";
  47432. } else {
  47433. $8="alternative block";
  47434. };
  47435. self._assert_equals_($8,"alternative block2");
  47436. return self;
  47437. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  47438. },
  47439. args: [],
  47440. 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'.",
  47441. referencedClasses: [],
  47442. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  47443. }),
  47444. $globals.BooleanTest);
  47445. $core.addMethod(
  47446. $core.method({
  47447. selector: "testIfTrueIfFalseWithBoxing",
  47448. protocol: 'tests',
  47449. fn: function (){
  47450. var self=this;
  47451. return $core.withContext(function($ctx1) {
  47452. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  47453. $2=true._yourself();
  47454. $ctx1.sendIdx["yourself"]=1;
  47455. if($core.assert($2)){
  47456. $1="alternative block";
  47457. };
  47458. self._assert_equals_($1,"alternative block");
  47459. $ctx1.sendIdx["assert:equals:"]=1;
  47460. $4=true._yourself();
  47461. $ctx1.sendIdx["yourself"]=2;
  47462. if(!$core.assert($4)){
  47463. $3="alternative block";
  47464. };
  47465. self._assert_equals_($3,nil);
  47466. $ctx1.sendIdx["assert:equals:"]=2;
  47467. $6=false._yourself();
  47468. $ctx1.sendIdx["yourself"]=3;
  47469. if($core.assert($6)){
  47470. $5="alternative block";
  47471. };
  47472. self._assert_equals_($5,nil);
  47473. $ctx1.sendIdx["assert:equals:"]=3;
  47474. $8=false._yourself();
  47475. $ctx1.sendIdx["yourself"]=4;
  47476. if(!$core.assert($8)){
  47477. $7="alternative block";
  47478. };
  47479. self._assert_equals_($7,"alternative block");
  47480. $ctx1.sendIdx["assert:equals:"]=4;
  47481. $10=false._yourself();
  47482. $ctx1.sendIdx["yourself"]=5;
  47483. if($core.assert($10)){
  47484. $9="alternative block";
  47485. } else {
  47486. $9="alternative block2";
  47487. };
  47488. self._assert_equals_($9,"alternative block2");
  47489. $ctx1.sendIdx["assert:equals:"]=5;
  47490. $12=false._yourself();
  47491. $ctx1.sendIdx["yourself"]=6;
  47492. if($core.assert($12)){
  47493. $11="alternative block2";
  47494. } else {
  47495. $11="alternative block";
  47496. };
  47497. self._assert_equals_($11,"alternative block");
  47498. $ctx1.sendIdx["assert:equals:"]=6;
  47499. $14=true._yourself();
  47500. $ctx1.sendIdx["yourself"]=7;
  47501. if($core.assert($14)){
  47502. $13="alternative block";
  47503. } else {
  47504. $13="alternative block2";
  47505. };
  47506. self._assert_equals_($13,"alternative block");
  47507. $ctx1.sendIdx["assert:equals:"]=7;
  47508. $16=true._yourself();
  47509. if($core.assert($16)){
  47510. $15="alternative block2";
  47511. } else {
  47512. $15="alternative block";
  47513. };
  47514. self._assert_equals_($15,"alternative block2");
  47515. return self;
  47516. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  47517. },
  47518. args: [],
  47519. 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'.",
  47520. referencedClasses: [],
  47521. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  47522. }),
  47523. $globals.BooleanTest);
  47524. $core.addMethod(
  47525. $core.method({
  47526. selector: "testLogic",
  47527. protocol: 'tests',
  47528. fn: function (){
  47529. var self=this;
  47530. return $core.withContext(function($ctx1) {
  47531. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$16,$17,$15,$19,$18,$21,$20,$23,$22;
  47532. $1=true.__and(true);
  47533. $ctx1.sendIdx["&"]=1;
  47534. self._assert_($1);
  47535. $ctx1.sendIdx["assert:"]=1;
  47536. $2=true.__and(false);
  47537. $ctx1.sendIdx["&"]=2;
  47538. self._deny_($2);
  47539. $ctx1.sendIdx["deny:"]=1;
  47540. $3=false.__and(true);
  47541. $ctx1.sendIdx["&"]=3;
  47542. self._deny_($3);
  47543. $ctx1.sendIdx["deny:"]=2;
  47544. $5=false.__and(false);
  47545. $ctx1.sendIdx["&"]=4;
  47546. $4=self._deny_($5);
  47547. $ctx1.sendIdx["deny:"]=3;
  47548. $6=true.__or(true);
  47549. $ctx1.sendIdx["|"]=1;
  47550. self._assert_($6);
  47551. $ctx1.sendIdx["assert:"]=2;
  47552. $7=true.__or(false);
  47553. $ctx1.sendIdx["|"]=2;
  47554. self._assert_($7);
  47555. $ctx1.sendIdx["assert:"]=3;
  47556. $8=false.__or(true);
  47557. $ctx1.sendIdx["|"]=3;
  47558. self._assert_($8);
  47559. $ctx1.sendIdx["assert:"]=4;
  47560. $10=false.__or(false);
  47561. $ctx1.sendIdx["|"]=4;
  47562. $9=self._deny_($10);
  47563. $ctx1.sendIdx["deny:"]=4;
  47564. $12=(1).__gt((0));
  47565. $ctx1.sendIdx[">"]=1;
  47566. $11=true.__and($12);
  47567. $ctx1.sendIdx["&"]=5;
  47568. self._assert_($11);
  47569. $ctx1.sendIdx["assert:"]=5;
  47570. $14=(1).__gt((0));
  47571. $ctx1.sendIdx[">"]=2;
  47572. $13=$recv($14).__and(false);
  47573. $ctx1.sendIdx["&"]=6;
  47574. self._deny_($13);
  47575. $ctx1.sendIdx["deny:"]=5;
  47576. $16=(1).__gt((0));
  47577. $ctx1.sendIdx[">"]=3;
  47578. $17=(1).__gt((2));
  47579. $ctx1.sendIdx[">"]=4;
  47580. $15=$recv($16).__and($17);
  47581. self._deny_($15);
  47582. $19=(1).__gt((0));
  47583. $ctx1.sendIdx[">"]=5;
  47584. $18=false.__or($19);
  47585. $ctx1.sendIdx["|"]=5;
  47586. self._assert_($18);
  47587. $ctx1.sendIdx["assert:"]=6;
  47588. $21=(1).__gt((0));
  47589. $ctx1.sendIdx[">"]=6;
  47590. $20=$recv($21).__or(false);
  47591. $ctx1.sendIdx["|"]=6;
  47592. self._assert_($20);
  47593. $ctx1.sendIdx["assert:"]=7;
  47594. $23=(1).__gt((0));
  47595. $ctx1.sendIdx[">"]=7;
  47596. $22=$recv($23).__or((1).__gt((2)));
  47597. self._assert_($22);
  47598. return self;
  47599. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  47600. },
  47601. args: [],
  47602. 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))",
  47603. referencedClasses: [],
  47604. messageSends: ["assert:", "&", "deny:", "|", ">"]
  47605. }),
  47606. $globals.BooleanTest);
  47607. $core.addMethod(
  47608. $core.method({
  47609. selector: "testLogicKeywords",
  47610. protocol: 'tests',
  47611. fn: function (){
  47612. var self=this;
  47613. return $core.withContext(function($ctx1) {
  47614. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$15,$14,$16,$18,$17,$20,$19;
  47615. $1=true._and_((function(){
  47616. return true;
  47617. }));
  47618. $ctx1.sendIdx["and:"]=1;
  47619. self._assert_($1);
  47620. $ctx1.sendIdx["assert:"]=1;
  47621. $2=true._and_((function(){
  47622. return false;
  47623. }));
  47624. $ctx1.sendIdx["and:"]=2;
  47625. self._deny_($2);
  47626. $ctx1.sendIdx["deny:"]=1;
  47627. $3=false._and_((function(){
  47628. return true;
  47629. }));
  47630. $ctx1.sendIdx["and:"]=3;
  47631. self._deny_($3);
  47632. $ctx1.sendIdx["deny:"]=2;
  47633. $5=false._and_((function(){
  47634. return false;
  47635. }));
  47636. $ctx1.sendIdx["and:"]=4;
  47637. $4=self._deny_($5);
  47638. $ctx1.sendIdx["deny:"]=3;
  47639. $6=true._or_((function(){
  47640. return true;
  47641. }));
  47642. $ctx1.sendIdx["or:"]=1;
  47643. self._assert_($6);
  47644. $ctx1.sendIdx["assert:"]=2;
  47645. $7=true._or_((function(){
  47646. return false;
  47647. }));
  47648. $ctx1.sendIdx["or:"]=2;
  47649. self._assert_($7);
  47650. $ctx1.sendIdx["assert:"]=3;
  47651. $8=false._or_((function(){
  47652. return true;
  47653. }));
  47654. $ctx1.sendIdx["or:"]=3;
  47655. self._assert_($8);
  47656. $ctx1.sendIdx["assert:"]=4;
  47657. $10=false._or_((function(){
  47658. return false;
  47659. }));
  47660. $ctx1.sendIdx["or:"]=4;
  47661. $9=self._deny_($10);
  47662. $ctx1.sendIdx["deny:"]=4;
  47663. $11=true._and_((function(){
  47664. return $core.withContext(function($ctx2) {
  47665. return (1).__gt((0));
  47666. $ctx2.sendIdx[">"]=1;
  47667. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  47668. }));
  47669. $ctx1.sendIdx["and:"]=5;
  47670. self._assert_($11);
  47671. $ctx1.sendIdx["assert:"]=5;
  47672. $13=(1).__gt((0));
  47673. $ctx1.sendIdx[">"]=2;
  47674. $12=$recv($13)._and_((function(){
  47675. return false;
  47676. }));
  47677. $ctx1.sendIdx["and:"]=6;
  47678. self._deny_($12);
  47679. $ctx1.sendIdx["deny:"]=5;
  47680. $15=(1).__gt((0));
  47681. $ctx1.sendIdx[">"]=3;
  47682. $14=$recv($15)._and_((function(){
  47683. return $core.withContext(function($ctx2) {
  47684. return (1).__gt((2));
  47685. $ctx2.sendIdx[">"]=4;
  47686. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  47687. }));
  47688. self._deny_($14);
  47689. $16=false._or_((function(){
  47690. return $core.withContext(function($ctx2) {
  47691. return (1).__gt((0));
  47692. $ctx2.sendIdx[">"]=5;
  47693. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  47694. }));
  47695. $ctx1.sendIdx["or:"]=5;
  47696. self._assert_($16);
  47697. $ctx1.sendIdx["assert:"]=6;
  47698. $18=(1).__gt((0));
  47699. $ctx1.sendIdx[">"]=6;
  47700. $17=$recv($18)._or_((function(){
  47701. return false;
  47702. }));
  47703. $ctx1.sendIdx["or:"]=6;
  47704. self._assert_($17);
  47705. $ctx1.sendIdx["assert:"]=7;
  47706. $20=(1).__gt((0));
  47707. $ctx1.sendIdx[">"]=7;
  47708. $19=$recv($20)._or_((function(){
  47709. return $core.withContext(function($ctx2) {
  47710. return (1).__gt((2));
  47711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  47712. }));
  47713. self._assert_($19);
  47714. return self;
  47715. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  47716. },
  47717. args: [],
  47718. 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 ])",
  47719. referencedClasses: [],
  47720. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  47721. }),
  47722. $globals.BooleanTest);
  47723. $core.addMethod(
  47724. $core.method({
  47725. selector: "testNonBooleanError",
  47726. protocol: 'tests',
  47727. fn: function (){
  47728. var self=this;
  47729. function $NonBooleanReceiver(){return $globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  47730. return $core.withContext(function($ctx1) {
  47731. self._should_raise_((function(){
  47732. return $core.withContext(function($ctx2) {
  47733. if($core.assert("")){
  47734. } else {
  47735. };
  47736. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47737. }),$NonBooleanReceiver());
  47738. return self;
  47739. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  47740. },
  47741. args: [],
  47742. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  47743. referencedClasses: ["NonBooleanReceiver"],
  47744. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  47745. }),
  47746. $globals.BooleanTest);
  47747. $core.addClass('ClassBuilderTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  47748. $core.addMethod(
  47749. $core.method({
  47750. selector: "setUp",
  47751. protocol: 'running',
  47752. fn: function (){
  47753. var self=this;
  47754. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  47755. return $core.withContext(function($ctx1) {
  47756. self["@builder"]=$recv($ClassBuilder())._new();
  47757. return self;
  47758. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  47759. },
  47760. args: [],
  47761. source: "setUp\x0a\x09builder := ClassBuilder new",
  47762. referencedClasses: ["ClassBuilder"],
  47763. messageSends: ["new"]
  47764. }),
  47765. $globals.ClassBuilderTest);
  47766. $core.addMethod(
  47767. $core.method({
  47768. selector: "tearDown",
  47769. protocol: 'running',
  47770. fn: function (){
  47771. var self=this;
  47772. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47773. return $core.withContext(function($ctx1) {
  47774. var $1,$receiver;
  47775. $1=self["@theClass"];
  47776. if(($receiver = $1) == null || $receiver.isNil){
  47777. $1;
  47778. } else {
  47779. $recv($Smalltalk())._removeClass_(self["@theClass"]);
  47780. self["@theClass"]=nil;
  47781. self["@theClass"];
  47782. };
  47783. return self;
  47784. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  47785. },
  47786. args: [],
  47787. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  47788. referencedClasses: ["Smalltalk"],
  47789. messageSends: ["ifNotNil:", "removeClass:"]
  47790. }),
  47791. $globals.ClassBuilderTest);
  47792. $core.addMethod(
  47793. $core.method({
  47794. selector: "testClassCopy",
  47795. protocol: 'tests',
  47796. fn: function (){
  47797. var self=this;
  47798. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  47799. return $core.withContext(function($ctx1) {
  47800. var $2,$1,$4,$3,$6,$5,$8,$7;
  47801. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  47802. $2=$recv(self["@theClass"])._superclass();
  47803. $ctx1.sendIdx["superclass"]=1;
  47804. $1=$recv($2).__eq_eq($recv($ObjectMock())._superclass());
  47805. $ctx1.sendIdx["=="]=1;
  47806. self._assert_($1);
  47807. $ctx1.sendIdx["assert:"]=1;
  47808. $4=$recv(self["@theClass"])._instanceVariableNames();
  47809. $ctx1.sendIdx["instanceVariableNames"]=1;
  47810. $3=$recv($4).__eq_eq($recv($ObjectMock())._instanceVariableNames());
  47811. $ctx1.sendIdx["=="]=2;
  47812. self._assert_($3);
  47813. $ctx1.sendIdx["assert:"]=2;
  47814. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  47815. $ctx1.sendIdx["assert:equals:"]=1;
  47816. $6=$recv(self["@theClass"])._package();
  47817. $ctx1.sendIdx["package"]=1;
  47818. $5=$recv($6).__eq_eq($recv($ObjectMock())._package());
  47819. self._assert_($5);
  47820. $8=$recv(self["@theClass"])._methodDictionary();
  47821. $ctx1.sendIdx["methodDictionary"]=1;
  47822. $7=$recv($8)._keys();
  47823. $ctx1.sendIdx["keys"]=1;
  47824. self._assert_equals_($7,$recv($recv($ObjectMock())._methodDictionary())._keys());
  47825. return self;
  47826. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  47827. },
  47828. args: [],
  47829. 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",
  47830. referencedClasses: ["ObjectMock"],
  47831. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"]
  47832. }),
  47833. $globals.ClassBuilderTest);
  47834. $core.addMethod(
  47835. $core.method({
  47836. selector: "testClassMigration",
  47837. protocol: 'tests',
  47838. fn: function (){
  47839. var self=this;
  47840. var instance,oldClass;
  47841. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  47842. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47843. function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  47844. return $core.withContext(function($ctx1) {
  47845. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  47846. oldClass=$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  47847. $2=$recv($Smalltalk())._globals();
  47848. $ctx1.sendIdx["globals"]=1;
  47849. $1=$recv($2)._at_("ObjectMock2");
  47850. $ctx1.sendIdx["at:"]=1;
  47851. instance=$recv($1)._new();
  47852. $4=$recv($Smalltalk())._globals();
  47853. $ctx1.sendIdx["globals"]=2;
  47854. $3=$recv($4)._at_("ObjectMock2");
  47855. $ctx1.sendIdx["at:"]=2;
  47856. $recv($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  47857. $5=$recv(oldClass).__eq_eq($ObjectMock2());
  47858. $ctx1.sendIdx["=="]=1;
  47859. self._deny_($5);
  47860. $ctx1.sendIdx["deny:"]=1;
  47861. $6=$recv($recv($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  47862. $ctx1.sendIdx["=="]=2;
  47863. self._assert_($6);
  47864. $ctx1.sendIdx["assert:"]=1;
  47865. self._assert_($recv($recv($ObjectMock2())._instanceVariableNames())._isEmpty());
  47866. $ctx1.sendIdx["assert:"]=2;
  47867. $7=$recv($ObjectMock2())._selectors();
  47868. $ctx1.sendIdx["selectors"]=1;
  47869. self._assert_equals_($7,$recv(oldClass)._selectors());
  47870. $ctx1.sendIdx["assert:equals:"]=1;
  47871. $8=$recv($ObjectMock2())._comment();
  47872. $ctx1.sendIdx["comment"]=1;
  47873. self._assert_equals_($8,$recv(oldClass)._comment());
  47874. $ctx1.sendIdx["assert:equals:"]=2;
  47875. $9=$recv($recv($ObjectMock2())._package())._name();
  47876. $ctx1.sendIdx["name"]=1;
  47877. self._assert_equals_($9,"Kernel-Tests");
  47878. $11=$recv(instance)._class();
  47879. $ctx1.sendIdx["class"]=1;
  47880. $10=$recv($11).__eq_eq($ObjectMock2());
  47881. self._deny_($10);
  47882. self._assert_($recv($recv($recv($Smalltalk())._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  47883. $recv($Smalltalk())._removeClass_($ObjectMock2());
  47884. return self;
  47885. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  47886. },
  47887. args: [],
  47888. 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",
  47889. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  47890. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"]
  47891. }),
  47892. $globals.ClassBuilderTest);
  47893. $core.addMethod(
  47894. $core.method({
  47895. selector: "testClassMigrationWithClassInstanceVariables",
  47896. protocol: 'tests',
  47897. fn: function (){
  47898. var self=this;
  47899. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  47900. function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  47901. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47902. return $core.withContext(function($ctx1) {
  47903. var $1;
  47904. $recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  47905. $1=$recv($ObjectMock2())._class();
  47906. $ctx1.sendIdx["class"]=1;
  47907. $recv($1)._instanceVariableNames_("foo bar");
  47908. $recv($ObjectMock())._subclass_instanceVariableNames_package_($recv($recv($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  47909. self._assert_equals_($recv($recv($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  47910. $recv($Smalltalk())._removeClass_($ObjectMock2());
  47911. return self;
  47912. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  47913. },
  47914. args: [],
  47915. 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",
  47916. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  47917. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  47918. }),
  47919. $globals.ClassBuilderTest);
  47920. $core.addMethod(
  47921. $core.method({
  47922. selector: "testClassMigrationWithSubclasses",
  47923. protocol: 'tests',
  47924. fn: function (){
  47925. var self=this;
  47926. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  47927. function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  47928. function $ObjectMock3(){return $globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  47929. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47930. function $ObjectMock4(){return $globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  47931. return $core.withContext(function($ctx1) {
  47932. var $2,$1,$4,$3;
  47933. $recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  47934. $recv($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  47935. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  47936. $recv($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  47937. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  47938. $recv($ObjectMock())._subclass_instanceVariableNames_package_($recv($recv($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  47939. $2=$recv($ObjectMock())._subclasses();
  47940. $ctx1.sendIdx["subclasses"]=1;
  47941. $1=$recv($2)._includes_($ObjectMock2());
  47942. $ctx1.sendIdx["includes:"]=1;
  47943. self._assert_($1);
  47944. $ctx1.sendIdx["assert:"]=1;
  47945. $4=$recv($ObjectMock2())._subclasses();
  47946. $ctx1.sendIdx["subclasses"]=2;
  47947. $3=$recv($4)._includes_($ObjectMock3());
  47948. $ctx1.sendIdx["includes:"]=2;
  47949. self._assert_($3);
  47950. $ctx1.sendIdx["assert:"]=2;
  47951. self._assert_($recv($recv($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  47952. $recv($recv($ObjectMock())._allSubclasses())._do_((function(each){
  47953. return $core.withContext(function($ctx2) {
  47954. return $recv($Smalltalk())._removeClass_(each);
  47955. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47956. }));
  47957. return self;
  47958. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  47959. },
  47960. args: [],
  47961. 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 ]",
  47962. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  47963. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"]
  47964. }),
  47965. $globals.ClassBuilderTest);
  47966. $core.addMethod(
  47967. $core.method({
  47968. selector: "testInstanceVariableNames",
  47969. protocol: 'tests',
  47970. fn: function (){
  47971. var self=this;
  47972. return $core.withContext(function($ctx1) {
  47973. self._assert_equals_($recv(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  47974. return self;
  47975. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  47976. },
  47977. args: [],
  47978. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  47979. referencedClasses: [],
  47980. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  47981. }),
  47982. $globals.ClassBuilderTest);
  47983. $core.addClass('ClassTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  47984. $core.addMethod(
  47985. $core.method({
  47986. selector: "jsConstructor",
  47987. protocol: 'running',
  47988. fn: function (){
  47989. var self=this;
  47990. return $core.withContext(function($ctx1) {
  47991. function Foo(){}
  47992. Foo.prototype.valueOf = function () {return 4;};
  47993. return Foo;
  47994. ;
  47995. return self;
  47996. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  47997. },
  47998. args: [],
  47999. source: "jsConstructor\x0a\x09<\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09>",
  48000. referencedClasses: [],
  48001. messageSends: []
  48002. }),
  48003. $globals.ClassTest);
  48004. $core.addMethod(
  48005. $core.method({
  48006. selector: "setUp",
  48007. protocol: 'running',
  48008. fn: function (){
  48009. var self=this;
  48010. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  48011. return $core.withContext(function($ctx1) {
  48012. self["@builder"]=$recv($ClassBuilder())._new();
  48013. return self;
  48014. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  48015. },
  48016. args: [],
  48017. source: "setUp\x0a\x09builder := ClassBuilder new",
  48018. referencedClasses: ["ClassBuilder"],
  48019. messageSends: ["new"]
  48020. }),
  48021. $globals.ClassTest);
  48022. $core.addMethod(
  48023. $core.method({
  48024. selector: "tearDown",
  48025. protocol: 'running',
  48026. fn: function (){
  48027. var self=this;
  48028. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  48029. return $core.withContext(function($ctx1) {
  48030. var $1,$receiver;
  48031. $1=self["@theClass"];
  48032. if(($receiver = $1) == null || $receiver.isNil){
  48033. $1;
  48034. } else {
  48035. $recv($Smalltalk())._removeClass_(self["@theClass"]);
  48036. self["@theClass"]=nil;
  48037. self["@theClass"];
  48038. };
  48039. return self;
  48040. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  48041. },
  48042. args: [],
  48043. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  48044. referencedClasses: ["Smalltalk"],
  48045. messageSends: ["ifNotNil:", "removeClass:"]
  48046. }),
  48047. $globals.ClassTest);
  48048. $core.addMethod(
  48049. $core.method({
  48050. selector: "testSetJavaScriptConstructor",
  48051. protocol: 'tests',
  48052. fn: function (){
  48053. var self=this;
  48054. var instance;
  48055. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  48056. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48057. return $core.withContext(function($ctx1) {
  48058. var $2,$1,$4,$3,$6,$5,$8,$7;
  48059. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  48060. $recv(self["@theClass"])._javascriptConstructor_(self._jsConstructor());
  48061. $2=$recv(self["@theClass"])._superclass();
  48062. $ctx1.sendIdx["superclass"]=1;
  48063. $1=$recv($2).__eq_eq($recv($ObjectMock())._superclass());
  48064. $ctx1.sendIdx["=="]=1;
  48065. self._assert_($1);
  48066. $ctx1.sendIdx["assert:"]=1;
  48067. $4=$recv(self["@theClass"])._instanceVariableNames();
  48068. $ctx1.sendIdx["instanceVariableNames"]=1;
  48069. $3=$recv($4).__eq_eq($recv($ObjectMock())._instanceVariableNames());
  48070. $ctx1.sendIdx["=="]=2;
  48071. self._assert_($3);
  48072. $ctx1.sendIdx["assert:"]=2;
  48073. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  48074. $ctx1.sendIdx["assert:equals:"]=1;
  48075. $6=$recv(self["@theClass"])._package();
  48076. $ctx1.sendIdx["package"]=1;
  48077. $5=$recv($6).__eq_eq($recv($ObjectMock())._package());
  48078. $ctx1.sendIdx["=="]=3;
  48079. self._assert_($5);
  48080. $ctx1.sendIdx["assert:"]=3;
  48081. $8=$recv(self["@theClass"])._methodDictionary();
  48082. $ctx1.sendIdx["methodDictionary"]=1;
  48083. $7=$recv($8)._keys();
  48084. $ctx1.sendIdx["keys"]=1;
  48085. self._assert_equals_($7,$recv($recv($ObjectMock())._methodDictionary())._keys());
  48086. $ctx1.sendIdx["assert:equals:"]=2;
  48087. instance=$recv(self["@theClass"])._new();
  48088. self._assert_($recv($recv(instance)._class()).__eq_eq(self["@theClass"]));
  48089. self._assert_equals_($recv(instance)._value(),(4));
  48090. $ctx1.sendIdx["assert:equals:"]=3;
  48091. self._shouldnt_raise_((function(){
  48092. return $core.withContext(function($ctx2) {
  48093. return $recv(instance)._foo_((9));
  48094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48095. }),$Error());
  48096. self._assert_equals_($recv(instance)._foo(),(9));
  48097. return self;
  48098. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  48099. },
  48100. args: [],
  48101. source: "testSetJavaScriptConstructor\x0a\x09| instance |\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09theClass javascriptConstructor: self jsConstructor.\x0a\x09\x22part took from copy class test\x22\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys.\x0a\x09\x22testing specific to late-wrapped class\x22\x0a\x09instance := theClass new.\x0a\x09self assert: instance class == theClass.\x0a\x09self assert: instance value equals: 4.\x0a\x09self shouldnt: [ instance foo: 9 ] raise: Error.\x0a\x09self assert: instance foo equals: 9",
  48102. referencedClasses: ["ObjectMock", "Error"],
  48103. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  48104. }),
  48105. $globals.ClassTest);
  48106. $core.addClass('CollectionTest', $globals.TestCase, ['sampleBlock'], 'Kernel-Tests');
  48107. $core.addMethod(
  48108. $core.method({
  48109. selector: "assertSameContents:as:",
  48110. protocol: 'convenience',
  48111. fn: function (aCollection,anotherCollection){
  48112. var self=this;
  48113. return $core.withContext(function($ctx1) {
  48114. var $2,$1,$4,$3;
  48115. $2=$recv(aCollection)._size();
  48116. $ctx1.sendIdx["size"]=1;
  48117. $1=$recv($2).__eq($recv(anotherCollection)._size());
  48118. $ctx1.sendIdx["="]=1;
  48119. self._assert_($1);
  48120. $ctx1.sendIdx["assert:"]=1;
  48121. $recv(aCollection)._do_((function(each){
  48122. return $core.withContext(function($ctx2) {
  48123. $4=$recv(aCollection)._occurrencesOf_(each);
  48124. $ctx2.sendIdx["occurrencesOf:"]=1;
  48125. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  48126. return self._assert_($3);
  48127. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48128. }));
  48129. return self;
  48130. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  48131. },
  48132. args: ["aCollection", "anotherCollection"],
  48133. 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)) ]",
  48134. referencedClasses: [],
  48135. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  48136. }),
  48137. $globals.CollectionTest);
  48138. $core.addMethod(
  48139. $core.method({
  48140. selector: "collection",
  48141. protocol: 'fixture',
  48142. fn: function (){
  48143. var self=this;
  48144. return $core.withContext(function($ctx1) {
  48145. self._subclassResponsibility();
  48146. return self;
  48147. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  48148. },
  48149. args: [],
  48150. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  48151. referencedClasses: [],
  48152. messageSends: ["subclassResponsibility"]
  48153. }),
  48154. $globals.CollectionTest);
  48155. $core.addMethod(
  48156. $core.method({
  48157. selector: "collectionClass",
  48158. protocol: 'fixture',
  48159. fn: function (){
  48160. var self=this;
  48161. return $core.withContext(function($ctx1) {
  48162. return $recv(self._class())._collectionClass();
  48163. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  48164. },
  48165. args: [],
  48166. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  48167. referencedClasses: [],
  48168. messageSends: ["collectionClass", "class"]
  48169. }),
  48170. $globals.CollectionTest);
  48171. $core.addMethod(
  48172. $core.method({
  48173. selector: "collectionOfPrintStrings",
  48174. protocol: 'fixture',
  48175. fn: function (){
  48176. var self=this;
  48177. return $core.withContext(function($ctx1) {
  48178. self._subclassResponsibility();
  48179. return self;
  48180. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  48181. },
  48182. args: [],
  48183. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  48184. referencedClasses: [],
  48185. messageSends: ["subclassResponsibility"]
  48186. }),
  48187. $globals.CollectionTest);
  48188. $core.addMethod(
  48189. $core.method({
  48190. selector: "collectionSize",
  48191. protocol: 'fixture',
  48192. fn: function (){
  48193. var self=this;
  48194. return $core.withContext(function($ctx1) {
  48195. self._subclassResponsibility();
  48196. return self;
  48197. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  48198. },
  48199. args: [],
  48200. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  48201. referencedClasses: [],
  48202. messageSends: ["subclassResponsibility"]
  48203. }),
  48204. $globals.CollectionTest);
  48205. $core.addMethod(
  48206. $core.method({
  48207. selector: "collectionWithDuplicates",
  48208. protocol: 'fixture',
  48209. fn: function (){
  48210. var self=this;
  48211. return $core.withContext(function($ctx1) {
  48212. self._subclassResponsibility();
  48213. return self;
  48214. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  48215. },
  48216. args: [],
  48217. 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",
  48218. referencedClasses: [],
  48219. messageSends: ["subclassResponsibility"]
  48220. }),
  48221. $globals.CollectionTest);
  48222. $core.addMethod(
  48223. $core.method({
  48224. selector: "collectionWithNewValue",
  48225. protocol: 'fixture',
  48226. fn: function (){
  48227. var self=this;
  48228. return $core.withContext(function($ctx1) {
  48229. self._subclassResponsibility();
  48230. return self;
  48231. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  48232. },
  48233. args: [],
  48234. 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",
  48235. referencedClasses: [],
  48236. messageSends: ["subclassResponsibility"]
  48237. }),
  48238. $globals.CollectionTest);
  48239. $core.addMethod(
  48240. $core.method({
  48241. selector: "initialize",
  48242. protocol: 'initialization',
  48243. fn: function (){
  48244. var self=this;
  48245. return $core.withContext(function($ctx1) {
  48246. (
  48247. $ctx1.supercall = true,
  48248. ($globals.CollectionTest.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  48249. $ctx1.supercall = false;
  48250. self["@sampleBlock"]=(function(){
  48251. });
  48252. return self;
  48253. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.CollectionTest)});
  48254. },
  48255. args: [],
  48256. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  48257. referencedClasses: [],
  48258. messageSends: ["initialize"]
  48259. }),
  48260. $globals.CollectionTest);
  48261. $core.addMethod(
  48262. $core.method({
  48263. selector: "isCollectionReadOnly",
  48264. protocol: 'testing',
  48265. fn: function (){
  48266. var self=this;
  48267. return false;
  48268. },
  48269. args: [],
  48270. source: "isCollectionReadOnly\x0a\x09^ false",
  48271. referencedClasses: [],
  48272. messageSends: []
  48273. }),
  48274. $globals.CollectionTest);
  48275. $core.addMethod(
  48276. $core.method({
  48277. selector: "sampleNewValue",
  48278. protocol: 'fixture',
  48279. fn: function (){
  48280. var self=this;
  48281. return "N";
  48282. },
  48283. args: [],
  48284. 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'",
  48285. referencedClasses: [],
  48286. messageSends: []
  48287. }),
  48288. $globals.CollectionTest);
  48289. $core.addMethod(
  48290. $core.method({
  48291. selector: "sampleNewValueAsCollection",
  48292. protocol: 'fixture',
  48293. fn: function (){
  48294. var self=this;
  48295. return $core.withContext(function($ctx1) {
  48296. return $recv(self._collectionClass())._with_(self._sampleNewValue());
  48297. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  48298. },
  48299. args: [],
  48300. 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",
  48301. referencedClasses: [],
  48302. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  48303. }),
  48304. $globals.CollectionTest);
  48305. $core.addMethod(
  48306. $core.method({
  48307. selector: "testAddAll",
  48308. protocol: 'tests',
  48309. fn: function (){
  48310. var self=this;
  48311. return $core.withContext(function($ctx1) {
  48312. var $2,$4,$3,$5,$1,$6,$9,$8,$10,$11,$7,$12,$15,$14,$17,$16,$18,$13,$20,$21,$22,$19,$23,$25,$24;
  48313. $2=self._collection();
  48314. $ctx1.sendIdx["collection"]=1;
  48315. $4=self._collectionClass();
  48316. $ctx1.sendIdx["collectionClass"]=1;
  48317. $3=$recv($4)._new();
  48318. $ctx1.sendIdx["new"]=1;
  48319. $recv($2)._addAll_($3);
  48320. $ctx1.sendIdx["addAll:"]=1;
  48321. $5=$recv($2)._yourself();
  48322. $ctx1.sendIdx["yourself"]=1;
  48323. $1=$5;
  48324. $6=self._collection();
  48325. $ctx1.sendIdx["collection"]=2;
  48326. self._assert_equals_($1,$6);
  48327. $ctx1.sendIdx["assert:equals:"]=1;
  48328. $9=self._collectionClass();
  48329. $ctx1.sendIdx["collectionClass"]=2;
  48330. $8=$recv($9)._new();
  48331. $ctx1.sendIdx["new"]=2;
  48332. $10=self._collection();
  48333. $ctx1.sendIdx["collection"]=3;
  48334. $recv($8)._addAll_($10);
  48335. $ctx1.sendIdx["addAll:"]=2;
  48336. $11=$recv($8)._yourself();
  48337. $ctx1.sendIdx["yourself"]=2;
  48338. $7=$11;
  48339. $12=self._collection();
  48340. $ctx1.sendIdx["collection"]=4;
  48341. self._assert_equals_($7,$12);
  48342. $ctx1.sendIdx["assert:equals:"]=2;
  48343. $15=self._collectionClass();
  48344. $ctx1.sendIdx["collectionClass"]=3;
  48345. $14=$recv($15)._new();
  48346. $ctx1.sendIdx["new"]=3;
  48347. $17=self._collectionClass();
  48348. $ctx1.sendIdx["collectionClass"]=4;
  48349. $16=$recv($17)._new();
  48350. $ctx1.sendIdx["new"]=4;
  48351. $recv($14)._addAll_($16);
  48352. $ctx1.sendIdx["addAll:"]=3;
  48353. $18=$recv($14)._yourself();
  48354. $ctx1.sendIdx["yourself"]=3;
  48355. $13=$18;
  48356. self._assert_equals_($13,$recv(self._collectionClass())._new());
  48357. $ctx1.sendIdx["assert:equals:"]=3;
  48358. $20=self._collection();
  48359. $ctx1.sendIdx["collection"]=5;
  48360. $21=self._sampleNewValueAsCollection();
  48361. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  48362. $recv($20)._addAll_($21);
  48363. $ctx1.sendIdx["addAll:"]=4;
  48364. $22=$recv($20)._yourself();
  48365. $ctx1.sendIdx["yourself"]=4;
  48366. $19=$22;
  48367. $23=self._collectionWithNewValue();
  48368. $ctx1.sendIdx["collectionWithNewValue"]=1;
  48369. self._assert_equals_($19,$23);
  48370. $25=self._sampleNewValueAsCollection();
  48371. $recv($25)._addAll_(self._collection());
  48372. $24=$recv($25)._yourself();
  48373. self._assertSameContents_as_($24,self._collectionWithNewValue());
  48374. return self;
  48375. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  48376. },
  48377. args: [],
  48378. 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",
  48379. referencedClasses: [],
  48380. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  48381. }),
  48382. $globals.CollectionTest);
  48383. $core.addMethod(
  48384. $core.method({
  48385. selector: "testAllSatisfy",
  48386. protocol: 'tests',
  48387. fn: function (){
  48388. var self=this;
  48389. var collection,anyOne;
  48390. return $core.withContext(function($ctx1) {
  48391. var $1;
  48392. collection=self._collection();
  48393. anyOne=$recv(collection)._anyOne();
  48394. $1=$recv(collection)._allSatisfy_((function(each){
  48395. return $core.withContext(function($ctx2) {
  48396. return $recv(collection)._includes_(each);
  48397. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48398. }));
  48399. $ctx1.sendIdx["allSatisfy:"]=1;
  48400. self._assert_($1);
  48401. self._deny_($recv(collection)._allSatisfy_((function(each){
  48402. return $core.withContext(function($ctx2) {
  48403. return $recv(each).__tild_eq(anyOne);
  48404. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  48405. })));
  48406. return self;
  48407. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  48408. },
  48409. args: [],
  48410. 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 ])",
  48411. referencedClasses: [],
  48412. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  48413. }),
  48414. $globals.CollectionTest);
  48415. $core.addMethod(
  48416. $core.method({
  48417. selector: "testAnyOne",
  48418. protocol: 'tests',
  48419. fn: function (){
  48420. var self=this;
  48421. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48422. return $core.withContext(function($ctx1) {
  48423. var $2,$1;
  48424. self._should_raise_((function(){
  48425. return $core.withContext(function($ctx2) {
  48426. return $recv($recv(self._collectionClass())._new())._anyOne();
  48427. $ctx2.sendIdx["anyOne"]=1;
  48428. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48429. }),$Error());
  48430. $2=self._collection();
  48431. $ctx1.sendIdx["collection"]=1;
  48432. $1=$recv($2)._includes_($recv(self._collection())._anyOne());
  48433. self._assert_($1);
  48434. return self;
  48435. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  48436. },
  48437. args: [],
  48438. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  48439. referencedClasses: ["Error"],
  48440. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  48441. }),
  48442. $globals.CollectionTest);
  48443. $core.addMethod(
  48444. $core.method({
  48445. selector: "testAnySatisfy",
  48446. protocol: 'tests',
  48447. fn: function (){
  48448. var self=this;
  48449. var anyOne;
  48450. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  48451. return $core.withContext(function($ctx1) {
  48452. var $1,$3,$2;
  48453. $1=self._collection();
  48454. $ctx1.sendIdx["collection"]=1;
  48455. anyOne=$recv($1)._anyOne();
  48456. $3=self._collection();
  48457. $ctx1.sendIdx["collection"]=2;
  48458. $2=$recv($3)._anySatisfy_((function(each){
  48459. return $core.withContext(function($ctx2) {
  48460. return $recv(each).__eq(anyOne);
  48461. $ctx2.sendIdx["="]=1;
  48462. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48463. }));
  48464. $ctx1.sendIdx["anySatisfy:"]=1;
  48465. self._assert_($2);
  48466. self._deny_($recv(self._collection())._anySatisfy_((function(each){
  48467. return $core.withContext(function($ctx2) {
  48468. return $recv(each).__eq($recv($Object())._new());
  48469. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  48470. })));
  48471. return self;
  48472. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  48473. },
  48474. args: [],
  48475. 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 ])",
  48476. referencedClasses: ["Object"],
  48477. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  48478. }),
  48479. $globals.CollectionTest);
  48480. $core.addMethod(
  48481. $core.method({
  48482. selector: "testAsArray",
  48483. protocol: 'tests',
  48484. fn: function (){
  48485. var self=this;
  48486. return $core.withContext(function($ctx1) {
  48487. var $1;
  48488. $1=self._collection();
  48489. $ctx1.sendIdx["collection"]=1;
  48490. self._assertSameContents_as_($1,$recv(self._collection())._asArray());
  48491. return self;
  48492. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  48493. },
  48494. args: [],
  48495. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  48496. referencedClasses: [],
  48497. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  48498. }),
  48499. $globals.CollectionTest);
  48500. $core.addMethod(
  48501. $core.method({
  48502. selector: "testAsOrderedCollection",
  48503. protocol: 'tests',
  48504. fn: function (){
  48505. var self=this;
  48506. return $core.withContext(function($ctx1) {
  48507. var $1;
  48508. $1=self._collection();
  48509. $ctx1.sendIdx["collection"]=1;
  48510. self._assertSameContents_as_($1,$recv(self._collection())._asOrderedCollection());
  48511. return self;
  48512. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  48513. },
  48514. args: [],
  48515. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  48516. referencedClasses: [],
  48517. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  48518. }),
  48519. $globals.CollectionTest);
  48520. $core.addMethod(
  48521. $core.method({
  48522. selector: "testAsSet",
  48523. protocol: 'tests',
  48524. fn: function (){
  48525. var self=this;
  48526. var c,set;
  48527. return $core.withContext(function($ctx1) {
  48528. c=self._collectionWithDuplicates();
  48529. set=$recv(c)._asSet();
  48530. self._assert_equals_($recv(set)._size(),(6));
  48531. $recv(c)._do_((function(each){
  48532. return $core.withContext(function($ctx2) {
  48533. return self._assert_($recv(set)._includes_(each));
  48534. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48535. }));
  48536. return self;
  48537. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  48538. },
  48539. args: [],
  48540. source: "testAsSet\x0a\x09| c set |\x0a\x09c := self collectionWithDuplicates.\x0a\x09set := c asSet.\x0a\x09self assert: set size equals: 6.\x0a\x09c do: [ :each |\x0a\x09\x09self assert: (set includes: each) ]",
  48541. referencedClasses: [],
  48542. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  48543. }),
  48544. $globals.CollectionTest);
  48545. $core.addMethod(
  48546. $core.method({
  48547. selector: "testCollect",
  48548. protocol: 'tests',
  48549. fn: function (){
  48550. var self=this;
  48551. return $core.withContext(function($ctx1) {
  48552. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  48553. $2=self._collection();
  48554. $ctx1.sendIdx["collection"]=1;
  48555. $1=$recv($2)._collect_((function(each){
  48556. return each;
  48557. }));
  48558. $ctx1.sendIdx["collect:"]=1;
  48559. $3=self._collection();
  48560. $ctx1.sendIdx["collection"]=2;
  48561. self._assert_equals_($1,$3);
  48562. $ctx1.sendIdx["assert:equals:"]=1;
  48563. $5=self._collectionWithNewValue();
  48564. $ctx1.sendIdx["collectionWithNewValue"]=1;
  48565. $4=$recv($5)._collect_((function(each){
  48566. return each;
  48567. }));
  48568. $ctx1.sendIdx["collect:"]=2;
  48569. self._assert_equals_($4,self._collectionWithNewValue());
  48570. $ctx1.sendIdx["assert:equals:"]=2;
  48571. $8=self._collectionClass();
  48572. $ctx1.sendIdx["collectionClass"]=1;
  48573. $7=$recv($8)._new();
  48574. $ctx1.sendIdx["new"]=1;
  48575. $6=$recv($7)._collect_((function(each){
  48576. return $core.withContext(function($ctx2) {
  48577. return $recv(each)._printString();
  48578. $ctx2.sendIdx["printString"]=1;
  48579. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  48580. }));
  48581. $ctx1.sendIdx["collect:"]=3;
  48582. self._assert_equals_($6,$recv(self._collectionClass())._new());
  48583. $ctx1.sendIdx["assert:equals:"]=3;
  48584. $11=self._collection();
  48585. $ctx1.sendIdx["collection"]=3;
  48586. $10=$recv($11)._collect_((function(){
  48587. return $core.withContext(function($ctx2) {
  48588. return self._sampleNewValue();
  48589. $ctx2.sendIdx["sampleNewValue"]=1;
  48590. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  48591. }));
  48592. $ctx1.sendIdx["collect:"]=4;
  48593. $9=$recv($10)._detect_((function(){
  48594. return true;
  48595. }));
  48596. self._assert_equals_($9,self._sampleNewValue());
  48597. $ctx1.sendIdx["assert:equals:"]=4;
  48598. self._assert_equals_($recv(self._collection())._collect_((function(each){
  48599. return $core.withContext(function($ctx2) {
  48600. return $recv(each)._printString();
  48601. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  48602. })),self._collectionOfPrintStrings());
  48603. return self;
  48604. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  48605. },
  48606. args: [],
  48607. 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",
  48608. referencedClasses: [],
  48609. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  48610. }),
  48611. $globals.CollectionTest);
  48612. $core.addMethod(
  48613. $core.method({
  48614. selector: "testComma",
  48615. protocol: 'tests',
  48616. fn: function (){
  48617. var self=this;
  48618. return $core.withContext(function($ctx1) {
  48619. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  48620. $2=self._collection();
  48621. $ctx1.sendIdx["collection"]=1;
  48622. $4=self._collectionClass();
  48623. $ctx1.sendIdx["collectionClass"]=1;
  48624. $3=$recv($4)._new();
  48625. $ctx1.sendIdx["new"]=1;
  48626. $1=$recv($2).__comma($3);
  48627. $ctx1.sendIdx[","]=1;
  48628. $5=self._collection();
  48629. $ctx1.sendIdx["collection"]=2;
  48630. self._assert_equals_($1,$5);
  48631. $ctx1.sendIdx["assert:equals:"]=1;
  48632. $8=self._collectionClass();
  48633. $ctx1.sendIdx["collectionClass"]=2;
  48634. $7=$recv($8)._new();
  48635. $ctx1.sendIdx["new"]=2;
  48636. $9=self._collection();
  48637. $ctx1.sendIdx["collection"]=3;
  48638. $6=$recv($7).__comma($9);
  48639. $ctx1.sendIdx[","]=2;
  48640. $10=self._collection();
  48641. $ctx1.sendIdx["collection"]=4;
  48642. self._assert_equals_($6,$10);
  48643. $ctx1.sendIdx["assert:equals:"]=2;
  48644. $13=self._collectionClass();
  48645. $ctx1.sendIdx["collectionClass"]=3;
  48646. $12=$recv($13)._new();
  48647. $ctx1.sendIdx["new"]=3;
  48648. $15=self._collectionClass();
  48649. $ctx1.sendIdx["collectionClass"]=4;
  48650. $14=$recv($15)._new();
  48651. $ctx1.sendIdx["new"]=4;
  48652. $11=$recv($12).__comma($14);
  48653. $ctx1.sendIdx[","]=3;
  48654. self._assert_equals_($11,$recv(self._collectionClass())._new());
  48655. $ctx1.sendIdx["assert:equals:"]=3;
  48656. $17=self._collection();
  48657. $ctx1.sendIdx["collection"]=5;
  48658. $18=self._sampleNewValueAsCollection();
  48659. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  48660. $16=$recv($17).__comma($18);
  48661. $ctx1.sendIdx[","]=4;
  48662. $19=self._collectionWithNewValue();
  48663. $ctx1.sendIdx["collectionWithNewValue"]=1;
  48664. self._assert_equals_($16,$19);
  48665. self._assertSameContents_as_($recv(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  48666. return self;
  48667. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  48668. },
  48669. args: [],
  48670. 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",
  48671. referencedClasses: [],
  48672. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  48673. }),
  48674. $globals.CollectionTest);
  48675. $core.addMethod(
  48676. $core.method({
  48677. selector: "testCopy",
  48678. protocol: 'tests',
  48679. fn: function (){
  48680. var self=this;
  48681. return $core.withContext(function($ctx1) {
  48682. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  48683. $3=self._collectionClass();
  48684. $ctx1.sendIdx["collectionClass"]=1;
  48685. $2=$recv($3)._new();
  48686. $ctx1.sendIdx["new"]=1;
  48687. $1=$recv($2)._copy();
  48688. $ctx1.sendIdx["copy"]=1;
  48689. $5=self._collectionClass();
  48690. $ctx1.sendIdx["collectionClass"]=2;
  48691. $4=$recv($5)._new();
  48692. $ctx1.sendIdx["new"]=2;
  48693. self._assert_equals_($1,$4);
  48694. $ctx1.sendIdx["assert:equals:"]=1;
  48695. $7=self._collection();
  48696. $ctx1.sendIdx["collection"]=1;
  48697. $6=$recv($7)._copy();
  48698. $ctx1.sendIdx["copy"]=2;
  48699. $8=self._collection();
  48700. $ctx1.sendIdx["collection"]=2;
  48701. self._assert_equals_($6,$8);
  48702. $ctx1.sendIdx["assert:equals:"]=2;
  48703. $10=self._collectionWithNewValue();
  48704. $ctx1.sendIdx["collectionWithNewValue"]=1;
  48705. $9=$recv($10)._copy();
  48706. $ctx1.sendIdx["copy"]=3;
  48707. $11=self._collectionWithNewValue();
  48708. $ctx1.sendIdx["collectionWithNewValue"]=2;
  48709. self._assert_equals_($9,$11);
  48710. $15=self._collectionClass();
  48711. $ctx1.sendIdx["collectionClass"]=3;
  48712. $14=$recv($15)._new();
  48713. $ctx1.sendIdx["new"]=3;
  48714. $13=$recv($14)._copy();
  48715. $ctx1.sendIdx["copy"]=4;
  48716. $16=self._collection();
  48717. $ctx1.sendIdx["collection"]=3;
  48718. $12=$recv($13).__eq($16);
  48719. $ctx1.sendIdx["="]=1;
  48720. self._deny_($12);
  48721. $ctx1.sendIdx["deny:"]=1;
  48722. $19=self._collection();
  48723. $ctx1.sendIdx["collection"]=4;
  48724. $18=$recv($19)._copy();
  48725. $ctx1.sendIdx["copy"]=5;
  48726. $17=$recv($18).__eq($recv(self._collectionClass())._new());
  48727. $ctx1.sendIdx["="]=2;
  48728. self._deny_($17);
  48729. $ctx1.sendIdx["deny:"]=2;
  48730. self._deny_($recv($recv(self._collection())._copy()).__eq(self._collectionWithNewValue()));
  48731. return self;
  48732. }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
  48733. },
  48734. args: [],
  48735. source: "testCopy\x0a\x09self assert: self collectionClass new copy equals: self collectionClass new.\x0a\x09self assert: self collection copy equals: self collection.\x0a\x09self assert: self collectionWithNewValue copy equals: self collectionWithNewValue.\x0a\x09\x0a\x09self deny: self collectionClass new copy = self collection.\x0a\x09self deny: self collection copy = self collectionClass new.\x0a\x09self deny: self collection copy = self collectionWithNewValue",
  48736. referencedClasses: [],
  48737. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  48738. }),
  48739. $globals.CollectionTest);
  48740. $core.addMethod(
  48741. $core.method({
  48742. selector: "testCopySeparates",
  48743. protocol: 'tests',
  48744. fn: function (){
  48745. var self=this;
  48746. var original,copy;
  48747. return $core.withContext(function($ctx1) {
  48748. original=self._collection();
  48749. $ctx1.sendIdx["collection"]=1;
  48750. copy=$recv(original)._copy();
  48751. $recv(copy)._addAll_(self._sampleNewValueAsCollection());
  48752. self._assert_($recv(original).__eq(self._collection()));
  48753. return self;
  48754. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
  48755. },
  48756. args: [],
  48757. source: "testCopySeparates\x0a\x09| original copy |\x0a\x09original := self collection.\x0a\x09copy := original copy.\x0a\x09copy addAll: self sampleNewValueAsCollection.\x0a\x09self assert: original = self collection",
  48758. referencedClasses: [],
  48759. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  48760. }),
  48761. $globals.CollectionTest);
  48762. $core.addMethod(
  48763. $core.method({
  48764. selector: "testDetect",
  48765. protocol: 'tests',
  48766. fn: function (){
  48767. var self=this;
  48768. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48769. return $core.withContext(function($ctx1) {
  48770. var $1,$2,$3,$4,$6,$5,$7;
  48771. self._shouldnt_raise_((function(){
  48772. return $core.withContext(function($ctx2) {
  48773. $1=self._collection();
  48774. $ctx2.sendIdx["collection"]=1;
  48775. return $recv($1)._detect_((function(){
  48776. return true;
  48777. }));
  48778. $ctx2.sendIdx["detect:"]=1;
  48779. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48780. }),$Error());
  48781. self._should_raise_((function(){
  48782. return $core.withContext(function($ctx2) {
  48783. $2=self._collection();
  48784. $ctx2.sendIdx["collection"]=2;
  48785. return $recv($2)._detect_((function(){
  48786. return false;
  48787. }));
  48788. $ctx2.sendIdx["detect:"]=2;
  48789. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48790. }),$Error());
  48791. $ctx1.sendIdx["should:raise:"]=1;
  48792. $3=$recv(self._sampleNewValueAsCollection())._detect_((function(){
  48793. return true;
  48794. }));
  48795. $ctx1.sendIdx["detect:"]=3;
  48796. $4=self._sampleNewValue();
  48797. $ctx1.sendIdx["sampleNewValue"]=1;
  48798. self._assert_equals_($3,$4);
  48799. $ctx1.sendIdx["assert:equals:"]=1;
  48800. $5=$recv(self._collectionWithNewValue())._detect_((function(each){
  48801. return $core.withContext(function($ctx2) {
  48802. $6=self._sampleNewValue();
  48803. $ctx2.sendIdx["sampleNewValue"]=2;
  48804. return $recv(each).__eq($6);
  48805. $ctx2.sendIdx["="]=1;
  48806. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  48807. }));
  48808. $ctx1.sendIdx["detect:"]=4;
  48809. $7=self._sampleNewValue();
  48810. $ctx1.sendIdx["sampleNewValue"]=3;
  48811. self._assert_equals_($5,$7);
  48812. self._should_raise_((function(){
  48813. return $core.withContext(function($ctx2) {
  48814. return $recv(self._collection())._detect_((function(each){
  48815. return $core.withContext(function($ctx3) {
  48816. return $recv(each).__eq(self._sampleNewValue());
  48817. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  48818. }));
  48819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  48820. }),$Error());
  48821. return self;
  48822. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  48823. },
  48824. args: [],
  48825. 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",
  48826. referencedClasses: ["Error"],
  48827. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  48828. }),
  48829. $globals.CollectionTest);
  48830. $core.addMethod(
  48831. $core.method({
  48832. selector: "testDetectIfNone",
  48833. protocol: 'tests',
  48834. fn: function (){
  48835. var self=this;
  48836. var sentinel;
  48837. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  48838. return $core.withContext(function($ctx1) {
  48839. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  48840. sentinel=$recv($Object())._new();
  48841. $3=self._collection();
  48842. $ctx1.sendIdx["collection"]=1;
  48843. $2=$recv($3)._detect_ifNone_((function(){
  48844. return true;
  48845. }),(function(){
  48846. return sentinel;
  48847. }));
  48848. $ctx1.sendIdx["detect:ifNone:"]=1;
  48849. $1=$recv($2).__tild_eq(sentinel);
  48850. self._assert_($1);
  48851. $5=self._collection();
  48852. $ctx1.sendIdx["collection"]=2;
  48853. $4=$recv($5)._detect_ifNone_((function(){
  48854. return false;
  48855. }),(function(){
  48856. return sentinel;
  48857. }));
  48858. $ctx1.sendIdx["detect:ifNone:"]=2;
  48859. self._assert_equals_($4,sentinel);
  48860. $ctx1.sendIdx["assert:equals:"]=1;
  48861. $6=$recv(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  48862. return true;
  48863. }),(function(){
  48864. return sentinel;
  48865. }));
  48866. $ctx1.sendIdx["detect:ifNone:"]=3;
  48867. $7=self._sampleNewValue();
  48868. $ctx1.sendIdx["sampleNewValue"]=1;
  48869. self._assert_equals_($6,$7);
  48870. $ctx1.sendIdx["assert:equals:"]=2;
  48871. $8=$recv(self._collectionWithNewValue())._detect_ifNone_((function(each){
  48872. return $core.withContext(function($ctx2) {
  48873. $9=self._sampleNewValue();
  48874. $ctx2.sendIdx["sampleNewValue"]=2;
  48875. return $recv(each).__eq($9);
  48876. $ctx2.sendIdx["="]=1;
  48877. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  48878. }),(function(){
  48879. return sentinel;
  48880. }));
  48881. $ctx1.sendIdx["detect:ifNone:"]=4;
  48882. $10=self._sampleNewValue();
  48883. $ctx1.sendIdx["sampleNewValue"]=3;
  48884. self._assert_equals_($8,$10);
  48885. $ctx1.sendIdx["assert:equals:"]=3;
  48886. self._assert_equals_($recv(self._collection())._detect_ifNone_((function(each){
  48887. return $core.withContext(function($ctx2) {
  48888. return $recv(each).__eq(self._sampleNewValue());
  48889. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  48890. }),(function(){
  48891. return sentinel;
  48892. })),sentinel);
  48893. return self;
  48894. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  48895. },
  48896. args: [],
  48897. 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",
  48898. referencedClasses: ["Object"],
  48899. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  48900. }),
  48901. $globals.CollectionTest);
  48902. $core.addMethod(
  48903. $core.method({
  48904. selector: "testDo",
  48905. protocol: 'tests',
  48906. fn: function (){
  48907. var self=this;
  48908. var newCollection;
  48909. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  48910. return $core.withContext(function($ctx1) {
  48911. var $1,$2;
  48912. newCollection=$recv($OrderedCollection())._new();
  48913. $ctx1.sendIdx["new"]=1;
  48914. $1=self._collection();
  48915. $ctx1.sendIdx["collection"]=1;
  48916. $recv($1)._do_((function(each){
  48917. return $core.withContext(function($ctx2) {
  48918. return $recv(newCollection)._add_(each);
  48919. $ctx2.sendIdx["add:"]=1;
  48920. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48921. }));
  48922. $ctx1.sendIdx["do:"]=1;
  48923. self._assertSameContents_as_(self._collection(),newCollection);
  48924. $ctx1.sendIdx["assertSameContents:as:"]=1;
  48925. newCollection=$recv($OrderedCollection())._new();
  48926. $2=self._collectionWithDuplicates();
  48927. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  48928. $recv($2)._do_((function(each){
  48929. return $core.withContext(function($ctx2) {
  48930. return $recv(newCollection)._add_(each);
  48931. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  48932. }));
  48933. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  48934. return self;
  48935. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  48936. },
  48937. args: [],
  48938. 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",
  48939. referencedClasses: ["OrderedCollection"],
  48940. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  48941. }),
  48942. $globals.CollectionTest);
  48943. $core.addMethod(
  48944. $core.method({
  48945. selector: "testEquality",
  48946. protocol: 'tests',
  48947. fn: function (){
  48948. var self=this;
  48949. return $core.withContext(function($ctx1) {
  48950. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  48951. $2=self._collectionClass();
  48952. $ctx1.sendIdx["collectionClass"]=1;
  48953. $1=$recv($2)._new();
  48954. $ctx1.sendIdx["new"]=1;
  48955. $4=self._collectionClass();
  48956. $ctx1.sendIdx["collectionClass"]=2;
  48957. $3=$recv($4)._new();
  48958. $ctx1.sendIdx["new"]=2;
  48959. self._assert_equals_($1,$3);
  48960. $ctx1.sendIdx["assert:equals:"]=1;
  48961. $5=self._collection();
  48962. $ctx1.sendIdx["collection"]=1;
  48963. $6=self._collection();
  48964. $ctx1.sendIdx["collection"]=2;
  48965. self._assert_equals_($5,$6);
  48966. $ctx1.sendIdx["assert:equals:"]=2;
  48967. $7=self._collectionWithNewValue();
  48968. $ctx1.sendIdx["collectionWithNewValue"]=1;
  48969. $8=self._collectionWithNewValue();
  48970. $ctx1.sendIdx["collectionWithNewValue"]=2;
  48971. self._assert_equals_($7,$8);
  48972. $11=self._collectionClass();
  48973. $ctx1.sendIdx["collectionClass"]=3;
  48974. $10=$recv($11)._new();
  48975. $ctx1.sendIdx["new"]=3;
  48976. $12=self._collection();
  48977. $ctx1.sendIdx["collection"]=3;
  48978. $9=$recv($10).__eq($12);
  48979. $ctx1.sendIdx["="]=1;
  48980. self._deny_($9);
  48981. $ctx1.sendIdx["deny:"]=1;
  48982. $14=self._collection();
  48983. $ctx1.sendIdx["collection"]=4;
  48984. $13=$recv($14).__eq($recv(self._collectionClass())._new());
  48985. $ctx1.sendIdx["="]=2;
  48986. self._deny_($13);
  48987. $ctx1.sendIdx["deny:"]=2;
  48988. self._deny_($recv(self._collection()).__eq(self._collectionWithNewValue()));
  48989. return self;
  48990. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
  48991. },
  48992. args: [],
  48993. source: "testEquality\x0a\x09self assert: self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection equals: self collection.\x0a\x09self assert: self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09\x0a\x09self deny: self collectionClass new = self collection.\x0a\x09self deny: self collection = self collectionClass new.\x0a\x09self deny: self collection = self collectionWithNewValue",
  48994. referencedClasses: [],
  48995. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  48996. }),
  48997. $globals.CollectionTest);
  48998. $core.addMethod(
  48999. $core.method({
  49000. selector: "testIfEmptyFamily",
  49001. protocol: 'tests',
  49002. fn: function (){
  49003. var self=this;
  49004. return $core.withContext(function($ctx1) {
  49005. 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;
  49006. $3=self._collectionClass();
  49007. $ctx1.sendIdx["collectionClass"]=1;
  49008. $2=$recv($3)._new();
  49009. $ctx1.sendIdx["new"]=1;
  49010. $1=$recv($2)._ifEmpty_((function(){
  49011. return (42);
  49012. }));
  49013. $ctx1.sendIdx["ifEmpty:"]=1;
  49014. self._assert_equals_($1,(42));
  49015. $ctx1.sendIdx["assert:equals:"]=1;
  49016. $5=self._collection();
  49017. $ctx1.sendIdx["collection"]=1;
  49018. $4=$recv($5)._ifEmpty_((function(){
  49019. return (42);
  49020. }));
  49021. $6=self._collection();
  49022. $ctx1.sendIdx["collection"]=2;
  49023. self._assert_equals_($4,$6);
  49024. $ctx1.sendIdx["assert:equals:"]=2;
  49025. $9=self._collectionClass();
  49026. $ctx1.sendIdx["collectionClass"]=2;
  49027. $8=$recv($9)._new();
  49028. $ctx1.sendIdx["new"]=2;
  49029. $7=$recv($8)._ifNotEmpty_((function(){
  49030. return (42);
  49031. }));
  49032. $ctx1.sendIdx["ifNotEmpty:"]=1;
  49033. $11=self._collectionClass();
  49034. $ctx1.sendIdx["collectionClass"]=3;
  49035. $10=$recv($11)._new();
  49036. $ctx1.sendIdx["new"]=3;
  49037. self._assert_equals_($7,$10);
  49038. $ctx1.sendIdx["assert:equals:"]=3;
  49039. $13=self._collection();
  49040. $ctx1.sendIdx["collection"]=3;
  49041. $12=$recv($13)._ifNotEmpty_((function(){
  49042. return (42);
  49043. }));
  49044. $ctx1.sendIdx["ifNotEmpty:"]=2;
  49045. self._assert_equals_($12,(42));
  49046. $ctx1.sendIdx["assert:equals:"]=4;
  49047. $15=self._collection();
  49048. $ctx1.sendIdx["collection"]=4;
  49049. $14=$recv($15)._ifNotEmpty_((function(col){
  49050. return col;
  49051. }));
  49052. $16=self._collection();
  49053. $ctx1.sendIdx["collection"]=5;
  49054. self._assert_equals_($14,$16);
  49055. $ctx1.sendIdx["assert:equals:"]=5;
  49056. $19=self._collectionClass();
  49057. $ctx1.sendIdx["collectionClass"]=4;
  49058. $18=$recv($19)._new();
  49059. $ctx1.sendIdx["new"]=4;
  49060. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  49061. return (42);
  49062. }),(function(){
  49063. return (999);
  49064. }));
  49065. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  49066. self._assert_equals_($17,(42));
  49067. $ctx1.sendIdx["assert:equals:"]=6;
  49068. $21=self._collection();
  49069. $ctx1.sendIdx["collection"]=6;
  49070. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  49071. return (42);
  49072. }),(function(){
  49073. return (999);
  49074. }));
  49075. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  49076. self._assert_equals_($20,(999));
  49077. $ctx1.sendIdx["assert:equals:"]=7;
  49078. $23=self._collection();
  49079. $ctx1.sendIdx["collection"]=7;
  49080. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  49081. return (42);
  49082. }),(function(col){
  49083. return col;
  49084. }));
  49085. $24=self._collection();
  49086. $ctx1.sendIdx["collection"]=8;
  49087. self._assert_equals_($22,$24);
  49088. $ctx1.sendIdx["assert:equals:"]=8;
  49089. $25=$recv($recv(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  49090. return (42);
  49091. }),(function(){
  49092. return (999);
  49093. }));
  49094. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  49095. self._assert_equals_($25,(999));
  49096. $ctx1.sendIdx["assert:equals:"]=9;
  49097. $27=self._collection();
  49098. $ctx1.sendIdx["collection"]=9;
  49099. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  49100. return (42);
  49101. }),(function(){
  49102. return (999);
  49103. }));
  49104. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  49105. self._assert_equals_($26,(42));
  49106. $ctx1.sendIdx["assert:equals:"]=10;
  49107. $29=self._collection();
  49108. $ctx1.sendIdx["collection"]=10;
  49109. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  49110. return col;
  49111. }),(function(){
  49112. return (999);
  49113. }));
  49114. self._assert_equals_($28,self._collection());
  49115. return self;
  49116. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  49117. },
  49118. args: [],
  49119. 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.",
  49120. referencedClasses: [],
  49121. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  49122. }),
  49123. $globals.CollectionTest);
  49124. $core.addMethod(
  49125. $core.method({
  49126. selector: "testIsEmpty",
  49127. protocol: 'tests',
  49128. fn: function (){
  49129. var self=this;
  49130. return $core.withContext(function($ctx1) {
  49131. var $1;
  49132. $1=$recv($recv(self._collectionClass())._new())._isEmpty();
  49133. $ctx1.sendIdx["isEmpty"]=1;
  49134. self._assert_($1);
  49135. self._deny_($recv(self._collection())._isEmpty());
  49136. return self;
  49137. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  49138. },
  49139. args: [],
  49140. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  49141. referencedClasses: [],
  49142. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  49143. }),
  49144. $globals.CollectionTest);
  49145. $core.addMethod(
  49146. $core.method({
  49147. selector: "testNoneSatisfy",
  49148. protocol: 'tests',
  49149. fn: function (){
  49150. var self=this;
  49151. var anyOne;
  49152. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  49153. return $core.withContext(function($ctx1) {
  49154. var $1,$3,$2;
  49155. $1=self._collection();
  49156. $ctx1.sendIdx["collection"]=1;
  49157. anyOne=$recv($1)._anyOne();
  49158. $3=self._collection();
  49159. $ctx1.sendIdx["collection"]=2;
  49160. $2=$recv($3)._noneSatisfy_((function(each){
  49161. return $core.withContext(function($ctx2) {
  49162. return $recv(each).__eq(anyOne);
  49163. $ctx2.sendIdx["="]=1;
  49164. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49165. }));
  49166. $ctx1.sendIdx["noneSatisfy:"]=1;
  49167. self._deny_($2);
  49168. self._assert_($recv(self._collection())._noneSatisfy_((function(each){
  49169. return $core.withContext(function($ctx2) {
  49170. return $recv(each).__eq($recv($Object())._new());
  49171. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49172. })));
  49173. return self;
  49174. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  49175. },
  49176. args: [],
  49177. 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 ])",
  49178. referencedClasses: ["Object"],
  49179. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  49180. }),
  49181. $globals.CollectionTest);
  49182. $core.addMethod(
  49183. $core.method({
  49184. selector: "testRemoveAll",
  49185. protocol: 'tests',
  49186. fn: function (){
  49187. var self=this;
  49188. return $core.withContext(function($ctx1) {
  49189. var $2,$1;
  49190. $2=self._collection();
  49191. $recv($2)._removeAll();
  49192. $1=$recv($2)._yourself();
  49193. self._assert_equals_($1,$recv(self._collectionClass())._new());
  49194. return self;
  49195. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  49196. },
  49197. args: [],
  49198. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  49199. referencedClasses: [],
  49200. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  49201. }),
  49202. $globals.CollectionTest);
  49203. $core.addMethod(
  49204. $core.method({
  49205. selector: "testSelect",
  49206. protocol: 'tests',
  49207. fn: function (){
  49208. var self=this;
  49209. return $core.withContext(function($ctx1) {
  49210. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  49211. $2=self._collection();
  49212. $ctx1.sendIdx["collection"]=1;
  49213. $1=$recv($2)._select_((function(){
  49214. return false;
  49215. }));
  49216. $ctx1.sendIdx["select:"]=1;
  49217. $4=self._collectionClass();
  49218. $ctx1.sendIdx["collectionClass"]=1;
  49219. $3=$recv($4)._new();
  49220. $ctx1.sendIdx["new"]=1;
  49221. self._assert_equals_($1,$3);
  49222. $ctx1.sendIdx["assert:equals:"]=1;
  49223. $6=self._collection();
  49224. $ctx1.sendIdx["collection"]=2;
  49225. $5=$recv($6)._select_((function(){
  49226. return true;
  49227. }));
  49228. $ctx1.sendIdx["select:"]=2;
  49229. $7=self._collection();
  49230. $ctx1.sendIdx["collection"]=3;
  49231. self._assert_equals_($5,$7);
  49232. $ctx1.sendIdx["assert:equals:"]=2;
  49233. $9=self._collectionWithNewValue();
  49234. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49235. $8=$recv($9)._select_((function(each){
  49236. return $core.withContext(function($ctx2) {
  49237. $10=self._sampleNewValue();
  49238. $ctx2.sendIdx["sampleNewValue"]=1;
  49239. return $recv(each).__eq($10);
  49240. $ctx2.sendIdx["="]=1;
  49241. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  49242. }));
  49243. $ctx1.sendIdx["select:"]=3;
  49244. self._assert_equals_($8,self._sampleNewValueAsCollection());
  49245. $ctx1.sendIdx["assert:equals:"]=3;
  49246. $12=self._collectionWithNewValue();
  49247. $ctx1.sendIdx["collectionWithNewValue"]=2;
  49248. $11=$recv($12)._select_((function(each){
  49249. return $core.withContext(function($ctx2) {
  49250. $13=self._sampleNewValue();
  49251. $ctx2.sendIdx["sampleNewValue"]=2;
  49252. return $recv(each).__tild_eq($13);
  49253. $ctx2.sendIdx["~="]=1;
  49254. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  49255. }));
  49256. $ctx1.sendIdx["select:"]=4;
  49257. $14=self._collection();
  49258. $ctx1.sendIdx["collection"]=4;
  49259. self._assert_equals_($11,$14);
  49260. $ctx1.sendIdx["assert:equals:"]=4;
  49261. $16=self._collection();
  49262. $ctx1.sendIdx["collection"]=5;
  49263. $15=$recv($16)._select_((function(each){
  49264. return $core.withContext(function($ctx2) {
  49265. $17=self._sampleNewValue();
  49266. $ctx2.sendIdx["sampleNewValue"]=3;
  49267. return $recv(each).__eq($17);
  49268. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  49269. }));
  49270. $ctx1.sendIdx["select:"]=5;
  49271. self._assert_equals_($15,$recv(self._collectionClass())._new());
  49272. $ctx1.sendIdx["assert:equals:"]=5;
  49273. self._assert_equals_($recv(self._collectionWithNewValue())._select_((function(each){
  49274. return $core.withContext(function($ctx2) {
  49275. return $recv(each).__tild_eq(self._sampleNewValue());
  49276. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  49277. })),self._collection());
  49278. return self;
  49279. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  49280. },
  49281. args: [],
  49282. 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",
  49283. referencedClasses: [],
  49284. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  49285. }),
  49286. $globals.CollectionTest);
  49287. $core.addMethod(
  49288. $core.method({
  49289. selector: "testSize",
  49290. protocol: 'tests',
  49291. fn: function (){
  49292. var self=this;
  49293. return $core.withContext(function($ctx1) {
  49294. var $1,$2;
  49295. $1=$recv($recv(self._collectionClass())._new())._size();
  49296. $ctx1.sendIdx["size"]=1;
  49297. self._assert_equals_($1,(0));
  49298. $ctx1.sendIdx["assert:equals:"]=1;
  49299. $2=$recv(self._sampleNewValueAsCollection())._size();
  49300. $ctx1.sendIdx["size"]=2;
  49301. self._assert_equals_($2,(1));
  49302. $ctx1.sendIdx["assert:equals:"]=2;
  49303. self._assert_equals_($recv(self._collection())._size(),self._collectionSize());
  49304. return self;
  49305. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  49306. },
  49307. args: [],
  49308. 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",
  49309. referencedClasses: [],
  49310. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  49311. }),
  49312. $globals.CollectionTest);
  49313. $core.addMethod(
  49314. $core.method({
  49315. selector: "collectionClass",
  49316. protocol: 'fixture',
  49317. fn: function (){
  49318. var self=this;
  49319. return nil;
  49320. },
  49321. args: [],
  49322. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  49323. referencedClasses: [],
  49324. messageSends: []
  49325. }),
  49326. $globals.CollectionTest.klass);
  49327. $core.addMethod(
  49328. $core.method({
  49329. selector: "isAbstract",
  49330. protocol: 'testing',
  49331. fn: function (){
  49332. var self=this;
  49333. return $core.withContext(function($ctx1) {
  49334. return $recv(self._collectionClass())._isNil();
  49335. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.klass)});
  49336. },
  49337. args: [],
  49338. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  49339. referencedClasses: [],
  49340. messageSends: ["isNil", "collectionClass"]
  49341. }),
  49342. $globals.CollectionTest.klass);
  49343. $core.addClass('IndexableCollectionTest', $globals.CollectionTest, [], 'Kernel-Tests');
  49344. $core.addMethod(
  49345. $core.method({
  49346. selector: "collectionWithNewValue",
  49347. protocol: 'fixture',
  49348. fn: function (){
  49349. var self=this;
  49350. return $core.withContext(function($ctx1) {
  49351. self._subclassResponsibility();
  49352. return self;
  49353. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  49354. },
  49355. args: [],
  49356. 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",
  49357. referencedClasses: [],
  49358. messageSends: ["subclassResponsibility"]
  49359. }),
  49360. $globals.IndexableCollectionTest);
  49361. $core.addMethod(
  49362. $core.method({
  49363. selector: "sampleNewIndex",
  49364. protocol: 'fixture',
  49365. fn: function (){
  49366. var self=this;
  49367. return $core.withContext(function($ctx1) {
  49368. self._subclassResponsibility();
  49369. return self;
  49370. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  49371. },
  49372. args: [],
  49373. 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",
  49374. referencedClasses: [],
  49375. messageSends: ["subclassResponsibility"]
  49376. }),
  49377. $globals.IndexableCollectionTest);
  49378. $core.addMethod(
  49379. $core.method({
  49380. selector: "sampleNonIndexesDo:",
  49381. protocol: 'fixture',
  49382. fn: function (aBlock){
  49383. var self=this;
  49384. return $core.withContext(function($ctx1) {
  49385. self._subclassResponsibility();
  49386. return self;
  49387. }, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  49388. },
  49389. args: ["aBlock"],
  49390. 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",
  49391. referencedClasses: [],
  49392. messageSends: ["subclassResponsibility"]
  49393. }),
  49394. $globals.IndexableCollectionTest);
  49395. $core.addMethod(
  49396. $core.method({
  49397. selector: "samplesDo:",
  49398. protocol: 'fixture',
  49399. fn: function (aBlock){
  49400. var self=this;
  49401. return $core.withContext(function($ctx1) {
  49402. self._subclassResponsibility();
  49403. return self;
  49404. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  49405. },
  49406. args: ["aBlock"],
  49407. 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",
  49408. referencedClasses: [],
  49409. messageSends: ["subclassResponsibility"]
  49410. }),
  49411. $globals.IndexableCollectionTest);
  49412. $core.addMethod(
  49413. $core.method({
  49414. selector: "testAt",
  49415. protocol: 'tests',
  49416. fn: function (){
  49417. var self=this;
  49418. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  49419. return $core.withContext(function($ctx1) {
  49420. var $1;
  49421. self._nonIndexesDo_((function(each){
  49422. return $core.withContext(function($ctx2) {
  49423. return self._should_raise_((function(){
  49424. return $core.withContext(function($ctx3) {
  49425. $1=self._collection();
  49426. $ctx3.sendIdx["collection"]=1;
  49427. return $recv($1)._at_(each);
  49428. $ctx3.sendIdx["at:"]=1;
  49429. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49430. }),$Error());
  49431. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49432. }));
  49433. self._samplesDo_((function(index,value){
  49434. return $core.withContext(function($ctx2) {
  49435. return self._assert_equals_($recv(self._collection())._at_(index),value);
  49436. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  49437. }));
  49438. return self;
  49439. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  49440. },
  49441. args: [],
  49442. 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 ]",
  49443. referencedClasses: ["Error"],
  49444. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  49445. }),
  49446. $globals.IndexableCollectionTest);
  49447. $core.addMethod(
  49448. $core.method({
  49449. selector: "testAtIfAbsent",
  49450. protocol: 'tests',
  49451. fn: function (){
  49452. var self=this;
  49453. return $core.withContext(function($ctx1) {
  49454. var $2,$1,$3;
  49455. self._nonIndexesDo_((function(each){
  49456. return $core.withContext(function($ctx2) {
  49457. $2=self._collection();
  49458. $ctx2.sendIdx["collection"]=1;
  49459. $1=$recv($2)._at_ifAbsent_(each,(function(){
  49460. return $core.withContext(function($ctx3) {
  49461. return self._sampleNewValue();
  49462. $ctx3.sendIdx["sampleNewValue"]=1;
  49463. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49464. }));
  49465. $ctx2.sendIdx["at:ifAbsent:"]=1;
  49466. $3=self._sampleNewValue();
  49467. $ctx2.sendIdx["sampleNewValue"]=2;
  49468. return self._assert_equals_($1,$3);
  49469. $ctx2.sendIdx["assert:equals:"]=1;
  49470. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49471. }));
  49472. self._samplesDo_((function(index,value){
  49473. return $core.withContext(function($ctx2) {
  49474. return self._assert_equals_($recv(self._collection())._at_ifAbsent_(index,(function(){
  49475. return $core.withContext(function($ctx3) {
  49476. return self._sampleNewValue();
  49477. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  49478. })),value);
  49479. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  49480. }));
  49481. return self;
  49482. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  49483. },
  49484. args: [],
  49485. 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 ].",
  49486. referencedClasses: [],
  49487. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  49488. }),
  49489. $globals.IndexableCollectionTest);
  49490. $core.addMethod(
  49491. $core.method({
  49492. selector: "testAtIfAbsentPut",
  49493. protocol: 'tests',
  49494. fn: function (){
  49495. var self=this;
  49496. var newCollection;
  49497. return $core.withContext(function($ctx1) {
  49498. var $1;
  49499. newCollection=self._collection();
  49500. $ctx1.sendIdx["collection"]=1;
  49501. self._samplesDo_((function(index,value){
  49502. return $core.withContext(function($ctx2) {
  49503. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  49504. return $core.withContext(function($ctx3) {
  49505. return self._sampleNewValue();
  49506. $ctx3.sendIdx["sampleNewValue"]=1;
  49507. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49508. }));
  49509. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  49510. return self._assert_equals_($1,value);
  49511. $ctx2.sendIdx["assert:equals:"]=1;
  49512. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  49513. }));
  49514. self._assert_equals_(newCollection,self._collection());
  49515. $ctx1.sendIdx["assert:equals:"]=2;
  49516. self._assert_equals_($recv(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  49517. return $core.withContext(function($ctx2) {
  49518. return self._sampleNewValue();
  49519. $ctx2.sendIdx["sampleNewValue"]=2;
  49520. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  49521. })),self._sampleNewValue());
  49522. $ctx1.sendIdx["assert:equals:"]=3;
  49523. self._assert_equals_(newCollection,self._collectionWithNewValue());
  49524. return self;
  49525. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  49526. },
  49527. args: [],
  49528. 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",
  49529. referencedClasses: [],
  49530. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  49531. }),
  49532. $globals.IndexableCollectionTest);
  49533. $core.addMethod(
  49534. $core.method({
  49535. selector: "testAtIfPresent",
  49536. protocol: 'tests',
  49537. fn: function (){
  49538. var self=this;
  49539. var visited,sentinel;
  49540. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  49541. return $core.withContext(function($ctx1) {
  49542. var $2,$1,$4,$3;
  49543. sentinel=$recv($Object())._new();
  49544. self._nonIndexesDo_((function(each){
  49545. return $core.withContext(function($ctx2) {
  49546. visited=nil;
  49547. visited;
  49548. $2=self._collection();
  49549. $ctx2.sendIdx["collection"]=1;
  49550. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  49551. visited=value1;
  49552. visited;
  49553. return sentinel;
  49554. }));
  49555. $ctx2.sendIdx["at:ifPresent:"]=1;
  49556. self._assert_equals_($1,nil);
  49557. $ctx2.sendIdx["assert:equals:"]=1;
  49558. return self._assert_($recv(visited)._isNil());
  49559. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49560. }));
  49561. self._samplesDo_((function(index,value){
  49562. return $core.withContext(function($ctx2) {
  49563. visited=nil;
  49564. visited;
  49565. $4=self._collection();
  49566. $ctx2.sendIdx["collection"]=2;
  49567. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  49568. visited=value2;
  49569. visited;
  49570. return sentinel;
  49571. }));
  49572. self._assert_equals_($3,sentinel);
  49573. $ctx2.sendIdx["assert:equals:"]=2;
  49574. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  49575. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  49576. }));
  49577. return self;
  49578. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  49579. },
  49580. args: [],
  49581. 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) ]",
  49582. referencedClasses: ["Object"],
  49583. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  49584. }),
  49585. $globals.IndexableCollectionTest);
  49586. $core.addMethod(
  49587. $core.method({
  49588. selector: "testAtIfPresentIfAbsent",
  49589. protocol: 'tests',
  49590. fn: function (){
  49591. var self=this;
  49592. var visited,sentinel;
  49593. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  49594. return $core.withContext(function($ctx1) {
  49595. var $2,$1,$3,$5,$4;
  49596. sentinel=$recv($Object())._new();
  49597. self._nonIndexesDo_((function(each){
  49598. return $core.withContext(function($ctx2) {
  49599. visited=nil;
  49600. visited;
  49601. $2=self._collection();
  49602. $ctx2.sendIdx["collection"]=1;
  49603. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  49604. visited=value1;
  49605. visited;
  49606. return sentinel;
  49607. }),(function(){
  49608. return $core.withContext(function($ctx3) {
  49609. return self._sampleNewValue();
  49610. $ctx3.sendIdx["sampleNewValue"]=1;
  49611. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  49612. }));
  49613. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  49614. $3=self._sampleNewValue();
  49615. $ctx2.sendIdx["sampleNewValue"]=2;
  49616. self._assert_equals_($1,$3);
  49617. $ctx2.sendIdx["assert:equals:"]=1;
  49618. return self._assert_($recv(visited)._isNil());
  49619. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49620. }));
  49621. self._samplesDo_((function(index,value){
  49622. return $core.withContext(function($ctx2) {
  49623. visited=nil;
  49624. visited;
  49625. $5=self._collection();
  49626. $ctx2.sendIdx["collection"]=2;
  49627. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  49628. visited=value2;
  49629. visited;
  49630. return sentinel;
  49631. }),(function(){
  49632. return $core.withContext(function($ctx3) {
  49633. return self._sampleNewValue();
  49634. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  49635. }));
  49636. self._assert_equals_($4,sentinel);
  49637. $ctx2.sendIdx["assert:equals:"]=2;
  49638. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  49639. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  49640. }));
  49641. return self;
  49642. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  49643. },
  49644. args: [],
  49645. 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) ]",
  49646. referencedClasses: ["Object"],
  49647. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  49648. }),
  49649. $globals.IndexableCollectionTest);
  49650. $core.addMethod(
  49651. $core.method({
  49652. selector: "testAtPut",
  49653. protocol: 'tests',
  49654. fn: function (){
  49655. var self=this;
  49656. var newCollection;
  49657. return $core.withContext(function($ctx1) {
  49658. newCollection=self._collection();
  49659. $ctx1.sendIdx["collection"]=1;
  49660. self._samplesDo_((function(index,value){
  49661. return $core.withContext(function($ctx2) {
  49662. return $recv(newCollection)._at_put_(index,value);
  49663. $ctx2.sendIdx["at:put:"]=1;
  49664. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  49665. }));
  49666. self._assert_equals_(newCollection,self._collection());
  49667. $ctx1.sendIdx["assert:equals:"]=1;
  49668. $recv(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  49669. self._assert_equals_(newCollection,self._collectionWithNewValue());
  49670. return self;
  49671. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  49672. },
  49673. args: [],
  49674. 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",
  49675. referencedClasses: [],
  49676. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  49677. }),
  49678. $globals.IndexableCollectionTest);
  49679. $core.addMethod(
  49680. $core.method({
  49681. selector: "testIndexOf",
  49682. protocol: 'tests',
  49683. fn: function (){
  49684. var self=this;
  49685. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  49686. return $core.withContext(function($ctx1) {
  49687. var $1;
  49688. self._should_raise_((function(){
  49689. return $core.withContext(function($ctx2) {
  49690. $1=self._collection();
  49691. $ctx2.sendIdx["collection"]=1;
  49692. return $recv($1)._indexOf_(self._sampleNewValue());
  49693. $ctx2.sendIdx["indexOf:"]=1;
  49694. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49695. }),$Error());
  49696. self._samplesDo_((function(index,value){
  49697. return $core.withContext(function($ctx2) {
  49698. return self._assert_equals_($recv(self._collection())._indexOf_(value),index);
  49699. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  49700. }));
  49701. return self;
  49702. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  49703. },
  49704. args: [],
  49705. 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 ]",
  49706. referencedClasses: ["Error"],
  49707. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  49708. }),
  49709. $globals.IndexableCollectionTest);
  49710. $core.addMethod(
  49711. $core.method({
  49712. selector: "testIndexOfWithNull",
  49713. protocol: 'tests',
  49714. fn: function (){
  49715. var self=this;
  49716. var jsNull;
  49717. function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  49718. return $core.withContext(function($ctx1) {
  49719. var $2,$1;
  49720. jsNull=$recv($JSON())._parse_("null");
  49721. self._samplesDo_((function(index,value){
  49722. return $core.withContext(function($ctx2) {
  49723. $2=self._collection();
  49724. $recv($2)._at_put_(index,jsNull);
  49725. $1=$recv($2)._indexOf_(jsNull);
  49726. return self._assert_equals_($1,index);
  49727. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  49728. }));
  49729. return self;
  49730. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  49731. },
  49732. args: [],
  49733. 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 ]",
  49734. referencedClasses: ["JSON"],
  49735. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  49736. }),
  49737. $globals.IndexableCollectionTest);
  49738. $core.addMethod(
  49739. $core.method({
  49740. selector: "testWithIndexDo",
  49741. protocol: 'tests',
  49742. fn: function (){
  49743. var self=this;
  49744. var collection;
  49745. return $core.withContext(function($ctx1) {
  49746. collection=self._collection();
  49747. $ctx1.sendIdx["collection"]=1;
  49748. $recv(self._collection())._withIndexDo_((function(each,index){
  49749. return $core.withContext(function($ctx2) {
  49750. return self._assert_equals_($recv(collection)._at_(index),each);
  49751. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  49752. }));
  49753. return self;
  49754. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  49755. },
  49756. args: [],
  49757. 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 ]",
  49758. referencedClasses: [],
  49759. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  49760. }),
  49761. $globals.IndexableCollectionTest);
  49762. $core.addClass('AssociativeCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
  49763. $core.addMethod(
  49764. $core.method({
  49765. selector: "collectionKeys",
  49766. protocol: 'fixture',
  49767. fn: function (){
  49768. var self=this;
  49769. return $core.withContext(function($ctx1) {
  49770. self._subclassResponsibility();
  49771. return self;
  49772. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  49773. },
  49774. args: [],
  49775. source: "collectionKeys\x0a\x09self subclassResponsibility",
  49776. referencedClasses: [],
  49777. messageSends: ["subclassResponsibility"]
  49778. }),
  49779. $globals.AssociativeCollectionTest);
  49780. $core.addMethod(
  49781. $core.method({
  49782. selector: "collectionValues",
  49783. protocol: 'fixture',
  49784. fn: function (){
  49785. var self=this;
  49786. return $core.withContext(function($ctx1) {
  49787. self._subclassResponsibility();
  49788. return self;
  49789. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  49790. },
  49791. args: [],
  49792. source: "collectionValues\x0a\x09self subclassResponsibility",
  49793. referencedClasses: [],
  49794. messageSends: ["subclassResponsibility"]
  49795. }),
  49796. $globals.AssociativeCollectionTest);
  49797. $core.addMethod(
  49798. $core.method({
  49799. selector: "nonIndexesDo:",
  49800. protocol: 'fixture',
  49801. fn: function (aBlock){
  49802. var self=this;
  49803. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  49804. return $core.withContext(function($ctx1) {
  49805. $recv(aBlock)._value_((5));
  49806. $ctx1.sendIdx["value:"]=1;
  49807. $recv(aBlock)._value_((function(){
  49808. }));
  49809. $ctx1.sendIdx["value:"]=2;
  49810. $recv(aBlock)._value_($recv($Object())._new());
  49811. $ctx1.sendIdx["value:"]=3;
  49812. $recv(aBlock)._value_("z");
  49813. return self;
  49814. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  49815. },
  49816. args: ["aBlock"],
  49817. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  49818. referencedClasses: ["Object"],
  49819. messageSends: ["value:", "new"]
  49820. }),
  49821. $globals.AssociativeCollectionTest);
  49822. $core.addMethod(
  49823. $core.method({
  49824. selector: "sampleNewIndex",
  49825. protocol: 'fixture',
  49826. fn: function (){
  49827. var self=this;
  49828. return "new";
  49829. },
  49830. args: [],
  49831. source: "sampleNewIndex\x0a\x09^ 'new'",
  49832. referencedClasses: [],
  49833. messageSends: []
  49834. }),
  49835. $globals.AssociativeCollectionTest);
  49836. $core.addMethod(
  49837. $core.method({
  49838. selector: "samplesDo:",
  49839. protocol: 'fixture',
  49840. fn: function (aBlock){
  49841. var self=this;
  49842. return $core.withContext(function($ctx1) {
  49843. $recv(aBlock)._value_value_("a",(2));
  49844. return self;
  49845. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  49846. },
  49847. args: ["aBlock"],
  49848. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  49849. referencedClasses: [],
  49850. messageSends: ["value:value:"]
  49851. }),
  49852. $globals.AssociativeCollectionTest);
  49853. $core.addMethod(
  49854. $core.method({
  49855. selector: "testAddAll",
  49856. protocol: 'tests',
  49857. fn: function (){
  49858. var self=this;
  49859. return $core.withContext(function($ctx1) {
  49860. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  49861. (
  49862. $ctx1.supercall = true,
  49863. ($globals.AssociativeCollectionTest.superclass||$boot.dnu).fn.prototype._testAddAll.apply($recv(self), []));
  49864. $ctx1.supercall = false;
  49865. $2=self._collection();
  49866. $ctx1.sendIdx["collection"]=1;
  49867. $3=self._collection();
  49868. $ctx1.sendIdx["collection"]=2;
  49869. $recv($2)._addAll_($3);
  49870. $ctx1.sendIdx["addAll:"]=1;
  49871. $4=$recv($2)._yourself();
  49872. $ctx1.sendIdx["yourself"]=1;
  49873. $1=$4;
  49874. $5=self._collection();
  49875. $ctx1.sendIdx["collection"]=3;
  49876. self._assert_equals_($1,$5);
  49877. $ctx1.sendIdx["assert:equals:"]=1;
  49878. $7=self._collection();
  49879. $ctx1.sendIdx["collection"]=4;
  49880. $8=self._collectionWithNewValue();
  49881. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49882. $recv($7)._addAll_($8);
  49883. $ctx1.sendIdx["addAll:"]=2;
  49884. $9=$recv($7)._yourself();
  49885. $ctx1.sendIdx["yourself"]=2;
  49886. $6=$9;
  49887. $10=self._collectionWithNewValue();
  49888. $ctx1.sendIdx["collectionWithNewValue"]=2;
  49889. self._assert_equals_($6,$10);
  49890. $ctx1.sendIdx["assert:equals:"]=2;
  49891. $12=self._collectionWithNewValue();
  49892. $ctx1.sendIdx["collectionWithNewValue"]=3;
  49893. $recv($12)._addAll_(self._collection());
  49894. $11=$recv($12)._yourself();
  49895. self._assert_equals_($11,self._collectionWithNewValue());
  49896. return self;
  49897. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  49898. },
  49899. args: [],
  49900. 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",
  49901. referencedClasses: [],
  49902. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  49903. }),
  49904. $globals.AssociativeCollectionTest);
  49905. $core.addMethod(
  49906. $core.method({
  49907. selector: "testAsDictionary",
  49908. protocol: 'tests',
  49909. fn: function (){
  49910. var self=this;
  49911. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  49912. return $core.withContext(function($ctx1) {
  49913. self._assert_($recv($recv($recv(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  49914. return self;
  49915. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  49916. },
  49917. args: [],
  49918. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  49919. referencedClasses: ["Dictionary"],
  49920. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  49921. }),
  49922. $globals.AssociativeCollectionTest);
  49923. $core.addMethod(
  49924. $core.method({
  49925. selector: "testAsHashedCollection",
  49926. protocol: 'tests',
  49927. fn: function (){
  49928. var self=this;
  49929. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  49930. return $core.withContext(function($ctx1) {
  49931. self._assert_($recv($recv($recv(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  49932. return self;
  49933. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  49934. },
  49935. args: [],
  49936. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  49937. referencedClasses: ["HashedCollection"],
  49938. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  49939. }),
  49940. $globals.AssociativeCollectionTest);
  49941. $core.addMethod(
  49942. $core.method({
  49943. selector: "testComma",
  49944. protocol: 'tests',
  49945. fn: function (){
  49946. var self=this;
  49947. return $core.withContext(function($ctx1) {
  49948. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  49949. (
  49950. $ctx1.supercall = true,
  49951. ($globals.AssociativeCollectionTest.superclass||$boot.dnu).fn.prototype._testComma.apply($recv(self), []));
  49952. $ctx1.supercall = false;
  49953. $2=self._collection();
  49954. $ctx1.sendIdx["collection"]=1;
  49955. $3=self._collection();
  49956. $ctx1.sendIdx["collection"]=2;
  49957. $1=$recv($2).__comma($3);
  49958. $ctx1.sendIdx[","]=1;
  49959. $4=self._collection();
  49960. $ctx1.sendIdx["collection"]=3;
  49961. self._assert_equals_($1,$4);
  49962. $ctx1.sendIdx["assert:equals:"]=1;
  49963. $6=self._collection();
  49964. $ctx1.sendIdx["collection"]=4;
  49965. $7=self._collectionWithNewValue();
  49966. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49967. $5=$recv($6).__comma($7);
  49968. $ctx1.sendIdx[","]=2;
  49969. $8=self._collectionWithNewValue();
  49970. $ctx1.sendIdx["collectionWithNewValue"]=2;
  49971. self._assert_equals_($5,$8);
  49972. $ctx1.sendIdx["assert:equals:"]=2;
  49973. $10=self._collectionWithNewValue();
  49974. $ctx1.sendIdx["collectionWithNewValue"]=3;
  49975. $9=$recv($10).__comma(self._collection());
  49976. self._assert_equals_($9,self._collectionWithNewValue());
  49977. return self;
  49978. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  49979. },
  49980. args: [],
  49981. 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",
  49982. referencedClasses: [],
  49983. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  49984. }),
  49985. $globals.AssociativeCollectionTest);
  49986. $core.addMethod(
  49987. $core.method({
  49988. selector: "testFrom",
  49989. protocol: 'tests',
  49990. fn: function (){
  49991. var self=this;
  49992. var associations;
  49993. return $core.withContext(function($ctx1) {
  49994. var $1;
  49995. $1="a".__minus_gt((1));
  49996. $ctx1.sendIdx["->"]=1;
  49997. associations=[$1,"b".__minus_gt((2))];
  49998. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  49999. return self;
  50000. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  50001. },
  50002. args: [],
  50003. 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 }.",
  50004. referencedClasses: [],
  50005. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  50006. }),
  50007. $globals.AssociativeCollectionTest);
  50008. $core.addMethod(
  50009. $core.method({
  50010. selector: "testKeys",
  50011. protocol: 'tests',
  50012. fn: function (){
  50013. var self=this;
  50014. return $core.withContext(function($ctx1) {
  50015. var $2,$1,$3,$4;
  50016. $2=$recv($recv(self._collectionClass())._new())._keys();
  50017. $ctx1.sendIdx["keys"]=1;
  50018. $1=$recv($2)._isEmpty();
  50019. self._assert_($1);
  50020. $3=$recv(self._collection())._keys();
  50021. $ctx1.sendIdx["keys"]=2;
  50022. $4=self._collectionKeys();
  50023. $ctx1.sendIdx["collectionKeys"]=1;
  50024. self._assertSameContents_as_($3,$4);
  50025. $ctx1.sendIdx["assertSameContents:as:"]=1;
  50026. self._assertSameContents_as_($recv(self._collectionWithNewValue())._keys(),$recv(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  50027. return self;
  50028. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  50029. },
  50030. args: [],
  50031. 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 }",
  50032. referencedClasses: [],
  50033. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  50034. }),
  50035. $globals.AssociativeCollectionTest);
  50036. $core.addMethod(
  50037. $core.method({
  50038. selector: "testNewFromPairs",
  50039. protocol: 'tests',
  50040. fn: function (){
  50041. var self=this;
  50042. var flattenedAssociations;
  50043. return $core.withContext(function($ctx1) {
  50044. flattenedAssociations=["a",(1),"b",(2)];
  50045. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  50046. return self;
  50047. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  50048. },
  50049. args: [],
  50050. 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 }.",
  50051. referencedClasses: [],
  50052. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  50053. }),
  50054. $globals.AssociativeCollectionTest);
  50055. $core.addMethod(
  50056. $core.method({
  50057. selector: "testPrintString",
  50058. protocol: 'tests',
  50059. fn: function (){
  50060. var self=this;
  50061. return $core.withContext(function($ctx1) {
  50062. var $3,$2,$1,$4;
  50063. $3=self._collectionClass();
  50064. $ctx1.sendIdx["collectionClass"]=1;
  50065. $2=$recv($3)._new();
  50066. $recv($2)._at_put_("firstname","James");
  50067. $ctx1.sendIdx["at:put:"]=1;
  50068. $recv($2)._at_put_("lastname","Bond");
  50069. $1=$recv($2)._printString();
  50070. $4=$recv("a ".__comma($recv(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  50071. $ctx1.sendIdx[","]=1;
  50072. self._assert_equals_($1,$4);
  50073. return self;
  50074. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  50075. },
  50076. args: [],
  50077. 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'')'",
  50078. referencedClasses: [],
  50079. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  50080. }),
  50081. $globals.AssociativeCollectionTest);
  50082. $core.addMethod(
  50083. $core.method({
  50084. selector: "testRemoveKey",
  50085. protocol: 'tests',
  50086. fn: function (){
  50087. var self=this;
  50088. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  50089. return $core.withContext(function($ctx1) {
  50090. var $1,$2,$3,$5,$6,$4,$8,$7;
  50091. self._nonIndexesDo_((function(each){
  50092. var collection;
  50093. return $core.withContext(function($ctx2) {
  50094. collection=self._collection();
  50095. $ctx2.sendIdx["collection"]=1;
  50096. collection;
  50097. self._should_raise_((function(){
  50098. return $core.withContext(function($ctx3) {
  50099. return $recv(collection)._removeKey_(each);
  50100. $ctx3.sendIdx["removeKey:"]=1;
  50101. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50102. }),$Error());
  50103. $1=collection;
  50104. $2=self._collection();
  50105. $ctx2.sendIdx["collection"]=2;
  50106. return self._assert_equals_($1,$2);
  50107. $ctx2.sendIdx["assert:equals:"]=1;
  50108. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  50109. }));
  50110. self._samplesDo_((function(index,value){
  50111. var collection;
  50112. return $core.withContext(function($ctx2) {
  50113. collection=self._collection();
  50114. $ctx2.sendIdx["collection"]=3;
  50115. collection;
  50116. $3=$recv(collection)._removeKey_(index);
  50117. $ctx2.sendIdx["removeKey:"]=2;
  50118. self._assert_equals_($3,value);
  50119. $ctx2.sendIdx["assert:equals:"]=2;
  50120. $5=collection;
  50121. $6=self._collection();
  50122. $ctx2.sendIdx["collection"]=4;
  50123. $4=$recv($5).__eq($6);
  50124. return self._deny_($4);
  50125. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  50126. }));
  50127. $8=self._collectionWithNewValue();
  50128. $recv($8)._removeKey_(self._sampleNewIndex());
  50129. $7=$recv($8)._yourself();
  50130. self._assert_equals_($7,self._collection());
  50131. return self;
  50132. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  50133. },
  50134. args: [],
  50135. 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",
  50136. referencedClasses: ["Error"],
  50137. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  50138. }),
  50139. $globals.AssociativeCollectionTest);
  50140. $core.addMethod(
  50141. $core.method({
  50142. selector: "testRemoveKeyIfAbsent",
  50143. protocol: 'tests',
  50144. fn: function (){
  50145. var self=this;
  50146. return $core.withContext(function($ctx1) {
  50147. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  50148. self._nonIndexesDo_((function(each){
  50149. var collection;
  50150. return $core.withContext(function($ctx2) {
  50151. collection=self._collection();
  50152. $ctx2.sendIdx["collection"]=1;
  50153. collection;
  50154. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  50155. return $core.withContext(function($ctx3) {
  50156. return self._sampleNewValue();
  50157. $ctx3.sendIdx["sampleNewValue"]=1;
  50158. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50159. }));
  50160. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  50161. $2=self._sampleNewValue();
  50162. $ctx2.sendIdx["sampleNewValue"]=2;
  50163. self._assert_equals_($1,$2);
  50164. $ctx2.sendIdx["assert:equals:"]=1;
  50165. $3=collection;
  50166. $4=self._collection();
  50167. $ctx2.sendIdx["collection"]=2;
  50168. return self._assert_equals_($3,$4);
  50169. $ctx2.sendIdx["assert:equals:"]=2;
  50170. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  50171. }));
  50172. self._samplesDo_((function(index,value){
  50173. var collection;
  50174. return $core.withContext(function($ctx2) {
  50175. collection=self._collection();
  50176. $ctx2.sendIdx["collection"]=3;
  50177. collection;
  50178. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  50179. return $core.withContext(function($ctx3) {
  50180. return self._sampleNewValue();
  50181. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  50182. }));
  50183. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  50184. self._assert_equals_($5,value);
  50185. $ctx2.sendIdx["assert:equals:"]=3;
  50186. $7=collection;
  50187. $8=self._collection();
  50188. $ctx2.sendIdx["collection"]=4;
  50189. $6=$recv($7).__eq($8);
  50190. return self._deny_($6);
  50191. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  50192. }));
  50193. $10=self._collectionWithNewValue();
  50194. $recv($10)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  50195. return $core.withContext(function($ctx2) {
  50196. return self._assert_(false);
  50197. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  50198. }));
  50199. $9=$recv($10)._yourself();
  50200. self._assert_equals_($9,self._collection());
  50201. return self;
  50202. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  50203. },
  50204. args: [],
  50205. 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",
  50206. referencedClasses: [],
  50207. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  50208. }),
  50209. $globals.AssociativeCollectionTest);
  50210. $core.addMethod(
  50211. $core.method({
  50212. selector: "testValues",
  50213. protocol: 'tests',
  50214. fn: function (){
  50215. var self=this;
  50216. return $core.withContext(function($ctx1) {
  50217. var $2,$1,$3,$4;
  50218. $2=$recv($recv(self._collectionClass())._new())._values();
  50219. $ctx1.sendIdx["values"]=1;
  50220. $1=$recv($2)._isEmpty();
  50221. self._assert_($1);
  50222. $3=$recv(self._collection())._values();
  50223. $ctx1.sendIdx["values"]=2;
  50224. $4=self._collectionValues();
  50225. $ctx1.sendIdx["collectionValues"]=1;
  50226. self._assertSameContents_as_($3,$4);
  50227. $ctx1.sendIdx["assertSameContents:as:"]=1;
  50228. self._assertSameContents_as_($recv(self._collectionWithNewValue())._values(),$recv(self._collectionValues()).__comma([self._sampleNewValue()]));
  50229. return self;
  50230. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  50231. },
  50232. args: [],
  50233. 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 }",
  50234. referencedClasses: [],
  50235. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  50236. }),
  50237. $globals.AssociativeCollectionTest);
  50238. $core.addClass('DictionaryTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  50239. $core.addMethod(
  50240. $core.method({
  50241. selector: "collection",
  50242. protocol: 'fixture',
  50243. fn: function (){
  50244. var self=this;
  50245. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  50246. return $core.withContext(function($ctx1) {
  50247. var $1;
  50248. $1=$recv($Dictionary())._new();
  50249. $recv($1)._at_put_((1),(1));
  50250. $ctx1.sendIdx["at:put:"]=1;
  50251. $recv($1)._at_put_("a",(2));
  50252. $ctx1.sendIdx["at:put:"]=2;
  50253. $recv($1)._at_put_(true,(3));
  50254. $ctx1.sendIdx["at:put:"]=3;
  50255. $recv($1)._at_put_((1).__at((3)),(-4));
  50256. $ctx1.sendIdx["at:put:"]=4;
  50257. $recv($1)._at_put_(self["@sampleBlock"],(9));
  50258. return $recv($1)._yourself();
  50259. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  50260. },
  50261. args: [],
  50262. source: "collection\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 1@3 put: -4;\x0a\x09\x09at: sampleBlock put: 9;\x0a\x09\x09yourself",
  50263. referencedClasses: ["Dictionary"],
  50264. messageSends: ["at:put:", "new", "@", "yourself"]
  50265. }),
  50266. $globals.DictionaryTest);
  50267. $core.addMethod(
  50268. $core.method({
  50269. selector: "collectionKeys",
  50270. protocol: 'fixture',
  50271. fn: function (){
  50272. var self=this;
  50273. return $core.withContext(function($ctx1) {
  50274. return [(1),"a",true,(1).__at((3)),self["@sampleBlock"]];
  50275. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  50276. },
  50277. args: [],
  50278. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  50279. referencedClasses: [],
  50280. messageSends: ["@"]
  50281. }),
  50282. $globals.DictionaryTest);
  50283. $core.addMethod(
  50284. $core.method({
  50285. selector: "collectionOfPrintStrings",
  50286. protocol: 'fixture',
  50287. fn: function (){
  50288. var self=this;
  50289. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  50290. return $core.withContext(function($ctx1) {
  50291. var $1;
  50292. $1=$recv($Dictionary())._new();
  50293. $recv($1)._at_put_((1),"1");
  50294. $ctx1.sendIdx["at:put:"]=1;
  50295. $recv($1)._at_put_("a","2");
  50296. $ctx1.sendIdx["at:put:"]=2;
  50297. $recv($1)._at_put_(true,"3");
  50298. $ctx1.sendIdx["at:put:"]=3;
  50299. $recv($1)._at_put_((1).__at((3)),"-4");
  50300. $ctx1.sendIdx["at:put:"]=4;
  50301. $recv($1)._at_put_(self["@sampleBlock"],"9");
  50302. return $recv($1)._yourself();
  50303. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  50304. },
  50305. args: [],
  50306. source: "collectionOfPrintStrings\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: '1';\x0a\x09\x09at: 'a' put: '2';\x0a\x09\x09at: true put: '3';\x0a\x09\x09at: 1@3 put: '-4';\x0a\x09\x09at: sampleBlock put: '9';\x0a\x09\x09yourself",
  50307. referencedClasses: ["Dictionary"],
  50308. messageSends: ["at:put:", "new", "@", "yourself"]
  50309. }),
  50310. $globals.DictionaryTest);
  50311. $core.addMethod(
  50312. $core.method({
  50313. selector: "collectionSize",
  50314. protocol: 'fixture',
  50315. fn: function (){
  50316. var self=this;
  50317. return (5);
  50318. },
  50319. args: [],
  50320. source: "collectionSize\x0a\x09^ 5",
  50321. referencedClasses: [],
  50322. messageSends: []
  50323. }),
  50324. $globals.DictionaryTest);
  50325. $core.addMethod(
  50326. $core.method({
  50327. selector: "collectionValues",
  50328. protocol: 'fixture',
  50329. fn: function (){
  50330. var self=this;
  50331. return [(1),(2),(3),(-4),(9)];
  50332. },
  50333. args: [],
  50334. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  50335. referencedClasses: [],
  50336. messageSends: []
  50337. }),
  50338. $globals.DictionaryTest);
  50339. $core.addMethod(
  50340. $core.method({
  50341. selector: "collectionWithDuplicates",
  50342. protocol: 'fixture',
  50343. fn: function (){
  50344. var self=this;
  50345. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  50346. return $core.withContext(function($ctx1) {
  50347. var $1;
  50348. $1=$recv($Dictionary())._new();
  50349. $recv($1)._at_put_((1),(1));
  50350. $ctx1.sendIdx["at:put:"]=1;
  50351. $recv($1)._at_put_("a",(2));
  50352. $ctx1.sendIdx["at:put:"]=2;
  50353. $recv($1)._at_put_(true,(3));
  50354. $ctx1.sendIdx["at:put:"]=3;
  50355. $recv($1)._at_put_((4),(-4));
  50356. $ctx1.sendIdx["at:put:"]=4;
  50357. $recv($1)._at_put_(self["@sampleBlock"],(9));
  50358. $ctx1.sendIdx["at:put:"]=5;
  50359. $recv($1)._at_put_("b",(1));
  50360. $ctx1.sendIdx["at:put:"]=6;
  50361. $recv($1)._at_put_((3),(3));
  50362. $ctx1.sendIdx["at:put:"]=7;
  50363. $recv($1)._at_put_(false,(12));
  50364. return $recv($1)._yourself();
  50365. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  50366. },
  50367. args: [],
  50368. source: "collectionWithDuplicates\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 4 put: -4;\x0a\x09\x09at: sampleBlock put: 9;\x0a\x09\x09at: 'b' put: 1;\x0a\x09\x09at: 3 put: 3;\x0a\x09\x09at: false put: 12;\x0a\x09\x09yourself",
  50369. referencedClasses: ["Dictionary"],
  50370. messageSends: ["at:put:", "new", "yourself"]
  50371. }),
  50372. $globals.DictionaryTest);
  50373. $core.addMethod(
  50374. $core.method({
  50375. selector: "collectionWithNewValue",
  50376. protocol: 'fixture',
  50377. fn: function (){
  50378. var self=this;
  50379. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  50380. return $core.withContext(function($ctx1) {
  50381. var $1;
  50382. $1=$recv($Dictionary())._new();
  50383. $recv($1)._at_put_((1),(1));
  50384. $ctx1.sendIdx["at:put:"]=1;
  50385. $recv($1)._at_put_("a",(2));
  50386. $ctx1.sendIdx["at:put:"]=2;
  50387. $recv($1)._at_put_(true,(3));
  50388. $ctx1.sendIdx["at:put:"]=3;
  50389. $recv($1)._at_put_((1).__at((3)),(-4));
  50390. $ctx1.sendIdx["at:put:"]=4;
  50391. $recv($1)._at_put_(self["@sampleBlock"],(9));
  50392. $ctx1.sendIdx["at:put:"]=5;
  50393. $recv($1)._at_put_("new","N");
  50394. return $recv($1)._yourself();
  50395. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  50396. },
  50397. args: [],
  50398. source: "collectionWithNewValue\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 1@3 put: -4;\x0a\x09\x09at: sampleBlock put: 9;\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  50399. referencedClasses: ["Dictionary"],
  50400. messageSends: ["at:put:", "new", "@", "yourself"]
  50401. }),
  50402. $globals.DictionaryTest);
  50403. $core.addMethod(
  50404. $core.method({
  50405. selector: "sampleNewValueAsCollection",
  50406. protocol: 'fixture',
  50407. fn: function (){
  50408. var self=this;
  50409. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  50410. return $core.withContext(function($ctx1) {
  50411. var $1;
  50412. $1=$recv($Dictionary())._new();
  50413. $recv($1)._at_put_("new","N");
  50414. return $recv($1)._yourself();
  50415. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  50416. },
  50417. args: [],
  50418. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  50419. referencedClasses: ["Dictionary"],
  50420. messageSends: ["at:put:", "new", "yourself"]
  50421. }),
  50422. $globals.DictionaryTest);
  50423. $core.addMethod(
  50424. $core.method({
  50425. selector: "samplesDo:",
  50426. protocol: 'fixture',
  50427. fn: function (aBlock){
  50428. var self=this;
  50429. return $core.withContext(function($ctx1) {
  50430. (
  50431. $ctx1.supercall = true,
  50432. ($globals.DictionaryTest.superclass||$boot.dnu).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  50433. $ctx1.supercall = false;
  50434. $recv(aBlock)._value_value_(true,(3));
  50435. $ctx1.sendIdx["value:value:"]=1;
  50436. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  50437. $ctx1.sendIdx["value:value:"]=2;
  50438. $recv(aBlock)._value_value_(self["@sampleBlock"],(9));
  50439. return self;
  50440. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  50441. },
  50442. args: ["aBlock"],
  50443. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4.\x0a\x09aBlock value: sampleBlock value: 9",
  50444. referencedClasses: [],
  50445. messageSends: ["samplesDo:", "value:value:", "@"]
  50446. }),
  50447. $globals.DictionaryTest);
  50448. $core.addMethod(
  50449. $core.method({
  50450. selector: "testAccessing",
  50451. protocol: 'tests',
  50452. fn: function (){
  50453. var self=this;
  50454. var d;
  50455. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  50456. return $core.withContext(function($ctx1) {
  50457. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  50458. d=$recv($Dictionary())._new();
  50459. $recv(d)._at_put_("hello","world");
  50460. $ctx1.sendIdx["at:put:"]=1;
  50461. $1=$recv(d)._at_("hello");
  50462. $ctx1.sendIdx["at:"]=1;
  50463. self._assert_equals_($1,"world");
  50464. $ctx1.sendIdx["assert:equals:"]=1;
  50465. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  50466. return nil;
  50467. }));
  50468. $ctx1.sendIdx["at:ifAbsent:"]=1;
  50469. self._assert_equals_($2,"world");
  50470. $ctx1.sendIdx["assert:equals:"]=2;
  50471. self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  50472. return nil;
  50473. }))).__eq("world"));
  50474. $ctx1.sendIdx["deny:"]=1;
  50475. $3=$recv(d)._includesKey_("hello");
  50476. $ctx1.sendIdx["includesKey:"]=1;
  50477. self._assert_($3);
  50478. $ctx1.sendIdx["assert:"]=1;
  50479. $4=$recv(d)._includesKey_("foo");
  50480. $ctx1.sendIdx["includesKey:"]=2;
  50481. self._deny_($4);
  50482. $ctx1.sendIdx["deny:"]=2;
  50483. $recv(d)._at_put_((1),(2));
  50484. $ctx1.sendIdx["at:put:"]=2;
  50485. $5=$recv(d)._at_((1));
  50486. $ctx1.sendIdx["at:"]=2;
  50487. self._assert_equals_($5,(2));
  50488. $ctx1.sendIdx["assert:equals:"]=3;
  50489. $6=d;
  50490. $7=(1).__at((3));
  50491. $ctx1.sendIdx["@"]=1;
  50492. $recv($6)._at_put_($7,(3));
  50493. $9=d;
  50494. $10=(1).__at((3));
  50495. $ctx1.sendIdx["@"]=2;
  50496. $8=$recv($9)._at_($10);
  50497. self._assert_equals_($8,(3));
  50498. $12=d;
  50499. $13=(1).__at((3));
  50500. $ctx1.sendIdx["@"]=3;
  50501. $11=$recv($12)._includesKey_($13);
  50502. $ctx1.sendIdx["includesKey:"]=3;
  50503. self._assert_($11);
  50504. self._deny_($recv(d)._includesKey_((3).__at((1))));
  50505. return self;
  50506. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  50507. },
  50508. args: [],
  50509. 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)",
  50510. referencedClasses: ["Dictionary"],
  50511. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  50512. }),
  50513. $globals.DictionaryTest);
  50514. $core.addMethod(
  50515. $core.method({
  50516. selector: "testDynamicDictionaries",
  50517. protocol: 'tests',
  50518. fn: function (){
  50519. var self=this;
  50520. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  50521. return $core.withContext(function($ctx1) {
  50522. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($Dictionary())._with_("hello".__minus_gt((1))));
  50523. return self;
  50524. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  50525. },
  50526. args: [],
  50527. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  50528. referencedClasses: ["Dictionary"],
  50529. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  50530. }),
  50531. $globals.DictionaryTest);
  50532. $core.addMethod(
  50533. $core.method({
  50534. selector: "collectionClass",
  50535. protocol: 'fixture',
  50536. fn: function (){
  50537. var self=this;
  50538. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  50539. return $Dictionary();
  50540. },
  50541. args: [],
  50542. source: "collectionClass\x0a\x09^ Dictionary",
  50543. referencedClasses: ["Dictionary"],
  50544. messageSends: []
  50545. }),
  50546. $globals.DictionaryTest.klass);
  50547. $core.addClass('HashedCollectionTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  50548. $core.addMethod(
  50549. $core.method({
  50550. selector: "collection",
  50551. protocol: 'fixture',
  50552. fn: function (){
  50553. var self=this;
  50554. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  50555. },
  50556. args: [],
  50557. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  50558. referencedClasses: [],
  50559. messageSends: []
  50560. }),
  50561. $globals.HashedCollectionTest);
  50562. $core.addMethod(
  50563. $core.method({
  50564. selector: "collectionKeys",
  50565. protocol: 'fixture',
  50566. fn: function (){
  50567. var self=this;
  50568. return ["b","a","c","d"];
  50569. },
  50570. args: [],
  50571. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  50572. referencedClasses: [],
  50573. messageSends: []
  50574. }),
  50575. $globals.HashedCollectionTest);
  50576. $core.addMethod(
  50577. $core.method({
  50578. selector: "collectionOfPrintStrings",
  50579. protocol: 'fixture',
  50580. fn: function (){
  50581. var self=this;
  50582. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  50583. },
  50584. args: [],
  50585. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  50586. referencedClasses: [],
  50587. messageSends: []
  50588. }),
  50589. $globals.HashedCollectionTest);
  50590. $core.addMethod(
  50591. $core.method({
  50592. selector: "collectionSize",
  50593. protocol: 'fixture',
  50594. fn: function (){
  50595. var self=this;
  50596. return (4);
  50597. },
  50598. args: [],
  50599. source: "collectionSize\x0a\x09^ 4",
  50600. referencedClasses: [],
  50601. messageSends: []
  50602. }),
  50603. $globals.HashedCollectionTest);
  50604. $core.addMethod(
  50605. $core.method({
  50606. selector: "collectionValues",
  50607. protocol: 'fixture',
  50608. fn: function (){
  50609. var self=this;
  50610. return [(1),(2),(3),(-4)];
  50611. },
  50612. args: [],
  50613. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  50614. referencedClasses: [],
  50615. messageSends: []
  50616. }),
  50617. $globals.HashedCollectionTest);
  50618. $core.addMethod(
  50619. $core.method({
  50620. selector: "collectionWithDuplicates",
  50621. protocol: 'fixture',
  50622. fn: function (){
  50623. var self=this;
  50624. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  50625. },
  50626. args: [],
  50627. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  50628. referencedClasses: [],
  50629. messageSends: []
  50630. }),
  50631. $globals.HashedCollectionTest);
  50632. $core.addMethod(
  50633. $core.method({
  50634. selector: "collectionWithNewValue",
  50635. protocol: 'fixture',
  50636. fn: function (){
  50637. var self=this;
  50638. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  50639. },
  50640. args: [],
  50641. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  50642. referencedClasses: [],
  50643. messageSends: []
  50644. }),
  50645. $globals.HashedCollectionTest);
  50646. $core.addMethod(
  50647. $core.method({
  50648. selector: "sampleNewValueAsCollection",
  50649. protocol: 'fixture',
  50650. fn: function (){
  50651. var self=this;
  50652. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  50653. },
  50654. args: [],
  50655. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  50656. referencedClasses: [],
  50657. messageSends: []
  50658. }),
  50659. $globals.HashedCollectionTest);
  50660. $core.addMethod(
  50661. $core.method({
  50662. selector: "testDynamicDictionaries",
  50663. protocol: 'tests',
  50664. fn: function (){
  50665. var self=this;
  50666. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  50667. return $core.withContext(function($ctx1) {
  50668. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($HashedCollection())._with_("hello".__minus_gt((1))));
  50669. return self;
  50670. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  50671. },
  50672. args: [],
  50673. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  50674. referencedClasses: ["HashedCollection"],
  50675. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  50676. }),
  50677. $globals.HashedCollectionTest);
  50678. $core.addMethod(
  50679. $core.method({
  50680. selector: "collectionClass",
  50681. protocol: 'fixture',
  50682. fn: function (){
  50683. var self=this;
  50684. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  50685. return $HashedCollection();
  50686. },
  50687. args: [],
  50688. source: "collectionClass\x0a\x09^ HashedCollection",
  50689. referencedClasses: ["HashedCollection"],
  50690. messageSends: []
  50691. }),
  50692. $globals.HashedCollectionTest.klass);
  50693. $core.addClass('SequenceableCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
  50694. $core.addMethod(
  50695. $core.method({
  50696. selector: "collectionFirst",
  50697. protocol: 'fixture',
  50698. fn: function (){
  50699. var self=this;
  50700. return $core.withContext(function($ctx1) {
  50701. self._subclassResponsibility();
  50702. return self;
  50703. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  50704. },
  50705. args: [],
  50706. source: "collectionFirst\x0a\x09self subclassResponsibility",
  50707. referencedClasses: [],
  50708. messageSends: ["subclassResponsibility"]
  50709. }),
  50710. $globals.SequenceableCollectionTest);
  50711. $core.addMethod(
  50712. $core.method({
  50713. selector: "collectionFirstTwo",
  50714. protocol: 'fixture',
  50715. fn: function (){
  50716. var self=this;
  50717. return $core.withContext(function($ctx1) {
  50718. self._subclassResponsibility();
  50719. return self;
  50720. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  50721. },
  50722. args: [],
  50723. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  50724. referencedClasses: [],
  50725. messageSends: ["subclassResponsibility"]
  50726. }),
  50727. $globals.SequenceableCollectionTest);
  50728. $core.addMethod(
  50729. $core.method({
  50730. selector: "collectionLast",
  50731. protocol: 'fixture',
  50732. fn: function (){
  50733. var self=this;
  50734. return $core.withContext(function($ctx1) {
  50735. self._subclassResponsibility();
  50736. return self;
  50737. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  50738. },
  50739. args: [],
  50740. source: "collectionLast\x0a\x09self subclassResponsibility",
  50741. referencedClasses: [],
  50742. messageSends: ["subclassResponsibility"]
  50743. }),
  50744. $globals.SequenceableCollectionTest);
  50745. $core.addMethod(
  50746. $core.method({
  50747. selector: "collectionLastTwo",
  50748. protocol: 'fixture',
  50749. fn: function (){
  50750. var self=this;
  50751. return $core.withContext(function($ctx1) {
  50752. self._subclassResponsibility();
  50753. return self;
  50754. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  50755. },
  50756. args: [],
  50757. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  50758. referencedClasses: [],
  50759. messageSends: ["subclassResponsibility"]
  50760. }),
  50761. $globals.SequenceableCollectionTest);
  50762. $core.addMethod(
  50763. $core.method({
  50764. selector: "nonIndexesDo:",
  50765. protocol: 'fixture',
  50766. fn: function (aBlock){
  50767. var self=this;
  50768. return $core.withContext(function($ctx1) {
  50769. $recv(aBlock)._value_((0));
  50770. $ctx1.sendIdx["value:"]=1;
  50771. $recv(aBlock)._value_($recv(self._collectionSize()).__plus((1)));
  50772. $ctx1.sendIdx["value:"]=2;
  50773. $recv(aBlock)._value_("z");
  50774. return self;
  50775. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  50776. },
  50777. args: ["aBlock"],
  50778. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  50779. referencedClasses: [],
  50780. messageSends: ["value:", "+", "collectionSize"]
  50781. }),
  50782. $globals.SequenceableCollectionTest);
  50783. $core.addMethod(
  50784. $core.method({
  50785. selector: "samplesDo:",
  50786. protocol: 'fixture',
  50787. fn: function (aBlock){
  50788. var self=this;
  50789. return $core.withContext(function($ctx1) {
  50790. $recv(aBlock)._value_value_((1),self._collectionFirst());
  50791. $ctx1.sendIdx["value:value:"]=1;
  50792. $recv(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  50793. return self;
  50794. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  50795. },
  50796. args: ["aBlock"],
  50797. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  50798. referencedClasses: [],
  50799. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  50800. }),
  50801. $globals.SequenceableCollectionTest);
  50802. $core.addMethod(
  50803. $core.method({
  50804. selector: "testBeginsWith",
  50805. protocol: 'tests',
  50806. fn: function (){
  50807. var self=this;
  50808. return $core.withContext(function($ctx1) {
  50809. var $2,$1,$4,$5,$3,$7,$6;
  50810. $2=self._collection();
  50811. $ctx1.sendIdx["collection"]=1;
  50812. $1=$recv($2)._beginsWith_($recv(self._collectionClass())._new());
  50813. $ctx1.sendIdx["beginsWith:"]=1;
  50814. self._assert_($1);
  50815. $ctx1.sendIdx["assert:"]=1;
  50816. $4=self._collection();
  50817. $ctx1.sendIdx["collection"]=2;
  50818. $5=self._collection();
  50819. $ctx1.sendIdx["collection"]=3;
  50820. $3=$recv($4)._beginsWith_($5);
  50821. $ctx1.sendIdx["beginsWith:"]=2;
  50822. self._assert_($3);
  50823. $ctx1.sendIdx["assert:"]=2;
  50824. $7=self._collection();
  50825. $ctx1.sendIdx["collection"]=4;
  50826. $6=$recv($7)._beginsWith_(self._collectionFirstTwo());
  50827. $ctx1.sendIdx["beginsWith:"]=3;
  50828. self._assert_($6);
  50829. self._deny_($recv(self._collection())._beginsWith_(self._collectionLastTwo()));
  50830. return self;
  50831. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  50832. },
  50833. args: [],
  50834. 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)",
  50835. referencedClasses: [],
  50836. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  50837. }),
  50838. $globals.SequenceableCollectionTest);
  50839. $core.addMethod(
  50840. $core.method({
  50841. selector: "testEndsWith",
  50842. protocol: 'tests',
  50843. fn: function (){
  50844. var self=this;
  50845. return $core.withContext(function($ctx1) {
  50846. var $2,$1,$4,$5,$3,$7,$6;
  50847. $2=self._collection();
  50848. $ctx1.sendIdx["collection"]=1;
  50849. $1=$recv($2)._endsWith_($recv(self._collectionClass())._new());
  50850. $ctx1.sendIdx["endsWith:"]=1;
  50851. self._assert_($1);
  50852. $ctx1.sendIdx["assert:"]=1;
  50853. $4=self._collection();
  50854. $ctx1.sendIdx["collection"]=2;
  50855. $5=self._collection();
  50856. $ctx1.sendIdx["collection"]=3;
  50857. $3=$recv($4)._endsWith_($5);
  50858. $ctx1.sendIdx["endsWith:"]=2;
  50859. self._assert_($3);
  50860. $ctx1.sendIdx["assert:"]=2;
  50861. $7=self._collection();
  50862. $ctx1.sendIdx["collection"]=4;
  50863. $6=$recv($7)._endsWith_(self._collectionLastTwo());
  50864. $ctx1.sendIdx["endsWith:"]=3;
  50865. self._assert_($6);
  50866. self._deny_($recv(self._collection())._endsWith_(self._collectionFirstTwo()));
  50867. return self;
  50868. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  50869. },
  50870. args: [],
  50871. 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)",
  50872. referencedClasses: [],
  50873. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  50874. }),
  50875. $globals.SequenceableCollectionTest);
  50876. $core.addMethod(
  50877. $core.method({
  50878. selector: "testFirst",
  50879. protocol: 'tests',
  50880. fn: function (){
  50881. var self=this;
  50882. return $core.withContext(function($ctx1) {
  50883. self._assert_equals_($recv(self._collection())._first(),self._collectionFirst());
  50884. return self;
  50885. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  50886. },
  50887. args: [],
  50888. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  50889. referencedClasses: [],
  50890. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  50891. }),
  50892. $globals.SequenceableCollectionTest);
  50893. $core.addMethod(
  50894. $core.method({
  50895. selector: "testFirstN",
  50896. protocol: 'tests',
  50897. fn: function (){
  50898. var self=this;
  50899. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  50900. return $core.withContext(function($ctx1) {
  50901. var $2,$1,$4,$3,$6,$5,$7;
  50902. $2=self._collection();
  50903. $ctx1.sendIdx["collection"]=1;
  50904. $1=$recv($2)._first_((2));
  50905. $ctx1.sendIdx["first:"]=1;
  50906. self._assert_equals_($1,self._collectionFirstTwo());
  50907. $ctx1.sendIdx["assert:equals:"]=1;
  50908. $4=self._collection();
  50909. $ctx1.sendIdx["collection"]=2;
  50910. $3=$recv($4)._first_((0));
  50911. $ctx1.sendIdx["first:"]=2;
  50912. self._assert_equals_($3,$recv(self._collectionClass())._new());
  50913. $ctx1.sendIdx["assert:equals:"]=2;
  50914. $6=self._collection();
  50915. $ctx1.sendIdx["collection"]=3;
  50916. $5=$recv($6)._first_(self._collectionSize());
  50917. $ctx1.sendIdx["first:"]=3;
  50918. $7=self._collection();
  50919. $ctx1.sendIdx["collection"]=4;
  50920. self._assert_equals_($5,$7);
  50921. self._should_raise_((function(){
  50922. return $core.withContext(function($ctx2) {
  50923. return $recv(self._collection())._first_((33));
  50924. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50925. }),$Error());
  50926. return self;
  50927. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  50928. },
  50929. args: [],
  50930. 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",
  50931. referencedClasses: ["Error"],
  50932. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  50933. }),
  50934. $globals.SequenceableCollectionTest);
  50935. $core.addMethod(
  50936. $core.method({
  50937. selector: "testFourth",
  50938. protocol: 'tests',
  50939. fn: function (){
  50940. var self=this;
  50941. return $core.withContext(function($ctx1) {
  50942. var $2,$1;
  50943. $2=self._collection();
  50944. $ctx1.sendIdx["collection"]=1;
  50945. $1=$recv($2)._fourth();
  50946. self._assert_equals_($1,$recv(self._collection())._at_((4)));
  50947. return self;
  50948. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  50949. },
  50950. args: [],
  50951. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  50952. referencedClasses: [],
  50953. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  50954. }),
  50955. $globals.SequenceableCollectionTest);
  50956. $core.addMethod(
  50957. $core.method({
  50958. selector: "testIndexOfStartingAt",
  50959. protocol: 'tests',
  50960. fn: function (){
  50961. var self=this;
  50962. var jsNull;
  50963. function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  50964. return $core.withContext(function($ctx1) {
  50965. var $2,$1,$4,$3;
  50966. jsNull=$recv($JSON())._parse_("null");
  50967. self._samplesDo_((function(index,value){
  50968. return $core.withContext(function($ctx2) {
  50969. $2=self._collection();
  50970. $ctx2.sendIdx["collection"]=1;
  50971. $1=$recv($2)._indexOf_startingAt_(value,(1));
  50972. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  50973. self._assert_equals_($1,index);
  50974. $ctx2.sendIdx["assert:equals:"]=1;
  50975. $4=self._collection();
  50976. $ctx2.sendIdx["collection"]=2;
  50977. $3=$recv($4)._indexOf_startingAt_(value,index);
  50978. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  50979. self._assert_equals_($3,index);
  50980. $ctx2.sendIdx["assert:equals:"]=2;
  50981. return self._assert_equals_($recv(self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  50982. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  50983. }));
  50984. return self;
  50985. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  50986. },
  50987. args: [],
  50988. 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 ]",
  50989. referencedClasses: ["JSON"],
  50990. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  50991. }),
  50992. $globals.SequenceableCollectionTest);
  50993. $core.addMethod(
  50994. $core.method({
  50995. selector: "testIndexOfStartingAtWithNull",
  50996. protocol: 'tests',
  50997. fn: function (){
  50998. var self=this;
  50999. var jsNull;
  51000. function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  51001. return $core.withContext(function($ctx1) {
  51002. var $1,$2;
  51003. jsNull=$recv($JSON())._parse_("null");
  51004. self._samplesDo_((function(index,value){
  51005. var collection;
  51006. return $core.withContext(function($ctx2) {
  51007. collection=self._collection();
  51008. collection;
  51009. $recv(collection)._at_put_(index,jsNull);
  51010. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  51011. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  51012. self._assert_equals_($1,index);
  51013. $ctx2.sendIdx["assert:equals:"]=1;
  51014. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  51015. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  51016. self._assert_equals_($2,index);
  51017. $ctx2.sendIdx["assert:equals:"]=2;
  51018. return self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  51019. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  51020. }));
  51021. return self;
  51022. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  51023. },
  51024. args: [],
  51025. 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 ]",
  51026. referencedClasses: ["JSON"],
  51027. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  51028. }),
  51029. $globals.SequenceableCollectionTest);
  51030. $core.addMethod(
  51031. $core.method({
  51032. selector: "testLast",
  51033. protocol: 'tests',
  51034. fn: function (){
  51035. var self=this;
  51036. return $core.withContext(function($ctx1) {
  51037. self._assert_equals_($recv(self._collection())._last(),self._collectionLast());
  51038. return self;
  51039. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  51040. },
  51041. args: [],
  51042. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  51043. referencedClasses: [],
  51044. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  51045. }),
  51046. $globals.SequenceableCollectionTest);
  51047. $core.addMethod(
  51048. $core.method({
  51049. selector: "testLastN",
  51050. protocol: 'tests',
  51051. fn: function (){
  51052. var self=this;
  51053. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  51054. return $core.withContext(function($ctx1) {
  51055. var $2,$1,$4,$3,$6,$5,$7;
  51056. $2=self._collection();
  51057. $ctx1.sendIdx["collection"]=1;
  51058. $1=$recv($2)._last_((2));
  51059. $ctx1.sendIdx["last:"]=1;
  51060. self._assert_equals_($1,self._collectionLastTwo());
  51061. $ctx1.sendIdx["assert:equals:"]=1;
  51062. $4=self._collection();
  51063. $ctx1.sendIdx["collection"]=2;
  51064. $3=$recv($4)._last_((0));
  51065. $ctx1.sendIdx["last:"]=2;
  51066. self._assert_equals_($3,$recv(self._collectionClass())._new());
  51067. $ctx1.sendIdx["assert:equals:"]=2;
  51068. $6=self._collection();
  51069. $ctx1.sendIdx["collection"]=3;
  51070. $5=$recv($6)._last_(self._collectionSize());
  51071. $ctx1.sendIdx["last:"]=3;
  51072. $7=self._collection();
  51073. $ctx1.sendIdx["collection"]=4;
  51074. self._assert_equals_($5,$7);
  51075. self._should_raise_((function(){
  51076. return $core.withContext(function($ctx2) {
  51077. return $recv(self._collection())._last_((33));
  51078. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51079. }),$Error());
  51080. return self;
  51081. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  51082. },
  51083. args: [],
  51084. 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",
  51085. referencedClasses: ["Error"],
  51086. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  51087. }),
  51088. $globals.SequenceableCollectionTest);
  51089. $core.addMethod(
  51090. $core.method({
  51091. selector: "testSecond",
  51092. protocol: 'tests',
  51093. fn: function (){
  51094. var self=this;
  51095. return $core.withContext(function($ctx1) {
  51096. var $2,$1;
  51097. $2=self._collection();
  51098. $ctx1.sendIdx["collection"]=1;
  51099. $1=$recv($2)._second();
  51100. self._assert_equals_($1,$recv(self._collection())._at_((2)));
  51101. return self;
  51102. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  51103. },
  51104. args: [],
  51105. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  51106. referencedClasses: [],
  51107. messageSends: ["assert:equals:", "second", "collection", "at:"]
  51108. }),
  51109. $globals.SequenceableCollectionTest);
  51110. $core.addMethod(
  51111. $core.method({
  51112. selector: "testThird",
  51113. protocol: 'tests',
  51114. fn: function (){
  51115. var self=this;
  51116. return $core.withContext(function($ctx1) {
  51117. var $2,$1;
  51118. $2=self._collection();
  51119. $ctx1.sendIdx["collection"]=1;
  51120. $1=$recv($2)._third();
  51121. self._assert_equals_($1,$recv(self._collection())._at_((3)));
  51122. return self;
  51123. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  51124. },
  51125. args: [],
  51126. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  51127. referencedClasses: [],
  51128. messageSends: ["assert:equals:", "third", "collection", "at:"]
  51129. }),
  51130. $globals.SequenceableCollectionTest);
  51131. $core.addClass('ArrayTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  51132. $core.addMethod(
  51133. $core.method({
  51134. selector: "collection",
  51135. protocol: 'fixture',
  51136. fn: function (){
  51137. var self=this;
  51138. return [(1), (2), (3), (-4)];
  51139. },
  51140. args: [],
  51141. source: "collection\x0a\x09^ #(1 2 3 -4)",
  51142. referencedClasses: [],
  51143. messageSends: []
  51144. }),
  51145. $globals.ArrayTest);
  51146. $core.addMethod(
  51147. $core.method({
  51148. selector: "collectionFirst",
  51149. protocol: 'fixture',
  51150. fn: function (){
  51151. var self=this;
  51152. return (1);
  51153. },
  51154. args: [],
  51155. source: "collectionFirst\x0a\x09^ 1",
  51156. referencedClasses: [],
  51157. messageSends: []
  51158. }),
  51159. $globals.ArrayTest);
  51160. $core.addMethod(
  51161. $core.method({
  51162. selector: "collectionFirstTwo",
  51163. protocol: 'fixture',
  51164. fn: function (){
  51165. var self=this;
  51166. return [(1), (2)];
  51167. },
  51168. args: [],
  51169. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  51170. referencedClasses: [],
  51171. messageSends: []
  51172. }),
  51173. $globals.ArrayTest);
  51174. $core.addMethod(
  51175. $core.method({
  51176. selector: "collectionLast",
  51177. protocol: 'fixture',
  51178. fn: function (){
  51179. var self=this;
  51180. return (-4);
  51181. },
  51182. args: [],
  51183. source: "collectionLast\x0a\x09^ -4",
  51184. referencedClasses: [],
  51185. messageSends: []
  51186. }),
  51187. $globals.ArrayTest);
  51188. $core.addMethod(
  51189. $core.method({
  51190. selector: "collectionLastTwo",
  51191. protocol: 'fixture',
  51192. fn: function (){
  51193. var self=this;
  51194. return [(3), (-4)];
  51195. },
  51196. args: [],
  51197. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  51198. referencedClasses: [],
  51199. messageSends: []
  51200. }),
  51201. $globals.ArrayTest);
  51202. $core.addMethod(
  51203. $core.method({
  51204. selector: "collectionOfPrintStrings",
  51205. protocol: 'fixture',
  51206. fn: function (){
  51207. var self=this;
  51208. return ["1", "2", "3", "-4"];
  51209. },
  51210. args: [],
  51211. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  51212. referencedClasses: [],
  51213. messageSends: []
  51214. }),
  51215. $globals.ArrayTest);
  51216. $core.addMethod(
  51217. $core.method({
  51218. selector: "collectionSize",
  51219. protocol: 'fixture',
  51220. fn: function (){
  51221. var self=this;
  51222. return (4);
  51223. },
  51224. args: [],
  51225. source: "collectionSize\x0a\x09^ 4",
  51226. referencedClasses: [],
  51227. messageSends: []
  51228. }),
  51229. $globals.ArrayTest);
  51230. $core.addMethod(
  51231. $core.method({
  51232. selector: "collectionWithDuplicates",
  51233. protocol: 'fixture',
  51234. fn: function (){
  51235. var self=this;
  51236. return ["a", "b", "c", (1), (2), (1), "a", []];
  51237. },
  51238. args: [],
  51239. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  51240. referencedClasses: [],
  51241. messageSends: []
  51242. }),
  51243. $globals.ArrayTest);
  51244. $core.addMethod(
  51245. $core.method({
  51246. selector: "collectionWithNewValue",
  51247. protocol: 'fixture',
  51248. fn: function (){
  51249. var self=this;
  51250. return [(1), (2), (3), (-4), "N"];
  51251. },
  51252. args: [],
  51253. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  51254. referencedClasses: [],
  51255. messageSends: []
  51256. }),
  51257. $globals.ArrayTest);
  51258. $core.addMethod(
  51259. $core.method({
  51260. selector: "sampleNewIndex",
  51261. protocol: 'fixture',
  51262. fn: function (){
  51263. var self=this;
  51264. return (5);
  51265. },
  51266. args: [],
  51267. source: "sampleNewIndex\x0a\x09^ 5",
  51268. referencedClasses: [],
  51269. messageSends: []
  51270. }),
  51271. $globals.ArrayTest);
  51272. $core.addMethod(
  51273. $core.method({
  51274. selector: "samplesDo:",
  51275. protocol: 'fixture',
  51276. fn: function (aBlock){
  51277. var self=this;
  51278. return $core.withContext(function($ctx1) {
  51279. (
  51280. $ctx1.supercall = true,
  51281. ($globals.ArrayTest.superclass||$boot.dnu).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  51282. $ctx1.supercall = false;
  51283. $recv(aBlock)._value_value_((3),(3));
  51284. return self;
  51285. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  51286. },
  51287. args: ["aBlock"],
  51288. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  51289. referencedClasses: [],
  51290. messageSends: ["samplesDo:", "value:value:"]
  51291. }),
  51292. $globals.ArrayTest);
  51293. $core.addMethod(
  51294. $core.method({
  51295. selector: "testAdd",
  51296. protocol: 'tests',
  51297. fn: function (){
  51298. var self=this;
  51299. var array;
  51300. return $core.withContext(function($ctx1) {
  51301. array=self._collection();
  51302. $recv(array)._add_((6));
  51303. self._assert_equals_($recv(array)._last(),(6));
  51304. return self;
  51305. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  51306. },
  51307. args: [],
  51308. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  51309. referencedClasses: [],
  51310. messageSends: ["collection", "add:", "assert:equals:", "last"]
  51311. }),
  51312. $globals.ArrayTest);
  51313. $core.addMethod(
  51314. $core.method({
  51315. selector: "testAddFirst",
  51316. protocol: 'tests',
  51317. fn: function (){
  51318. var self=this;
  51319. return $core.withContext(function($ctx1) {
  51320. var $3,$2,$1;
  51321. $3=self._collection();
  51322. $recv($3)._addFirst_((0));
  51323. $2=$recv($3)._yourself();
  51324. $1=$recv($2)._first();
  51325. self._assert_equals_($1,(0));
  51326. return self;
  51327. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  51328. },
  51329. args: [],
  51330. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  51331. referencedClasses: [],
  51332. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  51333. }),
  51334. $globals.ArrayTest);
  51335. $core.addMethod(
  51336. $core.method({
  51337. selector: "testPrintString",
  51338. protocol: 'tests',
  51339. fn: function (){
  51340. var self=this;
  51341. var array;
  51342. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  51343. return $core.withContext(function($ctx1) {
  51344. var $1,$2,$3,$4,$5,$6,$7,$8;
  51345. array=$recv($Array())._new();
  51346. $1=$recv(array)._printString();
  51347. $ctx1.sendIdx["printString"]=1;
  51348. self._assert_equals_($1,"an Array ()");
  51349. $ctx1.sendIdx["assert:equals:"]=1;
  51350. $2=array;
  51351. $recv($2)._add_((1));
  51352. $ctx1.sendIdx["add:"]=1;
  51353. $3=$recv($2)._add_((3));
  51354. $ctx1.sendIdx["add:"]=2;
  51355. $4=$recv(array)._printString();
  51356. $ctx1.sendIdx["printString"]=2;
  51357. self._assert_equals_($4,"an Array (1 3)");
  51358. $ctx1.sendIdx["assert:equals:"]=2;
  51359. $recv(array)._add_("foo");
  51360. $5=$recv(array)._printString();
  51361. $ctx1.sendIdx["printString"]=3;
  51362. self._assert_equals_($5,"an Array (1 3 'foo')");
  51363. $ctx1.sendIdx["assert:equals:"]=3;
  51364. $6=array;
  51365. $recv($6)._remove_((1));
  51366. $ctx1.sendIdx["remove:"]=1;
  51367. $recv($6)._remove_((3));
  51368. $7=$recv(array)._printString();
  51369. $ctx1.sendIdx["printString"]=4;
  51370. self._assert_equals_($7,"an Array ('foo')");
  51371. $ctx1.sendIdx["assert:equals:"]=4;
  51372. $recv(array)._addLast_((3));
  51373. $ctx1.sendIdx["addLast:"]=1;
  51374. $8=$recv(array)._printString();
  51375. $ctx1.sendIdx["printString"]=5;
  51376. self._assert_equals_($8,"an Array ('foo' 3)");
  51377. $ctx1.sendIdx["assert:equals:"]=5;
  51378. $recv(array)._addLast_((3));
  51379. self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  51380. return self;
  51381. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  51382. },
  51383. args: [],
  51384. 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)'.",
  51385. referencedClasses: ["Array"],
  51386. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  51387. }),
  51388. $globals.ArrayTest);
  51389. $core.addMethod(
  51390. $core.method({
  51391. selector: "testRemove",
  51392. protocol: 'tests',
  51393. fn: function (){
  51394. var self=this;
  51395. var array;
  51396. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  51397. return $core.withContext(function($ctx1) {
  51398. array=[(1), (2), (3), (4), (5)];
  51399. $recv(array)._remove_((3));
  51400. $ctx1.sendIdx["remove:"]=1;
  51401. self._assert_equals_(array,[(1), (2), (4), (5)]);
  51402. self._should_raise_((function(){
  51403. return $core.withContext(function($ctx2) {
  51404. return $recv(array)._remove_((3));
  51405. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51406. }),$Error());
  51407. return self;
  51408. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  51409. },
  51410. args: [],
  51411. 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",
  51412. referencedClasses: ["Error"],
  51413. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  51414. }),
  51415. $globals.ArrayTest);
  51416. $core.addMethod(
  51417. $core.method({
  51418. selector: "testRemoveFromTo",
  51419. protocol: 'tests',
  51420. fn: function (){
  51421. var self=this;
  51422. return $core.withContext(function($ctx1) {
  51423. var $1,$2;
  51424. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  51425. $ctx1.sendIdx["removeFrom:to:"]=1;
  51426. self._assert_equals_($1,[(4)]);
  51427. $ctx1.sendIdx["assert:equals:"]=1;
  51428. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  51429. $ctx1.sendIdx["removeFrom:to:"]=2;
  51430. self._assert_equals_($2,[(1), (4)]);
  51431. $ctx1.sendIdx["assert:equals:"]=2;
  51432. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  51433. return self;
  51434. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  51435. },
  51436. args: [],
  51437. 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)",
  51438. referencedClasses: [],
  51439. messageSends: ["assert:equals:", "removeFrom:to:"]
  51440. }),
  51441. $globals.ArrayTest);
  51442. $core.addMethod(
  51443. $core.method({
  51444. selector: "testRemoveIndex",
  51445. protocol: 'tests',
  51446. fn: function (){
  51447. var self=this;
  51448. return $core.withContext(function($ctx1) {
  51449. var $1,$2;
  51450. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  51451. $ctx1.sendIdx["removeIndex:"]=1;
  51452. self._assert_equals_($1,[(1), (3), (4)]);
  51453. $ctx1.sendIdx["assert:equals:"]=1;
  51454. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  51455. $ctx1.sendIdx["removeIndex:"]=2;
  51456. self._assert_equals_($2,[(2), (3), (4)]);
  51457. $ctx1.sendIdx["assert:equals:"]=2;
  51458. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  51459. return self;
  51460. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  51461. },
  51462. args: [],
  51463. 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: #()",
  51464. referencedClasses: [],
  51465. messageSends: ["assert:equals:", "removeIndex:"]
  51466. }),
  51467. $globals.ArrayTest);
  51468. $core.addMethod(
  51469. $core.method({
  51470. selector: "testRemoveLast",
  51471. protocol: 'tests',
  51472. fn: function (){
  51473. var self=this;
  51474. var array;
  51475. return $core.withContext(function($ctx1) {
  51476. array=[(1), (2)];
  51477. $recv(array)._removeLast();
  51478. self._assert_equals_($recv(array)._last(),(1));
  51479. return self;
  51480. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  51481. },
  51482. args: [],
  51483. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  51484. referencedClasses: [],
  51485. messageSends: ["removeLast", "assert:equals:", "last"]
  51486. }),
  51487. $globals.ArrayTest);
  51488. $core.addMethod(
  51489. $core.method({
  51490. selector: "testReversed",
  51491. protocol: 'tests',
  51492. fn: function (){
  51493. var self=this;
  51494. var array;
  51495. return $core.withContext(function($ctx1) {
  51496. array=[(5), (4), (3), (2), (1)];
  51497. self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  51498. return self;
  51499. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  51500. },
  51501. args: [],
  51502. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  51503. referencedClasses: [],
  51504. messageSends: ["assert:equals:", "reversed"]
  51505. }),
  51506. $globals.ArrayTest);
  51507. $core.addMethod(
  51508. $core.method({
  51509. selector: "testSort",
  51510. protocol: 'tests',
  51511. fn: function (){
  51512. var self=this;
  51513. var array;
  51514. return $core.withContext(function($ctx1) {
  51515. array=[(10), (1), (5)];
  51516. $recv(array)._sort();
  51517. self._assert_equals_(array,[(1), (5), (10)]);
  51518. return self;
  51519. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  51520. },
  51521. args: [],
  51522. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  51523. referencedClasses: [],
  51524. messageSends: ["sort", "assert:equals:"]
  51525. }),
  51526. $globals.ArrayTest);
  51527. $core.addMethod(
  51528. $core.method({
  51529. selector: "collectionClass",
  51530. protocol: 'fixture',
  51531. fn: function (){
  51532. var self=this;
  51533. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  51534. return $Array();
  51535. },
  51536. args: [],
  51537. source: "collectionClass\x0a\x09^ Array",
  51538. referencedClasses: ["Array"],
  51539. messageSends: []
  51540. }),
  51541. $globals.ArrayTest.klass);
  51542. $core.addClass('StringTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  51543. $core.addMethod(
  51544. $core.method({
  51545. selector: "collection",
  51546. protocol: 'fixture',
  51547. fn: function (){
  51548. var self=this;
  51549. return "helLo";
  51550. },
  51551. args: [],
  51552. source: "collection\x0a\x09^ 'helLo'",
  51553. referencedClasses: [],
  51554. messageSends: []
  51555. }),
  51556. $globals.StringTest);
  51557. $core.addMethod(
  51558. $core.method({
  51559. selector: "collectionFirst",
  51560. protocol: 'fixture',
  51561. fn: function (){
  51562. var self=this;
  51563. return "h";
  51564. },
  51565. args: [],
  51566. source: "collectionFirst\x0a\x09^ 'h'",
  51567. referencedClasses: [],
  51568. messageSends: []
  51569. }),
  51570. $globals.StringTest);
  51571. $core.addMethod(
  51572. $core.method({
  51573. selector: "collectionFirstTwo",
  51574. protocol: 'fixture',
  51575. fn: function (){
  51576. var self=this;
  51577. return "he";
  51578. },
  51579. args: [],
  51580. source: "collectionFirstTwo\x0a\x09^ 'he'",
  51581. referencedClasses: [],
  51582. messageSends: []
  51583. }),
  51584. $globals.StringTest);
  51585. $core.addMethod(
  51586. $core.method({
  51587. selector: "collectionLast",
  51588. protocol: 'fixture',
  51589. fn: function (){
  51590. var self=this;
  51591. return "o";
  51592. },
  51593. args: [],
  51594. source: "collectionLast\x0a\x09^ 'o'",
  51595. referencedClasses: [],
  51596. messageSends: []
  51597. }),
  51598. $globals.StringTest);
  51599. $core.addMethod(
  51600. $core.method({
  51601. selector: "collectionLastTwo",
  51602. protocol: 'fixture',
  51603. fn: function (){
  51604. var self=this;
  51605. return "Lo";
  51606. },
  51607. args: [],
  51608. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  51609. referencedClasses: [],
  51610. messageSends: []
  51611. }),
  51612. $globals.StringTest);
  51613. $core.addMethod(
  51614. $core.method({
  51615. selector: "collectionOfPrintStrings",
  51616. protocol: 'fixture',
  51617. fn: function (){
  51618. var self=this;
  51619. return "'h''e''l''L''o'";
  51620. },
  51621. args: [],
  51622. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  51623. referencedClasses: [],
  51624. messageSends: []
  51625. }),
  51626. $globals.StringTest);
  51627. $core.addMethod(
  51628. $core.method({
  51629. selector: "collectionSize",
  51630. protocol: 'fixture',
  51631. fn: function (){
  51632. var self=this;
  51633. return (5);
  51634. },
  51635. args: [],
  51636. source: "collectionSize\x0a\x09^ 5",
  51637. referencedClasses: [],
  51638. messageSends: []
  51639. }),
  51640. $globals.StringTest);
  51641. $core.addMethod(
  51642. $core.method({
  51643. selector: "collectionWithDuplicates",
  51644. protocol: 'fixture',
  51645. fn: function (){
  51646. var self=this;
  51647. return "abbaerten";
  51648. },
  51649. args: [],
  51650. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  51651. referencedClasses: [],
  51652. messageSends: []
  51653. }),
  51654. $globals.StringTest);
  51655. $core.addMethod(
  51656. $core.method({
  51657. selector: "collectionWithNewValue",
  51658. protocol: 'fixture',
  51659. fn: function (){
  51660. var self=this;
  51661. return "helLoN";
  51662. },
  51663. args: [],
  51664. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  51665. referencedClasses: [],
  51666. messageSends: []
  51667. }),
  51668. $globals.StringTest);
  51669. $core.addMethod(
  51670. $core.method({
  51671. selector: "sampleNewValueAsCollection",
  51672. protocol: 'fixture',
  51673. fn: function (){
  51674. var self=this;
  51675. return "N";
  51676. },
  51677. args: [],
  51678. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  51679. referencedClasses: [],
  51680. messageSends: []
  51681. }),
  51682. $globals.StringTest);
  51683. $core.addMethod(
  51684. $core.method({
  51685. selector: "samplesDo:",
  51686. protocol: 'fixture',
  51687. fn: function (aBlock){
  51688. var self=this;
  51689. return $core.withContext(function($ctx1) {
  51690. (
  51691. $ctx1.supercall = true,
  51692. ($globals.StringTest.superclass||$boot.dnu).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  51693. $ctx1.supercall = false;
  51694. $recv(aBlock)._value_value_((3),"l");
  51695. return self;
  51696. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  51697. },
  51698. args: ["aBlock"],
  51699. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  51700. referencedClasses: [],
  51701. messageSends: ["samplesDo:", "value:value:"]
  51702. }),
  51703. $globals.StringTest);
  51704. $core.addMethod(
  51705. $core.method({
  51706. selector: "testAddAll",
  51707. protocol: 'tests',
  51708. fn: function (){
  51709. var self=this;
  51710. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  51711. return $core.withContext(function($ctx1) {
  51712. var $1;
  51713. self._should_raise_((function(){
  51714. return $core.withContext(function($ctx2) {
  51715. $1=self._collection();
  51716. $ctx2.sendIdx["collection"]=1;
  51717. return $recv($1)._addAll_(self._collection());
  51718. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51719. }),$Error());
  51720. return self;
  51721. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  51722. },
  51723. args: [],
  51724. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  51725. referencedClasses: ["Error"],
  51726. messageSends: ["should:raise:", "addAll:", "collection"]
  51727. }),
  51728. $globals.StringTest);
  51729. $core.addMethod(
  51730. $core.method({
  51731. selector: "testAddRemove",
  51732. protocol: 'tests',
  51733. fn: function (){
  51734. var self=this;
  51735. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  51736. return $core.withContext(function($ctx1) {
  51737. self._should_raise_((function(){
  51738. return $core.withContext(function($ctx2) {
  51739. return "hello"._add_("a");
  51740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51741. }),$Error());
  51742. $ctx1.sendIdx["should:raise:"]=1;
  51743. self._should_raise_((function(){
  51744. return $core.withContext(function($ctx2) {
  51745. return "hello"._remove_("h");
  51746. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51747. }),$Error());
  51748. return self;
  51749. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  51750. },
  51751. args: [],
  51752. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  51753. referencedClasses: ["Error"],
  51754. messageSends: ["should:raise:", "add:", "remove:"]
  51755. }),
  51756. $globals.StringTest);
  51757. $core.addMethod(
  51758. $core.method({
  51759. selector: "testAsArray",
  51760. protocol: 'tests',
  51761. fn: function (){
  51762. var self=this;
  51763. return $core.withContext(function($ctx1) {
  51764. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  51765. return self;
  51766. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  51767. },
  51768. args: [],
  51769. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  51770. referencedClasses: [],
  51771. messageSends: ["assert:equals:", "asArray"]
  51772. }),
  51773. $globals.StringTest);
  51774. $core.addMethod(
  51775. $core.method({
  51776. selector: "testAsLowerCase",
  51777. protocol: 'tests',
  51778. fn: function (){
  51779. var self=this;
  51780. return $core.withContext(function($ctx1) {
  51781. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  51782. return self;
  51783. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  51784. },
  51785. args: [],
  51786. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  51787. referencedClasses: [],
  51788. messageSends: ["assert:equals:", "asLowercase"]
  51789. }),
  51790. $globals.StringTest);
  51791. $core.addMethod(
  51792. $core.method({
  51793. selector: "testAsNumber",
  51794. protocol: 'tests',
  51795. fn: function (){
  51796. var self=this;
  51797. return $core.withContext(function($ctx1) {
  51798. var $1,$2;
  51799. $1="3"._asNumber();
  51800. $ctx1.sendIdx["asNumber"]=1;
  51801. self._assert_equals_($1,(3));
  51802. $ctx1.sendIdx["assert:equals:"]=1;
  51803. $2="-3"._asNumber();
  51804. $ctx1.sendIdx["asNumber"]=2;
  51805. self._assert_equals_($2,(-3));
  51806. $ctx1.sendIdx["assert:equals:"]=2;
  51807. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  51808. return self;
  51809. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  51810. },
  51811. args: [],
  51812. 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.",
  51813. referencedClasses: [],
  51814. messageSends: ["assert:equals:", "asNumber"]
  51815. }),
  51816. $globals.StringTest);
  51817. $core.addMethod(
  51818. $core.method({
  51819. selector: "testAsUpperCase",
  51820. protocol: 'tests',
  51821. fn: function (){
  51822. var self=this;
  51823. return $core.withContext(function($ctx1) {
  51824. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  51825. return self;
  51826. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  51827. },
  51828. args: [],
  51829. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  51830. referencedClasses: [],
  51831. messageSends: ["assert:equals:", "asUppercase"]
  51832. }),
  51833. $globals.StringTest);
  51834. $core.addMethod(
  51835. $core.method({
  51836. selector: "testAsciiValue",
  51837. protocol: 'tests',
  51838. fn: function (){
  51839. var self=this;
  51840. var characterA,characterU;
  51841. return $core.withContext(function($ctx1) {
  51842. var $1;
  51843. characterA="A";
  51844. characterU="U";
  51845. $1=$recv(characterA)._asciiValue();
  51846. $ctx1.sendIdx["asciiValue"]=1;
  51847. self._assert_equals_($1,(65));
  51848. $ctx1.sendIdx["assert:equals:"]=1;
  51849. self._assert_equals_($recv(characterU)._asciiValue(),(85));
  51850. return self;
  51851. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  51852. },
  51853. args: [],
  51854. 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",
  51855. referencedClasses: [],
  51856. messageSends: ["assert:equals:", "asciiValue"]
  51857. }),
  51858. $globals.StringTest);
  51859. $core.addMethod(
  51860. $core.method({
  51861. selector: "testAtIfAbsentPut",
  51862. protocol: 'tests',
  51863. fn: function (){
  51864. var self=this;
  51865. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  51866. return $core.withContext(function($ctx1) {
  51867. self._should_raise_((function(){
  51868. return $core.withContext(function($ctx2) {
  51869. return "hello"._at_ifAbsentPut_((6),(function(){
  51870. return "a";
  51871. }));
  51872. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51873. }),$Error());
  51874. return self;
  51875. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  51876. },
  51877. args: [],
  51878. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  51879. referencedClasses: ["Error"],
  51880. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  51881. }),
  51882. $globals.StringTest);
  51883. $core.addMethod(
  51884. $core.method({
  51885. selector: "testAtPut",
  51886. protocol: 'tests',
  51887. fn: function (){
  51888. var self=this;
  51889. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  51890. return $core.withContext(function($ctx1) {
  51891. self._should_raise_((function(){
  51892. return $core.withContext(function($ctx2) {
  51893. return "hello"._at_put_((1),"a");
  51894. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51895. }),$Error());
  51896. return self;
  51897. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  51898. },
  51899. args: [],
  51900. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  51901. referencedClasses: ["Error"],
  51902. messageSends: ["should:raise:", "at:put:"]
  51903. }),
  51904. $globals.StringTest);
  51905. $core.addMethod(
  51906. $core.method({
  51907. selector: "testCapitalized",
  51908. protocol: 'tests',
  51909. fn: function (){
  51910. var self=this;
  51911. return $core.withContext(function($ctx1) {
  51912. var $1,$2,$3;
  51913. $1="test"._capitalized();
  51914. $ctx1.sendIdx["capitalized"]=1;
  51915. self._assert_equals_($1,"Test");
  51916. $ctx1.sendIdx["assert:equals:"]=1;
  51917. $2="Test"._capitalized();
  51918. $ctx1.sendIdx["capitalized"]=2;
  51919. self._assert_equals_($2,"Test");
  51920. $ctx1.sendIdx["assert:equals:"]=2;
  51921. self._assert_equals_(""._capitalized(),"");
  51922. $ctx1.sendIdx["assert:equals:"]=3;
  51923. $3="Test"._isCapitalized();
  51924. $ctx1.sendIdx["isCapitalized"]=1;
  51925. self._assert_equals_($3,true);
  51926. $ctx1.sendIdx["assert:equals:"]=4;
  51927. self._assert_equals_("test"._isCapitalized(),false);
  51928. return self;
  51929. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  51930. },
  51931. args: [],
  51932. 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.",
  51933. referencedClasses: [],
  51934. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  51935. }),
  51936. $globals.StringTest);
  51937. $core.addMethod(
  51938. $core.method({
  51939. selector: "testCharCodeAt",
  51940. protocol: 'tests',
  51941. fn: function (){
  51942. var self=this;
  51943. return $core.withContext(function($ctx1) {
  51944. var $1,$2,$3,$4,$5;
  51945. $1="jackie"._charCodeAt_((1));
  51946. $ctx1.sendIdx["charCodeAt:"]=1;
  51947. self._assert_equals_($1,(106));
  51948. $ctx1.sendIdx["assert:equals:"]=1;
  51949. $2="jackie"._charCodeAt_((2));
  51950. $ctx1.sendIdx["charCodeAt:"]=2;
  51951. self._assert_equals_($2,(97));
  51952. $ctx1.sendIdx["assert:equals:"]=2;
  51953. $3="jackie"._charCodeAt_((3));
  51954. $ctx1.sendIdx["charCodeAt:"]=3;
  51955. self._assert_equals_($3,(99));
  51956. $ctx1.sendIdx["assert:equals:"]=3;
  51957. $4="jackie"._charCodeAt_((4));
  51958. $ctx1.sendIdx["charCodeAt:"]=4;
  51959. self._assert_equals_($4,(107));
  51960. $ctx1.sendIdx["assert:equals:"]=4;
  51961. $5="jackie"._charCodeAt_((5));
  51962. $ctx1.sendIdx["charCodeAt:"]=5;
  51963. self._assert_equals_($5,(105));
  51964. $ctx1.sendIdx["assert:equals:"]=5;
  51965. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  51966. return self;
  51967. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  51968. },
  51969. args: [],
  51970. 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",
  51971. referencedClasses: [],
  51972. messageSends: ["assert:equals:", "charCodeAt:"]
  51973. }),
  51974. $globals.StringTest);
  51975. $core.addMethod(
  51976. $core.method({
  51977. selector: "testCopyFromTo",
  51978. protocol: 'tests',
  51979. fn: function (){
  51980. var self=this;
  51981. return $core.withContext(function($ctx1) {
  51982. var $1;
  51983. $1="jackie"._copyFrom_to_((1),(3));
  51984. $ctx1.sendIdx["copyFrom:to:"]=1;
  51985. self._assert_equals_($1,"jac");
  51986. $ctx1.sendIdx["assert:equals:"]=1;
  51987. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  51988. return self;
  51989. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  51990. },
  51991. args: [],
  51992. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  51993. referencedClasses: [],
  51994. messageSends: ["assert:equals:", "copyFrom:to:"]
  51995. }),
  51996. $globals.StringTest);
  51997. $core.addMethod(
  51998. $core.method({
  51999. selector: "testCopySeparates",
  52000. protocol: 'tests',
  52001. fn: function (){
  52002. var self=this;
  52003. return $core.withContext(function($ctx1) {
  52004. var $3,$2,$1;
  52005. $3=self._collection();
  52006. $ctx1.sendIdx["collection"]=1;
  52007. $2=$recv($3)._copy();
  52008. $1=$recv($2).__eq_eq(self._collection());
  52009. self._assert_($1);
  52010. return self;
  52011. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
  52012. },
  52013. args: [],
  52014. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  52015. referencedClasses: [],
  52016. messageSends: ["assert:", "==", "copy", "collection"]
  52017. }),
  52018. $globals.StringTest);
  52019. $core.addMethod(
  52020. $core.method({
  52021. selector: "testCopyWithoutAll",
  52022. protocol: 'tests',
  52023. fn: function (){
  52024. var self=this;
  52025. return $core.withContext(function($ctx1) {
  52026. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  52027. return self;
  52028. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  52029. },
  52030. args: [],
  52031. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  52032. referencedClasses: [],
  52033. messageSends: ["assert:equals:", "copyWithoutAll:"]
  52034. }),
  52035. $globals.StringTest);
  52036. $core.addMethod(
  52037. $core.method({
  52038. selector: "testEquality",
  52039. protocol: 'tests',
  52040. fn: function (){
  52041. var self=this;
  52042. return $core.withContext(function($ctx1) {
  52043. var $1,$2,$3;
  52044. self._assert_equals_("hello","hello");
  52045. $ctx1.sendIdx["assert:equals:"]=1;
  52046. $1="hello".__eq("world");
  52047. $ctx1.sendIdx["="]=1;
  52048. self._deny_($1);
  52049. $ctx1.sendIdx["deny:"]=1;
  52050. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  52051. })));
  52052. $ctx1.sendIdx["="]=2;
  52053. self._deny_($2);
  52054. $ctx1.sendIdx["deny:"]=2;
  52055. $3="hello"._yourself();
  52056. $ctx1.sendIdx["yourself"]=1;
  52057. self._assert_equals_("hello",$3);
  52058. $ctx1.sendIdx["assert:equals:"]=2;
  52059. self._assert_equals_("hello"._yourself(),"hello");
  52060. self._deny_("".__eq((0)));
  52061. return self;
  52062. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  52063. },
  52064. args: [],
  52065. 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",
  52066. referencedClasses: [],
  52067. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  52068. }),
  52069. $globals.StringTest);
  52070. $core.addMethod(
  52071. $core.method({
  52072. selector: "testIdentity",
  52073. protocol: 'tests',
  52074. fn: function (){
  52075. var self=this;
  52076. return $core.withContext(function($ctx1) {
  52077. var $1,$2,$4,$3,$5;
  52078. $1="hello".__eq_eq("hello");
  52079. $ctx1.sendIdx["=="]=1;
  52080. self._assert_($1);
  52081. $ctx1.sendIdx["assert:"]=1;
  52082. $2="hello".__eq_eq("world");
  52083. $ctx1.sendIdx["=="]=2;
  52084. self._deny_($2);
  52085. $ctx1.sendIdx["deny:"]=1;
  52086. $4="hello"._yourself();
  52087. $ctx1.sendIdx["yourself"]=1;
  52088. $3="hello".__eq_eq($4);
  52089. $ctx1.sendIdx["=="]=3;
  52090. self._assert_($3);
  52091. $ctx1.sendIdx["assert:"]=2;
  52092. $5=$recv("hello"._yourself()).__eq_eq("hello");
  52093. $ctx1.sendIdx["=="]=4;
  52094. self._assert_($5);
  52095. self._deny_("".__eq_eq((0)));
  52096. return self;
  52097. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  52098. },
  52099. args: [],
  52100. 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",
  52101. referencedClasses: [],
  52102. messageSends: ["assert:", "==", "deny:", "yourself"]
  52103. }),
  52104. $globals.StringTest);
  52105. $core.addMethod(
  52106. $core.method({
  52107. selector: "testIncludesSubString",
  52108. protocol: 'tests',
  52109. fn: function (){
  52110. var self=this;
  52111. return $core.withContext(function($ctx1) {
  52112. var $1;
  52113. $1="amber"._includesSubString_("ber");
  52114. $ctx1.sendIdx["includesSubString:"]=1;
  52115. self._assert_($1);
  52116. self._deny_("amber"._includesSubString_("zork"));
  52117. return self;
  52118. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  52119. },
  52120. args: [],
  52121. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  52122. referencedClasses: [],
  52123. messageSends: ["assert:", "includesSubString:", "deny:"]
  52124. }),
  52125. $globals.StringTest);
  52126. $core.addMethod(
  52127. $core.method({
  52128. selector: "testIndexOfStartingAtWithNull",
  52129. protocol: 'tests',
  52130. fn: function (){
  52131. var self=this;
  52132. return self;
  52133. },
  52134. args: [],
  52135. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  52136. referencedClasses: [],
  52137. messageSends: []
  52138. }),
  52139. $globals.StringTest);
  52140. $core.addMethod(
  52141. $core.method({
  52142. selector: "testIndexOfWithNull",
  52143. protocol: 'tests',
  52144. fn: function (){
  52145. var self=this;
  52146. return self;
  52147. },
  52148. args: [],
  52149. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  52150. referencedClasses: [],
  52151. messageSends: []
  52152. }),
  52153. $globals.StringTest);
  52154. $core.addMethod(
  52155. $core.method({
  52156. selector: "testIsVowel",
  52157. protocol: 'tests',
  52158. fn: function (){
  52159. var self=this;
  52160. var vowel,consonant;
  52161. return $core.withContext(function($ctx1) {
  52162. var $1;
  52163. vowel="u";
  52164. consonant="z";
  52165. $1=$recv(vowel)._isVowel();
  52166. $ctx1.sendIdx["isVowel"]=1;
  52167. self._assert_equals_($1,true);
  52168. $ctx1.sendIdx["assert:equals:"]=1;
  52169. self._assert_equals_($recv(consonant)._isVowel(),false);
  52170. return self;
  52171. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  52172. },
  52173. args: [],
  52174. 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",
  52175. referencedClasses: [],
  52176. messageSends: ["assert:equals:", "isVowel"]
  52177. }),
  52178. $globals.StringTest);
  52179. $core.addMethod(
  52180. $core.method({
  52181. selector: "testJoin",
  52182. protocol: 'tests',
  52183. fn: function (){
  52184. var self=this;
  52185. return $core.withContext(function($ctx1) {
  52186. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  52187. return self;
  52188. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  52189. },
  52190. args: [],
  52191. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  52192. referencedClasses: [],
  52193. messageSends: ["assert:equals:", "join:"]
  52194. }),
  52195. $globals.StringTest);
  52196. $core.addMethod(
  52197. $core.method({
  52198. selector: "testRemoveAll",
  52199. protocol: 'tests',
  52200. fn: function (){
  52201. var self=this;
  52202. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  52203. return $core.withContext(function($ctx1) {
  52204. self._should_raise_((function(){
  52205. return $core.withContext(function($ctx2) {
  52206. return $recv(self._collection())._removeAll();
  52207. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52208. }),$Error());
  52209. return self;
  52210. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  52211. },
  52212. args: [],
  52213. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  52214. referencedClasses: ["Error"],
  52215. messageSends: ["should:raise:", "removeAll", "collection"]
  52216. }),
  52217. $globals.StringTest);
  52218. $core.addMethod(
  52219. $core.method({
  52220. selector: "testReversed",
  52221. protocol: 'tests',
  52222. fn: function (){
  52223. var self=this;
  52224. return $core.withContext(function($ctx1) {
  52225. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  52226. return self;
  52227. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  52228. },
  52229. args: [],
  52230. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  52231. referencedClasses: [],
  52232. messageSends: ["assert:equals:", "reversed"]
  52233. }),
  52234. $globals.StringTest);
  52235. $core.addMethod(
  52236. $core.method({
  52237. selector: "testStreamContents",
  52238. protocol: 'tests',
  52239. fn: function (){
  52240. var self=this;
  52241. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  52242. return $core.withContext(function($ctx1) {
  52243. self._assert_equals_($recv($String())._streamContents_((function(aStream){
  52244. return $core.withContext(function($ctx2) {
  52245. $recv(aStream)._nextPutAll_("hello");
  52246. $ctx2.sendIdx["nextPutAll:"]=1;
  52247. $recv(aStream)._space();
  52248. return $recv(aStream)._nextPutAll_("world");
  52249. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  52250. })),"hello world");
  52251. return self;
  52252. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  52253. },
  52254. args: [],
  52255. 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'",
  52256. referencedClasses: ["String"],
  52257. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  52258. }),
  52259. $globals.StringTest);
  52260. $core.addMethod(
  52261. $core.method({
  52262. selector: "testSubStrings",
  52263. protocol: 'tests',
  52264. fn: function (){
  52265. var self=this;
  52266. return $core.withContext(function($ctx1) {
  52267. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  52268. return self;
  52269. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  52270. },
  52271. args: [],
  52272. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  52273. referencedClasses: [],
  52274. messageSends: ["assert:equals:", "subStrings:"]
  52275. }),
  52276. $globals.StringTest);
  52277. $core.addMethod(
  52278. $core.method({
  52279. selector: "testTrim",
  52280. protocol: 'tests',
  52281. fn: function (){
  52282. var self=this;
  52283. return $core.withContext(function($ctx1) {
  52284. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  52285. $ctx1.sendIdx["assert:equals:"]=1;
  52286. self._assert_equals_("jackie "._trimRight(),"jackie");
  52287. return self;
  52288. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  52289. },
  52290. args: [],
  52291. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  52292. referencedClasses: [],
  52293. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  52294. }),
  52295. $globals.StringTest);
  52296. $core.addMethod(
  52297. $core.method({
  52298. selector: "testValue",
  52299. protocol: 'tests',
  52300. fn: function (){
  52301. var self=this;
  52302. return $core.withContext(function($ctx1) {
  52303. self._assert_equals_("asString"._value_((1)),"1");
  52304. $ctx1.sendIdx["assert:equals:"]=1;
  52305. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  52306. return self;
  52307. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  52308. },
  52309. args: [],
  52310. 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')",
  52311. referencedClasses: [],
  52312. messageSends: ["assert:equals:", "value:", "collect:"]
  52313. }),
  52314. $globals.StringTest);
  52315. $core.addMethod(
  52316. $core.method({
  52317. selector: "collectionClass",
  52318. protocol: 'fixture',
  52319. fn: function (){
  52320. var self=this;
  52321. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  52322. return $String();
  52323. },
  52324. args: [],
  52325. source: "collectionClass\x0a\x09^ String",
  52326. referencedClasses: ["String"],
  52327. messageSends: []
  52328. }),
  52329. $globals.StringTest.klass);
  52330. $core.addClass('SetTest', $globals.CollectionTest, [], 'Kernel-Tests');
  52331. $core.addMethod(
  52332. $core.method({
  52333. selector: "collection",
  52334. protocol: 'fixture',
  52335. fn: function (){
  52336. var self=this;
  52337. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  52338. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  52339. return $core.withContext(function($ctx1) {
  52340. var $1;
  52341. $1=$recv($Set())._new();
  52342. $recv($1)._add_($Smalltalk());
  52343. $ctx1.sendIdx["add:"]=1;
  52344. $recv($1)._add_(nil);
  52345. $ctx1.sendIdx["add:"]=2;
  52346. $recv($1)._add_((3).__at((3)));
  52347. $ctx1.sendIdx["add:"]=3;
  52348. $recv($1)._add_(false);
  52349. $ctx1.sendIdx["add:"]=4;
  52350. $recv($1)._add_(self["@sampleBlock"]);
  52351. return $recv($1)._yourself();
  52352. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  52353. },
  52354. args: [],
  52355. source: "collection\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: false;\x0a\x09\x09add: sampleBlock;\x0a\x09\x09yourself",
  52356. referencedClasses: ["Set", "Smalltalk"],
  52357. messageSends: ["add:", "new", "@", "yourself"]
  52358. }),
  52359. $globals.SetTest);
  52360. $core.addMethod(
  52361. $core.method({
  52362. selector: "collectionOfPrintStrings",
  52363. protocol: 'fixture',
  52364. fn: function (){
  52365. var self=this;
  52366. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  52367. return $core.withContext(function($ctx1) {
  52368. var $1;
  52369. $1=$recv($Set())._new();
  52370. $recv($1)._add_("a SmalltalkImage");
  52371. $ctx1.sendIdx["add:"]=1;
  52372. $recv($1)._add_("nil");
  52373. $ctx1.sendIdx["add:"]=2;
  52374. $recv($1)._add_("3@3");
  52375. $ctx1.sendIdx["add:"]=3;
  52376. $recv($1)._add_("false");
  52377. $ctx1.sendIdx["add:"]=4;
  52378. $recv($1)._add_("a BlockClosure");
  52379. return $recv($1)._yourself();
  52380. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  52381. },
  52382. args: [],
  52383. source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: 'a SmalltalkImage';\x0a\x09\x09add: 'nil';\x0a\x09\x09add: '3@3';\x0a\x09\x09add: 'false';\x0a\x09\x09add: 'a BlockClosure';\x0a\x09\x09yourself",
  52384. referencedClasses: ["Set"],
  52385. messageSends: ["add:", "new", "yourself"]
  52386. }),
  52387. $globals.SetTest);
  52388. $core.addMethod(
  52389. $core.method({
  52390. selector: "collectionSize",
  52391. protocol: 'fixture',
  52392. fn: function (){
  52393. var self=this;
  52394. return (5);
  52395. },
  52396. args: [],
  52397. source: "collectionSize\x0a\x09^ 5",
  52398. referencedClasses: [],
  52399. messageSends: []
  52400. }),
  52401. $globals.SetTest);
  52402. $core.addMethod(
  52403. $core.method({
  52404. selector: "collectionWithDuplicates",
  52405. protocol: 'fixture',
  52406. fn: function (){
  52407. var self=this;
  52408. return $core.withContext(function($ctx1) {
  52409. var $1;
  52410. $1=self._collection();
  52411. $recv($1)._add_((0));
  52412. return $recv($1)._yourself();
  52413. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  52414. },
  52415. args: [],
  52416. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  52417. referencedClasses: [],
  52418. messageSends: ["add:", "collection", "yourself"]
  52419. }),
  52420. $globals.SetTest);
  52421. $core.addMethod(
  52422. $core.method({
  52423. selector: "collectionWithNewValue",
  52424. protocol: 'fixture',
  52425. fn: function (){
  52426. var self=this;
  52427. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  52428. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  52429. return $core.withContext(function($ctx1) {
  52430. var $1;
  52431. $1=$recv($Set())._new();
  52432. $recv($1)._add_($Smalltalk());
  52433. $ctx1.sendIdx["add:"]=1;
  52434. $recv($1)._add_(nil);
  52435. $ctx1.sendIdx["add:"]=2;
  52436. $recv($1)._add_((3).__at((3)));
  52437. $ctx1.sendIdx["add:"]=3;
  52438. $recv($1)._add_("N");
  52439. $ctx1.sendIdx["add:"]=4;
  52440. $recv($1)._add_(false);
  52441. $ctx1.sendIdx["add:"]=5;
  52442. $recv($1)._add_(self["@sampleBlock"]);
  52443. return $recv($1)._yourself();
  52444. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  52445. },
  52446. args: [],
  52447. source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: false;\x0a\x09\x09add: sampleBlock;\x0a\x09\x09yourself",
  52448. referencedClasses: ["Set", "Smalltalk"],
  52449. messageSends: ["add:", "new", "@", "yourself"]
  52450. }),
  52451. $globals.SetTest);
  52452. $core.addMethod(
  52453. $core.method({
  52454. selector: "testAddAll",
  52455. protocol: 'tests',
  52456. fn: function (){
  52457. var self=this;
  52458. return $core.withContext(function($ctx1) {
  52459. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  52460. (
  52461. $ctx1.supercall = true,
  52462. ($globals.SetTest.superclass||$boot.dnu).fn.prototype._testAddAll.apply($recv(self), []));
  52463. $ctx1.supercall = false;
  52464. $2=self._collection();
  52465. $ctx1.sendIdx["collection"]=1;
  52466. $3=self._collection();
  52467. $ctx1.sendIdx["collection"]=2;
  52468. $recv($2)._addAll_($3);
  52469. $ctx1.sendIdx["addAll:"]=1;
  52470. $4=$recv($2)._yourself();
  52471. $ctx1.sendIdx["yourself"]=1;
  52472. $1=$4;
  52473. $5=self._collection();
  52474. $ctx1.sendIdx["collection"]=3;
  52475. self._assert_equals_($1,$5);
  52476. $ctx1.sendIdx["assert:equals:"]=1;
  52477. $7=self._collection();
  52478. $ctx1.sendIdx["collection"]=4;
  52479. $8=self._collectionWithNewValue();
  52480. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52481. $recv($7)._addAll_($8);
  52482. $ctx1.sendIdx["addAll:"]=2;
  52483. $9=$recv($7)._yourself();
  52484. $ctx1.sendIdx["yourself"]=2;
  52485. $6=$9;
  52486. $10=self._collectionWithNewValue();
  52487. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52488. self._assert_equals_($6,$10);
  52489. $ctx1.sendIdx["assert:equals:"]=2;
  52490. $12=self._collectionWithNewValue();
  52491. $ctx1.sendIdx["collectionWithNewValue"]=3;
  52492. $recv($12)._addAll_(self._collection());
  52493. $11=$recv($12)._yourself();
  52494. self._assert_equals_($11,self._collectionWithNewValue());
  52495. return self;
  52496. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  52497. },
  52498. args: [],
  52499. 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",
  52500. referencedClasses: [],
  52501. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  52502. }),
  52503. $globals.SetTest);
  52504. $core.addMethod(
  52505. $core.method({
  52506. selector: "testAddRemove",
  52507. protocol: 'tests',
  52508. fn: function (){
  52509. var self=this;
  52510. var set;
  52511. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  52512. return $core.withContext(function($ctx1) {
  52513. var $1,$2;
  52514. set=$recv($Set())._new();
  52515. self._assert_($recv(set)._isEmpty());
  52516. $ctx1.sendIdx["assert:"]=1;
  52517. $recv(set)._add_((3));
  52518. $ctx1.sendIdx["add:"]=1;
  52519. $1=$recv(set)._includes_((3));
  52520. $ctx1.sendIdx["includes:"]=1;
  52521. self._assert_($1);
  52522. $ctx1.sendIdx["assert:"]=2;
  52523. $recv(set)._add_((5));
  52524. $2=$recv(set)._includes_((5));
  52525. $ctx1.sendIdx["includes:"]=2;
  52526. self._assert_($2);
  52527. $recv(set)._remove_((3));
  52528. self._deny_($recv(set)._includes_((3)));
  52529. return self;
  52530. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  52531. },
  52532. args: [],
  52533. 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)",
  52534. referencedClasses: ["Set"],
  52535. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  52536. }),
  52537. $globals.SetTest);
  52538. $core.addMethod(
  52539. $core.method({
  52540. selector: "testAt",
  52541. protocol: 'tests',
  52542. fn: function (){
  52543. var self=this;
  52544. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  52545. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  52546. return $core.withContext(function($ctx1) {
  52547. self._should_raise_((function(){
  52548. return $core.withContext(function($ctx2) {
  52549. return $recv($recv($Set())._new())._at_put_((1),(2));
  52550. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52551. }),$Error());
  52552. return self;
  52553. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  52554. },
  52555. args: [],
  52556. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  52557. referencedClasses: ["Set", "Error"],
  52558. messageSends: ["should:raise:", "at:put:", "new"]
  52559. }),
  52560. $globals.SetTest);
  52561. $core.addMethod(
  52562. $core.method({
  52563. selector: "testCollect",
  52564. protocol: 'tests',
  52565. fn: function (){
  52566. var self=this;
  52567. return $core.withContext(function($ctx1) {
  52568. var $2,$1;
  52569. (
  52570. $ctx1.supercall = true,
  52571. ($globals.SetTest.superclass||$boot.dnu).fn.prototype._testCollect.apply($recv(self), []));
  52572. $ctx1.supercall = false;
  52573. $2=[(5), (6), (8)]._asSet();
  52574. $ctx1.sendIdx["asSet"]=1;
  52575. $1=$recv($2)._collect_((function(x){
  52576. return $core.withContext(function($ctx2) {
  52577. return $recv(x).__backslash_backslash((3));
  52578. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  52579. }));
  52580. self._assert_equals_($1,[(0), (2)]._asSet());
  52581. return self;
  52582. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  52583. },
  52584. args: [],
  52585. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  52586. referencedClasses: [],
  52587. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  52588. }),
  52589. $globals.SetTest);
  52590. $core.addMethod(
  52591. $core.method({
  52592. selector: "testComma",
  52593. protocol: 'tests',
  52594. fn: function (){
  52595. var self=this;
  52596. return $core.withContext(function($ctx1) {
  52597. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  52598. (
  52599. $ctx1.supercall = true,
  52600. ($globals.SetTest.superclass||$boot.dnu).fn.prototype._testComma.apply($recv(self), []));
  52601. $ctx1.supercall = false;
  52602. $2=self._collection();
  52603. $ctx1.sendIdx["collection"]=1;
  52604. $3=self._collection();
  52605. $ctx1.sendIdx["collection"]=2;
  52606. $1=$recv($2).__comma($3);
  52607. $ctx1.sendIdx[","]=1;
  52608. $4=self._collection();
  52609. $ctx1.sendIdx["collection"]=3;
  52610. self._assert_equals_($1,$4);
  52611. $ctx1.sendIdx["assert:equals:"]=1;
  52612. $6=self._collection();
  52613. $ctx1.sendIdx["collection"]=4;
  52614. $7=self._collectionWithNewValue();
  52615. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52616. $5=$recv($6).__comma($7);
  52617. $ctx1.sendIdx[","]=2;
  52618. $8=self._collectionWithNewValue();
  52619. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52620. self._assert_equals_($5,$8);
  52621. $ctx1.sendIdx["assert:equals:"]=2;
  52622. $10=self._collectionWithNewValue();
  52623. $ctx1.sendIdx["collectionWithNewValue"]=3;
  52624. $9=$recv($10).__comma(self._collection());
  52625. self._assert_equals_($9,self._collectionWithNewValue());
  52626. return self;
  52627. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  52628. },
  52629. args: [],
  52630. 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",
  52631. referencedClasses: [],
  52632. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  52633. }),
  52634. $globals.SetTest);
  52635. $core.addMethod(
  52636. $core.method({
  52637. selector: "testComparing",
  52638. protocol: 'tests',
  52639. fn: function (){
  52640. var self=this;
  52641. return $core.withContext(function($ctx1) {
  52642. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  52643. $1=[(0), (2)]._asSet();
  52644. $ctx1.sendIdx["asSet"]=1;
  52645. $2=[(0), (2)]._asSet();
  52646. $ctx1.sendIdx["asSet"]=2;
  52647. self._assert_equals_($1,$2);
  52648. $ctx1.sendIdx["assert:equals:"]=1;
  52649. $3=[(2), (0)]._asSet();
  52650. $ctx1.sendIdx["asSet"]=3;
  52651. $4=[(0), (2)]._asSet();
  52652. $ctx1.sendIdx["asSet"]=4;
  52653. self._assert_equals_($3,$4);
  52654. $6=[(0), (2), (3)]._asSet();
  52655. $ctx1.sendIdx["asSet"]=5;
  52656. $7=[(0), (2)]._asSet();
  52657. $ctx1.sendIdx["asSet"]=6;
  52658. $5=$recv($6).__eq($7);
  52659. $ctx1.sendIdx["="]=1;
  52660. self._deny_($5);
  52661. $ctx1.sendIdx["deny:"]=1;
  52662. $9=[(1), (2)]._asSet();
  52663. $ctx1.sendIdx["asSet"]=7;
  52664. $8=$recv($9).__eq([(0), (2)]._asSet());
  52665. self._deny_($8);
  52666. return self;
  52667. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  52668. },
  52669. args: [],
  52670. 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",
  52671. referencedClasses: [],
  52672. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  52673. }),
  52674. $globals.SetTest);
  52675. $core.addMethod(
  52676. $core.method({
  52677. selector: "testPrintString",
  52678. protocol: 'tests',
  52679. fn: function (){
  52680. var self=this;
  52681. var set;
  52682. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  52683. return $core.withContext(function($ctx1) {
  52684. var $1,$2,$3,$4,$5,$6,$7,$8;
  52685. set=$recv($Set())._new();
  52686. $1=$recv(set)._printString();
  52687. $ctx1.sendIdx["printString"]=1;
  52688. self._assert_equals_($1,"a Set ()");
  52689. $ctx1.sendIdx["assert:equals:"]=1;
  52690. $2=set;
  52691. $recv($2)._add_((1));
  52692. $ctx1.sendIdx["add:"]=1;
  52693. $3=$recv($2)._add_((3));
  52694. $ctx1.sendIdx["add:"]=2;
  52695. $4=$recv(set)._printString();
  52696. $ctx1.sendIdx["printString"]=2;
  52697. self._assert_equals_($4,"a Set (1 3)");
  52698. $ctx1.sendIdx["assert:equals:"]=2;
  52699. $recv(set)._add_("foo");
  52700. $ctx1.sendIdx["add:"]=3;
  52701. $5=$recv(set)._printString();
  52702. $ctx1.sendIdx["printString"]=3;
  52703. self._assert_equals_($5,"a Set (1 3 'foo')");
  52704. $ctx1.sendIdx["assert:equals:"]=3;
  52705. $6=set;
  52706. $recv($6)._remove_((1));
  52707. $ctx1.sendIdx["remove:"]=1;
  52708. $recv($6)._remove_((3));
  52709. $7=$recv(set)._printString();
  52710. $ctx1.sendIdx["printString"]=4;
  52711. self._assert_equals_($7,"a Set ('foo')");
  52712. $ctx1.sendIdx["assert:equals:"]=4;
  52713. $recv(set)._add_((3));
  52714. $ctx1.sendIdx["add:"]=4;
  52715. $8=$recv(set)._printString();
  52716. $ctx1.sendIdx["printString"]=5;
  52717. self._assert_equals_($8,"a Set (3 'foo')");
  52718. $ctx1.sendIdx["assert:equals:"]=5;
  52719. $recv(set)._add_((3));
  52720. self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  52721. return self;
  52722. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  52723. },
  52724. args: [],
  52725. 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'')'",
  52726. referencedClasses: ["Set"],
  52727. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  52728. }),
  52729. $globals.SetTest);
  52730. $core.addMethod(
  52731. $core.method({
  52732. selector: "testUnboxedObjects",
  52733. protocol: 'tests',
  52734. fn: function (){
  52735. var self=this;
  52736. return $core.withContext(function($ctx1) {
  52737. var $4,$3,$2,$1;
  52738. $4="foo"._yourself();
  52739. $ctx1.sendIdx["yourself"]=1;
  52740. $3=[$4,"foo"._yourself()];
  52741. $2=$recv($3)._asSet();
  52742. $1=$recv($2)._asArray();
  52743. self._assert_equals_($1,["foo"]);
  52744. return self;
  52745. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  52746. },
  52747. args: [],
  52748. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  52749. referencedClasses: [],
  52750. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  52751. }),
  52752. $globals.SetTest);
  52753. $core.addMethod(
  52754. $core.method({
  52755. selector: "testUnicity",
  52756. protocol: 'tests',
  52757. fn: function (){
  52758. var self=this;
  52759. var set;
  52760. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  52761. return $core.withContext(function($ctx1) {
  52762. var $1;
  52763. set=$recv($Set())._new();
  52764. $recv(set)._add_((21));
  52765. $ctx1.sendIdx["add:"]=1;
  52766. $recv(set)._add_("hello");
  52767. $ctx1.sendIdx["add:"]=2;
  52768. $recv(set)._add_((21));
  52769. $ctx1.sendIdx["add:"]=3;
  52770. $1=$recv(set)._size();
  52771. $ctx1.sendIdx["size"]=1;
  52772. self._assert_equals_($1,(2));
  52773. $ctx1.sendIdx["assert:equals:"]=1;
  52774. $recv(set)._add_("hello");
  52775. self._assert_equals_($recv(set)._size(),(2));
  52776. $ctx1.sendIdx["assert:equals:"]=2;
  52777. self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  52778. return self;
  52779. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  52780. },
  52781. args: [],
  52782. 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')",
  52783. referencedClasses: ["Set"],
  52784. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  52785. }),
  52786. $globals.SetTest);
  52787. $core.addMethod(
  52788. $core.method({
  52789. selector: "collectionClass",
  52790. protocol: 'fixture',
  52791. fn: function (){
  52792. var self=this;
  52793. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  52794. return $Set();
  52795. },
  52796. args: [],
  52797. source: "collectionClass\x0a\x09^ Set",
  52798. referencedClasses: ["Set"],
  52799. messageSends: []
  52800. }),
  52801. $globals.SetTest.klass);
  52802. $core.addClass('ConsoleTranscriptTest', $globals.TestCase, [], 'Kernel-Tests');
  52803. $core.addMethod(
  52804. $core.method({
  52805. selector: "testShow",
  52806. protocol: 'tests',
  52807. fn: function (){
  52808. var self=this;
  52809. var originalTranscript;
  52810. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  52811. function $ConsoleTranscript(){return $globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  52812. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  52813. return $core.withContext(function($ctx1) {
  52814. originalTranscript=$recv($Transcript())._current();
  52815. $recv($Transcript())._register_($recv($ConsoleTranscript())._new());
  52816. $ctx1.sendIdx["register:"]=1;
  52817. self._shouldnt_raise_((function(){
  52818. return $core.withContext(function($ctx2) {
  52819. return $recv($Transcript())._show_("Hello console!");
  52820. $ctx2.sendIdx["show:"]=1;
  52821. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52822. }),$Error());
  52823. $ctx1.sendIdx["shouldnt:raise:"]=1;
  52824. self._shouldnt_raise_((function(){
  52825. return $core.withContext(function($ctx2) {
  52826. return $recv($Transcript())._show_(console);
  52827. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  52828. }),$Error());
  52829. $recv($Transcript())._register_(originalTranscript);
  52830. return self;
  52831. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  52832. },
  52833. args: [],
  52834. 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.",
  52835. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  52836. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  52837. }),
  52838. $globals.ConsoleTranscriptTest);
  52839. $core.addClass('DateTest', $globals.TestCase, [], 'Kernel-Tests');
  52840. $core.addMethod(
  52841. $core.method({
  52842. selector: "testEquality",
  52843. protocol: 'tests',
  52844. fn: function (){
  52845. var self=this;
  52846. var now;
  52847. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  52848. return $core.withContext(function($ctx1) {
  52849. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  52850. now=$recv($Date())._new();
  52851. $1=$recv(now).__eq(now);
  52852. $ctx1.sendIdx["="]=1;
  52853. self._assert_($1);
  52854. $ctx1.sendIdx["assert:"]=1;
  52855. $3=now;
  52856. $4=$recv($Date())._fromMilliseconds_((0));
  52857. $ctx1.sendIdx["fromMilliseconds:"]=1;
  52858. $2=$recv($3).__eq($4);
  52859. $ctx1.sendIdx["="]=2;
  52860. self._deny_($2);
  52861. $6=$recv($Date())._fromMilliseconds_((12345678));
  52862. $ctx1.sendIdx["fromMilliseconds:"]=2;
  52863. $7=$recv($Date())._fromMilliseconds_((12345678));
  52864. $ctx1.sendIdx["fromMilliseconds:"]=3;
  52865. $5=$recv($6).__eq($7);
  52866. $ctx1.sendIdx["="]=3;
  52867. self._assert_($5);
  52868. $ctx1.sendIdx["assert:"]=2;
  52869. $9=now;
  52870. $11=$recv(now)._asMilliseconds();
  52871. $ctx1.sendIdx["asMilliseconds"]=1;
  52872. $10=$recv($Date())._fromMilliseconds_($11);
  52873. $ctx1.sendIdx["fromMilliseconds:"]=4;
  52874. $8=$recv($9).__eq($10);
  52875. $ctx1.sendIdx["="]=4;
  52876. self._assert_($8);
  52877. $ctx1.sendIdx["assert:"]=3;
  52878. self._assert_($recv($recv($Date())._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  52879. return self;
  52880. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  52881. },
  52882. args: [],
  52883. source: "testEquality\x0a\x09| now |\x0a\x09now := Date new.\x0a\x0a\x09self assert: now = now.\x0a\x0a\x09self deny: now = (Date fromMilliseconds: 0).\x0a\x0a\x09self assert: (Date fromMilliseconds: 12345678) = (Date fromMilliseconds: 12345678).\x0a\x09self assert: now = (Date fromMilliseconds: now asMilliseconds).\x0a\x09self assert: (Date fromMilliseconds: now asMilliseconds) = now",
  52884. referencedClasses: ["Date"],
  52885. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  52886. }),
  52887. $globals.DateTest);
  52888. $core.addMethod(
  52889. $core.method({
  52890. selector: "testIdentity",
  52891. protocol: 'tests',
  52892. fn: function (){
  52893. var self=this;
  52894. var now;
  52895. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  52896. return $core.withContext(function($ctx1) {
  52897. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  52898. now=$recv($Date())._new();
  52899. $1=$recv(now).__eq_eq(now);
  52900. $ctx1.sendIdx["=="]=1;
  52901. self._assert_($1);
  52902. $3=now;
  52903. $4=$recv($Date())._fromMilliseconds_((0));
  52904. $ctx1.sendIdx["fromMilliseconds:"]=1;
  52905. $2=$recv($3).__eq_eq($4);
  52906. $ctx1.sendIdx["=="]=2;
  52907. self._deny_($2);
  52908. $ctx1.sendIdx["deny:"]=1;
  52909. $6=$recv($Date())._fromMilliseconds_((12345678));
  52910. $ctx1.sendIdx["fromMilliseconds:"]=2;
  52911. $7=$recv($Date())._fromMilliseconds_((12345678));
  52912. $ctx1.sendIdx["fromMilliseconds:"]=3;
  52913. $5=$recv($6).__eq_eq($7);
  52914. $ctx1.sendIdx["=="]=3;
  52915. self._deny_($5);
  52916. $ctx1.sendIdx["deny:"]=2;
  52917. $9=now;
  52918. $11=$recv(now)._asMilliseconds();
  52919. $ctx1.sendIdx["asMilliseconds"]=1;
  52920. $10=$recv($Date())._fromMilliseconds_($11);
  52921. $ctx1.sendIdx["fromMilliseconds:"]=4;
  52922. $8=$recv($9).__eq_eq($10);
  52923. $ctx1.sendIdx["=="]=4;
  52924. self._deny_($8);
  52925. $ctx1.sendIdx["deny:"]=3;
  52926. self._deny_($recv($recv($Date())._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  52927. return self;
  52928. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  52929. },
  52930. args: [],
  52931. source: "testIdentity\x0a\x09| now |\x0a\x09now := Date new.\x0a\x0a\x09self assert: now == now.\x0a\x0a\x09self deny: now == (Date fromMilliseconds: 0).\x0a\x0a\x09self deny: (Date fromMilliseconds: 12345678) == (Date fromMilliseconds: 12345678).\x0a\x09self deny: now == (Date fromMilliseconds: now asMilliseconds).\x0a\x09self deny: (Date fromMilliseconds: now asMilliseconds) == now",
  52932. referencedClasses: ["Date"],
  52933. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  52934. }),
  52935. $globals.DateTest);
  52936. $core.addClass('JSObjectProxyTest', $globals.TestCase, [], 'Kernel-Tests');
  52937. $core.addMethod(
  52938. $core.method({
  52939. selector: "jsNull",
  52940. protocol: 'accessing',
  52941. fn: function (){
  52942. var self=this;
  52943. return $core.withContext(function($ctx1) {
  52944. return null;
  52945. return self;
  52946. }, function($ctx1) {$ctx1.fill(self,"jsNull",{},$globals.JSObjectProxyTest)});
  52947. },
  52948. args: [],
  52949. source: "jsNull\x0a\x09<return null>",
  52950. referencedClasses: [],
  52951. messageSends: []
  52952. }),
  52953. $globals.JSObjectProxyTest);
  52954. $core.addMethod(
  52955. $core.method({
  52956. selector: "jsObject",
  52957. protocol: 'accessing',
  52958. fn: function (){
  52959. var self=this;
  52960. return $core.withContext(function($ctx1) {
  52961. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  52962. return self;
  52963. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  52964. },
  52965. args: [],
  52966. source: "jsObject\x0a\x09<return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  52967. referencedClasses: [],
  52968. messageSends: []
  52969. }),
  52970. $globals.JSObjectProxyTest);
  52971. $core.addMethod(
  52972. $core.method({
  52973. selector: "jsUndefined",
  52974. protocol: 'accessing',
  52975. fn: function (){
  52976. var self=this;
  52977. return $core.withContext(function($ctx1) {
  52978. return;
  52979. return self;
  52980. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  52981. },
  52982. args: [],
  52983. source: "jsUndefined\x0a\x09<return>",
  52984. referencedClasses: [],
  52985. messageSends: []
  52986. }),
  52987. $globals.JSObjectProxyTest);
  52988. $core.addMethod(
  52989. $core.method({
  52990. selector: "testAtIfAbsent",
  52991. protocol: 'tests',
  52992. fn: function (){
  52993. var self=this;
  52994. var testObject;
  52995. return $core.withContext(function($ctx1) {
  52996. var $1,$2,$3;
  52997. testObject=self._jsObject();
  52998. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  52999. return "Property does not exist";
  53000. }));
  53001. $ctx1.sendIdx["at:ifAbsent:"]=1;
  53002. self._assert_equals_($1,"Property does not exist");
  53003. $ctx1.sendIdx["assert:equals:"]=1;
  53004. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  53005. return "Property does not exist";
  53006. }));
  53007. $ctx1.sendIdx["at:ifAbsent:"]=2;
  53008. self._assert_equals_($2,nil);
  53009. $ctx1.sendIdx["assert:equals:"]=2;
  53010. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  53011. return "Property does not exist";
  53012. }));
  53013. $ctx1.sendIdx["at:ifAbsent:"]=3;
  53014. self._assert_equals_($3,(1));
  53015. $ctx1.sendIdx["assert:equals:"]=3;
  53016. self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  53017. return "Property does not exist";
  53018. })),nil);
  53019. return self;
  53020. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  53021. },
  53022. args: [],
  53023. 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.",
  53024. referencedClasses: [],
  53025. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  53026. }),
  53027. $globals.JSObjectProxyTest);
  53028. $core.addMethod(
  53029. $core.method({
  53030. selector: "testAtIfPresent",
  53031. protocol: 'tests',
  53032. fn: function (){
  53033. var self=this;
  53034. var testObject;
  53035. return $core.withContext(function($ctx1) {
  53036. var $2,$1,$4,$3,$6,$5;
  53037. testObject=self._jsObject();
  53038. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  53039. return $core.withContext(function($ctx2) {
  53040. $2=$recv(x)._asString();
  53041. $ctx2.sendIdx["asString"]=1;
  53042. return "hello ".__comma($2);
  53043. $ctx2.sendIdx[","]=1;
  53044. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  53045. }));
  53046. $ctx1.sendIdx["at:ifPresent:"]=1;
  53047. self._assert_equals_($1,nil);
  53048. $ctx1.sendIdx["assert:equals:"]=1;
  53049. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  53050. return $core.withContext(function($ctx2) {
  53051. $4=$recv(x)._asString();
  53052. $ctx2.sendIdx["asString"]=2;
  53053. return "hello ".__comma($4);
  53054. $ctx2.sendIdx[","]=2;
  53055. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  53056. }));
  53057. $ctx1.sendIdx["at:ifPresent:"]=2;
  53058. self._assert_equals_($3,"hello nil");
  53059. $ctx1.sendIdx["assert:equals:"]=2;
  53060. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  53061. return $core.withContext(function($ctx2) {
  53062. $6=$recv(x)._asString();
  53063. $ctx2.sendIdx["asString"]=3;
  53064. return "hello ".__comma($6);
  53065. $ctx2.sendIdx[","]=3;
  53066. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  53067. }));
  53068. $ctx1.sendIdx["at:ifPresent:"]=3;
  53069. self._assert_equals_($5,"hello 1");
  53070. $ctx1.sendIdx["assert:equals:"]=3;
  53071. self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  53072. return $core.withContext(function($ctx2) {
  53073. return "hello ".__comma($recv(x)._asString());
  53074. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  53075. })),"hello nil");
  53076. return self;
  53077. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  53078. },
  53079. args: [],
  53080. 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'.",
  53081. referencedClasses: [],
  53082. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  53083. }),
  53084. $globals.JSObjectProxyTest);
  53085. $core.addMethod(
  53086. $core.method({
  53087. selector: "testAtIfPresentIfAbsent",
  53088. protocol: 'tests',
  53089. fn: function (){
  53090. var self=this;
  53091. var testObject;
  53092. return $core.withContext(function($ctx1) {
  53093. var $2,$1,$4,$3,$6,$5;
  53094. testObject=self._jsObject();
  53095. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  53096. return $core.withContext(function($ctx2) {
  53097. $2=$recv(x)._asString();
  53098. $ctx2.sendIdx["asString"]=1;
  53099. return "hello ".__comma($2);
  53100. $ctx2.sendIdx[","]=1;
  53101. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  53102. }),(function(){
  53103. return "not present";
  53104. }));
  53105. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  53106. self._assert_equals_($1,"not present");
  53107. $ctx1.sendIdx["assert:equals:"]=1;
  53108. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  53109. return $core.withContext(function($ctx2) {
  53110. $4=$recv(x)._asString();
  53111. $ctx2.sendIdx["asString"]=2;
  53112. return "hello ".__comma($4);
  53113. $ctx2.sendIdx[","]=2;
  53114. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  53115. }),(function(){
  53116. return "not present";
  53117. }));
  53118. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  53119. self._assert_equals_($3,"hello nil");
  53120. $ctx1.sendIdx["assert:equals:"]=2;
  53121. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  53122. return $core.withContext(function($ctx2) {
  53123. $6=$recv(x)._asString();
  53124. $ctx2.sendIdx["asString"]=3;
  53125. return "hello ".__comma($6);
  53126. $ctx2.sendIdx[","]=3;
  53127. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  53128. }),(function(){
  53129. return "not present";
  53130. }));
  53131. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  53132. self._assert_equals_($5,"hello 1");
  53133. $ctx1.sendIdx["assert:equals:"]=3;
  53134. self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  53135. return $core.withContext(function($ctx2) {
  53136. return "hello ".__comma($recv(x)._asString());
  53137. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  53138. }),(function(){
  53139. return "not present";
  53140. })),"hello nil");
  53141. return self;
  53142. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  53143. },
  53144. args: [],
  53145. 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'.",
  53146. referencedClasses: [],
  53147. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  53148. }),
  53149. $globals.JSObjectProxyTest);
  53150. $core.addMethod(
  53151. $core.method({
  53152. selector: "testAtPut",
  53153. protocol: 'tests',
  53154. fn: function (){
  53155. var self=this;
  53156. var testObject;
  53157. return $core.withContext(function($ctx1) {
  53158. var $2,$1;
  53159. testObject=self._jsObject();
  53160. $2=$recv(testObject)._at_("abc");
  53161. $ctx1.sendIdx["at:"]=1;
  53162. $1=$recv($2).__tild_eq("xyz");
  53163. self._assert_($1);
  53164. self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  53165. $ctx1.sendIdx["assert:equals:"]=1;
  53166. self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  53167. return self;
  53168. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  53169. },
  53170. args: [],
  53171. 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'",
  53172. referencedClasses: [],
  53173. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  53174. }),
  53175. $globals.JSObjectProxyTest);
  53176. $core.addMethod(
  53177. $core.method({
  53178. selector: "testComparison",
  53179. protocol: 'tests',
  53180. fn: function (){
  53181. var self=this;
  53182. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  53183. return $core.withContext(function($ctx1) {
  53184. var $1,$2;
  53185. self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  53186. $1=$recv(console).__eq(console);
  53187. $ctx1.sendIdx["="]=1;
  53188. self._assert_($1);
  53189. $2=$recv(console).__eq($recv($Object())._new());
  53190. $ctx1.sendIdx["="]=2;
  53191. self._deny_($2);
  53192. $ctx1.sendIdx["deny:"]=1;
  53193. self._deny_($recv(console).__eq(self._jsObject()));
  53194. return self;
  53195. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  53196. },
  53197. args: [],
  53198. 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",
  53199. referencedClasses: ["Object"],
  53200. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  53201. }),
  53202. $globals.JSObjectProxyTest);
  53203. $core.addMethod(
  53204. $core.method({
  53205. selector: "testDNU",
  53206. protocol: 'tests',
  53207. fn: function (){
  53208. var self=this;
  53209. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  53210. return $core.withContext(function($ctx1) {
  53211. self._should_raise_((function(){
  53212. return $core.withContext(function($ctx2) {
  53213. return $recv(self._jsObject())._foo();
  53214. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53215. }),$MessageNotUnderstood());
  53216. return self;
  53217. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  53218. },
  53219. args: [],
  53220. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  53221. referencedClasses: ["MessageNotUnderstood"],
  53222. messageSends: ["should:raise:", "foo", "jsObject"]
  53223. }),
  53224. $globals.JSObjectProxyTest);
  53225. $core.addMethod(
  53226. $core.method({
  53227. selector: "testDNURegression1057",
  53228. protocol: 'tests',
  53229. fn: function (){
  53230. var self=this;
  53231. var jsObject;
  53232. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53233. return $core.withContext(function($ctx1) {
  53234. var $1;
  53235. jsObject=[];
  53236. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53237. $ctx1.sendIdx["basicAt:put:"]=1;
  53238. $recv(jsObject)._basicAt_put_("foo",(3));
  53239. self._shouldnt_raise_((function(){
  53240. return $core.withContext(function($ctx2) {
  53241. return $recv(jsObject)._foo();
  53242. $ctx2.sendIdx["foo"]=1;
  53243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53244. }),$Error());
  53245. $ctx1.sendIdx["shouldnt:raise:"]=1;
  53246. $1=$recv(jsObject)._foo();
  53247. $ctx1.sendIdx["foo"]=2;
  53248. self._assert_equals_($1,(3));
  53249. $ctx1.sendIdx["assert:equals:"]=1;
  53250. self._shouldnt_raise_((function(){
  53251. return $core.withContext(function($ctx2) {
  53252. return $recv(jsObject)._foo_((4));
  53253. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53254. }),$Error());
  53255. self._assert_equals_($recv(jsObject)._foo(),(4));
  53256. return self;
  53257. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1057",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  53258. },
  53259. args: [],
  53260. 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",
  53261. referencedClasses: ["Error"],
  53262. messageSends: ["basicAt:put:", "shouldnt:raise:", "foo", "assert:equals:", "foo:"]
  53263. }),
  53264. $globals.JSObjectProxyTest);
  53265. $core.addMethod(
  53266. $core.method({
  53267. selector: "testDNURegression1059",
  53268. protocol: 'tests',
  53269. fn: function (){
  53270. var self=this;
  53271. var jsObject;
  53272. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53273. return $core.withContext(function($ctx1) {
  53274. jsObject=[];
  53275. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53276. $ctx1.sendIdx["basicAt:put:"]=1;
  53277. $recv(jsObject)._basicAt_put_("x",(3));
  53278. $ctx1.sendIdx["basicAt:put:"]=2;
  53279. $recv(jsObject)._basicAt_put_("x:",(function(){
  53280. return $core.withContext(function($ctx2) {
  53281. return self._error();
  53282. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53283. }));
  53284. self._shouldnt_raise_((function(){
  53285. return $core.withContext(function($ctx2) {
  53286. return $recv(jsObject)._x_((4));
  53287. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53288. }),$Error());
  53289. self._assert_equals_($recv(jsObject)._x(),(4));
  53290. return self;
  53291. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1059",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  53292. },
  53293. args: [],
  53294. 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",
  53295. referencedClasses: ["Error"],
  53296. messageSends: ["basicAt:put:", "error", "shouldnt:raise:", "x:", "assert:equals:", "x"]
  53297. }),
  53298. $globals.JSObjectProxyTest);
  53299. $core.addMethod(
  53300. $core.method({
  53301. selector: "testDNURegression1062",
  53302. protocol: 'tests',
  53303. fn: function (){
  53304. var self=this;
  53305. var jsObject,stored;
  53306. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53307. return $core.withContext(function($ctx1) {
  53308. jsObject=[];
  53309. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53310. $ctx1.sendIdx["basicAt:put:"]=1;
  53311. $recv(jsObject)._basicAt_put_("x",(function(v){
  53312. stored=v;
  53313. return stored;
  53314. }));
  53315. self._shouldnt_raise_((function(){
  53316. return $core.withContext(function($ctx2) {
  53317. return $recv(jsObject)._x_((4));
  53318. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53319. }),$Error());
  53320. self._assert_equals_(stored,(4));
  53321. return self;
  53322. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1062",{jsObject:jsObject,stored:stored},$globals.JSObjectProxyTest)});
  53323. },
  53324. args: [],
  53325. 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",
  53326. referencedClasses: ["Error"],
  53327. messageSends: ["basicAt:put:", "shouldnt:raise:", "x:", "assert:equals:"]
  53328. }),
  53329. $globals.JSObjectProxyTest);
  53330. $core.addMethod(
  53331. $core.method({
  53332. selector: "testDNUWithAllowJavaScriptCalls",
  53333. protocol: 'tests',
  53334. fn: function (){
  53335. var self=this;
  53336. var jsObject;
  53337. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  53338. return $core.withContext(function($ctx1) {
  53339. jsObject=[];
  53340. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53341. self._should_raise_((function(){
  53342. return $core.withContext(function($ctx2) {
  53343. return $recv(jsObject)._foo();
  53344. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53345. }),$MessageNotUnderstood());
  53346. return self;
  53347. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  53348. },
  53349. args: [],
  53350. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  53351. referencedClasses: ["MessageNotUnderstood"],
  53352. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  53353. }),
  53354. $globals.JSObjectProxyTest);
  53355. $core.addMethod(
  53356. $core.method({
  53357. selector: "testMessageSend",
  53358. protocol: 'tests',
  53359. fn: function (){
  53360. var self=this;
  53361. return $core.withContext(function($ctx1) {
  53362. var $2,$1,$4,$3;
  53363. $2=self._jsObject();
  53364. $ctx1.sendIdx["jsObject"]=1;
  53365. $1=$recv($2)._a();
  53366. self._assert_equals_($1,(1));
  53367. $ctx1.sendIdx["assert:equals:"]=1;
  53368. $4=self._jsObject();
  53369. $ctx1.sendIdx["jsObject"]=2;
  53370. $3=$recv($4)._b();
  53371. self._assert_equals_($3,(2));
  53372. $ctx1.sendIdx["assert:equals:"]=2;
  53373. self._assert_equals_($recv(self._jsObject())._c_((3)),(3));
  53374. return self;
  53375. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  53376. },
  53377. args: [],
  53378. 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",
  53379. referencedClasses: [],
  53380. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  53381. }),
  53382. $globals.JSObjectProxyTest);
  53383. $core.addMethod(
  53384. $core.method({
  53385. selector: "testMethodWithArguments",
  53386. protocol: 'tests',
  53387. fn: function (){
  53388. var self=this;
  53389. return $core.withContext(function($ctx1) {
  53390. self._assert_equals_($recv(self._jsObject())._c_((1)),(1));
  53391. return self;
  53392. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  53393. },
  53394. args: [],
  53395. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  53396. referencedClasses: [],
  53397. messageSends: ["assert:equals:", "c:", "jsObject"]
  53398. }),
  53399. $globals.JSObjectProxyTest);
  53400. $core.addMethod(
  53401. $core.method({
  53402. selector: "testPrinting",
  53403. protocol: 'tests',
  53404. fn: function (){
  53405. var self=this;
  53406. return $core.withContext(function($ctx1) {
  53407. self._assert_equals_($recv(self._jsObject())._printString(),"[object Object]");
  53408. return self;
  53409. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  53410. },
  53411. args: [],
  53412. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  53413. referencedClasses: [],
  53414. messageSends: ["assert:equals:", "printString", "jsObject"]
  53415. }),
  53416. $globals.JSObjectProxyTest);
  53417. $core.addMethod(
  53418. $core.method({
  53419. selector: "testPropertyThatReturnsEmptyString",
  53420. protocol: 'tests',
  53421. fn: function (){
  53422. var self=this;
  53423. var object;
  53424. return $core.withContext(function($ctx1) {
  53425. var $1;
  53426. object=self._jsObject();
  53427. $1=$recv(object)._d();
  53428. $ctx1.sendIdx["d"]=1;
  53429. self._assert_equals_($1,"");
  53430. $ctx1.sendIdx["assert:equals:"]=1;
  53431. $recv(object)._d_("hello");
  53432. self._assert_equals_($recv(object)._d(),"hello");
  53433. return self;
  53434. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  53435. },
  53436. args: [],
  53437. 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'",
  53438. referencedClasses: [],
  53439. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  53440. }),
  53441. $globals.JSObjectProxyTest);
  53442. $core.addMethod(
  53443. $core.method({
  53444. selector: "testPropertyThatReturnsUndefined",
  53445. protocol: 'tests',
  53446. fn: function (){
  53447. var self=this;
  53448. var object;
  53449. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  53450. return $core.withContext(function($ctx1) {
  53451. object=self._jsObject();
  53452. self._shouldnt_raise_((function(){
  53453. return $core.withContext(function($ctx2) {
  53454. return $recv(object)._e();
  53455. $ctx2.sendIdx["e"]=1;
  53456. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53457. }),$MessageNotUnderstood());
  53458. self._assert_($recv($recv(object)._e())._isNil());
  53459. return self;
  53460. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  53461. },
  53462. args: [],
  53463. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  53464. referencedClasses: ["MessageNotUnderstood"],
  53465. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  53466. }),
  53467. $globals.JSObjectProxyTest);
  53468. $core.addMethod(
  53469. $core.method({
  53470. selector: "testSetPropertyWithFalsyValue",
  53471. protocol: 'tests',
  53472. fn: function (){
  53473. var self=this;
  53474. var jsObject;
  53475. return $core.withContext(function($ctx1) {
  53476. var $1,$2,$3,$4,$5;
  53477. jsObject=self._jsObject();
  53478. $1=$recv(jsObject)._a();
  53479. $ctx1.sendIdx["a"]=1;
  53480. self._assert_equals_($1,(1));
  53481. $ctx1.sendIdx["assert:equals:"]=1;
  53482. $recv(jsObject)._a_(self._jsNull());
  53483. $ctx1.sendIdx["a:"]=1;
  53484. $2=$recv(jsObject)._a();
  53485. $ctx1.sendIdx["a"]=2;
  53486. self._assert_equals_($2,nil);
  53487. $ctx1.sendIdx["assert:equals:"]=2;
  53488. $recv(jsObject)._a_((0));
  53489. $ctx1.sendIdx["a:"]=2;
  53490. $3=$recv(jsObject)._a();
  53491. $ctx1.sendIdx["a"]=3;
  53492. self._assert_equals_($3,(0));
  53493. $ctx1.sendIdx["assert:equals:"]=3;
  53494. $recv(jsObject)._a_(self._jsUndefined());
  53495. $ctx1.sendIdx["a:"]=3;
  53496. $4=$recv(jsObject)._a();
  53497. $ctx1.sendIdx["a"]=4;
  53498. self._assert_equals_($4,nil);
  53499. $ctx1.sendIdx["assert:equals:"]=4;
  53500. $recv(jsObject)._a_("");
  53501. $ctx1.sendIdx["a:"]=4;
  53502. $5=$recv(jsObject)._a();
  53503. $ctx1.sendIdx["a"]=5;
  53504. self._assert_equals_($5,"");
  53505. $ctx1.sendIdx["assert:equals:"]=5;
  53506. $recv(jsObject)._a_(false);
  53507. self._assert_equals_($recv(jsObject)._a(),false);
  53508. return self;
  53509. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  53510. },
  53511. args: [],
  53512. 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",
  53513. referencedClasses: [],
  53514. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"]
  53515. }),
  53516. $globals.JSObjectProxyTest);
  53517. $core.addMethod(
  53518. $core.method({
  53519. selector: "testValue",
  53520. protocol: 'tests',
  53521. fn: function (){
  53522. var self=this;
  53523. var testObject;
  53524. return $core.withContext(function($ctx1) {
  53525. testObject=self._jsObject();
  53526. $recv(testObject)._at_put_("value","aValue");
  53527. self._assert_equals_($recv(testObject)._value(),"aValue");
  53528. return self;
  53529. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  53530. },
  53531. args: [],
  53532. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  53533. referencedClasses: [],
  53534. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  53535. }),
  53536. $globals.JSObjectProxyTest);
  53537. $core.addMethod(
  53538. $core.method({
  53539. selector: "testYourself",
  53540. protocol: 'tests',
  53541. fn: function (){
  53542. var self=this;
  53543. var object;
  53544. return $core.withContext(function($ctx1) {
  53545. var $1;
  53546. $1=self._jsObject();
  53547. $recv($1)._d_("test");
  53548. object=$recv($1)._yourself();
  53549. self._assert_equals_($recv(object)._d(),"test");
  53550. return self;
  53551. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  53552. },
  53553. args: [],
  53554. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  53555. referencedClasses: [],
  53556. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  53557. }),
  53558. $globals.JSObjectProxyTest);
  53559. $core.addClass('JavaScriptExceptionTest', $globals.TestCase, [], 'Kernel-Tests');
  53560. $core.addMethod(
  53561. $core.method({
  53562. selector: "testCatchingException",
  53563. protocol: 'tests',
  53564. fn: function (){
  53565. var self=this;
  53566. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53567. return $core.withContext(function($ctx1) {
  53568. $recv((function(){
  53569. return $core.withContext(function($ctx2) {
  53570. return self._throwException();
  53571. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53572. }))._on_do_($Error(),(function(error){
  53573. return $core.withContext(function($ctx2) {
  53574. return self._assert_($recv($recv(error)._exception()).__eq("test"));
  53575. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  53576. }));
  53577. return self;
  53578. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  53579. },
  53580. args: [],
  53581. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  53582. referencedClasses: ["Error"],
  53583. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  53584. }),
  53585. $globals.JavaScriptExceptionTest);
  53586. $core.addMethod(
  53587. $core.method({
  53588. selector: "testRaisingException",
  53589. protocol: 'tests',
  53590. fn: function (){
  53591. var self=this;
  53592. function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  53593. return $core.withContext(function($ctx1) {
  53594. self._should_raise_((function(){
  53595. return $core.withContext(function($ctx2) {
  53596. return self._throwException();
  53597. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53598. }),$JavaScriptException());
  53599. return self;
  53600. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  53601. },
  53602. args: [],
  53603. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  53604. referencedClasses: ["JavaScriptException"],
  53605. messageSends: ["should:raise:", "throwException"]
  53606. }),
  53607. $globals.JavaScriptExceptionTest);
  53608. $core.addMethod(
  53609. $core.method({
  53610. selector: "throwException",
  53611. protocol: 'helpers',
  53612. fn: function (){
  53613. var self=this;
  53614. return $core.withContext(function($ctx1) {
  53615. throw 'test';
  53616. return self;
  53617. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  53618. },
  53619. args: [],
  53620. source: "throwException\x0a\x09<throw 'test'>",
  53621. referencedClasses: [],
  53622. messageSends: []
  53623. }),
  53624. $globals.JavaScriptExceptionTest);
  53625. $core.addClass('MessageSendTest', $globals.TestCase, [], 'Kernel-Tests');
  53626. $core.addMethod(
  53627. $core.method({
  53628. selector: "testValue",
  53629. protocol: 'tests',
  53630. fn: function (){
  53631. var self=this;
  53632. var messageSend;
  53633. function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  53634. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  53635. return $core.withContext(function($ctx1) {
  53636. var $1;
  53637. $1=$recv($MessageSend())._new();
  53638. $ctx1.sendIdx["new"]=1;
  53639. $recv($1)._receiver_($recv($Object())._new());
  53640. $recv($1)._selector_("asString");
  53641. messageSend=$recv($1)._yourself();
  53642. self._assert_equals_($recv(messageSend)._value(),"an Object");
  53643. return self;
  53644. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  53645. },
  53646. args: [],
  53647. 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'",
  53648. referencedClasses: ["MessageSend", "Object"],
  53649. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  53650. }),
  53651. $globals.MessageSendTest);
  53652. $core.addMethod(
  53653. $core.method({
  53654. selector: "testValueWithArguments",
  53655. protocol: 'tests',
  53656. fn: function (){
  53657. var self=this;
  53658. var messageSend;
  53659. function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  53660. return $core.withContext(function($ctx1) {
  53661. var $1;
  53662. $1=$recv($MessageSend())._new();
  53663. $recv($1)._receiver_((2));
  53664. $recv($1)._selector_("+");
  53665. messageSend=$recv($1)._yourself();
  53666. self._assert_equals_($recv(messageSend)._value_((3)),(5));
  53667. $ctx1.sendIdx["assert:equals:"]=1;
  53668. self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  53669. return self;
  53670. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  53671. },
  53672. args: [],
  53673. 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",
  53674. referencedClasses: ["MessageSend"],
  53675. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  53676. }),
  53677. $globals.MessageSendTest);
  53678. $core.addClass('MethodInheritanceTest', $globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  53679. $core.addMethod(
  53680. $core.method({
  53681. selector: "codeGeneratorClass",
  53682. protocol: 'accessing',
  53683. fn: function (){
  53684. var self=this;
  53685. function $CodeGenerator(){return $globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  53686. return $CodeGenerator();
  53687. },
  53688. args: [],
  53689. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  53690. referencedClasses: ["CodeGenerator"],
  53691. messageSends: []
  53692. }),
  53693. $globals.MethodInheritanceTest);
  53694. $core.addMethod(
  53695. $core.method({
  53696. selector: "compiler",
  53697. protocol: 'factory',
  53698. fn: function (){
  53699. var self=this;
  53700. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  53701. return $core.withContext(function($ctx1) {
  53702. var $1;
  53703. $1=$recv($Compiler())._new();
  53704. $recv($1)._codeGeneratorClass_(self._codeGeneratorClass());
  53705. return $recv($1)._yourself();
  53706. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  53707. },
  53708. args: [],
  53709. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  53710. referencedClasses: ["Compiler"],
  53711. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  53712. }),
  53713. $globals.MethodInheritanceTest);
  53714. $core.addMethod(
  53715. $core.method({
  53716. selector: "deinstallBottom",
  53717. protocol: 'testing',
  53718. fn: function (){
  53719. var self=this;
  53720. return $core.withContext(function($ctx1) {
  53721. $recv(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  53722. return self;
  53723. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  53724. },
  53725. args: [],
  53726. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  53727. referencedClasses: [],
  53728. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  53729. }),
  53730. $globals.MethodInheritanceTest);
  53731. $core.addMethod(
  53732. $core.method({
  53733. selector: "deinstallMiddle",
  53734. protocol: 'testing',
  53735. fn: function (){
  53736. var self=this;
  53737. return $core.withContext(function($ctx1) {
  53738. $recv(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  53739. return self;
  53740. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  53741. },
  53742. args: [],
  53743. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  53744. referencedClasses: [],
  53745. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  53746. }),
  53747. $globals.MethodInheritanceTest);
  53748. $core.addMethod(
  53749. $core.method({
  53750. selector: "deinstallTop",
  53751. protocol: 'testing',
  53752. fn: function (){
  53753. var self=this;
  53754. return $core.withContext(function($ctx1) {
  53755. $recv(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  53756. return self;
  53757. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  53758. },
  53759. args: [],
  53760. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  53761. referencedClasses: [],
  53762. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  53763. }),
  53764. $globals.MethodInheritanceTest);
  53765. $core.addMethod(
  53766. $core.method({
  53767. selector: "installBottom:",
  53768. protocol: 'testing',
  53769. fn: function (aString){
  53770. var self=this;
  53771. return $core.withContext(function($ctx1) {
  53772. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  53773. return self;
  53774. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  53775. },
  53776. args: ["aString"],
  53777. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  53778. referencedClasses: [],
  53779. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  53780. }),
  53781. $globals.MethodInheritanceTest);
  53782. $core.addMethod(
  53783. $core.method({
  53784. selector: "installMiddle:",
  53785. protocol: 'testing',
  53786. fn: function (aString){
  53787. var self=this;
  53788. return $core.withContext(function($ctx1) {
  53789. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  53790. return self;
  53791. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  53792. },
  53793. args: ["aString"],
  53794. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  53795. referencedClasses: [],
  53796. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  53797. }),
  53798. $globals.MethodInheritanceTest);
  53799. $core.addMethod(
  53800. $core.method({
  53801. selector: "installTop:",
  53802. protocol: 'testing',
  53803. fn: function (aString){
  53804. var self=this;
  53805. return $core.withContext(function($ctx1) {
  53806. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  53807. return self;
  53808. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  53809. },
  53810. args: ["aString"],
  53811. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  53812. referencedClasses: [],
  53813. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  53814. }),
  53815. $globals.MethodInheritanceTest);
  53816. $core.addMethod(
  53817. $core.method({
  53818. selector: "setUp",
  53819. protocol: 'initialization',
  53820. fn: function (){
  53821. var self=this;
  53822. return $core.withContext(function($ctx1) {
  53823. self["@receiverTop"]=$recv(self._targetClassTop())._new();
  53824. $ctx1.sendIdx["new"]=1;
  53825. self["@receiverMiddle"]=$recv(self._targetClassMiddle())._new();
  53826. $ctx1.sendIdx["new"]=2;
  53827. self["@receiverBottom"]=$recv(self._targetClassBottom())._new();
  53828. self["@method"]=nil;
  53829. self["@performBlock"]=(function(){
  53830. return $core.withContext(function($ctx2) {
  53831. return self._error_("performBlock not initialized");
  53832. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53833. });
  53834. return self;
  53835. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  53836. },
  53837. args: [],
  53838. 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' ]",
  53839. referencedClasses: [],
  53840. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  53841. }),
  53842. $globals.MethodInheritanceTest);
  53843. $core.addMethod(
  53844. $core.method({
  53845. selector: "shouldMNU",
  53846. protocol: 'testing',
  53847. fn: function (){
  53848. var self=this;
  53849. return $core.withContext(function($ctx1) {
  53850. self._shouldMNUTop();
  53851. self._shouldMNUMiddle();
  53852. self._shouldMNUBottom();
  53853. return self;
  53854. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  53855. },
  53856. args: [],
  53857. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  53858. referencedClasses: [],
  53859. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  53860. }),
  53861. $globals.MethodInheritanceTest);
  53862. $core.addMethod(
  53863. $core.method({
  53864. selector: "shouldMNUBottom",
  53865. protocol: 'testing',
  53866. fn: function (){
  53867. var self=this;
  53868. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  53869. return $core.withContext(function($ctx1) {
  53870. self._should_raise_((function(){
  53871. return $core.withContext(function($ctx2) {
  53872. return $recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  53873. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53874. }),$MessageNotUnderstood());
  53875. return self;
  53876. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  53877. },
  53878. args: [],
  53879. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  53880. referencedClasses: ["MessageNotUnderstood"],
  53881. messageSends: ["should:raise:", "value:"]
  53882. }),
  53883. $globals.MethodInheritanceTest);
  53884. $core.addMethod(
  53885. $core.method({
  53886. selector: "shouldMNUMiddle",
  53887. protocol: 'testing',
  53888. fn: function (){
  53889. var self=this;
  53890. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  53891. return $core.withContext(function($ctx1) {
  53892. self._should_raise_((function(){
  53893. return $core.withContext(function($ctx2) {
  53894. return $recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  53895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53896. }),$MessageNotUnderstood());
  53897. return self;
  53898. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  53899. },
  53900. args: [],
  53901. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  53902. referencedClasses: ["MessageNotUnderstood"],
  53903. messageSends: ["should:raise:", "value:"]
  53904. }),
  53905. $globals.MethodInheritanceTest);
  53906. $core.addMethod(
  53907. $core.method({
  53908. selector: "shouldMNUTop",
  53909. protocol: 'testing',
  53910. fn: function (){
  53911. var self=this;
  53912. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  53913. return $core.withContext(function($ctx1) {
  53914. self._should_raise_((function(){
  53915. return $core.withContext(function($ctx2) {
  53916. return $recv(self["@performBlock"])._value_(self["@receiverTop"]);
  53917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53918. }),$MessageNotUnderstood());
  53919. return self;
  53920. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  53921. },
  53922. args: [],
  53923. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  53924. referencedClasses: ["MessageNotUnderstood"],
  53925. messageSends: ["should:raise:", "value:"]
  53926. }),
  53927. $globals.MethodInheritanceTest);
  53928. $core.addMethod(
  53929. $core.method({
  53930. selector: "shouldReturn:",
  53931. protocol: 'testing',
  53932. fn: function (anObject){
  53933. var self=this;
  53934. var result;
  53935. return $core.withContext(function($ctx1) {
  53936. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  53937. $ctx1.sendIdx["value:"]=1;
  53938. self._assert_equals_(["top",anObject],["top",result]);
  53939. $ctx1.sendIdx["assert:equals:"]=1;
  53940. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  53941. $ctx1.sendIdx["value:"]=2;
  53942. self._assert_equals_(["middle",anObject],["middle",result]);
  53943. $ctx1.sendIdx["assert:equals:"]=2;
  53944. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  53945. self._assert_equals_(["bottom",anObject],["bottom",result]);
  53946. return self;
  53947. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  53948. },
  53949. args: ["anObject"],
  53950. 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 }",
  53951. referencedClasses: [],
  53952. messageSends: ["value:", "assert:equals:"]
  53953. }),
  53954. $globals.MethodInheritanceTest);
  53955. $core.addMethod(
  53956. $core.method({
  53957. selector: "shouldReturn:and:and:",
  53958. protocol: 'testing',
  53959. fn: function (anObject,anObject2,anObject3){
  53960. var self=this;
  53961. var result;
  53962. return $core.withContext(function($ctx1) {
  53963. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  53964. $ctx1.sendIdx["value:"]=1;
  53965. self._assert_equals_(["top",anObject],["top",result]);
  53966. $ctx1.sendIdx["assert:equals:"]=1;
  53967. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  53968. $ctx1.sendIdx["value:"]=2;
  53969. self._assert_equals_(["middle",anObject2],["middle",result]);
  53970. $ctx1.sendIdx["assert:equals:"]=2;
  53971. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  53972. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  53973. return self;
  53974. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  53975. },
  53976. args: ["anObject", "anObject2", "anObject3"],
  53977. 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 }",
  53978. referencedClasses: [],
  53979. messageSends: ["value:", "assert:equals:"]
  53980. }),
  53981. $globals.MethodInheritanceTest);
  53982. $core.addMethod(
  53983. $core.method({
  53984. selector: "targetClassBottom",
  53985. protocol: 'accessing',
  53986. fn: function (){
  53987. var self=this;
  53988. function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  53989. return $JavaScriptException();
  53990. },
  53991. args: [],
  53992. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  53993. referencedClasses: ["JavaScriptException"],
  53994. messageSends: []
  53995. }),
  53996. $globals.MethodInheritanceTest);
  53997. $core.addMethod(
  53998. $core.method({
  53999. selector: "targetClassMiddle",
  54000. protocol: 'accessing',
  54001. fn: function (){
  54002. var self=this;
  54003. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54004. return $Error();
  54005. },
  54006. args: [],
  54007. source: "targetClassMiddle\x0a\x09^ Error",
  54008. referencedClasses: ["Error"],
  54009. messageSends: []
  54010. }),
  54011. $globals.MethodInheritanceTest);
  54012. $core.addMethod(
  54013. $core.method({
  54014. selector: "targetClassTop",
  54015. protocol: 'accessing',
  54016. fn: function (){
  54017. var self=this;
  54018. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  54019. return $Object();
  54020. },
  54021. args: [],
  54022. source: "targetClassTop\x0a\x09^ Object",
  54023. referencedClasses: ["Object"],
  54024. messageSends: []
  54025. }),
  54026. $globals.MethodInheritanceTest);
  54027. $core.addMethod(
  54028. $core.method({
  54029. selector: "tearDown",
  54030. protocol: 'initialization',
  54031. fn: function (){
  54032. var self=this;
  54033. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54034. return $core.withContext(function($ctx1) {
  54035. $recv((function(){
  54036. return $core.withContext(function($ctx2) {
  54037. return self._deinstallTop();
  54038. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54039. }))._on_do_($Error(),(function(){
  54040. }));
  54041. $ctx1.sendIdx["on:do:"]=1;
  54042. $recv((function(){
  54043. return $core.withContext(function($ctx2) {
  54044. return self._deinstallMiddle();
  54045. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  54046. }))._on_do_($Error(),(function(){
  54047. }));
  54048. $ctx1.sendIdx["on:do:"]=2;
  54049. $recv((function(){
  54050. return $core.withContext(function($ctx2) {
  54051. return self._deinstallBottom();
  54052. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  54053. }))._on_do_($Error(),(function(){
  54054. }));
  54055. return self;
  54056. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  54057. },
  54058. args: [],
  54059. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  54060. referencedClasses: ["Error"],
  54061. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  54062. }),
  54063. $globals.MethodInheritanceTest);
  54064. $core.addMethod(
  54065. $core.method({
  54066. selector: "testMNU11",
  54067. protocol: 'tests',
  54068. fn: function (){
  54069. var self=this;
  54070. return $core.withContext(function($ctx1) {
  54071. self["@performBlock"]=(function(x){
  54072. return $core.withContext(function($ctx2) {
  54073. return $recv(x)._foo();
  54074. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54075. });
  54076. self._shouldMNU();
  54077. $ctx1.sendIdx["shouldMNU"]=1;
  54078. self._installTop_("foo ^ false");
  54079. $ctx1.sendIdx["installTop:"]=1;
  54080. self._installTop_("foo ^ true");
  54081. self._deinstallTop();
  54082. self._shouldMNU();
  54083. return self;
  54084. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  54085. },
  54086. args: [],
  54087. 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",
  54088. referencedClasses: [],
  54089. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  54090. }),
  54091. $globals.MethodInheritanceTest);
  54092. $core.addMethod(
  54093. $core.method({
  54094. selector: "testMNU22",
  54095. protocol: 'tests',
  54096. fn: function (){
  54097. var self=this;
  54098. return $core.withContext(function($ctx1) {
  54099. self["@performBlock"]=(function(x){
  54100. return $core.withContext(function($ctx2) {
  54101. return $recv(x)._foo();
  54102. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54103. });
  54104. self._shouldMNU();
  54105. $ctx1.sendIdx["shouldMNU"]=1;
  54106. self._installMiddle_("foo ^ false");
  54107. $ctx1.sendIdx["installMiddle:"]=1;
  54108. self._installMiddle_("foo ^ true");
  54109. self._deinstallMiddle();
  54110. self._shouldMNU();
  54111. return self;
  54112. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  54113. },
  54114. args: [],
  54115. 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",
  54116. referencedClasses: [],
  54117. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  54118. }),
  54119. $globals.MethodInheritanceTest);
  54120. $core.addMethod(
  54121. $core.method({
  54122. selector: "testReturns1",
  54123. protocol: 'tests',
  54124. fn: function (){
  54125. var self=this;
  54126. return $core.withContext(function($ctx1) {
  54127. self["@performBlock"]=(function(x){
  54128. return $core.withContext(function($ctx2) {
  54129. return $recv(x)._foo();
  54130. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54131. });
  54132. self._installTop_("foo ^ false");
  54133. $ctx1.sendIdx["installTop:"]=1;
  54134. self._shouldReturn_(false);
  54135. $ctx1.sendIdx["shouldReturn:"]=1;
  54136. self._installTop_("foo ^ true");
  54137. self._shouldReturn_(true);
  54138. return self;
  54139. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  54140. },
  54141. args: [],
  54142. 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",
  54143. referencedClasses: [],
  54144. messageSends: ["foo", "installTop:", "shouldReturn:"]
  54145. }),
  54146. $globals.MethodInheritanceTest);
  54147. $core.addClass('NumberTest', $globals.TestCase, [], 'Kernel-Tests');
  54148. $core.addMethod(
  54149. $core.method({
  54150. selector: "testAbs",
  54151. protocol: 'tests',
  54152. fn: function (){
  54153. var self=this;
  54154. return $core.withContext(function($ctx1) {
  54155. var $1;
  54156. $1=(4)._abs();
  54157. $ctx1.sendIdx["abs"]=1;
  54158. self._assert_equals_($1,(4));
  54159. $ctx1.sendIdx["assert:equals:"]=1;
  54160. self._assert_equals_((-4)._abs(),(4));
  54161. return self;
  54162. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  54163. },
  54164. args: [],
  54165. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  54166. referencedClasses: [],
  54167. messageSends: ["assert:equals:", "abs"]
  54168. }),
  54169. $globals.NumberTest);
  54170. $core.addMethod(
  54171. $core.method({
  54172. selector: "testArithmetic",
  54173. protocol: 'tests',
  54174. fn: function (){
  54175. var self=this;
  54176. return $core.withContext(function($ctx1) {
  54177. var $1,$2,$3,$5,$4;
  54178. $1=(1.5).__plus((1));
  54179. $ctx1.sendIdx["+"]=1;
  54180. self._assert_equals_($1,(2.5));
  54181. $ctx1.sendIdx["assert:equals:"]=1;
  54182. $2=(2).__minus((1));
  54183. $ctx1.sendIdx["-"]=1;
  54184. self._assert_equals_($2,(1));
  54185. $ctx1.sendIdx["assert:equals:"]=2;
  54186. self._assert_equals_((-2).__minus((1)),(-3));
  54187. $ctx1.sendIdx["assert:equals:"]=3;
  54188. self._assert_equals_((12).__slash((2)),(6));
  54189. $ctx1.sendIdx["assert:equals:"]=4;
  54190. $3=(3).__star((4));
  54191. $ctx1.sendIdx["*"]=1;
  54192. self._assert_equals_($3,(12));
  54193. $ctx1.sendIdx["assert:equals:"]=5;
  54194. self._assert_equals_((7).__slash_slash((2)),(3));
  54195. $ctx1.sendIdx["assert:equals:"]=6;
  54196. self._assert_equals_((7).__backslash_backslash((2)),(1));
  54197. $ctx1.sendIdx["assert:equals:"]=7;
  54198. $5=(1).__plus((2));
  54199. $ctx1.sendIdx["+"]=2;
  54200. $4=$recv($5).__star((3));
  54201. $ctx1.sendIdx["*"]=2;
  54202. self._assert_equals_($4,(9));
  54203. $ctx1.sendIdx["assert:equals:"]=8;
  54204. self._assert_equals_((1).__plus((2).__star((3))),(7));
  54205. return self;
  54206. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  54207. },
  54208. args: [],
  54209. 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",
  54210. referencedClasses: [],
  54211. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  54212. }),
  54213. $globals.NumberTest);
  54214. $core.addMethod(
  54215. $core.method({
  54216. selector: "testAsNumber",
  54217. protocol: 'tests',
  54218. fn: function (){
  54219. var self=this;
  54220. return $core.withContext(function($ctx1) {
  54221. self._assert_equals_((3)._asNumber(),(3));
  54222. return self;
  54223. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  54224. },
  54225. args: [],
  54226. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  54227. referencedClasses: [],
  54228. messageSends: ["assert:equals:", "asNumber"]
  54229. }),
  54230. $globals.NumberTest);
  54231. $core.addMethod(
  54232. $core.method({
  54233. selector: "testCeiling",
  54234. protocol: 'tests',
  54235. fn: function (){
  54236. var self=this;
  54237. return $core.withContext(function($ctx1) {
  54238. var $1,$2;
  54239. $1=(1.2)._ceiling();
  54240. $ctx1.sendIdx["ceiling"]=1;
  54241. self._assert_equals_($1,(2));
  54242. $ctx1.sendIdx["assert:equals:"]=1;
  54243. $2=(-1.2)._ceiling();
  54244. $ctx1.sendIdx["ceiling"]=2;
  54245. self._assert_equals_($2,(-1));
  54246. $ctx1.sendIdx["assert:equals:"]=2;
  54247. self._assert_equals_((1)._ceiling(),(1));
  54248. return self;
  54249. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  54250. },
  54251. args: [],
  54252. 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.",
  54253. referencedClasses: [],
  54254. messageSends: ["assert:equals:", "ceiling"]
  54255. }),
  54256. $globals.NumberTest);
  54257. $core.addMethod(
  54258. $core.method({
  54259. selector: "testComparison",
  54260. protocol: 'tests',
  54261. fn: function (){
  54262. var self=this;
  54263. return $core.withContext(function($ctx1) {
  54264. var $1,$2,$3,$4;
  54265. $1=(3).__gt((2));
  54266. $ctx1.sendIdx[">"]=1;
  54267. self._assert_($1);
  54268. $ctx1.sendIdx["assert:"]=1;
  54269. $2=(2).__lt((3));
  54270. $ctx1.sendIdx["<"]=1;
  54271. self._assert_($2);
  54272. $ctx1.sendIdx["assert:"]=2;
  54273. self._deny_((3).__lt((2)));
  54274. $ctx1.sendIdx["deny:"]=1;
  54275. self._deny_((2).__gt((3)));
  54276. $3=(3).__gt_eq((3));
  54277. $ctx1.sendIdx[">="]=1;
  54278. self._assert_($3);
  54279. $ctx1.sendIdx["assert:"]=3;
  54280. self._assert_((3.1).__gt_eq((3)));
  54281. $ctx1.sendIdx["assert:"]=4;
  54282. $4=(3).__lt_eq((3));
  54283. $ctx1.sendIdx["<="]=1;
  54284. self._assert_($4);
  54285. $ctx1.sendIdx["assert:"]=5;
  54286. self._assert_((3).__lt_eq((3.1)));
  54287. return self;
  54288. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  54289. },
  54290. args: [],
  54291. 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",
  54292. referencedClasses: [],
  54293. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  54294. }),
  54295. $globals.NumberTest);
  54296. $core.addMethod(
  54297. $core.method({
  54298. selector: "testCopying",
  54299. protocol: 'tests',
  54300. fn: function (){
  54301. var self=this;
  54302. return $core.withContext(function($ctx1) {
  54303. var $1;
  54304. $1=$recv((1)._copy()).__eq_eq((1));
  54305. $ctx1.sendIdx["=="]=1;
  54306. self._assert_($1);
  54307. $ctx1.sendIdx["assert:"]=1;
  54308. self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  54309. return self;
  54310. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  54311. },
  54312. args: [],
  54313. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  54314. referencedClasses: [],
  54315. messageSends: ["assert:", "==", "copy", "deepCopy"]
  54316. }),
  54317. $globals.NumberTest);
  54318. $core.addMethod(
  54319. $core.method({
  54320. selector: "testEquality",
  54321. protocol: 'tests',
  54322. fn: function (){
  54323. var self=this;
  54324. return $core.withContext(function($ctx1) {
  54325. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  54326. $1=(1).__eq((1));
  54327. $ctx1.sendIdx["="]=1;
  54328. self._assert_($1);
  54329. $ctx1.sendIdx["assert:"]=1;
  54330. $2=(0).__eq((0));
  54331. $ctx1.sendIdx["="]=2;
  54332. self._assert_($2);
  54333. $ctx1.sendIdx["assert:"]=2;
  54334. $3=(1).__eq((0));
  54335. $ctx1.sendIdx["="]=3;
  54336. self._deny_($3);
  54337. $ctx1.sendIdx["deny:"]=1;
  54338. $5=(1)._yourself();
  54339. $ctx1.sendIdx["yourself"]=1;
  54340. $4=$recv($5).__eq((1));
  54341. $ctx1.sendIdx["="]=4;
  54342. self._assert_($4);
  54343. $ctx1.sendIdx["assert:"]=3;
  54344. $7=(1)._yourself();
  54345. $ctx1.sendIdx["yourself"]=2;
  54346. $6=(1).__eq($7);
  54347. $ctx1.sendIdx["="]=5;
  54348. self._assert_($6);
  54349. $ctx1.sendIdx["assert:"]=4;
  54350. $9=(1)._yourself();
  54351. $ctx1.sendIdx["yourself"]=3;
  54352. $8=$recv($9).__eq((1)._yourself());
  54353. $ctx1.sendIdx["="]=6;
  54354. self._assert_($8);
  54355. $10=(0).__eq(false);
  54356. $ctx1.sendIdx["="]=7;
  54357. self._deny_($10);
  54358. $ctx1.sendIdx["deny:"]=2;
  54359. $11=false.__eq((0));
  54360. $ctx1.sendIdx["="]=8;
  54361. self._deny_($11);
  54362. $ctx1.sendIdx["deny:"]=3;
  54363. $12="".__eq((0));
  54364. $ctx1.sendIdx["="]=9;
  54365. self._deny_($12);
  54366. $ctx1.sendIdx["deny:"]=4;
  54367. self._deny_((0).__eq(""));
  54368. return self;
  54369. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  54370. },
  54371. args: [],
  54372. 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 = ''",
  54373. referencedClasses: [],
  54374. messageSends: ["assert:", "=", "deny:", "yourself"]
  54375. }),
  54376. $globals.NumberTest);
  54377. $core.addMethod(
  54378. $core.method({
  54379. selector: "testFloor",
  54380. protocol: 'tests',
  54381. fn: function (){
  54382. var self=this;
  54383. return $core.withContext(function($ctx1) {
  54384. var $1,$2;
  54385. $1=(1.2)._floor();
  54386. $ctx1.sendIdx["floor"]=1;
  54387. self._assert_equals_($1,(1));
  54388. $ctx1.sendIdx["assert:equals:"]=1;
  54389. $2=(-1.2)._floor();
  54390. $ctx1.sendIdx["floor"]=2;
  54391. self._assert_equals_($2,(-2));
  54392. $ctx1.sendIdx["assert:equals:"]=2;
  54393. self._assert_equals_((1)._floor(),(1));
  54394. return self;
  54395. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  54396. },
  54397. args: [],
  54398. 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.",
  54399. referencedClasses: [],
  54400. messageSends: ["assert:equals:", "floor"]
  54401. }),
  54402. $globals.NumberTest);
  54403. $core.addMethod(
  54404. $core.method({
  54405. selector: "testHexNumbers",
  54406. protocol: 'tests',
  54407. fn: function (){
  54408. var self=this;
  54409. return $core.withContext(function($ctx1) {
  54410. var $1,$2,$3,$4,$5;
  54411. self._assert_equals_((9),(9));
  54412. $ctx1.sendIdx["assert:equals:"]=1;
  54413. $1=(10)._truncated();
  54414. $ctx1.sendIdx["truncated"]=1;
  54415. self._assert_equals_($1,(10));
  54416. $ctx1.sendIdx["assert:equals:"]=2;
  54417. $2=(11)._truncated();
  54418. $ctx1.sendIdx["truncated"]=2;
  54419. self._assert_equals_($2,(11));
  54420. $ctx1.sendIdx["assert:equals:"]=3;
  54421. $3=(12)._truncated();
  54422. $ctx1.sendIdx["truncated"]=3;
  54423. self._assert_equals_($3,(12));
  54424. $ctx1.sendIdx["assert:equals:"]=4;
  54425. $4=(13)._truncated();
  54426. $ctx1.sendIdx["truncated"]=4;
  54427. self._assert_equals_($4,(13));
  54428. $ctx1.sendIdx["assert:equals:"]=5;
  54429. $5=(14)._truncated();
  54430. $ctx1.sendIdx["truncated"]=5;
  54431. self._assert_equals_($5,(14));
  54432. $ctx1.sendIdx["assert:equals:"]=6;
  54433. self._assert_equals_((15)._truncated(),(15));
  54434. return self;
  54435. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  54436. },
  54437. args: [],
  54438. 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",
  54439. referencedClasses: [],
  54440. messageSends: ["assert:equals:", "truncated"]
  54441. }),
  54442. $globals.NumberTest);
  54443. $core.addMethod(
  54444. $core.method({
  54445. selector: "testIdentity",
  54446. protocol: 'tests',
  54447. fn: function (){
  54448. var self=this;
  54449. return $core.withContext(function($ctx1) {
  54450. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  54451. $1=(1).__eq_eq((1));
  54452. $ctx1.sendIdx["=="]=1;
  54453. self._assert_($1);
  54454. $ctx1.sendIdx["assert:"]=1;
  54455. $2=(0).__eq_eq((0));
  54456. $ctx1.sendIdx["=="]=2;
  54457. self._assert_($2);
  54458. $ctx1.sendIdx["assert:"]=2;
  54459. $3=(1).__eq_eq((0));
  54460. $ctx1.sendIdx["=="]=3;
  54461. self._deny_($3);
  54462. $ctx1.sendIdx["deny:"]=1;
  54463. $5=(1)._yourself();
  54464. $ctx1.sendIdx["yourself"]=1;
  54465. $4=$recv($5).__eq_eq((1));
  54466. $ctx1.sendIdx["=="]=4;
  54467. self._assert_($4);
  54468. $ctx1.sendIdx["assert:"]=3;
  54469. $7=(1)._yourself();
  54470. $ctx1.sendIdx["yourself"]=2;
  54471. $6=(1).__eq_eq($7);
  54472. $ctx1.sendIdx["=="]=5;
  54473. self._assert_($6);
  54474. $ctx1.sendIdx["assert:"]=4;
  54475. $9=(1)._yourself();
  54476. $ctx1.sendIdx["yourself"]=3;
  54477. $8=$recv($9).__eq_eq((1)._yourself());
  54478. $ctx1.sendIdx["=="]=6;
  54479. self._assert_($8);
  54480. self._deny_((1).__eq_eq((2)));
  54481. return self;
  54482. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  54483. },
  54484. args: [],
  54485. 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",
  54486. referencedClasses: [],
  54487. messageSends: ["assert:", "==", "deny:", "yourself"]
  54488. }),
  54489. $globals.NumberTest);
  54490. $core.addMethod(
  54491. $core.method({
  54492. selector: "testInvalidHexNumbers",
  54493. protocol: 'tests',
  54494. fn: function (){
  54495. var self=this;
  54496. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  54497. return $core.withContext(function($ctx1) {
  54498. self._should_raise_((function(){
  54499. return $core.withContext(function($ctx2) {
  54500. return (16)._rG();
  54501. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54502. }),$MessageNotUnderstood());
  54503. $ctx1.sendIdx["should:raise:"]=1;
  54504. self._should_raise_((function(){
  54505. return $core.withContext(function($ctx2) {
  54506. return (16)._rg();
  54507. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54508. }),$MessageNotUnderstood());
  54509. $ctx1.sendIdx["should:raise:"]=2;
  54510. self._should_raise_((function(){
  54511. return $core.withContext(function($ctx2) {
  54512. return (16)._rH();
  54513. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  54514. }),$MessageNotUnderstood());
  54515. $ctx1.sendIdx["should:raise:"]=3;
  54516. self._should_raise_((function(){
  54517. return $core.withContext(function($ctx2) {
  54518. return (16)._rh();
  54519. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  54520. }),$MessageNotUnderstood());
  54521. $ctx1.sendIdx["should:raise:"]=4;
  54522. self._should_raise_((function(){
  54523. return $core.withContext(function($ctx2) {
  54524. return (16)._rI();
  54525. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  54526. }),$MessageNotUnderstood());
  54527. $ctx1.sendIdx["should:raise:"]=5;
  54528. self._should_raise_((function(){
  54529. return $core.withContext(function($ctx2) {
  54530. return (16)._ri();
  54531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  54532. }),$MessageNotUnderstood());
  54533. $ctx1.sendIdx["should:raise:"]=6;
  54534. self._should_raise_((function(){
  54535. return $core.withContext(function($ctx2) {
  54536. return (16)._rJ();
  54537. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  54538. }),$MessageNotUnderstood());
  54539. $ctx1.sendIdx["should:raise:"]=7;
  54540. self._should_raise_((function(){
  54541. return $core.withContext(function($ctx2) {
  54542. return (16)._rj();
  54543. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  54544. }),$MessageNotUnderstood());
  54545. $ctx1.sendIdx["should:raise:"]=8;
  54546. self._should_raise_((function(){
  54547. return $core.withContext(function($ctx2) {
  54548. return (16)._rK();
  54549. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  54550. }),$MessageNotUnderstood());
  54551. $ctx1.sendIdx["should:raise:"]=9;
  54552. self._should_raise_((function(){
  54553. return $core.withContext(function($ctx2) {
  54554. return (16)._rk();
  54555. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  54556. }),$MessageNotUnderstood());
  54557. $ctx1.sendIdx["should:raise:"]=10;
  54558. self._should_raise_((function(){
  54559. return $core.withContext(function($ctx2) {
  54560. return (16)._rL();
  54561. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  54562. }),$MessageNotUnderstood());
  54563. $ctx1.sendIdx["should:raise:"]=11;
  54564. self._should_raise_((function(){
  54565. return $core.withContext(function($ctx2) {
  54566. return (16)._rl();
  54567. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  54568. }),$MessageNotUnderstood());
  54569. $ctx1.sendIdx["should:raise:"]=12;
  54570. self._should_raise_((function(){
  54571. return $core.withContext(function($ctx2) {
  54572. return (16)._rM();
  54573. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  54574. }),$MessageNotUnderstood());
  54575. $ctx1.sendIdx["should:raise:"]=13;
  54576. self._should_raise_((function(){
  54577. return $core.withContext(function($ctx2) {
  54578. return (16)._rm();
  54579. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  54580. }),$MessageNotUnderstood());
  54581. $ctx1.sendIdx["should:raise:"]=14;
  54582. self._should_raise_((function(){
  54583. return $core.withContext(function($ctx2) {
  54584. return (16)._rN();
  54585. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  54586. }),$MessageNotUnderstood());
  54587. $ctx1.sendIdx["should:raise:"]=15;
  54588. self._should_raise_((function(){
  54589. return $core.withContext(function($ctx2) {
  54590. return (16)._rn();
  54591. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  54592. }),$MessageNotUnderstood());
  54593. $ctx1.sendIdx["should:raise:"]=16;
  54594. self._should_raise_((function(){
  54595. return $core.withContext(function($ctx2) {
  54596. return (16)._rO();
  54597. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  54598. }),$MessageNotUnderstood());
  54599. $ctx1.sendIdx["should:raise:"]=17;
  54600. self._should_raise_((function(){
  54601. return $core.withContext(function($ctx2) {
  54602. return (16)._ro();
  54603. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  54604. }),$MessageNotUnderstood());
  54605. $ctx1.sendIdx["should:raise:"]=18;
  54606. self._should_raise_((function(){
  54607. return $core.withContext(function($ctx2) {
  54608. return (16)._rP();
  54609. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  54610. }),$MessageNotUnderstood());
  54611. $ctx1.sendIdx["should:raise:"]=19;
  54612. self._should_raise_((function(){
  54613. return $core.withContext(function($ctx2) {
  54614. return (16)._rp();
  54615. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  54616. }),$MessageNotUnderstood());
  54617. $ctx1.sendIdx["should:raise:"]=20;
  54618. self._should_raise_((function(){
  54619. return $core.withContext(function($ctx2) {
  54620. return (16)._rQ();
  54621. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  54622. }),$MessageNotUnderstood());
  54623. $ctx1.sendIdx["should:raise:"]=21;
  54624. self._should_raise_((function(){
  54625. return $core.withContext(function($ctx2) {
  54626. return (16)._rq();
  54627. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  54628. }),$MessageNotUnderstood());
  54629. $ctx1.sendIdx["should:raise:"]=22;
  54630. self._should_raise_((function(){
  54631. return $core.withContext(function($ctx2) {
  54632. return (16)._rR();
  54633. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  54634. }),$MessageNotUnderstood());
  54635. $ctx1.sendIdx["should:raise:"]=23;
  54636. self._should_raise_((function(){
  54637. return $core.withContext(function($ctx2) {
  54638. return (16)._rr();
  54639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  54640. }),$MessageNotUnderstood());
  54641. $ctx1.sendIdx["should:raise:"]=24;
  54642. self._should_raise_((function(){
  54643. return $core.withContext(function($ctx2) {
  54644. return (16)._rS();
  54645. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  54646. }),$MessageNotUnderstood());
  54647. $ctx1.sendIdx["should:raise:"]=25;
  54648. self._should_raise_((function(){
  54649. return $core.withContext(function($ctx2) {
  54650. return (16)._rs();
  54651. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  54652. }),$MessageNotUnderstood());
  54653. $ctx1.sendIdx["should:raise:"]=26;
  54654. self._should_raise_((function(){
  54655. return $core.withContext(function($ctx2) {
  54656. return (16)._rT();
  54657. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  54658. }),$MessageNotUnderstood());
  54659. $ctx1.sendIdx["should:raise:"]=27;
  54660. self._should_raise_((function(){
  54661. return $core.withContext(function($ctx2) {
  54662. return (16)._rt();
  54663. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  54664. }),$MessageNotUnderstood());
  54665. $ctx1.sendIdx["should:raise:"]=28;
  54666. self._should_raise_((function(){
  54667. return $core.withContext(function($ctx2) {
  54668. return (16)._rU();
  54669. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  54670. }),$MessageNotUnderstood());
  54671. $ctx1.sendIdx["should:raise:"]=29;
  54672. self._should_raise_((function(){
  54673. return $core.withContext(function($ctx2) {
  54674. return (16)._ru();
  54675. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  54676. }),$MessageNotUnderstood());
  54677. $ctx1.sendIdx["should:raise:"]=30;
  54678. self._should_raise_((function(){
  54679. return $core.withContext(function($ctx2) {
  54680. return (16)._rV();
  54681. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  54682. }),$MessageNotUnderstood());
  54683. $ctx1.sendIdx["should:raise:"]=31;
  54684. self._should_raise_((function(){
  54685. return $core.withContext(function($ctx2) {
  54686. return (16)._rv();
  54687. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  54688. }),$MessageNotUnderstood());
  54689. $ctx1.sendIdx["should:raise:"]=32;
  54690. self._should_raise_((function(){
  54691. return $core.withContext(function($ctx2) {
  54692. return (16)._rW();
  54693. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  54694. }),$MessageNotUnderstood());
  54695. $ctx1.sendIdx["should:raise:"]=33;
  54696. self._should_raise_((function(){
  54697. return $core.withContext(function($ctx2) {
  54698. return (16)._rw();
  54699. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  54700. }),$MessageNotUnderstood());
  54701. $ctx1.sendIdx["should:raise:"]=34;
  54702. self._should_raise_((function(){
  54703. return $core.withContext(function($ctx2) {
  54704. return (16)._rX();
  54705. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  54706. }),$MessageNotUnderstood());
  54707. $ctx1.sendIdx["should:raise:"]=35;
  54708. self._should_raise_((function(){
  54709. return $core.withContext(function($ctx2) {
  54710. return (16)._rx();
  54711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  54712. }),$MessageNotUnderstood());
  54713. $ctx1.sendIdx["should:raise:"]=36;
  54714. self._should_raise_((function(){
  54715. return $core.withContext(function($ctx2) {
  54716. return (16)._rY();
  54717. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  54718. }),$MessageNotUnderstood());
  54719. $ctx1.sendIdx["should:raise:"]=37;
  54720. self._should_raise_((function(){
  54721. return $core.withContext(function($ctx2) {
  54722. return (16)._ry();
  54723. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  54724. }),$MessageNotUnderstood());
  54725. $ctx1.sendIdx["should:raise:"]=38;
  54726. self._should_raise_((function(){
  54727. return $core.withContext(function($ctx2) {
  54728. return (16)._rZ();
  54729. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  54730. }),$MessageNotUnderstood());
  54731. $ctx1.sendIdx["should:raise:"]=39;
  54732. self._should_raise_((function(){
  54733. return $core.withContext(function($ctx2) {
  54734. return (16)._rz();
  54735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  54736. }),$MessageNotUnderstood());
  54737. $ctx1.sendIdx["should:raise:"]=40;
  54738. self._should_raise_((function(){
  54739. return $core.withContext(function($ctx2) {
  54740. return (11259375)._Z();
  54741. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  54742. }),$MessageNotUnderstood());
  54743. return self;
  54744. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  54745. },
  54746. args: [],
  54747. 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.",
  54748. referencedClasses: ["MessageNotUnderstood"],
  54749. 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"]
  54750. }),
  54751. $globals.NumberTest);
  54752. $core.addMethod(
  54753. $core.method({
  54754. selector: "testLog",
  54755. protocol: 'tests',
  54756. fn: function (){
  54757. var self=this;
  54758. function $Number(){return $globals.Number||(typeof Number=="undefined"?nil:Number)}
  54759. return $core.withContext(function($ctx1) {
  54760. self._assert_equals_((10000)._log(),(4));
  54761. $ctx1.sendIdx["assert:equals:"]=1;
  54762. self._assert_equals_((512)._log_((2)),(9));
  54763. $ctx1.sendIdx["assert:equals:"]=2;
  54764. self._assert_equals_($recv($recv($Number())._e())._ln(),(1));
  54765. return self;
  54766. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  54767. },
  54768. args: [],
  54769. 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.",
  54770. referencedClasses: ["Number"],
  54771. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  54772. }),
  54773. $globals.NumberTest);
  54774. $core.addMethod(
  54775. $core.method({
  54776. selector: "testMinMax",
  54777. protocol: 'tests',
  54778. fn: function (){
  54779. var self=this;
  54780. return $core.withContext(function($ctx1) {
  54781. self._assert_equals_((2)._max_((5)),(5));
  54782. $ctx1.sendIdx["assert:equals:"]=1;
  54783. self._assert_equals_((2)._min_((5)),(2));
  54784. return self;
  54785. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  54786. },
  54787. args: [],
  54788. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  54789. referencedClasses: [],
  54790. messageSends: ["assert:equals:", "max:", "min:"]
  54791. }),
  54792. $globals.NumberTest);
  54793. $core.addMethod(
  54794. $core.method({
  54795. selector: "testNegated",
  54796. protocol: 'tests',
  54797. fn: function (){
  54798. var self=this;
  54799. return $core.withContext(function($ctx1) {
  54800. var $1;
  54801. $1=(3)._negated();
  54802. $ctx1.sendIdx["negated"]=1;
  54803. self._assert_equals_($1,(-3));
  54804. $ctx1.sendIdx["assert:equals:"]=1;
  54805. self._assert_equals_((-3)._negated(),(3));
  54806. return self;
  54807. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  54808. },
  54809. args: [],
  54810. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  54811. referencedClasses: [],
  54812. messageSends: ["assert:equals:", "negated"]
  54813. }),
  54814. $globals.NumberTest);
  54815. $core.addMethod(
  54816. $core.method({
  54817. selector: "testPrintShowingDecimalPlaces",
  54818. protocol: 'tests',
  54819. fn: function (){
  54820. var self=this;
  54821. return $core.withContext(function($ctx1) {
  54822. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  54823. $1=(23)._printShowingDecimalPlaces_((2));
  54824. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  54825. self._assert_equals_($1,"23.00");
  54826. $ctx1.sendIdx["assert:equals:"]=1;
  54827. $2=(23.5698)._printShowingDecimalPlaces_((2));
  54828. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  54829. self._assert_equals_($2,"23.57");
  54830. $ctx1.sendIdx["assert:equals:"]=2;
  54831. $4=(234.567)._negated();
  54832. $ctx1.sendIdx["negated"]=1;
  54833. $3=$recv($4)._printShowingDecimalPlaces_((5));
  54834. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  54835. self._assert_equals_($3,"-234.56700");
  54836. $ctx1.sendIdx["assert:equals:"]=3;
  54837. $5=(23.4567)._printShowingDecimalPlaces_((0));
  54838. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  54839. self._assert_equals_($5,"23");
  54840. $ctx1.sendIdx["assert:equals:"]=4;
  54841. $6=(23.5567)._printShowingDecimalPlaces_((0));
  54842. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  54843. self._assert_equals_($6,"24");
  54844. $ctx1.sendIdx["assert:equals:"]=5;
  54845. $8=(23.4567)._negated();
  54846. $ctx1.sendIdx["negated"]=2;
  54847. $7=$recv($8)._printShowingDecimalPlaces_((0));
  54848. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  54849. self._assert_equals_($7,"-23");
  54850. $ctx1.sendIdx["assert:equals:"]=6;
  54851. $10=(23.5567)._negated();
  54852. $ctx1.sendIdx["negated"]=3;
  54853. $9=$recv($10)._printShowingDecimalPlaces_((0));
  54854. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  54855. self._assert_equals_($9,"-24");
  54856. $ctx1.sendIdx["assert:equals:"]=7;
  54857. $11=(100000000)._printShowingDecimalPlaces_((1));
  54858. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  54859. self._assert_equals_($11,"100000000.0");
  54860. $ctx1.sendIdx["assert:equals:"]=8;
  54861. $12=(0.98)._printShowingDecimalPlaces_((5));
  54862. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  54863. self._assert_equals_($12,"0.98000");
  54864. $ctx1.sendIdx["assert:equals:"]=9;
  54865. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  54866. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  54867. self._assert_equals_($13,"-0.98");
  54868. $ctx1.sendIdx["assert:equals:"]=10;
  54869. $14=(2.567)._printShowingDecimalPlaces_((2));
  54870. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  54871. self._assert_equals_($14,"2.57");
  54872. $ctx1.sendIdx["assert:equals:"]=11;
  54873. $15=(-2.567)._printShowingDecimalPlaces_((2));
  54874. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  54875. self._assert_equals_($15,"-2.57");
  54876. $ctx1.sendIdx["assert:equals:"]=12;
  54877. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  54878. return self;
  54879. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  54880. },
  54881. args: [],
  54882. 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'.",
  54883. referencedClasses: [],
  54884. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  54885. }),
  54886. $globals.NumberTest);
  54887. $core.addMethod(
  54888. $core.method({
  54889. selector: "testRaisedTo",
  54890. protocol: 'tests',
  54891. fn: function (){
  54892. var self=this;
  54893. return $core.withContext(function($ctx1) {
  54894. var $1,$2,$3;
  54895. $1=(2)._raisedTo_((4));
  54896. $ctx1.sendIdx["raisedTo:"]=1;
  54897. self._assert_equals_($1,(16));
  54898. $ctx1.sendIdx["assert:equals:"]=1;
  54899. $2=(2)._raisedTo_((0));
  54900. $ctx1.sendIdx["raisedTo:"]=2;
  54901. self._assert_equals_($2,(1));
  54902. $ctx1.sendIdx["assert:equals:"]=2;
  54903. $3=(2)._raisedTo_((-3));
  54904. $ctx1.sendIdx["raisedTo:"]=3;
  54905. self._assert_equals_($3,(0.125));
  54906. $ctx1.sendIdx["assert:equals:"]=3;
  54907. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  54908. $ctx1.sendIdx["assert:equals:"]=4;
  54909. self._assert_equals_((2).__star_star((4)),(16));
  54910. return self;
  54911. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  54912. },
  54913. args: [],
  54914. 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.",
  54915. referencedClasses: [],
  54916. messageSends: ["assert:equals:", "raisedTo:", "**"]
  54917. }),
  54918. $globals.NumberTest);
  54919. $core.addMethod(
  54920. $core.method({
  54921. selector: "testRounded",
  54922. protocol: 'tests',
  54923. fn: function (){
  54924. var self=this;
  54925. return $core.withContext(function($ctx1) {
  54926. var $1,$2;
  54927. $1=(3)._rounded();
  54928. $ctx1.sendIdx["rounded"]=1;
  54929. self._assert_equals_($1,(3));
  54930. $ctx1.sendIdx["assert:equals:"]=1;
  54931. $2=(3.212)._rounded();
  54932. $ctx1.sendIdx["rounded"]=2;
  54933. self._assert_equals_($2,(3));
  54934. $ctx1.sendIdx["assert:equals:"]=2;
  54935. self._assert_equals_((3.51)._rounded(),(4));
  54936. return self;
  54937. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  54938. },
  54939. args: [],
  54940. 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",
  54941. referencedClasses: [],
  54942. messageSends: ["assert:equals:", "rounded"]
  54943. }),
  54944. $globals.NumberTest);
  54945. $core.addMethod(
  54946. $core.method({
  54947. selector: "testSign",
  54948. protocol: 'tests',
  54949. fn: function (){
  54950. var self=this;
  54951. return $core.withContext(function($ctx1) {
  54952. var $1,$2;
  54953. $1=(5)._sign();
  54954. $ctx1.sendIdx["sign"]=1;
  54955. self._assert_equals_($1,(1));
  54956. $ctx1.sendIdx["assert:equals:"]=1;
  54957. $2=(0)._sign();
  54958. $ctx1.sendIdx["sign"]=2;
  54959. self._assert_equals_($2,(0));
  54960. $ctx1.sendIdx["assert:equals:"]=2;
  54961. self._assert_equals_((-1.4)._sign(),(-1));
  54962. return self;
  54963. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  54964. },
  54965. args: [],
  54966. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  54967. referencedClasses: [],
  54968. messageSends: ["assert:equals:", "sign"]
  54969. }),
  54970. $globals.NumberTest);
  54971. $core.addMethod(
  54972. $core.method({
  54973. selector: "testSqrt",
  54974. protocol: 'tests',
  54975. fn: function (){
  54976. var self=this;
  54977. return $core.withContext(function($ctx1) {
  54978. var $1;
  54979. $1=(4)._sqrt();
  54980. $ctx1.sendIdx["sqrt"]=1;
  54981. self._assert_equals_($1,(2));
  54982. $ctx1.sendIdx["assert:equals:"]=1;
  54983. self._assert_equals_((16)._sqrt(),(4));
  54984. return self;
  54985. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  54986. },
  54987. args: [],
  54988. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  54989. referencedClasses: [],
  54990. messageSends: ["assert:equals:", "sqrt"]
  54991. }),
  54992. $globals.NumberTest);
  54993. $core.addMethod(
  54994. $core.method({
  54995. selector: "testSquared",
  54996. protocol: 'tests',
  54997. fn: function (){
  54998. var self=this;
  54999. return $core.withContext(function($ctx1) {
  55000. self._assert_equals_((4)._squared(),(16));
  55001. return self;
  55002. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  55003. },
  55004. args: [],
  55005. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  55006. referencedClasses: [],
  55007. messageSends: ["assert:equals:", "squared"]
  55008. }),
  55009. $globals.NumberTest);
  55010. $core.addMethod(
  55011. $core.method({
  55012. selector: "testTimesRepeat",
  55013. protocol: 'tests',
  55014. fn: function (){
  55015. var self=this;
  55016. var i;
  55017. return $core.withContext(function($ctx1) {
  55018. i=(0);
  55019. (0)._timesRepeat_((function(){
  55020. return $core.withContext(function($ctx2) {
  55021. i=$recv(i).__plus((1));
  55022. $ctx2.sendIdx["+"]=1;
  55023. return i;
  55024. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55025. }));
  55026. $ctx1.sendIdx["timesRepeat:"]=1;
  55027. self._assert_equals_(i,(0));
  55028. $ctx1.sendIdx["assert:equals:"]=1;
  55029. (5)._timesRepeat_((function(){
  55030. return $core.withContext(function($ctx2) {
  55031. i=$recv(i).__plus((1));
  55032. return i;
  55033. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55034. }));
  55035. self._assert_equals_(i,(5));
  55036. return self;
  55037. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  55038. },
  55039. args: [],
  55040. 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",
  55041. referencedClasses: [],
  55042. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  55043. }),
  55044. $globals.NumberTest);
  55045. $core.addMethod(
  55046. $core.method({
  55047. selector: "testTo",
  55048. protocol: 'tests',
  55049. fn: function (){
  55050. var self=this;
  55051. return $core.withContext(function($ctx1) {
  55052. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  55053. return self;
  55054. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  55055. },
  55056. args: [],
  55057. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  55058. referencedClasses: [],
  55059. messageSends: ["assert:equals:", "to:"]
  55060. }),
  55061. $globals.NumberTest);
  55062. $core.addMethod(
  55063. $core.method({
  55064. selector: "testToBy",
  55065. protocol: 'tests',
  55066. fn: function (){
  55067. var self=this;
  55068. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  55069. return $core.withContext(function($ctx1) {
  55070. var $1;
  55071. $1=(0)._to_by_((6),(2));
  55072. $ctx1.sendIdx["to:by:"]=1;
  55073. self._assert_equals_($1,[(0), (2), (4), (6)]);
  55074. self._should_raise_((function(){
  55075. return $core.withContext(function($ctx2) {
  55076. return (1)._to_by_((4),(0));
  55077. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55078. }),$Error());
  55079. return self;
  55080. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  55081. },
  55082. args: [],
  55083. 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",
  55084. referencedClasses: ["Error"],
  55085. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  55086. }),
  55087. $globals.NumberTest);
  55088. $core.addMethod(
  55089. $core.method({
  55090. selector: "testTrigonometry",
  55091. protocol: 'tests',
  55092. fn: function (){
  55093. var self=this;
  55094. return $core.withContext(function($ctx1) {
  55095. self._assert_equals_((0)._cos(),(1));
  55096. $ctx1.sendIdx["assert:equals:"]=1;
  55097. self._assert_equals_((0)._sin(),(0));
  55098. $ctx1.sendIdx["assert:equals:"]=2;
  55099. self._assert_equals_((0)._tan(),(0));
  55100. $ctx1.sendIdx["assert:equals:"]=3;
  55101. self._assert_equals_((1)._arcCos(),(0));
  55102. $ctx1.sendIdx["assert:equals:"]=4;
  55103. self._assert_equals_((0)._arcSin(),(0));
  55104. $ctx1.sendIdx["assert:equals:"]=5;
  55105. self._assert_equals_((0)._arcTan(),(0));
  55106. return self;
  55107. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  55108. },
  55109. args: [],
  55110. 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.",
  55111. referencedClasses: [],
  55112. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"]
  55113. }),
  55114. $globals.NumberTest);
  55115. $core.addMethod(
  55116. $core.method({
  55117. selector: "testTruncated",
  55118. protocol: 'tests',
  55119. fn: function (){
  55120. var self=this;
  55121. return $core.withContext(function($ctx1) {
  55122. var $1,$2;
  55123. $1=(3)._truncated();
  55124. $ctx1.sendIdx["truncated"]=1;
  55125. self._assert_equals_($1,(3));
  55126. $ctx1.sendIdx["assert:equals:"]=1;
  55127. $2=(3.212)._truncated();
  55128. $ctx1.sendIdx["truncated"]=2;
  55129. self._assert_equals_($2,(3));
  55130. $ctx1.sendIdx["assert:equals:"]=2;
  55131. self._assert_equals_((3.51)._truncated(),(3));
  55132. return self;
  55133. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  55134. },
  55135. args: [],
  55136. 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",
  55137. referencedClasses: [],
  55138. messageSends: ["assert:equals:", "truncated"]
  55139. }),
  55140. $globals.NumberTest);
  55141. $core.addClass('ObjectMock', $globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  55142. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  55143. $core.addMethod(
  55144. $core.method({
  55145. selector: "foo",
  55146. protocol: 'not yet classified',
  55147. fn: function (){
  55148. var self=this;
  55149. return self["@foo"];
  55150. },
  55151. args: [],
  55152. source: "foo\x0a\x09^ foo",
  55153. referencedClasses: [],
  55154. messageSends: []
  55155. }),
  55156. $globals.ObjectMock);
  55157. $core.addMethod(
  55158. $core.method({
  55159. selector: "foo:",
  55160. protocol: 'not yet classified',
  55161. fn: function (anObject){
  55162. var self=this;
  55163. self["@foo"]=anObject;
  55164. return self;
  55165. },
  55166. args: ["anObject"],
  55167. source: "foo: anObject\x0a\x09foo := anObject",
  55168. referencedClasses: [],
  55169. messageSends: []
  55170. }),
  55171. $globals.ObjectMock);
  55172. $core.addClass('ObjectTest', $globals.TestCase, [], 'Kernel-Tests');
  55173. $core.addMethod(
  55174. $core.method({
  55175. selector: "notDefined",
  55176. protocol: 'tests',
  55177. fn: function (){
  55178. var self=this;
  55179. return $core.withContext(function($ctx1) {
  55180. return void 0;;
  55181. return self;
  55182. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  55183. },
  55184. args: [],
  55185. source: "notDefined\x0a\x09<return void 0;>",
  55186. referencedClasses: [],
  55187. messageSends: []
  55188. }),
  55189. $globals.ObjectTest);
  55190. $core.addMethod(
  55191. $core.method({
  55192. selector: "testBasicAccess",
  55193. protocol: 'tests',
  55194. fn: function (){
  55195. var self=this;
  55196. var o;
  55197. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  55198. return $core.withContext(function($ctx1) {
  55199. var $1;
  55200. o=$recv($Object())._new();
  55201. $recv(o)._basicAt_put_("a",(1));
  55202. $1=$recv(o)._basicAt_("a");
  55203. $ctx1.sendIdx["basicAt:"]=1;
  55204. self._assert_equals_($1,(1));
  55205. $ctx1.sendIdx["assert:equals:"]=1;
  55206. self._assert_equals_($recv(o)._basicAt_("b"),nil);
  55207. return self;
  55208. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  55209. },
  55210. args: [],
  55211. 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",
  55212. referencedClasses: ["Object"],
  55213. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  55214. }),
  55215. $globals.ObjectTest);
  55216. $core.addMethod(
  55217. $core.method({
  55218. selector: "testBasicPerform",
  55219. protocol: 'tests',
  55220. fn: function (){
  55221. var self=this;
  55222. var o;
  55223. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  55224. return $core.withContext(function($ctx1) {
  55225. o=$recv($Object())._new();
  55226. $recv(o)._basicAt_put_("func",(function(){
  55227. return "hello";
  55228. }));
  55229. $ctx1.sendIdx["basicAt:put:"]=1;
  55230. $recv(o)._basicAt_put_("func2",(function(a){
  55231. return $core.withContext(function($ctx2) {
  55232. return $recv(a).__plus((1));
  55233. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  55234. }));
  55235. self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  55236. $ctx1.sendIdx["assert:equals:"]=1;
  55237. self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  55238. return self;
  55239. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  55240. },
  55241. args: [],
  55242. 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",
  55243. referencedClasses: ["Object"],
  55244. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  55245. }),
  55246. $globals.ObjectTest);
  55247. $core.addMethod(
  55248. $core.method({
  55249. selector: "testDNU",
  55250. protocol: 'tests',
  55251. fn: function (){
  55252. var self=this;
  55253. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  55254. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  55255. return $core.withContext(function($ctx1) {
  55256. self._should_raise_((function(){
  55257. return $core.withContext(function($ctx2) {
  55258. return $recv($recv($Object())._new())._foo();
  55259. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55260. }),$MessageNotUnderstood());
  55261. return self;
  55262. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  55263. },
  55264. args: [],
  55265. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  55266. referencedClasses: ["Object", "MessageNotUnderstood"],
  55267. messageSends: ["should:raise:", "foo", "new"]
  55268. }),
  55269. $globals.ObjectTest);
  55270. $core.addMethod(
  55271. $core.method({
  55272. selector: "testEquality",
  55273. protocol: 'tests',
  55274. fn: function (){
  55275. var self=this;
  55276. var o;
  55277. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  55278. return $core.withContext(function($ctx1) {
  55279. var $1,$2,$4,$3;
  55280. o=$recv($Object())._new();
  55281. $ctx1.sendIdx["new"]=1;
  55282. $1=$recv(o).__eq($recv($Object())._new());
  55283. $ctx1.sendIdx["="]=1;
  55284. self._deny_($1);
  55285. $2=$recv(o).__eq(o);
  55286. $ctx1.sendIdx["="]=2;
  55287. self._assert_($2);
  55288. $ctx1.sendIdx["assert:"]=1;
  55289. $4=$recv(o)._yourself();
  55290. $ctx1.sendIdx["yourself"]=1;
  55291. $3=$recv($4).__eq(o);
  55292. $ctx1.sendIdx["="]=3;
  55293. self._assert_($3);
  55294. $ctx1.sendIdx["assert:"]=2;
  55295. self._assert_($recv(o).__eq($recv(o)._yourself()));
  55296. return self;
  55297. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  55298. },
  55299. args: [],
  55300. 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)",
  55301. referencedClasses: ["Object"],
  55302. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  55303. }),
  55304. $globals.ObjectTest);
  55305. $core.addMethod(
  55306. $core.method({
  55307. selector: "testHalt",
  55308. protocol: 'tests',
  55309. fn: function (){
  55310. var self=this;
  55311. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  55312. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  55313. return $core.withContext(function($ctx1) {
  55314. self._should_raise_((function(){
  55315. return $core.withContext(function($ctx2) {
  55316. return $recv($recv($Object())._new())._halt();
  55317. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55318. }),$Error());
  55319. return self;
  55320. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  55321. },
  55322. args: [],
  55323. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  55324. referencedClasses: ["Object", "Error"],
  55325. messageSends: ["should:raise:", "halt", "new"]
  55326. }),
  55327. $globals.ObjectTest);
  55328. $core.addMethod(
  55329. $core.method({
  55330. selector: "testIdentity",
  55331. protocol: 'tests',
  55332. fn: function (){
  55333. var self=this;
  55334. var o;
  55335. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  55336. return $core.withContext(function($ctx1) {
  55337. var $1,$2,$4,$3;
  55338. o=$recv($Object())._new();
  55339. $ctx1.sendIdx["new"]=1;
  55340. $1=$recv(o).__eq_eq($recv($Object())._new());
  55341. $ctx1.sendIdx["=="]=1;
  55342. self._deny_($1);
  55343. $2=$recv(o).__eq_eq(o);
  55344. $ctx1.sendIdx["=="]=2;
  55345. self._assert_($2);
  55346. $ctx1.sendIdx["assert:"]=1;
  55347. $4=$recv(o)._yourself();
  55348. $ctx1.sendIdx["yourself"]=1;
  55349. $3=$recv($4).__eq_eq(o);
  55350. $ctx1.sendIdx["=="]=3;
  55351. self._assert_($3);
  55352. $ctx1.sendIdx["assert:"]=2;
  55353. self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  55354. return self;
  55355. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  55356. },
  55357. args: [],
  55358. 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",
  55359. referencedClasses: ["Object"],
  55360. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  55361. }),
  55362. $globals.ObjectTest);
  55363. $core.addMethod(
  55364. $core.method({
  55365. selector: "testIfNil",
  55366. protocol: 'tests',
  55367. fn: function (){
  55368. var self=this;
  55369. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  55370. return $core.withContext(function($ctx1) {
  55371. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  55372. $2=$recv($Object())._new();
  55373. $ctx1.sendIdx["new"]=1;
  55374. $1=$recv($2)._isNil();
  55375. self._deny_($1);
  55376. $ctx1.sendIdx["deny:"]=1;
  55377. $5=$recv($Object())._new();
  55378. $ctx1.sendIdx["new"]=2;
  55379. if(($receiver = $5) == null || $receiver.isNil){
  55380. $4=true;
  55381. } else {
  55382. $4=$5;
  55383. };
  55384. $3=$recv($4).__eq(true);
  55385. self._deny_($3);
  55386. $7=$recv($Object())._new();
  55387. $ctx1.sendIdx["new"]=3;
  55388. if(($receiver = $7) == null || $receiver.isNil){
  55389. $6=$7;
  55390. } else {
  55391. $6=true;
  55392. };
  55393. self._assert_equals_($6,true);
  55394. $ctx1.sendIdx["assert:equals:"]=1;
  55395. $9=$recv($Object())._new();
  55396. $ctx1.sendIdx["new"]=4;
  55397. if(($receiver = $9) == null || $receiver.isNil){
  55398. $8=false;
  55399. } else {
  55400. $8=true;
  55401. };
  55402. self._assert_equals_($8,true);
  55403. $ctx1.sendIdx["assert:equals:"]=2;
  55404. $11=$recv($Object())._new();
  55405. if(($receiver = $11) == null || $receiver.isNil){
  55406. $10=false;
  55407. } else {
  55408. $10=true;
  55409. };
  55410. self._assert_equals_($10,true);
  55411. return self;
  55412. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  55413. },
  55414. args: [],
  55415. 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",
  55416. referencedClasses: ["Object"],
  55417. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  55418. }),
  55419. $globals.ObjectTest);
  55420. $core.addMethod(
  55421. $core.method({
  55422. selector: "testInstVars",
  55423. protocol: 'tests',
  55424. fn: function (){
  55425. var self=this;
  55426. var o;
  55427. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  55428. return $core.withContext(function($ctx1) {
  55429. var $1,$2;
  55430. o=$recv($ObjectMock())._new();
  55431. $1=$recv(o)._instVarAt_("foo");
  55432. $ctx1.sendIdx["instVarAt:"]=1;
  55433. self._assert_equals_($1,nil);
  55434. $ctx1.sendIdx["assert:equals:"]=1;
  55435. $recv(o)._instVarAt_put_("foo",(1));
  55436. $2=$recv(o)._instVarAt_("foo");
  55437. $ctx1.sendIdx["instVarAt:"]=2;
  55438. self._assert_equals_($2,(1));
  55439. $ctx1.sendIdx["assert:equals:"]=2;
  55440. self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  55441. return self;
  55442. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  55443. },
  55444. args: [],
  55445. 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",
  55446. referencedClasses: ["ObjectMock"],
  55447. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  55448. }),
  55449. $globals.ObjectTest);
  55450. $core.addMethod(
  55451. $core.method({
  55452. selector: "testNilUndefined",
  55453. protocol: 'tests',
  55454. fn: function (){
  55455. var self=this;
  55456. return $core.withContext(function($ctx1) {
  55457. self._assert_equals_(self._notDefined(),nil);
  55458. return self;
  55459. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  55460. },
  55461. args: [],
  55462. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  55463. referencedClasses: [],
  55464. messageSends: ["assert:equals:", "notDefined"]
  55465. }),
  55466. $globals.ObjectTest);
  55467. $core.addMethod(
  55468. $core.method({
  55469. selector: "testYourself",
  55470. protocol: 'tests',
  55471. fn: function (){
  55472. var self=this;
  55473. var o;
  55474. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  55475. return $core.withContext(function($ctx1) {
  55476. o=$recv($ObjectMock())._new();
  55477. self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  55478. return self;
  55479. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  55480. },
  55481. args: [],
  55482. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  55483. referencedClasses: ["ObjectMock"],
  55484. messageSends: ["new", "assert:", "==", "yourself"]
  55485. }),
  55486. $globals.ObjectTest);
  55487. $core.addMethod(
  55488. $core.method({
  55489. selector: "testidentityHash",
  55490. protocol: 'tests',
  55491. fn: function (){
  55492. var self=this;
  55493. var o1,o2;
  55494. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  55495. return $core.withContext(function($ctx1) {
  55496. var $2,$3,$1,$5,$4;
  55497. o1=$recv($Object())._new();
  55498. $ctx1.sendIdx["new"]=1;
  55499. o2=$recv($Object())._new();
  55500. $2=$recv(o1)._identityHash();
  55501. $ctx1.sendIdx["identityHash"]=1;
  55502. $3=$recv(o1)._identityHash();
  55503. $ctx1.sendIdx["identityHash"]=2;
  55504. $1=$recv($2).__eq_eq($3);
  55505. $ctx1.sendIdx["=="]=1;
  55506. self._assert_($1);
  55507. $5=$recv(o1)._identityHash();
  55508. $ctx1.sendIdx["identityHash"]=3;
  55509. $4=$recv($5).__eq_eq($recv(o2)._identityHash());
  55510. self._deny_($4);
  55511. return self;
  55512. }, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},$globals.ObjectTest)});
  55513. },
  55514. args: [],
  55515. 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",
  55516. referencedClasses: ["Object"],
  55517. messageSends: ["new", "assert:", "==", "identityHash", "deny:"]
  55518. }),
  55519. $globals.ObjectTest);
  55520. $core.addClass('PointTest', $globals.TestCase, [], 'Kernel-Tests');
  55521. $core.addMethod(
  55522. $core.method({
  55523. selector: "testAccessing",
  55524. protocol: 'tests',
  55525. fn: function (){
  55526. var self=this;
  55527. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  55528. return $core.withContext(function($ctx1) {
  55529. var $2,$1,$3,$6,$5,$4;
  55530. $2=$recv($Point())._x_y_((3),(4));
  55531. $ctx1.sendIdx["x:y:"]=1;
  55532. $1=$recv($2)._x();
  55533. $ctx1.sendIdx["x"]=1;
  55534. self._assert_equals_($1,(3));
  55535. $ctx1.sendIdx["assert:equals:"]=1;
  55536. $3=$recv($recv($Point())._x_y_((3),(4)))._y();
  55537. $ctx1.sendIdx["y"]=1;
  55538. self._assert_equals_($3,(4));
  55539. $ctx1.sendIdx["assert:equals:"]=2;
  55540. $6=$recv($Point())._new();
  55541. $ctx1.sendIdx["new"]=1;
  55542. $5=$recv($6)._x_((3));
  55543. $4=$recv($5)._x();
  55544. self._assert_equals_($4,(3));
  55545. $ctx1.sendIdx["assert:equals:"]=3;
  55546. self._assert_equals_($recv($recv($recv($Point())._new())._y_((4)))._y(),(4));
  55547. return self;
  55548. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  55549. },
  55550. args: [],
  55551. 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",
  55552. referencedClasses: ["Point"],
  55553. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  55554. }),
  55555. $globals.PointTest);
  55556. $core.addMethod(
  55557. $core.method({
  55558. selector: "testArithmetic",
  55559. protocol: 'tests',
  55560. fn: function (){
  55561. var self=this;
  55562. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  55563. return $core.withContext(function($ctx1) {
  55564. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  55565. $2=(3).__at((4));
  55566. $ctx1.sendIdx["@"]=1;
  55567. $3=(3).__at((4));
  55568. $ctx1.sendIdx["@"]=2;
  55569. $1=$recv($2).__star($3);
  55570. $4=$recv($Point())._x_y_((9),(16));
  55571. $ctx1.sendIdx["x:y:"]=1;
  55572. self._assert_equals_($1,$4);
  55573. $ctx1.sendIdx["assert:equals:"]=1;
  55574. $6=(3).__at((4));
  55575. $ctx1.sendIdx["@"]=3;
  55576. $7=(3).__at((4));
  55577. $ctx1.sendIdx["@"]=4;
  55578. $5=$recv($6).__plus($7);
  55579. $8=$recv($Point())._x_y_((6),(8));
  55580. $ctx1.sendIdx["x:y:"]=2;
  55581. self._assert_equals_($5,$8);
  55582. $ctx1.sendIdx["assert:equals:"]=2;
  55583. $10=(3).__at((4));
  55584. $ctx1.sendIdx["@"]=5;
  55585. $11=(3).__at((4));
  55586. $ctx1.sendIdx["@"]=6;
  55587. $9=$recv($10).__minus($11);
  55588. $12=$recv($Point())._x_y_((0),(0));
  55589. $ctx1.sendIdx["x:y:"]=3;
  55590. self._assert_equals_($9,$12);
  55591. $ctx1.sendIdx["assert:equals:"]=3;
  55592. $14=(6).__at((8));
  55593. $ctx1.sendIdx["@"]=7;
  55594. $13=$recv($14).__slash((3).__at((4)));
  55595. self._assert_equals_($13,$recv($Point())._x_y_((2),(2)));
  55596. return self;
  55597. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  55598. },
  55599. args: [],
  55600. 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)",
  55601. referencedClasses: ["Point"],
  55602. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  55603. }),
  55604. $globals.PointTest);
  55605. $core.addMethod(
  55606. $core.method({
  55607. selector: "testAt",
  55608. protocol: 'tests',
  55609. fn: function (){
  55610. var self=this;
  55611. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  55612. return $core.withContext(function($ctx1) {
  55613. self._assert_equals_((3).__at((4)),$recv($Point())._x_y_((3),(4)));
  55614. return self;
  55615. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  55616. },
  55617. args: [],
  55618. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  55619. referencedClasses: ["Point"],
  55620. messageSends: ["assert:equals:", "@", "x:y:"]
  55621. }),
  55622. $globals.PointTest);
  55623. $core.addMethod(
  55624. $core.method({
  55625. selector: "testComparison",
  55626. protocol: 'tests',
  55627. fn: function (){
  55628. var self=this;
  55629. return $core.withContext(function($ctx1) {
  55630. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  55631. $2=(3).__at((4));
  55632. $ctx1.sendIdx["@"]=1;
  55633. $3=(4).__at((5));
  55634. $ctx1.sendIdx["@"]=2;
  55635. $1=$recv($2).__lt($3);
  55636. $ctx1.sendIdx["<"]=1;
  55637. self._assert_($1);
  55638. $ctx1.sendIdx["assert:"]=1;
  55639. $5=(3).__at((4));
  55640. $ctx1.sendIdx["@"]=3;
  55641. $6=(4).__at((4));
  55642. $ctx1.sendIdx["@"]=4;
  55643. $4=$recv($5).__lt($6);
  55644. self._deny_($4);
  55645. $ctx1.sendIdx["deny:"]=1;
  55646. $8=(4).__at((5));
  55647. $ctx1.sendIdx["@"]=5;
  55648. $9=(4).__at((5));
  55649. $ctx1.sendIdx["@"]=6;
  55650. $7=$recv($8).__lt_eq($9);
  55651. $ctx1.sendIdx["<="]=1;
  55652. self._assert_($7);
  55653. $ctx1.sendIdx["assert:"]=2;
  55654. $11=(4).__at((5));
  55655. $ctx1.sendIdx["@"]=7;
  55656. $12=(3).__at((5));
  55657. $ctx1.sendIdx["@"]=8;
  55658. $10=$recv($11).__lt_eq($12);
  55659. self._deny_($10);
  55660. $ctx1.sendIdx["deny:"]=2;
  55661. $14=(5).__at((6));
  55662. $ctx1.sendIdx["@"]=9;
  55663. $15=(4).__at((5));
  55664. $ctx1.sendIdx["@"]=10;
  55665. $13=$recv($14).__gt($15);
  55666. $ctx1.sendIdx[">"]=1;
  55667. self._assert_($13);
  55668. $ctx1.sendIdx["assert:"]=3;
  55669. $17=(5).__at((6));
  55670. $ctx1.sendIdx["@"]=11;
  55671. $18=(6).__at((6));
  55672. $ctx1.sendIdx["@"]=12;
  55673. $16=$recv($17).__gt($18);
  55674. self._deny_($16);
  55675. $ctx1.sendIdx["deny:"]=3;
  55676. $20=(4).__at((5));
  55677. $ctx1.sendIdx["@"]=13;
  55678. $21=(4).__at((5));
  55679. $ctx1.sendIdx["@"]=14;
  55680. $19=$recv($20).__gt_eq($21);
  55681. $ctx1.sendIdx[">="]=1;
  55682. self._assert_($19);
  55683. $23=(4).__at((5));
  55684. $ctx1.sendIdx["@"]=15;
  55685. $22=$recv($23).__gt_eq((5).__at((5)));
  55686. self._deny_($22);
  55687. return self;
  55688. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  55689. },
  55690. args: [],
  55691. 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)",
  55692. referencedClasses: [],
  55693. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  55694. }),
  55695. $globals.PointTest);
  55696. $core.addMethod(
  55697. $core.method({
  55698. selector: "testEgality",
  55699. protocol: 'tests',
  55700. fn: function (){
  55701. var self=this;
  55702. return $core.withContext(function($ctx1) {
  55703. var $2,$3,$1,$5,$4;
  55704. $2=(3).__at((4));
  55705. $ctx1.sendIdx["@"]=1;
  55706. $3=(3).__at((4));
  55707. $ctx1.sendIdx["@"]=2;
  55708. $1=$recv($2).__eq($3);
  55709. $ctx1.sendIdx["="]=1;
  55710. self._assert_($1);
  55711. $5=(3).__at((5));
  55712. $ctx1.sendIdx["@"]=3;
  55713. $4=$recv($5).__eq((3).__at((6)));
  55714. self._deny_($4);
  55715. return self;
  55716. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  55717. },
  55718. args: [],
  55719. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  55720. referencedClasses: [],
  55721. messageSends: ["assert:", "=", "@", "deny:"]
  55722. }),
  55723. $globals.PointTest);
  55724. $core.addMethod(
  55725. $core.method({
  55726. selector: "testNew",
  55727. protocol: 'tests',
  55728. fn: function (){
  55729. var self=this;
  55730. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  55731. return $core.withContext(function($ctx1) {
  55732. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  55733. $3=$recv($Point())._new();
  55734. $ctx1.sendIdx["new"]=1;
  55735. $2=$recv($3)._x_((3));
  55736. $ctx1.sendIdx["x:"]=1;
  55737. $1=$recv($2)._y();
  55738. $ctx1.sendIdx["y"]=1;
  55739. self._assert_equals_($1,nil);
  55740. $ctx1.sendIdx["assert:equals:"]=1;
  55741. $7=$recv($Point())._new();
  55742. $ctx1.sendIdx["new"]=2;
  55743. $6=$recv($7)._x_((3));
  55744. $5=$recv($6)._x();
  55745. $ctx1.sendIdx["x"]=1;
  55746. $4=$recv($5).__eq((0));
  55747. $ctx1.sendIdx["="]=1;
  55748. self._deny_($4);
  55749. $ctx1.sendIdx["deny:"]=1;
  55750. $10=$recv($Point())._new();
  55751. $ctx1.sendIdx["new"]=3;
  55752. $9=$recv($10)._y_((4));
  55753. $ctx1.sendIdx["y:"]=1;
  55754. $8=$recv($9)._x();
  55755. self._assert_equals_($8,nil);
  55756. self._deny_($recv($recv($recv($recv($Point())._new())._y_((4)))._y()).__eq((0)));
  55757. return self;
  55758. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  55759. },
  55760. args: [],
  55761. 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",
  55762. referencedClasses: ["Point"],
  55763. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  55764. }),
  55765. $globals.PointTest);
  55766. $core.addMethod(
  55767. $core.method({
  55768. selector: "testTranslateBy",
  55769. protocol: 'tests',
  55770. fn: function (){
  55771. var self=this;
  55772. return $core.withContext(function($ctx1) {
  55773. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  55774. $2=(3).__at((3));
  55775. $ctx1.sendIdx["@"]=1;
  55776. $3=(0).__at((1));
  55777. $ctx1.sendIdx["@"]=2;
  55778. $1=$recv($2)._translateBy_($3);
  55779. $ctx1.sendIdx["translateBy:"]=1;
  55780. $4=(3).__at((4));
  55781. $ctx1.sendIdx["@"]=3;
  55782. self._assert_equals_($1,$4);
  55783. $ctx1.sendIdx["assert:equals:"]=1;
  55784. $6=(3).__at((3));
  55785. $ctx1.sendIdx["@"]=4;
  55786. $8=(1)._negated();
  55787. $ctx1.sendIdx["negated"]=1;
  55788. $7=(0).__at($8);
  55789. $ctx1.sendIdx["@"]=5;
  55790. $5=$recv($6)._translateBy_($7);
  55791. $ctx1.sendIdx["translateBy:"]=2;
  55792. $9=(3).__at((2));
  55793. $ctx1.sendIdx["@"]=6;
  55794. self._assert_equals_($5,$9);
  55795. $ctx1.sendIdx["assert:equals:"]=2;
  55796. $11=(3).__at((3));
  55797. $ctx1.sendIdx["@"]=7;
  55798. $12=(2).__at((3));
  55799. $ctx1.sendIdx["@"]=8;
  55800. $10=$recv($11)._translateBy_($12);
  55801. $ctx1.sendIdx["translateBy:"]=3;
  55802. $13=(5).__at((6));
  55803. $ctx1.sendIdx["@"]=9;
  55804. self._assert_equals_($10,$13);
  55805. $ctx1.sendIdx["assert:equals:"]=3;
  55806. $15=(3).__at((3));
  55807. $ctx1.sendIdx["@"]=10;
  55808. $16=$recv((3)._negated()).__at((0));
  55809. $ctx1.sendIdx["@"]=11;
  55810. $14=$recv($15)._translateBy_($16);
  55811. self._assert_equals_($14,(0).__at((3)));
  55812. return self;
  55813. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  55814. },
  55815. args: [],
  55816. 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.",
  55817. referencedClasses: [],
  55818. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  55819. }),
  55820. $globals.PointTest);
  55821. $core.addClass('QueueTest', $globals.TestCase, [], 'Kernel-Tests');
  55822. $core.addMethod(
  55823. $core.method({
  55824. selector: "testNextIfAbsent",
  55825. protocol: 'tests',
  55826. fn: function (){
  55827. var self=this;
  55828. var queue;
  55829. function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  55830. return $core.withContext(function($ctx1) {
  55831. var $2,$1;
  55832. queue=$recv($Queue())._new();
  55833. $recv(queue)._nextPut_("index1");
  55834. $2=$recv(queue)._nextIfAbsent_("empty");
  55835. $ctx1.sendIdx["nextIfAbsent:"]=1;
  55836. $1=$recv($2).__eq("index1");
  55837. $ctx1.sendIdx["="]=1;
  55838. self._assert_($1);
  55839. self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  55840. return self;
  55841. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  55842. },
  55843. args: [],
  55844. 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'",
  55845. referencedClasses: ["Queue"],
  55846. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  55847. }),
  55848. $globals.QueueTest);
  55849. $core.addMethod(
  55850. $core.method({
  55851. selector: "testQueueNext",
  55852. protocol: 'tests',
  55853. fn: function (){
  55854. var self=this;
  55855. var queue;
  55856. function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  55857. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  55858. return $core.withContext(function($ctx1) {
  55859. var $1,$3,$2,$5,$4;
  55860. queue=$recv($Queue())._new();
  55861. $1=queue;
  55862. $recv($1)._nextPut_("index1");
  55863. $ctx1.sendIdx["nextPut:"]=1;
  55864. $recv($1)._nextPut_("index2");
  55865. $3=$recv(queue)._next();
  55866. $ctx1.sendIdx["next"]=1;
  55867. $2=$recv($3).__eq("index1");
  55868. $ctx1.sendIdx["="]=1;
  55869. self._assert_($2);
  55870. $5=$recv(queue)._next();
  55871. $ctx1.sendIdx["next"]=2;
  55872. $4=$recv($5).__eq("index");
  55873. self._deny_($4);
  55874. self._should_raise_((function(){
  55875. return $core.withContext(function($ctx2) {
  55876. return $recv(queue)._next();
  55877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55878. }),$Error());
  55879. return self;
  55880. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  55881. },
  55882. args: [],
  55883. 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",
  55884. referencedClasses: ["Queue", "Error"],
  55885. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  55886. }),
  55887. $globals.QueueTest);
  55888. $core.addClass('RandomTest', $globals.TestCase, [], 'Kernel-Tests');
  55889. $core.addMethod(
  55890. $core.method({
  55891. selector: "testAtRandomNumber",
  55892. protocol: 'tests',
  55893. fn: function (){
  55894. var self=this;
  55895. var val;
  55896. return $core.withContext(function($ctx1) {
  55897. (100)._timesRepeat_((function(){
  55898. return $core.withContext(function($ctx2) {
  55899. val=(10)._atRandom();
  55900. val;
  55901. self._assert_($recv(val).__gt((0)));
  55902. $ctx2.sendIdx["assert:"]=1;
  55903. return self._assert_($recv(val).__lt((11)));
  55904. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55905. }));
  55906. return self;
  55907. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  55908. },
  55909. args: [],
  55910. 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]",
  55911. referencedClasses: [],
  55912. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  55913. }),
  55914. $globals.RandomTest);
  55915. $core.addMethod(
  55916. $core.method({
  55917. selector: "testAtRandomSequenceableCollection",
  55918. protocol: 'tests',
  55919. fn: function (){
  55920. var self=this;
  55921. var val;
  55922. return $core.withContext(function($ctx1) {
  55923. var $3,$4,$2,$1;
  55924. (100)._timesRepeat_((function(){
  55925. return $core.withContext(function($ctx2) {
  55926. val="abc"._atRandom();
  55927. val;
  55928. $3=$recv(val).__eq("a");
  55929. $ctx2.sendIdx["="]=1;
  55930. $4=$recv(val).__eq("b");
  55931. $ctx2.sendIdx["="]=2;
  55932. $2=$recv($3).__or($4);
  55933. $1=$recv($2).__or($recv(val).__eq("c"));
  55934. $ctx2.sendIdx["|"]=1;
  55935. return self._assert_($1);
  55936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55937. }));
  55938. return self;
  55939. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  55940. },
  55941. args: [],
  55942. 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].",
  55943. referencedClasses: [],
  55944. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  55945. }),
  55946. $globals.RandomTest);
  55947. $core.addMethod(
  55948. $core.method({
  55949. selector: "textNext",
  55950. protocol: 'tests',
  55951. fn: function (){
  55952. var self=this;
  55953. function $Random(){return $globals.Random||(typeof Random=="undefined"?nil:Random)}
  55954. return $core.withContext(function($ctx1) {
  55955. var $1;
  55956. (10000)._timesRepeat_((function(){
  55957. var current,next;
  55958. return $core.withContext(function($ctx2) {
  55959. next=$recv($recv($Random())._new())._next();
  55960. next;
  55961. self._assert_($recv(next).__gt_eq((0)));
  55962. $ctx2.sendIdx["assert:"]=1;
  55963. self._assert_($recv(next).__lt((1)));
  55964. $1=$recv(current).__eq(next);
  55965. $ctx2.sendIdx["="]=1;
  55966. self._deny_($1);
  55967. return $recv(next).__eq(current);
  55968. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  55969. }));
  55970. return self;
  55971. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  55972. },
  55973. args: [],
  55974. 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 ]",
  55975. referencedClasses: ["Random"],
  55976. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  55977. }),
  55978. $globals.RandomTest);
  55979. $core.addClass('StreamTest', $globals.TestCase, [], 'Kernel-Tests');
  55980. $core.addMethod(
  55981. $core.method({
  55982. selector: "collectionClass",
  55983. protocol: 'accessing',
  55984. fn: function (){
  55985. var self=this;
  55986. return $core.withContext(function($ctx1) {
  55987. return $recv(self._class())._collectionClass();
  55988. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  55989. },
  55990. args: [],
  55991. source: "collectionClass\x0a\x09^ self class collectionClass",
  55992. referencedClasses: [],
  55993. messageSends: ["collectionClass", "class"]
  55994. }),
  55995. $globals.StreamTest);
  55996. $core.addMethod(
  55997. $core.method({
  55998. selector: "newCollection",
  55999. protocol: 'accessing',
  56000. fn: function (){
  56001. var self=this;
  56002. return $core.withContext(function($ctx1) {
  56003. return $recv(self._collectionClass())._new();
  56004. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  56005. },
  56006. args: [],
  56007. source: "newCollection\x0a\x09^ self collectionClass new",
  56008. referencedClasses: [],
  56009. messageSends: ["new", "collectionClass"]
  56010. }),
  56011. $globals.StreamTest);
  56012. $core.addMethod(
  56013. $core.method({
  56014. selector: "newStream",
  56015. protocol: 'accessing',
  56016. fn: function (){
  56017. var self=this;
  56018. return $core.withContext(function($ctx1) {
  56019. return $recv($recv(self._collectionClass())._new())._stream();
  56020. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  56021. },
  56022. args: [],
  56023. source: "newStream\x0a\x09^ self collectionClass new stream",
  56024. referencedClasses: [],
  56025. messageSends: ["stream", "new", "collectionClass"]
  56026. }),
  56027. $globals.StreamTest);
  56028. $core.addMethod(
  56029. $core.method({
  56030. selector: "testAtStartAtEnd",
  56031. protocol: 'tests',
  56032. fn: function (){
  56033. var self=this;
  56034. var stream;
  56035. return $core.withContext(function($ctx1) {
  56036. var $1,$2,$3,$4;
  56037. stream=self._newStream();
  56038. $1=$recv(stream)._atStart();
  56039. $ctx1.sendIdx["atStart"]=1;
  56040. self._assert_($1);
  56041. $ctx1.sendIdx["assert:"]=1;
  56042. $2=$recv(stream)._atEnd();
  56043. $ctx1.sendIdx["atEnd"]=1;
  56044. self._assert_($2);
  56045. $ctx1.sendIdx["assert:"]=2;
  56046. $recv(stream)._nextPutAll_(self._newCollection());
  56047. $3=$recv(stream)._atEnd();
  56048. $ctx1.sendIdx["atEnd"]=2;
  56049. self._assert_($3);
  56050. $4=$recv(stream)._atStart();
  56051. $ctx1.sendIdx["atStart"]=2;
  56052. self._deny_($4);
  56053. $ctx1.sendIdx["deny:"]=1;
  56054. $recv(stream)._position_((1));
  56055. self._deny_($recv(stream)._atEnd());
  56056. $ctx1.sendIdx["deny:"]=2;
  56057. self._deny_($recv(stream)._atStart());
  56058. return self;
  56059. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  56060. },
  56061. args: [],
  56062. 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",
  56063. referencedClasses: [],
  56064. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  56065. }),
  56066. $globals.StreamTest);
  56067. $core.addMethod(
  56068. $core.method({
  56069. selector: "testContents",
  56070. protocol: 'tests',
  56071. fn: function (){
  56072. var self=this;
  56073. var stream;
  56074. return $core.withContext(function($ctx1) {
  56075. var $1,$2;
  56076. stream=self._newStream();
  56077. $1=stream;
  56078. $2=self._newCollection();
  56079. $ctx1.sendIdx["newCollection"]=1;
  56080. $recv($1)._nextPutAll_($2);
  56081. self._assert_equals_($recv(stream)._contents(),self._newCollection());
  56082. return self;
  56083. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  56084. },
  56085. args: [],
  56086. 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",
  56087. referencedClasses: [],
  56088. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  56089. }),
  56090. $globals.StreamTest);
  56091. $core.addMethod(
  56092. $core.method({
  56093. selector: "testIsEmpty",
  56094. protocol: 'tests',
  56095. fn: function (){
  56096. var self=this;
  56097. var stream;
  56098. return $core.withContext(function($ctx1) {
  56099. var $1;
  56100. stream=self._newStream();
  56101. $1=$recv(stream)._isEmpty();
  56102. $ctx1.sendIdx["isEmpty"]=1;
  56103. self._assert_($1);
  56104. $recv(stream)._nextPutAll_(self._newCollection());
  56105. self._deny_($recv(stream)._isEmpty());
  56106. return self;
  56107. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  56108. },
  56109. args: [],
  56110. 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",
  56111. referencedClasses: [],
  56112. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  56113. }),
  56114. $globals.StreamTest);
  56115. $core.addMethod(
  56116. $core.method({
  56117. selector: "testPosition",
  56118. protocol: 'tests',
  56119. fn: function (){
  56120. var self=this;
  56121. var collection,stream;
  56122. return $core.withContext(function($ctx1) {
  56123. var $1,$2,$3;
  56124. collection=self._newCollection();
  56125. stream=self._newStream();
  56126. $recv(stream)._nextPutAll_(collection);
  56127. $1=$recv(stream)._position();
  56128. $ctx1.sendIdx["position"]=1;
  56129. self._assert_equals_($1,$recv(collection)._size());
  56130. $ctx1.sendIdx["assert:equals:"]=1;
  56131. $recv(stream)._position_((0));
  56132. $2=$recv(stream)._position();
  56133. $ctx1.sendIdx["position"]=2;
  56134. self._assert_equals_($2,(0));
  56135. $ctx1.sendIdx["assert:equals:"]=2;
  56136. $recv(stream)._next();
  56137. $ctx1.sendIdx["next"]=1;
  56138. $3=$recv(stream)._position();
  56139. $ctx1.sendIdx["position"]=3;
  56140. self._assert_equals_($3,(1));
  56141. $ctx1.sendIdx["assert:equals:"]=3;
  56142. $recv(stream)._next();
  56143. self._assert_equals_($recv(stream)._position(),(2));
  56144. return self;
  56145. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  56146. },
  56147. args: [],
  56148. 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",
  56149. referencedClasses: [],
  56150. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  56151. }),
  56152. $globals.StreamTest);
  56153. $core.addMethod(
  56154. $core.method({
  56155. selector: "testReading",
  56156. protocol: 'tests',
  56157. fn: function (){
  56158. var self=this;
  56159. var stream,collection;
  56160. return $core.withContext(function($ctx1) {
  56161. var $1,$2;
  56162. collection=self._newCollection();
  56163. stream=self._newStream();
  56164. $1=stream;
  56165. $recv($1)._nextPutAll_(collection);
  56166. $recv($1)._position_((0));
  56167. $recv(collection)._do_((function(each){
  56168. return $core.withContext(function($ctx2) {
  56169. $2=$recv(stream)._next();
  56170. $ctx2.sendIdx["next"]=1;
  56171. return self._assert_equals_($2,each);
  56172. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56173. }));
  56174. self._assert_($recv($recv(stream)._next())._isNil());
  56175. return self;
  56176. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  56177. },
  56178. args: [],
  56179. 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",
  56180. referencedClasses: [],
  56181. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  56182. }),
  56183. $globals.StreamTest);
  56184. $core.addMethod(
  56185. $core.method({
  56186. selector: "testStreamContents",
  56187. protocol: 'tests',
  56188. fn: function (){
  56189. var self=this;
  56190. return self;
  56191. },
  56192. args: [],
  56193. source: "testStreamContents",
  56194. referencedClasses: [],
  56195. messageSends: []
  56196. }),
  56197. $globals.StreamTest);
  56198. $core.addMethod(
  56199. $core.method({
  56200. selector: "testWrite",
  56201. protocol: 'tests',
  56202. fn: function (){
  56203. var self=this;
  56204. var stream,collection;
  56205. return $core.withContext(function($ctx1) {
  56206. collection=self._newCollection();
  56207. stream=self._newStream();
  56208. $recv(collection)._do_((function(each){
  56209. return $core.withContext(function($ctx2) {
  56210. return $recv(stream).__lt_lt(each);
  56211. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56212. }));
  56213. self._assert_equals_($recv(stream)._contents(),collection);
  56214. return self;
  56215. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  56216. },
  56217. args: [],
  56218. 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",
  56219. referencedClasses: [],
  56220. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  56221. }),
  56222. $globals.StreamTest);
  56223. $core.addMethod(
  56224. $core.method({
  56225. selector: "testWriting",
  56226. protocol: 'tests',
  56227. fn: function (){
  56228. var self=this;
  56229. var stream,collection;
  56230. return $core.withContext(function($ctx1) {
  56231. var $1;
  56232. collection=self._newCollection();
  56233. stream=self._newStream();
  56234. $ctx1.sendIdx["newStream"]=1;
  56235. $recv(collection)._do_((function(each){
  56236. return $core.withContext(function($ctx2) {
  56237. return $recv(stream)._nextPut_(each);
  56238. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56239. }));
  56240. $1=$recv(stream)._contents();
  56241. $ctx1.sendIdx["contents"]=1;
  56242. self._assert_equals_($1,collection);
  56243. $ctx1.sendIdx["assert:equals:"]=1;
  56244. stream=self._newStream();
  56245. $recv(stream)._nextPutAll_(collection);
  56246. self._assert_equals_($recv(stream)._contents(),collection);
  56247. return self;
  56248. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  56249. },
  56250. args: [],
  56251. 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",
  56252. referencedClasses: [],
  56253. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  56254. }),
  56255. $globals.StreamTest);
  56256. $core.addMethod(
  56257. $core.method({
  56258. selector: "collectionClass",
  56259. protocol: 'accessing',
  56260. fn: function (){
  56261. var self=this;
  56262. return nil;
  56263. },
  56264. args: [],
  56265. source: "collectionClass\x0a\x09^ nil",
  56266. referencedClasses: [],
  56267. messageSends: []
  56268. }),
  56269. $globals.StreamTest.klass);
  56270. $core.addMethod(
  56271. $core.method({
  56272. selector: "isAbstract",
  56273. protocol: 'testing',
  56274. fn: function (){
  56275. var self=this;
  56276. return $core.withContext(function($ctx1) {
  56277. return $recv(self._collectionClass())._isNil();
  56278. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.klass)});
  56279. },
  56280. args: [],
  56281. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  56282. referencedClasses: [],
  56283. messageSends: ["isNil", "collectionClass"]
  56284. }),
  56285. $globals.StreamTest.klass);
  56286. $core.addClass('ArrayStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
  56287. $core.addMethod(
  56288. $core.method({
  56289. selector: "newCollection",
  56290. protocol: 'accessing',
  56291. fn: function (){
  56292. var self=this;
  56293. return $core.withContext(function($ctx1) {
  56294. return [true,(1),(3).__at((4)),"foo"];
  56295. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  56296. },
  56297. args: [],
  56298. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  56299. referencedClasses: [],
  56300. messageSends: ["@"]
  56301. }),
  56302. $globals.ArrayStreamTest);
  56303. $core.addMethod(
  56304. $core.method({
  56305. selector: "collectionClass",
  56306. protocol: 'accessing',
  56307. fn: function (){
  56308. var self=this;
  56309. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  56310. return $Array();
  56311. },
  56312. args: [],
  56313. source: "collectionClass\x0a\x09^ Array",
  56314. referencedClasses: ["Array"],
  56315. messageSends: []
  56316. }),
  56317. $globals.ArrayStreamTest.klass);
  56318. $core.addClass('StringStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
  56319. $core.addMethod(
  56320. $core.method({
  56321. selector: "newCollection",
  56322. protocol: 'accessing',
  56323. fn: function (){
  56324. var self=this;
  56325. return "hello world";
  56326. },
  56327. args: [],
  56328. source: "newCollection\x0a\x09^ 'hello world'",
  56329. referencedClasses: [],
  56330. messageSends: []
  56331. }),
  56332. $globals.StringStreamTest);
  56333. $core.addMethod(
  56334. $core.method({
  56335. selector: "collectionClass",
  56336. protocol: 'accessing',
  56337. fn: function (){
  56338. var self=this;
  56339. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  56340. return $String();
  56341. },
  56342. args: [],
  56343. source: "collectionClass\x0a\x09^ String",
  56344. referencedClasses: ["String"],
  56345. messageSends: []
  56346. }),
  56347. $globals.StringStreamTest.klass);
  56348. $core.addClass('UndefinedTest', $globals.TestCase, [], 'Kernel-Tests');
  56349. $core.addMethod(
  56350. $core.method({
  56351. selector: "testCopying",
  56352. protocol: 'tests',
  56353. fn: function (){
  56354. var self=this;
  56355. return $core.withContext(function($ctx1) {
  56356. self._assert_equals_(nil._copy(),nil);
  56357. return self;
  56358. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  56359. },
  56360. args: [],
  56361. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  56362. referencedClasses: [],
  56363. messageSends: ["assert:equals:", "copy"]
  56364. }),
  56365. $globals.UndefinedTest);
  56366. $core.addMethod(
  56367. $core.method({
  56368. selector: "testDeepCopy",
  56369. protocol: 'tests',
  56370. fn: function (){
  56371. var self=this;
  56372. return $core.withContext(function($ctx1) {
  56373. self._assert_($recv(nil._deepCopy()).__eq(nil));
  56374. return self;
  56375. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  56376. },
  56377. args: [],
  56378. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  56379. referencedClasses: [],
  56380. messageSends: ["assert:", "=", "deepCopy"]
  56381. }),
  56382. $globals.UndefinedTest);
  56383. $core.addMethod(
  56384. $core.method({
  56385. selector: "testIfNil",
  56386. protocol: 'tests',
  56387. fn: function (){
  56388. var self=this;
  56389. return $core.withContext(function($ctx1) {
  56390. var $1,$3,$2,$4,$6,$5,$receiver;
  56391. if(($receiver = nil) == null || $receiver.isNil){
  56392. $1=true;
  56393. } else {
  56394. $1=nil;
  56395. };
  56396. self._assert_equals_($1,true);
  56397. $ctx1.sendIdx["assert:equals:"]=1;
  56398. if(($receiver = nil) == null || $receiver.isNil){
  56399. $3=nil;
  56400. } else {
  56401. $3=true;
  56402. };
  56403. $2=$recv($3).__eq(true);
  56404. $ctx1.sendIdx["="]=1;
  56405. self._deny_($2);
  56406. $ctx1.sendIdx["deny:"]=1;
  56407. if(($receiver = nil) == null || $receiver.isNil){
  56408. $4=true;
  56409. } else {
  56410. $4=false;
  56411. };
  56412. self._assert_equals_($4,true);
  56413. if(($receiver = nil) == null || $receiver.isNil){
  56414. $6=false;
  56415. } else {
  56416. $6=true;
  56417. };
  56418. $5=$recv($6).__eq(true);
  56419. self._deny_($5);
  56420. return self;
  56421. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  56422. },
  56423. args: [],
  56424. 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",
  56425. referencedClasses: [],
  56426. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  56427. }),
  56428. $globals.UndefinedTest);
  56429. $core.addMethod(
  56430. $core.method({
  56431. selector: "testIsNil",
  56432. protocol: 'tests',
  56433. fn: function (){
  56434. var self=this;
  56435. return $core.withContext(function($ctx1) {
  56436. self._assert_(nil._isNil());
  56437. self._deny_(nil._notNil());
  56438. return self;
  56439. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  56440. },
  56441. args: [],
  56442. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  56443. referencedClasses: [],
  56444. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  56445. }),
  56446. $globals.UndefinedTest);
  56447. });
  56448. define("amber_core/SUnit-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  56449. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  56450. $core.addPackage('SUnit-Tests');
  56451. $core.packages["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  56452. $core.packages["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  56453. $core.addClass('ExampleSetTest', $globals.TestCase, ['empty', 'full'], 'SUnit-Tests');
  56454. $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.";
  56455. $core.addMethod(
  56456. $core.method({
  56457. selector: "setUp",
  56458. protocol: 'running',
  56459. fn: function (){
  56460. var self=this;
  56461. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  56462. return $core.withContext(function($ctx1) {
  56463. self["@empty"]=$recv($Set())._new();
  56464. self["@full"]=$recv($Set())._with_with_((5),"abc");
  56465. return self;
  56466. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  56467. },
  56468. args: [],
  56469. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  56470. referencedClasses: ["Set"],
  56471. messageSends: ["new", "with:with:"]
  56472. }),
  56473. $globals.ExampleSetTest);
  56474. $core.addMethod(
  56475. $core.method({
  56476. selector: "testAdd",
  56477. protocol: 'tests',
  56478. fn: function (){
  56479. var self=this;
  56480. return $core.withContext(function($ctx1) {
  56481. $recv(self["@empty"])._add_((5));
  56482. self._assert_($recv(self["@empty"])._includes_((5)));
  56483. return self;
  56484. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  56485. },
  56486. args: [],
  56487. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  56488. referencedClasses: [],
  56489. messageSends: ["add:", "assert:", "includes:"]
  56490. }),
  56491. $globals.ExampleSetTest);
  56492. $core.addMethod(
  56493. $core.method({
  56494. selector: "testGrow",
  56495. protocol: 'tests',
  56496. fn: function (){
  56497. var self=this;
  56498. return $core.withContext(function($ctx1) {
  56499. $recv(self["@empty"])._addAll_((1)._to_((100)));
  56500. self._assert_equals_($recv(self["@empty"])._size(),(100));
  56501. return self;
  56502. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  56503. },
  56504. args: [],
  56505. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  56506. referencedClasses: [],
  56507. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  56508. }),
  56509. $globals.ExampleSetTest);
  56510. $core.addMethod(
  56511. $core.method({
  56512. selector: "testIllegal",
  56513. protocol: 'tests',
  56514. fn: function (){
  56515. var self=this;
  56516. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  56517. return $core.withContext(function($ctx1) {
  56518. self._should_raise_((function(){
  56519. return $core.withContext(function($ctx2) {
  56520. return $recv(self["@empty"])._at_((5));
  56521. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56522. }),$Error());
  56523. $ctx1.sendIdx["should:raise:"]=1;
  56524. self._should_raise_((function(){
  56525. return $core.withContext(function($ctx2) {
  56526. return $recv(self["@empty"])._at_put_((5),"abc");
  56527. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56528. }),$Error());
  56529. return self;
  56530. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  56531. },
  56532. args: [],
  56533. 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",
  56534. referencedClasses: ["Error"],
  56535. messageSends: ["should:raise:", "at:", "at:put:"]
  56536. }),
  56537. $globals.ExampleSetTest);
  56538. $core.addMethod(
  56539. $core.method({
  56540. selector: "testIncludes",
  56541. protocol: 'tests',
  56542. fn: function (){
  56543. var self=this;
  56544. return $core.withContext(function($ctx1) {
  56545. var $1;
  56546. $1=$recv(self["@full"])._includes_((5));
  56547. $ctx1.sendIdx["includes:"]=1;
  56548. self._assert_($1);
  56549. $ctx1.sendIdx["assert:"]=1;
  56550. self._assert_($recv(self["@full"])._includes_("abc"));
  56551. return self;
  56552. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  56553. },
  56554. args: [],
  56555. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  56556. referencedClasses: [],
  56557. messageSends: ["assert:", "includes:"]
  56558. }),
  56559. $globals.ExampleSetTest);
  56560. $core.addMethod(
  56561. $core.method({
  56562. selector: "testOccurrences",
  56563. protocol: 'tests',
  56564. fn: function (){
  56565. var self=this;
  56566. return $core.withContext(function($ctx1) {
  56567. var $1,$2;
  56568. $1=$recv(self["@empty"])._occurrencesOf_((0));
  56569. $ctx1.sendIdx["occurrencesOf:"]=1;
  56570. self._assert_equals_($1,(0));
  56571. $ctx1.sendIdx["assert:equals:"]=1;
  56572. $2=$recv(self["@full"])._occurrencesOf_((5));
  56573. $ctx1.sendIdx["occurrencesOf:"]=2;
  56574. self._assert_equals_($2,(1));
  56575. $ctx1.sendIdx["assert:equals:"]=2;
  56576. $recv(self["@full"])._add_((5));
  56577. self._assert_equals_($recv(self["@full"])._occurrencesOf_((5)),(1));
  56578. return self;
  56579. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  56580. },
  56581. args: [],
  56582. 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",
  56583. referencedClasses: [],
  56584. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  56585. }),
  56586. $globals.ExampleSetTest);
  56587. $core.addMethod(
  56588. $core.method({
  56589. selector: "testRemove",
  56590. protocol: 'tests',
  56591. fn: function (){
  56592. var self=this;
  56593. return $core.withContext(function($ctx1) {
  56594. var $1;
  56595. $recv(self["@full"])._remove_((5));
  56596. $1=$recv(self["@full"])._includes_("abc");
  56597. $ctx1.sendIdx["includes:"]=1;
  56598. self._assert_($1);
  56599. self._deny_($recv(self["@full"])._includes_((5)));
  56600. return self;
  56601. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  56602. },
  56603. args: [],
  56604. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  56605. referencedClasses: [],
  56606. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  56607. }),
  56608. $globals.ExampleSetTest);
  56609. $core.addClass('SUnitAsyncTest', $globals.TestCase, ['flag'], 'SUnit-Tests');
  56610. $core.addMethod(
  56611. $core.method({
  56612. selector: "fakeError",
  56613. protocol: 'helpers',
  56614. fn: function (){
  56615. var self=this;
  56616. return $core.withContext(function($ctx1) {
  56617. self["@flag"]="bad";
  56618. self._timeout_((30));
  56619. self["@flag"]=$recv(self._async_((function(){
  56620. return $core.withContext(function($ctx2) {
  56621. self["@flag"]="ok";
  56622. self["@flag"];
  56623. return self._error_("Intentional");
  56624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56625. })))._valueWithTimeout_((20));
  56626. return self;
  56627. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  56628. },
  56629. args: [],
  56630. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  56631. referencedClasses: [],
  56632. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  56633. }),
  56634. $globals.SUnitAsyncTest);
  56635. $core.addMethod(
  56636. $core.method({
  56637. selector: "fakeErrorFailingInTearDown",
  56638. protocol: 'helpers',
  56639. fn: function (){
  56640. var self=this;
  56641. return $core.withContext(function($ctx1) {
  56642. self["@flag"]="bad";
  56643. self._timeout_((30));
  56644. self["@flag"]=$recv(self._async_((function(){
  56645. return $core.withContext(function($ctx2) {
  56646. return self._error_("Intentional");
  56647. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56648. })))._valueWithTimeout_((20));
  56649. return self;
  56650. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  56651. },
  56652. args: [],
  56653. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  56654. referencedClasses: [],
  56655. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  56656. }),
  56657. $globals.SUnitAsyncTest);
  56658. $core.addMethod(
  56659. $core.method({
  56660. selector: "fakeFailure",
  56661. protocol: 'helpers',
  56662. fn: function (){
  56663. var self=this;
  56664. return $core.withContext(function($ctx1) {
  56665. self["@flag"]="bad";
  56666. self._timeout_((30));
  56667. self["@flag"]=$recv(self._async_((function(){
  56668. return $core.withContext(function($ctx2) {
  56669. self["@flag"]="ok";
  56670. self["@flag"];
  56671. return self._assert_(false);
  56672. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56673. })))._valueWithTimeout_((20));
  56674. return self;
  56675. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  56676. },
  56677. args: [],
  56678. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  56679. referencedClasses: [],
  56680. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  56681. }),
  56682. $globals.SUnitAsyncTest);
  56683. $core.addMethod(
  56684. $core.method({
  56685. selector: "fakeMultipleTimeoutFailing",
  56686. protocol: 'helpers',
  56687. fn: function (){
  56688. var self=this;
  56689. return $core.withContext(function($ctx1) {
  56690. var $1;
  56691. self._timeout_((100));
  56692. $ctx1.sendIdx["timeout:"]=1;
  56693. $1=self._async_((function(){
  56694. return $core.withContext(function($ctx2) {
  56695. self._timeout_((20));
  56696. return $recv(self._async_((function(){
  56697. return $core.withContext(function($ctx3) {
  56698. return self._finished();
  56699. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  56700. })))._valueWithTimeout_((30));
  56701. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56702. }));
  56703. $ctx1.sendIdx["async:"]=1;
  56704. $recv($1)._valueWithTimeout_((20));
  56705. $ctx1.sendIdx["valueWithTimeout:"]=1;
  56706. return self;
  56707. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  56708. },
  56709. args: [],
  56710. 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",
  56711. referencedClasses: [],
  56712. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  56713. }),
  56714. $globals.SUnitAsyncTest);
  56715. $core.addMethod(
  56716. $core.method({
  56717. selector: "fakeMultipleTimeoutPassing",
  56718. protocol: 'helpers',
  56719. fn: function (){
  56720. var self=this;
  56721. return $core.withContext(function($ctx1) {
  56722. var $1;
  56723. self._timeout_((20));
  56724. $ctx1.sendIdx["timeout:"]=1;
  56725. $1=self._async_((function(){
  56726. return $core.withContext(function($ctx2) {
  56727. self._timeout_((40));
  56728. return $recv(self._async_((function(){
  56729. return $core.withContext(function($ctx3) {
  56730. return self._finished();
  56731. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  56732. })))._valueWithTimeout_((20));
  56733. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56734. }));
  56735. $ctx1.sendIdx["async:"]=1;
  56736. $recv($1)._valueWithTimeout_((10));
  56737. $ctx1.sendIdx["valueWithTimeout:"]=1;
  56738. return self;
  56739. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  56740. },
  56741. args: [],
  56742. 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",
  56743. referencedClasses: [],
  56744. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  56745. }),
  56746. $globals.SUnitAsyncTest);
  56747. $core.addMethod(
  56748. $core.method({
  56749. selector: "fakeTimeout",
  56750. protocol: 'helpers',
  56751. fn: function (){
  56752. var self=this;
  56753. return $core.withContext(function($ctx1) {
  56754. self._timeout_((10));
  56755. $recv(self._async_((function(){
  56756. return $core.withContext(function($ctx2) {
  56757. return self._finished();
  56758. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56759. })))._valueWithTimeout_((20));
  56760. return self;
  56761. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  56762. },
  56763. args: [],
  56764. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  56765. referencedClasses: [],
  56766. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  56767. }),
  56768. $globals.SUnitAsyncTest);
  56769. $core.addMethod(
  56770. $core.method({
  56771. selector: "selectorSetOf:",
  56772. protocol: 'private',
  56773. fn: function (aCollection){
  56774. var self=this;
  56775. return $core.withContext(function($ctx1) {
  56776. return $recv($recv(aCollection)._collect_((function(each){
  56777. return $core.withContext(function($ctx2) {
  56778. return $recv(each)._selector();
  56779. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56780. })))._asSet();
  56781. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  56782. },
  56783. args: ["aCollection"],
  56784. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  56785. referencedClasses: [],
  56786. messageSends: ["asSet", "collect:", "selector"]
  56787. }),
  56788. $globals.SUnitAsyncTest);
  56789. $core.addMethod(
  56790. $core.method({
  56791. selector: "setUp",
  56792. protocol: 'running',
  56793. fn: function (){
  56794. var self=this;
  56795. self["@flag"]="ok";
  56796. return self;
  56797. },
  56798. args: [],
  56799. source: "setUp\x0a\x09flag := 'ok'",
  56800. referencedClasses: [],
  56801. messageSends: []
  56802. }),
  56803. $globals.SUnitAsyncTest);
  56804. $core.addMethod(
  56805. $core.method({
  56806. selector: "tearDown",
  56807. protocol: 'running',
  56808. fn: function (){
  56809. var self=this;
  56810. return $core.withContext(function($ctx1) {
  56811. self._assert_equals_("ok",self["@flag"]);
  56812. return self;
  56813. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  56814. },
  56815. args: [],
  56816. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  56817. referencedClasses: [],
  56818. messageSends: ["assert:equals:"]
  56819. }),
  56820. $globals.SUnitAsyncTest);
  56821. $core.addMethod(
  56822. $core.method({
  56823. selector: "testAsyncErrorsAndFailures",
  56824. protocol: 'tests',
  56825. fn: function (){
  56826. var self=this;
  56827. var suite,runner,result,assertBlock;
  56828. function $TestSuiteRunner(){return $globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)}
  56829. function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  56830. return $core.withContext(function($ctx1) {
  56831. var $1,$2,$3,$4;
  56832. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  56833. return $core.withContext(function($ctx2) {
  56834. return $recv(self._class())._selector_(each);
  56835. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56836. }));
  56837. runner=$recv($TestSuiteRunner())._on_(suite);
  56838. self._timeout_((200));
  56839. result=$recv(runner)._result();
  56840. $ctx1.sendIdx["result"]=1;
  56841. assertBlock=self._async_((function(){
  56842. return $core.withContext(function($ctx2) {
  56843. $1=self._selectorSetOf_($recv(result)._errors());
  56844. $ctx2.sendIdx["selectorSetOf:"]=1;
  56845. $2=["fakeError"]._asSet();
  56846. $ctx2.sendIdx["asSet"]=1;
  56847. self._assert_equals_($1,$2);
  56848. $ctx2.sendIdx["assert:equals:"]=1;
  56849. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  56850. return self._finished();
  56851. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56852. }));
  56853. $recv($recv(runner)._announcer())._on_do_($ResultAnnouncement(),(function(ann){
  56854. return $core.withContext(function($ctx2) {
  56855. $3=$recv($recv(ann)._result()).__eq_eq(result);
  56856. if($core.assert($3)){
  56857. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  56858. return $recv($4)._ifTrue_(assertBlock);
  56859. };
  56860. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  56861. }));
  56862. $recv(runner)._run();
  56863. return self;
  56864. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  56865. },
  56866. args: [],
  56867. 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",
  56868. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  56869. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  56870. }),
  56871. $globals.SUnitAsyncTest);
  56872. $core.addMethod(
  56873. $core.method({
  56874. selector: "testAsyncNeedsTimeout",
  56875. protocol: 'tests',
  56876. fn: function (){
  56877. var self=this;
  56878. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  56879. return $core.withContext(function($ctx1) {
  56880. self._should_raise_((function(){
  56881. return $core.withContext(function($ctx2) {
  56882. return self._async_((function(){
  56883. }));
  56884. $ctx2.sendIdx["async:"]=1;
  56885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56886. }),$Error());
  56887. self._timeout_((0));
  56888. self._shouldnt_raise_((function(){
  56889. return $core.withContext(function($ctx2) {
  56890. return self._async_((function(){
  56891. }));
  56892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  56893. }),$Error());
  56894. self._finished();
  56895. return self;
  56896. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  56897. },
  56898. args: [],
  56899. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  56900. referencedClasses: ["Error"],
  56901. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  56902. }),
  56903. $globals.SUnitAsyncTest);
  56904. $core.addMethod(
  56905. $core.method({
  56906. selector: "testFinishedNeedsTimeout",
  56907. protocol: 'tests',
  56908. fn: function (){
  56909. var self=this;
  56910. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  56911. return $core.withContext(function($ctx1) {
  56912. self._should_raise_((function(){
  56913. return $core.withContext(function($ctx2) {
  56914. return self._finished();
  56915. $ctx2.sendIdx["finished"]=1;
  56916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56917. }),$Error());
  56918. self._timeout_((0));
  56919. self._shouldnt_raise_((function(){
  56920. return $core.withContext(function($ctx2) {
  56921. return self._finished();
  56922. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56923. }),$Error());
  56924. return self;
  56925. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  56926. },
  56927. args: [],
  56928. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  56929. referencedClasses: ["Error"],
  56930. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  56931. }),
  56932. $globals.SUnitAsyncTest);
  56933. $core.addMethod(
  56934. $core.method({
  56935. selector: "testIsAsyncReturnsCorrectValues",
  56936. protocol: 'tests',
  56937. fn: function (){
  56938. var self=this;
  56939. return $core.withContext(function($ctx1) {
  56940. var $1,$2;
  56941. $1=self._isAsync();
  56942. $ctx1.sendIdx["isAsync"]=1;
  56943. self._deny_($1);
  56944. $ctx1.sendIdx["deny:"]=1;
  56945. self._timeout_((0));
  56946. $2=self._isAsync();
  56947. $ctx1.sendIdx["isAsync"]=2;
  56948. self._assert_($2);
  56949. self._finished();
  56950. self._deny_(self._isAsync());
  56951. return self;
  56952. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  56953. },
  56954. args: [],
  56955. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  56956. referencedClasses: [],
  56957. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  56958. }),
  56959. $globals.SUnitAsyncTest);
  56960. $core.addMethod(
  56961. $core.method({
  56962. selector: "testPass",
  56963. protocol: 'tests',
  56964. fn: function (){
  56965. var self=this;
  56966. return $core.withContext(function($ctx1) {
  56967. self["@flag"]="bad";
  56968. self._timeout_((10));
  56969. self["@flag"]=$recv(self._async_((function(){
  56970. return $core.withContext(function($ctx2) {
  56971. self._assert_(true);
  56972. self._finished();
  56973. self["@flag"]="ok";
  56974. return self["@flag"];
  56975. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56976. })))._valueWithTimeout_((5));
  56977. return self;
  56978. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  56979. },
  56980. args: [],
  56981. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  56982. referencedClasses: [],
  56983. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  56984. }),
  56985. $globals.SUnitAsyncTest);
  56986. $core.addMethod(
  56987. $core.method({
  56988. selector: "testTimeouts",
  56989. protocol: 'tests',
  56990. fn: function (){
  56991. var self=this;
  56992. var suite,runner,result,assertBlock;
  56993. function $TestSuiteRunner(){return $globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)}
  56994. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  56995. function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  56996. return $core.withContext(function($ctx1) {
  56997. var $1,$2,$3;
  56998. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  56999. return $core.withContext(function($ctx2) {
  57000. return $recv(self._class())._selector_(each);
  57001. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57002. }));
  57003. runner=$recv($TestSuiteRunner())._on_(suite);
  57004. self._timeout_((200));
  57005. result=$recv(runner)._result();
  57006. $ctx1.sendIdx["result"]=1;
  57007. assertBlock=self._async_((function(){
  57008. return $core.withContext(function($ctx2) {
  57009. $1=self._selectorSetOf_($recv(result)._errors());
  57010. $ctx2.sendIdx["selectorSetOf:"]=1;
  57011. self._assert_equals_($1,$recv($Set())._new());
  57012. $ctx2.sendIdx["assert:equals:"]=1;
  57013. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  57014. return self._finished();
  57015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57016. }));
  57017. $recv($recv(runner)._announcer())._on_do_($ResultAnnouncement(),(function(ann){
  57018. return $core.withContext(function($ctx2) {
  57019. $2=$recv($recv(ann)._result()).__eq_eq(result);
  57020. if($core.assert($2)){
  57021. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  57022. return $recv($3)._ifTrue_(assertBlock);
  57023. };
  57024. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  57025. }));
  57026. $recv(runner)._run();
  57027. return self;
  57028. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  57029. },
  57030. args: [],
  57031. 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",
  57032. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  57033. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  57034. }),
  57035. $globals.SUnitAsyncTest);
  57036. $core.addMethod(
  57037. $core.method({
  57038. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  57039. protocol: 'tests',
  57040. fn: function (){
  57041. var self=this;
  57042. var x;
  57043. return $core.withContext(function($ctx1) {
  57044. var $1;
  57045. self["@flag"]="bad";
  57046. self._timeout_((10));
  57047. x=(0);
  57048. $1=self._async_((function(){
  57049. return $core.withContext(function($ctx2) {
  57050. self._finished();
  57051. $ctx2.sendIdx["finished"]=1;
  57052. self["@flag"]="ok";
  57053. self["@flag"];
  57054. x=$recv(x).__plus((1));
  57055. $ctx2.sendIdx["+"]=1;
  57056. x;
  57057. return self._assert_equals_(x,(1));
  57058. $ctx2.sendIdx["assert:equals:"]=1;
  57059. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57060. }));
  57061. $ctx1.sendIdx["async:"]=1;
  57062. self["@flag"]=$recv($1)._valueWithTimeout_((0));
  57063. $ctx1.sendIdx["valueWithTimeout:"]=1;
  57064. self["@flag"]=$recv(self._async_((function(){
  57065. return $core.withContext(function($ctx2) {
  57066. self._finished();
  57067. self["@flag"]="ok";
  57068. self["@flag"];
  57069. x=$recv(x).__plus((1));
  57070. x;
  57071. return self._assert_equals_(x,(1));
  57072. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57073. })))._valueWithTimeout_((0));
  57074. return self;
  57075. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  57076. },
  57077. args: [],
  57078. 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.",
  57079. referencedClasses: [],
  57080. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  57081. }),
  57082. $globals.SUnitAsyncTest);
  57083. });
  57084. define('amber/devel',[
  57085. './helpers', // pre-fetch, dep of ./deploy
  57086. './deploy', // pre-fetch, dep of ./lang
  57087. './lang',
  57088. // --- packages of the development only Amber begin here ---
  57089. 'amber_core/SUnit',
  57090. 'amber_core/Compiler-Tests',
  57091. 'amber_core/Kernel-Tests',
  57092. 'amber_core/SUnit-Tests'
  57093. // --- packages of the development only Amber end here ---
  57094. ], function (amber) { return amber; });
  57095. define("amber_cli/AmberCli", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  57096. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  57097. $core.addPackage('AmberCli');
  57098. $core.packages["AmberCli"].innerEval = function (expr) { return eval(expr); };
  57099. $core.packages["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  57100. $core.addClass('AmberCli', $globals.Object, [], 'AmberCli');
  57101. $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.";
  57102. $core.addMethod(
  57103. $core.method({
  57104. selector: "commandLineSwitches",
  57105. protocol: 'commandline',
  57106. fn: function (){
  57107. var self=this;
  57108. var switches;
  57109. return $core.withContext(function($ctx1) {
  57110. switches=$recv($recv(self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  57111. return $core.withContext(function($ctx2) {
  57112. return $recv(each)._selector();
  57113. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57114. }));
  57115. $ctx1.sendIdx["collect:"]=1;
  57116. switches=$recv(switches)._select_((function(each){
  57117. return $core.withContext(function($ctx2) {
  57118. return $recv(each)._match_("^[^:]*:$");
  57119. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  57120. }));
  57121. switches=$recv(switches)._collect_((function(each){
  57122. return $core.withContext(function($ctx2) {
  57123. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  57124. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  57125. }));
  57126. return switches;
  57127. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.klass)});
  57128. },
  57129. args: [],
  57130. 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",
  57131. referencedClasses: [],
  57132. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  57133. }),
  57134. $globals.AmberCli.klass);
  57135. $core.addMethod(
  57136. $core.method({
  57137. selector: "config:",
  57138. protocol: 'commands',
  57139. fn: function (args){
  57140. var self=this;
  57141. function $Configurator(){return $globals.Configurator||(typeof Configurator=="undefined"?nil:Configurator)}
  57142. return $core.withContext(function($ctx1) {
  57143. $recv($recv($Configurator())._new())._start();
  57144. return self;
  57145. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.klass)});
  57146. },
  57147. args: ["args"],
  57148. source: "config: args\x0a\x09Configurator new start",
  57149. referencedClasses: ["Configurator"],
  57150. messageSends: ["start", "new"]
  57151. }),
  57152. $globals.AmberCli.klass);
  57153. $core.addMethod(
  57154. $core.method({
  57155. selector: "handleArguments:",
  57156. protocol: 'commandline',
  57157. fn: function (args){
  57158. var self=this;
  57159. var selector;
  57160. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  57161. return $core.withContext(function($ctx1) {
  57162. var $1;
  57163. $1=$recv(args)._first();
  57164. $ctx1.sendIdx["first"]=1;
  57165. selector=self._selectorForCommandLineSwitch_($1);
  57166. $recv(args)._remove_($recv(args)._first());
  57167. self._perform_withArguments_(selector,$recv($Array())._with_(args));
  57168. return self;
  57169. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.klass)});
  57170. },
  57171. args: ["args"],
  57172. 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)",
  57173. referencedClasses: ["Array"],
  57174. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  57175. }),
  57176. $globals.AmberCli.klass);
  57177. $core.addMethod(
  57178. $core.method({
  57179. selector: "help:",
  57180. protocol: 'commands',
  57181. fn: function (args){
  57182. var self=this;
  57183. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  57184. return $core.withContext(function($ctx1) {
  57185. $recv($Transcript())._show_("Available commands");
  57186. $recv(self._commandLineSwitches())._do_((function(each){
  57187. return $core.withContext(function($ctx2) {
  57188. return $recv(console)._log_(each);
  57189. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57190. }));
  57191. return self;
  57192. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.klass)});
  57193. },
  57194. args: ["args"],
  57195. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  57196. referencedClasses: ["Transcript"],
  57197. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  57198. }),
  57199. $globals.AmberCli.klass);
  57200. $core.addMethod(
  57201. $core.method({
  57202. selector: "init:",
  57203. protocol: 'commands',
  57204. fn: function (args){
  57205. var self=this;
  57206. function $Initer(){return $globals.Initer||(typeof Initer=="undefined"?nil:Initer)}
  57207. return $core.withContext(function($ctx1) {
  57208. $recv($recv($Initer())._new())._start();
  57209. return self;
  57210. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.klass)});
  57211. },
  57212. args: ["args"],
  57213. source: "init: args\x0a\x09Initer new start",
  57214. referencedClasses: ["Initer"],
  57215. messageSends: ["start", "new"]
  57216. }),
  57217. $globals.AmberCli.klass);
  57218. $core.addMethod(
  57219. $core.method({
  57220. selector: "main",
  57221. protocol: 'startup',
  57222. fn: function (){
  57223. var self=this;
  57224. var args;
  57225. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  57226. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  57227. return $core.withContext(function($ctx1) {
  57228. var $3,$2,$1,$4;
  57229. $3=$recv("Welcome to Amber version ".__comma($recv($Smalltalk())._version())).__comma(" (NodeJS ");
  57230. $ctx1.sendIdx[","]=3;
  57231. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  57232. $ctx1.sendIdx[","]=2;
  57233. $1=$recv($2).__comma(").");
  57234. $ctx1.sendIdx[","]=1;
  57235. $recv($Transcript())._show_($1);
  57236. args=$recv(process)._argv();
  57237. $recv(args)._removeFrom_to_((1),(2));
  57238. $4=$recv(args)._isEmpty();
  57239. if($core.assert($4)){
  57240. self._help_(nil);
  57241. } else {
  57242. return self._handleArguments_(args);
  57243. };
  57244. return self;
  57245. }, function($ctx1) {$ctx1.fill(self,"main",{args:args},$globals.AmberCli.klass)});
  57246. },
  57247. args: [],
  57248. source: "main\x0a\x09\x22Main entry point for Amber applications.\x0a\x09Parses commandline arguments and starts the according subprogram.\x22\x0a\x09| args |\x0a\x09\x0a\x09Transcript show: 'Welcome to Amber version ', Smalltalk version, ' (NodeJS ', process versions node, ').'.\x0a\x0a\x09args := process argv.\x0a\x09\x22Remove the first args which contain the path to the node executable and the script file.\x22\x0a\x09args removeFrom: 1 to: 2.\x0a\x09\x0a\x09(args isEmpty)\x0a\x09\x09ifTrue: [self help: nil]\x0a\x09\x09ifFalse: [^self handleArguments: args]",
  57249. referencedClasses: ["Transcript", "Smalltalk"],
  57250. messageSends: ["show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifTrue:ifFalse:", "isEmpty", "help:", "handleArguments:"]
  57251. }),
  57252. $globals.AmberCli.klass);
  57253. $core.addMethod(
  57254. $core.method({
  57255. selector: "repl:",
  57256. protocol: 'commands',
  57257. fn: function (args){
  57258. var self=this;
  57259. function $Repl(){return $globals.Repl||(typeof Repl=="undefined"?nil:Repl)}
  57260. return $core.withContext(function($ctx1) {
  57261. return $recv($recv($Repl())._new())._createInterface();
  57262. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.klass)});
  57263. },
  57264. args: ["args"],
  57265. source: "repl: args\x0a\x09^ Repl new createInterface",
  57266. referencedClasses: ["Repl"],
  57267. messageSends: ["createInterface", "new"]
  57268. }),
  57269. $globals.AmberCli.klass);
  57270. $core.addMethod(
  57271. $core.method({
  57272. selector: "selectorForCommandLineSwitch:",
  57273. protocol: 'commandline',
  57274. fn: function (aSwitch){
  57275. var self=this;
  57276. var command,selector;
  57277. return $core.withContext(function($ctx1) {
  57278. var $1;
  57279. $1=$recv(self._commandLineSwitches())._includes_(aSwitch);
  57280. if($core.assert($1)){
  57281. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  57282. return $core.withContext(function($ctx2) {
  57283. return $recv($recv(each)._second())._asUppercase();
  57284. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  57285. }))).__comma(":");
  57286. selector;
  57287. } else {
  57288. selector="help:";
  57289. selector;
  57290. };
  57291. return selector;
  57292. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.klass)});
  57293. },
  57294. args: ["aSwitch"],
  57295. 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",
  57296. referencedClasses: [],
  57297. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  57298. }),
  57299. $globals.AmberCli.klass);
  57300. $core.addMethod(
  57301. $core.method({
  57302. selector: "serve:",
  57303. protocol: 'commands',
  57304. fn: function (args){
  57305. var self=this;
  57306. function $FileServer(){return $globals.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  57307. return $core.withContext(function($ctx1) {
  57308. return $recv($recv($FileServer())._createServerWithArguments_(args))._start();
  57309. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.klass)});
  57310. },
  57311. args: ["args"],
  57312. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  57313. referencedClasses: ["FileServer"],
  57314. messageSends: ["start", "createServerWithArguments:"]
  57315. }),
  57316. $globals.AmberCli.klass);
  57317. $core.addMethod(
  57318. $core.method({
  57319. selector: "version:",
  57320. protocol: 'commands',
  57321. fn: function (arguments_){
  57322. var self=this;
  57323. return self;
  57324. },
  57325. args: ["arguments"],
  57326. source: "version: arguments",
  57327. referencedClasses: [],
  57328. messageSends: []
  57329. }),
  57330. $globals.AmberCli.klass);
  57331. $core.addClass('BaseFileManipulator', $globals.Object, ['path', 'fs'], 'AmberCli');
  57332. $core.addMethod(
  57333. $core.method({
  57334. selector: "dirname",
  57335. protocol: 'private',
  57336. fn: function (){
  57337. var self=this;
  57338. return $core.withContext(function($ctx1) {
  57339. return __dirname;
  57340. return self;
  57341. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  57342. },
  57343. args: [],
  57344. source: "dirname\x0a\x09<return __dirname>",
  57345. referencedClasses: [],
  57346. messageSends: []
  57347. }),
  57348. $globals.BaseFileManipulator);
  57349. $core.addMethod(
  57350. $core.method({
  57351. selector: "initialize",
  57352. protocol: 'initialization',
  57353. fn: function (){
  57354. var self=this;
  57355. return $core.withContext(function($ctx1) {
  57356. (
  57357. $ctx1.supercall = true,
  57358. ($globals.BaseFileManipulator.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  57359. $ctx1.supercall = false;
  57360. self["@path"]=$recv(require)._value_("path");
  57361. $ctx1.sendIdx["value:"]=1;
  57362. self["@fs"]=$recv(require)._value_("fs");
  57363. return self;
  57364. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  57365. },
  57366. args: [],
  57367. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  57368. referencedClasses: [],
  57369. messageSends: ["initialize", "value:"]
  57370. }),
  57371. $globals.BaseFileManipulator);
  57372. $core.addMethod(
  57373. $core.method({
  57374. selector: "rootDirname",
  57375. protocol: 'private',
  57376. fn: function (){
  57377. var self=this;
  57378. return $core.withContext(function($ctx1) {
  57379. return $recv(self["@path"])._join_with_(self._dirname(),"..");
  57380. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  57381. },
  57382. args: [],
  57383. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  57384. referencedClasses: [],
  57385. messageSends: ["join:with:", "dirname"]
  57386. }),
  57387. $globals.BaseFileManipulator);
  57388. $core.addClass('Configurator', $globals.BaseFileManipulator, [], 'AmberCli');
  57389. $core.addMethod(
  57390. $core.method({
  57391. selector: "initialize",
  57392. protocol: 'initialization',
  57393. fn: function (){
  57394. var self=this;
  57395. return $core.withContext(function($ctx1) {
  57396. (
  57397. $ctx1.supercall = true,
  57398. ($globals.Configurator.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  57399. $ctx1.supercall = false;
  57400. return self;
  57401. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  57402. },
  57403. args: [],
  57404. source: "initialize\x0a\x09super initialize",
  57405. referencedClasses: [],
  57406. messageSends: ["initialize"]
  57407. }),
  57408. $globals.Configurator);
  57409. $core.addMethod(
  57410. $core.method({
  57411. selector: "start",
  57412. protocol: 'action',
  57413. fn: function (){
  57414. var self=this;
  57415. return $core.withContext(function($ctx1) {
  57416. var $receiver;
  57417. self._writeConfigThenDo_((function(err){
  57418. return $core.withContext(function($ctx2) {
  57419. if(($receiver = err) == null || $receiver.isNil){
  57420. return $recv(process)._exit();
  57421. } else {
  57422. return $recv(process)._exit_((111));
  57423. };
  57424. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  57425. }));
  57426. return self;
  57427. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  57428. },
  57429. args: [],
  57430. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  57431. referencedClasses: [],
  57432. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  57433. }),
  57434. $globals.Configurator);
  57435. $core.addMethod(
  57436. $core.method({
  57437. selector: "writeConfigThenDo:",
  57438. protocol: 'action',
  57439. fn: function (aBlock){
  57440. var self=this;
  57441. return $core.withContext(function($ctx1) {
  57442. $recv($recv(require)._value_("amber-dev/lib/config"))._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  57443. return self;
  57444. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  57445. },
  57446. args: ["aBlock"],
  57447. 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",
  57448. referencedClasses: [],
  57449. messageSends: ["writeConfig:toFile:thenDo:", "value:", "cwd"]
  57450. }),
  57451. $globals.Configurator);
  57452. $core.addClass('FileServer', $globals.BaseFileManipulator, ['http', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli');
  57453. $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.";
  57454. $core.addMethod(
  57455. $core.method({
  57456. selector: "base64Decode:",
  57457. protocol: 'private',
  57458. fn: function (aString){
  57459. var self=this;
  57460. return $core.withContext(function($ctx1) {
  57461. return (new Buffer(aString, 'base64').toString());
  57462. return self;
  57463. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  57464. },
  57465. args: ["aString"],
  57466. source: "base64Decode: aString\x0a\x09<return (new Buffer(aString, 'base64').toString())>",
  57467. referencedClasses: [],
  57468. messageSends: []
  57469. }),
  57470. $globals.FileServer);
  57471. $core.addMethod(
  57472. $core.method({
  57473. selector: "basePath",
  57474. protocol: 'accessing',
  57475. fn: function (){
  57476. var self=this;
  57477. return $core.withContext(function($ctx1) {
  57478. var $1,$receiver;
  57479. $1=self["@basePath"];
  57480. if(($receiver = $1) == null || $receiver.isNil){
  57481. return $recv(self._class())._defaultBasePath();
  57482. } else {
  57483. return $1;
  57484. };
  57485. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  57486. },
  57487. args: [],
  57488. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  57489. referencedClasses: [],
  57490. messageSends: ["ifNil:", "defaultBasePath", "class"]
  57491. }),
  57492. $globals.FileServer);
  57493. $core.addMethod(
  57494. $core.method({
  57495. selector: "basePath:",
  57496. protocol: 'accessing',
  57497. fn: function (aString){
  57498. var self=this;
  57499. return $core.withContext(function($ctx1) {
  57500. self["@basePath"]=aString;
  57501. self._validateBasePath();
  57502. return self;
  57503. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  57504. },
  57505. args: ["aString"],
  57506. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  57507. referencedClasses: [],
  57508. messageSends: ["validateBasePath"]
  57509. }),
  57510. $globals.FileServer);
  57511. $core.addMethod(
  57512. $core.method({
  57513. selector: "checkDirectoryLayout",
  57514. protocol: 'initialization',
  57515. fn: function (){
  57516. var self=this;
  57517. return $core.withContext(function($ctx1) {
  57518. var $1;
  57519. $1=$recv(self["@fs"])._existsSync_(self._withBasePath_("index.html"));
  57520. if(!$core.assert($1)){
  57521. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  57522. $ctx1.sendIdx["warn:"]=1;
  57523. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  57524. $ctx1.sendIdx["warn:"]=2;
  57525. $recv(console)._warn_(" You can also specify a page to be served by default,");
  57526. $ctx1.sendIdx["warn:"]=3;
  57527. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  57528. };
  57529. return self;
  57530. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  57531. },
  57532. args: [],
  57533. 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.'].",
  57534. referencedClasses: [],
  57535. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  57536. }),
  57537. $globals.FileServer);
  57538. $core.addMethod(
  57539. $core.method({
  57540. selector: "fallbackPage",
  57541. protocol: 'accessing',
  57542. fn: function (){
  57543. var self=this;
  57544. return self["@fallbackPage"];
  57545. },
  57546. args: [],
  57547. source: "fallbackPage\x0a\x09^ fallbackPage",
  57548. referencedClasses: [],
  57549. messageSends: []
  57550. }),
  57551. $globals.FileServer);
  57552. $core.addMethod(
  57553. $core.method({
  57554. selector: "fallbackPage:",
  57555. protocol: 'accessing',
  57556. fn: function (aString){
  57557. var self=this;
  57558. self["@fallbackPage"]=aString;
  57559. return self;
  57560. },
  57561. args: ["aString"],
  57562. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  57563. referencedClasses: [],
  57564. messageSends: []
  57565. }),
  57566. $globals.FileServer);
  57567. $core.addMethod(
  57568. $core.method({
  57569. selector: "handleGETRequest:respondTo:",
  57570. protocol: 'request handling',
  57571. fn: function (aRequest,aResponse){
  57572. var self=this;
  57573. var uri,filename;
  57574. return $core.withContext(function($ctx1) {
  57575. var $1;
  57576. uri=$recv(self["@url"])._parse_($recv(aRequest)._url());
  57577. filename=$recv(self["@path"])._join_with_(self._basePath(),$recv(uri)._pathname());
  57578. $recv(self["@fs"])._exists_do_(filename,(function(aBoolean){
  57579. return $core.withContext(function($ctx2) {
  57580. if($core.assert(aBoolean)){
  57581. $1=$recv($recv(self["@fs"])._statSync_(filename))._isDirectory();
  57582. if($core.assert($1)){
  57583. return self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  57584. } else {
  57585. return self._respondFileNamed_to_(filename,aResponse);
  57586. };
  57587. } else {
  57588. return self._respondNotFoundTo_(aResponse);
  57589. };
  57590. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  57591. }));
  57592. return self;
  57593. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  57594. },
  57595. args: ["aRequest", "aResponse"],
  57596. 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]]]",
  57597. referencedClasses: [],
  57598. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  57599. }),
  57600. $globals.FileServer);
  57601. $core.addMethod(
  57602. $core.method({
  57603. selector: "handleOPTIONSRequest:respondTo:",
  57604. protocol: 'request handling',
  57605. fn: function (aRequest,aResponse){
  57606. var self=this;
  57607. return $core.withContext(function($ctx1) {
  57608. $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)]));
  57609. $recv(aResponse)._end();
  57610. return self;
  57611. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  57612. },
  57613. args: ["aRequest", "aResponse"],
  57614. 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",
  57615. referencedClasses: [],
  57616. messageSends: ["writeHead:options:", "end"]
  57617. }),
  57618. $globals.FileServer);
  57619. $core.addMethod(
  57620. $core.method({
  57621. selector: "handlePUTRequest:respondTo:",
  57622. protocol: 'request handling',
  57623. fn: function (aRequest,aResponse){
  57624. var self=this;
  57625. var file,stream;
  57626. return $core.withContext(function($ctx1) {
  57627. var $1,$2,$3,$4;
  57628. $1=self._isAuthenticated_(aRequest);
  57629. if(!$core.assert($1)){
  57630. self._respondAuthenticationRequiredTo_(aResponse);
  57631. return nil;
  57632. };
  57633. file=".".__comma($recv(aRequest)._url());
  57634. $ctx1.sendIdx[","]=1;
  57635. stream=$recv(self["@fs"])._createWriteStream_(file);
  57636. $recv(stream)._on_do_("error",(function(error){
  57637. return $core.withContext(function($ctx2) {
  57638. $2=console;
  57639. $3="Error creating WriteStream for file ".__comma(file);
  57640. $ctx2.sendIdx[","]=2;
  57641. $recv($2)._warn_($3);
  57642. $ctx2.sendIdx["warn:"]=1;
  57643. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  57644. $ctx2.sendIdx["warn:"]=2;
  57645. $recv(console)._warn_(" The exact error is: ".__comma(error));
  57646. return self._respondNotCreatedTo_(aResponse);
  57647. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  57648. }));
  57649. $ctx1.sendIdx["on:do:"]=1;
  57650. $recv(stream)._on_do_("close",(function(){
  57651. return $core.withContext(function($ctx2) {
  57652. return self._respondCreatedTo_(aResponse);
  57653. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  57654. }));
  57655. $ctx1.sendIdx["on:do:"]=2;
  57656. $recv(aRequest)._setEncoding_("utf8");
  57657. $recv(aRequest)._on_do_("data",(function(data){
  57658. return $core.withContext(function($ctx2) {
  57659. return $recv(stream)._write_(data);
  57660. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  57661. }));
  57662. $ctx1.sendIdx["on:do:"]=3;
  57663. $recv(aRequest)._on_do_("end",(function(){
  57664. return $core.withContext(function($ctx2) {
  57665. $4=$recv(stream)._writable();
  57666. if($core.assert($4)){
  57667. return $recv(stream)._end();
  57668. };
  57669. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  57670. }));
  57671. return self;
  57672. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  57673. },
  57674. args: ["aRequest", "aResponse"],
  57675. 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]]",
  57676. referencedClasses: [],
  57677. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  57678. }),
  57679. $globals.FileServer);
  57680. $core.addMethod(
  57681. $core.method({
  57682. selector: "handleRequest:respondTo:",
  57683. protocol: 'request handling',
  57684. fn: function (aRequest,aResponse){
  57685. var self=this;
  57686. return $core.withContext(function($ctx1) {
  57687. var $2,$1,$4,$3,$5;
  57688. $2=$recv(aRequest)._method();
  57689. $ctx1.sendIdx["method"]=1;
  57690. $1=$recv($2).__eq("PUT");
  57691. $ctx1.sendIdx["="]=1;
  57692. if($core.assert($1)){
  57693. self._handlePUTRequest_respondTo_(aRequest,aResponse);
  57694. };
  57695. $4=$recv(aRequest)._method();
  57696. $ctx1.sendIdx["method"]=2;
  57697. $3=$recv($4).__eq("GET");
  57698. $ctx1.sendIdx["="]=2;
  57699. if($core.assert($3)){
  57700. self._handleGETRequest_respondTo_(aRequest,aResponse);
  57701. };
  57702. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  57703. if($core.assert($5)){
  57704. self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  57705. };
  57706. return self;
  57707. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  57708. },
  57709. args: ["aRequest", "aResponse"],
  57710. 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]",
  57711. referencedClasses: [],
  57712. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  57713. }),
  57714. $globals.FileServer);
  57715. $core.addMethod(
  57716. $core.method({
  57717. selector: "host",
  57718. protocol: 'accessing',
  57719. fn: function (){
  57720. var self=this;
  57721. return self["@host"];
  57722. },
  57723. args: [],
  57724. source: "host\x0a\x09^ host",
  57725. referencedClasses: [],
  57726. messageSends: []
  57727. }),
  57728. $globals.FileServer);
  57729. $core.addMethod(
  57730. $core.method({
  57731. selector: "host:",
  57732. protocol: 'accessing',
  57733. fn: function (hostname){
  57734. var self=this;
  57735. self["@host"]=hostname;
  57736. return self;
  57737. },
  57738. args: ["hostname"],
  57739. source: "host: hostname\x0a\x09host := hostname",
  57740. referencedClasses: [],
  57741. messageSends: []
  57742. }),
  57743. $globals.FileServer);
  57744. $core.addMethod(
  57745. $core.method({
  57746. selector: "initialize",
  57747. protocol: 'initialization',
  57748. fn: function (){
  57749. var self=this;
  57750. return $core.withContext(function($ctx1) {
  57751. var $1;
  57752. (
  57753. $ctx1.supercall = true,
  57754. ($globals.FileServer.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  57755. $ctx1.supercall = false;
  57756. self["@http"]=self._require_("http");
  57757. $ctx1.sendIdx["require:"]=1;
  57758. self["@util"]=self._require_("util");
  57759. $ctx1.sendIdx["require:"]=2;
  57760. self["@url"]=self._require_("url");
  57761. $1=self._class();
  57762. $ctx1.sendIdx["class"]=1;
  57763. self["@host"]=$recv($1)._defaultHost();
  57764. self["@port"]=$recv(self._class())._defaultPort();
  57765. self["@username"]=nil;
  57766. self["@password"]=nil;
  57767. self["@fallbackPage"]=nil;
  57768. return self;
  57769. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  57770. },
  57771. args: [],
  57772. 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.",
  57773. referencedClasses: [],
  57774. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  57775. }),
  57776. $globals.FileServer);
  57777. $core.addMethod(
  57778. $core.method({
  57779. selector: "isAuthenticated:",
  57780. protocol: 'private',
  57781. fn: function (aRequest){
  57782. var self=this;
  57783. var header,token,auth,parts;
  57784. return $core.withContext(function($ctx1) {
  57785. var $2,$1,$3,$4,$5,$6,$9,$10,$8,$7,$receiver;
  57786. $2=$recv(self["@username"])._isNil();
  57787. $ctx1.sendIdx["isNil"]=1;
  57788. $1=$recv($2)._and_((function(){
  57789. return $core.withContext(function($ctx2) {
  57790. return $recv(self["@password"])._isNil();
  57791. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57792. }));
  57793. $ctx1.sendIdx["and:"]=1;
  57794. if($core.assert($1)){
  57795. return true;
  57796. };
  57797. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  57798. $ctx1.sendIdx["at:"]=1;
  57799. if(($receiver = $3) == null || $receiver.isNil){
  57800. header="";
  57801. } else {
  57802. header=$3;
  57803. };
  57804. $4=$recv(header)._isEmpty();
  57805. if($core.assert($4)){
  57806. return false;
  57807. } else {
  57808. $5=$recv(header)._tokenize_(" ");
  57809. $ctx1.sendIdx["tokenize:"]=1;
  57810. if(($receiver = $5) == null || $receiver.isNil){
  57811. token="";
  57812. } else {
  57813. token=$5;
  57814. };
  57815. token;
  57816. $6=$recv(token)._at_((2));
  57817. $ctx1.sendIdx["at:"]=2;
  57818. auth=self._base64Decode_($6);
  57819. auth;
  57820. parts=$recv(auth)._tokenize_(":");
  57821. parts;
  57822. $9=self["@username"];
  57823. $10=$recv(parts)._at_((1));
  57824. $ctx1.sendIdx["at:"]=3;
  57825. $8=$recv($9).__eq($10);
  57826. $ctx1.sendIdx["="]=1;
  57827. $7=$recv($8)._and_((function(){
  57828. return $core.withContext(function($ctx2) {
  57829. return $recv(self["@password"]).__eq($recv(parts)._at_((2)));
  57830. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  57831. }));
  57832. if($core.assert($7)){
  57833. return true;
  57834. } else {
  57835. return false;
  57836. };
  57837. };
  57838. return self;
  57839. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  57840. },
  57841. args: ["aRequest"],
  57842. 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].",
  57843. referencedClasses: [],
  57844. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "isEmpty", "tokenize:", "base64Decode:", "="]
  57845. }),
  57846. $globals.FileServer);
  57847. $core.addMethod(
  57848. $core.method({
  57849. selector: "password:",
  57850. protocol: 'accessing',
  57851. fn: function (aPassword){
  57852. var self=this;
  57853. self["@password"]=aPassword;
  57854. return self;
  57855. },
  57856. args: ["aPassword"],
  57857. source: "password: aPassword\x0a\x09password := aPassword.",
  57858. referencedClasses: [],
  57859. messageSends: []
  57860. }),
  57861. $globals.FileServer);
  57862. $core.addMethod(
  57863. $core.method({
  57864. selector: "port",
  57865. protocol: 'accessing',
  57866. fn: function (){
  57867. var self=this;
  57868. return self["@port"];
  57869. },
  57870. args: [],
  57871. source: "port\x0a\x09^ port",
  57872. referencedClasses: [],
  57873. messageSends: []
  57874. }),
  57875. $globals.FileServer);
  57876. $core.addMethod(
  57877. $core.method({
  57878. selector: "port:",
  57879. protocol: 'accessing',
  57880. fn: function (aNumber){
  57881. var self=this;
  57882. self["@port"]=aNumber;
  57883. return self;
  57884. },
  57885. args: ["aNumber"],
  57886. source: "port: aNumber\x0a\x09port := aNumber",
  57887. referencedClasses: [],
  57888. messageSends: []
  57889. }),
  57890. $globals.FileServer);
  57891. $core.addMethod(
  57892. $core.method({
  57893. selector: "require:",
  57894. protocol: 'private',
  57895. fn: function (aModuleString){
  57896. var self=this;
  57897. return $core.withContext(function($ctx1) {
  57898. return $recv(require)._value_(aModuleString);
  57899. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  57900. },
  57901. args: ["aModuleString"],
  57902. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  57903. referencedClasses: [],
  57904. messageSends: ["value:"]
  57905. }),
  57906. $globals.FileServer);
  57907. $core.addMethod(
  57908. $core.method({
  57909. selector: "respondAuthenticationRequiredTo:",
  57910. protocol: 'request handling',
  57911. fn: function (aResponse){
  57912. var self=this;
  57913. return $core.withContext(function($ctx1) {
  57914. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  57915. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  57916. $recv(aResponse)._end();
  57917. return self;
  57918. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  57919. },
  57920. args: ["aResponse"],
  57921. 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.",
  57922. referencedClasses: [],
  57923. messageSends: ["writeHead:options:", "write:", "end"]
  57924. }),
  57925. $globals.FileServer);
  57926. $core.addMethod(
  57927. $core.method({
  57928. selector: "respondCreatedTo:",
  57929. protocol: 'request handling',
  57930. fn: function (aResponse){
  57931. var self=this;
  57932. return $core.withContext(function($ctx1) {
  57933. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  57934. $recv(aResponse)._end();
  57935. return self;
  57936. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  57937. },
  57938. args: ["aResponse"],
  57939. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  57940. referencedClasses: [],
  57941. messageSends: ["writeHead:options:", "end"]
  57942. }),
  57943. $globals.FileServer);
  57944. $core.addMethod(
  57945. $core.method({
  57946. selector: "respondDirectoryNamed:from:to:",
  57947. protocol: 'request handling',
  57948. fn: function (aDirname,aUrl,aResponse){
  57949. var self=this;
  57950. return $core.withContext(function($ctx1) {
  57951. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  57952. $2=$recv(aUrl)._pathname();
  57953. $ctx1.sendIdx["pathname"]=1;
  57954. $1=$recv($2)._endsWith_("/");
  57955. if($core.assert($1)){
  57956. $3=$recv(aDirname).__comma("index.html");
  57957. $ctx1.sendIdx[","]=1;
  57958. self._respondFileNamed_to_($3,aResponse);
  57959. } else {
  57960. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  57961. $7=$recv(aUrl)._search();
  57962. if(($receiver = $7) == null || $receiver.isNil){
  57963. $6="";
  57964. } else {
  57965. $6=$7;
  57966. };
  57967. $4=$recv($5).__comma($6);
  57968. $ctx1.sendIdx[","]=2;
  57969. self._respondRedirect_to_($4,aResponse);
  57970. };
  57971. return self;
  57972. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  57973. },
  57974. args: ["aDirname", "aUrl", "aResponse"],
  57975. 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]",
  57976. referencedClasses: [],
  57977. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  57978. }),
  57979. $globals.FileServer);
  57980. $core.addMethod(
  57981. $core.method({
  57982. selector: "respondFileNamed:to:",
  57983. protocol: 'request handling',
  57984. fn: function (aFilename,aResponse){
  57985. var self=this;
  57986. var type,filename;
  57987. return $core.withContext(function($ctx1) {
  57988. var $1,$2,$3,$4;
  57989. filename=aFilename;
  57990. $recv(self["@fs"])._readFile_do_(filename,(function(ex,file){
  57991. return $core.withContext(function($ctx2) {
  57992. $1=$recv(ex)._notNil();
  57993. if($core.assert($1)){
  57994. $2=console;
  57995. $3=$recv(filename).__comma(" does not exist");
  57996. $ctx2.sendIdx[","]=1;
  57997. $recv($2)._log_($3);
  57998. return self._respondNotFoundTo_(aResponse);
  57999. } else {
  58000. type=$recv(self._class())._mimeTypeFor_(filename);
  58001. type;
  58002. $4=$recv(type).__eq("application/javascript");
  58003. if($core.assert($4)){
  58004. type=$recv(type).__comma(";charset=utf-8");
  58005. type;
  58006. };
  58007. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  58008. $recv(aResponse)._write_encoding_(file,"binary");
  58009. return $recv(aResponse)._end();
  58010. };
  58011. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  58012. }));
  58013. return self;
  58014. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  58015. },
  58016. args: ["aFilename", "aResponse"],
  58017. 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]]",
  58018. referencedClasses: [],
  58019. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  58020. }),
  58021. $globals.FileServer);
  58022. $core.addMethod(
  58023. $core.method({
  58024. selector: "respondInternalErrorTo:",
  58025. protocol: 'request handling',
  58026. fn: function (aResponse){
  58027. var self=this;
  58028. return $core.withContext(function($ctx1) {
  58029. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  58030. $recv(aResponse)._write_("500 Internal server error");
  58031. $recv(aResponse)._end();
  58032. return self;
  58033. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  58034. },
  58035. args: ["aResponse"],
  58036. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  58037. referencedClasses: [],
  58038. messageSends: ["writeHead:options:", "write:", "end"]
  58039. }),
  58040. $globals.FileServer);
  58041. $core.addMethod(
  58042. $core.method({
  58043. selector: "respondNotCreatedTo:",
  58044. protocol: 'request handling',
  58045. fn: function (aResponse){
  58046. var self=this;
  58047. return $core.withContext(function($ctx1) {
  58048. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  58049. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  58050. $recv(aResponse)._end();
  58051. return self;
  58052. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  58053. },
  58054. args: ["aResponse"],
  58055. 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.",
  58056. referencedClasses: [],
  58057. messageSends: ["writeHead:options:", "write:", "end"]
  58058. }),
  58059. $globals.FileServer);
  58060. $core.addMethod(
  58061. $core.method({
  58062. selector: "respondNotFoundTo:",
  58063. protocol: 'request handling',
  58064. fn: function (aResponse){
  58065. var self=this;
  58066. return $core.withContext(function($ctx1) {
  58067. var $2,$1;
  58068. $2=self._fallbackPage();
  58069. $ctx1.sendIdx["fallbackPage"]=1;
  58070. $1=$recv($2)._isNil();
  58071. if(!$core.assert($1)){
  58072. return self._respondFileNamed_to_(self._fallbackPage(),aResponse);
  58073. };
  58074. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  58075. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  58076. $ctx1.sendIdx["write:"]=1;
  58077. $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>");
  58078. $ctx1.sendIdx["write:"]=2;
  58079. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  58080. $ctx1.sendIdx["write:"]=3;
  58081. $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>");
  58082. $ctx1.sendIdx["write:"]=4;
  58083. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  58084. $ctx1.sendIdx["write:"]=5;
  58085. $recv(aResponse)._write_("</ul></p></body></html>");
  58086. $recv(aResponse)._end();
  58087. return self;
  58088. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  58089. },
  58090. args: ["aResponse"],
  58091. 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",
  58092. referencedClasses: [],
  58093. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  58094. }),
  58095. $globals.FileServer);
  58096. $core.addMethod(
  58097. $core.method({
  58098. selector: "respondOKTo:",
  58099. protocol: 'request handling',
  58100. fn: function (aResponse){
  58101. var self=this;
  58102. return $core.withContext(function($ctx1) {
  58103. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  58104. $recv(aResponse)._end();
  58105. return self;
  58106. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  58107. },
  58108. args: ["aResponse"],
  58109. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  58110. referencedClasses: [],
  58111. messageSends: ["writeHead:options:", "end"]
  58112. }),
  58113. $globals.FileServer);
  58114. $core.addMethod(
  58115. $core.method({
  58116. selector: "respondRedirect:to:",
  58117. protocol: 'request handling',
  58118. fn: function (aString,aResponse){
  58119. var self=this;
  58120. return $core.withContext(function($ctx1) {
  58121. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  58122. $recv(aResponse)._end();
  58123. return self;
  58124. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  58125. },
  58126. args: ["aString", "aResponse"],
  58127. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  58128. referencedClasses: [],
  58129. messageSends: ["writeHead:options:", "end"]
  58130. }),
  58131. $globals.FileServer);
  58132. $core.addMethod(
  58133. $core.method({
  58134. selector: "start",
  58135. protocol: 'starting',
  58136. fn: function (){
  58137. var self=this;
  58138. return $core.withContext(function($ctx1) {
  58139. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  58140. self._checkDirectoryLayout();
  58141. $1=$recv(self["@http"])._createServer_((function(request,response){
  58142. return $core.withContext(function($ctx2) {
  58143. return self._handleRequest_respondTo_(request,response);
  58144. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  58145. }));
  58146. $recv($1)._on_do_("error",(function(error){
  58147. return $core.withContext(function($ctx2) {
  58148. $2=console;
  58149. $3="Error starting server: ".__comma(error);
  58150. $ctx2.sendIdx[","]=1;
  58151. return $recv($2)._log_($3);
  58152. $ctx2.sendIdx["log:"]=1;
  58153. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  58154. }));
  58155. $ctx1.sendIdx["on:do:"]=1;
  58156. $recv($1)._on_do_("listening",(function(){
  58157. return $core.withContext(function($ctx2) {
  58158. $4=console;
  58159. $8=self._host();
  58160. $ctx2.sendIdx["host"]=1;
  58161. $7="Starting file server on http://".__comma($8);
  58162. $6=$recv($7).__comma(":");
  58163. $ctx2.sendIdx[","]=3;
  58164. $10=self._port();
  58165. $ctx2.sendIdx["port"]=1;
  58166. $9=$recv($10)._asString();
  58167. $5=$recv($6).__comma($9);
  58168. $ctx2.sendIdx[","]=2;
  58169. return $recv($4)._log_($5);
  58170. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58171. }));
  58172. $recv($1)._listen_host_(self._port(),self._host());
  58173. return self;
  58174. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  58175. },
  58176. args: [],
  58177. 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.",
  58178. referencedClasses: [],
  58179. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  58180. }),
  58181. $globals.FileServer);
  58182. $core.addMethod(
  58183. $core.method({
  58184. selector: "startOn:",
  58185. protocol: 'starting',
  58186. fn: function (aPort){
  58187. var self=this;
  58188. return $core.withContext(function($ctx1) {
  58189. self._port_(aPort);
  58190. self._start();
  58191. return self;
  58192. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  58193. },
  58194. args: ["aPort"],
  58195. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  58196. referencedClasses: [],
  58197. messageSends: ["port:", "start"]
  58198. }),
  58199. $globals.FileServer);
  58200. $core.addMethod(
  58201. $core.method({
  58202. selector: "username:",
  58203. protocol: 'accessing',
  58204. fn: function (aUsername){
  58205. var self=this;
  58206. self["@username"]=aUsername;
  58207. return self;
  58208. },
  58209. args: ["aUsername"],
  58210. source: "username: aUsername\x0a\x09username := aUsername.",
  58211. referencedClasses: [],
  58212. messageSends: []
  58213. }),
  58214. $globals.FileServer);
  58215. $core.addMethod(
  58216. $core.method({
  58217. selector: "validateBasePath",
  58218. protocol: 'private',
  58219. fn: function (){
  58220. var self=this;
  58221. return $core.withContext(function($ctx1) {
  58222. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  58223. $1=self["@fs"];
  58224. $2=self._basePath();
  58225. $ctx1.sendIdx["basePath"]=1;
  58226. $recv($1)._stat_then_($2,(function(err,stat){
  58227. return $core.withContext(function($ctx2) {
  58228. if(($receiver = err) == null || $receiver.isNil){
  58229. $3=$recv(stat)._isDirectory();
  58230. if(!$core.assert($3)){
  58231. $4=console;
  58232. $7=self._basePath();
  58233. $ctx2.sendIdx["basePath"]=2;
  58234. $6="Warning: --base-path parameter ".__comma($7);
  58235. $ctx2.sendIdx[","]=2;
  58236. $5=$recv($6).__comma(" is not a directory.");
  58237. $ctx2.sendIdx[","]=1;
  58238. return $recv($4)._warn_($5);
  58239. $ctx2.sendIdx["warn:"]=1;
  58240. };
  58241. } else {
  58242. $8=console;
  58243. $9=$recv("Warning: path at --base-path parameter ".__comma(self._basePath())).__comma(" does not exist.");
  58244. $ctx2.sendIdx[","]=3;
  58245. return $recv($8)._warn_($9);
  58246. };
  58247. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  58248. }));
  58249. return self;
  58250. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  58251. },
  58252. args: [],
  58253. 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.' ]].",
  58254. referencedClasses: [],
  58255. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  58256. }),
  58257. $globals.FileServer);
  58258. $core.addMethod(
  58259. $core.method({
  58260. selector: "withBasePath:",
  58261. protocol: 'private',
  58262. fn: function (aBaseRelativePath){
  58263. var self=this;
  58264. return $core.withContext(function($ctx1) {
  58265. return $recv(self["@path"])._join_with_(self._basePath(),aBaseRelativePath);
  58266. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  58267. },
  58268. args: ["aBaseRelativePath"],
  58269. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  58270. referencedClasses: [],
  58271. messageSends: ["join:with:", "basePath"]
  58272. }),
  58273. $globals.FileServer);
  58274. $core.addMethod(
  58275. $core.method({
  58276. selector: "writeData:toFileNamed:",
  58277. protocol: 'private',
  58278. fn: function (data,aFilename){
  58279. var self=this;
  58280. return $core.withContext(function($ctx1) {
  58281. $recv(console)._log_(aFilename);
  58282. return self;
  58283. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  58284. },
  58285. args: ["data", "aFilename"],
  58286. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  58287. referencedClasses: [],
  58288. messageSends: ["log:"]
  58289. }),
  58290. $globals.FileServer);
  58291. $globals.FileServer.klass.iVarNames = ['mimeTypes'];
  58292. $core.addMethod(
  58293. $core.method({
  58294. selector: "commandLineSwitches",
  58295. protocol: 'accessing',
  58296. fn: function (){
  58297. var self=this;
  58298. var switches;
  58299. return $core.withContext(function($ctx1) {
  58300. switches=$recv(self._methodsInProtocol_("accessing"))._collect_((function(each){
  58301. return $core.withContext(function($ctx2) {
  58302. return $recv(each)._selector();
  58303. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58304. }));
  58305. $ctx1.sendIdx["collect:"]=1;
  58306. switches=$recv(switches)._select_((function(each){
  58307. return $core.withContext(function($ctx2) {
  58308. return $recv(each)._match_("^[^:]*:$");
  58309. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  58310. }));
  58311. switches=$recv(switches)._collect_((function(each){
  58312. return $core.withContext(function($ctx2) {
  58313. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  58314. $ctx2.sendIdx["replace:with:"]=1;
  58315. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  58316. }));
  58317. return switches;
  58318. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.klass)});
  58319. },
  58320. args: [],
  58321. 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",
  58322. referencedClasses: [],
  58323. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  58324. }),
  58325. $globals.FileServer.klass);
  58326. $core.addMethod(
  58327. $core.method({
  58328. selector: "createServerWithArguments:",
  58329. protocol: 'initialization',
  58330. fn: function (options){
  58331. var self=this;
  58332. var server,popFront,front,optionName,optionValue,switches;
  58333. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  58334. return $core.withContext(function($ctx1) {
  58335. var $1,$2,$3,$4,$5,$6,$7,$8;
  58336. var $early={};
  58337. try {
  58338. switches=self._commandLineSwitches();
  58339. server=self._new();
  58340. $recv(options)._ifEmpty_((function(){
  58341. throw $early=[server];
  58342. }));
  58343. $1=$recv($recv(options)._size())._even();
  58344. if(!$core.assert($1)){
  58345. $recv(console)._log_("Using default parameters.");
  58346. $ctx1.sendIdx["log:"]=1;
  58347. $2=console;
  58348. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  58349. $ctx1.sendIdx[","]=1;
  58350. $recv($2)._log_($3);
  58351. $ctx1.sendIdx["log:"]=2;
  58352. $4=console;
  58353. $5="Use any of the following ones: ".__comma(switches);
  58354. $ctx1.sendIdx[","]=2;
  58355. $recv($4)._log_($5);
  58356. $ctx1.sendIdx["log:"]=3;
  58357. return server;
  58358. };
  58359. popFront=(function(args){
  58360. return $core.withContext(function($ctx2) {
  58361. front=$recv(args)._first();
  58362. front;
  58363. $recv(args)._remove_(front);
  58364. return front;
  58365. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  58366. });
  58367. $recv((function(){
  58368. return $core.withContext(function($ctx2) {
  58369. return $recv(options)._notEmpty();
  58370. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  58371. }))._whileTrue_((function(){
  58372. return $core.withContext(function($ctx2) {
  58373. optionName=$recv(popFront)._value_(options);
  58374. $ctx2.sendIdx["value:"]=1;
  58375. optionName;
  58376. optionValue=$recv(popFront)._value_(options);
  58377. optionValue;
  58378. $6=$recv(switches)._includes_(optionName);
  58379. if($core.assert($6)){
  58380. optionName=self._selectorForCommandLineSwitch_(optionName);
  58381. optionName;
  58382. return $recv(server)._perform_withArguments_(optionName,$recv($Array())._with_(optionValue));
  58383. } else {
  58384. $7=console;
  58385. $8=$recv(optionName).__comma(" is not a valid commandline option");
  58386. $ctx2.sendIdx[","]=3;
  58387. $recv($7)._log_($8);
  58388. $ctx2.sendIdx["log:"]=4;
  58389. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  58390. };
  58391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58392. }));
  58393. return server;
  58394. }
  58395. catch(e) {if(e===$early)return e[0]; throw e}
  58396. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.klass)});
  58397. },
  58398. args: ["options"],
  58399. 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.",
  58400. referencedClasses: ["Array"],
  58401. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  58402. }),
  58403. $globals.FileServer.klass);
  58404. $core.addMethod(
  58405. $core.method({
  58406. selector: "defaultBasePath",
  58407. protocol: 'accessing',
  58408. fn: function (){
  58409. var self=this;
  58410. return "./";
  58411. },
  58412. args: [],
  58413. source: "defaultBasePath\x0a\x09^ './'",
  58414. referencedClasses: [],
  58415. messageSends: []
  58416. }),
  58417. $globals.FileServer.klass);
  58418. $core.addMethod(
  58419. $core.method({
  58420. selector: "defaultHost",
  58421. protocol: 'accessing',
  58422. fn: function (){
  58423. var self=this;
  58424. return "127.0.0.1";
  58425. },
  58426. args: [],
  58427. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  58428. referencedClasses: [],
  58429. messageSends: []
  58430. }),
  58431. $globals.FileServer.klass);
  58432. $core.addMethod(
  58433. $core.method({
  58434. selector: "defaultMimeTypes",
  58435. protocol: 'accessing',
  58436. fn: function (){
  58437. var self=this;
  58438. return $globals.HashedCollection._newFromPairs_(["%","application/x-trash","323","text/h323","abw","application/x-abiword","ai","application/postscript","aif","audio/x-aiff","aifc","audio/x-aiff","aiff","audio/x-aiff","alc","chemical/x-alchemy","art","image/x-jg","asc","text/plain","asf","video/x-ms-asf","asn","chemical/x-ncbi-asn1-spec","aso","chemical/x-ncbi-asn1-binary","asx","video/x-ms-asf","au","audio/basic","avi","video/x-msvideo","b","chemical/x-molconn-Z","bak","application/x-trash","bat","application/x-msdos-program","bcpio","application/x-bcpio","bib","text/x-bibtex","bin","application/octet-stream","bmp","image/x-ms-bmp","book","application/x-maker","bsd","chemical/x-crossfire","c","text/x-csrc","c++","text/x-c++src","c3d","chemical/x-chem3d","cac","chemical/x-cache","cache","chemical/x-cache","cascii","chemical/x-cactvs-binary","cat","application/vnd.ms-pki.seccat","cbin","chemical/x-cactvs-binary","cc","text/x-c++src","cdf","application/x-cdf","cdr","image/x-coreldraw","cdt","image/x-coreldrawtemplate","cdx","chemical/x-cdx","cdy","application/vnd.cinderella","cef","chemical/x-cxf","cer","chemical/x-cerius","chm","chemical/x-chemdraw","chrt","application/x-kchart","cif","chemical/x-cif","class","application/java-vm","cls","text/x-tex","cmdf","chemical/x-cmdf","cml","chemical/x-cml","cod","application/vnd.rim.cod","com","application/x-msdos-program","cpa","chemical/x-compass","cpio","application/x-cpio","cpp","text/x-c++src","cpt","image/x-corelphotopaint","crl","application/x-pkcs7-crl","crt","application/x-x509-ca-cert","csf","chemical/x-cache-csf","csh","text/x-csh","csm","chemical/x-csml","csml","chemical/x-csml","css","text/css","csv","text/comma-separated-values","ctab","chemical/x-cactvs-binary","ctx","chemical/x-ctx","cu","application/cu-seeme","cub","chemical/x-gaussian-cube","cxf","chemical/x-cxf","cxx","text/x-c++src","dat","chemical/x-mopac-input","dcr","application/x-director","deb","application/x-debian-package","dif","video/dv","diff","text/plain","dir","application/x-director","djv","image/vnd.djvu","djvu","image/vnd.djvu","dl","video/dl","dll","application/x-msdos-program","dmg","application/x-apple-diskimage","dms","application/x-dms","doc","application/msword","dot","application/msword","dv","video/dv","dvi","application/x-dvi","dx","chemical/x-jcamp-dx","dxr","application/x-director","emb","chemical/x-embl-dl-nucleotide","embl","chemical/x-embl-dl-nucleotide","ent","chemical/x-pdb","eps","application/postscript","etx","text/x-setext","exe","application/x-msdos-program","ez","application/andrew-inset","fb","application/x-maker","fbdoc","application/x-maker","fch","chemical/x-gaussian-checkpoint","fchk","chemical/x-gaussian-checkpoint","fig","application/x-xfig","flac","application/x-flac","fli","video/fli","fm","application/x-maker","frame","application/x-maker","frm","application/x-maker","gal","chemical/x-gaussian-log","gam","chemical/x-gamess-input","gamin","chemical/x-gamess-input","gau","chemical/x-gaussian-input","gcd","text/x-pcs-gcd","gcf","application/x-graphing-calculator","gcg","chemical/x-gcg8-sequence","gen","chemical/x-genbank","gf","application/x-tex-gf","gif","image/gif","gjc","chemical/x-gaussian-input","gjf","chemical/x-gaussian-input","gl","video/gl","gnumeric","application/x-gnumeric","gpt","chemical/x-mopac-graph","gsf","application/x-font","gsm","audio/x-gsm","gtar","application/x-gtar","h","text/x-chdr","h++","text/x-c++hdr","hdf","application/x-hdf","hh","text/x-c++hdr","hin","chemical/x-hin","hpp","text/x-c++hdr","hqx","application/mac-binhex40","hs","text/x-haskell","hta","application/hta","htc","text/x-component","htm","text/html","html","text/html","hxx","text/x-c++hdr","ica","application/x-ica","ice","x-conference/x-cooltalk","ico","image/x-icon","ics","text/calendar","icz","text/calendar","ief","image/ief","iges","model/iges","igs","model/iges","iii","application/x-iphone","inp","chemical/x-gamess-input","ins","application/x-internet-signup","iso","application/x-iso9660-image","isp","application/x-internet-signup","ist","chemical/x-isostar","istr","chemical/x-isostar","jad","text/vnd.sun.j2me.app-descriptor","jar","application/java-archive","java","text/x-java","jdx","chemical/x-jcamp-dx","jmz","application/x-jmol","jng","image/x-jng","jnlp","application/x-java-jnlp-file","jpe","image/jpeg","jpeg","image/jpeg","jpg","image/jpeg","js","application/javascript","kar","audio/midi","key","application/pgp-keys","kil","application/x-killustrator","kin","chemical/x-kinemage","kpr","application/x-kpresenter","kpt","application/x-kpresenter","ksp","application/x-kspread","kwd","application/x-kword","kwt","application/x-kword","latex","application/x-latex","lha","application/x-lha","lhs","text/x-literate-haskell","lsf","video/x-la-asf","lsx","video/x-la-asf","ltx","text/x-tex","lzh","application/x-lzh","lzx","application/x-lzx","m3u","audio/x-mpegurl","m4a","audio/mpeg","maker","application/x-maker","man","application/x-troff-man","mcif","chemical/x-mmcif","mcm","chemical/x-macmolecule","mdb","application/msaccess","me","application/x-troff-me","mesh","model/mesh","mid","audio/midi","midi","audio/midi","mif","application/x-mif","mm","application/x-freemind","mmd","chemical/x-macromodel-input","mmf","application/vnd.smaf","mml","text/mathml","mmod","chemical/x-macromodel-input","mng","video/x-mng","moc","text/x-moc","mol","chemical/x-mdl-molfile","mol2","chemical/x-mol2","moo","chemical/x-mopac-out","mop","chemical/x-mopac-input","mopcrt","chemical/x-mopac-input","mov","video/quicktime","movie","video/x-sgi-movie","mp2","audio/mpeg","mp3","audio/mpeg","mp4","video/mp4","mpc","chemical/x-mopac-input","mpe","video/mpeg","mpeg","video/mpeg","mpega","audio/mpeg","mpg","video/mpeg","mpga","audio/mpeg","ms","application/x-troff-ms","msh","model/mesh","msi","application/x-msi","mvb","chemical/x-mopac-vib","mxu","video/vnd.mpegurl","nb","application/mathematica","nc","application/x-netcdf","nwc","application/x-nwc","o","application/x-object","oda","application/oda","odb","application/vnd.oasis.opendocument.database","odc","application/vnd.oasis.opendocument.chart","odf","application/vnd.oasis.opendocument.formula","odg","application/vnd.oasis.opendocument.graphics","odi","application/vnd.oasis.opendocument.image","odm","application/vnd.oasis.opendocument.text-master","odp","application/vnd.oasis.opendocument.presentation","ods","application/vnd.oasis.opendocument.spreadsheet","odt","application/vnd.oasis.opendocument.text","ogg","application/ogg","old","application/x-trash","oth","application/vnd.oasis.opendocument.text-web","oza","application/x-oz-application","p","text/x-pascal","p7r","application/x-pkcs7-certreqresp","pac","application/x-ns-proxy-autoconfig","pas","text/x-pascal","pat","image/x-coreldrawpattern","pbm","image/x-portable-bitmap","pcf","application/x-font","pcf.Z","application/x-font","pcx","image/pcx","pdb","chemical/x-pdb","pdf","application/pdf","pfa","application/x-font","pfb","application/x-font","pgm","image/x-portable-graymap","pgn","application/x-chess-pgn","pgp","application/pgp-signature","pk","application/x-tex-pk","pl","text/x-perl","pls","audio/x-scpls","pm","text/x-perl","png","image/png","pnm","image/x-portable-anymap","pot","text/plain","ppm","image/x-portable-pixmap","pps","application/vnd.ms-powerpoint","ppt","application/vnd.ms-powerpoint","prf","application/pics-rules","prt","chemical/x-ncbi-asn1-ascii","ps","application/postscript","psd","image/x-photoshop","psp","text/x-psp","py","text/x-python","pyc","application/x-python-code","pyo","application/x-python-code","qt","video/quicktime","qtl","application/x-quicktimeplayer","ra","audio/x-realaudio","ram","audio/x-pn-realaudio","rar","application/rar","ras","image/x-cmu-raster","rd","chemical/x-mdl-rdfile","rdf","application/rdf+xml","rgb","image/x-rgb","rm","audio/x-pn-realaudio","roff","application/x-troff","ros","chemical/x-rosdal","rpm","application/x-redhat-package-manager","rss","application/rss+xml","rtf","text/rtf","rtx","text/richtext","rxn","chemical/x-mdl-rxnfile","sct","text/scriptlet","sd","chemical/x-mdl-sdfile","sd2","audio/x-sd2","sda","application/vnd.stardivision.draw","sdc","application/vnd.stardivision.calc","sdd","application/vnd.stardivision.impress","sdf","chemical/x-mdl-sdfile","sdp","application/vnd.stardivision.impress","sdw","application/vnd.stardivision.writer","ser","application/java-serialized-object","sgf","application/x-go-sgf","sgl","application/vnd.stardivision.writer-global","sh","text/x-sh","shar","application/x-shar","shtml","text/html","sid","audio/prs.sid","sik","application/x-trash","silo","model/mesh","sis","application/vnd.symbian.install","sit","application/x-stuffit","skd","application/x-koan","skm","application/x-koan","skp","application/x-koan","skt","application/x-koan","smf","application/vnd.stardivision.math","smi","application/smil","smil","application/smil","snd","audio/basic","spc","chemical/x-galactic-spc","spl","application/x-futuresplash","src","application/x-wais-source","stc","application/vnd.sun.xml.calc.template","std","application/vnd.sun.xml.draw.template","sti","application/vnd.sun.xml.impress.template","stl","application/vnd.ms-pki.stl","stw","application/vnd.sun.xml.writer.template","sty","text/x-tex","sv4cpio","application/x-sv4cpio","sv4crc","application/x-sv4crc","svg","image/svg+xml","svgz","image/svg+xml","sw","chemical/x-swissprot","swf","application/x-shockwave-flash","swfl","application/x-shockwave-flash","sxc","application/vnd.sun.xml.calc","sxd","application/vnd.sun.xml.draw","sxg","application/vnd.sun.xml.writer.global","sxi","application/vnd.sun.xml.impress","sxm","application/vnd.sun.xml.math","sxw","application/vnd.sun.xml.writer","t","application/x-troff","tar","application/x-tar","taz","application/x-gtar","tcl","text/x-tcl","tex","text/x-tex","texi","application/x-texinfo","texinfo","application/x-texinfo","text","text/plain","tgf","chemical/x-mdl-tgf","tgz","application/x-gtar","tif","image/tiff","tiff","image/tiff","tk","text/x-tcl","tm","text/texmacs","torrent","application/x-bittorrent","tr","application/x-troff","ts","text/texmacs","tsp","application/dsptype","tsv","text/tab-separated-values","txt","text/plain","udeb","application/x-debian-package","uls","text/iuls","ustar","application/x-ustar","val","chemical/x-ncbi-asn1-binary","vcd","application/x-cdlink","vcf","text/x-vcard","vcs","text/x-vcalendar","vmd","chemical/x-vmd","vms","chemical/x-vamas-iso14976","vor","application/vnd.stardivision.writer","vrm","x-world/x-vrml","vrml","x-world/x-vrml","vsd","application/vnd.visio","wad","application/x-doom","wav","audio/x-wav","wax","audio/x-ms-wax","wbmp","image/vnd.wap.wbmp","wbxml","application/vnd.wap.wbxml","wk","application/x-123","wm","video/x-ms-wm","wma","audio/x-ms-wma","wmd","application/x-ms-wmd","wml","text/vnd.wap.wml","wmlc","application/vnd.wap.wmlc","wmls","text/vnd.wap.wmlscript","wmlsc","application/vnd.wap.wmlscriptc","wmv","video/x-ms-wmv","wmx","video/x-ms-wmx","wmz","application/x-ms-wmz","wp5","application/wordperfect5.1","wpd","application/wordperfect","wrl","x-world/x-vrml","wsc","text/scriptlet","wvx","video/x-ms-wvx","wz","application/x-wingz","xbm","image/x-xbitmap","xcf","application/x-xcf","xht","application/xhtml+xml","xhtml","application/xhtml+xml","xlb","application/vnd.ms-excel","xls","application/vnd.ms-excel","xlt","application/vnd.ms-excel","xml","application/xml","xpi","application/x-xpinstall","xpm","image/x-xpixmap","xsl","application/xml","xtel","chemical/x-xtel","xul","application/vnd.mozilla.xul+xml","xwd","image/x-xwindowdump","xyz","chemical/x-xyz","zip","application/zip","zmt","chemical/x-mopac-input","~","application/x-trash"]);
  58439. },
  58440. args: [],
  58441. 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}",
  58442. referencedClasses: [],
  58443. messageSends: []
  58444. }),
  58445. $globals.FileServer.klass);
  58446. $core.addMethod(
  58447. $core.method({
  58448. selector: "defaultPort",
  58449. protocol: 'accessing',
  58450. fn: function (){
  58451. var self=this;
  58452. return (4000);
  58453. },
  58454. args: [],
  58455. source: "defaultPort\x0a\x09^ 4000",
  58456. referencedClasses: [],
  58457. messageSends: []
  58458. }),
  58459. $globals.FileServer.klass);
  58460. $core.addMethod(
  58461. $core.method({
  58462. selector: "main",
  58463. protocol: 'initialization',
  58464. fn: function (){
  58465. var self=this;
  58466. var fileServer,args;
  58467. function $FileServer(){return $globals.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  58468. return $core.withContext(function($ctx1) {
  58469. var $1;
  58470. var $early={};
  58471. try {
  58472. args=$recv(process)._argv();
  58473. $recv(args)._removeFrom_to_((1),(3));
  58474. $recv(args)._detect_ifNone_((function(each){
  58475. return $core.withContext(function($ctx2) {
  58476. $1=$recv(each).__eq("--help");
  58477. if($core.assert($1)){
  58478. return $recv($FileServer())._printHelp();
  58479. };
  58480. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58481. }),(function(){
  58482. return $core.withContext(function($ctx2) {
  58483. fileServer=$recv($FileServer())._createServerWithArguments_(args);
  58484. fileServer;
  58485. throw $early=[$recv(fileServer)._start()];
  58486. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58487. }));
  58488. return self;
  58489. }
  58490. catch(e) {if(e===$early)return e[0]; throw e}
  58491. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.klass)});
  58492. },
  58493. args: [],
  58494. 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]",
  58495. referencedClasses: ["FileServer"],
  58496. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  58497. }),
  58498. $globals.FileServer.klass);
  58499. $core.addMethod(
  58500. $core.method({
  58501. selector: "mimeTypeFor:",
  58502. protocol: 'accessing',
  58503. fn: function (aString){
  58504. var self=this;
  58505. return $core.withContext(function($ctx1) {
  58506. return $recv(self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  58507. return "text/plain";
  58508. }));
  58509. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.klass)});
  58510. },
  58511. args: ["aString"],
  58512. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  58513. referencedClasses: [],
  58514. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  58515. }),
  58516. $globals.FileServer.klass);
  58517. $core.addMethod(
  58518. $core.method({
  58519. selector: "mimeTypes",
  58520. protocol: 'accessing',
  58521. fn: function (){
  58522. var self=this;
  58523. return $core.withContext(function($ctx1) {
  58524. var $1,$receiver;
  58525. $1=self["@mimeTypes"];
  58526. if(($receiver = $1) == null || $receiver.isNil){
  58527. self["@mimeTypes"]=self._defaultMimeTypes();
  58528. return self["@mimeTypes"];
  58529. } else {
  58530. return $1;
  58531. };
  58532. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.klass)});
  58533. },
  58534. args: [],
  58535. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  58536. referencedClasses: [],
  58537. messageSends: ["ifNil:", "defaultMimeTypes"]
  58538. }),
  58539. $globals.FileServer.klass);
  58540. $core.addMethod(
  58541. $core.method({
  58542. selector: "printHelp",
  58543. protocol: 'accessing',
  58544. fn: function (){
  58545. var self=this;
  58546. return $core.withContext(function($ctx1) {
  58547. $recv(console)._log_("Available commandline options are:");
  58548. $ctx1.sendIdx["log:"]=1;
  58549. $recv(console)._log_("--help");
  58550. $ctx1.sendIdx["log:"]=2;
  58551. $recv(self._commandLineSwitches())._do_((function(each){
  58552. return $core.withContext(function($ctx2) {
  58553. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  58554. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58555. }));
  58556. return self;
  58557. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.klass)});
  58558. },
  58559. args: [],
  58560. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  58561. referencedClasses: [],
  58562. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  58563. }),
  58564. $globals.FileServer.klass);
  58565. $core.addMethod(
  58566. $core.method({
  58567. selector: "selectorForCommandLineSwitch:",
  58568. protocol: 'accessing',
  58569. fn: function (aSwitch){
  58570. var self=this;
  58571. return $core.withContext(function($ctx1) {
  58572. var $1;
  58573. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  58574. return $core.withContext(function($ctx2) {
  58575. return $recv($recv(each)._second())._asUppercase();
  58576. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58577. }));
  58578. $ctx1.sendIdx["replace:with:"]=1;
  58579. return $recv($1).__comma(":");
  58580. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.klass)});
  58581. },
  58582. args: ["aSwitch"],
  58583. 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 ]), ':'",
  58584. referencedClasses: [],
  58585. messageSends: [",", "replace:with:", "asUppercase", "second"]
  58586. }),
  58587. $globals.FileServer.klass);
  58588. $core.addClass('Initer', $globals.BaseFileManipulator, ['childProcess', 'nmPath'], 'AmberCli');
  58589. $core.addMethod(
  58590. $core.method({
  58591. selector: "bowerInstallThenDo:",
  58592. protocol: 'action',
  58593. fn: function (aBlock){
  58594. var self=this;
  58595. var child;
  58596. return $core.withContext(function($ctx1) {
  58597. var $1,$3,$2;
  58598. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("bower","bower"),["install"]);
  58599. $1=child;
  58600. $recv($1)._on_do_("error",aBlock);
  58601. $ctx1.sendIdx["on:do:"]=1;
  58602. $recv($1)._on_do_("close",(function(code){
  58603. return $core.withContext(function($ctx2) {
  58604. $3=$recv(code).__eq((0));
  58605. if($core.assert($3)){
  58606. $2=nil;
  58607. } else {
  58608. $2=code;
  58609. };
  58610. return $recv(aBlock)._value_($2);
  58611. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  58612. }));
  58613. return self;
  58614. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  58615. },
  58616. args: ["aBlock"],
  58617. 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 ]) ]",
  58618. referencedClasses: [],
  58619. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  58620. }),
  58621. $globals.Initer);
  58622. $core.addMethod(
  58623. $core.method({
  58624. selector: "finishMessage",
  58625. protocol: 'action',
  58626. fn: function (){
  58627. var self=this;
  58628. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  58629. return $core.withContext(function($ctx1) {
  58630. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($String())._lf()));
  58631. $recv((function(){
  58632. }))._valueWithTimeout_((600));
  58633. return self;
  58634. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  58635. },
  58636. args: [],
  58637. source: "finishMessage\x0a\x09console log: (#(\x0a\x09\x09' '\x0a\x09\x09'The project should now be set up.'\x0a\x09\x09' '\x0a\x09\x09' '\x0a\x09) join: String lf).\x0a\x09[] valueWithTimeout: 600",
  58638. referencedClasses: ["String"],
  58639. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  58640. }),
  58641. $globals.Initer);
  58642. $core.addMethod(
  58643. $core.method({
  58644. selector: "gruntInitThenDo:",
  58645. protocol: 'action',
  58646. fn: function (aBlock){
  58647. var self=this;
  58648. var child,sanitizedTemplatePath;
  58649. return $core.withContext(function($ctx1) {
  58650. var $1,$3,$2;
  58651. sanitizedTemplatePath=$recv($recv($recv(self["@path"])._join_with_(self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  58652. $ctx1.sendIdx["replace:with:"]=1;
  58653. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  58654. $1=child;
  58655. $recv($1)._on_do_("error",aBlock);
  58656. $ctx1.sendIdx["on:do:"]=1;
  58657. $recv($1)._on_do_("close",(function(code){
  58658. return $core.withContext(function($ctx2) {
  58659. $3=$recv(code).__eq((0));
  58660. if($core.assert($3)){
  58661. $2=nil;
  58662. } else {
  58663. $2=code;
  58664. };
  58665. return $recv(aBlock)._value_($2);
  58666. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  58667. }));
  58668. return self;
  58669. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  58670. },
  58671. args: ["aBlock"],
  58672. 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 ]) ]",
  58673. referencedClasses: [],
  58674. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  58675. }),
  58676. $globals.Initer);
  58677. $core.addMethod(
  58678. $core.method({
  58679. selector: "gruntThenDo:",
  58680. protocol: 'action',
  58681. fn: function (aBlock){
  58682. var self=this;
  58683. var child;
  58684. return $core.withContext(function($ctx1) {
  58685. var $1,$3,$2;
  58686. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
  58687. $1=child;
  58688. $recv($1)._on_do_("error",aBlock);
  58689. $ctx1.sendIdx["on:do:"]=1;
  58690. $recv($1)._on_do_("close",(function(code){
  58691. return $core.withContext(function($ctx2) {
  58692. $3=$recv(code).__eq((0));
  58693. if($core.assert($3)){
  58694. $2=nil;
  58695. } else {
  58696. $2=code;
  58697. };
  58698. return $recv(aBlock)._value_($2);
  58699. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  58700. }));
  58701. return self;
  58702. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  58703. },
  58704. args: ["aBlock"],
  58705. 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 ]) ]",
  58706. referencedClasses: [],
  58707. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  58708. }),
  58709. $globals.Initer);
  58710. $core.addMethod(
  58711. $core.method({
  58712. selector: "initialize",
  58713. protocol: 'initialization',
  58714. fn: function (){
  58715. var self=this;
  58716. return $core.withContext(function($ctx1) {
  58717. (
  58718. $ctx1.supercall = true,
  58719. ($globals.Initer.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  58720. $ctx1.supercall = false;
  58721. self["@childProcess"]=$recv(require)._value_("child_process");
  58722. self["@nmPath"]=$recv(self["@path"])._join_with_(self._rootDirname(),"node_modules");
  58723. return self;
  58724. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  58725. },
  58726. args: [],
  58727. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  58728. referencedClasses: [],
  58729. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  58730. }),
  58731. $globals.Initer);
  58732. $core.addMethod(
  58733. $core.method({
  58734. selector: "npmInstallThenDo:",
  58735. protocol: 'action',
  58736. fn: function (aBlock){
  58737. var self=this;
  58738. var child;
  58739. return $core.withContext(function($ctx1) {
  58740. var $1;
  58741. child=$recv(self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  58742. $1=$recv(child)._stdout();
  58743. $ctx1.sendIdx["stdout"]=1;
  58744. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  58745. return self;
  58746. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  58747. },
  58748. args: ["aBlock"],
  58749. 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 }",
  58750. referencedClasses: [],
  58751. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  58752. }),
  58753. $globals.Initer);
  58754. $core.addMethod(
  58755. $core.method({
  58756. selector: "npmScriptForModule:named:",
  58757. protocol: 'npm',
  58758. fn: function (aString,anotherString){
  58759. var self=this;
  58760. var modulePath,packageJson,binSection,scriptPath;
  58761. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  58762. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  58763. return $core.withContext(function($ctx1) {
  58764. var $1,$3,$4,$2,$5;
  58765. $1=self["@path"];
  58766. $3=$recv($JSObjectProxy())._on_(require);
  58767. $4=$recv(aString).__comma("/package.json");
  58768. $ctx1.sendIdx[","]=1;
  58769. $2=$recv($3)._resolve_($4);
  58770. modulePath=$recv($1)._dirname_($2);
  58771. packageJson=$recv($Smalltalk())._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  58772. binSection=$recv(packageJson)._at_("bin");
  58773. $ctx1.sendIdx["at:"]=1;
  58774. $5=$recv(binSection)._isString();
  58775. if($core.assert($5)){
  58776. scriptPath=binSection;
  58777. } else {
  58778. scriptPath=$recv(binSection)._at_(anotherString);
  58779. };
  58780. return $recv(self["@path"])._join_with_(modulePath,scriptPath);
  58781. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  58782. },
  58783. args: ["aString", "anotherString"],
  58784. 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",
  58785. referencedClasses: ["JSObjectProxy", "Smalltalk"],
  58786. messageSends: ["dirname:", "resolve:", "on:", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  58787. }),
  58788. $globals.Initer);
  58789. $core.addMethod(
  58790. $core.method({
  58791. selector: "start",
  58792. protocol: 'action',
  58793. fn: function (){
  58794. var self=this;
  58795. return $core.withContext(function($ctx1) {
  58796. var $1,$2,$3,$4,$5,$6,$7,$receiver;
  58797. self._gruntInitThenDo_((function(error){
  58798. return $core.withContext(function($ctx2) {
  58799. if(($receiver = error) == null || $receiver.isNil){
  58800. return self._bowerInstallThenDo_((function(error2){
  58801. return $core.withContext(function($ctx3) {
  58802. if(($receiver = error2) == null || $receiver.isNil){
  58803. return self._npmInstallThenDo_((function(error3){
  58804. return $core.withContext(function($ctx4) {
  58805. if(($receiver = error3) == null || $receiver.isNil){
  58806. return self._gruntThenDo_((function(error4){
  58807. return $core.withContext(function($ctx5) {
  58808. if(($receiver = error4) == null || $receiver.isNil){
  58809. self._finishMessage();
  58810. return $recv(process)._exit();
  58811. } else {
  58812. $7=console;
  58813. $recv($7)._log_("grunt exec error:");
  58814. $ctx5.sendIdx["log:"]=7;
  58815. $recv($7)._log_(error4);
  58816. return $recv(process)._exit_((104));
  58817. };
  58818. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  58819. }));
  58820. } else {
  58821. $5=console;
  58822. $recv($5)._log_("npm install exec error:");
  58823. $ctx4.sendIdx["log:"]=5;
  58824. $6=$recv($5)._log_(error3);
  58825. $ctx4.sendIdx["log:"]=6;
  58826. $6;
  58827. return $recv(process)._exit_((103));
  58828. $ctx4.sendIdx["exit:"]=3;
  58829. };
  58830. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  58831. }));
  58832. } else {
  58833. $3=console;
  58834. $recv($3)._log_("bower install exec error:");
  58835. $ctx3.sendIdx["log:"]=3;
  58836. $4=$recv($3)._log_(error2);
  58837. $ctx3.sendIdx["log:"]=4;
  58838. $4;
  58839. return $recv(process)._exit_((102));
  58840. $ctx3.sendIdx["exit:"]=2;
  58841. };
  58842. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  58843. }));
  58844. } else {
  58845. $1=console;
  58846. $recv($1)._log_("grunt-init exec error:");
  58847. $ctx2.sendIdx["log:"]=1;
  58848. $2=$recv($1)._log_(error);
  58849. $ctx2.sendIdx["log:"]=2;
  58850. $2;
  58851. return $recv(process)._exit_((101));
  58852. $ctx2.sendIdx["exit:"]=1;
  58853. };
  58854. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  58855. }));
  58856. return self;
  58857. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  58858. },
  58859. args: [],
  58860. 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 ]]]]]]]]",
  58861. referencedClasses: [],
  58862. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
  58863. }),
  58864. $globals.Initer);
  58865. $core.addClass('Repl', $globals.Object, ['readline', 'interface', 'util', 'session', 'resultCount', 'commands'], 'AmberCli');
  58866. $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.";
  58867. $core.addMethod(
  58868. $core.method({
  58869. selector: "addVariableNamed:to:",
  58870. protocol: 'private',
  58871. fn: function (aString,anObject){
  58872. var self=this;
  58873. var newClass,newObject;
  58874. return $core.withContext(function($ctx1) {
  58875. newClass=self._subclass_withVariable_($recv(anObject)._class(),aString);
  58876. self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  58877. newObject=$recv(newClass)._new();
  58878. self._setPreviousVariablesFor_from_(newObject,anObject);
  58879. return newObject;
  58880. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  58881. },
  58882. args: ["aString", "anObject"],
  58883. 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",
  58884. referencedClasses: [],
  58885. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  58886. }),
  58887. $globals.Repl);
  58888. $core.addMethod(
  58889. $core.method({
  58890. selector: "assignNewVariable:do:",
  58891. protocol: 'private',
  58892. fn: function (buffer,aBlock){
  58893. var self=this;
  58894. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  58895. function $ConsoleErrorHandler(){return $globals.ConsoleErrorHandler||(typeof ConsoleErrorHandler=="undefined"?nil:ConsoleErrorHandler)}
  58896. return $core.withContext(function($ctx1) {
  58897. var $2,$3,$1,$receiver;
  58898. return self._parseAssignment_do_(buffer,(function(name,expr){
  58899. var varName,value;
  58900. return $core.withContext(function($ctx2) {
  58901. if(($receiver = name) == null || $receiver.isNil){
  58902. varName=self._nextResultName();
  58903. } else {
  58904. varName=name;
  58905. };
  58906. varName;
  58907. self["@session"]=self._addVariableNamed_to_(varName,self["@session"]);
  58908. self["@session"];
  58909. $recv((function(){
  58910. return $core.withContext(function($ctx3) {
  58911. $2=$recv(varName).__comma(" := ");
  58912. if(($receiver = expr) == null || $receiver.isNil){
  58913. $3=buffer;
  58914. } else {
  58915. $3=expr;
  58916. };
  58917. $1=$recv($2).__comma($3);
  58918. $ctx3.sendIdx[","]=1;
  58919. value=self._eval_on_($1,self["@session"]);
  58920. return value;
  58921. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  58922. }))._on_do_($Error(),(function(e){
  58923. return $core.withContext(function($ctx3) {
  58924. $recv($recv($ConsoleErrorHandler())._new())._logError_(e);
  58925. value=nil;
  58926. return value;
  58927. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  58928. }));
  58929. return $recv(aBlock)._value_value_(varName,value);
  58930. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  58931. }));
  58932. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  58933. },
  58934. args: ["buffer", "aBlock"],
  58935. 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]",
  58936. referencedClasses: ["Error", "ConsoleErrorHandler"],
  58937. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  58938. }),
  58939. $globals.Repl);
  58940. $core.addMethod(
  58941. $core.method({
  58942. selector: "clearScreen",
  58943. protocol: 'actions',
  58944. fn: function (){
  58945. var self=this;
  58946. var esc,cls;
  58947. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  58948. return $core.withContext(function($ctx1) {
  58949. var $1;
  58950. esc=$recv($String())._fromCharCode_((27));
  58951. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  58952. $ctx1.sendIdx[","]=2;
  58953. cls=$recv($1).__comma("[0;0f");
  58954. $ctx1.sendIdx[","]=1;
  58955. $recv($recv(process)._stdout())._write_(cls);
  58956. $recv(self["@interface"])._prompt();
  58957. return self;
  58958. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  58959. },
  58960. args: [],
  58961. 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",
  58962. referencedClasses: ["String"],
  58963. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  58964. }),
  58965. $globals.Repl);
  58966. $core.addMethod(
  58967. $core.method({
  58968. selector: "close",
  58969. protocol: 'actions',
  58970. fn: function (){
  58971. var self=this;
  58972. return $core.withContext(function($ctx1) {
  58973. $recv($recv(process)._stdin())._destroy();
  58974. return self;
  58975. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  58976. },
  58977. args: [],
  58978. source: "close\x0a\x09process stdin destroy",
  58979. referencedClasses: [],
  58980. messageSends: ["destroy", "stdin"]
  58981. }),
  58982. $globals.Repl);
  58983. $core.addMethod(
  58984. $core.method({
  58985. selector: "commands",
  58986. protocol: 'accessing',
  58987. fn: function (){
  58988. var self=this;
  58989. return self["@commands"];
  58990. },
  58991. args: [],
  58992. source: "commands\x0a\x09^ commands",
  58993. referencedClasses: [],
  58994. messageSends: []
  58995. }),
  58996. $globals.Repl);
  58997. $core.addMethod(
  58998. $core.method({
  58999. selector: "createInterface",
  59000. protocol: 'actions',
  59001. fn: function (){
  59002. var self=this;
  59003. return $core.withContext(function($ctx1) {
  59004. self["@interface"]=$recv(self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  59005. $recv(self["@interface"])._on_do_("line",(function(buffer){
  59006. return $core.withContext(function($ctx2) {
  59007. return self._processLine_(buffer);
  59008. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  59009. }));
  59010. $ctx1.sendIdx["on:do:"]=1;
  59011. $recv(self["@interface"])._on_do_("close",(function(){
  59012. return $core.withContext(function($ctx2) {
  59013. return self._close();
  59014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59015. }));
  59016. self._printWelcome();
  59017. self._setupHotkeys();
  59018. self._setPrompt();
  59019. $recv(self["@interface"])._prompt();
  59020. return self;
  59021. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  59022. },
  59023. args: [],
  59024. 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",
  59025. referencedClasses: [],
  59026. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  59027. }),
  59028. $globals.Repl);
  59029. $core.addMethod(
  59030. $core.method({
  59031. selector: "encapsulateVariable:withValue:in:",
  59032. protocol: 'private',
  59033. fn: function (aString,anObject,aClass){
  59034. var self=this;
  59035. var compiler;
  59036. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  59037. return $core.withContext(function($ctx1) {
  59038. var $1,$4,$3,$2,$5,$6;
  59039. compiler=$recv($Compiler())._new();
  59040. $1=compiler;
  59041. $4=$recv(aString).__comma(": anObject ^ ");
  59042. $ctx1.sendIdx[","]=3;
  59043. $3=$recv($4).__comma(aString);
  59044. $ctx1.sendIdx[","]=2;
  59045. $2=$recv($3).__comma(" := anObject");
  59046. $ctx1.sendIdx[","]=1;
  59047. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  59048. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  59049. $5=compiler;
  59050. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  59051. $ctx1.sendIdx[","]=4;
  59052. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  59053. return self;
  59054. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  59055. },
  59056. args: ["aString", "anObject", "aClass"],
  59057. 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'.",
  59058. referencedClasses: ["Compiler"],
  59059. messageSends: ["new", "install:forClass:protocol:", ","]
  59060. }),
  59061. $globals.Repl);
  59062. $core.addMethod(
  59063. $core.method({
  59064. selector: "eval:",
  59065. protocol: 'actions',
  59066. fn: function (buffer){
  59067. var self=this;
  59068. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  59069. return $core.withContext(function($ctx1) {
  59070. return self._eval_on_(buffer,$recv($DoIt())._new());
  59071. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  59072. },
  59073. args: ["buffer"],
  59074. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  59075. referencedClasses: ["DoIt"],
  59076. messageSends: ["eval:on:", "new"]
  59077. }),
  59078. $globals.Repl);
  59079. $core.addMethod(
  59080. $core.method({
  59081. selector: "eval:on:",
  59082. protocol: 'actions',
  59083. fn: function (buffer,anObject){
  59084. var self=this;
  59085. var result;
  59086. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  59087. return $core.withContext(function($ctx1) {
  59088. var $1,$2;
  59089. $1=$recv(buffer)._isEmpty();
  59090. if(!$core.assert($1)){
  59091. $recv((function(){
  59092. return $core.withContext(function($ctx2) {
  59093. result=$recv($recv($Compiler())._new())._evaluateExpression_on_(buffer,anObject);
  59094. return result;
  59095. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59096. }))._tryCatch_((function(e){
  59097. return $core.withContext(function($ctx2) {
  59098. $2=$recv(e)._isSmalltalkError();
  59099. if($core.assert($2)){
  59100. return $recv(e)._resignal();
  59101. } else {
  59102. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  59103. };
  59104. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,3)});
  59105. }));
  59106. };
  59107. return result;
  59108. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  59109. },
  59110. args: ["buffer", "anObject"],
  59111. 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",
  59112. referencedClasses: ["Compiler"],
  59113. messageSends: ["ifFalse:", "isEmpty", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"]
  59114. }),
  59115. $globals.Repl);
  59116. $core.addMethod(
  59117. $core.method({
  59118. selector: "executeCommand:",
  59119. protocol: 'private',
  59120. fn: function (aString){
  59121. var self=this;
  59122. return $core.withContext(function($ctx1) {
  59123. var $1;
  59124. var $early={};
  59125. try {
  59126. $recv(self._commands())._keysAndValuesDo_((function(names,cmd){
  59127. return $core.withContext(function($ctx2) {
  59128. $1=$recv(names)._includes_(aString);
  59129. if($core.assert($1)){
  59130. $recv(cmd)._value();
  59131. throw $early=[true];
  59132. };
  59133. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  59134. }));
  59135. return false;
  59136. }
  59137. catch(e) {if(e===$early)return e[0]; throw e}
  59138. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  59139. },
  59140. args: ["aString"],
  59141. 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",
  59142. referencedClasses: [],
  59143. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  59144. }),
  59145. $globals.Repl);
  59146. $core.addMethod(
  59147. $core.method({
  59148. selector: "initialize",
  59149. protocol: 'initialization',
  59150. fn: function (){
  59151. var self=this;
  59152. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  59153. return $core.withContext(function($ctx1) {
  59154. (
  59155. $ctx1.supercall = true,
  59156. ($globals.Repl.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  59157. $ctx1.supercall = false;
  59158. self["@session"]=$recv($DoIt())._new();
  59159. self["@readline"]=$recv(require)._value_("readline");
  59160. $ctx1.sendIdx["value:"]=1;
  59161. self["@util"]=$recv(require)._value_("util");
  59162. self._setupCommands();
  59163. return self;
  59164. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  59165. },
  59166. args: [],
  59167. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  59168. referencedClasses: ["DoIt"],
  59169. messageSends: ["initialize", "new", "value:", "setupCommands"]
  59170. }),
  59171. $globals.Repl);
  59172. $core.addMethod(
  59173. $core.method({
  59174. selector: "instanceVariableNamesFor:",
  59175. protocol: 'private',
  59176. fn: function (aClass){
  59177. var self=this;
  59178. return $core.withContext(function($ctx1) {
  59179. var $1,$2,$receiver;
  59180. $1=$recv(aClass)._superclass();
  59181. $ctx1.sendIdx["superclass"]=1;
  59182. if(($receiver = $1) == null || $receiver.isNil){
  59183. return $recv(aClass)._instanceVariableNames();
  59184. } else {
  59185. $2=$recv(aClass)._instanceVariableNames();
  59186. $ctx1.sendIdx["instanceVariableNames"]=1;
  59187. return $recv($2)._copyWithAll_(self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  59188. };
  59189. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  59190. },
  59191. args: ["aClass"],
  59192. 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]",
  59193. referencedClasses: [],
  59194. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  59195. }),
  59196. $globals.Repl);
  59197. $core.addMethod(
  59198. $core.method({
  59199. selector: "isIdentifier:",
  59200. protocol: 'private',
  59201. fn: function (aString){
  59202. var self=this;
  59203. return $core.withContext(function($ctx1) {
  59204. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  59205. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  59206. },
  59207. args: ["aString"],
  59208. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  59209. referencedClasses: [],
  59210. messageSends: ["match:", "asRegexp"]
  59211. }),
  59212. $globals.Repl);
  59213. $core.addMethod(
  59214. $core.method({
  59215. selector: "isVariableDefined:",
  59216. protocol: 'private',
  59217. fn: function (aString){
  59218. var self=this;
  59219. return $core.withContext(function($ctx1) {
  59220. return $recv(self._instanceVariableNamesFor_($recv(self["@session"])._class()))._includes_(aString);
  59221. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  59222. },
  59223. args: ["aString"],
  59224. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  59225. referencedClasses: [],
  59226. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  59227. }),
  59228. $globals.Repl);
  59229. $core.addMethod(
  59230. $core.method({
  59231. selector: "nextResultName",
  59232. protocol: 'private',
  59233. fn: function (){
  59234. var self=this;
  59235. return $core.withContext(function($ctx1) {
  59236. var $1,$receiver;
  59237. $1=self["@resultCount"];
  59238. if(($receiver = $1) == null || $receiver.isNil){
  59239. self["@resultCount"]=(1);
  59240. } else {
  59241. self["@resultCount"]=$recv(self["@resultCount"]).__plus((1));
  59242. };
  59243. return "res".__comma($recv(self["@resultCount"])._asString());
  59244. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  59245. },
  59246. args: [],
  59247. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  59248. referencedClasses: [],
  59249. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  59250. }),
  59251. $globals.Repl);
  59252. $core.addMethod(
  59253. $core.method({
  59254. selector: "onKeyPress:",
  59255. protocol: 'private',
  59256. fn: function (key){
  59257. var self=this;
  59258. return $core.withContext(function($ctx1) {
  59259. var $1;
  59260. $1=$recv($recv(key)._ctrl())._and_((function(){
  59261. return $core.withContext(function($ctx2) {
  59262. return $recv($recv(key)._name()).__eq("l");
  59263. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59264. }));
  59265. if($core.assert($1)){
  59266. self._clearScreen();
  59267. };
  59268. return self;
  59269. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  59270. },
  59271. args: ["key"],
  59272. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  59273. referencedClasses: [],
  59274. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  59275. }),
  59276. $globals.Repl);
  59277. $core.addMethod(
  59278. $core.method({
  59279. selector: "parseAssignment:do:",
  59280. protocol: 'private',
  59281. fn: function (aString,aBlock){
  59282. var self=this;
  59283. var assignment;
  59284. return $core.withContext(function($ctx1) {
  59285. var $2,$1;
  59286. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  59287. return $core.withContext(function($ctx2) {
  59288. return $recv(s)._trimBoth();
  59289. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  59290. }));
  59291. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  59292. return $core.withContext(function($ctx2) {
  59293. $2=$recv(assignment)._first();
  59294. $ctx2.sendIdx["first"]=1;
  59295. return self._isIdentifier_($2);
  59296. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59297. }));
  59298. if($core.assert($1)){
  59299. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  59300. $ctx1.sendIdx["value:value:"]=1;
  59301. } else {
  59302. return $recv(aBlock)._value_value_(nil,nil);
  59303. };
  59304. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  59305. },
  59306. args: ["aString", "aBlock"],
  59307. 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 ]",
  59308. referencedClasses: [],
  59309. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  59310. }),
  59311. $globals.Repl);
  59312. $core.addMethod(
  59313. $core.method({
  59314. selector: "presentResultNamed:withValue:",
  59315. protocol: 'private',
  59316. fn: function (varName,value){
  59317. var self=this;
  59318. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  59319. return $core.withContext(function($ctx1) {
  59320. var $3,$2,$1;
  59321. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  59322. $ctx1.sendIdx[","]=3;
  59323. $2=$recv($3).__comma(" = ");
  59324. $ctx1.sendIdx[","]=2;
  59325. $1=$recv($2).__comma($recv(value)._asString());
  59326. $ctx1.sendIdx[","]=1;
  59327. $recv($Transcript())._show_($1);
  59328. $recv($Transcript())._cr();
  59329. $recv(self["@interface"])._prompt();
  59330. return self;
  59331. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  59332. },
  59333. args: ["varName", "value"],
  59334. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  59335. referencedClasses: ["Transcript"],
  59336. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  59337. }),
  59338. $globals.Repl);
  59339. $core.addMethod(
  59340. $core.method({
  59341. selector: "printWelcome",
  59342. protocol: 'actions',
  59343. fn: function (){
  59344. var self=this;
  59345. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  59346. return $core.withContext(function($ctx1) {
  59347. $recv($Transcript())._show_("Type :q to exit.");
  59348. $recv($Transcript())._cr();
  59349. return self;
  59350. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  59351. },
  59352. args: [],
  59353. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  59354. referencedClasses: ["Transcript"],
  59355. messageSends: ["show:", "cr"]
  59356. }),
  59357. $globals.Repl);
  59358. $core.addMethod(
  59359. $core.method({
  59360. selector: "processLine:",
  59361. protocol: 'private',
  59362. fn: function (buffer){
  59363. var self=this;
  59364. var show;
  59365. return $core.withContext(function($ctx1) {
  59366. var $1,$2;
  59367. show=(function(varName,value){
  59368. return $core.withContext(function($ctx2) {
  59369. return self._presentResultNamed_withValue_(varName,value);
  59370. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  59371. });
  59372. $1=self._executeCommand_(buffer);
  59373. if(!$core.assert($1)){
  59374. $2=self._isVariableDefined_(buffer);
  59375. if($core.assert($2)){
  59376. $recv(show)._value_value_(buffer,$recv(self["@session"])._perform_(buffer));
  59377. } else {
  59378. self._assignNewVariable_do_(buffer,show);
  59379. };
  59380. };
  59381. return self;
  59382. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  59383. },
  59384. args: ["buffer"],
  59385. 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]]",
  59386. referencedClasses: [],
  59387. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  59388. }),
  59389. $globals.Repl);
  59390. $core.addMethod(
  59391. $core.method({
  59392. selector: "prompt",
  59393. protocol: 'accessing',
  59394. fn: function (){
  59395. var self=this;
  59396. return "amber >> ";
  59397. },
  59398. args: [],
  59399. source: "prompt\x0a\x09^ 'amber >> '",
  59400. referencedClasses: [],
  59401. messageSends: []
  59402. }),
  59403. $globals.Repl);
  59404. $core.addMethod(
  59405. $core.method({
  59406. selector: "setPreviousVariablesFor:from:",
  59407. protocol: 'private',
  59408. fn: function (newObject,oldObject){
  59409. var self=this;
  59410. return $core.withContext(function($ctx1) {
  59411. $recv(self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  59412. return $core.withContext(function($ctx2) {
  59413. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  59414. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59415. }));
  59416. return self;
  59417. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  59418. },
  59419. args: ["newObject", "oldObject"],
  59420. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  59421. referencedClasses: [],
  59422. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  59423. }),
  59424. $globals.Repl);
  59425. $core.addMethod(
  59426. $core.method({
  59427. selector: "setPrompt",
  59428. protocol: 'actions',
  59429. fn: function (){
  59430. var self=this;
  59431. return $core.withContext(function($ctx1) {
  59432. $recv(self["@interface"])._setPrompt_(self._prompt());
  59433. return self;
  59434. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  59435. },
  59436. args: [],
  59437. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  59438. referencedClasses: [],
  59439. messageSends: ["setPrompt:", "prompt"]
  59440. }),
  59441. $globals.Repl);
  59442. $core.addMethod(
  59443. $core.method({
  59444. selector: "setupCommands",
  59445. protocol: 'initialization',
  59446. fn: function (){
  59447. var self=this;
  59448. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  59449. return $core.withContext(function($ctx1) {
  59450. var $2,$1;
  59451. $2=$recv([":q"]).__minus_gt((function(){
  59452. return $core.withContext(function($ctx2) {
  59453. return $recv(process)._exit();
  59454. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59455. }));
  59456. $ctx1.sendIdx["->"]=1;
  59457. $1=[$2,$recv([""]).__minus_gt((function(){
  59458. return $core.withContext(function($ctx2) {
  59459. return $recv(self["@interface"])._prompt();
  59460. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59461. }))];
  59462. self["@commands"]=$recv($Dictionary())._from_($1);
  59463. return self;
  59464. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  59465. },
  59466. args: [],
  59467. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  59468. referencedClasses: ["Dictionary"],
  59469. messageSends: ["from:", "->", "exit", "prompt"]
  59470. }),
  59471. $globals.Repl);
  59472. $core.addMethod(
  59473. $core.method({
  59474. selector: "setupHotkeys",
  59475. protocol: 'initialization',
  59476. fn: function (){
  59477. var self=this;
  59478. return $core.withContext(function($ctx1) {
  59479. var $receiver;
  59480. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  59481. return $core.withContext(function($ctx2) {
  59482. if(($receiver = key) == null || $receiver.isNil){
  59483. return key;
  59484. } else {
  59485. return self._onKeyPress_(key);
  59486. };
  59487. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  59488. }));
  59489. return self;
  59490. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  59491. },
  59492. args: [],
  59493. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  59494. referencedClasses: [],
  59495. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  59496. }),
  59497. $globals.Repl);
  59498. $core.addMethod(
  59499. $core.method({
  59500. selector: "subclass:withVariable:",
  59501. protocol: 'private',
  59502. fn: function (aClass,varName){
  59503. var self=this;
  59504. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  59505. return $core.withContext(function($ctx1) {
  59506. return $recv($recv($ClassBuilder())._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv(self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  59507. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  59508. },
  59509. args: ["aClass", "varName"],
  59510. 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'",
  59511. referencedClasses: ["ClassBuilder"],
  59512. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  59513. }),
  59514. $globals.Repl);
  59515. $core.addMethod(
  59516. $core.method({
  59517. selector: "subclassNameFor:",
  59518. protocol: 'private',
  59519. fn: function (aClass){
  59520. var self=this;
  59521. return $core.withContext(function($ctx1) {
  59522. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  59523. $2=$recv(aClass)._name();
  59524. $ctx1.sendIdx["name"]=1;
  59525. $1=$recv($2)._matchesOf_("\x5cd+$");
  59526. $ctx1.sendIdx["matchesOf:"]=1;
  59527. if(($receiver = $1) == null || $receiver.isNil){
  59528. return $recv($recv(aClass)._name()).__comma("2");
  59529. } else {
  59530. var counter;
  59531. $6=$recv(aClass)._name();
  59532. $ctx1.sendIdx["name"]=2;
  59533. $5=$recv($6)._matchesOf_("\x5cd+$");
  59534. $4=$recv($5)._first();
  59535. $3=$recv($4)._asNumber();
  59536. counter=$recv($3).__plus((1));
  59537. counter;
  59538. $7=$recv(aClass)._name();
  59539. $ctx1.sendIdx["name"]=3;
  59540. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  59541. };
  59542. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  59543. },
  59544. args: ["aClass"],
  59545. 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'].",
  59546. referencedClasses: [],
  59547. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  59548. }),
  59549. $globals.Repl);
  59550. $core.addMethod(
  59551. $core.method({
  59552. selector: "main",
  59553. protocol: 'initialization',
  59554. fn: function (){
  59555. var self=this;
  59556. return $core.withContext(function($ctx1) {
  59557. $recv(self._new())._createInterface();
  59558. return self;
  59559. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.klass)});
  59560. },
  59561. args: [],
  59562. source: "main\x0a\x09self new createInterface",
  59563. referencedClasses: [],
  59564. messageSends: ["createInterface", "new"]
  59565. }),
  59566. $globals.Repl.klass);
  59567. });
  59568. (function () {
  59569. define('app',["amber/devel", "amber_cli/AmberCli"], function (amber) {
  59570. amber.initialize();
  59571. amber.globals.AmberCli._main();
  59572. });
  59573. }());
  59574. require(["app"]);
  59575. });
  59576. define.require('__wrap__');
  59577. }((function amdefine(module, requireFn) {
  59578. 'use strict';
  59579. var defineCache = {},
  59580. loaderCache = {},
  59581. alreadyCalled = false,
  59582. path = require('path'),
  59583. makeRequire, stringRequire;
  59584. /**
  59585. * Trims the . and .. from an array of path segments.
  59586. * It will keep a leading path segment if a .. will become
  59587. * the first path segment, to help with module name lookups,
  59588. * which act like paths, but can be remapped. But the end result,
  59589. * all paths that use this function should look normalized.
  59590. * NOTE: this method MODIFIES the input array.
  59591. * @param {Array} ary the array of path segments.
  59592. */
  59593. function trimDots(ary) {
  59594. var i, part;
  59595. for (i = 0; ary[i]; i+= 1) {
  59596. part = ary[i];
  59597. if (part === '.') {
  59598. ary.splice(i, 1);
  59599. i -= 1;
  59600. } else if (part === '..') {
  59601. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  59602. //End of the line. Keep at least one non-dot
  59603. //path segment at the front so it can be mapped
  59604. //correctly to disk. Otherwise, there is likely
  59605. //no path mapping for a path starting with '..'.
  59606. //This can still fail, but catches the most reasonable
  59607. //uses of ..
  59608. break;
  59609. } else if (i > 0) {
  59610. ary.splice(i - 1, 2);
  59611. i -= 2;
  59612. }
  59613. }
  59614. }
  59615. }
  59616. function normalize(name, baseName) {
  59617. var baseParts;
  59618. //Adjust any relative paths.
  59619. if (name && name.charAt(0) === '.') {
  59620. //If have a base name, try to normalize against it,
  59621. //otherwise, assume it is a top-level require that will
  59622. //be relative to baseUrl in the end.
  59623. if (baseName) {
  59624. baseParts = baseName.split('/');
  59625. baseParts = baseParts.slice(0, baseParts.length - 1);
  59626. baseParts = baseParts.concat(name.split('/'));
  59627. trimDots(baseParts);
  59628. name = baseParts.join('/');
  59629. }
  59630. }
  59631. return name;
  59632. }
  59633. /**
  59634. * Create the normalize() function passed to a loader plugin's
  59635. * normalize method.
  59636. */
  59637. function makeNormalize(relName) {
  59638. return function (name) {
  59639. return normalize(name, relName);
  59640. };
  59641. }
  59642. function makeLoad(id) {
  59643. function load(value) {
  59644. loaderCache[id] = value;
  59645. }
  59646. load.fromText = function (id, text) {
  59647. //This one is difficult because the text can/probably uses
  59648. //define, and any relative paths and requires should be relative
  59649. //to that id was it would be found on disk. But this would require
  59650. //bootstrapping a module/require fairly deeply from node core.
  59651. //Not sure how best to go about that yet.
  59652. throw new Error('amdefine does not implement load.fromText');
  59653. };
  59654. return load;
  59655. }
  59656. makeRequire = function (systemRequire, exports, module, relId) {
  59657. function amdRequire(deps, callback) {
  59658. if (typeof deps === 'string') {
  59659. //Synchronous, single module require('')
  59660. return stringRequire(systemRequire, exports, module, deps, relId);
  59661. } else {
  59662. //Array of dependencies with a callback.
  59663. //Convert the dependencies to modules.
  59664. deps = deps.map(function (depName) {
  59665. return stringRequire(systemRequire, exports, module, depName, relId);
  59666. });
  59667. //Wait for next tick to call back the require call.
  59668. if (callback) {
  59669. process.nextTick(function () {
  59670. callback.apply(null, deps);
  59671. });
  59672. }
  59673. }
  59674. }
  59675. amdRequire.toUrl = function (filePath) {
  59676. if (filePath.indexOf('.') === 0) {
  59677. return normalize(filePath, path.dirname(module.filename));
  59678. } else {
  59679. return filePath;
  59680. }
  59681. };
  59682. return amdRequire;
  59683. };
  59684. //Favor explicit value, passed in if the module wants to support Node 0.4.
  59685. requireFn = requireFn || function req() {
  59686. return module.require.apply(module, arguments);
  59687. };
  59688. function runFactory(id, deps, factory) {
  59689. var r, e, m, result;
  59690. if (id) {
  59691. e = loaderCache[id] = {};
  59692. m = {
  59693. id: id,
  59694. uri: __filename,
  59695. exports: e
  59696. };
  59697. r = makeRequire(requireFn, e, m, id);
  59698. } else {
  59699. //Only support one define call per file
  59700. if (alreadyCalled) {
  59701. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  59702. }
  59703. alreadyCalled = true;
  59704. //Use the real variables from node
  59705. //Use module.exports for exports, since
  59706. //the exports in here is amdefine exports.
  59707. e = module.exports;
  59708. m = module;
  59709. r = makeRequire(requireFn, e, m, module.id);
  59710. }
  59711. //If there are dependencies, they are strings, so need
  59712. //to convert them to dependency values.
  59713. if (deps) {
  59714. deps = deps.map(function (depName) {
  59715. return r(depName);
  59716. });
  59717. }
  59718. //Call the factory with the right dependencies.
  59719. if (typeof factory === 'function') {
  59720. result = factory.apply(m.exports, deps);
  59721. } else {
  59722. result = factory;
  59723. }
  59724. if (result !== undefined) {
  59725. m.exports = result;
  59726. if (id) {
  59727. loaderCache[id] = m.exports;
  59728. }
  59729. }
  59730. }
  59731. stringRequire = function (systemRequire, exports, module, id, relId) {
  59732. //Split the ID by a ! so that
  59733. var index = id.indexOf('!'),
  59734. originalId = id,
  59735. prefix, plugin;
  59736. if (index === -1) {
  59737. id = normalize(id, relId);
  59738. //Straight module lookup. If it is one of the special dependencies,
  59739. //deal with it, otherwise, delegate to node.
  59740. if (id === 'require') {
  59741. return makeRequire(systemRequire, exports, module, relId);
  59742. } else if (id === 'exports') {
  59743. return exports;
  59744. } else if (id === 'module') {
  59745. return module;
  59746. } else if (loaderCache.hasOwnProperty(id)) {
  59747. return loaderCache[id];
  59748. } else if (defineCache[id]) {
  59749. runFactory.apply(null, defineCache[id]);
  59750. return loaderCache[id];
  59751. } else {
  59752. if(systemRequire) {
  59753. return systemRequire(originalId);
  59754. } else {
  59755. throw new Error('No module with ID: ' + id);
  59756. }
  59757. }
  59758. } else {
  59759. //There is a plugin in play.
  59760. prefix = id.substring(0, index);
  59761. id = id.substring(index + 1, id.length);
  59762. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  59763. if (plugin.normalize) {
  59764. id = plugin.normalize(id, makeNormalize(relId));
  59765. } else {
  59766. //Normalize the ID normally.
  59767. id = normalize(id, relId);
  59768. }
  59769. if (loaderCache[id]) {
  59770. return loaderCache[id];
  59771. } else {
  59772. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  59773. return loaderCache[id];
  59774. }
  59775. }
  59776. };
  59777. //Create a define function specific to the module asking for amdefine.
  59778. function define(id, deps, factory) {
  59779. if (Array.isArray(id)) {
  59780. factory = deps;
  59781. deps = id;
  59782. id = undefined;
  59783. } else if (typeof id !== 'string') {
  59784. factory = id;
  59785. id = deps = undefined;
  59786. }
  59787. if (deps && !Array.isArray(deps)) {
  59788. factory = deps;
  59789. deps = undefined;
  59790. }
  59791. if (!deps) {
  59792. deps = ['require', 'exports', 'module'];
  59793. }
  59794. //Set up properties for this module. If an ID, then use
  59795. //internal cache. If no ID, then use the external variables
  59796. //for this node module.
  59797. if (id) {
  59798. //Put the module in deep freeze until there is a
  59799. //require call for it.
  59800. defineCache[id] = [id, deps, factory];
  59801. } else {
  59802. runFactory(id, deps, factory);
  59803. }
  59804. }
  59805. //define.require, which has access to all the values in the
  59806. //cache. Useful for AMD modules that all have IDs in the file,
  59807. //but need to finally export a value to node based on one of those
  59808. //IDs.
  59809. define.require = function (id) {
  59810. if (loaderCache[id]) {
  59811. return loaderCache[id];
  59812. }
  59813. if (defineCache[id]) {
  59814. runFactory.apply(null, defineCache[id]);
  59815. return loaderCache[id];
  59816. }
  59817. };
  59818. define.amd = {};
  59819. return define;
  59820. }(module)), require));