amber-cli.js 2.1 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968
  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 {api: api, nil: brikz.root.nil, globals: globals, asReceiver: brikz.asReceiver.asReceiver};
  999. });
  1000. define("amber/helpers", ["amber/boot", "require"], function (boot, require) {
  1001. var globals = boot.globals,
  1002. exports = {},
  1003. api = boot.api,
  1004. nil = boot.nil;
  1005. // API
  1006. exports.popupHelios = function () {
  1007. require(['helios/index'], function (helios) {
  1008. helios.popup();
  1009. }, function (err) {
  1010. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  1011. });
  1012. };
  1013. Object.defineProperty(exports, "api", {
  1014. value: api,
  1015. enumerable: true, configurable: true, writable: false
  1016. });
  1017. Object.defineProperty(exports, "globals", {
  1018. value: globals,
  1019. enumerable: true, configurable: true, writable: false
  1020. });
  1021. Object.defineProperty(exports, "nil", {
  1022. value: nil,
  1023. enumerable: true, configurable: true, writable: false
  1024. });
  1025. function mixinToSettings(source) {
  1026. var settings = globals.SmalltalkSettings;
  1027. Object.keys(source).forEach(function (key) {
  1028. settings[key] = source[key];
  1029. });
  1030. }
  1031. function settingsInLocalStorage() {
  1032. //jshint evil:true
  1033. var global = new Function('return this')(),
  1034. storage = 'localStorage' in global && global.localStorage;
  1035. if (storage) {
  1036. var fromStorage;
  1037. try {
  1038. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  1039. } catch (ex) {
  1040. // pass
  1041. }
  1042. mixinToSettings(fromStorage || {});
  1043. if (typeof window !== "undefined") {
  1044. requirejs(['jquery'], function ($) {
  1045. $(window).on('beforeunload', function () {
  1046. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  1047. });
  1048. });
  1049. }
  1050. }
  1051. }
  1052. exports.initialize = function (options) {
  1053. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  1054. settingsInLocalStorage();
  1055. mixinToSettings(options || {});
  1056. return api.initialize();
  1057. };
  1058. // Exports
  1059. return exports;
  1060. });
  1061. define("amber_core/Kernel-Objects", ["amber/boot"], function($boot){"use strict";
  1062. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  1063. $core.addPackage('Kernel-Objects');
  1064. $core.packages["Kernel-Objects"].innerEval = function (expr) { return eval(expr); };
  1065. $core.packages["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  1066. $core.addClass('ProtoObject', null, [], 'Kernel-Objects');
  1067. $globals.ProtoObject.comment="I implement the basic behavior required for any object in Amber.\x0a\x0aIn most cases, subclassing `ProtoObject` is wrong and `Object` should be used instead. However subclassing `ProtoObject` can be useful in some special cases like proxy implementations.";
  1068. $core.addMethod(
  1069. $core.method({
  1070. selector: "=",
  1071. protocol: 'comparing',
  1072. fn: function (anObject){
  1073. var self=this;
  1074. return $core.withContext(function($ctx1) {
  1075. var $1;
  1076. $1=self.__eq_eq(anObject);
  1077. return $1;
  1078. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  1079. },
  1080. args: ["anObject"],
  1081. source: "= anObject\x0a\x09^ self == anObject",
  1082. referencedClasses: [],
  1083. messageSends: ["=="]
  1084. }),
  1085. $globals.ProtoObject);
  1086. $core.addMethod(
  1087. $core.method({
  1088. selector: "==",
  1089. protocol: 'comparing',
  1090. fn: function (anObject){
  1091. var self=this;
  1092. return $core.withContext(function($ctx1) {
  1093. return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject);
  1094. return self;
  1095. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  1096. },
  1097. args: ["anObject"],
  1098. source: "== anObject\x0a<return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject)>",
  1099. referencedClasses: [],
  1100. messageSends: []
  1101. }),
  1102. $globals.ProtoObject);
  1103. $core.addMethod(
  1104. $core.method({
  1105. selector: "asString",
  1106. protocol: 'converting',
  1107. fn: function (){
  1108. var self=this;
  1109. return $core.withContext(function($ctx1) {
  1110. var $1;
  1111. $1=self._printString();
  1112. return $1;
  1113. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  1114. },
  1115. args: [],
  1116. source: "asString\x0a\x09^ self printString",
  1117. referencedClasses: [],
  1118. messageSends: ["printString"]
  1119. }),
  1120. $globals.ProtoObject);
  1121. $core.addMethod(
  1122. $core.method({
  1123. selector: "class",
  1124. protocol: 'accessing',
  1125. fn: function (){
  1126. var self=this;
  1127. return $core.withContext(function($ctx1) {
  1128. return self.klass;
  1129. return self;
  1130. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  1131. },
  1132. args: [],
  1133. source: "class\x0a\x09<return self.klass>",
  1134. referencedClasses: [],
  1135. messageSends: []
  1136. }),
  1137. $globals.ProtoObject);
  1138. $core.addMethod(
  1139. $core.method({
  1140. selector: "doesNotUnderstand:",
  1141. protocol: 'error handling',
  1142. fn: function (aMessage){
  1143. var self=this;
  1144. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  1145. return $core.withContext(function($ctx1) {
  1146. var $1,$2;
  1147. $1=$recv($MessageNotUnderstood())._new();
  1148. $recv($1)._receiver_(self);
  1149. $recv($1)._message_(aMessage);
  1150. $2=$recv($1)._signal();
  1151. return self;
  1152. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  1153. },
  1154. args: ["aMessage"],
  1155. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  1156. referencedClasses: ["MessageNotUnderstood"],
  1157. messageSends: ["receiver:", "new", "message:", "signal"]
  1158. }),
  1159. $globals.ProtoObject);
  1160. $core.addMethod(
  1161. $core.method({
  1162. selector: "evaluate:on:",
  1163. protocol: 'evaluating',
  1164. fn: function (aString,anEvaluator){
  1165. var self=this;
  1166. return $core.withContext(function($ctx1) {
  1167. var $1;
  1168. $1=$recv(anEvaluator)._evaluate_receiver_(aString,self);
  1169. return $1;
  1170. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  1171. },
  1172. args: ["aString", "anEvaluator"],
  1173. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  1174. referencedClasses: [],
  1175. messageSends: ["evaluate:receiver:"]
  1176. }),
  1177. $globals.ProtoObject);
  1178. $core.addMethod(
  1179. $core.method({
  1180. selector: "identityHash",
  1181. protocol: 'accessing',
  1182. fn: function (){
  1183. var self=this;
  1184. return $core.withContext(function($ctx1) {
  1185. var hash=self.identityHash;
  1186. if (hash) return hash;
  1187. hash=$core.nextId();
  1188. Object.defineProperty(self, 'identityHash', {value:hash});
  1189. return hash;
  1190. ;
  1191. return self;
  1192. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  1193. },
  1194. args: [],
  1195. source: "identityHash\x0a\x09<\x0a\x09\x09var hash=self.identityHash;\x0a\x09\x09if (hash) return hash;\x0a\x09\x09hash=$core.nextId();\x0a\x09\x09Object.defineProperty(self, 'identityHash', {value:hash});\x0a\x09\x09return hash;\x0a\x09>",
  1196. referencedClasses: [],
  1197. messageSends: []
  1198. }),
  1199. $globals.ProtoObject);
  1200. $core.addMethod(
  1201. $core.method({
  1202. selector: "ifNil:",
  1203. protocol: 'testing',
  1204. fn: function (aBlock){
  1205. var self=this;
  1206. return self;
  1207. },
  1208. args: ["aBlock"],
  1209. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  1210. referencedClasses: [],
  1211. messageSends: []
  1212. }),
  1213. $globals.ProtoObject);
  1214. $core.addMethod(
  1215. $core.method({
  1216. selector: "ifNil:ifNotNil:",
  1217. protocol: 'testing',
  1218. fn: function (aBlock,anotherBlock){
  1219. var self=this;
  1220. return $core.withContext(function($ctx1) {
  1221. var $1;
  1222. $1=$recv(anotherBlock)._value_(self);
  1223. return $1;
  1224. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  1225. },
  1226. args: ["aBlock", "anotherBlock"],
  1227. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  1228. referencedClasses: [],
  1229. messageSends: ["value:"]
  1230. }),
  1231. $globals.ProtoObject);
  1232. $core.addMethod(
  1233. $core.method({
  1234. selector: "ifNotNil:",
  1235. protocol: 'testing',
  1236. fn: function (aBlock){
  1237. var self=this;
  1238. return $core.withContext(function($ctx1) {
  1239. var $1;
  1240. $1=$recv(aBlock)._value_(self);
  1241. return $1;
  1242. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  1243. },
  1244. args: ["aBlock"],
  1245. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  1246. referencedClasses: [],
  1247. messageSends: ["value:"]
  1248. }),
  1249. $globals.ProtoObject);
  1250. $core.addMethod(
  1251. $core.method({
  1252. selector: "ifNotNil:ifNil:",
  1253. protocol: 'testing',
  1254. fn: function (aBlock,anotherBlock){
  1255. var self=this;
  1256. return $core.withContext(function($ctx1) {
  1257. var $1;
  1258. $1=$recv(aBlock)._value_(self);
  1259. return $1;
  1260. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  1261. },
  1262. args: ["aBlock", "anotherBlock"],
  1263. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  1264. referencedClasses: [],
  1265. messageSends: ["value:"]
  1266. }),
  1267. $globals.ProtoObject);
  1268. $core.addMethod(
  1269. $core.method({
  1270. selector: "initialize",
  1271. protocol: 'initialization',
  1272. fn: function (){
  1273. var self=this;
  1274. return self;
  1275. },
  1276. args: [],
  1277. source: "initialize",
  1278. referencedClasses: [],
  1279. messageSends: []
  1280. }),
  1281. $globals.ProtoObject);
  1282. $core.addMethod(
  1283. $core.method({
  1284. selector: "inspect",
  1285. protocol: 'inspecting',
  1286. fn: function (){
  1287. var self=this;
  1288. function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  1289. return $core.withContext(function($ctx1) {
  1290. $recv($Inspector())._inspect_(self);
  1291. return self;
  1292. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  1293. },
  1294. args: [],
  1295. source: "inspect\x0a\x09Inspector inspect: self",
  1296. referencedClasses: ["Inspector"],
  1297. messageSends: ["inspect:"]
  1298. }),
  1299. $globals.ProtoObject);
  1300. $core.addMethod(
  1301. $core.method({
  1302. selector: "inspectOn:",
  1303. protocol: 'inspecting',
  1304. fn: function (anInspector){
  1305. var self=this;
  1306. return self;
  1307. },
  1308. args: ["anInspector"],
  1309. source: "inspectOn: anInspector",
  1310. referencedClasses: [],
  1311. messageSends: []
  1312. }),
  1313. $globals.ProtoObject);
  1314. $core.addMethod(
  1315. $core.method({
  1316. selector: "instVarAt:",
  1317. protocol: 'accessing',
  1318. fn: function (aString){
  1319. var self=this;
  1320. return $core.withContext(function($ctx1) {
  1321. return self['@'+aString] ;
  1322. return self;
  1323. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  1324. },
  1325. args: ["aString"],
  1326. source: "instVarAt: aString\x0a\x09< return self['@'+aString] >",
  1327. referencedClasses: [],
  1328. messageSends: []
  1329. }),
  1330. $globals.ProtoObject);
  1331. $core.addMethod(
  1332. $core.method({
  1333. selector: "instVarAt:put:",
  1334. protocol: 'accessing',
  1335. fn: function (aString,anObject){
  1336. var self=this;
  1337. return $core.withContext(function($ctx1) {
  1338. self['@' + aString] = anObject ;
  1339. return self;
  1340. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  1341. },
  1342. args: ["aString", "anObject"],
  1343. source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >",
  1344. referencedClasses: [],
  1345. messageSends: []
  1346. }),
  1347. $globals.ProtoObject);
  1348. $core.addMethod(
  1349. $core.method({
  1350. selector: "isKindOf:",
  1351. protocol: 'testing',
  1352. fn: function (aClass){
  1353. var self=this;
  1354. return $core.withContext(function($ctx1) {
  1355. var $2,$1;
  1356. $2=self._isMemberOf_(aClass);
  1357. if($core.assert($2)){
  1358. $1=true;
  1359. } else {
  1360. $1=$recv(self._class())._inheritsFrom_(aClass);
  1361. };
  1362. return $1;
  1363. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  1364. },
  1365. args: ["aClass"],
  1366. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  1367. referencedClasses: [],
  1368. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  1369. }),
  1370. $globals.ProtoObject);
  1371. $core.addMethod(
  1372. $core.method({
  1373. selector: "isNil",
  1374. protocol: 'testing',
  1375. fn: function (){
  1376. var self=this;
  1377. return false;
  1378. },
  1379. args: [],
  1380. source: "isNil\x0a\x09^ false",
  1381. referencedClasses: [],
  1382. messageSends: []
  1383. }),
  1384. $globals.ProtoObject);
  1385. $core.addMethod(
  1386. $core.method({
  1387. selector: "isSameInstanceAs:",
  1388. protocol: 'comparing',
  1389. fn: function (anObject){
  1390. var self=this;
  1391. return $core.withContext(function($ctx1) {
  1392. var $2,$1;
  1393. $2=self._identityHash();
  1394. $ctx1.sendIdx["identityHash"]=1;
  1395. $1=$recv($2).__eq($recv(anObject)._identityHash());
  1396. return $1;
  1397. }, function($ctx1) {$ctx1.fill(self,"isSameInstanceAs:",{anObject:anObject},$globals.ProtoObject)});
  1398. },
  1399. args: ["anObject"],
  1400. source: "isSameInstanceAs: anObject\x0a\x09^ self identityHash = anObject identityHash",
  1401. referencedClasses: [],
  1402. messageSends: ["=", "identityHash"]
  1403. }),
  1404. $globals.ProtoObject);
  1405. $core.addMethod(
  1406. $core.method({
  1407. selector: "notNil",
  1408. protocol: 'testing',
  1409. fn: function (){
  1410. var self=this;
  1411. return $core.withContext(function($ctx1) {
  1412. var $1;
  1413. $1=$recv(self._isNil())._not();
  1414. return $1;
  1415. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  1416. },
  1417. args: [],
  1418. source: "notNil\x0a\x09^ self isNil not",
  1419. referencedClasses: [],
  1420. messageSends: ["not", "isNil"]
  1421. }),
  1422. $globals.ProtoObject);
  1423. $core.addMethod(
  1424. $core.method({
  1425. selector: "perform:",
  1426. protocol: 'message handling',
  1427. fn: function (aString){
  1428. var self=this;
  1429. return $core.withContext(function($ctx1) {
  1430. var $1;
  1431. $1=self._perform_withArguments_(aString,[]);
  1432. return $1;
  1433. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  1434. },
  1435. args: ["aString"],
  1436. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  1437. referencedClasses: [],
  1438. messageSends: ["perform:withArguments:"]
  1439. }),
  1440. $globals.ProtoObject);
  1441. $core.addMethod(
  1442. $core.method({
  1443. selector: "perform:withArguments:",
  1444. protocol: 'message handling',
  1445. fn: function (aString,aCollection){
  1446. var self=this;
  1447. return $core.withContext(function($ctx1) {
  1448. return $core.send(self, aString._asJavaScriptMethodName(), aCollection);
  1449. return self;
  1450. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  1451. },
  1452. args: ["aString", "aCollection"],
  1453. source: "perform: aString withArguments: aCollection\x0a\x09<return $core.send(self, aString._asJavaScriptMethodName(), aCollection)>",
  1454. referencedClasses: [],
  1455. messageSends: []
  1456. }),
  1457. $globals.ProtoObject);
  1458. $core.addMethod(
  1459. $core.method({
  1460. selector: "printOn:",
  1461. protocol: 'printing',
  1462. fn: function (aStream){
  1463. var self=this;
  1464. return $core.withContext(function($ctx1) {
  1465. var $5,$4,$3,$2,$1;
  1466. $5=self._class();
  1467. $ctx1.sendIdx["class"]=1;
  1468. $4=$recv($5)._name();
  1469. $ctx1.sendIdx["name"]=1;
  1470. $3=$recv($4)._first();
  1471. $2=$recv($3)._isVowel();
  1472. if($core.assert($2)){
  1473. $1="an ";
  1474. } else {
  1475. $1="a ";
  1476. };
  1477. $recv(aStream)._nextPutAll_($1);
  1478. $ctx1.sendIdx["nextPutAll:"]=1;
  1479. $recv(aStream)._nextPutAll_($recv(self._class())._name());
  1480. return self;
  1481. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  1482. },
  1483. args: ["aStream"],
  1484. source: "printOn: aStream\x0a\x09aStream nextPutAll: (self class name first isVowel\x0a\x09\x09ifTrue: [ 'an ' ]\x0a\x09\x09ifFalse: [ 'a ' ]).\x0a\x09aStream nextPutAll: self class name",
  1485. referencedClasses: [],
  1486. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  1487. }),
  1488. $globals.ProtoObject);
  1489. $core.addMethod(
  1490. $core.method({
  1491. selector: "printString",
  1492. protocol: 'printing',
  1493. fn: function (){
  1494. var self=this;
  1495. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  1496. return $core.withContext(function($ctx1) {
  1497. var $1;
  1498. $1=$recv($String())._streamContents_((function(str){
  1499. return $core.withContext(function($ctx2) {
  1500. return self._printOn_(str);
  1501. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  1502. }));
  1503. return $1;
  1504. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  1505. },
  1506. args: [],
  1507. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  1508. referencedClasses: ["String"],
  1509. messageSends: ["streamContents:", "printOn:"]
  1510. }),
  1511. $globals.ProtoObject);
  1512. $core.addMethod(
  1513. $core.method({
  1514. selector: "yourself",
  1515. protocol: 'accessing',
  1516. fn: function (){
  1517. var self=this;
  1518. return self;
  1519. },
  1520. args: [],
  1521. source: "yourself\x0a\x09^ self",
  1522. referencedClasses: [],
  1523. messageSends: []
  1524. }),
  1525. $globals.ProtoObject);
  1526. $core.addMethod(
  1527. $core.method({
  1528. selector: "~=",
  1529. protocol: 'comparing',
  1530. fn: function (anObject){
  1531. var self=this;
  1532. return $core.withContext(function($ctx1) {
  1533. var $1;
  1534. $1=$recv(self.__eq(anObject)).__eq(false);
  1535. $ctx1.sendIdx["="]=1;
  1536. return $1;
  1537. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  1538. },
  1539. args: ["anObject"],
  1540. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  1541. referencedClasses: [],
  1542. messageSends: ["="]
  1543. }),
  1544. $globals.ProtoObject);
  1545. $core.addMethod(
  1546. $core.method({
  1547. selector: "~~",
  1548. protocol: 'comparing',
  1549. fn: function (anObject){
  1550. var self=this;
  1551. return $core.withContext(function($ctx1) {
  1552. var $1;
  1553. $1=$recv(self.__eq_eq(anObject)).__eq(false);
  1554. return $1;
  1555. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  1556. },
  1557. args: ["anObject"],
  1558. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  1559. referencedClasses: [],
  1560. messageSends: ["=", "=="]
  1561. }),
  1562. $globals.ProtoObject);
  1563. $core.addMethod(
  1564. $core.method({
  1565. selector: "initialize",
  1566. protocol: 'initialization',
  1567. fn: function (){
  1568. var self=this;
  1569. return self;
  1570. },
  1571. args: [],
  1572. source: "initialize",
  1573. referencedClasses: [],
  1574. messageSends: []
  1575. }),
  1576. $globals.ProtoObject.klass);
  1577. $core.addClass('Object', $globals.ProtoObject, [], 'Kernel-Objects');
  1578. $globals.Object.comment="**I am the root of the Smalltalk class system**. With the exception of unual subclasses of `ProtoObject`, all other classes in the system are subclasses of me.\x0a\x0aI provide default behavior common to all normal objects (some of it inherited from `ProtoObject`), such as:\x0a\x0a- accessing\x0a- copying\x0a- comparison\x0a- error handling\x0a- message sending\x0a- reflection\x0a\x0aAlso utility messages that all objects should respond to are defined here.\x0a\x0aI have no instance variable.\x0a\x0a##Access\x0a\x0aInstance variables can be accessed with `#instVarAt:` and `#instVarAt:put:`. `#instanceVariableNames` answers a collection of all instance variable names.\x0aAccessing JavaScript properties of an object is done through `#basicAt:`, `#basicAt:put:` and `basicDelete:`.\x0a\x0a##Copying\x0a\x0aCopying an object is handled by `#copy` and `#deepCopy`. The first one performs a shallow copy of the receiver, while the second one performs a deep copy.\x0aThe hook method `#postCopy` can be overriden in subclasses to copy fields as necessary to complete the full copy. It will be sent by the copy of the receiver.\x0a\x0a##Comparison\x0a\x0aI understand equality `#=` and identity `#==` comparison.\x0a\x0a##Error handling\x0a\x0a- `#halt` is the typical message to use for inserting breakpoints during debugging.\x0a- `#error:` throws a generic error exception\x0a- `#doesNotUnderstand:` handles the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message.\x0a\x09Overriding this message can be useful to implement proxies for example.";
  1579. $core.addMethod(
  1580. $core.method({
  1581. selector: "->",
  1582. protocol: 'converting',
  1583. fn: function (anObject){
  1584. var self=this;
  1585. function $Association(){return $globals.Association||(typeof Association=="undefined"?nil:Association)}
  1586. return $core.withContext(function($ctx1) {
  1587. var $1;
  1588. $1=$recv($Association())._key_value_(self,anObject);
  1589. return $1;
  1590. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  1591. },
  1592. args: ["anObject"],
  1593. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  1594. referencedClasses: ["Association"],
  1595. messageSends: ["key:value:"]
  1596. }),
  1597. $globals.Object);
  1598. $core.addMethod(
  1599. $core.method({
  1600. selector: "asJSON",
  1601. protocol: 'converting',
  1602. fn: function (){
  1603. var self=this;
  1604. var variables;
  1605. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1606. return $core.withContext(function($ctx1) {
  1607. var $1;
  1608. variables=$recv($HashedCollection())._new();
  1609. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  1610. return $core.withContext(function($ctx2) {
  1611. return $recv(variables)._at_put_(each,$recv(self._instVarAt_(each))._asJSON());
  1612. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1613. }));
  1614. $1=variables;
  1615. return $1;
  1616. }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},$globals.Object)});
  1617. },
  1618. args: [],
  1619. source: "asJSON\x0a\x09| variables |\x0a\x09variables := HashedCollection new.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) asJSON ].\x0a\x09^ variables",
  1620. referencedClasses: ["HashedCollection"],
  1621. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJSON", "instVarAt:"]
  1622. }),
  1623. $globals.Object);
  1624. $core.addMethod(
  1625. $core.method({
  1626. selector: "asJSONString",
  1627. protocol: 'converting',
  1628. fn: function (){
  1629. var self=this;
  1630. function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  1631. return $core.withContext(function($ctx1) {
  1632. var $1;
  1633. $1=$recv($JSON())._stringify_(self._asJSON());
  1634. return $1;
  1635. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  1636. },
  1637. args: [],
  1638. source: "asJSONString\x0a\x09^ JSON stringify: self asJSON",
  1639. referencedClasses: ["JSON"],
  1640. messageSends: ["stringify:", "asJSON"]
  1641. }),
  1642. $globals.Object);
  1643. $core.addMethod(
  1644. $core.method({
  1645. selector: "asJavascript",
  1646. protocol: 'converting',
  1647. fn: function (){
  1648. var self=this;
  1649. return $core.withContext(function($ctx1) {
  1650. var $1;
  1651. $1=self._asString();
  1652. return $1;
  1653. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Object)});
  1654. },
  1655. args: [],
  1656. source: "asJavascript\x0a\x09^ self asString",
  1657. referencedClasses: [],
  1658. messageSends: ["asString"]
  1659. }),
  1660. $globals.Object);
  1661. $core.addMethod(
  1662. $core.method({
  1663. selector: "basicAt:",
  1664. protocol: 'accessing',
  1665. fn: function (aString){
  1666. var self=this;
  1667. return $core.withContext(function($ctx1) {
  1668. return self[aString];
  1669. return self;
  1670. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  1671. },
  1672. args: ["aString"],
  1673. source: "basicAt: aString\x0a\x09<return self[aString]>",
  1674. referencedClasses: [],
  1675. messageSends: []
  1676. }),
  1677. $globals.Object);
  1678. $core.addMethod(
  1679. $core.method({
  1680. selector: "basicAt:put:",
  1681. protocol: 'accessing',
  1682. fn: function (aString,anObject){
  1683. var self=this;
  1684. return $core.withContext(function($ctx1) {
  1685. return self[aString] = anObject;
  1686. return self;
  1687. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  1688. },
  1689. args: ["aString", "anObject"],
  1690. source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
  1691. referencedClasses: [],
  1692. messageSends: []
  1693. }),
  1694. $globals.Object);
  1695. $core.addMethod(
  1696. $core.method({
  1697. selector: "basicDelete:",
  1698. protocol: 'accessing',
  1699. fn: function (aString){
  1700. var self=this;
  1701. return $core.withContext(function($ctx1) {
  1702. delete self[aString]; return aString;
  1703. return self;
  1704. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  1705. },
  1706. args: ["aString"],
  1707. source: "basicDelete: aString\x0a\x09<delete self[aString]; return aString>",
  1708. referencedClasses: [],
  1709. messageSends: []
  1710. }),
  1711. $globals.Object);
  1712. $core.addMethod(
  1713. $core.method({
  1714. selector: "basicPerform:",
  1715. protocol: 'message handling',
  1716. fn: function (aString){
  1717. var self=this;
  1718. return $core.withContext(function($ctx1) {
  1719. var $1;
  1720. $1=self._basicPerform_withArguments_(aString,[]);
  1721. return $1;
  1722. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  1723. },
  1724. args: ["aString"],
  1725. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  1726. referencedClasses: [],
  1727. messageSends: ["basicPerform:withArguments:"]
  1728. }),
  1729. $globals.Object);
  1730. $core.addMethod(
  1731. $core.method({
  1732. selector: "basicPerform:withArguments:",
  1733. protocol: 'message handling',
  1734. fn: function (aString,aCollection){
  1735. var self=this;
  1736. return $core.withContext(function($ctx1) {
  1737. return self[aString].apply(self, aCollection);;
  1738. return self;
  1739. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  1740. },
  1741. args: ["aString", "aCollection"],
  1742. source: "basicPerform: aString withArguments: aCollection\x0a\x09<return self[aString].apply(self, aCollection);>",
  1743. referencedClasses: [],
  1744. messageSends: []
  1745. }),
  1746. $globals.Object);
  1747. $core.addMethod(
  1748. $core.method({
  1749. selector: "browse",
  1750. protocol: 'browsing',
  1751. fn: function (){
  1752. var self=this;
  1753. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  1754. return $core.withContext(function($ctx1) {
  1755. $recv($Finder())._findClass_(self._class());
  1756. return self;
  1757. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  1758. },
  1759. args: [],
  1760. source: "browse\x0a\x09Finder findClass: self class",
  1761. referencedClasses: ["Finder"],
  1762. messageSends: ["findClass:", "class"]
  1763. }),
  1764. $globals.Object);
  1765. $core.addMethod(
  1766. $core.method({
  1767. selector: "copy",
  1768. protocol: 'copying',
  1769. fn: function (){
  1770. var self=this;
  1771. return $core.withContext(function($ctx1) {
  1772. var $1;
  1773. $1=$recv(self._shallowCopy())._postCopy();
  1774. return $1;
  1775. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  1776. },
  1777. args: [],
  1778. source: "copy\x0a\x09^ self shallowCopy postCopy",
  1779. referencedClasses: [],
  1780. messageSends: ["postCopy", "shallowCopy"]
  1781. }),
  1782. $globals.Object);
  1783. $core.addMethod(
  1784. $core.method({
  1785. selector: "deepCopy",
  1786. protocol: 'copying',
  1787. fn: function (){
  1788. var self=this;
  1789. return $core.withContext(function($ctx1) {
  1790. var copy = self.klass._new();
  1791. Object.keys(self).forEach(function (i) {
  1792. if(/^@.+/.test(i)) {
  1793. copy[i] = self[i]._deepCopy();
  1794. }
  1795. });
  1796. return copy;
  1797. ;
  1798. return self;
  1799. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  1800. },
  1801. args: [],
  1802. source: "deepCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09Object.keys(self).forEach(function (i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i]._deepCopy();\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09>",
  1803. referencedClasses: [],
  1804. messageSends: []
  1805. }),
  1806. $globals.Object);
  1807. $core.addMethod(
  1808. $core.method({
  1809. selector: "deprecatedAPI",
  1810. protocol: 'error handling',
  1811. fn: function (){
  1812. var self=this;
  1813. return $core.withContext(function($ctx1) {
  1814. var $1,$6,$5,$4,$8,$7,$3,$2;
  1815. $1=console;
  1816. $6=$core.getThisContext()._home();
  1817. $ctx1.sendIdx["home"]=1;
  1818. $5=$recv($6)._asString();
  1819. $ctx1.sendIdx["asString"]=1;
  1820. $4=$recv($5).__comma(" is deprecated! (in ");
  1821. $8=$recv($core.getThisContext()._home())._home();
  1822. $ctx1.sendIdx["home"]=2;
  1823. $7=$recv($8)._asString();
  1824. $3=$recv($4).__comma($7);
  1825. $ctx1.sendIdx[","]=2;
  1826. $2=$recv($3).__comma(")");
  1827. $ctx1.sendIdx[","]=1;
  1828. $recv($1)._warn_($2);
  1829. return self;
  1830. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  1831. },
  1832. args: [],
  1833. source: "deprecatedAPI\x0a\x09\x22Just a simple way to deprecate methods.\x0a\x09#deprecatedAPI is in the 'error handling' protocol even if it doesn't throw an error,\x0a\x09but it could in the future.\x22\x0a\x09console warn: thisContext home asString, ' is deprecated! (in ', thisContext home home asString, ')'.",
  1834. referencedClasses: [],
  1835. messageSends: ["warn:", ",", "asString", "home"]
  1836. }),
  1837. $globals.Object);
  1838. $core.addMethod(
  1839. $core.method({
  1840. selector: "deprecatedAPI:",
  1841. protocol: 'error handling',
  1842. fn: function (aString){
  1843. var self=this;
  1844. return $core.withContext(function($ctx1) {
  1845. var $1,$6,$5,$4,$8,$7,$3,$2;
  1846. $1=console;
  1847. $6=$core.getThisContext()._home();
  1848. $ctx1.sendIdx["home"]=1;
  1849. $5=$recv($6)._asString();
  1850. $ctx1.sendIdx["asString"]=1;
  1851. $4=$recv($5).__comma(" is deprecated! (in ");
  1852. $8=$recv($core.getThisContext()._home())._home();
  1853. $ctx1.sendIdx["home"]=2;
  1854. $7=$recv($8)._asString();
  1855. $3=$recv($4).__comma($7);
  1856. $ctx1.sendIdx[","]=2;
  1857. $2=$recv($3).__comma(")");
  1858. $ctx1.sendIdx[","]=1;
  1859. $recv($1)._warn_($2);
  1860. $ctx1.sendIdx["warn:"]=1;
  1861. $recv(console)._warn_(aString);
  1862. return self;
  1863. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  1864. },
  1865. args: ["aString"],
  1866. source: "deprecatedAPI: aString\x0a\x09\x22Just a simple way to deprecate methods.\x0a\x09#deprecatedAPI is in the 'error handling' protocol even if it doesn't throw an error,\x0a\x09but it could in the future.\x22\x0a\x09console warn: thisContext home asString, ' is deprecated! (in ', thisContext home home asString, ')'.\x0a\x09console warn: aString",
  1867. referencedClasses: [],
  1868. messageSends: ["warn:", ",", "asString", "home"]
  1869. }),
  1870. $globals.Object);
  1871. $core.addMethod(
  1872. $core.method({
  1873. selector: "error:",
  1874. protocol: 'error handling',
  1875. fn: function (aString){
  1876. var self=this;
  1877. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  1878. return $core.withContext(function($ctx1) {
  1879. $recv($Error())._signal_(aString);
  1880. return self;
  1881. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  1882. },
  1883. args: ["aString"],
  1884. source: "error: aString\x0a\x09Error signal: aString",
  1885. referencedClasses: ["Error"],
  1886. messageSends: ["signal:"]
  1887. }),
  1888. $globals.Object);
  1889. $core.addMethod(
  1890. $core.method({
  1891. selector: "halt",
  1892. protocol: 'error handling',
  1893. fn: function (){
  1894. var self=this;
  1895. function $Halt(){return $globals.Halt||(typeof Halt=="undefined"?nil:Halt)}
  1896. return $core.withContext(function($ctx1) {
  1897. $recv($Halt())._signal();
  1898. return self;
  1899. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  1900. },
  1901. args: [],
  1902. source: "halt\x0a\x09Halt signal",
  1903. referencedClasses: ["Halt"],
  1904. messageSends: ["signal"]
  1905. }),
  1906. $globals.Object);
  1907. $core.addMethod(
  1908. $core.method({
  1909. selector: "in:",
  1910. protocol: 'evaluating',
  1911. fn: function (aValuable){
  1912. var self=this;
  1913. return $core.withContext(function($ctx1) {
  1914. var $1;
  1915. $1=$recv(aValuable)._value_(self);
  1916. return $1;
  1917. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  1918. },
  1919. args: ["aValuable"],
  1920. source: "in: aValuable\x0a\x09^ aValuable value: self",
  1921. referencedClasses: [],
  1922. messageSends: ["value:"]
  1923. }),
  1924. $globals.Object);
  1925. $core.addMethod(
  1926. $core.method({
  1927. selector: "isBehavior",
  1928. protocol: 'testing',
  1929. fn: function (){
  1930. var self=this;
  1931. return false;
  1932. },
  1933. args: [],
  1934. source: "isBehavior\x0a\x09^ false",
  1935. referencedClasses: [],
  1936. messageSends: []
  1937. }),
  1938. $globals.Object);
  1939. $core.addMethod(
  1940. $core.method({
  1941. selector: "isBoolean",
  1942. protocol: 'testing',
  1943. fn: function (){
  1944. var self=this;
  1945. return false;
  1946. },
  1947. args: [],
  1948. source: "isBoolean\x0a\x09^ false",
  1949. referencedClasses: [],
  1950. messageSends: []
  1951. }),
  1952. $globals.Object);
  1953. $core.addMethod(
  1954. $core.method({
  1955. selector: "isClass",
  1956. protocol: 'testing',
  1957. fn: function (){
  1958. var self=this;
  1959. return false;
  1960. },
  1961. args: [],
  1962. source: "isClass\x0a\x09^ false",
  1963. referencedClasses: [],
  1964. messageSends: []
  1965. }),
  1966. $globals.Object);
  1967. $core.addMethod(
  1968. $core.method({
  1969. selector: "isCompiledMethod",
  1970. protocol: 'testing',
  1971. fn: function (){
  1972. var self=this;
  1973. return false;
  1974. },
  1975. args: [],
  1976. source: "isCompiledMethod\x0a\x09^ false",
  1977. referencedClasses: [],
  1978. messageSends: []
  1979. }),
  1980. $globals.Object);
  1981. $core.addMethod(
  1982. $core.method({
  1983. selector: "isImmutable",
  1984. protocol: 'testing',
  1985. fn: function (){
  1986. var self=this;
  1987. return false;
  1988. },
  1989. args: [],
  1990. source: "isImmutable\x0a\x09^ false",
  1991. referencedClasses: [],
  1992. messageSends: []
  1993. }),
  1994. $globals.Object);
  1995. $core.addMethod(
  1996. $core.method({
  1997. selector: "isMemberOf:",
  1998. protocol: 'testing',
  1999. fn: function (aClass){
  2000. var self=this;
  2001. return $core.withContext(function($ctx1) {
  2002. var $1;
  2003. $1=$recv(self._class()).__eq(aClass);
  2004. return $1;
  2005. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  2006. },
  2007. args: ["aClass"],
  2008. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  2009. referencedClasses: [],
  2010. messageSends: ["=", "class"]
  2011. }),
  2012. $globals.Object);
  2013. $core.addMethod(
  2014. $core.method({
  2015. selector: "isMetaclass",
  2016. protocol: 'testing',
  2017. fn: function (){
  2018. var self=this;
  2019. return false;
  2020. },
  2021. args: [],
  2022. source: "isMetaclass\x0a\x09^ false",
  2023. referencedClasses: [],
  2024. messageSends: []
  2025. }),
  2026. $globals.Object);
  2027. $core.addMethod(
  2028. $core.method({
  2029. selector: "isNumber",
  2030. protocol: 'testing',
  2031. fn: function (){
  2032. var self=this;
  2033. return false;
  2034. },
  2035. args: [],
  2036. source: "isNumber\x0a\x09^ false",
  2037. referencedClasses: [],
  2038. messageSends: []
  2039. }),
  2040. $globals.Object);
  2041. $core.addMethod(
  2042. $core.method({
  2043. selector: "isPackage",
  2044. protocol: 'testing',
  2045. fn: function (){
  2046. var self=this;
  2047. return false;
  2048. },
  2049. args: [],
  2050. source: "isPackage\x0a\x09^ false",
  2051. referencedClasses: [],
  2052. messageSends: []
  2053. }),
  2054. $globals.Object);
  2055. $core.addMethod(
  2056. $core.method({
  2057. selector: "isParseFailure",
  2058. protocol: 'testing',
  2059. fn: function (){
  2060. var self=this;
  2061. return false;
  2062. },
  2063. args: [],
  2064. source: "isParseFailure\x0a\x09^ false",
  2065. referencedClasses: [],
  2066. messageSends: []
  2067. }),
  2068. $globals.Object);
  2069. $core.addMethod(
  2070. $core.method({
  2071. selector: "isString",
  2072. protocol: 'testing',
  2073. fn: function (){
  2074. var self=this;
  2075. return false;
  2076. },
  2077. args: [],
  2078. source: "isString\x0a\x09^ false",
  2079. referencedClasses: [],
  2080. messageSends: []
  2081. }),
  2082. $globals.Object);
  2083. $core.addMethod(
  2084. $core.method({
  2085. selector: "isSymbol",
  2086. protocol: 'testing',
  2087. fn: function (){
  2088. var self=this;
  2089. return false;
  2090. },
  2091. args: [],
  2092. source: "isSymbol\x0a\x09^ false",
  2093. referencedClasses: [],
  2094. messageSends: []
  2095. }),
  2096. $globals.Object);
  2097. $core.addMethod(
  2098. $core.method({
  2099. selector: "postCopy",
  2100. protocol: 'copying',
  2101. fn: function (){
  2102. var self=this;
  2103. return self;
  2104. },
  2105. args: [],
  2106. source: "postCopy",
  2107. referencedClasses: [],
  2108. messageSends: []
  2109. }),
  2110. $globals.Object);
  2111. $core.addMethod(
  2112. $core.method({
  2113. selector: "putOn:",
  2114. protocol: 'streaming',
  2115. fn: function (aStream){
  2116. var self=this;
  2117. return $core.withContext(function($ctx1) {
  2118. $recv(aStream)._nextPut_(self);
  2119. return self;
  2120. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  2121. },
  2122. args: ["aStream"],
  2123. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  2124. referencedClasses: [],
  2125. messageSends: ["nextPut:"]
  2126. }),
  2127. $globals.Object);
  2128. $core.addMethod(
  2129. $core.method({
  2130. selector: "respondsTo:",
  2131. protocol: 'testing',
  2132. fn: function (aSelector){
  2133. var self=this;
  2134. return $core.withContext(function($ctx1) {
  2135. var $1;
  2136. $1=$recv(self._class())._canUnderstand_(aSelector);
  2137. return $1;
  2138. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  2139. },
  2140. args: ["aSelector"],
  2141. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  2142. referencedClasses: [],
  2143. messageSends: ["canUnderstand:", "class"]
  2144. }),
  2145. $globals.Object);
  2146. $core.addMethod(
  2147. $core.method({
  2148. selector: "shallowCopy",
  2149. protocol: 'copying',
  2150. fn: function (){
  2151. var self=this;
  2152. return $core.withContext(function($ctx1) {
  2153. var copy = self.klass._new();
  2154. Object.keys(self).forEach(function(i) {
  2155. if(/^@.+/.test(i)) {
  2156. copy[i] = self[i];
  2157. }
  2158. });
  2159. return copy;
  2160. ;
  2161. return self;
  2162. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  2163. },
  2164. args: [],
  2165. source: "shallowCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09Object.keys(self).forEach(function(i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09>",
  2166. referencedClasses: [],
  2167. messageSends: []
  2168. }),
  2169. $globals.Object);
  2170. $core.addMethod(
  2171. $core.method({
  2172. selector: "shouldNotImplement",
  2173. protocol: 'error handling',
  2174. fn: function (){
  2175. var self=this;
  2176. return $core.withContext(function($ctx1) {
  2177. self._error_("This method should not be implemented in ".__comma($recv(self._class())._name()));
  2178. return self;
  2179. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  2180. },
  2181. args: [],
  2182. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  2183. referencedClasses: [],
  2184. messageSends: ["error:", ",", "name", "class"]
  2185. }),
  2186. $globals.Object);
  2187. $core.addMethod(
  2188. $core.method({
  2189. selector: "size",
  2190. protocol: 'accessing',
  2191. fn: function (){
  2192. var self=this;
  2193. return $core.withContext(function($ctx1) {
  2194. self._error_("Object not indexable");
  2195. return self;
  2196. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  2197. },
  2198. args: [],
  2199. source: "size\x0a\x09self error: 'Object not indexable'",
  2200. referencedClasses: [],
  2201. messageSends: ["error:"]
  2202. }),
  2203. $globals.Object);
  2204. $core.addMethod(
  2205. $core.method({
  2206. selector: "subclassResponsibility",
  2207. protocol: 'error handling',
  2208. fn: function (){
  2209. var self=this;
  2210. return $core.withContext(function($ctx1) {
  2211. self._error_("This method is a responsibility of a subclass");
  2212. return self;
  2213. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  2214. },
  2215. args: [],
  2216. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  2217. referencedClasses: [],
  2218. messageSends: ["error:"]
  2219. }),
  2220. $globals.Object);
  2221. $core.addMethod(
  2222. $core.method({
  2223. selector: "throw:",
  2224. protocol: 'error handling',
  2225. fn: function (anObject){
  2226. var self=this;
  2227. return $core.withContext(function($ctx1) {
  2228. throw anObject ;
  2229. return self;
  2230. }, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},$globals.Object)});
  2231. },
  2232. args: ["anObject"],
  2233. source: "throw: anObject\x0a\x09< throw anObject >",
  2234. referencedClasses: [],
  2235. messageSends: []
  2236. }),
  2237. $globals.Object);
  2238. $core.addMethod(
  2239. $core.method({
  2240. selector: "value",
  2241. protocol: 'evaluating',
  2242. fn: function (){
  2243. var self=this;
  2244. return $core.withContext(function($ctx1) {
  2245. return self.valueOf();
  2246. return self;
  2247. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  2248. },
  2249. args: [],
  2250. source: "value\x0a\x09<return self.valueOf()>",
  2251. referencedClasses: [],
  2252. messageSends: []
  2253. }),
  2254. $globals.Object);
  2255. $core.addMethod(
  2256. $core.method({
  2257. selector: "accessorProtocolWith:",
  2258. protocol: 'helios',
  2259. fn: function (aGenerator){
  2260. var self=this;
  2261. return $core.withContext(function($ctx1) {
  2262. $recv(aGenerator)._accessorProtocolForObject();
  2263. return self;
  2264. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2265. },
  2266. args: ["aGenerator"],
  2267. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  2268. referencedClasses: [],
  2269. messageSends: ["accessorProtocolForObject"]
  2270. }),
  2271. $globals.Object.klass);
  2272. $core.addMethod(
  2273. $core.method({
  2274. selector: "accessorsSourceCodesWith:",
  2275. protocol: 'helios',
  2276. fn: function (aGenerator){
  2277. var self=this;
  2278. return $core.withContext(function($ctx1) {
  2279. $recv(aGenerator)._accessorsForObject();
  2280. return self;
  2281. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2282. },
  2283. args: ["aGenerator"],
  2284. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  2285. referencedClasses: [],
  2286. messageSends: ["accessorsForObject"]
  2287. }),
  2288. $globals.Object.klass);
  2289. $core.addMethod(
  2290. $core.method({
  2291. selector: "initialize",
  2292. protocol: 'initialization',
  2293. fn: function (){
  2294. var self=this;
  2295. return self;
  2296. },
  2297. args: [],
  2298. source: "initialize\x0a\x09\x22no op\x22",
  2299. referencedClasses: [],
  2300. messageSends: []
  2301. }),
  2302. $globals.Object.klass);
  2303. $core.addMethod(
  2304. $core.method({
  2305. selector: "initializeProtocolWith:",
  2306. protocol: 'helios',
  2307. fn: function (aGenerator){
  2308. var self=this;
  2309. return $core.withContext(function($ctx1) {
  2310. $recv(aGenerator)._initializeProtocolForObject();
  2311. return self;
  2312. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2313. },
  2314. args: ["aGenerator"],
  2315. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  2316. referencedClasses: [],
  2317. messageSends: ["initializeProtocolForObject"]
  2318. }),
  2319. $globals.Object.klass);
  2320. $core.addMethod(
  2321. $core.method({
  2322. selector: "initializeSourceCodesWith:",
  2323. protocol: 'helios',
  2324. fn: function (aGenerator){
  2325. var self=this;
  2326. return $core.withContext(function($ctx1) {
  2327. $recv(aGenerator)._initializeForObject();
  2328. return self;
  2329. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2330. },
  2331. args: ["aGenerator"],
  2332. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  2333. referencedClasses: [],
  2334. messageSends: ["initializeForObject"]
  2335. }),
  2336. $globals.Object.klass);
  2337. $core.addClass('Boolean', $globals.Object, [], 'Kernel-Objects');
  2338. $globals.Boolean.comment="I define the protocol for logic testing operations and conditional control structures for the logical values (see the `controlling` protocol).\x0a\x0aI have two instances, `true` and `false`.\x0a\x0aI am directly mapped to JavaScript Boolean. The `true` and `false` objects are the JavaScript boolean objects.\x0a\x0a## Usage Example:\x0a\x0a aBoolean not ifTrue: [ ... ] ifFalse: [ ... ]";
  2339. $core.addMethod(
  2340. $core.method({
  2341. selector: "&",
  2342. protocol: 'controlling',
  2343. fn: function (aBoolean){
  2344. var self=this;
  2345. return $core.withContext(function($ctx1) {
  2346. if(self == true) {
  2347. return aBoolean;
  2348. } else {
  2349. return false;
  2350. }
  2351. ;
  2352. return self;
  2353. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  2354. },
  2355. args: ["aBoolean"],
  2356. source: "& aBoolean\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09\x09} else {\x0a\x09\x09return false;\x0a\x09\x09}\x0a\x09>",
  2357. referencedClasses: [],
  2358. messageSends: []
  2359. }),
  2360. $globals.Boolean);
  2361. $core.addMethod(
  2362. $core.method({
  2363. selector: "==",
  2364. protocol: 'comparing',
  2365. fn: function (aBoolean){
  2366. var self=this;
  2367. return $core.withContext(function($ctx1) {
  2368. return aBoolean != null && self.valueOf() === (typeof aBoolean === "boolean" ? aBoolean : aBoolean.valueOf());
  2369. return self;
  2370. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  2371. },
  2372. args: ["aBoolean"],
  2373. source: "== aBoolean\x0a<return aBoolean != null && self.valueOf() === (typeof aBoolean === \x22boolean\x22 ? aBoolean : aBoolean.valueOf())>",
  2374. referencedClasses: [],
  2375. messageSends: []
  2376. }),
  2377. $globals.Boolean);
  2378. $core.addMethod(
  2379. $core.method({
  2380. selector: "and:",
  2381. protocol: 'controlling',
  2382. fn: function (aBlock){
  2383. var self=this;
  2384. return $core.withContext(function($ctx1) {
  2385. var $2,$1;
  2386. $2=self.__eq(true);
  2387. $1=$recv($2)._ifTrue_ifFalse_(aBlock,(function(){
  2388. return false;
  2389. }));
  2390. return $1;
  2391. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  2392. },
  2393. args: ["aBlock"],
  2394. source: "and: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ false ]",
  2395. referencedClasses: [],
  2396. messageSends: ["ifTrue:ifFalse:", "="]
  2397. }),
  2398. $globals.Boolean);
  2399. $core.addMethod(
  2400. $core.method({
  2401. selector: "asBit",
  2402. protocol: 'converting',
  2403. fn: function (){
  2404. var self=this;
  2405. return $core.withContext(function($ctx1) {
  2406. var $1;
  2407. if($core.assert(self)){
  2408. $1=(1);
  2409. } else {
  2410. $1=(0);
  2411. };
  2412. return $1;
  2413. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  2414. },
  2415. args: [],
  2416. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  2417. referencedClasses: [],
  2418. messageSends: ["ifTrue:ifFalse:"]
  2419. }),
  2420. $globals.Boolean);
  2421. $core.addMethod(
  2422. $core.method({
  2423. selector: "asJSON",
  2424. protocol: 'converting',
  2425. fn: function (){
  2426. var self=this;
  2427. return self;
  2428. },
  2429. args: [],
  2430. source: "asJSON\x0a\x09^ self",
  2431. referencedClasses: [],
  2432. messageSends: []
  2433. }),
  2434. $globals.Boolean);
  2435. $core.addMethod(
  2436. $core.method({
  2437. selector: "asString",
  2438. protocol: 'converting',
  2439. fn: function (){
  2440. var self=this;
  2441. return $core.withContext(function($ctx1) {
  2442. return self.toString() ;
  2443. return self;
  2444. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  2445. },
  2446. args: [],
  2447. source: "asString\x0a\x09< return self.toString() >",
  2448. referencedClasses: [],
  2449. messageSends: []
  2450. }),
  2451. $globals.Boolean);
  2452. $core.addMethod(
  2453. $core.method({
  2454. selector: "deepCopy",
  2455. protocol: 'copying',
  2456. fn: function (){
  2457. var self=this;
  2458. return self;
  2459. },
  2460. args: [],
  2461. source: "deepCopy\x0a\x09^ self",
  2462. referencedClasses: [],
  2463. messageSends: []
  2464. }),
  2465. $globals.Boolean);
  2466. $core.addMethod(
  2467. $core.method({
  2468. selector: "ifFalse:",
  2469. protocol: 'controlling',
  2470. fn: function (aBlock){
  2471. var self=this;
  2472. return $core.withContext(function($ctx1) {
  2473. var $1;
  2474. $1=self._ifTrue_ifFalse_((function(){
  2475. }),aBlock);
  2476. return $1;
  2477. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  2478. },
  2479. args: ["aBlock"],
  2480. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  2481. referencedClasses: [],
  2482. messageSends: ["ifTrue:ifFalse:"]
  2483. }),
  2484. $globals.Boolean);
  2485. $core.addMethod(
  2486. $core.method({
  2487. selector: "ifFalse:ifTrue:",
  2488. protocol: 'controlling',
  2489. fn: function (aBlock,anotherBlock){
  2490. var self=this;
  2491. return $core.withContext(function($ctx1) {
  2492. var $1;
  2493. $1=self._ifTrue_ifFalse_(anotherBlock,aBlock);
  2494. return $1;
  2495. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  2496. },
  2497. args: ["aBlock", "anotherBlock"],
  2498. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  2499. referencedClasses: [],
  2500. messageSends: ["ifTrue:ifFalse:"]
  2501. }),
  2502. $globals.Boolean);
  2503. $core.addMethod(
  2504. $core.method({
  2505. selector: "ifTrue:",
  2506. protocol: 'controlling',
  2507. fn: function (aBlock){
  2508. var self=this;
  2509. return $core.withContext(function($ctx1) {
  2510. var $1;
  2511. $1=self._ifTrue_ifFalse_(aBlock,(function(){
  2512. }));
  2513. return $1;
  2514. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  2515. },
  2516. args: ["aBlock"],
  2517. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  2518. referencedClasses: [],
  2519. messageSends: ["ifTrue:ifFalse:"]
  2520. }),
  2521. $globals.Boolean);
  2522. $core.addMethod(
  2523. $core.method({
  2524. selector: "ifTrue:ifFalse:",
  2525. protocol: 'controlling',
  2526. fn: function (aBlock,anotherBlock){
  2527. var self=this;
  2528. return $core.withContext(function($ctx1) {
  2529. if(self == true) {
  2530. return aBlock._value();
  2531. } else {
  2532. return anotherBlock._value();
  2533. }
  2534. ;
  2535. return self;
  2536. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  2537. },
  2538. args: ["aBlock", "anotherBlock"],
  2539. source: "ifTrue: aBlock ifFalse: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBlock._value();\x0a\x09\x09} else {\x0a\x09\x09return anotherBlock._value();\x0a\x09\x09}\x0a\x09>",
  2540. referencedClasses: [],
  2541. messageSends: []
  2542. }),
  2543. $globals.Boolean);
  2544. $core.addMethod(
  2545. $core.method({
  2546. selector: "isBoolean",
  2547. protocol: 'testing',
  2548. fn: function (){
  2549. var self=this;
  2550. return true;
  2551. },
  2552. args: [],
  2553. source: "isBoolean\x0a\x09^ true",
  2554. referencedClasses: [],
  2555. messageSends: []
  2556. }),
  2557. $globals.Boolean);
  2558. $core.addMethod(
  2559. $core.method({
  2560. selector: "isImmutable",
  2561. protocol: 'testing',
  2562. fn: function (){
  2563. var self=this;
  2564. return true;
  2565. },
  2566. args: [],
  2567. source: "isImmutable\x0a\x09^ true",
  2568. referencedClasses: [],
  2569. messageSends: []
  2570. }),
  2571. $globals.Boolean);
  2572. $core.addMethod(
  2573. $core.method({
  2574. selector: "not",
  2575. protocol: 'controlling',
  2576. fn: function (){
  2577. var self=this;
  2578. return $core.withContext(function($ctx1) {
  2579. var $1;
  2580. $1=self.__eq(false);
  2581. return $1;
  2582. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  2583. },
  2584. args: [],
  2585. source: "not\x0a\x09^ self = false",
  2586. referencedClasses: [],
  2587. messageSends: ["="]
  2588. }),
  2589. $globals.Boolean);
  2590. $core.addMethod(
  2591. $core.method({
  2592. selector: "or:",
  2593. protocol: 'controlling',
  2594. fn: function (aBlock){
  2595. var self=this;
  2596. return $core.withContext(function($ctx1) {
  2597. var $2,$1;
  2598. $2=self.__eq(true);
  2599. $1=$recv($2)._ifTrue_ifFalse_((function(){
  2600. return true;
  2601. }),aBlock);
  2602. return $1;
  2603. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  2604. },
  2605. args: ["aBlock"],
  2606. source: "or: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: aBlock",
  2607. referencedClasses: [],
  2608. messageSends: ["ifTrue:ifFalse:", "="]
  2609. }),
  2610. $globals.Boolean);
  2611. $core.addMethod(
  2612. $core.method({
  2613. selector: "printOn:",
  2614. protocol: 'printing',
  2615. fn: function (aStream){
  2616. var self=this;
  2617. return $core.withContext(function($ctx1) {
  2618. $recv(aStream)._nextPutAll_(self._asString());
  2619. return self;
  2620. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  2621. },
  2622. args: ["aStream"],
  2623. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  2624. referencedClasses: [],
  2625. messageSends: ["nextPutAll:", "asString"]
  2626. }),
  2627. $globals.Boolean);
  2628. $core.addMethod(
  2629. $core.method({
  2630. selector: "shallowCopy",
  2631. protocol: 'copying',
  2632. fn: function (){
  2633. var self=this;
  2634. return self;
  2635. },
  2636. args: [],
  2637. source: "shallowCopy\x0a\x09^ self",
  2638. referencedClasses: [],
  2639. messageSends: []
  2640. }),
  2641. $globals.Boolean);
  2642. $core.addMethod(
  2643. $core.method({
  2644. selector: "|",
  2645. protocol: 'controlling',
  2646. fn: function (aBoolean){
  2647. var self=this;
  2648. return $core.withContext(function($ctx1) {
  2649. if(self == true) {
  2650. return true;
  2651. } else {
  2652. return aBoolean;
  2653. }
  2654. ;
  2655. return self;
  2656. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  2657. },
  2658. args: ["aBoolean"],
  2659. source: "| aBoolean\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return true;\x0a\x09\x09} else {\x0a\x09\x09return aBoolean;\x0a\x09\x09}\x0a\x09>",
  2660. referencedClasses: [],
  2661. messageSends: []
  2662. }),
  2663. $globals.Boolean);
  2664. $core.addClass('Date', $globals.Object, [], 'Kernel-Objects');
  2665. $globals.Date.comment="I am used to work with both dates and times. Therefore `Date today` and `Date now` are both valid in\x0aAmber and answer the same date object.\x0a\x0aDate directly maps to the `Date()` JavaScript constructor, and Amber date objects are JavaScript date objects.\x0a\x0a## API\x0a\x0aThe class-side `instance creation` protocol contains some convenience methods for creating date/time objects such as `#fromSeconds:`.\x0a\x0aArithmetic and comparison is supported (see the `comparing` and `arithmetic` protocols).\x0a\x0aThe `converting` protocol provides convenience methods for various convertions (to numbers, strings, etc.).";
  2666. $core.addMethod(
  2667. $core.method({
  2668. selector: "+",
  2669. protocol: 'arithmetic',
  2670. fn: function (aDate){
  2671. var self=this;
  2672. return $core.withContext(function($ctx1) {
  2673. return self + aDate;
  2674. return self;
  2675. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  2676. },
  2677. args: ["aDate"],
  2678. source: "+ aDate\x0a\x09<return self + aDate>",
  2679. referencedClasses: [],
  2680. messageSends: []
  2681. }),
  2682. $globals.Date);
  2683. $core.addMethod(
  2684. $core.method({
  2685. selector: "-",
  2686. protocol: 'arithmetic',
  2687. fn: function (aDate){
  2688. var self=this;
  2689. return $core.withContext(function($ctx1) {
  2690. return self - aDate;
  2691. return self;
  2692. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  2693. },
  2694. args: ["aDate"],
  2695. source: "- aDate\x0a\x09<return self - aDate>",
  2696. referencedClasses: [],
  2697. messageSends: []
  2698. }),
  2699. $globals.Date);
  2700. $core.addMethod(
  2701. $core.method({
  2702. selector: "<",
  2703. protocol: 'comparing',
  2704. fn: function (aDate){
  2705. var self=this;
  2706. return $core.withContext(function($ctx1) {
  2707. return self < aDate;
  2708. return self;
  2709. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  2710. },
  2711. args: ["aDate"],
  2712. source: "< aDate\x0a\x09<return self < aDate>",
  2713. referencedClasses: [],
  2714. messageSends: []
  2715. }),
  2716. $globals.Date);
  2717. $core.addMethod(
  2718. $core.method({
  2719. selector: "<=",
  2720. protocol: 'comparing',
  2721. fn: function (aDate){
  2722. var self=this;
  2723. return $core.withContext(function($ctx1) {
  2724. return self <= aDate;
  2725. return self;
  2726. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  2727. },
  2728. args: ["aDate"],
  2729. source: "<= aDate\x0a\x09<return self <= aDate>",
  2730. referencedClasses: [],
  2731. messageSends: []
  2732. }),
  2733. $globals.Date);
  2734. $core.addMethod(
  2735. $core.method({
  2736. selector: "=",
  2737. protocol: 'comparing',
  2738. fn: function (aDate){
  2739. var self=this;
  2740. return $core.withContext(function($ctx1) {
  2741. var $3,$2,$4,$1;
  2742. $3=$recv(aDate)._class();
  2743. $ctx1.sendIdx["class"]=1;
  2744. $2=$recv($3).__eq_eq(self._class());
  2745. $ctx1.sendIdx["=="]=1;
  2746. $1=$recv($2)._and_((function(){
  2747. return $core.withContext(function($ctx2) {
  2748. $4=self._asMilliseconds();
  2749. $ctx2.sendIdx["asMilliseconds"]=1;
  2750. return $recv($4).__eq_eq($recv(aDate)._asMilliseconds());
  2751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2752. }));
  2753. return $1;
  2754. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  2755. },
  2756. args: ["aDate"],
  2757. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  2758. referencedClasses: [],
  2759. messageSends: ["and:", "==", "class", "asMilliseconds"]
  2760. }),
  2761. $globals.Date);
  2762. $core.addMethod(
  2763. $core.method({
  2764. selector: ">",
  2765. protocol: 'comparing',
  2766. fn: function (aDate){
  2767. var self=this;
  2768. return $core.withContext(function($ctx1) {
  2769. return self > aDate;
  2770. return self;
  2771. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)});
  2772. },
  2773. args: ["aDate"],
  2774. source: "> aDate\x0a\x09<return self >> aDate>",
  2775. referencedClasses: [],
  2776. messageSends: []
  2777. }),
  2778. $globals.Date);
  2779. $core.addMethod(
  2780. $core.method({
  2781. selector: ">=",
  2782. protocol: 'comparing',
  2783. fn: function (aDate){
  2784. var self=this;
  2785. return $core.withContext(function($ctx1) {
  2786. return self >= aDate;
  2787. return self;
  2788. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  2789. },
  2790. args: ["aDate"],
  2791. source: ">= aDate\x0a\x09<return self >>= aDate>",
  2792. referencedClasses: [],
  2793. messageSends: []
  2794. }),
  2795. $globals.Date);
  2796. $core.addMethod(
  2797. $core.method({
  2798. selector: "asDateString",
  2799. protocol: 'converting',
  2800. fn: function (){
  2801. var self=this;
  2802. return $core.withContext(function($ctx1) {
  2803. return self.toDateString();
  2804. return self;
  2805. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  2806. },
  2807. args: [],
  2808. source: "asDateString\x0a\x09<return self.toDateString()>",
  2809. referencedClasses: [],
  2810. messageSends: []
  2811. }),
  2812. $globals.Date);
  2813. $core.addMethod(
  2814. $core.method({
  2815. selector: "asLocaleString",
  2816. protocol: 'converting',
  2817. fn: function (){
  2818. var self=this;
  2819. return $core.withContext(function($ctx1) {
  2820. return self.toLocaleString();
  2821. return self;
  2822. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  2823. },
  2824. args: [],
  2825. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  2826. referencedClasses: [],
  2827. messageSends: []
  2828. }),
  2829. $globals.Date);
  2830. $core.addMethod(
  2831. $core.method({
  2832. selector: "asMilliseconds",
  2833. protocol: 'converting',
  2834. fn: function (){
  2835. var self=this;
  2836. return $core.withContext(function($ctx1) {
  2837. var $1;
  2838. $1=self._time();
  2839. return $1;
  2840. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  2841. },
  2842. args: [],
  2843. source: "asMilliseconds\x0a\x09^ self time",
  2844. referencedClasses: [],
  2845. messageSends: ["time"]
  2846. }),
  2847. $globals.Date);
  2848. $core.addMethod(
  2849. $core.method({
  2850. selector: "asNumber",
  2851. protocol: 'converting',
  2852. fn: function (){
  2853. var self=this;
  2854. return $core.withContext(function($ctx1) {
  2855. var $1;
  2856. $1=self._asMilliseconds();
  2857. return $1;
  2858. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  2859. },
  2860. args: [],
  2861. source: "asNumber\x0a\x09^ self asMilliseconds",
  2862. referencedClasses: [],
  2863. messageSends: ["asMilliseconds"]
  2864. }),
  2865. $globals.Date);
  2866. $core.addMethod(
  2867. $core.method({
  2868. selector: "asString",
  2869. protocol: 'converting',
  2870. fn: function (){
  2871. var self=this;
  2872. return $core.withContext(function($ctx1) {
  2873. return self.toString();
  2874. return self;
  2875. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  2876. },
  2877. args: [],
  2878. source: "asString\x0a\x09<return self.toString()>",
  2879. referencedClasses: [],
  2880. messageSends: []
  2881. }),
  2882. $globals.Date);
  2883. $core.addMethod(
  2884. $core.method({
  2885. selector: "asTimeString",
  2886. protocol: 'converting',
  2887. fn: function (){
  2888. var self=this;
  2889. return $core.withContext(function($ctx1) {
  2890. return self.toTimeString();
  2891. return self;
  2892. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  2893. },
  2894. args: [],
  2895. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  2896. referencedClasses: [],
  2897. messageSends: []
  2898. }),
  2899. $globals.Date);
  2900. $core.addMethod(
  2901. $core.method({
  2902. selector: "day",
  2903. protocol: 'accessing',
  2904. fn: function (){
  2905. var self=this;
  2906. return $core.withContext(function($ctx1) {
  2907. var $1;
  2908. $1=self._dayOfWeek();
  2909. return $1;
  2910. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  2911. },
  2912. args: [],
  2913. source: "day\x0a\x09^ self dayOfWeek",
  2914. referencedClasses: [],
  2915. messageSends: ["dayOfWeek"]
  2916. }),
  2917. $globals.Date);
  2918. $core.addMethod(
  2919. $core.method({
  2920. selector: "day:",
  2921. protocol: 'accessing',
  2922. fn: function (aNumber){
  2923. var self=this;
  2924. return $core.withContext(function($ctx1) {
  2925. self._dayOfWeek_(aNumber);
  2926. return self;
  2927. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  2928. },
  2929. args: ["aNumber"],
  2930. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  2931. referencedClasses: [],
  2932. messageSends: ["dayOfWeek:"]
  2933. }),
  2934. $globals.Date);
  2935. $core.addMethod(
  2936. $core.method({
  2937. selector: "dayOfMonth",
  2938. protocol: 'accessing',
  2939. fn: function (){
  2940. var self=this;
  2941. return $core.withContext(function($ctx1) {
  2942. return self.getDate();
  2943. return self;
  2944. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  2945. },
  2946. args: [],
  2947. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  2948. referencedClasses: [],
  2949. messageSends: []
  2950. }),
  2951. $globals.Date);
  2952. $core.addMethod(
  2953. $core.method({
  2954. selector: "dayOfMonth:",
  2955. protocol: 'accessing',
  2956. fn: function (aNumber){
  2957. var self=this;
  2958. return $core.withContext(function($ctx1) {
  2959. self.setDate(aNumber);
  2960. return self;
  2961. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  2962. },
  2963. args: ["aNumber"],
  2964. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  2965. referencedClasses: [],
  2966. messageSends: []
  2967. }),
  2968. $globals.Date);
  2969. $core.addMethod(
  2970. $core.method({
  2971. selector: "dayOfWeek",
  2972. protocol: 'accessing',
  2973. fn: function (){
  2974. var self=this;
  2975. return $core.withContext(function($ctx1) {
  2976. return self.getDay() + 1;
  2977. return self;
  2978. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  2979. },
  2980. args: [],
  2981. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  2982. referencedClasses: [],
  2983. messageSends: []
  2984. }),
  2985. $globals.Date);
  2986. $core.addMethod(
  2987. $core.method({
  2988. selector: "dayOfWeek:",
  2989. protocol: 'accessing',
  2990. fn: function (aNumber){
  2991. var self=this;
  2992. return $core.withContext(function($ctx1) {
  2993. return self.setDay(aNumber - 1);
  2994. return self;
  2995. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  2996. },
  2997. args: ["aNumber"],
  2998. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  2999. referencedClasses: [],
  3000. messageSends: []
  3001. }),
  3002. $globals.Date);
  3003. $core.addMethod(
  3004. $core.method({
  3005. selector: "hours",
  3006. protocol: 'accessing',
  3007. fn: function (){
  3008. var self=this;
  3009. return $core.withContext(function($ctx1) {
  3010. return self.getHours();
  3011. return self;
  3012. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  3013. },
  3014. args: [],
  3015. source: "hours\x0a\x09<return self.getHours()>",
  3016. referencedClasses: [],
  3017. messageSends: []
  3018. }),
  3019. $globals.Date);
  3020. $core.addMethod(
  3021. $core.method({
  3022. selector: "hours:",
  3023. protocol: 'accessing',
  3024. fn: function (aNumber){
  3025. var self=this;
  3026. return $core.withContext(function($ctx1) {
  3027. self.setHours(aNumber);
  3028. return self;
  3029. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  3030. },
  3031. args: ["aNumber"],
  3032. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  3033. referencedClasses: [],
  3034. messageSends: []
  3035. }),
  3036. $globals.Date);
  3037. $core.addMethod(
  3038. $core.method({
  3039. selector: "milliseconds",
  3040. protocol: 'accessing',
  3041. fn: function (){
  3042. var self=this;
  3043. return $core.withContext(function($ctx1) {
  3044. return self.getMilliseconds();
  3045. return self;
  3046. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  3047. },
  3048. args: [],
  3049. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  3050. referencedClasses: [],
  3051. messageSends: []
  3052. }),
  3053. $globals.Date);
  3054. $core.addMethod(
  3055. $core.method({
  3056. selector: "milliseconds:",
  3057. protocol: 'accessing',
  3058. fn: function (aNumber){
  3059. var self=this;
  3060. return $core.withContext(function($ctx1) {
  3061. self.setMilliseconds(aNumber);
  3062. return self;
  3063. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  3064. },
  3065. args: ["aNumber"],
  3066. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  3067. referencedClasses: [],
  3068. messageSends: []
  3069. }),
  3070. $globals.Date);
  3071. $core.addMethod(
  3072. $core.method({
  3073. selector: "minutes",
  3074. protocol: 'accessing',
  3075. fn: function (){
  3076. var self=this;
  3077. return $core.withContext(function($ctx1) {
  3078. return self.getMinutes();
  3079. return self;
  3080. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  3081. },
  3082. args: [],
  3083. source: "minutes\x0a\x09<return self.getMinutes()>",
  3084. referencedClasses: [],
  3085. messageSends: []
  3086. }),
  3087. $globals.Date);
  3088. $core.addMethod(
  3089. $core.method({
  3090. selector: "minutes:",
  3091. protocol: 'accessing',
  3092. fn: function (aNumber){
  3093. var self=this;
  3094. return $core.withContext(function($ctx1) {
  3095. self.setMinutes(aNumber);
  3096. return self;
  3097. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  3098. },
  3099. args: ["aNumber"],
  3100. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  3101. referencedClasses: [],
  3102. messageSends: []
  3103. }),
  3104. $globals.Date);
  3105. $core.addMethod(
  3106. $core.method({
  3107. selector: "month",
  3108. protocol: 'accessing',
  3109. fn: function (){
  3110. var self=this;
  3111. return $core.withContext(function($ctx1) {
  3112. return self.getMonth() + 1;
  3113. return self;
  3114. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  3115. },
  3116. args: [],
  3117. source: "month\x0a\x09<return self.getMonth() + 1>",
  3118. referencedClasses: [],
  3119. messageSends: []
  3120. }),
  3121. $globals.Date);
  3122. $core.addMethod(
  3123. $core.method({
  3124. selector: "month:",
  3125. protocol: 'accessing',
  3126. fn: function (aNumber){
  3127. var self=this;
  3128. return $core.withContext(function($ctx1) {
  3129. self.setMonth(aNumber - 1);
  3130. return self;
  3131. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  3132. },
  3133. args: ["aNumber"],
  3134. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  3135. referencedClasses: [],
  3136. messageSends: []
  3137. }),
  3138. $globals.Date);
  3139. $core.addMethod(
  3140. $core.method({
  3141. selector: "printOn:",
  3142. protocol: 'printing',
  3143. fn: function (aStream){
  3144. var self=this;
  3145. return $core.withContext(function($ctx1) {
  3146. $recv(aStream)._nextPutAll_(self._asString());
  3147. return self;
  3148. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  3149. },
  3150. args: ["aStream"],
  3151. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3152. referencedClasses: [],
  3153. messageSends: ["nextPutAll:", "asString"]
  3154. }),
  3155. $globals.Date);
  3156. $core.addMethod(
  3157. $core.method({
  3158. selector: "seconds",
  3159. protocol: 'accessing',
  3160. fn: function (){
  3161. var self=this;
  3162. return $core.withContext(function($ctx1) {
  3163. return self.getSeconds();
  3164. return self;
  3165. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  3166. },
  3167. args: [],
  3168. source: "seconds\x0a\x09<return self.getSeconds()>",
  3169. referencedClasses: [],
  3170. messageSends: []
  3171. }),
  3172. $globals.Date);
  3173. $core.addMethod(
  3174. $core.method({
  3175. selector: "seconds:",
  3176. protocol: 'accessing',
  3177. fn: function (aNumber){
  3178. var self=this;
  3179. return $core.withContext(function($ctx1) {
  3180. self.setSeconds(aNumber);
  3181. return self;
  3182. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  3183. },
  3184. args: ["aNumber"],
  3185. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  3186. referencedClasses: [],
  3187. messageSends: []
  3188. }),
  3189. $globals.Date);
  3190. $core.addMethod(
  3191. $core.method({
  3192. selector: "time",
  3193. protocol: 'accessing',
  3194. fn: function (){
  3195. var self=this;
  3196. return $core.withContext(function($ctx1) {
  3197. return self.getTime();
  3198. return self;
  3199. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  3200. },
  3201. args: [],
  3202. source: "time\x0a\x09<return self.getTime()>",
  3203. referencedClasses: [],
  3204. messageSends: []
  3205. }),
  3206. $globals.Date);
  3207. $core.addMethod(
  3208. $core.method({
  3209. selector: "time:",
  3210. protocol: 'accessing',
  3211. fn: function (aNumber){
  3212. var self=this;
  3213. return $core.withContext(function($ctx1) {
  3214. self.setTime(aNumber);
  3215. return self;
  3216. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  3217. },
  3218. args: ["aNumber"],
  3219. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  3220. referencedClasses: [],
  3221. messageSends: []
  3222. }),
  3223. $globals.Date);
  3224. $core.addMethod(
  3225. $core.method({
  3226. selector: "year",
  3227. protocol: 'accessing',
  3228. fn: function (){
  3229. var self=this;
  3230. return $core.withContext(function($ctx1) {
  3231. return self.getFullYear();
  3232. return self;
  3233. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  3234. },
  3235. args: [],
  3236. source: "year\x0a\x09<return self.getFullYear()>",
  3237. referencedClasses: [],
  3238. messageSends: []
  3239. }),
  3240. $globals.Date);
  3241. $core.addMethod(
  3242. $core.method({
  3243. selector: "year:",
  3244. protocol: 'accessing',
  3245. fn: function (aNumber){
  3246. var self=this;
  3247. return $core.withContext(function($ctx1) {
  3248. self.setFullYear(aNumber);
  3249. return self;
  3250. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  3251. },
  3252. args: ["aNumber"],
  3253. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  3254. referencedClasses: [],
  3255. messageSends: []
  3256. }),
  3257. $globals.Date);
  3258. $core.addMethod(
  3259. $core.method({
  3260. selector: "classTag",
  3261. protocol: 'accessing',
  3262. fn: function (){
  3263. var self=this;
  3264. return "magnitude";
  3265. },
  3266. args: [],
  3267. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'magnitude'",
  3268. referencedClasses: [],
  3269. messageSends: []
  3270. }),
  3271. $globals.Date.klass);
  3272. $core.addMethod(
  3273. $core.method({
  3274. selector: "fromMilliseconds:",
  3275. protocol: 'instance creation',
  3276. fn: function (aNumber){
  3277. var self=this;
  3278. return $core.withContext(function($ctx1) {
  3279. var $1;
  3280. $1=self._new_(aNumber);
  3281. return $1;
  3282. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.klass)});
  3283. },
  3284. args: ["aNumber"],
  3285. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  3286. referencedClasses: [],
  3287. messageSends: ["new:"]
  3288. }),
  3289. $globals.Date.klass);
  3290. $core.addMethod(
  3291. $core.method({
  3292. selector: "fromSeconds:",
  3293. protocol: 'instance creation',
  3294. fn: function (aNumber){
  3295. var self=this;
  3296. return $core.withContext(function($ctx1) {
  3297. var $1;
  3298. $1=self._fromMilliseconds_($recv(aNumber).__star((1000)));
  3299. return $1;
  3300. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.klass)});
  3301. },
  3302. args: ["aNumber"],
  3303. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  3304. referencedClasses: [],
  3305. messageSends: ["fromMilliseconds:", "*"]
  3306. }),
  3307. $globals.Date.klass);
  3308. $core.addMethod(
  3309. $core.method({
  3310. selector: "fromString:",
  3311. protocol: 'instance creation',
  3312. fn: function (aString){
  3313. var self=this;
  3314. return $core.withContext(function($ctx1) {
  3315. var $1;
  3316. $1=self._new_(aString);
  3317. return $1;
  3318. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.klass)});
  3319. },
  3320. args: ["aString"],
  3321. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  3322. referencedClasses: [],
  3323. messageSends: ["new:"]
  3324. }),
  3325. $globals.Date.klass);
  3326. $core.addMethod(
  3327. $core.method({
  3328. selector: "millisecondsToRun:",
  3329. protocol: 'instance creation',
  3330. fn: function (aBlock){
  3331. var self=this;
  3332. var t;
  3333. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  3334. return $core.withContext(function($ctx1) {
  3335. var $1;
  3336. t=$recv($Date())._now();
  3337. $ctx1.sendIdx["now"]=1;
  3338. $recv(aBlock)._value();
  3339. $1=$recv($recv($Date())._now()).__minus(t);
  3340. return $1;
  3341. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.klass)});
  3342. },
  3343. args: ["aBlock"],
  3344. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  3345. referencedClasses: ["Date"],
  3346. messageSends: ["now", "value", "-"]
  3347. }),
  3348. $globals.Date.klass);
  3349. $core.addMethod(
  3350. $core.method({
  3351. selector: "new:",
  3352. protocol: 'instance creation',
  3353. fn: function (anObject){
  3354. var self=this;
  3355. return $core.withContext(function($ctx1) {
  3356. return new Date(anObject);
  3357. return self;
  3358. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.klass)});
  3359. },
  3360. args: ["anObject"],
  3361. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  3362. referencedClasses: [],
  3363. messageSends: []
  3364. }),
  3365. $globals.Date.klass);
  3366. $core.addMethod(
  3367. $core.method({
  3368. selector: "now",
  3369. protocol: 'instance creation',
  3370. fn: function (){
  3371. var self=this;
  3372. return $core.withContext(function($ctx1) {
  3373. var $1;
  3374. $1=self._today();
  3375. return $1;
  3376. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.klass)});
  3377. },
  3378. args: [],
  3379. source: "now\x0a\x09^ self today",
  3380. referencedClasses: [],
  3381. messageSends: ["today"]
  3382. }),
  3383. $globals.Date.klass);
  3384. $core.addMethod(
  3385. $core.method({
  3386. selector: "today",
  3387. protocol: 'instance creation',
  3388. fn: function (){
  3389. var self=this;
  3390. return $core.withContext(function($ctx1) {
  3391. var $1;
  3392. $1=self._new();
  3393. return $1;
  3394. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.klass)});
  3395. },
  3396. args: [],
  3397. source: "today\x0a\x09^ self new",
  3398. referencedClasses: [],
  3399. messageSends: ["new"]
  3400. }),
  3401. $globals.Date.klass);
  3402. $core.addClass('Number', $globals.Object, [], 'Kernel-Objects');
  3403. $globals.Number.comment="I am the Amber representation for all numbers.\x0aI am directly mapped to JavaScript Number.\x0a\x0a## API\x0a\x0aI provide all necessary methods for arithmetic operations, comparison, conversion and so on with numbers.\x0a\x0aMy instances can also be used to evaluate a block a fixed number of times:\x0a\x0a\x095 timesRepeat: [ Transcript show: 'This will be printed 5 times'; cr ].\x0a\x09\x0a\x091 to: 5 do: [ :aNumber| Transcript show: aNumber asString; cr ].\x0a\x09\x0a\x091 to: 10 by: 2 do: [ :aNumber| Transcript show: aNumber asString; cr ].";
  3404. $core.addMethod(
  3405. $core.method({
  3406. selector: "&",
  3407. protocol: 'converting',
  3408. fn: function (aNumber){
  3409. var self=this;
  3410. return $core.withContext(function($ctx1) {
  3411. return self & aNumber;
  3412. return self;
  3413. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  3414. },
  3415. args: ["aNumber"],
  3416. source: "& aNumber\x0a\x09<return self & aNumber>",
  3417. referencedClasses: [],
  3418. messageSends: []
  3419. }),
  3420. $globals.Number);
  3421. $core.addMethod(
  3422. $core.method({
  3423. selector: "*",
  3424. protocol: 'arithmetic',
  3425. fn: function (aNumber){
  3426. var self=this;
  3427. return $core.withContext(function($ctx1) {
  3428. return self * aNumber;
  3429. return self;
  3430. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  3431. },
  3432. args: ["aNumber"],
  3433. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  3434. referencedClasses: [],
  3435. messageSends: []
  3436. }),
  3437. $globals.Number);
  3438. $core.addMethod(
  3439. $core.method({
  3440. selector: "**",
  3441. protocol: 'mathematical functions',
  3442. fn: function (exponent){
  3443. var self=this;
  3444. return $core.withContext(function($ctx1) {
  3445. var $1;
  3446. $1=self._raisedTo_(exponent);
  3447. return $1;
  3448. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  3449. },
  3450. args: ["exponent"],
  3451. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  3452. referencedClasses: [],
  3453. messageSends: ["raisedTo:"]
  3454. }),
  3455. $globals.Number);
  3456. $core.addMethod(
  3457. $core.method({
  3458. selector: "+",
  3459. protocol: 'arithmetic',
  3460. fn: function (aNumber){
  3461. var self=this;
  3462. return $core.withContext(function($ctx1) {
  3463. return self + aNumber;
  3464. return self;
  3465. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  3466. },
  3467. args: ["aNumber"],
  3468. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  3469. referencedClasses: [],
  3470. messageSends: []
  3471. }),
  3472. $globals.Number);
  3473. $core.addMethod(
  3474. $core.method({
  3475. selector: "-",
  3476. protocol: 'arithmetic',
  3477. fn: function (aNumber){
  3478. var self=this;
  3479. return $core.withContext(function($ctx1) {
  3480. return self - aNumber;
  3481. return self;
  3482. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  3483. },
  3484. args: ["aNumber"],
  3485. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  3486. referencedClasses: [],
  3487. messageSends: []
  3488. }),
  3489. $globals.Number);
  3490. $core.addMethod(
  3491. $core.method({
  3492. selector: "/",
  3493. protocol: 'arithmetic',
  3494. fn: function (aNumber){
  3495. var self=this;
  3496. return $core.withContext(function($ctx1) {
  3497. return self / aNumber;
  3498. return self;
  3499. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  3500. },
  3501. args: ["aNumber"],
  3502. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  3503. referencedClasses: [],
  3504. messageSends: []
  3505. }),
  3506. $globals.Number);
  3507. $core.addMethod(
  3508. $core.method({
  3509. selector: "//",
  3510. protocol: 'arithmetic',
  3511. fn: function (aNumber){
  3512. var self=this;
  3513. return $core.withContext(function($ctx1) {
  3514. var $1;
  3515. $1=$recv(self.__slash(aNumber))._floor();
  3516. return $1;
  3517. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  3518. },
  3519. args: ["aNumber"],
  3520. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  3521. referencedClasses: [],
  3522. messageSends: ["floor", "/"]
  3523. }),
  3524. $globals.Number);
  3525. $core.addMethod(
  3526. $core.method({
  3527. selector: "<",
  3528. protocol: 'comparing',
  3529. fn: function (aNumber){
  3530. var self=this;
  3531. return $core.withContext(function($ctx1) {
  3532. return self < aNumber;
  3533. return self;
  3534. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  3535. },
  3536. args: ["aNumber"],
  3537. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  3538. referencedClasses: [],
  3539. messageSends: []
  3540. }),
  3541. $globals.Number);
  3542. $core.addMethod(
  3543. $core.method({
  3544. selector: "<=",
  3545. protocol: 'comparing',
  3546. fn: function (aNumber){
  3547. var self=this;
  3548. return $core.withContext(function($ctx1) {
  3549. return self <= aNumber;
  3550. return self;
  3551. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  3552. },
  3553. args: ["aNumber"],
  3554. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  3555. referencedClasses: [],
  3556. messageSends: []
  3557. }),
  3558. $globals.Number);
  3559. $core.addMethod(
  3560. $core.method({
  3561. selector: "==",
  3562. protocol: 'comparing',
  3563. fn: function (aNumber){
  3564. var self=this;
  3565. return $core.withContext(function($ctx1) {
  3566. return aNumber != null && Number(self) === (typeof aNumber === "number" ? aNumber : aNumber.valueOf());
  3567. return self;
  3568. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  3569. },
  3570. args: ["aNumber"],
  3571. source: "== aNumber\x0a<return aNumber != null && Number(self) === (typeof aNumber === \x22number\x22 ? aNumber : aNumber.valueOf())>",
  3572. referencedClasses: [],
  3573. messageSends: []
  3574. }),
  3575. $globals.Number);
  3576. $core.addMethod(
  3577. $core.method({
  3578. selector: ">",
  3579. protocol: 'comparing',
  3580. fn: function (aNumber){
  3581. var self=this;
  3582. return $core.withContext(function($ctx1) {
  3583. return self > aNumber;
  3584. return self;
  3585. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  3586. },
  3587. args: ["aNumber"],
  3588. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  3589. referencedClasses: [],
  3590. messageSends: []
  3591. }),
  3592. $globals.Number);
  3593. $core.addMethod(
  3594. $core.method({
  3595. selector: ">=",
  3596. protocol: 'comparing',
  3597. fn: function (aNumber){
  3598. var self=this;
  3599. return $core.withContext(function($ctx1) {
  3600. return self >= aNumber;
  3601. return self;
  3602. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  3603. },
  3604. args: ["aNumber"],
  3605. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  3606. referencedClasses: [],
  3607. messageSends: []
  3608. }),
  3609. $globals.Number);
  3610. $core.addMethod(
  3611. $core.method({
  3612. selector: "@",
  3613. protocol: 'converting',
  3614. fn: function (aNumber){
  3615. var self=this;
  3616. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  3617. return $core.withContext(function($ctx1) {
  3618. var $1;
  3619. $1=$recv($Point())._x_y_(self,aNumber);
  3620. return $1;
  3621. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  3622. },
  3623. args: ["aNumber"],
  3624. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  3625. referencedClasses: ["Point"],
  3626. messageSends: ["x:y:"]
  3627. }),
  3628. $globals.Number);
  3629. $core.addMethod(
  3630. $core.method({
  3631. selector: "\x5c\x5c",
  3632. protocol: 'arithmetic',
  3633. fn: function (aNumber){
  3634. var self=this;
  3635. return $core.withContext(function($ctx1) {
  3636. return self % aNumber;
  3637. return self;
  3638. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  3639. },
  3640. args: ["aNumber"],
  3641. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  3642. referencedClasses: [],
  3643. messageSends: []
  3644. }),
  3645. $globals.Number);
  3646. $core.addMethod(
  3647. $core.method({
  3648. selector: "abs",
  3649. protocol: 'arithmetic',
  3650. fn: function (){
  3651. var self=this;
  3652. return $core.withContext(function($ctx1) {
  3653. return Math.abs(self);;
  3654. return self;
  3655. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  3656. },
  3657. args: [],
  3658. source: "abs\x0a\x09<return Math.abs(self);>",
  3659. referencedClasses: [],
  3660. messageSends: []
  3661. }),
  3662. $globals.Number);
  3663. $core.addMethod(
  3664. $core.method({
  3665. selector: "arcCos",
  3666. protocol: 'mathematical functions',
  3667. fn: function (){
  3668. var self=this;
  3669. return $core.withContext(function($ctx1) {
  3670. return Math.acos(self);;
  3671. return self;
  3672. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  3673. },
  3674. args: [],
  3675. source: "arcCos\x0a\x09<return Math.acos(self);>",
  3676. referencedClasses: [],
  3677. messageSends: []
  3678. }),
  3679. $globals.Number);
  3680. $core.addMethod(
  3681. $core.method({
  3682. selector: "arcSin",
  3683. protocol: 'mathematical functions',
  3684. fn: function (){
  3685. var self=this;
  3686. return $core.withContext(function($ctx1) {
  3687. return Math.asin(self);;
  3688. return self;
  3689. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  3690. },
  3691. args: [],
  3692. source: "arcSin\x0a\x09<return Math.asin(self);>",
  3693. referencedClasses: [],
  3694. messageSends: []
  3695. }),
  3696. $globals.Number);
  3697. $core.addMethod(
  3698. $core.method({
  3699. selector: "arcTan",
  3700. protocol: 'mathematical functions',
  3701. fn: function (){
  3702. var self=this;
  3703. return $core.withContext(function($ctx1) {
  3704. return Math.atan(self);;
  3705. return self;
  3706. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  3707. },
  3708. args: [],
  3709. source: "arcTan\x0a\x09<return Math.atan(self);>",
  3710. referencedClasses: [],
  3711. messageSends: []
  3712. }),
  3713. $globals.Number);
  3714. $core.addMethod(
  3715. $core.method({
  3716. selector: "asJSON",
  3717. protocol: 'converting',
  3718. fn: function (){
  3719. var self=this;
  3720. return self;
  3721. },
  3722. args: [],
  3723. source: "asJSON\x0a\x09^ self",
  3724. referencedClasses: [],
  3725. messageSends: []
  3726. }),
  3727. $globals.Number);
  3728. $core.addMethod(
  3729. $core.method({
  3730. selector: "asJavascript",
  3731. protocol: 'converting',
  3732. fn: function (){
  3733. var self=this;
  3734. return $core.withContext(function($ctx1) {
  3735. var $1;
  3736. $1=$recv("(".__comma(self._printString())).__comma(")");
  3737. $ctx1.sendIdx[","]=1;
  3738. return $1;
  3739. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Number)});
  3740. },
  3741. args: [],
  3742. source: "asJavascript\x0a\x09^ '(', self printString, ')'",
  3743. referencedClasses: [],
  3744. messageSends: [",", "printString"]
  3745. }),
  3746. $globals.Number);
  3747. $core.addMethod(
  3748. $core.method({
  3749. selector: "asNumber",
  3750. protocol: 'converting',
  3751. fn: function (){
  3752. var self=this;
  3753. return self;
  3754. },
  3755. args: [],
  3756. source: "asNumber\x0a\x09^ self",
  3757. referencedClasses: [],
  3758. messageSends: []
  3759. }),
  3760. $globals.Number);
  3761. $core.addMethod(
  3762. $core.method({
  3763. selector: "asPoint",
  3764. protocol: 'converting',
  3765. fn: function (){
  3766. var self=this;
  3767. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  3768. return $core.withContext(function($ctx1) {
  3769. var $1;
  3770. $1=$recv($Point())._x_y_(self,self);
  3771. return $1;
  3772. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  3773. },
  3774. args: [],
  3775. source: "asPoint\x0a\x09^ Point x: self y: self",
  3776. referencedClasses: ["Point"],
  3777. messageSends: ["x:y:"]
  3778. }),
  3779. $globals.Number);
  3780. $core.addMethod(
  3781. $core.method({
  3782. selector: "asString",
  3783. protocol: 'converting',
  3784. fn: function (){
  3785. var self=this;
  3786. return $core.withContext(function($ctx1) {
  3787. return String(self) ;
  3788. return self;
  3789. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  3790. },
  3791. args: [],
  3792. source: "asString\x0a\x09< return String(self) >",
  3793. referencedClasses: [],
  3794. messageSends: []
  3795. }),
  3796. $globals.Number);
  3797. $core.addMethod(
  3798. $core.method({
  3799. selector: "atRandom",
  3800. protocol: 'converting',
  3801. fn: function (){
  3802. var self=this;
  3803. function $Random(){return $globals.Random||(typeof Random=="undefined"?nil:Random)}
  3804. return $core.withContext(function($ctx1) {
  3805. var $1;
  3806. $1=$recv($recv($recv($recv($recv($Random())._new())._next()).__star(self))._truncated()).__plus((1));
  3807. return $1;
  3808. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  3809. },
  3810. args: [],
  3811. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  3812. referencedClasses: ["Random"],
  3813. messageSends: ["+", "truncated", "*", "next", "new"]
  3814. }),
  3815. $globals.Number);
  3816. $core.addMethod(
  3817. $core.method({
  3818. selector: "ceiling",
  3819. protocol: 'converting',
  3820. fn: function (){
  3821. var self=this;
  3822. return $core.withContext(function($ctx1) {
  3823. return Math.ceil(self);;
  3824. return self;
  3825. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  3826. },
  3827. args: [],
  3828. source: "ceiling\x0a\x09<return Math.ceil(self);>",
  3829. referencedClasses: [],
  3830. messageSends: []
  3831. }),
  3832. $globals.Number);
  3833. $core.addMethod(
  3834. $core.method({
  3835. selector: "copy",
  3836. protocol: 'copying',
  3837. fn: function (){
  3838. var self=this;
  3839. return self;
  3840. },
  3841. args: [],
  3842. source: "copy\x0a\x09^ self",
  3843. referencedClasses: [],
  3844. messageSends: []
  3845. }),
  3846. $globals.Number);
  3847. $core.addMethod(
  3848. $core.method({
  3849. selector: "cos",
  3850. protocol: 'mathematical functions',
  3851. fn: function (){
  3852. var self=this;
  3853. return $core.withContext(function($ctx1) {
  3854. return Math.cos(self);;
  3855. return self;
  3856. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  3857. },
  3858. args: [],
  3859. source: "cos\x0a\x09<return Math.cos(self);>",
  3860. referencedClasses: [],
  3861. messageSends: []
  3862. }),
  3863. $globals.Number);
  3864. $core.addMethod(
  3865. $core.method({
  3866. selector: "deepCopy",
  3867. protocol: 'copying',
  3868. fn: function (){
  3869. var self=this;
  3870. return $core.withContext(function($ctx1) {
  3871. var $1;
  3872. $1=self._copy();
  3873. return $1;
  3874. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  3875. },
  3876. args: [],
  3877. source: "deepCopy\x0a\x09^ self copy",
  3878. referencedClasses: [],
  3879. messageSends: ["copy"]
  3880. }),
  3881. $globals.Number);
  3882. $core.addMethod(
  3883. $core.method({
  3884. selector: "even",
  3885. protocol: 'testing',
  3886. fn: function (){
  3887. var self=this;
  3888. return $core.withContext(function($ctx1) {
  3889. var $1;
  3890. $1=(0).__eq(self.__backslash_backslash((2)));
  3891. return $1;
  3892. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  3893. },
  3894. args: [],
  3895. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  3896. referencedClasses: [],
  3897. messageSends: ["=", "\x5c\x5c"]
  3898. }),
  3899. $globals.Number);
  3900. $core.addMethod(
  3901. $core.method({
  3902. selector: "floor",
  3903. protocol: 'converting',
  3904. fn: function (){
  3905. var self=this;
  3906. return $core.withContext(function($ctx1) {
  3907. return Math.floor(self);;
  3908. return self;
  3909. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  3910. },
  3911. args: [],
  3912. source: "floor\x0a\x09<return Math.floor(self);>",
  3913. referencedClasses: [],
  3914. messageSends: []
  3915. }),
  3916. $globals.Number);
  3917. $core.addMethod(
  3918. $core.method({
  3919. selector: "isImmutable",
  3920. protocol: 'testing',
  3921. fn: function (){
  3922. var self=this;
  3923. return true;
  3924. },
  3925. args: [],
  3926. source: "isImmutable\x0a\x09^ true",
  3927. referencedClasses: [],
  3928. messageSends: []
  3929. }),
  3930. $globals.Number);
  3931. $core.addMethod(
  3932. $core.method({
  3933. selector: "isNumber",
  3934. protocol: 'testing',
  3935. fn: function (){
  3936. var self=this;
  3937. return true;
  3938. },
  3939. args: [],
  3940. source: "isNumber\x0a\x09^ true",
  3941. referencedClasses: [],
  3942. messageSends: []
  3943. }),
  3944. $globals.Number);
  3945. $core.addMethod(
  3946. $core.method({
  3947. selector: "isZero",
  3948. protocol: 'testing',
  3949. fn: function (){
  3950. var self=this;
  3951. return $core.withContext(function($ctx1) {
  3952. var $1;
  3953. $1=self.__eq((0));
  3954. return $1;
  3955. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  3956. },
  3957. args: [],
  3958. source: "isZero\x0a\x09^ self = 0",
  3959. referencedClasses: [],
  3960. messageSends: ["="]
  3961. }),
  3962. $globals.Number);
  3963. $core.addMethod(
  3964. $core.method({
  3965. selector: "ln",
  3966. protocol: 'mathematical functions',
  3967. fn: function (){
  3968. var self=this;
  3969. return $core.withContext(function($ctx1) {
  3970. return Math.log(self);;
  3971. return self;
  3972. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  3973. },
  3974. args: [],
  3975. source: "ln\x0a\x09<return Math.log(self);>",
  3976. referencedClasses: [],
  3977. messageSends: []
  3978. }),
  3979. $globals.Number);
  3980. $core.addMethod(
  3981. $core.method({
  3982. selector: "log",
  3983. protocol: 'mathematical functions',
  3984. fn: function (){
  3985. var self=this;
  3986. return $core.withContext(function($ctx1) {
  3987. return Math.log(self) / Math.LN10;;
  3988. return self;
  3989. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  3990. },
  3991. args: [],
  3992. source: "log\x0a\x09<return Math.log(self) / Math.LN10;>",
  3993. referencedClasses: [],
  3994. messageSends: []
  3995. }),
  3996. $globals.Number);
  3997. $core.addMethod(
  3998. $core.method({
  3999. selector: "log:",
  4000. protocol: 'mathematical functions',
  4001. fn: function (aNumber){
  4002. var self=this;
  4003. return $core.withContext(function($ctx1) {
  4004. return Math.log(self) / Math.log(aNumber);;
  4005. return self;
  4006. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  4007. },
  4008. args: ["aNumber"],
  4009. source: "log: aNumber\x0a\x09<return Math.log(self) / Math.log(aNumber);>",
  4010. referencedClasses: [],
  4011. messageSends: []
  4012. }),
  4013. $globals.Number);
  4014. $core.addMethod(
  4015. $core.method({
  4016. selector: "max:",
  4017. protocol: 'arithmetic',
  4018. fn: function (aNumber){
  4019. var self=this;
  4020. return $core.withContext(function($ctx1) {
  4021. return Math.max(self, aNumber);;
  4022. return self;
  4023. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  4024. },
  4025. args: ["aNumber"],
  4026. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  4027. referencedClasses: [],
  4028. messageSends: []
  4029. }),
  4030. $globals.Number);
  4031. $core.addMethod(
  4032. $core.method({
  4033. selector: "min:",
  4034. protocol: 'arithmetic',
  4035. fn: function (aNumber){
  4036. var self=this;
  4037. return $core.withContext(function($ctx1) {
  4038. return Math.min(self, aNumber);;
  4039. return self;
  4040. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  4041. },
  4042. args: ["aNumber"],
  4043. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  4044. referencedClasses: [],
  4045. messageSends: []
  4046. }),
  4047. $globals.Number);
  4048. $core.addMethod(
  4049. $core.method({
  4050. selector: "negated",
  4051. protocol: 'arithmetic',
  4052. fn: function (){
  4053. var self=this;
  4054. return $core.withContext(function($ctx1) {
  4055. var $1;
  4056. $1=(0).__minus(self);
  4057. return $1;
  4058. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  4059. },
  4060. args: [],
  4061. source: "negated\x0a\x09^ 0 - self",
  4062. referencedClasses: [],
  4063. messageSends: ["-"]
  4064. }),
  4065. $globals.Number);
  4066. $core.addMethod(
  4067. $core.method({
  4068. selector: "negative",
  4069. protocol: 'testing',
  4070. fn: function (){
  4071. var self=this;
  4072. return $core.withContext(function($ctx1) {
  4073. var $1;
  4074. $1=self.__lt((0));
  4075. return $1;
  4076. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  4077. },
  4078. args: [],
  4079. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  4080. referencedClasses: [],
  4081. messageSends: ["<"]
  4082. }),
  4083. $globals.Number);
  4084. $core.addMethod(
  4085. $core.method({
  4086. selector: "odd",
  4087. protocol: 'testing',
  4088. fn: function (){
  4089. var self=this;
  4090. return $core.withContext(function($ctx1) {
  4091. var $1;
  4092. $1=$recv(self._even())._not();
  4093. return $1;
  4094. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  4095. },
  4096. args: [],
  4097. source: "odd\x0a\x09^ self even not",
  4098. referencedClasses: [],
  4099. messageSends: ["not", "even"]
  4100. }),
  4101. $globals.Number);
  4102. $core.addMethod(
  4103. $core.method({
  4104. selector: "positive",
  4105. protocol: 'testing',
  4106. fn: function (){
  4107. var self=this;
  4108. return $core.withContext(function($ctx1) {
  4109. var $1;
  4110. $1=self.__gt_eq((0));
  4111. return $1;
  4112. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  4113. },
  4114. args: [],
  4115. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  4116. referencedClasses: [],
  4117. messageSends: [">="]
  4118. }),
  4119. $globals.Number);
  4120. $core.addMethod(
  4121. $core.method({
  4122. selector: "printOn:",
  4123. protocol: 'printing',
  4124. fn: function (aStream){
  4125. var self=this;
  4126. return $core.withContext(function($ctx1) {
  4127. $recv(aStream)._nextPutAll_(self._asString());
  4128. return self;
  4129. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  4130. },
  4131. args: ["aStream"],
  4132. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4133. referencedClasses: [],
  4134. messageSends: ["nextPutAll:", "asString"]
  4135. }),
  4136. $globals.Number);
  4137. $core.addMethod(
  4138. $core.method({
  4139. selector: "printShowingDecimalPlaces:",
  4140. protocol: 'printing',
  4141. fn: function (placesDesired){
  4142. var self=this;
  4143. return $core.withContext(function($ctx1) {
  4144. return self.toFixed(placesDesired);
  4145. return self;
  4146. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  4147. },
  4148. args: ["placesDesired"],
  4149. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  4150. referencedClasses: [],
  4151. messageSends: []
  4152. }),
  4153. $globals.Number);
  4154. $core.addMethod(
  4155. $core.method({
  4156. selector: "raisedTo:",
  4157. protocol: 'mathematical functions',
  4158. fn: function (exponent){
  4159. var self=this;
  4160. return $core.withContext(function($ctx1) {
  4161. return Math.pow(self, exponent);;
  4162. return self;
  4163. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  4164. },
  4165. args: ["exponent"],
  4166. source: "raisedTo: exponent\x0a\x09<return Math.pow(self, exponent);>",
  4167. referencedClasses: [],
  4168. messageSends: []
  4169. }),
  4170. $globals.Number);
  4171. $core.addMethod(
  4172. $core.method({
  4173. selector: "rounded",
  4174. protocol: 'converting',
  4175. fn: function (){
  4176. var self=this;
  4177. return $core.withContext(function($ctx1) {
  4178. return Math.round(self);;
  4179. return self;
  4180. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  4181. },
  4182. args: [],
  4183. source: "rounded\x0a\x09<return Math.round(self);>",
  4184. referencedClasses: [],
  4185. messageSends: []
  4186. }),
  4187. $globals.Number);
  4188. $core.addMethod(
  4189. $core.method({
  4190. selector: "sign",
  4191. protocol: 'mathematical functions',
  4192. fn: function (){
  4193. var self=this;
  4194. return $core.withContext(function($ctx1) {
  4195. var $1,$2;
  4196. $1=self._isZero();
  4197. if($core.assert($1)){
  4198. return (0);
  4199. };
  4200. $2=self._positive();
  4201. if($core.assert($2)){
  4202. return (1);
  4203. } else {
  4204. return (-1);
  4205. };
  4206. return self;
  4207. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  4208. },
  4209. args: [],
  4210. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  4211. referencedClasses: [],
  4212. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  4213. }),
  4214. $globals.Number);
  4215. $core.addMethod(
  4216. $core.method({
  4217. selector: "sin",
  4218. protocol: 'mathematical functions',
  4219. fn: function (){
  4220. var self=this;
  4221. return $core.withContext(function($ctx1) {
  4222. return Math.sin(self);;
  4223. return self;
  4224. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  4225. },
  4226. args: [],
  4227. source: "sin\x0a\x09<return Math.sin(self);>",
  4228. referencedClasses: [],
  4229. messageSends: []
  4230. }),
  4231. $globals.Number);
  4232. $core.addMethod(
  4233. $core.method({
  4234. selector: "sqrt",
  4235. protocol: 'mathematical functions',
  4236. fn: function (){
  4237. var self=this;
  4238. return $core.withContext(function($ctx1) {
  4239. return Math.sqrt(self);
  4240. return self;
  4241. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  4242. },
  4243. args: [],
  4244. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  4245. referencedClasses: [],
  4246. messageSends: []
  4247. }),
  4248. $globals.Number);
  4249. $core.addMethod(
  4250. $core.method({
  4251. selector: "squared",
  4252. protocol: 'mathematical functions',
  4253. fn: function (){
  4254. var self=this;
  4255. return $core.withContext(function($ctx1) {
  4256. var $1;
  4257. $1=self.__star(self);
  4258. return $1;
  4259. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  4260. },
  4261. args: [],
  4262. source: "squared\x0a\x09^ self * self",
  4263. referencedClasses: [],
  4264. messageSends: ["*"]
  4265. }),
  4266. $globals.Number);
  4267. $core.addMethod(
  4268. $core.method({
  4269. selector: "tan",
  4270. protocol: 'mathematical functions',
  4271. fn: function (){
  4272. var self=this;
  4273. return $core.withContext(function($ctx1) {
  4274. return Math.tan(self);;
  4275. return self;
  4276. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  4277. },
  4278. args: [],
  4279. source: "tan\x0a\x09<return Math.tan(self);>",
  4280. referencedClasses: [],
  4281. messageSends: []
  4282. }),
  4283. $globals.Number);
  4284. $core.addMethod(
  4285. $core.method({
  4286. selector: "timesRepeat:",
  4287. protocol: 'enumerating',
  4288. fn: function (aBlock){
  4289. var self=this;
  4290. var count;
  4291. return $core.withContext(function($ctx1) {
  4292. count=(1);
  4293. $recv((function(){
  4294. return $core.withContext(function($ctx2) {
  4295. return $recv(count).__gt(self);
  4296. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4297. }))._whileFalse_((function(){
  4298. return $core.withContext(function($ctx2) {
  4299. $recv(aBlock)._value();
  4300. count=$recv(count).__plus((1));
  4301. return count;
  4302. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4303. }));
  4304. return self;
  4305. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  4306. },
  4307. args: ["aBlock"],
  4308. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  4309. referencedClasses: [],
  4310. messageSends: ["whileFalse:", ">", "value", "+"]
  4311. }),
  4312. $globals.Number);
  4313. $core.addMethod(
  4314. $core.method({
  4315. selector: "to:",
  4316. protocol: 'converting',
  4317. fn: function (aNumber){
  4318. var self=this;
  4319. var array,first,last,count;
  4320. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  4321. return $core.withContext(function($ctx1) {
  4322. var $1;
  4323. first=self._truncated();
  4324. $ctx1.sendIdx["truncated"]=1;
  4325. last=$recv($recv(aNumber)._truncated()).__plus((1));
  4326. $ctx1.sendIdx["+"]=1;
  4327. count=(1);
  4328. array=$recv($Array())._new();
  4329. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  4330. return $core.withContext(function($ctx2) {
  4331. $recv(array)._at_put_(count,first);
  4332. count=$recv(count).__plus((1));
  4333. $ctx2.sendIdx["+"]=2;
  4334. count;
  4335. first=$recv(first).__plus((1));
  4336. return first;
  4337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4338. }));
  4339. $1=array;
  4340. return $1;
  4341. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  4342. },
  4343. args: ["aNumber"],
  4344. source: "to: aNumber\x0a\x09| array first last count |\x0a\x09first := self truncated.\x0a\x09last := aNumber truncated + 1.\x0a\x09count := 1.\x0a\x09array := Array new.\x0a\x09(last - first) timesRepeat: [\x0a\x09\x09array at: count put: first.\x0a\x09\x09count := count + 1.\x0a\x09\x09first := first + 1 ].\x0a\x09^ array",
  4345. referencedClasses: ["Array"],
  4346. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  4347. }),
  4348. $globals.Number);
  4349. $core.addMethod(
  4350. $core.method({
  4351. selector: "to:by:",
  4352. protocol: 'converting',
  4353. fn: function (stop,step){
  4354. var self=this;
  4355. var array,value,pos;
  4356. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  4357. return $core.withContext(function($ctx1) {
  4358. var $1,$2,$3;
  4359. value=self;
  4360. array=$recv($Array())._new();
  4361. pos=(1);
  4362. $1=$recv(step).__eq((0));
  4363. if($core.assert($1)){
  4364. self._error_("step must be non-zero");
  4365. };
  4366. $2=$recv(step).__lt((0));
  4367. if($core.assert($2)){
  4368. $recv((function(){
  4369. return $core.withContext(function($ctx2) {
  4370. return $recv(value).__gt_eq(stop);
  4371. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  4372. }))._whileTrue_((function(){
  4373. return $core.withContext(function($ctx2) {
  4374. $recv(array)._at_put_(pos,value);
  4375. $ctx2.sendIdx["at:put:"]=1;
  4376. pos=$recv(pos).__plus((1));
  4377. $ctx2.sendIdx["+"]=1;
  4378. pos;
  4379. value=$recv(value).__plus(step);
  4380. $ctx2.sendIdx["+"]=2;
  4381. return value;
  4382. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  4383. }));
  4384. $ctx1.sendIdx["whileTrue:"]=1;
  4385. } else {
  4386. $recv((function(){
  4387. return $core.withContext(function($ctx2) {
  4388. return $recv(value).__lt_eq(stop);
  4389. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  4390. }))._whileTrue_((function(){
  4391. return $core.withContext(function($ctx2) {
  4392. $recv(array)._at_put_(pos,value);
  4393. pos=$recv(pos).__plus((1));
  4394. $ctx2.sendIdx["+"]=3;
  4395. pos;
  4396. value=$recv(value).__plus(step);
  4397. return value;
  4398. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  4399. }));
  4400. };
  4401. $3=array;
  4402. return $3;
  4403. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  4404. },
  4405. args: ["stop", "step"],
  4406. source: "to: stop by: step\x0a\x09| array value pos |\x0a\x09value := self.\x0a\x09array := Array new.\x0a\x09pos := 1.\x0a\x09step = 0 ifTrue: [ self error: 'step must be non-zero' ].\x0a\x09step < 0\x0a\x09\x09ifTrue: [ [ value >= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09array at: pos put: value.\x0a\x09\x09\x09\x09\x09pos := pos + 1.\x0a\x09\x09\x09\x09\x09value := value + step ]]\x0a\x09\x09ifFalse: [ [ value <= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09array at: pos put: value.\x0a\x09\x09\x09\x09pos := pos + 1.\x0a\x09\x09\x09\x09\x09value := value + step ]].\x0a\x09^ array",
  4407. referencedClasses: ["Array"],
  4408. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  4409. }),
  4410. $globals.Number);
  4411. $core.addMethod(
  4412. $core.method({
  4413. selector: "to:by:do:",
  4414. protocol: 'enumerating',
  4415. fn: function (stop,step,aBlock){
  4416. var self=this;
  4417. var value;
  4418. return $core.withContext(function($ctx1) {
  4419. var $1,$2;
  4420. value=self;
  4421. $1=$recv(step).__eq((0));
  4422. if($core.assert($1)){
  4423. self._error_("step must be non-zero");
  4424. };
  4425. $2=$recv(step).__lt((0));
  4426. if($core.assert($2)){
  4427. $recv((function(){
  4428. return $core.withContext(function($ctx2) {
  4429. return $recv(value).__gt_eq(stop);
  4430. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  4431. }))._whileTrue_((function(){
  4432. return $core.withContext(function($ctx2) {
  4433. $recv(aBlock)._value_(value);
  4434. $ctx2.sendIdx["value:"]=1;
  4435. value=$recv(value).__plus(step);
  4436. $ctx2.sendIdx["+"]=1;
  4437. return value;
  4438. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  4439. }));
  4440. $ctx1.sendIdx["whileTrue:"]=1;
  4441. } else {
  4442. $recv((function(){
  4443. return $core.withContext(function($ctx2) {
  4444. return $recv(value).__lt_eq(stop);
  4445. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  4446. }))._whileTrue_((function(){
  4447. return $core.withContext(function($ctx2) {
  4448. $recv(aBlock)._value_(value);
  4449. value=$recv(value).__plus(step);
  4450. return value;
  4451. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  4452. }));
  4453. };
  4454. return self;
  4455. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  4456. },
  4457. args: ["stop", "step", "aBlock"],
  4458. source: "to: stop by: step do: aBlock\x0a\x09| value |\x0a\x09value := self.\x0a\x09step = 0 ifTrue: [ self error: 'step must be non-zero' ].\x0a\x09step < 0\x0a\x09\x09ifTrue: [ [ value >= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09aBlock value: value.\x0a\x09\x09\x09\x09\x09value := value + step ]]\x0a\x09\x09ifFalse: [ [ value <= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09aBlock value: value.\x0a\x09\x09\x09\x09\x09value := value + step ]]",
  4459. referencedClasses: [],
  4460. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  4461. }),
  4462. $globals.Number);
  4463. $core.addMethod(
  4464. $core.method({
  4465. selector: "to:do:",
  4466. protocol: 'enumerating',
  4467. fn: function (stop,aBlock){
  4468. var self=this;
  4469. var nextValue;
  4470. return $core.withContext(function($ctx1) {
  4471. nextValue=self;
  4472. $recv((function(){
  4473. return $core.withContext(function($ctx2) {
  4474. return $recv(nextValue).__lt_eq(stop);
  4475. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4476. }))._whileTrue_((function(){
  4477. return $core.withContext(function($ctx2) {
  4478. $recv(aBlock)._value_(nextValue);
  4479. nextValue=$recv(nextValue).__plus((1));
  4480. return nextValue;
  4481. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4482. }));
  4483. return self;
  4484. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  4485. },
  4486. args: ["stop", "aBlock"],
  4487. source: "to: stop do: aBlock\x0a\x09\x22Evaluate aBlock for each number from self to aNumber.\x22\x0a\x09| nextValue |\x0a\x09nextValue := self.\x0a\x09[ nextValue <= stop ]\x0a\x09\x09whileTrue:\x0a\x09\x09\x09[ aBlock value: nextValue.\x0a\x09\x09\x09nextValue := nextValue + 1 ]",
  4488. referencedClasses: [],
  4489. messageSends: ["whileTrue:", "<=", "value:", "+"]
  4490. }),
  4491. $globals.Number);
  4492. $core.addMethod(
  4493. $core.method({
  4494. selector: "truncated",
  4495. protocol: 'converting',
  4496. fn: function (){
  4497. var self=this;
  4498. return $core.withContext(function($ctx1) {
  4499. if(self >= 0) {
  4500. return Math.floor(self);
  4501. } else {
  4502. return Math.floor(self * (-1)) * (-1);
  4503. };
  4504. ;
  4505. return self;
  4506. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  4507. },
  4508. args: [],
  4509. source: "truncated\x0a\x09<\x0a\x09\x09if(self >>= 0) {\x0a\x09\x09\x09return Math.floor(self);\x0a\x09\x09} else {\x0a\x09\x09\x09return Math.floor(self * (-1)) * (-1);\x0a\x09\x09};\x0a\x09>",
  4510. referencedClasses: [],
  4511. messageSends: []
  4512. }),
  4513. $globals.Number);
  4514. $core.addMethod(
  4515. $core.method({
  4516. selector: "|",
  4517. protocol: 'converting',
  4518. fn: function (aNumber){
  4519. var self=this;
  4520. return $core.withContext(function($ctx1) {
  4521. return self | aNumber;
  4522. return self;
  4523. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  4524. },
  4525. args: ["aNumber"],
  4526. source: "| aNumber\x0a\x09<return self | aNumber>",
  4527. referencedClasses: [],
  4528. messageSends: []
  4529. }),
  4530. $globals.Number);
  4531. $core.addMethod(
  4532. $core.method({
  4533. selector: "classTag",
  4534. protocol: 'accessing',
  4535. fn: function (){
  4536. var self=this;
  4537. return "magnitude";
  4538. },
  4539. args: [],
  4540. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'magnitude'",
  4541. referencedClasses: [],
  4542. messageSends: []
  4543. }),
  4544. $globals.Number.klass);
  4545. $core.addMethod(
  4546. $core.method({
  4547. selector: "e",
  4548. protocol: 'instance creation',
  4549. fn: function (){
  4550. var self=this;
  4551. return $core.withContext(function($ctx1) {
  4552. return Math.E;;
  4553. return self;
  4554. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.klass)});
  4555. },
  4556. args: [],
  4557. source: "e\x0a\x09<return Math.E;>",
  4558. referencedClasses: [],
  4559. messageSends: []
  4560. }),
  4561. $globals.Number.klass);
  4562. $core.addMethod(
  4563. $core.method({
  4564. selector: "pi",
  4565. protocol: 'instance creation',
  4566. fn: function (){
  4567. var self=this;
  4568. return $core.withContext(function($ctx1) {
  4569. return Math.PI;
  4570. return self;
  4571. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.klass)});
  4572. },
  4573. args: [],
  4574. source: "pi\x0a\x09<return Math.PI>",
  4575. referencedClasses: [],
  4576. messageSends: []
  4577. }),
  4578. $globals.Number.klass);
  4579. $core.addClass('Point', $globals.Object, ['x', 'y'], 'Kernel-Objects');
  4580. $globals.Point.comment="I represent an x-y pair of numbers usually designating a geometric coordinate.\x0a\x0a## API\x0a\x0aInstances are traditionally created using the binary `#@` message to a number:\x0a\x0a\x09100@120\x0a\x0aPoints can then be arithmetically manipulated:\x0a\x0a\x09100@100 + (10@10)\x0a\x0a...or for example:\x0a\x0a\x09(100@100) * 2\x0a\x0a**NOTE:** Creating a point with a negative y-value will need a space after `@` in order to avoid a parsing error:\x0a\x0a\x09100@ -100 \x22but 100@-100 would not parse\x22";
  4581. $core.addMethod(
  4582. $core.method({
  4583. selector: "*",
  4584. protocol: 'arithmetic',
  4585. fn: function (aPoint){
  4586. var self=this;
  4587. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  4588. return $core.withContext(function($ctx1) {
  4589. var $3,$5,$4,$2,$7,$6,$1;
  4590. $3=self._x();
  4591. $ctx1.sendIdx["x"]=1;
  4592. $5=$recv(aPoint)._asPoint();
  4593. $ctx1.sendIdx["asPoint"]=1;
  4594. $4=$recv($5)._x();
  4595. $2=$recv($3).__star($4);
  4596. $ctx1.sendIdx["*"]=1;
  4597. $7=self._y();
  4598. $ctx1.sendIdx["y"]=1;
  4599. $6=$recv($7).__star($recv($recv(aPoint)._asPoint())._y());
  4600. $1=$recv($Point())._x_y_($2,$6);
  4601. return $1;
  4602. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  4603. },
  4604. args: ["aPoint"],
  4605. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  4606. referencedClasses: ["Point"],
  4607. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  4608. }),
  4609. $globals.Point);
  4610. $core.addMethod(
  4611. $core.method({
  4612. selector: "+",
  4613. protocol: 'arithmetic',
  4614. fn: function (aPoint){
  4615. var self=this;
  4616. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  4617. return $core.withContext(function($ctx1) {
  4618. var $3,$5,$4,$2,$7,$6,$1;
  4619. $3=self._x();
  4620. $ctx1.sendIdx["x"]=1;
  4621. $5=$recv(aPoint)._asPoint();
  4622. $ctx1.sendIdx["asPoint"]=1;
  4623. $4=$recv($5)._x();
  4624. $2=$recv($3).__plus($4);
  4625. $ctx1.sendIdx["+"]=1;
  4626. $7=self._y();
  4627. $ctx1.sendIdx["y"]=1;
  4628. $6=$recv($7).__plus($recv($recv(aPoint)._asPoint())._y());
  4629. $1=$recv($Point())._x_y_($2,$6);
  4630. return $1;
  4631. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  4632. },
  4633. args: ["aPoint"],
  4634. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  4635. referencedClasses: ["Point"],
  4636. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  4637. }),
  4638. $globals.Point);
  4639. $core.addMethod(
  4640. $core.method({
  4641. selector: "-",
  4642. protocol: 'arithmetic',
  4643. fn: function (aPoint){
  4644. var self=this;
  4645. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  4646. return $core.withContext(function($ctx1) {
  4647. var $3,$5,$4,$2,$7,$6,$1;
  4648. $3=self._x();
  4649. $ctx1.sendIdx["x"]=1;
  4650. $5=$recv(aPoint)._asPoint();
  4651. $ctx1.sendIdx["asPoint"]=1;
  4652. $4=$recv($5)._x();
  4653. $2=$recv($3).__minus($4);
  4654. $ctx1.sendIdx["-"]=1;
  4655. $7=self._y();
  4656. $ctx1.sendIdx["y"]=1;
  4657. $6=$recv($7).__minus($recv($recv(aPoint)._asPoint())._y());
  4658. $1=$recv($Point())._x_y_($2,$6);
  4659. return $1;
  4660. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  4661. },
  4662. args: ["aPoint"],
  4663. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  4664. referencedClasses: ["Point"],
  4665. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  4666. }),
  4667. $globals.Point);
  4668. $core.addMethod(
  4669. $core.method({
  4670. selector: "/",
  4671. protocol: 'arithmetic',
  4672. fn: function (aPoint){
  4673. var self=this;
  4674. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  4675. return $core.withContext(function($ctx1) {
  4676. var $3,$5,$4,$2,$7,$6,$1;
  4677. $3=self._x();
  4678. $ctx1.sendIdx["x"]=1;
  4679. $5=$recv(aPoint)._asPoint();
  4680. $ctx1.sendIdx["asPoint"]=1;
  4681. $4=$recv($5)._x();
  4682. $2=$recv($3).__slash($4);
  4683. $ctx1.sendIdx["/"]=1;
  4684. $7=self._y();
  4685. $ctx1.sendIdx["y"]=1;
  4686. $6=$recv($7).__slash($recv($recv(aPoint)._asPoint())._y());
  4687. $1=$recv($Point())._x_y_($2,$6);
  4688. return $1;
  4689. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  4690. },
  4691. args: ["aPoint"],
  4692. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  4693. referencedClasses: ["Point"],
  4694. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  4695. }),
  4696. $globals.Point);
  4697. $core.addMethod(
  4698. $core.method({
  4699. selector: "<",
  4700. protocol: 'comparing',
  4701. fn: function (aPoint){
  4702. var self=this;
  4703. return $core.withContext(function($ctx1) {
  4704. var $3,$2,$4,$1;
  4705. $3=self._x();
  4706. $ctx1.sendIdx["x"]=1;
  4707. $2=$recv($3).__lt($recv(aPoint)._x());
  4708. $ctx1.sendIdx["<"]=1;
  4709. $1=$recv($2)._and_((function(){
  4710. return $core.withContext(function($ctx2) {
  4711. $4=self._y();
  4712. $ctx2.sendIdx["y"]=1;
  4713. return $recv($4).__lt($recv(aPoint)._y());
  4714. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4715. }));
  4716. return $1;
  4717. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  4718. },
  4719. args: ["aPoint"],
  4720. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  4721. referencedClasses: [],
  4722. messageSends: ["and:", "<", "x", "y"]
  4723. }),
  4724. $globals.Point);
  4725. $core.addMethod(
  4726. $core.method({
  4727. selector: "<=",
  4728. protocol: 'comparing',
  4729. fn: function (aPoint){
  4730. var self=this;
  4731. return $core.withContext(function($ctx1) {
  4732. var $3,$2,$4,$1;
  4733. $3=self._x();
  4734. $ctx1.sendIdx["x"]=1;
  4735. $2=$recv($3).__lt_eq($recv(aPoint)._x());
  4736. $ctx1.sendIdx["<="]=1;
  4737. $1=$recv($2)._and_((function(){
  4738. return $core.withContext(function($ctx2) {
  4739. $4=self._y();
  4740. $ctx2.sendIdx["y"]=1;
  4741. return $recv($4).__lt_eq($recv(aPoint)._y());
  4742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4743. }));
  4744. return $1;
  4745. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  4746. },
  4747. args: ["aPoint"],
  4748. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  4749. referencedClasses: [],
  4750. messageSends: ["and:", "<=", "x", "y"]
  4751. }),
  4752. $globals.Point);
  4753. $core.addMethod(
  4754. $core.method({
  4755. selector: "=",
  4756. protocol: 'comparing',
  4757. fn: function (aPoint){
  4758. var self=this;
  4759. return $core.withContext(function($ctx1) {
  4760. var $3,$2,$5,$4,$7,$6,$1;
  4761. $3=$recv(aPoint)._class();
  4762. $ctx1.sendIdx["class"]=1;
  4763. $2=$recv($3).__eq(self._class());
  4764. $ctx1.sendIdx["="]=1;
  4765. $1=$recv($2)._and_((function(){
  4766. return $core.withContext(function($ctx2) {
  4767. $5=$recv(aPoint)._x();
  4768. $ctx2.sendIdx["x"]=1;
  4769. $4=$recv($5).__eq(self._x());
  4770. $ctx2.sendIdx["="]=2;
  4771. $7=$recv(aPoint)._y();
  4772. $ctx2.sendIdx["y"]=1;
  4773. $6=$recv($7).__eq(self._y());
  4774. return $recv($4).__and($6);
  4775. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4776. }));
  4777. return $1;
  4778. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  4779. },
  4780. args: ["aPoint"],
  4781. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  4782. referencedClasses: [],
  4783. messageSends: ["and:", "=", "class", "&", "x", "y"]
  4784. }),
  4785. $globals.Point);
  4786. $core.addMethod(
  4787. $core.method({
  4788. selector: ">",
  4789. protocol: 'comparing',
  4790. fn: function (aPoint){
  4791. var self=this;
  4792. return $core.withContext(function($ctx1) {
  4793. var $3,$2,$4,$1;
  4794. $3=self._x();
  4795. $ctx1.sendIdx["x"]=1;
  4796. $2=$recv($3).__gt($recv(aPoint)._x());
  4797. $ctx1.sendIdx[">"]=1;
  4798. $1=$recv($2)._and_((function(){
  4799. return $core.withContext(function($ctx2) {
  4800. $4=self._y();
  4801. $ctx2.sendIdx["y"]=1;
  4802. return $recv($4).__gt($recv(aPoint)._y());
  4803. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4804. }));
  4805. return $1;
  4806. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  4807. },
  4808. args: ["aPoint"],
  4809. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  4810. referencedClasses: [],
  4811. messageSends: ["and:", ">", "x", "y"]
  4812. }),
  4813. $globals.Point);
  4814. $core.addMethod(
  4815. $core.method({
  4816. selector: ">=",
  4817. protocol: 'comparing',
  4818. fn: function (aPoint){
  4819. var self=this;
  4820. return $core.withContext(function($ctx1) {
  4821. var $3,$2,$4,$1;
  4822. $3=self._x();
  4823. $ctx1.sendIdx["x"]=1;
  4824. $2=$recv($3).__gt_eq($recv(aPoint)._x());
  4825. $ctx1.sendIdx[">="]=1;
  4826. $1=$recv($2)._and_((function(){
  4827. return $core.withContext(function($ctx2) {
  4828. $4=self._y();
  4829. $ctx2.sendIdx["y"]=1;
  4830. return $recv($4).__gt_eq($recv(aPoint)._y());
  4831. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4832. }));
  4833. return $1;
  4834. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  4835. },
  4836. args: ["aPoint"],
  4837. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  4838. referencedClasses: [],
  4839. messageSends: ["and:", ">=", "x", "y"]
  4840. }),
  4841. $globals.Point);
  4842. $core.addMethod(
  4843. $core.method({
  4844. selector: "asPoint",
  4845. protocol: 'converting',
  4846. fn: function (){
  4847. var self=this;
  4848. return self;
  4849. },
  4850. args: [],
  4851. source: "asPoint\x0a\x09^ self",
  4852. referencedClasses: [],
  4853. messageSends: []
  4854. }),
  4855. $globals.Point);
  4856. $core.addMethod(
  4857. $core.method({
  4858. selector: "dist:",
  4859. protocol: 'transforming',
  4860. fn: function (aPoint){
  4861. var self=this;
  4862. var dx,dy;
  4863. return $core.withContext(function($ctx1) {
  4864. var $3,$2,$1;
  4865. dx=$recv($recv(aPoint)._x()).__minus(self["@x"]);
  4866. $ctx1.sendIdx["-"]=1;
  4867. dy=$recv($recv(aPoint)._y()).__minus(self["@y"]);
  4868. $3=$recv(dx).__star(dx);
  4869. $ctx1.sendIdx["*"]=1;
  4870. $2=$recv($3).__plus($recv(dy).__star(dy));
  4871. $1=$recv($2)._sqrt();
  4872. return $1;
  4873. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  4874. },
  4875. args: ["aPoint"],
  4876. source: "dist: aPoint \x0a\x09\x22Answer the distance between aPoint and the receiver.\x22\x0a\x09| dx dy |\x0a\x09dx := aPoint x - x.\x0a\x09dy := aPoint y - y.\x0a\x09^ (dx * dx + (dy * dy)) sqrt",
  4877. referencedClasses: [],
  4878. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  4879. }),
  4880. $globals.Point);
  4881. $core.addMethod(
  4882. $core.method({
  4883. selector: "printOn:",
  4884. protocol: 'printing',
  4885. fn: function (aStream){
  4886. var self=this;
  4887. return $core.withContext(function($ctx1) {
  4888. var $1;
  4889. $recv(self["@x"])._printOn_(aStream);
  4890. $ctx1.sendIdx["printOn:"]=1;
  4891. $recv(aStream)._nextPutAll_("@");
  4892. $1=$recv($recv(self["@y"])._notNil())._and_((function(){
  4893. return $core.withContext(function($ctx2) {
  4894. return $recv(self["@y"])._negative();
  4895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4896. }));
  4897. if($core.assert($1)){
  4898. $recv(aStream)._space();
  4899. };
  4900. $recv(self["@y"])._printOn_(aStream);
  4901. return self;
  4902. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  4903. },
  4904. args: ["aStream"],
  4905. source: "printOn: aStream\x0a\x09\x22Print receiver in classic x@y notation.\x22\x0a\x0a\x09x printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: '@'.\x0a\x09(y notNil and: [ y negative ]) ifTrue: [\x0a\x09\x09\x09\x22Avoid ambiguous @- construct\x22\x0a\x09\x09\x09aStream space ].\x0a\x09\x0a\x09y printOn: aStream",
  4906. referencedClasses: [],
  4907. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  4908. }),
  4909. $globals.Point);
  4910. $core.addMethod(
  4911. $core.method({
  4912. selector: "translateBy:",
  4913. protocol: 'transforming',
  4914. fn: function (delta){
  4915. var self=this;
  4916. return $core.withContext(function($ctx1) {
  4917. var $2,$1;
  4918. $2=$recv($recv(delta)._x()).__plus(self["@x"]);
  4919. $ctx1.sendIdx["+"]=1;
  4920. $1=$recv($2).__at($recv($recv(delta)._y()).__plus(self["@y"]));
  4921. return $1;
  4922. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  4923. },
  4924. args: ["delta"],
  4925. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  4926. referencedClasses: [],
  4927. messageSends: ["@", "+", "x", "y"]
  4928. }),
  4929. $globals.Point);
  4930. $core.addMethod(
  4931. $core.method({
  4932. selector: "x",
  4933. protocol: 'accessing',
  4934. fn: function (){
  4935. var self=this;
  4936. var $1;
  4937. $1=self["@x"];
  4938. return $1;
  4939. },
  4940. args: [],
  4941. source: "x\x0a\x09^ x",
  4942. referencedClasses: [],
  4943. messageSends: []
  4944. }),
  4945. $globals.Point);
  4946. $core.addMethod(
  4947. $core.method({
  4948. selector: "x:",
  4949. protocol: 'accessing',
  4950. fn: function (aNumber){
  4951. var self=this;
  4952. self["@x"]=aNumber;
  4953. return self;
  4954. },
  4955. args: ["aNumber"],
  4956. source: "x: aNumber\x0a\x09x := aNumber",
  4957. referencedClasses: [],
  4958. messageSends: []
  4959. }),
  4960. $globals.Point);
  4961. $core.addMethod(
  4962. $core.method({
  4963. selector: "y",
  4964. protocol: 'accessing',
  4965. fn: function (){
  4966. var self=this;
  4967. var $1;
  4968. $1=self["@y"];
  4969. return $1;
  4970. },
  4971. args: [],
  4972. source: "y\x0a\x09^ y",
  4973. referencedClasses: [],
  4974. messageSends: []
  4975. }),
  4976. $globals.Point);
  4977. $core.addMethod(
  4978. $core.method({
  4979. selector: "y:",
  4980. protocol: 'accessing',
  4981. fn: function (aNumber){
  4982. var self=this;
  4983. self["@y"]=aNumber;
  4984. return self;
  4985. },
  4986. args: ["aNumber"],
  4987. source: "y: aNumber\x0a\x09y := aNumber",
  4988. referencedClasses: [],
  4989. messageSends: []
  4990. }),
  4991. $globals.Point);
  4992. $core.addMethod(
  4993. $core.method({
  4994. selector: "classTag",
  4995. protocol: 'accessing',
  4996. fn: function (){
  4997. var self=this;
  4998. return "magnitude";
  4999. },
  5000. args: [],
  5001. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'magnitude'",
  5002. referencedClasses: [],
  5003. messageSends: []
  5004. }),
  5005. $globals.Point.klass);
  5006. $core.addMethod(
  5007. $core.method({
  5008. selector: "x:y:",
  5009. protocol: 'instance creation',
  5010. fn: function (aNumber,anotherNumber){
  5011. var self=this;
  5012. return $core.withContext(function($ctx1) {
  5013. var $2,$3,$1;
  5014. $2=self._new();
  5015. $recv($2)._x_(aNumber);
  5016. $recv($2)._y_(anotherNumber);
  5017. $3=$recv($2)._yourself();
  5018. $1=$3;
  5019. return $1;
  5020. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.klass)});
  5021. },
  5022. args: ["aNumber", "anotherNumber"],
  5023. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  5024. referencedClasses: [],
  5025. messageSends: ["x:", "new", "y:", "yourself"]
  5026. }),
  5027. $globals.Point.klass);
  5028. $core.addClass('Random', $globals.Object, [], 'Kernel-Objects');
  5029. $globals.Random.comment="I an used to generate a random number and I am implemented as a trivial wrapper around javascript `Math.random()`.\x0a\x0a## API\x0a\x0aThe typical use case it to use the `#next` method like the following:\x0a\x0a\x09Random new next\x0a\x0aThis will return a float x where x < 1 and x > 0. If you want a random integer from 1 to 10 you can use `#atRandom`\x0a\x0a\x0910 atRandom\x0a\x0aA random number in a specific interval can be obtained with the following:\x0a\x0a\x09(3 to: 7) atRandom\x0a\x0aBe aware that `#to:` does not create an Interval as in other Smalltalk implementations but in fact an `Array` of numbers, so it's better to use:\x0a\x0a\x095 atRandom + 2\x0a\x0aSince `#atRandom` is implemented in `SequencableCollection` you can easy pick an element at random:\x0a\x0a\x09#('a' 'b' 'c') atRandom\x0a\x0aAs well as letter from a `String`:\x0a\x0a\x09'abc' atRandom\x0a\x0aSince Amber does not have Characters this will return a `String` of length 1 like for example `'b'`.";
  5030. $core.addMethod(
  5031. $core.method({
  5032. selector: "next",
  5033. protocol: 'accessing',
  5034. fn: function (){
  5035. var self=this;
  5036. return $core.withContext(function($ctx1) {
  5037. return Math.random();
  5038. return self;
  5039. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  5040. },
  5041. args: [],
  5042. source: "next\x0a\x09<return Math.random()>",
  5043. referencedClasses: [],
  5044. messageSends: []
  5045. }),
  5046. $globals.Random);
  5047. $core.addMethod(
  5048. $core.method({
  5049. selector: "next:",
  5050. protocol: 'accessing',
  5051. fn: function (anInteger){
  5052. var self=this;
  5053. return $core.withContext(function($ctx1) {
  5054. var $1;
  5055. $1=$recv((1)._to_(anInteger))._collect_((function(each){
  5056. return $core.withContext(function($ctx2) {
  5057. return self._next();
  5058. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5059. }));
  5060. return $1;
  5061. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  5062. },
  5063. args: ["anInteger"],
  5064. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  5065. referencedClasses: [],
  5066. messageSends: ["collect:", "to:", "next"]
  5067. }),
  5068. $globals.Random);
  5069. $core.addClass('UndefinedObject', $globals.Object, [], 'Kernel-Objects');
  5070. $globals.UndefinedObject.comment="I describe the behavior of my sole instance, `nil`. `nil` represents a prior value for variables that have not been initialized, or for results which are meaningless.\x0a\x0a`nil` is the Smalltalk equivalent of the `undefined` JavaScript object.\x0a\x0a__note:__ When sending messages to the `undefined` JavaScript object, it will be replaced by `nil`.";
  5071. $core.addMethod(
  5072. $core.method({
  5073. selector: "asJSON",
  5074. protocol: 'converting',
  5075. fn: function (){
  5076. var self=this;
  5077. var $1;
  5078. $1=null;
  5079. return $1;
  5080. },
  5081. args: [],
  5082. source: "asJSON\x0a\x09^ null",
  5083. referencedClasses: [],
  5084. messageSends: []
  5085. }),
  5086. $globals.UndefinedObject);
  5087. $core.addMethod(
  5088. $core.method({
  5089. selector: "deepCopy",
  5090. protocol: 'copying',
  5091. fn: function (){
  5092. var self=this;
  5093. return self;
  5094. },
  5095. args: [],
  5096. source: "deepCopy\x0a\x09^ self",
  5097. referencedClasses: [],
  5098. messageSends: []
  5099. }),
  5100. $globals.UndefinedObject);
  5101. $core.addMethod(
  5102. $core.method({
  5103. selector: "ifNil:",
  5104. protocol: 'testing',
  5105. fn: function (aBlock){
  5106. var self=this;
  5107. return $core.withContext(function($ctx1) {
  5108. var $1;
  5109. $1=self._ifNil_ifNotNil_(aBlock,(function(){
  5110. }));
  5111. return $1;
  5112. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  5113. },
  5114. args: ["aBlock"],
  5115. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  5116. referencedClasses: [],
  5117. messageSends: ["ifNil:ifNotNil:"]
  5118. }),
  5119. $globals.UndefinedObject);
  5120. $core.addMethod(
  5121. $core.method({
  5122. selector: "ifNil:ifNotNil:",
  5123. protocol: 'testing',
  5124. fn: function (aBlock,anotherBlock){
  5125. var self=this;
  5126. return $core.withContext(function($ctx1) {
  5127. var $1;
  5128. $1=$recv(aBlock)._value();
  5129. return $1;
  5130. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5131. },
  5132. args: ["aBlock", "anotherBlock"],
  5133. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  5134. referencedClasses: [],
  5135. messageSends: ["value"]
  5136. }),
  5137. $globals.UndefinedObject);
  5138. $core.addMethod(
  5139. $core.method({
  5140. selector: "ifNotNil:",
  5141. protocol: 'testing',
  5142. fn: function (aBlock){
  5143. var self=this;
  5144. return self;
  5145. },
  5146. args: ["aBlock"],
  5147. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  5148. referencedClasses: [],
  5149. messageSends: []
  5150. }),
  5151. $globals.UndefinedObject);
  5152. $core.addMethod(
  5153. $core.method({
  5154. selector: "ifNotNil:ifNil:",
  5155. protocol: 'testing',
  5156. fn: function (aBlock,anotherBlock){
  5157. var self=this;
  5158. return $core.withContext(function($ctx1) {
  5159. var $1;
  5160. $1=$recv(anotherBlock)._value();
  5161. return $1;
  5162. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5163. },
  5164. args: ["aBlock", "anotherBlock"],
  5165. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  5166. referencedClasses: [],
  5167. messageSends: ["value"]
  5168. }),
  5169. $globals.UndefinedObject);
  5170. $core.addMethod(
  5171. $core.method({
  5172. selector: "isImmutable",
  5173. protocol: 'testing',
  5174. fn: function (){
  5175. var self=this;
  5176. return true;
  5177. },
  5178. args: [],
  5179. source: "isImmutable\x0a\x09^ true",
  5180. referencedClasses: [],
  5181. messageSends: []
  5182. }),
  5183. $globals.UndefinedObject);
  5184. $core.addMethod(
  5185. $core.method({
  5186. selector: "isNil",
  5187. protocol: 'testing',
  5188. fn: function (){
  5189. var self=this;
  5190. return true;
  5191. },
  5192. args: [],
  5193. source: "isNil\x0a\x09^ true",
  5194. referencedClasses: [],
  5195. messageSends: []
  5196. }),
  5197. $globals.UndefinedObject);
  5198. $core.addMethod(
  5199. $core.method({
  5200. selector: "notNil",
  5201. protocol: 'testing',
  5202. fn: function (){
  5203. var self=this;
  5204. return false;
  5205. },
  5206. args: [],
  5207. source: "notNil\x0a\x09^ false",
  5208. referencedClasses: [],
  5209. messageSends: []
  5210. }),
  5211. $globals.UndefinedObject);
  5212. $core.addMethod(
  5213. $core.method({
  5214. selector: "printOn:",
  5215. protocol: 'printing',
  5216. fn: function (aStream){
  5217. var self=this;
  5218. return $core.withContext(function($ctx1) {
  5219. $recv(aStream)._nextPutAll_("nil");
  5220. return self;
  5221. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  5222. },
  5223. args: ["aStream"],
  5224. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  5225. referencedClasses: [],
  5226. messageSends: ["nextPutAll:"]
  5227. }),
  5228. $globals.UndefinedObject);
  5229. $core.addMethod(
  5230. $core.method({
  5231. selector: "shallowCopy",
  5232. protocol: 'copying',
  5233. fn: function (){
  5234. var self=this;
  5235. return self;
  5236. },
  5237. args: [],
  5238. source: "shallowCopy\x0a\x09^ self",
  5239. referencedClasses: [],
  5240. messageSends: []
  5241. }),
  5242. $globals.UndefinedObject);
  5243. $core.addMethod(
  5244. $core.method({
  5245. selector: "subclass:instanceVariableNames:",
  5246. protocol: 'class creation',
  5247. fn: function (aString,anotherString){
  5248. var self=this;
  5249. return $core.withContext(function($ctx1) {
  5250. var $1;
  5251. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  5252. return $1;
  5253. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.UndefinedObject)});
  5254. },
  5255. args: ["aString", "anotherString"],
  5256. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  5257. referencedClasses: [],
  5258. messageSends: ["subclass:instanceVariableNames:package:"]
  5259. }),
  5260. $globals.UndefinedObject);
  5261. $core.addMethod(
  5262. $core.method({
  5263. selector: "subclass:instanceVariableNames:category:",
  5264. protocol: 'class creation',
  5265. fn: function (aString,aString2,aString3){
  5266. var self=this;
  5267. return $core.withContext(function($ctx1) {
  5268. var $1;
  5269. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5270. return $1;
  5271. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  5272. },
  5273. args: ["aString", "aString2", "aString3"],
  5274. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  5275. referencedClasses: [],
  5276. messageSends: ["subclass:instanceVariableNames:package:"]
  5277. }),
  5278. $globals.UndefinedObject);
  5279. $core.addMethod(
  5280. $core.method({
  5281. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  5282. protocol: 'class creation',
  5283. fn: function (aString,aString2,classVars,pools,aString3){
  5284. var self=this;
  5285. return $core.withContext(function($ctx1) {
  5286. var $1;
  5287. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5288. return $1;
  5289. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.UndefinedObject)});
  5290. },
  5291. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  5292. source: "subclass: aString instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Kept for file-in compatibility. ignores class variables and pools.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  5293. referencedClasses: [],
  5294. messageSends: ["subclass:instanceVariableNames:package:"]
  5295. }),
  5296. $globals.UndefinedObject);
  5297. $core.addMethod(
  5298. $core.method({
  5299. selector: "subclass:instanceVariableNames:package:",
  5300. protocol: 'class creation',
  5301. fn: function (aString,aString2,aString3){
  5302. var self=this;
  5303. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  5304. return $core.withContext(function($ctx1) {
  5305. var $1;
  5306. $1=$recv($recv($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  5307. return $1;
  5308. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  5309. },
  5310. args: ["aString", "aString2", "aString3"],
  5311. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  5312. referencedClasses: ["ClassBuilder"],
  5313. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  5314. }),
  5315. $globals.UndefinedObject);
  5316. $core.addMethod(
  5317. $core.method({
  5318. selector: "new",
  5319. protocol: 'instance creation',
  5320. fn: function (){
  5321. var self=this;
  5322. return $core.withContext(function($ctx1) {
  5323. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  5324. return self;
  5325. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.klass)});
  5326. },
  5327. args: [],
  5328. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  5329. referencedClasses: [],
  5330. messageSends: ["error:"]
  5331. }),
  5332. $globals.UndefinedObject.klass);
  5333. });
  5334. define("amber_core/Kernel-Classes", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  5335. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  5336. $core.addPackage('Kernel-Classes');
  5337. $core.packages["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  5338. $core.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  5339. $core.addClass('Behavior', $globals.Object, [], 'Kernel-Classes');
  5340. $globals.Behavior.comment="I am the superclass of all class objects.\x0a\x0aI define the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0a\x0aMy instances know about the subclass/superclass relationships between classes, contain the description that instances are created from,\x0aand hold the method dictionary that's associated with each class.\x0a\x0aI also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy.";
  5341. $core.addMethod(
  5342. $core.method({
  5343. selector: ">>",
  5344. protocol: 'accessing',
  5345. fn: function (aString){
  5346. var self=this;
  5347. return $core.withContext(function($ctx1) {
  5348. var $1;
  5349. $1=self._methodAt_(aString);
  5350. return $1;
  5351. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.Behavior)});
  5352. },
  5353. args: ["aString"],
  5354. source: ">> aString\x0a\x09^ self methodAt: aString",
  5355. referencedClasses: [],
  5356. messageSends: ["methodAt:"]
  5357. }),
  5358. $globals.Behavior);
  5359. $core.addMethod(
  5360. $core.method({
  5361. selector: "addCompiledMethod:",
  5362. protocol: 'compiling',
  5363. fn: function (aMethod){
  5364. var self=this;
  5365. var oldMethod,announcement;
  5366. function $MethodAdded(){return $globals.MethodAdded||(typeof MethodAdded=="undefined"?nil:MethodAdded)}
  5367. function $MethodModified(){return $globals.MethodModified||(typeof MethodModified=="undefined"?nil:MethodModified)}
  5368. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  5369. return $core.withContext(function($ctx1) {
  5370. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$receiver;
  5371. oldMethod=$recv(self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  5372. return nil;
  5373. }));
  5374. $2=self._protocols();
  5375. $3=$recv(aMethod)._protocol();
  5376. $ctx1.sendIdx["protocol"]=1;
  5377. $1=$recv($2)._includes_($3);
  5378. if(!$core.assert($1)){
  5379. $4=self._organization();
  5380. $5=$recv(aMethod)._protocol();
  5381. $ctx1.sendIdx["protocol"]=2;
  5382. $recv($4)._addElement_($5);
  5383. };
  5384. self._basicAddCompiledMethod_(aMethod);
  5385. $6=oldMethod;
  5386. if(($receiver = $6) == null || $receiver.isNil){
  5387. $6;
  5388. } else {
  5389. self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  5390. };
  5391. $7=oldMethod;
  5392. if(($receiver = $7) == null || $receiver.isNil){
  5393. $8=$recv($MethodAdded())._new();
  5394. $ctx1.sendIdx["new"]=1;
  5395. $recv($8)._method_(aMethod);
  5396. $ctx1.sendIdx["method:"]=1;
  5397. $9=$recv($8)._yourself();
  5398. $ctx1.sendIdx["yourself"]=1;
  5399. announcement=$9;
  5400. } else {
  5401. $10=$recv($MethodModified())._new();
  5402. $recv($10)._oldMethod_(oldMethod);
  5403. $recv($10)._method_(aMethod);
  5404. $11=$recv($10)._yourself();
  5405. announcement=$11;
  5406. };
  5407. $recv($recv($SystemAnnouncer())._current())._announce_(announcement);
  5408. return self;
  5409. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.Behavior)});
  5410. },
  5411. args: ["aMethod"],
  5412. source: "addCompiledMethod: aMethod\x0a\x09| oldMethod announcement |\x0a\x09\x0a\x09oldMethod := self methodDictionary\x0a\x09\x09at: aMethod selector\x0a\x09\x09ifAbsent: [ nil ].\x0a\x09\x0a\x09(self protocols includes: aMethod protocol)\x0a\x09\x09ifFalse: [ self organization addElement: aMethod protocol ].\x0a\x0a\x09self basicAddCompiledMethod: aMethod.\x0a\x09\x0a\x09oldMethod ifNotNil: [\x0a\x09\x09self removeProtocolIfEmpty: oldMethod protocol ].\x0a\x09\x0a\x09announcement := oldMethod\x0a\x09\x09ifNil: [\x0a\x09\x09\x09MethodAdded new\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ]\x0a\x09\x09ifNotNil: [\x0a\x09\x09\x09MethodModified new\x0a\x09\x09\x09\x09\x09oldMethod: oldMethod;\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ].\x0a\x09\x09\x09\x09\x09\x0a\x09\x09\x09\x09\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09\x09\x09announce: announcement",
  5413. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  5414. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  5415. }),
  5416. $globals.Behavior);
  5417. $core.addMethod(
  5418. $core.method({
  5419. selector: "allInstanceVariableNames",
  5420. protocol: 'accessing',
  5421. fn: function (){
  5422. var self=this;
  5423. var result;
  5424. return $core.withContext(function($ctx1) {
  5425. var $1,$2,$receiver;
  5426. result=$recv(self._instanceVariableNames())._copy();
  5427. $1=self._superclass();
  5428. $ctx1.sendIdx["superclass"]=1;
  5429. if(($receiver = $1) == null || $receiver.isNil){
  5430. $1;
  5431. } else {
  5432. $recv(result)._addAll_($recv(self._superclass())._allInstanceVariableNames());
  5433. };
  5434. $2=result;
  5435. return $2;
  5436. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  5437. },
  5438. args: [],
  5439. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  5440. referencedClasses: [],
  5441. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  5442. }),
  5443. $globals.Behavior);
  5444. $core.addMethod(
  5445. $core.method({
  5446. selector: "allSelectors",
  5447. protocol: 'accessing',
  5448. fn: function (){
  5449. var self=this;
  5450. return $core.withContext(function($ctx1) {
  5451. var $2,$3,$4,$1;
  5452. $2=self._allSuperclasses();
  5453. $3=self._selectors();
  5454. $ctx1.sendIdx["selectors"]=1;
  5455. $1=$recv($2)._inject_into_($3,(function(acc,each){
  5456. return $core.withContext(function($ctx2) {
  5457. $recv(acc)._addAll_($recv(each)._selectors());
  5458. $4=$recv(acc)._yourself();
  5459. return $4;
  5460. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  5461. }));
  5462. return $1;
  5463. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  5464. },
  5465. args: [],
  5466. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  5467. referencedClasses: [],
  5468. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  5469. }),
  5470. $globals.Behavior);
  5471. $core.addMethod(
  5472. $core.method({
  5473. selector: "allSubclasses",
  5474. protocol: 'accessing',
  5475. fn: function (){
  5476. var self=this;
  5477. var subclasses,index;
  5478. return $core.withContext(function($ctx1) {
  5479. var $1;
  5480. subclasses=self._subclasses();
  5481. $ctx1.sendIdx["subclasses"]=1;
  5482. index=(1);
  5483. $recv((function(){
  5484. return $core.withContext(function($ctx2) {
  5485. return $recv(index).__gt($recv(subclasses)._size());
  5486. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5487. }))._whileFalse_((function(){
  5488. return $core.withContext(function($ctx2) {
  5489. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  5490. index=$recv(index).__plus((1));
  5491. return index;
  5492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5493. }));
  5494. $1=subclasses;
  5495. return $1;
  5496. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{subclasses:subclasses,index:index},$globals.Behavior)});
  5497. },
  5498. args: [],
  5499. source: "allSubclasses\x0a\x09\x22Answer an collection of the receiver's and the receiver's descendent's subclasses. \x22\x0a\x0a\x09| subclasses index |\x0a\x09\x0a\x09subclasses := self subclasses.\x0a\x09index := 1.\x0a\x09[ index > subclasses size ]\x0a\x09\x09whileFalse: [ subclasses addAll: (subclasses at: index) subclasses.\x0a\x09\x09\x09index := index + 1 ].\x0a\x0a\x09^ subclasses",
  5500. referencedClasses: [],
  5501. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+"]
  5502. }),
  5503. $globals.Behavior);
  5504. $core.addMethod(
  5505. $core.method({
  5506. selector: "allSubclassesDo:",
  5507. protocol: 'enumerating',
  5508. fn: function (aBlock){
  5509. var self=this;
  5510. return $core.withContext(function($ctx1) {
  5511. $recv(self._allSubclasses())._do_((function(each){
  5512. return $core.withContext(function($ctx2) {
  5513. return $recv(aBlock)._value_(each);
  5514. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5515. }));
  5516. return self;
  5517. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  5518. },
  5519. args: ["aBlock"],
  5520. source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a\x09self allSubclasses do: [ :each |\x0a \x09aBlock value: each ]",
  5521. referencedClasses: [],
  5522. messageSends: ["do:", "allSubclasses", "value:"]
  5523. }),
  5524. $globals.Behavior);
  5525. $core.addMethod(
  5526. $core.method({
  5527. selector: "allSuperclasses",
  5528. protocol: 'accessing',
  5529. fn: function (){
  5530. var self=this;
  5531. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  5532. return $core.withContext(function($ctx1) {
  5533. var $1,$2,$5,$4,$6,$3,$receiver;
  5534. $1=self._superclass();
  5535. $ctx1.sendIdx["superclass"]=1;
  5536. if(($receiver = $1) == null || $receiver.isNil){
  5537. $2=[];
  5538. return $2;
  5539. } else {
  5540. $1;
  5541. };
  5542. $5=self._superclass();
  5543. $ctx1.sendIdx["superclass"]=2;
  5544. $4=$recv($OrderedCollection())._with_($5);
  5545. $recv($4)._addAll_($recv(self._superclass())._allSuperclasses());
  5546. $6=$recv($4)._yourself();
  5547. $3=$6;
  5548. return $3;
  5549. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  5550. },
  5551. args: [],
  5552. source: "allSuperclasses\x0a\x09\x0a\x09self superclass ifNil: [ ^ #() ].\x0a\x09\x0a\x09^ (OrderedCollection with: self superclass)\x0a\x09\x09addAll: self superclass allSuperclasses;\x0a\x09\x09yourself",
  5553. referencedClasses: ["OrderedCollection"],
  5554. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  5555. }),
  5556. $globals.Behavior);
  5557. $core.addMethod(
  5558. $core.method({
  5559. selector: "basicAddCompiledMethod:",
  5560. protocol: 'private',
  5561. fn: function (aMethod){
  5562. var self=this;
  5563. return $core.withContext(function($ctx1) {
  5564. $core.addMethod(aMethod, self);
  5565. return self;
  5566. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  5567. },
  5568. args: ["aMethod"],
  5569. source: "basicAddCompiledMethod: aMethod\x0a\x09<$core.addMethod(aMethod, self)>",
  5570. referencedClasses: [],
  5571. messageSends: []
  5572. }),
  5573. $globals.Behavior);
  5574. $core.addMethod(
  5575. $core.method({
  5576. selector: "basicNew",
  5577. protocol: 'instance creation',
  5578. fn: function (){
  5579. var self=this;
  5580. return $core.withContext(function($ctx1) {
  5581. return new self.fn();
  5582. return self;
  5583. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  5584. },
  5585. args: [],
  5586. source: "basicNew\x0a\x09<return new self.fn()>",
  5587. referencedClasses: [],
  5588. messageSends: []
  5589. }),
  5590. $globals.Behavior);
  5591. $core.addMethod(
  5592. $core.method({
  5593. selector: "basicRemoveCompiledMethod:",
  5594. protocol: 'private',
  5595. fn: function (aMethod){
  5596. var self=this;
  5597. return $core.withContext(function($ctx1) {
  5598. $core.removeMethod(aMethod,self);
  5599. return self;
  5600. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  5601. },
  5602. args: ["aMethod"],
  5603. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<$core.removeMethod(aMethod,self)>",
  5604. referencedClasses: [],
  5605. messageSends: []
  5606. }),
  5607. $globals.Behavior);
  5608. $core.addMethod(
  5609. $core.method({
  5610. selector: "canUnderstand:",
  5611. protocol: 'testing',
  5612. fn: function (aSelector){
  5613. var self=this;
  5614. return $core.withContext(function($ctx1) {
  5615. var $3,$2,$1;
  5616. $1=$recv(self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  5617. return $core.withContext(function($ctx2) {
  5618. $3=self._superclass();
  5619. $ctx2.sendIdx["superclass"]=1;
  5620. $2=$recv($3)._notNil();
  5621. return $recv($2)._and_((function(){
  5622. return $core.withContext(function($ctx3) {
  5623. return $recv(self._superclass())._canUnderstand_(aSelector);
  5624. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  5625. }));
  5626. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5627. }));
  5628. return $1;
  5629. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  5630. },
  5631. args: ["aSelector"],
  5632. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  5633. referencedClasses: [],
  5634. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  5635. }),
  5636. $globals.Behavior);
  5637. $core.addMethod(
  5638. $core.method({
  5639. selector: "comment",
  5640. protocol: 'accessing',
  5641. fn: function (){
  5642. var self=this;
  5643. return $core.withContext(function($ctx1) {
  5644. var $2,$1,$receiver;
  5645. $2=self._basicAt_("comment");
  5646. if(($receiver = $2) == null || $receiver.isNil){
  5647. $1="";
  5648. } else {
  5649. $1=$2;
  5650. };
  5651. return $1;
  5652. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.Behavior)});
  5653. },
  5654. args: [],
  5655. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  5656. referencedClasses: [],
  5657. messageSends: ["ifNil:", "basicAt:"]
  5658. }),
  5659. $globals.Behavior);
  5660. $core.addMethod(
  5661. $core.method({
  5662. selector: "comment:",
  5663. protocol: 'accessing',
  5664. fn: function (aString){
  5665. var self=this;
  5666. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  5667. function $ClassCommentChanged(){return $globals.ClassCommentChanged||(typeof ClassCommentChanged=="undefined"?nil:ClassCommentChanged)}
  5668. return $core.withContext(function($ctx1) {
  5669. var $1,$2;
  5670. self._basicAt_put_("comment",aString);
  5671. $1=$recv($ClassCommentChanged())._new();
  5672. $recv($1)._theClass_(self);
  5673. $2=$recv($1)._yourself();
  5674. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  5675. return self;
  5676. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.Behavior)});
  5677. },
  5678. args: ["aString"],
  5679. source: "comment: aString\x0a\x09self basicAt: 'comment' put: aString.\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassCommentChanged new\x0a\x09\x09\x09theClass: self;\x0a\x09\x09\x09yourself)",
  5680. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  5681. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  5682. }),
  5683. $globals.Behavior);
  5684. $core.addMethod(
  5685. $core.method({
  5686. selector: "compile:protocol:",
  5687. protocol: 'compiling',
  5688. fn: function (aString,anotherString){
  5689. var self=this;
  5690. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  5691. return $core.withContext(function($ctx1) {
  5692. var $1;
  5693. $1=$recv($recv($Compiler())._new())._install_forClass_protocol_(aString,self,anotherString);
  5694. return $1;
  5695. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.Behavior)});
  5696. },
  5697. args: ["aString", "anotherString"],
  5698. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  5699. referencedClasses: ["Compiler"],
  5700. messageSends: ["install:forClass:protocol:", "new"]
  5701. }),
  5702. $globals.Behavior);
  5703. $core.addMethod(
  5704. $core.method({
  5705. selector: "definition",
  5706. protocol: 'accessing',
  5707. fn: function (){
  5708. var self=this;
  5709. return "";
  5710. },
  5711. args: [],
  5712. source: "definition\x0a\x09^ ''",
  5713. referencedClasses: [],
  5714. messageSends: []
  5715. }),
  5716. $globals.Behavior);
  5717. $core.addMethod(
  5718. $core.method({
  5719. selector: "includesBehavior:",
  5720. protocol: 'testing',
  5721. fn: function (aClass){
  5722. var self=this;
  5723. return $core.withContext(function($ctx1) {
  5724. var $1;
  5725. $1=$recv(self.__eq_eq(aClass))._or_((function(){
  5726. return $core.withContext(function($ctx2) {
  5727. return self._inheritsFrom_(aClass);
  5728. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5729. }));
  5730. return $1;
  5731. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  5732. },
  5733. args: ["aClass"],
  5734. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  5735. referencedClasses: [],
  5736. messageSends: ["or:", "==", "inheritsFrom:"]
  5737. }),
  5738. $globals.Behavior);
  5739. $core.addMethod(
  5740. $core.method({
  5741. selector: "includesSelector:",
  5742. protocol: 'testing',
  5743. fn: function (aString){
  5744. var self=this;
  5745. return $core.withContext(function($ctx1) {
  5746. var $1;
  5747. $1=$recv(self._methodDictionary())._includesKey_(aString);
  5748. return $1;
  5749. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.Behavior)});
  5750. },
  5751. args: ["aString"],
  5752. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  5753. referencedClasses: [],
  5754. messageSends: ["includesKey:", "methodDictionary"]
  5755. }),
  5756. $globals.Behavior);
  5757. $core.addMethod(
  5758. $core.method({
  5759. selector: "inheritsFrom:",
  5760. protocol: 'testing',
  5761. fn: function (aClass){
  5762. var self=this;
  5763. return $core.withContext(function($ctx1) {
  5764. var $1,$4,$3,$2,$receiver;
  5765. $1=self._superclass();
  5766. $ctx1.sendIdx["superclass"]=1;
  5767. if(($receiver = $1) == null || $receiver.isNil){
  5768. return false;
  5769. } else {
  5770. $1;
  5771. };
  5772. $4=self._superclass();
  5773. $ctx1.sendIdx["superclass"]=2;
  5774. $3=$recv(aClass).__eq_eq($4);
  5775. $2=$recv($3)._or_((function(){
  5776. return $core.withContext(function($ctx2) {
  5777. return $recv(self._superclass())._inheritsFrom_(aClass);
  5778. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5779. }));
  5780. return $2;
  5781. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  5782. },
  5783. args: ["aClass"],
  5784. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  5785. referencedClasses: [],
  5786. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  5787. }),
  5788. $globals.Behavior);
  5789. $core.addMethod(
  5790. $core.method({
  5791. selector: "instanceVariableNames",
  5792. protocol: 'accessing',
  5793. fn: function (){
  5794. var self=this;
  5795. return $core.withContext(function($ctx1) {
  5796. return self.iVarNames;
  5797. return self;
  5798. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  5799. },
  5800. args: [],
  5801. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  5802. referencedClasses: [],
  5803. messageSends: []
  5804. }),
  5805. $globals.Behavior);
  5806. $core.addMethod(
  5807. $core.method({
  5808. selector: "isBehavior",
  5809. protocol: 'testing',
  5810. fn: function (){
  5811. var self=this;
  5812. return true;
  5813. },
  5814. args: [],
  5815. source: "isBehavior\x0a\x09^ true",
  5816. referencedClasses: [],
  5817. messageSends: []
  5818. }),
  5819. $globals.Behavior);
  5820. $core.addMethod(
  5821. $core.method({
  5822. selector: "javascriptConstructor",
  5823. protocol: 'accessing',
  5824. fn: function (){
  5825. var self=this;
  5826. return $core.withContext(function($ctx1) {
  5827. return self.fn;
  5828. return self;
  5829. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  5830. },
  5831. args: [],
  5832. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<return self.fn>",
  5833. referencedClasses: [],
  5834. messageSends: []
  5835. }),
  5836. $globals.Behavior);
  5837. $core.addMethod(
  5838. $core.method({
  5839. selector: "javascriptConstructor:",
  5840. protocol: 'accessing',
  5841. fn: function (aJavaScriptFunction){
  5842. var self=this;
  5843. return $core.withContext(function($ctx1) {
  5844. $core.setClassConstructor(self, aJavaScriptFunction);;
  5845. return self;
  5846. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  5847. },
  5848. args: ["aJavaScriptFunction"],
  5849. source: "javascriptConstructor: aJavaScriptFunction\x0a\x09\x22Set the JS constructor used to instantiate.\x0a\x09See the JS counter-part in boot.js `$core.setClassConstructor'\x22\x0a\x09\x0a\x09<$core.setClassConstructor(self, aJavaScriptFunction);>",
  5850. referencedClasses: [],
  5851. messageSends: []
  5852. }),
  5853. $globals.Behavior);
  5854. $core.addMethod(
  5855. $core.method({
  5856. selector: "lookupSelector:",
  5857. protocol: 'accessing',
  5858. fn: function (selector){
  5859. var self=this;
  5860. var lookupClass;
  5861. return $core.withContext(function($ctx1) {
  5862. var $1,$2;
  5863. var $early={};
  5864. try {
  5865. lookupClass=self;
  5866. $recv((function(){
  5867. return $core.withContext(function($ctx2) {
  5868. return $recv(lookupClass).__eq(nil);
  5869. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5870. }))._whileFalse_((function(){
  5871. return $core.withContext(function($ctx2) {
  5872. $1=$recv(lookupClass)._includesSelector_(selector);
  5873. if($core.assert($1)){
  5874. $2=$recv(lookupClass)._methodAt_(selector);
  5875. throw $early=[$2];
  5876. };
  5877. lookupClass=$recv(lookupClass)._superclass();
  5878. return lookupClass;
  5879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5880. }));
  5881. return nil;
  5882. }
  5883. catch(e) {if(e===$early)return e[0]; throw e}
  5884. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  5885. },
  5886. args: ["selector"],
  5887. source: "lookupSelector: selector\x0a\x09\x22Look up the given selector in my methodDictionary.\x0a\x09Return the corresponding method if found.\x0a\x09Otherwise chase the superclass chain and try again.\x0a\x09Return nil if no method is found.\x22\x0a\x09\x0a\x09| lookupClass |\x0a\x09\x0a\x09lookupClass := self.\x0a\x09[ lookupClass = nil ] whileFalse: [\x0a\x09\x09(lookupClass includesSelector: selector)\x0a\x09\x09\x09\x09ifTrue: [ ^ lookupClass methodAt: selector ].\x0a\x09\x09\x09lookupClass := lookupClass superclass ].\x0a\x09^ nil",
  5888. referencedClasses: [],
  5889. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  5890. }),
  5891. $globals.Behavior);
  5892. $core.addMethod(
  5893. $core.method({
  5894. selector: "methodAt:",
  5895. protocol: 'accessing',
  5896. fn: function (aString){
  5897. var self=this;
  5898. return $core.withContext(function($ctx1) {
  5899. var $1;
  5900. $1=$recv(self._methodDictionary())._at_(aString);
  5901. return $1;
  5902. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.Behavior)});
  5903. },
  5904. args: ["aString"],
  5905. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  5906. referencedClasses: [],
  5907. messageSends: ["at:", "methodDictionary"]
  5908. }),
  5909. $globals.Behavior);
  5910. $core.addMethod(
  5911. $core.method({
  5912. selector: "methodDictionary",
  5913. protocol: 'accessing',
  5914. fn: function (){
  5915. var self=this;
  5916. return $core.withContext(function($ctx1) {
  5917. var dict = $globals.HashedCollection._new();
  5918. var methods = self.methods;
  5919. Object.keys(methods).forEach(function(i) {
  5920. if(methods[i].selector) {
  5921. dict._at_put_(methods[i].selector, methods[i]);
  5922. }
  5923. });
  5924. return dict;
  5925. return self;
  5926. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.Behavior)});
  5927. },
  5928. args: [],
  5929. source: "methodDictionary\x0a\x09<var dict = $globals.HashedCollection._new();\x0a\x09var methods = self.methods;\x0a\x09Object.keys(methods).forEach(function(i) {\x0a\x09\x09if(methods[i].selector) {\x0a\x09\x09\x09dict._at_put_(methods[i].selector, methods[i]);\x0a\x09\x09}\x0a\x09});\x0a\x09return dict>",
  5930. referencedClasses: [],
  5931. messageSends: []
  5932. }),
  5933. $globals.Behavior);
  5934. $core.addMethod(
  5935. $core.method({
  5936. selector: "methodTemplate",
  5937. protocol: 'accessing',
  5938. fn: function (){
  5939. var self=this;
  5940. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  5941. return $core.withContext(function($ctx1) {
  5942. var $3,$4,$2,$7,$8,$6,$9,$5,$10,$1;
  5943. $1=$recv($String())._streamContents_((function(stream){
  5944. return $core.withContext(function($ctx2) {
  5945. $recv(stream)._nextPutAll_("messageSelectorAndArgumentNames");
  5946. $ctx2.sendIdx["nextPutAll:"]=1;
  5947. $3=$recv($String())._lf();
  5948. $ctx2.sendIdx["lf"]=1;
  5949. $4=$recv($String())._tab();
  5950. $ctx2.sendIdx["tab"]=1;
  5951. $2=$recv($3).__comma($4);
  5952. $ctx2.sendIdx[","]=1;
  5953. $recv(stream)._nextPutAll_($2);
  5954. $ctx2.sendIdx["nextPutAll:"]=2;
  5955. $recv(stream)._nextPutAll_("\x22comment stating purpose of message\x22");
  5956. $ctx2.sendIdx["nextPutAll:"]=3;
  5957. $7=$recv($String())._lf();
  5958. $ctx2.sendIdx["lf"]=2;
  5959. $8=$recv($String())._lf();
  5960. $ctx2.sendIdx["lf"]=3;
  5961. $6=$recv($7).__comma($8);
  5962. $ctx2.sendIdx[","]=3;
  5963. $9=$recv($String())._tab();
  5964. $ctx2.sendIdx["tab"]=2;
  5965. $5=$recv($6).__comma($9);
  5966. $ctx2.sendIdx[","]=2;
  5967. $recv(stream)._nextPutAll_($5);
  5968. $ctx2.sendIdx["nextPutAll:"]=4;
  5969. $recv(stream)._nextPutAll_("| temporary variable names |");
  5970. $ctx2.sendIdx["nextPutAll:"]=5;
  5971. $recv(stream)._nextPutAll_($recv($recv($String())._lf()).__comma($recv($String())._tab()));
  5972. $ctx2.sendIdx["nextPutAll:"]=6;
  5973. $10=$recv(stream)._nextPutAll_("statements");
  5974. return $10;
  5975. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  5976. }));
  5977. return $1;
  5978. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.Behavior)});
  5979. },
  5980. args: [],
  5981. source: "methodTemplate\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: 'messageSelectorAndArgumentNames';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: '\x22comment stating purpose of message\x22';\x0a\x09\x09\x09nextPutAll: String lf, String lf, String tab;\x0a\x09\x09\x09nextPutAll: '| temporary variable names |';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'statements' ]",
  5982. referencedClasses: ["String"],
  5983. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab"]
  5984. }),
  5985. $globals.Behavior);
  5986. $core.addMethod(
  5987. $core.method({
  5988. selector: "methods",
  5989. protocol: 'accessing',
  5990. fn: function (){
  5991. var self=this;
  5992. return $core.withContext(function($ctx1) {
  5993. var $1;
  5994. $1=$recv(self._methodDictionary())._values();
  5995. return $1;
  5996. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.Behavior)});
  5997. },
  5998. args: [],
  5999. source: "methods\x0a\x09^ self methodDictionary values",
  6000. referencedClasses: [],
  6001. messageSends: ["values", "methodDictionary"]
  6002. }),
  6003. $globals.Behavior);
  6004. $core.addMethod(
  6005. $core.method({
  6006. selector: "methodsInProtocol:",
  6007. protocol: 'accessing',
  6008. fn: function (aString){
  6009. var self=this;
  6010. return $core.withContext(function($ctx1) {
  6011. var $1;
  6012. $1=$recv(self._methods())._select_((function(each){
  6013. return $core.withContext(function($ctx2) {
  6014. return $recv($recv(each)._protocol()).__eq(aString);
  6015. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6016. }));
  6017. return $1;
  6018. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.Behavior)});
  6019. },
  6020. args: ["aString"],
  6021. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  6022. referencedClasses: [],
  6023. messageSends: ["select:", "methods", "=", "protocol"]
  6024. }),
  6025. $globals.Behavior);
  6026. $core.addMethod(
  6027. $core.method({
  6028. selector: "name",
  6029. protocol: 'accessing',
  6030. fn: function (){
  6031. var self=this;
  6032. return $core.withContext(function($ctx1) {
  6033. return self.className || nil;
  6034. return self;
  6035. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Behavior)});
  6036. },
  6037. args: [],
  6038. source: "name\x0a\x09<return self.className || nil>",
  6039. referencedClasses: [],
  6040. messageSends: []
  6041. }),
  6042. $globals.Behavior);
  6043. $core.addMethod(
  6044. $core.method({
  6045. selector: "new",
  6046. protocol: 'instance creation',
  6047. fn: function (){
  6048. var self=this;
  6049. return $core.withContext(function($ctx1) {
  6050. var $1;
  6051. $1=$recv(self._basicNew())._initialize();
  6052. return $1;
  6053. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  6054. },
  6055. args: [],
  6056. source: "new\x0a\x09^ self basicNew initialize",
  6057. referencedClasses: [],
  6058. messageSends: ["initialize", "basicNew"]
  6059. }),
  6060. $globals.Behavior);
  6061. $core.addMethod(
  6062. $core.method({
  6063. selector: "organization",
  6064. protocol: 'accessing',
  6065. fn: function (){
  6066. var self=this;
  6067. return $core.withContext(function($ctx1) {
  6068. var $1;
  6069. $1=self._basicAt_("organization");
  6070. return $1;
  6071. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Behavior)});
  6072. },
  6073. args: [],
  6074. source: "organization\x0a\x09^ self basicAt: 'organization'",
  6075. referencedClasses: [],
  6076. messageSends: ["basicAt:"]
  6077. }),
  6078. $globals.Behavior);
  6079. $core.addMethod(
  6080. $core.method({
  6081. selector: "ownMethods",
  6082. protocol: 'accessing',
  6083. fn: function (){
  6084. var self=this;
  6085. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  6086. return $core.withContext(function($ctx1) {
  6087. var $2,$1;
  6088. $1=$recv($recv(self._ownProtocols())._inject_into_($recv($OrderedCollection())._new(),(function(acc,each){
  6089. return $core.withContext(function($ctx2) {
  6090. return $recv(acc).__comma(self._methodsInProtocol_(each));
  6091. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  6092. })))._sorted_((function(a,b){
  6093. return $core.withContext(function($ctx2) {
  6094. $2=$recv(a)._selector();
  6095. $ctx2.sendIdx["selector"]=1;
  6096. return $recv($2).__lt_eq($recv(b)._selector());
  6097. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  6098. }));
  6099. return $1;
  6100. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.Behavior)});
  6101. },
  6102. args: [],
  6103. source: "ownMethods\x0a\x09\x22Answer the methods of the receiver that are not package extensions\x22\x0a\x0a\x09^ (self ownProtocols \x0a\x09\x09inject: OrderedCollection new\x0a\x09\x09into: [ :acc :each | acc, (self methodsInProtocol: each) ])\x0a\x09\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  6104. referencedClasses: ["OrderedCollection"],
  6105. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "methodsInProtocol:", "<=", "selector"]
  6106. }),
  6107. $globals.Behavior);
  6108. $core.addMethod(
  6109. $core.method({
  6110. selector: "ownProtocols",
  6111. protocol: 'accessing',
  6112. fn: function (){
  6113. var self=this;
  6114. return $core.withContext(function($ctx1) {
  6115. var $1;
  6116. $1=$recv(self._protocols())._reject_((function(each){
  6117. return $core.withContext(function($ctx2) {
  6118. return $recv(each)._match_("^\x5c*");
  6119. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6120. }));
  6121. return $1;
  6122. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.Behavior)});
  6123. },
  6124. args: [],
  6125. source: "ownProtocols\x0a\x09\x22Answer the protocols of the receiver that are not package extensions\x22\x0a\x0a\x09^ self protocols reject: [ :each |\x0a\x09\x09each match: '^\x5c*' ]",
  6126. referencedClasses: [],
  6127. messageSends: ["reject:", "protocols", "match:"]
  6128. }),
  6129. $globals.Behavior);
  6130. $core.addMethod(
  6131. $core.method({
  6132. selector: "packageOfProtocol:",
  6133. protocol: 'accessing',
  6134. fn: function (aString){
  6135. var self=this;
  6136. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  6137. return $core.withContext(function($ctx1) {
  6138. var $1,$2,$3;
  6139. $1=$recv(aString)._beginsWith_("*");
  6140. if(!$core.assert($1)){
  6141. $2=self._package();
  6142. return $2;
  6143. };
  6144. $3=$recv($Package())._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  6145. return nil;
  6146. }));
  6147. return $3;
  6148. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.Behavior)});
  6149. },
  6150. args: ["aString"],
  6151. source: "packageOfProtocol: aString\x0a\x09\x22Answer the package the method of receiver belongs to:\x0a\x09- if it is an extension method, answer the corresponding package\x0a\x09- else answer the receiver's package\x22\x0a\x09\x0a\x09(aString beginsWith: '*') ifFalse: [\x0a\x09\x09^ self package ].\x0a\x09\x09\x0a\x09^ Package \x0a\x09\x09named: aString allButFirst\x0a\x09\x09ifAbsent: [ nil ]",
  6152. referencedClasses: ["Package"],
  6153. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  6154. }),
  6155. $globals.Behavior);
  6156. $core.addMethod(
  6157. $core.method({
  6158. selector: "protocols",
  6159. protocol: 'accessing',
  6160. fn: function (){
  6161. var self=this;
  6162. return $core.withContext(function($ctx1) {
  6163. var $1;
  6164. $1=$recv($recv(self._organization())._elements())._sorted();
  6165. return $1;
  6166. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.Behavior)});
  6167. },
  6168. args: [],
  6169. source: "protocols\x0a\x09^ self organization elements sorted",
  6170. referencedClasses: [],
  6171. messageSends: ["sorted", "elements", "organization"]
  6172. }),
  6173. $globals.Behavior);
  6174. $core.addMethod(
  6175. $core.method({
  6176. selector: "protocolsDo:",
  6177. protocol: 'enumerating',
  6178. fn: function (aBlock){
  6179. var self=this;
  6180. var methodsByProtocol;
  6181. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  6182. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  6183. return $core.withContext(function($ctx1) {
  6184. methodsByProtocol=$recv($HashedCollection())._new();
  6185. $ctx1.sendIdx["new"]=1;
  6186. $recv(self._methodDictionary())._valuesDo_((function(m){
  6187. return $core.withContext(function($ctx2) {
  6188. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  6189. return $core.withContext(function($ctx3) {
  6190. return $recv($Array())._new();
  6191. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  6192. })))._add_(m);
  6193. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  6194. }));
  6195. $recv(self._protocols())._do_((function(protocol){
  6196. return $core.withContext(function($ctx2) {
  6197. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  6198. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  6199. }));
  6200. return self;
  6201. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.Behavior)});
  6202. },
  6203. args: ["aBlock"],
  6204. source: "protocolsDo: aBlock\x0a\x09\x22Execute aBlock for each method protocol with\x0a\x09its collection of methods in the sort order of protocol name.\x22\x0a\x0a\x09| methodsByProtocol |\x0a\x09methodsByProtocol := HashedCollection new.\x0a\x09self methodDictionary valuesDo: [ :m |\x0a\x09\x09(methodsByProtocol at: m protocol ifAbsentPut: [ Array new ])\x0a\x09\x09\x09add: m ].\x0a\x09self protocols do: [ :protocol |\x0a\x09\x09aBlock value: protocol value: (methodsByProtocol at: protocol) ]",
  6205. referencedClasses: ["HashedCollection", "Array"],
  6206. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  6207. }),
  6208. $globals.Behavior);
  6209. $core.addMethod(
  6210. $core.method({
  6211. selector: "prototype",
  6212. protocol: 'accessing',
  6213. fn: function (){
  6214. var self=this;
  6215. return $core.withContext(function($ctx1) {
  6216. return self.fn.prototype;
  6217. return self;
  6218. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  6219. },
  6220. args: [],
  6221. source: "prototype\x0a\x09<return self.fn.prototype>",
  6222. referencedClasses: [],
  6223. messageSends: []
  6224. }),
  6225. $globals.Behavior);
  6226. $core.addMethod(
  6227. $core.method({
  6228. selector: "recompile",
  6229. protocol: 'compiling',
  6230. fn: function (){
  6231. var self=this;
  6232. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6233. return $core.withContext(function($ctx1) {
  6234. var $1;
  6235. $1=$recv($recv($Compiler())._new())._recompile_(self);
  6236. return $1;
  6237. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.Behavior)});
  6238. },
  6239. args: [],
  6240. source: "recompile\x0a\x09^ Compiler new recompile: self",
  6241. referencedClasses: ["Compiler"],
  6242. messageSends: ["recompile:", "new"]
  6243. }),
  6244. $globals.Behavior);
  6245. $core.addMethod(
  6246. $core.method({
  6247. selector: "removeCompiledMethod:",
  6248. protocol: 'compiling',
  6249. fn: function (aMethod){
  6250. var self=this;
  6251. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6252. function $MethodRemoved(){return $globals.MethodRemoved||(typeof MethodRemoved=="undefined"?nil:MethodRemoved)}
  6253. return $core.withContext(function($ctx1) {
  6254. var $1,$2;
  6255. self._basicRemoveCompiledMethod_(aMethod);
  6256. self._removeProtocolIfEmpty_($recv(aMethod)._protocol());
  6257. $1=$recv($MethodRemoved())._new();
  6258. $recv($1)._method_(aMethod);
  6259. $2=$recv($1)._yourself();
  6260. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  6261. return self;
  6262. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  6263. },
  6264. args: ["aMethod"],
  6265. source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09self removeProtocolIfEmpty: aMethod protocol.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)",
  6266. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  6267. messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"]
  6268. }),
  6269. $globals.Behavior);
  6270. $core.addMethod(
  6271. $core.method({
  6272. selector: "removeProtocolIfEmpty:",
  6273. protocol: 'accessing',
  6274. fn: function (aString){
  6275. var self=this;
  6276. return $core.withContext(function($ctx1) {
  6277. $recv(self._methods())._detect_ifNone_((function(each){
  6278. return $core.withContext(function($ctx2) {
  6279. return $recv($recv(each)._protocol()).__eq(aString);
  6280. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6281. }),(function(){
  6282. return $core.withContext(function($ctx2) {
  6283. return $recv(self._organization())._removeElement_(aString);
  6284. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6285. }));
  6286. return self;
  6287. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.Behavior)});
  6288. },
  6289. args: ["aString"],
  6290. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  6291. referencedClasses: [],
  6292. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  6293. }),
  6294. $globals.Behavior);
  6295. $core.addMethod(
  6296. $core.method({
  6297. selector: "selectors",
  6298. protocol: 'accessing',
  6299. fn: function (){
  6300. var self=this;
  6301. return $core.withContext(function($ctx1) {
  6302. var $1;
  6303. $1=$recv(self._methodDictionary())._keys();
  6304. return $1;
  6305. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.Behavior)});
  6306. },
  6307. args: [],
  6308. source: "selectors\x0a\x09^ self methodDictionary keys",
  6309. referencedClasses: [],
  6310. messageSends: ["keys", "methodDictionary"]
  6311. }),
  6312. $globals.Behavior);
  6313. $core.addMethod(
  6314. $core.method({
  6315. selector: "subclasses",
  6316. protocol: 'accessing',
  6317. fn: function (){
  6318. var self=this;
  6319. return $core.withContext(function($ctx1) {
  6320. self._subclassResponsibility();
  6321. return self;
  6322. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  6323. },
  6324. args: [],
  6325. source: "subclasses\x0a\x09self subclassResponsibility",
  6326. referencedClasses: [],
  6327. messageSends: ["subclassResponsibility"]
  6328. }),
  6329. $globals.Behavior);
  6330. $core.addMethod(
  6331. $core.method({
  6332. selector: "superclass",
  6333. protocol: 'accessing',
  6334. fn: function (){
  6335. var self=this;
  6336. return $core.withContext(function($ctx1) {
  6337. return self.superclass || nil;
  6338. return self;
  6339. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  6340. },
  6341. args: [],
  6342. source: "superclass\x0a\x09<return self.superclass || nil>",
  6343. referencedClasses: [],
  6344. messageSends: []
  6345. }),
  6346. $globals.Behavior);
  6347. $core.addMethod(
  6348. $core.method({
  6349. selector: "theMetaClass",
  6350. protocol: 'accessing',
  6351. fn: function (){
  6352. var self=this;
  6353. return $core.withContext(function($ctx1) {
  6354. self._subclassResponsibility();
  6355. return self;
  6356. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  6357. },
  6358. args: [],
  6359. source: "theMetaClass\x0a\x09self subclassResponsibility",
  6360. referencedClasses: [],
  6361. messageSends: ["subclassResponsibility"]
  6362. }),
  6363. $globals.Behavior);
  6364. $core.addMethod(
  6365. $core.method({
  6366. selector: "theNonMetaClass",
  6367. protocol: 'accessing',
  6368. fn: function (){
  6369. var self=this;
  6370. return $core.withContext(function($ctx1) {
  6371. self._subclassResponsibility();
  6372. return self;
  6373. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  6374. },
  6375. args: [],
  6376. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  6377. referencedClasses: [],
  6378. messageSends: ["subclassResponsibility"]
  6379. }),
  6380. $globals.Behavior);
  6381. $core.addMethod(
  6382. $core.method({
  6383. selector: "withAllSubclasses",
  6384. protocol: 'accessing',
  6385. fn: function (){
  6386. var self=this;
  6387. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  6388. return $core.withContext(function($ctx1) {
  6389. var $2,$3,$1;
  6390. $2=$recv($Array())._with_(self);
  6391. $recv($2)._addAll_(self._allSubclasses());
  6392. $3=$recv($2)._yourself();
  6393. $1=$3;
  6394. return $1;
  6395. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  6396. },
  6397. args: [],
  6398. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  6399. referencedClasses: ["Array"],
  6400. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  6401. }),
  6402. $globals.Behavior);
  6403. $core.addClass('Class', $globals.Behavior, [], 'Kernel-Classes');
  6404. $globals.Class.comment="I am __the__ class object.\x0a\x0aMy instances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder` instance.";
  6405. $core.addMethod(
  6406. $core.method({
  6407. selector: "asJavascript",
  6408. protocol: 'converting',
  6409. fn: function (){
  6410. var self=this;
  6411. return $core.withContext(function($ctx1) {
  6412. var $1;
  6413. $1="$globals.".__comma(self._name());
  6414. return $1;
  6415. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Class)});
  6416. },
  6417. args: [],
  6418. source: "asJavascript\x0a\x09^ '$globals.', self name",
  6419. referencedClasses: [],
  6420. messageSends: [",", "name"]
  6421. }),
  6422. $globals.Class);
  6423. $core.addMethod(
  6424. $core.method({
  6425. selector: "browse",
  6426. protocol: 'browsing',
  6427. fn: function (){
  6428. var self=this;
  6429. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  6430. return $core.withContext(function($ctx1) {
  6431. $recv($Finder())._findClass_(self);
  6432. return self;
  6433. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Class)});
  6434. },
  6435. args: [],
  6436. source: "browse\x0a\x09Finder findClass: self",
  6437. referencedClasses: ["Finder"],
  6438. messageSends: ["findClass:"]
  6439. }),
  6440. $globals.Class);
  6441. $core.addMethod(
  6442. $core.method({
  6443. selector: "category",
  6444. protocol: 'accessing',
  6445. fn: function (){
  6446. var self=this;
  6447. return $core.withContext(function($ctx1) {
  6448. var $2,$1,$receiver;
  6449. $2=self._package();
  6450. $ctx1.sendIdx["package"]=1;
  6451. if(($receiver = $2) == null || $receiver.isNil){
  6452. $1="Unclassified";
  6453. } else {
  6454. $1=$recv(self._package())._name();
  6455. };
  6456. return $1;
  6457. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.Class)});
  6458. },
  6459. args: [],
  6460. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  6461. referencedClasses: [],
  6462. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  6463. }),
  6464. $globals.Class);
  6465. $core.addMethod(
  6466. $core.method({
  6467. selector: "classTag",
  6468. protocol: 'accessing',
  6469. fn: function (){
  6470. var self=this;
  6471. return "class";
  6472. },
  6473. args: [],
  6474. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'class'",
  6475. referencedClasses: [],
  6476. messageSends: []
  6477. }),
  6478. $globals.Class);
  6479. $core.addMethod(
  6480. $core.method({
  6481. selector: "definition",
  6482. protocol: 'accessing',
  6483. fn: function (){
  6484. var self=this;
  6485. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  6486. return $core.withContext(function($ctx1) {
  6487. var $3,$4,$2,$5,$6,$7,$1;
  6488. $1=$recv($String())._streamContents_((function(stream){
  6489. return $core.withContext(function($ctx2) {
  6490. $recv(stream)._nextPutAll_($recv(self._superclass())._asString());
  6491. $ctx2.sendIdx["nextPutAll:"]=1;
  6492. $recv(stream)._nextPutAll_(" subclass: #");
  6493. $ctx2.sendIdx["nextPutAll:"]=2;
  6494. $recv(stream)._nextPutAll_(self._name());
  6495. $ctx2.sendIdx["nextPutAll:"]=3;
  6496. $3=$recv($String())._lf();
  6497. $ctx2.sendIdx["lf"]=1;
  6498. $4=$recv($String())._tab();
  6499. $ctx2.sendIdx["tab"]=1;
  6500. $2=$recv($3).__comma($4);
  6501. $ctx2.sendIdx[","]=1;
  6502. $recv(stream)._nextPutAll_($2);
  6503. $ctx2.sendIdx["nextPutAll:"]=4;
  6504. $5=$recv(stream)._nextPutAll_("instanceVariableNames: '");
  6505. $ctx2.sendIdx["nextPutAll:"]=5;
  6506. $5;
  6507. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  6508. return $core.withContext(function($ctx3) {
  6509. return $recv(stream)._nextPutAll_(each);
  6510. $ctx3.sendIdx["nextPutAll:"]=6;
  6511. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6512. }),(function(){
  6513. return $core.withContext(function($ctx3) {
  6514. return $recv(stream)._nextPutAll_(" ");
  6515. $ctx3.sendIdx["nextPutAll:"]=7;
  6516. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6517. }));
  6518. $6=$recv("'".__comma($recv($String())._lf())).__comma($recv($String())._tab());
  6519. $ctx2.sendIdx[","]=2;
  6520. $recv(stream)._nextPutAll_($6);
  6521. $ctx2.sendIdx["nextPutAll:"]=8;
  6522. $recv(stream)._nextPutAll_("package: '");
  6523. $ctx2.sendIdx["nextPutAll:"]=9;
  6524. $recv(stream)._nextPutAll_(self._category());
  6525. $ctx2.sendIdx["nextPutAll:"]=10;
  6526. $7=$recv(stream)._nextPutAll_("'");
  6527. return $7;
  6528. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6529. }));
  6530. return $1;
  6531. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  6532. },
  6533. args: [],
  6534. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self superclass asString;\x0a\x09\x09\x09nextPutAll: ' subclass: #';\x0a\x09\x09\x09nextPutAll: self name;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: '''', String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'package: ''';\x0a\x09\x09\x09nextPutAll: self category;\x0a\x09\x09\x09nextPutAll: '''' ]",
  6535. referencedClasses: ["String"],
  6536. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category"]
  6537. }),
  6538. $globals.Class);
  6539. $core.addMethod(
  6540. $core.method({
  6541. selector: "isClass",
  6542. protocol: 'testing',
  6543. fn: function (){
  6544. var self=this;
  6545. return true;
  6546. },
  6547. args: [],
  6548. source: "isClass\x0a\x09^ true",
  6549. referencedClasses: [],
  6550. messageSends: []
  6551. }),
  6552. $globals.Class);
  6553. $core.addMethod(
  6554. $core.method({
  6555. selector: "package",
  6556. protocol: 'accessing',
  6557. fn: function (){
  6558. var self=this;
  6559. return $core.withContext(function($ctx1) {
  6560. var $1;
  6561. $1=self._basicAt_("pkg");
  6562. return $1;
  6563. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Class)});
  6564. },
  6565. args: [],
  6566. source: "package\x0a\x09^ self basicAt: 'pkg'",
  6567. referencedClasses: [],
  6568. messageSends: ["basicAt:"]
  6569. }),
  6570. $globals.Class);
  6571. $core.addMethod(
  6572. $core.method({
  6573. selector: "package:",
  6574. protocol: 'accessing',
  6575. fn: function (aPackage){
  6576. var self=this;
  6577. var oldPackage;
  6578. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6579. function $ClassMoved(){return $globals.ClassMoved||(typeof ClassMoved=="undefined"?nil:ClassMoved)}
  6580. return $core.withContext(function($ctx1) {
  6581. var $2,$1,$3,$4,$5;
  6582. $2=self._package();
  6583. $ctx1.sendIdx["package"]=1;
  6584. $1=$recv($2).__eq(aPackage);
  6585. if($core.assert($1)){
  6586. return self;
  6587. };
  6588. oldPackage=self._package();
  6589. self._basicAt_put_("pkg",aPackage);
  6590. $3=$recv(oldPackage)._organization();
  6591. $ctx1.sendIdx["organization"]=1;
  6592. $recv($3)._removeElement_(self);
  6593. $recv($recv(aPackage)._organization())._addElement_(self);
  6594. $4=$recv($ClassMoved())._new();
  6595. $recv($4)._theClass_(self);
  6596. $recv($4)._oldPackage_(oldPackage);
  6597. $5=$recv($4)._yourself();
  6598. $recv($recv($SystemAnnouncer())._current())._announce_($5);
  6599. return self;
  6600. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.Class)});
  6601. },
  6602. args: ["aPackage"],
  6603. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self basicAt: 'pkg' put: aPackage.\x0a\x09oldPackage organization removeElement: self.\x0a\x09aPackage organization addElement: self.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  6604. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  6605. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  6606. }),
  6607. $globals.Class);
  6608. $core.addMethod(
  6609. $core.method({
  6610. selector: "printOn:",
  6611. protocol: 'printing',
  6612. fn: function (aStream){
  6613. var self=this;
  6614. return $core.withContext(function($ctx1) {
  6615. $recv(aStream)._nextPutAll_(self._name());
  6616. return self;
  6617. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Class)});
  6618. },
  6619. args: ["aStream"],
  6620. source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
  6621. referencedClasses: [],
  6622. messageSends: ["nextPutAll:", "name"]
  6623. }),
  6624. $globals.Class);
  6625. $core.addMethod(
  6626. $core.method({
  6627. selector: "rename:",
  6628. protocol: 'accessing',
  6629. fn: function (aString){
  6630. var self=this;
  6631. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6632. return $core.withContext(function($ctx1) {
  6633. $recv($recv($ClassBuilder())._new())._renameClass_to_(self,aString);
  6634. return self;
  6635. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  6636. },
  6637. args: ["aString"],
  6638. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  6639. referencedClasses: ["ClassBuilder"],
  6640. messageSends: ["renameClass:to:", "new"]
  6641. }),
  6642. $globals.Class);
  6643. $core.addMethod(
  6644. $core.method({
  6645. selector: "subclass:instanceVariableNames:",
  6646. protocol: 'class creation',
  6647. fn: function (aString,anotherString){
  6648. var self=this;
  6649. return $core.withContext(function($ctx1) {
  6650. var $1;
  6651. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  6652. return $1;
  6653. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.Class)});
  6654. },
  6655. args: ["aString", "anotherString"],
  6656. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  6657. referencedClasses: [],
  6658. messageSends: ["subclass:instanceVariableNames:package:"]
  6659. }),
  6660. $globals.Class);
  6661. $core.addMethod(
  6662. $core.method({
  6663. selector: "subclass:instanceVariableNames:category:",
  6664. protocol: 'class creation',
  6665. fn: function (aString,aString2,aString3){
  6666. var self=this;
  6667. return $core.withContext(function($ctx1) {
  6668. var $1;
  6669. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  6670. return $1;
  6671. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  6672. },
  6673. args: ["aString", "aString2", "aString3"],
  6674. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  6675. referencedClasses: [],
  6676. messageSends: ["subclass:instanceVariableNames:package:"]
  6677. }),
  6678. $globals.Class);
  6679. $core.addMethod(
  6680. $core.method({
  6681. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  6682. protocol: 'class creation',
  6683. fn: function (aString,aString2,classVars,pools,aString3){
  6684. var self=this;
  6685. return $core.withContext(function($ctx1) {
  6686. var $1;
  6687. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  6688. return $1;
  6689. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.Class)});
  6690. },
  6691. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  6692. source: "subclass: aString instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Kept for file-in compatibility. ignores class variables and pools.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  6693. referencedClasses: [],
  6694. messageSends: ["subclass:instanceVariableNames:package:"]
  6695. }),
  6696. $globals.Class);
  6697. $core.addMethod(
  6698. $core.method({
  6699. selector: "subclass:instanceVariableNames:package:",
  6700. protocol: 'class creation',
  6701. fn: function (aString,aString2,aString3){
  6702. var self=this;
  6703. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6704. return $core.withContext(function($ctx1) {
  6705. var $1;
  6706. $1=$recv($recv($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  6707. return $1;
  6708. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  6709. },
  6710. args: ["aString", "aString2", "aString3"],
  6711. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  6712. referencedClasses: ["ClassBuilder"],
  6713. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  6714. }),
  6715. $globals.Class);
  6716. $core.addMethod(
  6717. $core.method({
  6718. selector: "subclasses",
  6719. protocol: 'accessing',
  6720. fn: function (){
  6721. var self=this;
  6722. return $core.withContext(function($ctx1) {
  6723. return self.subclasses._copy();
  6724. return self;
  6725. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  6726. },
  6727. args: [],
  6728. source: "subclasses\x0a\x09<return self.subclasses._copy()>",
  6729. referencedClasses: [],
  6730. messageSends: []
  6731. }),
  6732. $globals.Class);
  6733. $core.addMethod(
  6734. $core.method({
  6735. selector: "theMetaClass",
  6736. protocol: 'accessing',
  6737. fn: function (){
  6738. var self=this;
  6739. return $core.withContext(function($ctx1) {
  6740. var $1;
  6741. $1=self._class();
  6742. return $1;
  6743. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  6744. },
  6745. args: [],
  6746. source: "theMetaClass\x0a\x09^ self class",
  6747. referencedClasses: [],
  6748. messageSends: ["class"]
  6749. }),
  6750. $globals.Class);
  6751. $core.addMethod(
  6752. $core.method({
  6753. selector: "theNonMetaClass",
  6754. protocol: 'accessing',
  6755. fn: function (){
  6756. var self=this;
  6757. return self;
  6758. },
  6759. args: [],
  6760. source: "theNonMetaClass\x0a\x09^ self",
  6761. referencedClasses: [],
  6762. messageSends: []
  6763. }),
  6764. $globals.Class);
  6765. $core.addClass('Metaclass', $globals.Behavior, [], 'Kernel-Classes');
  6766. $globals.Metaclass.comment="I am the root of the class hierarchy.\x0a\x0aMy instances are metaclasses, one for each real class, and have a single instance, which they hold onto: the class that they are the metaclass of.";
  6767. $core.addMethod(
  6768. $core.method({
  6769. selector: "asJavascript",
  6770. protocol: 'converting',
  6771. fn: function (){
  6772. var self=this;
  6773. return $core.withContext(function($ctx1) {
  6774. var $1;
  6775. $1=$recv("$globals.".__comma($recv(self._instanceClass())._name())).__comma(".klass");
  6776. $ctx1.sendIdx[","]=1;
  6777. return $1;
  6778. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Metaclass)});
  6779. },
  6780. args: [],
  6781. source: "asJavascript\x0a\x09^ '$globals.', self instanceClass name, '.klass'",
  6782. referencedClasses: [],
  6783. messageSends: [",", "name", "instanceClass"]
  6784. }),
  6785. $globals.Metaclass);
  6786. $core.addMethod(
  6787. $core.method({
  6788. selector: "definition",
  6789. protocol: 'accessing',
  6790. fn: function (){
  6791. var self=this;
  6792. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  6793. return $core.withContext(function($ctx1) {
  6794. var $2,$1;
  6795. $1=$recv($String())._streamContents_((function(stream){
  6796. return $core.withContext(function($ctx2) {
  6797. $recv(stream)._nextPutAll_(self._asString());
  6798. $ctx2.sendIdx["nextPutAll:"]=1;
  6799. $2=$recv(stream)._nextPutAll_(" instanceVariableNames: '");
  6800. $ctx2.sendIdx["nextPutAll:"]=2;
  6801. $2;
  6802. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  6803. return $core.withContext(function($ctx3) {
  6804. return $recv(stream)._nextPutAll_(each);
  6805. $ctx3.sendIdx["nextPutAll:"]=3;
  6806. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6807. }),(function(){
  6808. return $core.withContext(function($ctx3) {
  6809. return $recv(stream)._nextPutAll_(" ");
  6810. $ctx3.sendIdx["nextPutAll:"]=4;
  6811. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6812. }));
  6813. return $recv(stream)._nextPutAll_("'");
  6814. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6815. }));
  6816. return $1;
  6817. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  6818. },
  6819. args: [],
  6820. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self asString;\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream nextPutAll: '''' ]",
  6821. referencedClasses: ["String"],
  6822. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"]
  6823. }),
  6824. $globals.Metaclass);
  6825. $core.addMethod(
  6826. $core.method({
  6827. selector: "instanceClass",
  6828. protocol: 'accessing',
  6829. fn: function (){
  6830. var self=this;
  6831. return $core.withContext(function($ctx1) {
  6832. return self.instanceClass;
  6833. return self;
  6834. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  6835. },
  6836. args: [],
  6837. source: "instanceClass\x0a\x09<return self.instanceClass>",
  6838. referencedClasses: [],
  6839. messageSends: []
  6840. }),
  6841. $globals.Metaclass);
  6842. $core.addMethod(
  6843. $core.method({
  6844. selector: "instanceVariableNames:",
  6845. protocol: 'accessing',
  6846. fn: function (aCollection){
  6847. var self=this;
  6848. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6849. return $core.withContext(function($ctx1) {
  6850. $recv($recv($ClassBuilder())._new())._class_instanceVariableNames_(self,aCollection);
  6851. return self;
  6852. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  6853. },
  6854. args: ["aCollection"],
  6855. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
  6856. referencedClasses: ["ClassBuilder"],
  6857. messageSends: ["class:instanceVariableNames:", "new"]
  6858. }),
  6859. $globals.Metaclass);
  6860. $core.addMethod(
  6861. $core.method({
  6862. selector: "isMetaclass",
  6863. protocol: 'testing',
  6864. fn: function (){
  6865. var self=this;
  6866. return true;
  6867. },
  6868. args: [],
  6869. source: "isMetaclass\x0a\x09^ true",
  6870. referencedClasses: [],
  6871. messageSends: []
  6872. }),
  6873. $globals.Metaclass);
  6874. $core.addMethod(
  6875. $core.method({
  6876. selector: "package",
  6877. protocol: 'accessing',
  6878. fn: function (){
  6879. var self=this;
  6880. return $core.withContext(function($ctx1) {
  6881. var $1;
  6882. $1=$recv(self._instanceClass())._package();
  6883. return $1;
  6884. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  6885. },
  6886. args: [],
  6887. source: "package\x0a\x09^ self instanceClass package",
  6888. referencedClasses: [],
  6889. messageSends: ["package", "instanceClass"]
  6890. }),
  6891. $globals.Metaclass);
  6892. $core.addMethod(
  6893. $core.method({
  6894. selector: "printOn:",
  6895. protocol: 'printing',
  6896. fn: function (aStream){
  6897. var self=this;
  6898. return $core.withContext(function($ctx1) {
  6899. var $1;
  6900. $recv(aStream)._nextPutAll_($recv(self._instanceClass())._name());
  6901. $ctx1.sendIdx["nextPutAll:"]=1;
  6902. $1=$recv(aStream)._nextPutAll_(" class");
  6903. return self;
  6904. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Metaclass)});
  6905. },
  6906. args: ["aStream"],
  6907. source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
  6908. referencedClasses: [],
  6909. messageSends: ["nextPutAll:", "name", "instanceClass"]
  6910. }),
  6911. $globals.Metaclass);
  6912. $core.addMethod(
  6913. $core.method({
  6914. selector: "subclasses",
  6915. protocol: 'accessing',
  6916. fn: function (){
  6917. var self=this;
  6918. return $core.withContext(function($ctx1) {
  6919. var $1;
  6920. $1=$recv($recv($recv(self._instanceClass())._subclasses())._select_((function(each){
  6921. return $core.withContext(function($ctx2) {
  6922. return $recv($recv(each)._isMetaclass())._not();
  6923. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6924. })))._collect_((function(each){
  6925. return $core.withContext(function($ctx2) {
  6926. return $recv(each)._theMetaClass();
  6927. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  6928. }));
  6929. return $1;
  6930. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  6931. },
  6932. args: [],
  6933. source: "subclasses\x0a\x09^ (self instanceClass subclasses \x0a\x09\x09select: [ :each | each isMetaclass not ])\x0a\x09\x09collect: [ :each | each theMetaClass ]",
  6934. referencedClasses: [],
  6935. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "not", "isMetaclass", "theMetaClass"]
  6936. }),
  6937. $globals.Metaclass);
  6938. $core.addMethod(
  6939. $core.method({
  6940. selector: "theMetaClass",
  6941. protocol: 'accessing',
  6942. fn: function (){
  6943. var self=this;
  6944. return self;
  6945. },
  6946. args: [],
  6947. source: "theMetaClass\x0a\x09^ self",
  6948. referencedClasses: [],
  6949. messageSends: []
  6950. }),
  6951. $globals.Metaclass);
  6952. $core.addMethod(
  6953. $core.method({
  6954. selector: "theNonMetaClass",
  6955. protocol: 'accessing',
  6956. fn: function (){
  6957. var self=this;
  6958. return $core.withContext(function($ctx1) {
  6959. var $1;
  6960. $1=self._instanceClass();
  6961. return $1;
  6962. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  6963. },
  6964. args: [],
  6965. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  6966. referencedClasses: [],
  6967. messageSends: ["instanceClass"]
  6968. }),
  6969. $globals.Metaclass);
  6970. $core.addClass('ClassBuilder', $globals.Object, [], 'Kernel-Classes');
  6971. $globals.ClassBuilder.comment="I am responsible for compiling new classes or modifying existing classes in the system.\x0a\x0aRather than using me directly to compile a class, use `Class >> subclass:instanceVariableNames:package:`.";
  6972. $core.addMethod(
  6973. $core.method({
  6974. selector: "addSubclassOf:named:instanceVariableNames:package:",
  6975. protocol: 'class definition',
  6976. fn: function (aClass,className,aCollection,packageName){
  6977. var self=this;
  6978. var theClass,thePackage;
  6979. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  6980. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  6981. return $core.withContext(function($ctx1) {
  6982. var $1,$2,$3,$4,$receiver;
  6983. theClass=$recv($recv($Smalltalk())._globals())._at_(className);
  6984. thePackage=$recv($Package())._named_(packageName);
  6985. $1=theClass;
  6986. if(($receiver = $1) == null || $receiver.isNil){
  6987. $1;
  6988. } else {
  6989. $recv(theClass)._package_(thePackage);
  6990. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  6991. if(!$core.assert($2)){
  6992. $3=self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  6993. return $3;
  6994. };
  6995. };
  6996. $4=self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  6997. return $4;
  6998. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  6999. },
  7000. args: ["aClass", "className", "aCollection", "packageName"],
  7001. source: "addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName\x0a\x09| theClass thePackage |\x0a\x09\x0a\x09theClass := Smalltalk globals at: className.\x0a\x09thePackage := Package named: packageName.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass package: thePackage.\x0a\x09\x09theClass superclass == aClass ifFalse: [\x0a\x09\x09\x09^ self\x0a\x09\x09\x09\x09migrateClassNamed: className\x0a\x09\x09\x09\x09superclass: aClass\x0a\x09\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09\x09package: packageName ] ].\x0a\x09\x09\x0a\x09^ self\x0a\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName",
  7002. referencedClasses: ["Smalltalk", "Package"],
  7003. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "basicAddSubclassOf:named:instanceVariableNames:package:"]
  7004. }),
  7005. $globals.ClassBuilder);
  7006. $core.addMethod(
  7007. $core.method({
  7008. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  7009. protocol: 'private',
  7010. fn: function (aClass,aString,aCollection,packageName){
  7011. var self=this;
  7012. return $core.withContext(function($ctx1) {
  7013. $core.addClass(aString, aClass, aCollection, packageName);
  7014. return $globals[aString]
  7015. ;
  7016. return self;
  7017. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  7018. },
  7019. args: ["aClass", "aString", "aCollection", "packageName"],
  7020. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<\x0a\x09\x09$core.addClass(aString, aClass, aCollection, packageName);\x0a\x09\x09return $globals[aString]\x0a\x09>",
  7021. referencedClasses: [],
  7022. messageSends: []
  7023. }),
  7024. $globals.ClassBuilder);
  7025. $core.addMethod(
  7026. $core.method({
  7027. selector: "basicClass:instanceVariableNames:",
  7028. protocol: 'private',
  7029. fn: function (aClass,aString){
  7030. var self=this;
  7031. return $core.withContext(function($ctx1) {
  7032. self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
  7033. return self;
  7034. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7035. },
  7036. args: ["aClass", "aString"],
  7037. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  7038. referencedClasses: [],
  7039. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"]
  7040. }),
  7041. $globals.ClassBuilder);
  7042. $core.addMethod(
  7043. $core.method({
  7044. selector: "basicClass:instanceVariables:",
  7045. protocol: 'private',
  7046. fn: function (aClass,aCollection){
  7047. var self=this;
  7048. return $core.withContext(function($ctx1) {
  7049. var $1;
  7050. $1=$recv(aClass)._isMetaclass();
  7051. if(!$core.assert($1)){
  7052. self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  7053. };
  7054. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  7055. return self;
  7056. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  7057. },
  7058. args: ["aClass", "aCollection"],
  7059. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  7060. referencedClasses: [],
  7061. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  7062. }),
  7063. $globals.ClassBuilder);
  7064. $core.addMethod(
  7065. $core.method({
  7066. selector: "basicRemoveClass:",
  7067. protocol: 'private',
  7068. fn: function (aClass){
  7069. var self=this;
  7070. return $core.withContext(function($ctx1) {
  7071. $core.removeClass(aClass);
  7072. return self;
  7073. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  7074. },
  7075. args: ["aClass"],
  7076. source: "basicRemoveClass: aClass\x0a\x09<$core.removeClass(aClass)>",
  7077. referencedClasses: [],
  7078. messageSends: []
  7079. }),
  7080. $globals.ClassBuilder);
  7081. $core.addMethod(
  7082. $core.method({
  7083. selector: "basicRenameClass:to:",
  7084. protocol: 'private',
  7085. fn: function (aClass,aString){
  7086. var self=this;
  7087. return $core.withContext(function($ctx1) {
  7088. $globals[aString] = aClass;
  7089. delete $globals[aClass.className];
  7090. aClass.className = aString;
  7091. ;
  7092. return self;
  7093. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7094. },
  7095. args: ["aClass", "aString"],
  7096. source: "basicRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09$globals[aString] = aClass;\x0a\x09\x09delete $globals[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09>",
  7097. referencedClasses: [],
  7098. messageSends: []
  7099. }),
  7100. $globals.ClassBuilder);
  7101. $core.addMethod(
  7102. $core.method({
  7103. selector: "basicSwapClassNames:with:",
  7104. protocol: 'private',
  7105. fn: function (aClass,anotherClass){
  7106. var self=this;
  7107. return $core.withContext(function($ctx1) {
  7108. var tmp = aClass.className;
  7109. aClass.className = anotherClass.className;
  7110. anotherClass.className = tmp;
  7111. ;
  7112. return self;
  7113. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7114. },
  7115. args: ["aClass", "anotherClass"],
  7116. source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<\x0a\x09\x09var tmp = aClass.className;\x0a\x09\x09aClass.className = anotherClass.className;\x0a\x09\x09anotherClass.className = tmp;\x0a\x09>",
  7117. referencedClasses: [],
  7118. messageSends: []
  7119. }),
  7120. $globals.ClassBuilder);
  7121. $core.addMethod(
  7122. $core.method({
  7123. selector: "class:instanceVariableNames:",
  7124. protocol: 'class definition',
  7125. fn: function (aClass,ivarNames){
  7126. var self=this;
  7127. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7128. function $ClassDefinitionChanged(){return $globals.ClassDefinitionChanged||(typeof ClassDefinitionChanged=="undefined"?nil:ClassDefinitionChanged)}
  7129. return $core.withContext(function($ctx1) {
  7130. var $1,$2;
  7131. self._basicClass_instanceVariableNames_(aClass,ivarNames);
  7132. self._setupClass_(aClass);
  7133. $1=$recv($ClassDefinitionChanged())._new();
  7134. $recv($1)._theClass_(aClass);
  7135. $2=$recv($1)._yourself();
  7136. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  7137. return self;
  7138. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  7139. },
  7140. args: ["aClass", "ivarNames"],
  7141. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self basicClass: aClass instanceVariableNames: ivarNames.\x0a\x09self setupClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  7142. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  7143. messageSends: ["basicClass:instanceVariableNames:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"]
  7144. }),
  7145. $globals.ClassBuilder);
  7146. $core.addMethod(
  7147. $core.method({
  7148. selector: "copyClass:named:",
  7149. protocol: 'copying',
  7150. fn: function (aClass,className){
  7151. var self=this;
  7152. var newClass;
  7153. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7154. function $ClassAdded(){return $globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  7155. return $core.withContext(function($ctx1) {
  7156. var $1,$2,$3;
  7157. newClass=self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  7158. self._copyClass_to_(aClass,newClass);
  7159. $1=$recv($ClassAdded())._new();
  7160. $recv($1)._theClass_(newClass);
  7161. $2=$recv($1)._yourself();
  7162. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  7163. $3=newClass;
  7164. return $3;
  7165. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  7166. },
  7167. args: ["aClass", "className"],
  7168. source: "copyClass: aClass named: className\x0a\x09| newClass |\x0a\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass superclass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name.\x0a\x0a\x09self copyClass: aClass to: newClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  7169. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  7170. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  7171. }),
  7172. $globals.ClassBuilder);
  7173. $core.addMethod(
  7174. $core.method({
  7175. selector: "copyClass:to:",
  7176. protocol: 'copying',
  7177. fn: function (aClass,anotherClass){
  7178. var self=this;
  7179. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  7180. return $core.withContext(function($ctx1) {
  7181. var $1,$2,$3,$4,$5,$7,$6,$9,$8;
  7182. $recv(anotherClass)._comment_($recv(aClass)._comment());
  7183. $1=$recv(aClass)._methodDictionary();
  7184. $ctx1.sendIdx["methodDictionary"]=1;
  7185. $recv($1)._valuesDo_((function(each){
  7186. return $core.withContext(function($ctx2) {
  7187. $2=$recv($Compiler())._new();
  7188. $ctx2.sendIdx["new"]=1;
  7189. $3=$recv(each)._source();
  7190. $ctx2.sendIdx["source"]=1;
  7191. $4=$recv(each)._protocol();
  7192. $ctx2.sendIdx["protocol"]=1;
  7193. return $recv($2)._install_forClass_protocol_($3,anotherClass,$4);
  7194. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  7195. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7196. }));
  7197. $ctx1.sendIdx["valuesDo:"]=1;
  7198. $5=$recv(anotherClass)._class();
  7199. $ctx1.sendIdx["class"]=1;
  7200. $7=$recv(aClass)._class();
  7201. $ctx1.sendIdx["class"]=2;
  7202. $6=$recv($7)._instanceVariableNames();
  7203. self._basicClass_instanceVariables_($5,$6);
  7204. $9=$recv(aClass)._class();
  7205. $ctx1.sendIdx["class"]=3;
  7206. $8=$recv($9)._methodDictionary();
  7207. $recv($8)._valuesDo_((function(each){
  7208. return $core.withContext(function($ctx2) {
  7209. return $recv($recv($Compiler())._new())._install_forClass_protocol_($recv(each)._source(),$recv(anotherClass)._class(),$recv(each)._protocol());
  7210. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7211. }));
  7212. self._setupClass_(anotherClass);
  7213. return self;
  7214. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7215. },
  7216. args: ["aClass", "anotherClass"],
  7217. source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary valuesDo: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass protocol: each protocol ].\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary valuesDo: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass class protocol: each protocol ].\x0a\x0a\x09self setupClass: anotherClass",
  7218. referencedClasses: ["Compiler"],
  7219. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "install:forClass:protocol:", "new", "source", "protocol", "basicClass:instanceVariables:", "class", "instanceVariableNames", "setupClass:"]
  7220. }),
  7221. $globals.ClassBuilder);
  7222. $core.addMethod(
  7223. $core.method({
  7224. selector: "installMethod:forClass:protocol:",
  7225. protocol: 'method definition',
  7226. fn: function (aCompiledMethod,aBehavior,aString){
  7227. var self=this;
  7228. return $core.withContext(function($ctx1) {
  7229. $recv(aCompiledMethod)._protocol_(aString);
  7230. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  7231. return aCompiledMethod;
  7232. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  7233. },
  7234. args: ["aCompiledMethod", "aBehavior", "aString"],
  7235. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  7236. referencedClasses: [],
  7237. messageSends: ["protocol:", "addCompiledMethod:"]
  7238. }),
  7239. $globals.ClassBuilder);
  7240. $core.addMethod(
  7241. $core.method({
  7242. selector: "instanceVariableNamesFor:",
  7243. protocol: 'accessing',
  7244. fn: function (aString){
  7245. var self=this;
  7246. return $core.withContext(function($ctx1) {
  7247. var $1;
  7248. $1=$recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  7249. return $core.withContext(function($ctx2) {
  7250. return $recv(each)._isEmpty();
  7251. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7252. }));
  7253. return $1;
  7254. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  7255. },
  7256. args: ["aString"],
  7257. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  7258. referencedClasses: [],
  7259. messageSends: ["reject:", "tokenize:", "isEmpty"]
  7260. }),
  7261. $globals.ClassBuilder);
  7262. $core.addMethod(
  7263. $core.method({
  7264. selector: "migrateClass:superclass:",
  7265. protocol: 'class migration',
  7266. fn: function (aClass,anotherClass){
  7267. var self=this;
  7268. return $core.withContext(function($ctx1) {
  7269. var $2,$1;
  7270. $2=$recv(aClass)._name();
  7271. $ctx1.sendIdx["name"]=1;
  7272. $1=self._migrateClassNamed_superclass_instanceVariableNames_package_($2,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  7273. return $1;
  7274. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7275. },
  7276. args: ["aClass", "anotherClass"],
  7277. source: "migrateClass: aClass superclass: anotherClass\x0a\x09^ self\x0a\x09\x09migrateClassNamed: aClass name\x0a\x09\x09superclass: anotherClass\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name",
  7278. referencedClasses: [],
  7279. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  7280. }),
  7281. $globals.ClassBuilder);
  7282. $core.addMethod(
  7283. $core.method({
  7284. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  7285. protocol: 'class migration',
  7286. fn: function (className,aClass,aCollection,packageName){
  7287. var self=this;
  7288. var oldClass,newClass,tmp;
  7289. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  7290. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  7291. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7292. function $ClassMigrated(){return $globals.ClassMigrated||(typeof ClassMigrated=="undefined"?nil:ClassMigrated)}
  7293. return $core.withContext(function($ctx1) {
  7294. var $1,$2,$3,$4,$5;
  7295. tmp="new*".__comma(className);
  7296. oldClass=$recv($recv($Smalltalk())._globals())._at_(className);
  7297. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  7298. self._basicSwapClassNames_with_(oldClass,newClass);
  7299. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  7300. $recv((function(){
  7301. return $core.withContext(function($ctx2) {
  7302. return self._copyClass_to_(oldClass,newClass);
  7303. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7304. }))._on_do_($Error(),(function(exception){
  7305. return $core.withContext(function($ctx2) {
  7306. self._basicSwapClassNames_with_(oldClass,newClass);
  7307. $1=self._basicRemoveClass_(newClass);
  7308. $ctx2.sendIdx["basicRemoveClass:"]=1;
  7309. $1;
  7310. return $recv(exception)._resignal();
  7311. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  7312. }));
  7313. self._rawRenameClass_to_(oldClass,tmp);
  7314. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  7315. $2=self._rawRenameClass_to_(newClass,className);
  7316. $recv($recv(oldClass)._subclasses())._do_((function(each){
  7317. return $core.withContext(function($ctx2) {
  7318. return self._migrateClass_superclass_(each,newClass);
  7319. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7320. }));
  7321. self._basicRemoveClass_(oldClass);
  7322. $3=$recv($ClassMigrated())._new();
  7323. $recv($3)._theClass_(newClass);
  7324. $recv($3)._oldClass_(oldClass);
  7325. $4=$recv($3)._yourself();
  7326. $recv($recv($SystemAnnouncer())._current())._announce_($4);
  7327. $5=newClass;
  7328. return $5;
  7329. }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{className:className,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass,tmp:tmp},$globals.ClassBuilder)});
  7330. },
  7331. args: ["className", "aClass", "aCollection", "packageName"],
  7332. source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk globals at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09\x09exception resignal ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  7333. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  7334. messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "resignal", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"]
  7335. }),
  7336. $globals.ClassBuilder);
  7337. $core.addMethod(
  7338. $core.method({
  7339. selector: "rawRenameClass:to:",
  7340. protocol: 'private',
  7341. fn: function (aClass,aString){
  7342. var self=this;
  7343. return $core.withContext(function($ctx1) {
  7344. $globals[aString] = aClass;
  7345. ;
  7346. return self;
  7347. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7348. },
  7349. args: ["aClass", "aString"],
  7350. source: "rawRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09$globals[aString] = aClass;\x0a\x09>",
  7351. referencedClasses: [],
  7352. messageSends: []
  7353. }),
  7354. $globals.ClassBuilder);
  7355. $core.addMethod(
  7356. $core.method({
  7357. selector: "renameClass:to:",
  7358. protocol: 'class migration',
  7359. fn: function (aClass,className){
  7360. var self=this;
  7361. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7362. function $ClassRenamed(){return $globals.ClassRenamed||(typeof ClassRenamed=="undefined"?nil:ClassRenamed)}
  7363. return $core.withContext(function($ctx1) {
  7364. var $1,$2;
  7365. self._basicRenameClass_to_(aClass,className);
  7366. $recv(aClass)._recompile();
  7367. $1=$recv($ClassRenamed())._new();
  7368. $recv($1)._theClass_(aClass);
  7369. $2=$recv($1)._yourself();
  7370. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  7371. return self;
  7372. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  7373. },
  7374. args: ["aClass", "className"],
  7375. source: "renameClass: aClass to: className\x0a\x09self basicRenameClass: aClass to: className.\x0a\x09\x0a\x09\x22Recompile the class to fix potential issues with super sends\x22\x0a\x09aClass recompile.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRenamed new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  7376. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  7377. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  7378. }),
  7379. $globals.ClassBuilder);
  7380. $core.addMethod(
  7381. $core.method({
  7382. selector: "setupClass:",
  7383. protocol: 'public',
  7384. fn: function (aClass){
  7385. var self=this;
  7386. return $core.withContext(function($ctx1) {
  7387. $core.init(aClass);;
  7388. return self;
  7389. }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},$globals.ClassBuilder)});
  7390. },
  7391. args: ["aClass"],
  7392. source: "setupClass: aClass\x0a\x09<$core.init(aClass);>",
  7393. referencedClasses: [],
  7394. messageSends: []
  7395. }),
  7396. $globals.ClassBuilder);
  7397. $core.addMethod(
  7398. $core.method({
  7399. selector: "superclass:subclass:",
  7400. protocol: 'class definition',
  7401. fn: function (aClass,className){
  7402. var self=this;
  7403. return $core.withContext(function($ctx1) {
  7404. var $1;
  7405. $1=self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  7406. return $1;
  7407. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  7408. },
  7409. args: ["aClass", "className"],
  7410. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  7411. referencedClasses: [],
  7412. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  7413. }),
  7414. $globals.ClassBuilder);
  7415. $core.addMethod(
  7416. $core.method({
  7417. selector: "superclass:subclass:instanceVariableNames:package:",
  7418. protocol: 'class definition',
  7419. fn: function (aClass,className,ivarNames,packageName){
  7420. var self=this;
  7421. var newClass;
  7422. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7423. function $ClassAdded(){return $globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  7424. return $core.withContext(function($ctx1) {
  7425. var $1,$2,$3,$4,$5,$receiver;
  7426. $1=self._instanceVariableNamesFor_(ivarNames);
  7427. if(($receiver = packageName) == null || $receiver.isNil){
  7428. $2="unclassified";
  7429. } else {
  7430. $2=packageName;
  7431. };
  7432. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  7433. self._setupClass_(newClass);
  7434. $3=$recv($ClassAdded())._new();
  7435. $recv($3)._theClass_(newClass);
  7436. $4=$recv($3)._yourself();
  7437. $recv($recv($SystemAnnouncer())._current())._announce_($4);
  7438. $5=newClass;
  7439. return $5;
  7440. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  7441. },
  7442. args: ["aClass", "className", "ivarNames", "packageName"],
  7443. source: "superclass: aClass subclass: className instanceVariableNames: ivarNames package: packageName\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: className instanceVariableNames: (self instanceVariableNamesFor: ivarNames)\x0a\x09\x09package: (packageName ifNil: [ 'unclassified' ]).\x0a\x09self setupClass: newClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  7444. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  7445. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"]
  7446. }),
  7447. $globals.ClassBuilder);
  7448. $core.addClass('ClassSorterNode', $globals.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  7449. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://github.com/amber-smalltalk/amber/issues/143) on GitHub.";
  7450. $core.addMethod(
  7451. $core.method({
  7452. selector: "getNodesFrom:",
  7453. protocol: 'accessing',
  7454. fn: function (aCollection){
  7455. var self=this;
  7456. var children,others;
  7457. function $ClassSorterNode(){return $globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  7458. return $core.withContext(function($ctx1) {
  7459. var $1;
  7460. children=[];
  7461. others=[];
  7462. $recv(aCollection)._do_((function(each){
  7463. return $core.withContext(function($ctx2) {
  7464. $1=$recv($recv(each)._superclass()).__eq(self._theClass());
  7465. if($core.assert($1)){
  7466. return $recv(children)._add_(each);
  7467. $ctx2.sendIdx["add:"]=1;
  7468. } else {
  7469. return $recv(others)._add_(each);
  7470. };
  7471. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7472. }));
  7473. self["@nodes"]=$recv(children)._collect_((function(each){
  7474. return $core.withContext(function($ctx2) {
  7475. return $recv($ClassSorterNode())._on_classes_level_(each,others,$recv(self._level()).__plus((1)));
  7476. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  7477. }));
  7478. return self;
  7479. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  7480. },
  7481. args: ["aCollection"],
  7482. source: "getNodesFrom: aCollection\x0a\x09| children others |\x0a\x09children := #().\x0a\x09others := #().\x0a\x09aCollection do: [ :each |\x0a\x09\x09(each superclass = self theClass)\x0a\x09\x09\x09ifTrue: [ children add: each ]\x0a\x09\x09\x09ifFalse: [ others add: each ]].\x0a\x09nodes:= children collect: [ :each |\x0a\x09\x09ClassSorterNode on: each classes: others level: self level + 1 ]",
  7483. referencedClasses: ["ClassSorterNode"],
  7484. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  7485. }),
  7486. $globals.ClassSorterNode);
  7487. $core.addMethod(
  7488. $core.method({
  7489. selector: "level",
  7490. protocol: 'accessing',
  7491. fn: function (){
  7492. var self=this;
  7493. var $1;
  7494. $1=self["@level"];
  7495. return $1;
  7496. },
  7497. args: [],
  7498. source: "level\x0a\x09^ level",
  7499. referencedClasses: [],
  7500. messageSends: []
  7501. }),
  7502. $globals.ClassSorterNode);
  7503. $core.addMethod(
  7504. $core.method({
  7505. selector: "level:",
  7506. protocol: 'accessing',
  7507. fn: function (anInteger){
  7508. var self=this;
  7509. self["@level"]=anInteger;
  7510. return self;
  7511. },
  7512. args: ["anInteger"],
  7513. source: "level: anInteger\x0a\x09level := anInteger",
  7514. referencedClasses: [],
  7515. messageSends: []
  7516. }),
  7517. $globals.ClassSorterNode);
  7518. $core.addMethod(
  7519. $core.method({
  7520. selector: "nodes",
  7521. protocol: 'accessing',
  7522. fn: function (){
  7523. var self=this;
  7524. var $1;
  7525. $1=self["@nodes"];
  7526. return $1;
  7527. },
  7528. args: [],
  7529. source: "nodes\x0a\x09^ nodes",
  7530. referencedClasses: [],
  7531. messageSends: []
  7532. }),
  7533. $globals.ClassSorterNode);
  7534. $core.addMethod(
  7535. $core.method({
  7536. selector: "theClass",
  7537. protocol: 'accessing',
  7538. fn: function (){
  7539. var self=this;
  7540. var $1;
  7541. $1=self["@theClass"];
  7542. return $1;
  7543. },
  7544. args: [],
  7545. source: "theClass\x0a\x09^ theClass",
  7546. referencedClasses: [],
  7547. messageSends: []
  7548. }),
  7549. $globals.ClassSorterNode);
  7550. $core.addMethod(
  7551. $core.method({
  7552. selector: "theClass:",
  7553. protocol: 'accessing',
  7554. fn: function (aClass){
  7555. var self=this;
  7556. self["@theClass"]=aClass;
  7557. return self;
  7558. },
  7559. args: ["aClass"],
  7560. source: "theClass: aClass\x0a\x09theClass := aClass",
  7561. referencedClasses: [],
  7562. messageSends: []
  7563. }),
  7564. $globals.ClassSorterNode);
  7565. $core.addMethod(
  7566. $core.method({
  7567. selector: "traverseClassesWith:",
  7568. protocol: 'visiting',
  7569. fn: function (aCollection){
  7570. var self=this;
  7571. return $core.withContext(function($ctx1) {
  7572. var $1,$3,$2;
  7573. $1=self._theClass();
  7574. $ctx1.sendIdx["theClass"]=1;
  7575. $recv(aCollection)._add_($1);
  7576. $recv($recv(self._nodes())._sorted_((function(a,b){
  7577. return $core.withContext(function($ctx2) {
  7578. $3=$recv(a)._theClass();
  7579. $ctx2.sendIdx["theClass"]=2;
  7580. $2=$recv($3)._name();
  7581. $ctx2.sendIdx["name"]=1;
  7582. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  7583. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  7584. })))._do_((function(aNode){
  7585. return $core.withContext(function($ctx2) {
  7586. return $recv(aNode)._traverseClassesWith_(aCollection);
  7587. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  7588. }));
  7589. return self;
  7590. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  7591. },
  7592. args: ["aCollection"],
  7593. source: "traverseClassesWith: aCollection\x0a\x09\x22sort classes alphabetically Issue #143\x22\x0a\x0a\x09aCollection add: self theClass.\x0a\x09(self nodes sorted: [ :a :b | a theClass name <= b theClass name ]) do: [ :aNode |\x0a\x09\x09aNode traverseClassesWith: aCollection ].",
  7594. referencedClasses: [],
  7595. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  7596. }),
  7597. $globals.ClassSorterNode);
  7598. $core.addMethod(
  7599. $core.method({
  7600. selector: "on:classes:level:",
  7601. protocol: 'instance creation',
  7602. fn: function (aClass,aCollection,anInteger){
  7603. var self=this;
  7604. return $core.withContext(function($ctx1) {
  7605. var $2,$3,$1;
  7606. $2=self._new();
  7607. $recv($2)._theClass_(aClass);
  7608. $recv($2)._level_(anInteger);
  7609. $recv($2)._getNodesFrom_(aCollection);
  7610. $3=$recv($2)._yourself();
  7611. $1=$3;
  7612. return $1;
  7613. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.klass)});
  7614. },
  7615. args: ["aClass", "aCollection", "anInteger"],
  7616. source: "on: aClass classes: aCollection level: anInteger\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09level: anInteger;\x0a\x09\x09getNodesFrom: aCollection;\x0a\x09\x09yourself",
  7617. referencedClasses: [],
  7618. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  7619. }),
  7620. $globals.ClassSorterNode.klass);
  7621. });
  7622. define("amber_core/Kernel-Methods", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  7623. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  7624. $core.addPackage('Kernel-Methods');
  7625. $core.packages["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
  7626. $core.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7627. $core.addClass('BlockClosure', $globals.Object, [], 'Kernel-Methods');
  7628. $globals.BlockClosure.comment="I represent a lexical closure.\x0aI am is directly mapped to JavaScript Function.\x0a\x0a## API\x0a\x0a1. Evaluation\x0a\x0a My instances get evaluated with the `#value*` methods in the 'evaluating' protocol.\x0a\x0a Example: ` [ :x | x + 1 ] value: 3 \x22Answers 4\x22 `\x0a\x0a2. Control structures\x0a\x0a Blocks are used (together with `Boolean`) for control structures (methods in the `controlling` protocol).\x0a\x0a Example: `aBlock whileTrue: [ ... ]`\x0a\x0a3. Error handling\x0a\x0a I provide the `#on:do:` method for handling exceptions.\x0a\x0a Example: ` aBlock on: MessageNotUnderstood do: [ :ex | ... ] `";
  7629. $core.addMethod(
  7630. $core.method({
  7631. selector: "applyTo:arguments:",
  7632. protocol: 'evaluating',
  7633. fn: function (anObject,aCollection){
  7634. var self=this;
  7635. return $core.withContext(function($ctx1) {
  7636. return self.apply(anObject, aCollection);
  7637. return self;
  7638. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  7639. },
  7640. args: ["anObject", "aCollection"],
  7641. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  7642. referencedClasses: [],
  7643. messageSends: []
  7644. }),
  7645. $globals.BlockClosure);
  7646. $core.addMethod(
  7647. $core.method({
  7648. selector: "asCompiledMethod:",
  7649. protocol: 'converting',
  7650. fn: function (aString){
  7651. var self=this;
  7652. return $core.withContext(function($ctx1) {
  7653. return $core.method({selector:aString, fn:self});;
  7654. return self;
  7655. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  7656. },
  7657. args: ["aString"],
  7658. source: "asCompiledMethod: aString\x0a\x09<return $core.method({selector:aString, fn:self});>",
  7659. referencedClasses: [],
  7660. messageSends: []
  7661. }),
  7662. $globals.BlockClosure);
  7663. $core.addMethod(
  7664. $core.method({
  7665. selector: "compiledSource",
  7666. protocol: 'accessing',
  7667. fn: function (){
  7668. var self=this;
  7669. return $core.withContext(function($ctx1) {
  7670. return self.toString();
  7671. return self;
  7672. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  7673. },
  7674. args: [],
  7675. source: "compiledSource\x0a\x09<return self.toString()>",
  7676. referencedClasses: [],
  7677. messageSends: []
  7678. }),
  7679. $globals.BlockClosure);
  7680. $core.addMethod(
  7681. $core.method({
  7682. selector: "currySelf",
  7683. protocol: 'converting',
  7684. fn: function (){
  7685. var self=this;
  7686. return $core.withContext(function($ctx1) {
  7687. return function () {
  7688. var args = [ this ];
  7689. args.push.apply(args, arguments);
  7690. return self.apply(null, args);
  7691. }
  7692. ;
  7693. return self;
  7694. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  7695. },
  7696. args: [],
  7697. source: "currySelf\x0a\x09\x22Transforms [ :selfarg :x :y | stcode ] block\x0a\x09which represents JS function (selfarg, x, y, ...) {jscode}\x0a\x09into function (x, y, ...) {jscode} that takes selfarg from 'this'.\x0a\x09IOW, it is usable as JS method and first arg takes the receiver.\x22\x0a\x09\x0a\x09<\x0a\x09\x09return function () {\x0a\x09\x09\x09var args = [ this ];\x0a\x09\x09\x09args.push.apply(args, arguments);\x0a\x09\x09\x09return self.apply(null, args);\x0a\x09\x09}\x0a\x09>",
  7698. referencedClasses: [],
  7699. messageSends: []
  7700. }),
  7701. $globals.BlockClosure);
  7702. $core.addMethod(
  7703. $core.method({
  7704. selector: "ensure:",
  7705. protocol: 'evaluating',
  7706. fn: function (aBlock){
  7707. var self=this;
  7708. return $core.withContext(function($ctx1) {
  7709. try{return self._value()}finally{aBlock._value()};
  7710. return self;
  7711. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  7712. },
  7713. args: ["aBlock"],
  7714. source: "ensure: aBlock\x0a\x09<try{return self._value()}finally{aBlock._value()}>",
  7715. referencedClasses: [],
  7716. messageSends: []
  7717. }),
  7718. $globals.BlockClosure);
  7719. $core.addMethod(
  7720. $core.method({
  7721. selector: "fork",
  7722. protocol: 'timeout/interval',
  7723. fn: function (){
  7724. var self=this;
  7725. function $ForkPool(){return $globals.ForkPool||(typeof ForkPool=="undefined"?nil:ForkPool)}
  7726. return $core.withContext(function($ctx1) {
  7727. $recv($recv($ForkPool())._default())._fork_(self);
  7728. return self;
  7729. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  7730. },
  7731. args: [],
  7732. source: "fork\x0a\x09ForkPool default fork: self",
  7733. referencedClasses: ["ForkPool"],
  7734. messageSends: ["fork:", "default"]
  7735. }),
  7736. $globals.BlockClosure);
  7737. $core.addMethod(
  7738. $core.method({
  7739. selector: "new",
  7740. protocol: 'evaluating',
  7741. fn: function (){
  7742. var self=this;
  7743. return $core.withContext(function($ctx1) {
  7744. return new self();
  7745. return self;
  7746. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  7747. },
  7748. args: [],
  7749. source: "new\x0a\x09\x22Use the receiver as a JS constructor.\x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<return new self()>",
  7750. referencedClasses: [],
  7751. messageSends: []
  7752. }),
  7753. $globals.BlockClosure);
  7754. $core.addMethod(
  7755. $core.method({
  7756. selector: "newValue:",
  7757. protocol: 'evaluating',
  7758. fn: function (anObject){
  7759. var self=this;
  7760. return $core.withContext(function($ctx1) {
  7761. var $1;
  7762. $1=self._newWithValues_([anObject]);
  7763. return $1;
  7764. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  7765. },
  7766. args: ["anObject"],
  7767. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  7768. referencedClasses: [],
  7769. messageSends: ["newWithValues:"]
  7770. }),
  7771. $globals.BlockClosure);
  7772. $core.addMethod(
  7773. $core.method({
  7774. selector: "newValue:value:",
  7775. protocol: 'evaluating',
  7776. fn: function (anObject,anObject2){
  7777. var self=this;
  7778. return $core.withContext(function($ctx1) {
  7779. var $1;
  7780. $1=self._newWithValues_([anObject,anObject2]);
  7781. return $1;
  7782. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  7783. },
  7784. args: ["anObject", "anObject2"],
  7785. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  7786. referencedClasses: [],
  7787. messageSends: ["newWithValues:"]
  7788. }),
  7789. $globals.BlockClosure);
  7790. $core.addMethod(
  7791. $core.method({
  7792. selector: "newValue:value:value:",
  7793. protocol: 'evaluating',
  7794. fn: function (anObject,anObject2,anObject3){
  7795. var self=this;
  7796. return $core.withContext(function($ctx1) {
  7797. var $1;
  7798. $1=self._newWithValues_([anObject,anObject2,anObject3]);
  7799. return $1;
  7800. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  7801. },
  7802. args: ["anObject", "anObject2", "anObject3"],
  7803. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  7804. referencedClasses: [],
  7805. messageSends: ["newWithValues:"]
  7806. }),
  7807. $globals.BlockClosure);
  7808. $core.addMethod(
  7809. $core.method({
  7810. selector: "newWithValues:",
  7811. protocol: 'evaluating',
  7812. fn: function (aCollection){
  7813. var self=this;
  7814. return $core.withContext(function($ctx1) {
  7815. var object = Object.create(self.prototype);
  7816. var result = self.apply(object, aCollection);
  7817. return typeof result === "object" ? result : object;
  7818. ;
  7819. return self;
  7820. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  7821. },
  7822. args: ["aCollection"],
  7823. source: "newWithValues: aCollection\x0a\x09\x22Simulates JS new operator by combination of Object.create and .apply\x22\x0a\x09<\x0a\x09\x09var object = Object.create(self.prototype);\x0a\x09\x09var result = self.apply(object, aCollection);\x0a\x09\x09return typeof result === \x22object\x22 ? result : object;\x0a\x09>",
  7824. referencedClasses: [],
  7825. messageSends: []
  7826. }),
  7827. $globals.BlockClosure);
  7828. $core.addMethod(
  7829. $core.method({
  7830. selector: "numArgs",
  7831. protocol: 'accessing',
  7832. fn: function (){
  7833. var self=this;
  7834. return $core.withContext(function($ctx1) {
  7835. return self.length;
  7836. return self;
  7837. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  7838. },
  7839. args: [],
  7840. source: "numArgs\x0a\x09<return self.length>",
  7841. referencedClasses: [],
  7842. messageSends: []
  7843. }),
  7844. $globals.BlockClosure);
  7845. $core.addMethod(
  7846. $core.method({
  7847. selector: "on:do:",
  7848. protocol: 'error handling',
  7849. fn: function (anErrorClass,aBlock){
  7850. var self=this;
  7851. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  7852. return $core.withContext(function($ctx1) {
  7853. var $2,$1;
  7854. $1=self._tryCatch_((function(error){
  7855. var smalltalkError;
  7856. return $core.withContext(function($ctx2) {
  7857. smalltalkError=$recv($Smalltalk())._asSmalltalkException_(error);
  7858. smalltalkError;
  7859. $2=$recv(smalltalkError)._isKindOf_(anErrorClass);
  7860. if($core.assert($2)){
  7861. return $recv(aBlock)._value_(smalltalkError);
  7862. } else {
  7863. return $recv(smalltalkError)._resignal();
  7864. };
  7865. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  7866. }));
  7867. return $1;
  7868. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  7869. },
  7870. args: ["anErrorClass", "aBlock"],
  7871. source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a\x09Convert all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09^ self tryCatch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError resignal ] ]",
  7872. referencedClasses: ["Smalltalk"],
  7873. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"]
  7874. }),
  7875. $globals.BlockClosure);
  7876. $core.addMethod(
  7877. $core.method({
  7878. selector: "receiver",
  7879. protocol: 'accessing',
  7880. fn: function (){
  7881. var self=this;
  7882. return nil;
  7883. },
  7884. args: [],
  7885. source: "receiver\x0a\x09^ nil",
  7886. referencedClasses: [],
  7887. messageSends: []
  7888. }),
  7889. $globals.BlockClosure);
  7890. $core.addMethod(
  7891. $core.method({
  7892. selector: "timeToRun",
  7893. protocol: 'evaluating',
  7894. fn: function (){
  7895. var self=this;
  7896. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  7897. return $core.withContext(function($ctx1) {
  7898. var $1;
  7899. $1=$recv($Date())._millisecondsToRun_(self);
  7900. return $1;
  7901. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  7902. },
  7903. args: [],
  7904. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  7905. referencedClasses: ["Date"],
  7906. messageSends: ["millisecondsToRun:"]
  7907. }),
  7908. $globals.BlockClosure);
  7909. $core.addMethod(
  7910. $core.method({
  7911. selector: "tryCatch:",
  7912. protocol: 'error handling',
  7913. fn: function (aBlock){
  7914. var self=this;
  7915. return $core.withContext(function($ctx1) {
  7916. try {
  7917. return self._value();
  7918. } catch(error) {
  7919. // pass non-local returns undetected
  7920. if (Array.isArray(error) && error.length === 1) throw error;
  7921. return aBlock._value_(error);
  7922. }
  7923. ;
  7924. return self;
  7925. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  7926. },
  7927. args: ["aBlock"],
  7928. source: "tryCatch: aBlock\x0a\x09<\x0a\x09\x09try {\x0a\x09\x09\x09return self._value();\x0a\x09\x09} catch(error) {\x0a\x09\x09\x09// pass non-local returns undetected\x0a\x09\x09\x09if (Array.isArray(error) && error.length === 1) throw error;\x0a\x09\x09\x09return aBlock._value_(error);\x0a\x09\x09}\x0a\x09>",
  7929. referencedClasses: [],
  7930. messageSends: []
  7931. }),
  7932. $globals.BlockClosure);
  7933. $core.addMethod(
  7934. $core.method({
  7935. selector: "value",
  7936. protocol: 'evaluating',
  7937. fn: function (){
  7938. var self=this;
  7939. return $core.withContext(function($ctx1) {
  7940. return self();;
  7941. return self;
  7942. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  7943. },
  7944. args: [],
  7945. source: "value\x0a\x09<return self();>",
  7946. referencedClasses: [],
  7947. messageSends: []
  7948. }),
  7949. $globals.BlockClosure);
  7950. $core.addMethod(
  7951. $core.method({
  7952. selector: "value:",
  7953. protocol: 'evaluating',
  7954. fn: function (anArg){
  7955. var self=this;
  7956. return $core.withContext(function($ctx1) {
  7957. return self(anArg);;
  7958. return self;
  7959. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  7960. },
  7961. args: ["anArg"],
  7962. source: "value: anArg\x0a\x09<return self(anArg);>",
  7963. referencedClasses: [],
  7964. messageSends: []
  7965. }),
  7966. $globals.BlockClosure);
  7967. $core.addMethod(
  7968. $core.method({
  7969. selector: "value:value:",
  7970. protocol: 'evaluating',
  7971. fn: function (firstArg,secondArg){
  7972. var self=this;
  7973. return $core.withContext(function($ctx1) {
  7974. return self(firstArg, secondArg);;
  7975. return self;
  7976. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  7977. },
  7978. args: ["firstArg", "secondArg"],
  7979. source: "value: firstArg value: secondArg\x0a\x09<return self(firstArg, secondArg);>",
  7980. referencedClasses: [],
  7981. messageSends: []
  7982. }),
  7983. $globals.BlockClosure);
  7984. $core.addMethod(
  7985. $core.method({
  7986. selector: "value:value:value:",
  7987. protocol: 'evaluating',
  7988. fn: function (firstArg,secondArg,thirdArg){
  7989. var self=this;
  7990. return $core.withContext(function($ctx1) {
  7991. return self(firstArg, secondArg, thirdArg);;
  7992. return self;
  7993. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  7994. },
  7995. args: ["firstArg", "secondArg", "thirdArg"],
  7996. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  7997. referencedClasses: [],
  7998. messageSends: []
  7999. }),
  8000. $globals.BlockClosure);
  8001. $core.addMethod(
  8002. $core.method({
  8003. selector: "valueWithInterval:",
  8004. protocol: 'timeout/interval',
  8005. fn: function (aNumber){
  8006. var self=this;
  8007. return $core.withContext(function($ctx1) {
  8008. var interval = setInterval(self, aNumber);
  8009. return $globals.Timeout._on_(interval);
  8010. ;
  8011. return self;
  8012. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  8013. },
  8014. args: ["aNumber"],
  8015. source: "valueWithInterval: aNumber\x0a\x09<\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09>",
  8016. referencedClasses: [],
  8017. messageSends: []
  8018. }),
  8019. $globals.BlockClosure);
  8020. $core.addMethod(
  8021. $core.method({
  8022. selector: "valueWithPossibleArguments:",
  8023. protocol: 'evaluating',
  8024. fn: function (aCollection){
  8025. var self=this;
  8026. return $core.withContext(function($ctx1) {
  8027. return self.apply(null, aCollection);;
  8028. return self;
  8029. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  8030. },
  8031. args: ["aCollection"],
  8032. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  8033. referencedClasses: [],
  8034. messageSends: []
  8035. }),
  8036. $globals.BlockClosure);
  8037. $core.addMethod(
  8038. $core.method({
  8039. selector: "valueWithTimeout:",
  8040. protocol: 'timeout/interval',
  8041. fn: function (aNumber){
  8042. var self=this;
  8043. return $core.withContext(function($ctx1) {
  8044. var timeout = setTimeout(self, aNumber);
  8045. return $globals.Timeout._on_(timeout);
  8046. ;
  8047. return self;
  8048. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  8049. },
  8050. args: ["aNumber"],
  8051. source: "valueWithTimeout: aNumber\x0a\x09<\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09>",
  8052. referencedClasses: [],
  8053. messageSends: []
  8054. }),
  8055. $globals.BlockClosure);
  8056. $core.addMethod(
  8057. $core.method({
  8058. selector: "whileFalse",
  8059. protocol: 'controlling',
  8060. fn: function (){
  8061. var self=this;
  8062. return $core.withContext(function($ctx1) {
  8063. self._whileFalse_((function(){
  8064. }));
  8065. return self;
  8066. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  8067. },
  8068. args: [],
  8069. source: "whileFalse\x0a\x09self whileFalse: []",
  8070. referencedClasses: [],
  8071. messageSends: ["whileFalse:"]
  8072. }),
  8073. $globals.BlockClosure);
  8074. $core.addMethod(
  8075. $core.method({
  8076. selector: "whileFalse:",
  8077. protocol: 'controlling',
  8078. fn: function (aBlock){
  8079. var self=this;
  8080. return $core.withContext(function($ctx1) {
  8081. while(!$core.assert(self._value())) {aBlock._value()};
  8082. return self;
  8083. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  8084. },
  8085. args: ["aBlock"],
  8086. source: "whileFalse: aBlock\x0a\x09<while(!$core.assert(self._value())) {aBlock._value()}>",
  8087. referencedClasses: [],
  8088. messageSends: []
  8089. }),
  8090. $globals.BlockClosure);
  8091. $core.addMethod(
  8092. $core.method({
  8093. selector: "whileTrue",
  8094. protocol: 'controlling',
  8095. fn: function (){
  8096. var self=this;
  8097. return $core.withContext(function($ctx1) {
  8098. self._whileTrue_((function(){
  8099. }));
  8100. return self;
  8101. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  8102. },
  8103. args: [],
  8104. source: "whileTrue\x0a\x09self whileTrue: []",
  8105. referencedClasses: [],
  8106. messageSends: ["whileTrue:"]
  8107. }),
  8108. $globals.BlockClosure);
  8109. $core.addMethod(
  8110. $core.method({
  8111. selector: "whileTrue:",
  8112. protocol: 'controlling',
  8113. fn: function (aBlock){
  8114. var self=this;
  8115. return $core.withContext(function($ctx1) {
  8116. while($core.assert(self._value())) {aBlock._value()};
  8117. return self;
  8118. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  8119. },
  8120. args: ["aBlock"],
  8121. source: "whileTrue: aBlock\x0a\x09<while($core.assert(self._value())) {aBlock._value()}>",
  8122. referencedClasses: [],
  8123. messageSends: []
  8124. }),
  8125. $globals.BlockClosure);
  8126. $core.addClass('CompiledMethod', $globals.Object, [], 'Kernel-Methods');
  8127. $globals.CompiledMethod.comment="I represent a class method of the system. I hold the source and compiled code of a class method.\x0a\x0a## API\x0aMy instances can be accessed using `Behavior >> #methodAt:`\x0a\x0a Object methodAt: 'asString'\x0a\x0aSource code access:\x0a\x0a\x09(String methodAt: 'lines') source\x0a\x0aReferenced classes:\x0a\x0a\x09(String methodAt: 'lines') referencedClasses\x0a\x0aMessages sent from an instance:\x0a\x09\x0a\x09(String methodAt: 'lines') messageSends";
  8128. $core.addMethod(
  8129. $core.method({
  8130. selector: "arguments",
  8131. protocol: 'accessing',
  8132. fn: function (){
  8133. var self=this;
  8134. return $core.withContext(function($ctx1) {
  8135. return self.args || [];
  8136. return self;
  8137. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  8138. },
  8139. args: [],
  8140. source: "arguments\x0a\x09<return self.args || []>",
  8141. referencedClasses: [],
  8142. messageSends: []
  8143. }),
  8144. $globals.CompiledMethod);
  8145. $core.addMethod(
  8146. $core.method({
  8147. selector: "browse",
  8148. protocol: 'browsing',
  8149. fn: function (){
  8150. var self=this;
  8151. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  8152. return $core.withContext(function($ctx1) {
  8153. $recv($Finder())._findMethod_(self);
  8154. return self;
  8155. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  8156. },
  8157. args: [],
  8158. source: "browse\x0a\x09Finder findMethod: self",
  8159. referencedClasses: ["Finder"],
  8160. messageSends: ["findMethod:"]
  8161. }),
  8162. $globals.CompiledMethod);
  8163. $core.addMethod(
  8164. $core.method({
  8165. selector: "category",
  8166. protocol: 'accessing',
  8167. fn: function (){
  8168. var self=this;
  8169. return $core.withContext(function($ctx1) {
  8170. var $1;
  8171. $1=self._protocol();
  8172. return $1;
  8173. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  8174. },
  8175. args: [],
  8176. source: "category\x0a\x09^ self protocol",
  8177. referencedClasses: [],
  8178. messageSends: ["protocol"]
  8179. }),
  8180. $globals.CompiledMethod);
  8181. $core.addMethod(
  8182. $core.method({
  8183. selector: "defaultProtocol",
  8184. protocol: 'defaults',
  8185. fn: function (){
  8186. var self=this;
  8187. return "as yet unclassified";
  8188. },
  8189. args: [],
  8190. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  8191. referencedClasses: [],
  8192. messageSends: []
  8193. }),
  8194. $globals.CompiledMethod);
  8195. $core.addMethod(
  8196. $core.method({
  8197. selector: "fn",
  8198. protocol: 'accessing',
  8199. fn: function (){
  8200. var self=this;
  8201. return $core.withContext(function($ctx1) {
  8202. var $1;
  8203. $1=self._basicAt_("fn");
  8204. return $1;
  8205. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  8206. },
  8207. args: [],
  8208. source: "fn\x0a\x09^ self basicAt: 'fn'",
  8209. referencedClasses: [],
  8210. messageSends: ["basicAt:"]
  8211. }),
  8212. $globals.CompiledMethod);
  8213. $core.addMethod(
  8214. $core.method({
  8215. selector: "fn:",
  8216. protocol: 'accessing',
  8217. fn: function (aBlock){
  8218. var self=this;
  8219. return $core.withContext(function($ctx1) {
  8220. self._basicAt_put_("fn",aBlock);
  8221. return self;
  8222. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  8223. },
  8224. args: ["aBlock"],
  8225. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  8226. referencedClasses: [],
  8227. messageSends: ["basicAt:put:"]
  8228. }),
  8229. $globals.CompiledMethod);
  8230. $core.addMethod(
  8231. $core.method({
  8232. selector: "isCompiledMethod",
  8233. protocol: 'testing',
  8234. fn: function (){
  8235. var self=this;
  8236. return true;
  8237. },
  8238. args: [],
  8239. source: "isCompiledMethod\x0a\x09^ true",
  8240. referencedClasses: [],
  8241. messageSends: []
  8242. }),
  8243. $globals.CompiledMethod);
  8244. $core.addMethod(
  8245. $core.method({
  8246. selector: "isOverridden",
  8247. protocol: 'testing',
  8248. fn: function (){
  8249. var self=this;
  8250. var selector;
  8251. return $core.withContext(function($ctx1) {
  8252. var $1;
  8253. var $early={};
  8254. try {
  8255. selector=self._selector();
  8256. $recv(self._methodClass())._allSubclassesDo_((function(each){
  8257. return $core.withContext(function($ctx2) {
  8258. $1=$recv(each)._includesSelector_(selector);
  8259. if($core.assert($1)){
  8260. throw $early=[true];
  8261. };
  8262. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8263. }));
  8264. return false;
  8265. }
  8266. catch(e) {if(e===$early)return e[0]; throw e}
  8267. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  8268. },
  8269. args: [],
  8270. source: "isOverridden\x0a\x09| selector |\x0a \x0a selector := self selector.\x0a self methodClass allSubclassesDo: [ :each |\x0a\x09 (each includesSelector: selector)\x0a \x09ifTrue: [ ^ true ] ].\x0a\x09^ false",
  8271. referencedClasses: [],
  8272. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  8273. }),
  8274. $globals.CompiledMethod);
  8275. $core.addMethod(
  8276. $core.method({
  8277. selector: "isOverride",
  8278. protocol: 'testing',
  8279. fn: function (){
  8280. var self=this;
  8281. var superclass;
  8282. return $core.withContext(function($ctx1) {
  8283. var $1,$2,$3,$receiver;
  8284. $1=self._methodClass();
  8285. $ctx1.sendIdx["methodClass"]=1;
  8286. superclass=$recv($1)._superclass();
  8287. $ctx1.sendIdx["superclass"]=1;
  8288. $2=superclass;
  8289. if(($receiver = $2) == null || $receiver.isNil){
  8290. return false;
  8291. } else {
  8292. $2;
  8293. };
  8294. $3=$recv($recv($recv(self._methodClass())._superclass())._lookupSelector_(self._selector()))._notNil();
  8295. return $3;
  8296. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  8297. },
  8298. args: [],
  8299. source: "isOverride\x0a\x09| superclass |\x0a \x0a superclass := self methodClass superclass.\x0a\x09superclass ifNil: [ ^ false ].\x0a\x09\x0a ^ (self methodClass superclass lookupSelector: self selector) notNil",
  8300. referencedClasses: [],
  8301. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  8302. }),
  8303. $globals.CompiledMethod);
  8304. $core.addMethod(
  8305. $core.method({
  8306. selector: "messageSends",
  8307. protocol: 'accessing',
  8308. fn: function (){
  8309. var self=this;
  8310. return $core.withContext(function($ctx1) {
  8311. var $1;
  8312. $1=self._basicAt_("messageSends");
  8313. return $1;
  8314. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  8315. },
  8316. args: [],
  8317. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  8318. referencedClasses: [],
  8319. messageSends: ["basicAt:"]
  8320. }),
  8321. $globals.CompiledMethod);
  8322. $core.addMethod(
  8323. $core.method({
  8324. selector: "methodClass",
  8325. protocol: 'accessing',
  8326. fn: function (){
  8327. var self=this;
  8328. return $core.withContext(function($ctx1) {
  8329. var $1;
  8330. $1=self._basicAt_("methodClass");
  8331. return $1;
  8332. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  8333. },
  8334. args: [],
  8335. source: "methodClass\x0a\x09^ self basicAt: 'methodClass'",
  8336. referencedClasses: [],
  8337. messageSends: ["basicAt:"]
  8338. }),
  8339. $globals.CompiledMethod);
  8340. $core.addMethod(
  8341. $core.method({
  8342. selector: "package",
  8343. protocol: 'accessing',
  8344. fn: function (){
  8345. var self=this;
  8346. return $core.withContext(function($ctx1) {
  8347. var $2,$1,$receiver;
  8348. $2=self._methodClass();
  8349. if(($receiver = $2) == null || $receiver.isNil){
  8350. $1=$2;
  8351. } else {
  8352. var class_;
  8353. class_=$receiver;
  8354. $1=$recv(class_)._packageOfProtocol_(self._protocol());
  8355. };
  8356. return $1;
  8357. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  8358. },
  8359. args: [],
  8360. source: "package\x0a\x09\x22Answer the package the receiver belongs to:\x0a\x09- if it is an extension method, answer the corresponding package\x0a\x09- else answer the `methodClass` package\x22\x0a\x09\x0a\x09^ self methodClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  8361. referencedClasses: [],
  8362. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  8363. }),
  8364. $globals.CompiledMethod);
  8365. $core.addMethod(
  8366. $core.method({
  8367. selector: "protocol",
  8368. protocol: 'accessing',
  8369. fn: function (){
  8370. var self=this;
  8371. return $core.withContext(function($ctx1) {
  8372. var $2,$1,$receiver;
  8373. $2=self._basicAt_("protocol");
  8374. if(($receiver = $2) == null || $receiver.isNil){
  8375. $1=self._defaultProtocol();
  8376. } else {
  8377. $1=$2;
  8378. };
  8379. return $1;
  8380. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  8381. },
  8382. args: [],
  8383. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  8384. referencedClasses: [],
  8385. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  8386. }),
  8387. $globals.CompiledMethod);
  8388. $core.addMethod(
  8389. $core.method({
  8390. selector: "protocol:",
  8391. protocol: 'accessing',
  8392. fn: function (aString){
  8393. var self=this;
  8394. var oldProtocol;
  8395. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  8396. function $MethodMoved(){return $globals.MethodMoved||(typeof MethodMoved=="undefined"?nil:MethodMoved)}
  8397. return $core.withContext(function($ctx1) {
  8398. var $1,$2,$3,$receiver;
  8399. oldProtocol=self._protocol();
  8400. self._basicAt_put_("protocol",aString);
  8401. $1=$recv($MethodMoved())._new();
  8402. $recv($1)._method_(self);
  8403. $recv($1)._oldProtocol_(oldProtocol);
  8404. $2=$recv($1)._yourself();
  8405. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  8406. $3=self._methodClass();
  8407. if(($receiver = $3) == null || $receiver.isNil){
  8408. $3;
  8409. } else {
  8410. var methodClass;
  8411. methodClass=$receiver;
  8412. $recv($recv(methodClass)._organization())._addElement_(aString);
  8413. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  8414. };
  8415. return self;
  8416. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  8417. },
  8418. args: ["aString"],
  8419. source: "protocol: aString\x0a\x09| oldProtocol |\x0a\x09oldProtocol := self protocol.\x0a\x09self basicAt: 'protocol' put: aString.\x0a\x0a\x09SystemAnnouncer current announce: (MethodMoved new\x0a\x09\x09method: self;\x0a\x09\x09oldProtocol: oldProtocol;\x0a\x09\x09yourself).\x0a\x0a\x09self methodClass ifNotNil: [ :methodClass |\x0a\x09\x09methodClass organization addElement: aString.\x0a\x09\x09methodClass removeProtocolIfEmpty: oldProtocol ]",
  8420. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  8421. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  8422. }),
  8423. $globals.CompiledMethod);
  8424. $core.addMethod(
  8425. $core.method({
  8426. selector: "referencedClasses",
  8427. protocol: 'accessing',
  8428. fn: function (){
  8429. var self=this;
  8430. return $core.withContext(function($ctx1) {
  8431. var $1;
  8432. $1=self._basicAt_("referencedClasses");
  8433. return $1;
  8434. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  8435. },
  8436. args: [],
  8437. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  8438. referencedClasses: [],
  8439. messageSends: ["basicAt:"]
  8440. }),
  8441. $globals.CompiledMethod);
  8442. $core.addMethod(
  8443. $core.method({
  8444. selector: "selector",
  8445. protocol: 'accessing',
  8446. fn: function (){
  8447. var self=this;
  8448. return $core.withContext(function($ctx1) {
  8449. var $1;
  8450. $1=self._basicAt_("selector");
  8451. return $1;
  8452. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  8453. },
  8454. args: [],
  8455. source: "selector\x0a\x09^ self basicAt: 'selector'",
  8456. referencedClasses: [],
  8457. messageSends: ["basicAt:"]
  8458. }),
  8459. $globals.CompiledMethod);
  8460. $core.addMethod(
  8461. $core.method({
  8462. selector: "selector:",
  8463. protocol: 'accessing',
  8464. fn: function (aString){
  8465. var self=this;
  8466. return $core.withContext(function($ctx1) {
  8467. self._basicAt_put_("selector",aString);
  8468. return self;
  8469. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  8470. },
  8471. args: ["aString"],
  8472. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  8473. referencedClasses: [],
  8474. messageSends: ["basicAt:put:"]
  8475. }),
  8476. $globals.CompiledMethod);
  8477. $core.addMethod(
  8478. $core.method({
  8479. selector: "sendTo:arguments:",
  8480. protocol: 'evaluating',
  8481. fn: function (anObject,aCollection){
  8482. var self=this;
  8483. return $core.withContext(function($ctx1) {
  8484. var $1;
  8485. $1=$recv(self._fn())._applyTo_arguments_(anObject,aCollection);
  8486. return $1;
  8487. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  8488. },
  8489. args: ["anObject", "aCollection"],
  8490. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  8491. referencedClasses: [],
  8492. messageSends: ["applyTo:arguments:", "fn"]
  8493. }),
  8494. $globals.CompiledMethod);
  8495. $core.addMethod(
  8496. $core.method({
  8497. selector: "source",
  8498. protocol: 'accessing',
  8499. fn: function (){
  8500. var self=this;
  8501. return $core.withContext(function($ctx1) {
  8502. var $2,$1,$receiver;
  8503. $2=self._basicAt_("source");
  8504. if(($receiver = $2) == null || $receiver.isNil){
  8505. $1="";
  8506. } else {
  8507. $1=$2;
  8508. };
  8509. return $1;
  8510. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  8511. },
  8512. args: [],
  8513. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  8514. referencedClasses: [],
  8515. messageSends: ["ifNil:", "basicAt:"]
  8516. }),
  8517. $globals.CompiledMethod);
  8518. $core.addMethod(
  8519. $core.method({
  8520. selector: "source:",
  8521. protocol: 'accessing',
  8522. fn: function (aString){
  8523. var self=this;
  8524. return $core.withContext(function($ctx1) {
  8525. self._basicAt_put_("source",aString);
  8526. return self;
  8527. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  8528. },
  8529. args: ["aString"],
  8530. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  8531. referencedClasses: [],
  8532. messageSends: ["basicAt:put:"]
  8533. }),
  8534. $globals.CompiledMethod);
  8535. $core.addClass('ForkPool', $globals.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  8536. $globals.ForkPool.comment="I am responsible for handling forked blocks.\x0aThe pool size sets the maximum concurrent forked blocks.\x0a\x0a## API\x0a\x0aThe default instance is accessed with `#default`.\x0aThe maximum concurrent forked blocks can be set with `#maxPoolSize:`.\x0a\x0aForking is done via `BlockClosure >> #fork`";
  8537. $core.addMethod(
  8538. $core.method({
  8539. selector: "addWorker",
  8540. protocol: 'private',
  8541. fn: function (){
  8542. var self=this;
  8543. return $core.withContext(function($ctx1) {
  8544. $recv(self["@worker"])._valueWithTimeout_((0));
  8545. self["@poolSize"]=$recv(self["@poolSize"]).__plus((1));
  8546. return self;
  8547. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  8548. },
  8549. args: [],
  8550. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  8551. referencedClasses: [],
  8552. messageSends: ["valueWithTimeout:", "+"]
  8553. }),
  8554. $globals.ForkPool);
  8555. $core.addMethod(
  8556. $core.method({
  8557. selector: "defaultMaxPoolSize",
  8558. protocol: 'defaults',
  8559. fn: function (){
  8560. var self=this;
  8561. return $core.withContext(function($ctx1) {
  8562. var $1;
  8563. $1=$recv(self._class())._defaultMaxPoolSize();
  8564. return $1;
  8565. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  8566. },
  8567. args: [],
  8568. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  8569. referencedClasses: [],
  8570. messageSends: ["defaultMaxPoolSize", "class"]
  8571. }),
  8572. $globals.ForkPool);
  8573. $core.addMethod(
  8574. $core.method({
  8575. selector: "fork:",
  8576. protocol: 'actions',
  8577. fn: function (aBlock){
  8578. var self=this;
  8579. return $core.withContext(function($ctx1) {
  8580. var $1;
  8581. $1=$recv(self["@poolSize"]).__lt(self._maxPoolSize());
  8582. if($core.assert($1)){
  8583. self._addWorker();
  8584. };
  8585. $recv(self["@queue"])._nextPut_(aBlock);
  8586. return self;
  8587. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  8588. },
  8589. args: ["aBlock"],
  8590. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  8591. referencedClasses: [],
  8592. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  8593. }),
  8594. $globals.ForkPool);
  8595. $core.addMethod(
  8596. $core.method({
  8597. selector: "initialize",
  8598. protocol: 'initialization',
  8599. fn: function (){
  8600. var self=this;
  8601. function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  8602. return $core.withContext(function($ctx1) {
  8603. (
  8604. $ctx1.supercall = true,
  8605. $globals.ForkPool.superclass.fn.prototype._initialize.apply($recv(self), []));
  8606. $ctx1.supercall = false;
  8607. self["@poolSize"]=(0);
  8608. self["@queue"]=$recv($Queue())._new();
  8609. self["@worker"]=self._makeWorker();
  8610. return self;
  8611. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  8612. },
  8613. args: [],
  8614. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  8615. referencedClasses: ["Queue"],
  8616. messageSends: ["initialize", "new", "makeWorker"]
  8617. }),
  8618. $globals.ForkPool);
  8619. $core.addMethod(
  8620. $core.method({
  8621. selector: "makeWorker",
  8622. protocol: 'initialization',
  8623. fn: function (){
  8624. var self=this;
  8625. var sentinel;
  8626. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  8627. return $core.withContext(function($ctx1) {
  8628. var $2,$1;
  8629. sentinel=$recv($Object())._new();
  8630. $1=(function(){
  8631. var block;
  8632. return $core.withContext(function($ctx2) {
  8633. self["@poolSize"]=$recv(self["@poolSize"]).__minus((1));
  8634. self["@poolSize"];
  8635. block=$recv(self["@queue"])._nextIfAbsent_((function(){
  8636. return sentinel;
  8637. }));
  8638. block;
  8639. $2=$recv(block).__eq_eq(sentinel);
  8640. if(!$core.assert($2)){
  8641. return $recv((function(){
  8642. return $core.withContext(function($ctx3) {
  8643. return $recv(block)._value();
  8644. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  8645. }))._ensure_((function(){
  8646. return $core.withContext(function($ctx3) {
  8647. return self._addWorker();
  8648. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  8649. }));
  8650. };
  8651. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  8652. });
  8653. return $1;
  8654. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  8655. },
  8656. args: [],
  8657. source: "makeWorker\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09^ [ | block |\x0a\x09\x09poolSize := poolSize - 1.\x0a\x09\x09block := queue nextIfAbsent: [ sentinel ].\x0a\x09\x09block == sentinel ifFalse: [\x0a\x09\x09\x09[ block value ] ensure: [ self addWorker ] ]]",
  8658. referencedClasses: ["Object"],
  8659. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  8660. }),
  8661. $globals.ForkPool);
  8662. $core.addMethod(
  8663. $core.method({
  8664. selector: "maxPoolSize",
  8665. protocol: 'accessing',
  8666. fn: function (){
  8667. var self=this;
  8668. return $core.withContext(function($ctx1) {
  8669. var $2,$1,$receiver;
  8670. $2=self["@maxPoolSize"];
  8671. if(($receiver = $2) == null || $receiver.isNil){
  8672. $1=self._defaultMaxPoolSize();
  8673. } else {
  8674. $1=$2;
  8675. };
  8676. return $1;
  8677. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  8678. },
  8679. args: [],
  8680. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  8681. referencedClasses: [],
  8682. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  8683. }),
  8684. $globals.ForkPool);
  8685. $core.addMethod(
  8686. $core.method({
  8687. selector: "maxPoolSize:",
  8688. protocol: 'accessing',
  8689. fn: function (anInteger){
  8690. var self=this;
  8691. self["@maxPoolSize"]=anInteger;
  8692. return self;
  8693. },
  8694. args: ["anInteger"],
  8695. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  8696. referencedClasses: [],
  8697. messageSends: []
  8698. }),
  8699. $globals.ForkPool);
  8700. $globals.ForkPool.klass.iVarNames = ['default'];
  8701. $core.addMethod(
  8702. $core.method({
  8703. selector: "default",
  8704. protocol: 'accessing',
  8705. fn: function (){
  8706. var self=this;
  8707. return $core.withContext(function($ctx1) {
  8708. var $2,$1,$receiver;
  8709. $2=self["@default"];
  8710. if(($receiver = $2) == null || $receiver.isNil){
  8711. self["@default"]=self._new();
  8712. $1=self["@default"];
  8713. } else {
  8714. $1=$2;
  8715. };
  8716. return $1;
  8717. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.klass)});
  8718. },
  8719. args: [],
  8720. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  8721. referencedClasses: [],
  8722. messageSends: ["ifNil:", "new"]
  8723. }),
  8724. $globals.ForkPool.klass);
  8725. $core.addMethod(
  8726. $core.method({
  8727. selector: "defaultMaxPoolSize",
  8728. protocol: 'accessing',
  8729. fn: function (){
  8730. var self=this;
  8731. return (100);
  8732. },
  8733. args: [],
  8734. source: "defaultMaxPoolSize\x0a\x09^ 100",
  8735. referencedClasses: [],
  8736. messageSends: []
  8737. }),
  8738. $globals.ForkPool.klass);
  8739. $core.addMethod(
  8740. $core.method({
  8741. selector: "resetDefault",
  8742. protocol: 'accessing',
  8743. fn: function (){
  8744. var self=this;
  8745. self["@default"]=nil;
  8746. return self;
  8747. },
  8748. args: [],
  8749. source: "resetDefault\x0a\x09default := nil",
  8750. referencedClasses: [],
  8751. messageSends: []
  8752. }),
  8753. $globals.ForkPool.klass);
  8754. $core.addClass('Message', $globals.Object, ['selector', 'arguments'], 'Kernel-Methods');
  8755. $globals.Message.comment="In general, the system does not use instances of me for efficiency reasons.\x0aHowever, when a message is not understood by its receiver, the interpreter will make up an instance of it in order to capture the information involved in an actual message transmission.\x0aThis instance is sent it as an argument with the message `#doesNotUnderstand:` to the receiver.\x0a\x0aSee boot.js, `messageNotUnderstood` and its counterpart `Object >> #doesNotUnderstand:`\x0a\x0a## API\x0a\x0aBesides accessing methods, `#sendTo:` provides a convenient way to send a message to an object.";
  8756. $core.addMethod(
  8757. $core.method({
  8758. selector: "arguments",
  8759. protocol: 'accessing',
  8760. fn: function (){
  8761. var self=this;
  8762. var $1;
  8763. $1=self["@arguments"];
  8764. return $1;
  8765. },
  8766. args: [],
  8767. source: "arguments\x0a\x09^ arguments",
  8768. referencedClasses: [],
  8769. messageSends: []
  8770. }),
  8771. $globals.Message);
  8772. $core.addMethod(
  8773. $core.method({
  8774. selector: "arguments:",
  8775. protocol: 'accessing',
  8776. fn: function (anArray){
  8777. var self=this;
  8778. self["@arguments"]=anArray;
  8779. return self;
  8780. },
  8781. args: ["anArray"],
  8782. source: "arguments: anArray\x0a\x09arguments := anArray",
  8783. referencedClasses: [],
  8784. messageSends: []
  8785. }),
  8786. $globals.Message);
  8787. $core.addMethod(
  8788. $core.method({
  8789. selector: "printOn:",
  8790. protocol: 'printing',
  8791. fn: function (aStream){
  8792. var self=this;
  8793. return $core.withContext(function($ctx1) {
  8794. var $1;
  8795. (
  8796. $ctx1.supercall = true,
  8797. $globals.Message.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  8798. $ctx1.supercall = false;
  8799. $recv(aStream)._nextPutAll_("(");
  8800. $ctx1.sendIdx["nextPutAll:"]=1;
  8801. $recv(aStream)._nextPutAll_(self._selector());
  8802. $ctx1.sendIdx["nextPutAll:"]=2;
  8803. $1=$recv(aStream)._nextPutAll_(")");
  8804. return self;
  8805. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  8806. },
  8807. args: ["aStream"],
  8808. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  8809. referencedClasses: [],
  8810. messageSends: ["printOn:", "nextPutAll:", "selector"]
  8811. }),
  8812. $globals.Message);
  8813. $core.addMethod(
  8814. $core.method({
  8815. selector: "selector",
  8816. protocol: 'accessing',
  8817. fn: function (){
  8818. var self=this;
  8819. var $1;
  8820. $1=self["@selector"];
  8821. return $1;
  8822. },
  8823. args: [],
  8824. source: "selector\x0a\x09^ selector",
  8825. referencedClasses: [],
  8826. messageSends: []
  8827. }),
  8828. $globals.Message);
  8829. $core.addMethod(
  8830. $core.method({
  8831. selector: "selector:",
  8832. protocol: 'accessing',
  8833. fn: function (aString){
  8834. var self=this;
  8835. self["@selector"]=aString;
  8836. return self;
  8837. },
  8838. args: ["aString"],
  8839. source: "selector: aString\x0a\x09selector := aString",
  8840. referencedClasses: [],
  8841. messageSends: []
  8842. }),
  8843. $globals.Message);
  8844. $core.addMethod(
  8845. $core.method({
  8846. selector: "sendTo:",
  8847. protocol: 'actions',
  8848. fn: function (anObject){
  8849. var self=this;
  8850. return $core.withContext(function($ctx1) {
  8851. var $1;
  8852. $1=$recv(anObject)._perform_withArguments_(self._selector(),self._arguments());
  8853. return $1;
  8854. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  8855. },
  8856. args: ["anObject"],
  8857. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  8858. referencedClasses: [],
  8859. messageSends: ["perform:withArguments:", "selector", "arguments"]
  8860. }),
  8861. $globals.Message);
  8862. $core.addMethod(
  8863. $core.method({
  8864. selector: "selector:arguments:",
  8865. protocol: 'instance creation',
  8866. fn: function (aString,anArray){
  8867. var self=this;
  8868. return $core.withContext(function($ctx1) {
  8869. var $2,$3,$1;
  8870. $2=self._new();
  8871. $recv($2)._selector_(aString);
  8872. $recv($2)._arguments_(anArray);
  8873. $3=$recv($2)._yourself();
  8874. $1=$3;
  8875. return $1;
  8876. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.klass)});
  8877. },
  8878. args: ["aString", "anArray"],
  8879. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  8880. referencedClasses: [],
  8881. messageSends: ["selector:", "new", "arguments:", "yourself"]
  8882. }),
  8883. $globals.Message.klass);
  8884. $core.addClass('MessageSend', $globals.Object, ['receiver', 'message'], 'Kernel-Methods');
  8885. $globals.MessageSend.comment="I encapsulate message sends to objects. Arguments can be either predefined or supplied when the message send is performed. \x0a\x0a## API\x0a\x0aUse `#value` to perform a message send with its predefined arguments and `#value:*` if additonal arguments have to supplied.";
  8886. $core.addMethod(
  8887. $core.method({
  8888. selector: "arguments",
  8889. protocol: 'accessing',
  8890. fn: function (){
  8891. var self=this;
  8892. return $core.withContext(function($ctx1) {
  8893. var $1;
  8894. $1=$recv(self["@message"])._arguments();
  8895. return $1;
  8896. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  8897. },
  8898. args: [],
  8899. source: "arguments\x0a\x09^ message arguments",
  8900. referencedClasses: [],
  8901. messageSends: ["arguments"]
  8902. }),
  8903. $globals.MessageSend);
  8904. $core.addMethod(
  8905. $core.method({
  8906. selector: "arguments:",
  8907. protocol: 'accessing',
  8908. fn: function (aCollection){
  8909. var self=this;
  8910. return $core.withContext(function($ctx1) {
  8911. $recv(self["@message"])._arguments_(aCollection);
  8912. return self;
  8913. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  8914. },
  8915. args: ["aCollection"],
  8916. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  8917. referencedClasses: [],
  8918. messageSends: ["arguments:"]
  8919. }),
  8920. $globals.MessageSend);
  8921. $core.addMethod(
  8922. $core.method({
  8923. selector: "initialize",
  8924. protocol: 'initialization',
  8925. fn: function (){
  8926. var self=this;
  8927. function $Message(){return $globals.Message||(typeof Message=="undefined"?nil:Message)}
  8928. return $core.withContext(function($ctx1) {
  8929. (
  8930. $ctx1.supercall = true,
  8931. $globals.MessageSend.superclass.fn.prototype._initialize.apply($recv(self), []));
  8932. $ctx1.supercall = false;
  8933. self["@message"]=$recv($Message())._new();
  8934. return self;
  8935. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  8936. },
  8937. args: [],
  8938. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  8939. referencedClasses: ["Message"],
  8940. messageSends: ["initialize", "new"]
  8941. }),
  8942. $globals.MessageSend);
  8943. $core.addMethod(
  8944. $core.method({
  8945. selector: "printOn:",
  8946. protocol: 'printing',
  8947. fn: function (aStream){
  8948. var self=this;
  8949. return $core.withContext(function($ctx1) {
  8950. var $1;
  8951. (
  8952. $ctx1.supercall = true,
  8953. $globals.MessageSend.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  8954. $ctx1.supercall = false;
  8955. $recv(aStream)._nextPutAll_("(");
  8956. $ctx1.sendIdx["nextPutAll:"]=1;
  8957. $recv(aStream)._nextPutAll_(self._receiver());
  8958. $ctx1.sendIdx["nextPutAll:"]=2;
  8959. $recv(aStream)._nextPutAll_(" >> ");
  8960. $ctx1.sendIdx["nextPutAll:"]=3;
  8961. $recv(aStream)._nextPutAll_(self._selector());
  8962. $ctx1.sendIdx["nextPutAll:"]=4;
  8963. $1=$recv(aStream)._nextPutAll_(")");
  8964. return self;
  8965. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  8966. },
  8967. args: ["aStream"],
  8968. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self receiver;\x0a\x09\x09nextPutAll: ' >> ';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  8969. referencedClasses: [],
  8970. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  8971. }),
  8972. $globals.MessageSend);
  8973. $core.addMethod(
  8974. $core.method({
  8975. selector: "receiver",
  8976. protocol: 'accessing',
  8977. fn: function (){
  8978. var self=this;
  8979. var $1;
  8980. $1=self["@receiver"];
  8981. return $1;
  8982. },
  8983. args: [],
  8984. source: "receiver\x0a\x09^ receiver",
  8985. referencedClasses: [],
  8986. messageSends: []
  8987. }),
  8988. $globals.MessageSend);
  8989. $core.addMethod(
  8990. $core.method({
  8991. selector: "receiver:",
  8992. protocol: 'accessing',
  8993. fn: function (anObject){
  8994. var self=this;
  8995. self["@receiver"]=anObject;
  8996. return self;
  8997. },
  8998. args: ["anObject"],
  8999. source: "receiver: anObject\x0a\x09receiver := anObject",
  9000. referencedClasses: [],
  9001. messageSends: []
  9002. }),
  9003. $globals.MessageSend);
  9004. $core.addMethod(
  9005. $core.method({
  9006. selector: "selector",
  9007. protocol: 'accessing',
  9008. fn: function (){
  9009. var self=this;
  9010. return $core.withContext(function($ctx1) {
  9011. var $1;
  9012. $1=$recv(self["@message"])._selector();
  9013. return $1;
  9014. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  9015. },
  9016. args: [],
  9017. source: "selector\x0a\x09^ message selector",
  9018. referencedClasses: [],
  9019. messageSends: ["selector"]
  9020. }),
  9021. $globals.MessageSend);
  9022. $core.addMethod(
  9023. $core.method({
  9024. selector: "selector:",
  9025. protocol: 'accessing',
  9026. fn: function (aString){
  9027. var self=this;
  9028. return $core.withContext(function($ctx1) {
  9029. $recv(self["@message"])._selector_(aString);
  9030. return self;
  9031. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  9032. },
  9033. args: ["aString"],
  9034. source: "selector: aString\x0a\x09message selector: aString",
  9035. referencedClasses: [],
  9036. messageSends: ["selector:"]
  9037. }),
  9038. $globals.MessageSend);
  9039. $core.addMethod(
  9040. $core.method({
  9041. selector: "value",
  9042. protocol: 'evaluating',
  9043. fn: function (){
  9044. var self=this;
  9045. return $core.withContext(function($ctx1) {
  9046. var $1;
  9047. $1=$recv(self["@message"])._sendTo_(self._receiver());
  9048. return $1;
  9049. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  9050. },
  9051. args: [],
  9052. source: "value\x0a\x09^ message sendTo: self receiver",
  9053. referencedClasses: [],
  9054. messageSends: ["sendTo:", "receiver"]
  9055. }),
  9056. $globals.MessageSend);
  9057. $core.addMethod(
  9058. $core.method({
  9059. selector: "value:",
  9060. protocol: 'evaluating',
  9061. fn: function (anObject){
  9062. var self=this;
  9063. return $core.withContext(function($ctx1) {
  9064. var $2,$3,$1;
  9065. $2=self["@message"];
  9066. $recv($2)._arguments_([anObject]);
  9067. $3=$recv($2)._sendTo_(self._receiver());
  9068. $1=$3;
  9069. return $1;
  9070. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  9071. },
  9072. args: ["anObject"],
  9073. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  9074. referencedClasses: [],
  9075. messageSends: ["arguments:", "sendTo:", "receiver"]
  9076. }),
  9077. $globals.MessageSend);
  9078. $core.addMethod(
  9079. $core.method({
  9080. selector: "value:value:",
  9081. protocol: 'evaluating',
  9082. fn: function (firstArgument,secondArgument){
  9083. var self=this;
  9084. return $core.withContext(function($ctx1) {
  9085. var $2,$3,$1;
  9086. $2=self["@message"];
  9087. $recv($2)._arguments_([firstArgument,secondArgument]);
  9088. $3=$recv($2)._sendTo_(self._receiver());
  9089. $1=$3;
  9090. return $1;
  9091. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  9092. },
  9093. args: ["firstArgument", "secondArgument"],
  9094. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  9095. referencedClasses: [],
  9096. messageSends: ["arguments:", "sendTo:", "receiver"]
  9097. }),
  9098. $globals.MessageSend);
  9099. $core.addMethod(
  9100. $core.method({
  9101. selector: "value:value:value:",
  9102. protocol: 'evaluating',
  9103. fn: function (firstArgument,secondArgument,thirdArgument){
  9104. var self=this;
  9105. return $core.withContext(function($ctx1) {
  9106. var $2,$3,$1;
  9107. $2=self["@message"];
  9108. $recv($2)._arguments_([firstArgument,secondArgument,thirdArgument]);
  9109. $3=$recv($2)._sendTo_(self._receiver());
  9110. $1=$3;
  9111. return $1;
  9112. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  9113. },
  9114. args: ["firstArgument", "secondArgument", "thirdArgument"],
  9115. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  9116. referencedClasses: [],
  9117. messageSends: ["arguments:", "sendTo:", "receiver"]
  9118. }),
  9119. $globals.MessageSend);
  9120. $core.addMethod(
  9121. $core.method({
  9122. selector: "valueWithPossibleArguments:",
  9123. protocol: 'evaluating',
  9124. fn: function (aCollection){
  9125. var self=this;
  9126. return $core.withContext(function($ctx1) {
  9127. var $1;
  9128. self._arguments_(aCollection);
  9129. $1=self._value();
  9130. return $1;
  9131. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  9132. },
  9133. args: ["aCollection"],
  9134. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  9135. referencedClasses: [],
  9136. messageSends: ["arguments:", "value"]
  9137. }),
  9138. $globals.MessageSend);
  9139. $core.addClass('MethodContext', $globals.Object, [], 'Kernel-Methods');
  9140. $globals.MethodContext.comment="I hold all the dynamic state associated with the execution of either a method activation resulting from a message send. I am used to build the call stack while debugging.\x0a\x0aMy instances are JavaScript `SmalltalkMethodContext` objects defined in `boot.js`.";
  9141. $core.addMethod(
  9142. $core.method({
  9143. selector: "asString",
  9144. protocol: 'converting',
  9145. fn: function (){
  9146. var self=this;
  9147. return $core.withContext(function($ctx1) {
  9148. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  9149. $2=self._isBlockContext();
  9150. if($core.assert($2)){
  9151. $3="a block (in ".__comma($recv(self._methodContext())._asString());
  9152. $ctx1.sendIdx[","]=2;
  9153. $1=$recv($3).__comma(")");
  9154. $ctx1.sendIdx[","]=1;
  9155. } else {
  9156. var methodClass;
  9157. methodClass=$recv(self._method())._methodClass();
  9158. methodClass;
  9159. $5=methodClass;
  9160. $7=self._receiver();
  9161. $ctx1.sendIdx["receiver"]=1;
  9162. $6=$recv($7)._class();
  9163. $ctx1.sendIdx["class"]=1;
  9164. $4=$recv($5).__eq($6);
  9165. if($core.assert($4)){
  9166. $11=self._receiver();
  9167. $ctx1.sendIdx["receiver"]=2;
  9168. $10=$recv($11)._class();
  9169. $ctx1.sendIdx["class"]=2;
  9170. $9=$recv($10)._name();
  9171. $ctx1.sendIdx["name"]=1;
  9172. $8=$recv($9).__comma(" >> ");
  9173. $ctx1.sendIdx[","]=4;
  9174. $12=self._selector();
  9175. $ctx1.sendIdx["selector"]=1;
  9176. $1=$recv($8).__comma($12);
  9177. $ctx1.sendIdx[","]=3;
  9178. } else {
  9179. $16=$recv($recv(self._receiver())._class())._name();
  9180. $ctx1.sendIdx["name"]=2;
  9181. $15=$recv($16).__comma("(");
  9182. $14=$recv($15).__comma($recv(methodClass)._name());
  9183. $ctx1.sendIdx[","]=7;
  9184. $13=$recv($14).__comma(") >> ");
  9185. $ctx1.sendIdx[","]=6;
  9186. $1=$recv($13).__comma(self._selector());
  9187. $ctx1.sendIdx[","]=5;
  9188. };
  9189. };
  9190. return $1;
  9191. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  9192. },
  9193. args: [],
  9194. source: "asString\x0a\x09^ self isBlockContext\x0a\x09\x09ifTrue: [ 'a block (in ', self methodContext asString, ')' ]\x0a\x09\x09ifFalse: [ \x0a\x09\x09\x09| methodClass |\x0a\x09\x09\x09methodClass := self method methodClass.\x0a\x09\x09\x09methodClass = self receiver class \x0a\x09\x09\x09\x09ifTrue: [ self receiver class name, ' >> ', self selector ]\x0a\x09\x09\x09\x09ifFalse: [ self receiver class name, '(', methodClass name, ') >> ', self selector ] ]",
  9195. referencedClasses: [],
  9196. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  9197. }),
  9198. $globals.MethodContext);
  9199. $core.addMethod(
  9200. $core.method({
  9201. selector: "basicReceiver",
  9202. protocol: 'accessing',
  9203. fn: function (){
  9204. var self=this;
  9205. return $core.withContext(function($ctx1) {
  9206. return self.receiver;
  9207. return self;
  9208. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  9209. },
  9210. args: [],
  9211. source: "basicReceiver\x0a\x09<return self.receiver>",
  9212. referencedClasses: [],
  9213. messageSends: []
  9214. }),
  9215. $globals.MethodContext);
  9216. $core.addMethod(
  9217. $core.method({
  9218. selector: "evaluatedSelector",
  9219. protocol: 'accessing',
  9220. fn: function (){
  9221. var self=this;
  9222. return $core.withContext(function($ctx1) {
  9223. return self.evaluatedSelector;
  9224. return self;
  9225. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  9226. },
  9227. args: [],
  9228. source: "evaluatedSelector\x0a\x09<return self.evaluatedSelector>",
  9229. referencedClasses: [],
  9230. messageSends: []
  9231. }),
  9232. $globals.MethodContext);
  9233. $core.addMethod(
  9234. $core.method({
  9235. selector: "findContextSuchThat:",
  9236. protocol: 'accessing',
  9237. fn: function (testBlock){
  9238. var self=this;
  9239. var context;
  9240. return $core.withContext(function($ctx1) {
  9241. var $1,$2;
  9242. var $early={};
  9243. try {
  9244. context=self;
  9245. $recv((function(){
  9246. return $core.withContext(function($ctx2) {
  9247. return $recv(context)._isNil();
  9248. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9249. }))._whileFalse_((function(){
  9250. return $core.withContext(function($ctx2) {
  9251. $1=$recv(testBlock)._value_(context);
  9252. if($core.assert($1)){
  9253. $2=context;
  9254. throw $early=[$2];
  9255. };
  9256. context=$recv(context)._outerContext();
  9257. return context;
  9258. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9259. }));
  9260. return nil;
  9261. }
  9262. catch(e) {if(e===$early)return e[0]; throw e}
  9263. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  9264. },
  9265. args: ["testBlock"],
  9266. source: "findContextSuchThat: testBlock\x0a\x09\x22Search self and my sender chain for first one that satisfies `testBlock`. \x0a\x09Answer `nil` if none satisfy\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self.\x0a\x09[ context isNil] whileFalse: [\x0a\x09\x09(testBlock value: context) \x0a\x09\x09\x09ifTrue: [ ^ context ].\x0a\x09\x09context := context outerContext ].\x0a\x0a\x09^ nil",
  9267. referencedClasses: [],
  9268. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  9269. }),
  9270. $globals.MethodContext);
  9271. $core.addMethod(
  9272. $core.method({
  9273. selector: "home",
  9274. protocol: 'accessing',
  9275. fn: function (){
  9276. var self=this;
  9277. return $core.withContext(function($ctx1) {
  9278. return self.homeContext;
  9279. return self;
  9280. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  9281. },
  9282. args: [],
  9283. source: "home\x0a\x09<return self.homeContext>",
  9284. referencedClasses: [],
  9285. messageSends: []
  9286. }),
  9287. $globals.MethodContext);
  9288. $core.addMethod(
  9289. $core.method({
  9290. selector: "index",
  9291. protocol: 'accessing',
  9292. fn: function (){
  9293. var self=this;
  9294. return $core.withContext(function($ctx1) {
  9295. return self.index || 0;
  9296. return self;
  9297. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  9298. },
  9299. args: [],
  9300. source: "index\x0a\x09<return self.index || 0>",
  9301. referencedClasses: [],
  9302. messageSends: []
  9303. }),
  9304. $globals.MethodContext);
  9305. $core.addMethod(
  9306. $core.method({
  9307. selector: "isBlockContext",
  9308. protocol: 'testing',
  9309. fn: function (){
  9310. var self=this;
  9311. return $core.withContext(function($ctx1) {
  9312. var $1;
  9313. $1=$recv(self._selector())._isNil();
  9314. return $1;
  9315. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  9316. },
  9317. args: [],
  9318. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  9319. referencedClasses: [],
  9320. messageSends: ["isNil", "selector"]
  9321. }),
  9322. $globals.MethodContext);
  9323. $core.addMethod(
  9324. $core.method({
  9325. selector: "locals",
  9326. protocol: 'accessing',
  9327. fn: function (){
  9328. var self=this;
  9329. return $core.withContext(function($ctx1) {
  9330. return self.locals || {};
  9331. return self;
  9332. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  9333. },
  9334. args: [],
  9335. source: "locals\x0a\x09<return self.locals || {}>",
  9336. referencedClasses: [],
  9337. messageSends: []
  9338. }),
  9339. $globals.MethodContext);
  9340. $core.addMethod(
  9341. $core.method({
  9342. selector: "method",
  9343. protocol: 'accessing',
  9344. fn: function (){
  9345. var self=this;
  9346. var method,lookupClass,receiverClass,supercall;
  9347. return $core.withContext(function($ctx1) {
  9348. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$receiver;
  9349. $1=self._methodContext();
  9350. $ctx1.sendIdx["methodContext"]=1;
  9351. if(($receiver = $1) == null || $receiver.isNil){
  9352. return nil;
  9353. } else {
  9354. $1;
  9355. };
  9356. $3=self._methodContext();
  9357. $ctx1.sendIdx["methodContext"]=2;
  9358. $2=$recv($3)._receiver();
  9359. receiverClass=$recv($2)._class();
  9360. $4=receiverClass;
  9361. $6=self._methodContext();
  9362. $ctx1.sendIdx["methodContext"]=3;
  9363. $5=$recv($6)._selector();
  9364. $ctx1.sendIdx["selector"]=1;
  9365. method=$recv($4)._lookupSelector_($5);
  9366. $ctx1.sendIdx["lookupSelector:"]=1;
  9367. $7=self._outerContext();
  9368. if(($receiver = $7) == null || $receiver.isNil){
  9369. supercall=false;
  9370. } else {
  9371. var outer;
  9372. outer=$receiver;
  9373. supercall=$recv(outer)._supercall();
  9374. };
  9375. $9=supercall;
  9376. if($core.assert($9)){
  9377. $8=$recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv(self._methodContext())._selector());
  9378. } else {
  9379. $8=method;
  9380. };
  9381. return $8;
  9382. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  9383. },
  9384. args: [],
  9385. source: "method\x0a\x09| method lookupClass receiverClass supercall |\x0a\x09\x0a\x09self methodContext ifNil: [ ^ nil ].\x0a\x0a\x09receiverClass := self methodContext receiver class.\x0a\x09method := receiverClass lookupSelector: self methodContext selector.\x0a\x09supercall := self outerContext \x0a\x09\x09ifNil: [ false ]\x0a\x09\x09ifNotNil: [ :outer | outer supercall ].\x0a\x0a\x09^ supercall\x0a\x09\x09ifFalse: [ method ]\x0a\x09\x09ifTrue: [ method methodClass superclass lookupSelector: self methodContext selector ]",
  9386. referencedClasses: [],
  9387. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  9388. }),
  9389. $globals.MethodContext);
  9390. $core.addMethod(
  9391. $core.method({
  9392. selector: "methodContext",
  9393. protocol: 'accessing',
  9394. fn: function (){
  9395. var self=this;
  9396. return $core.withContext(function($ctx1) {
  9397. var $1,$3,$2,$receiver;
  9398. $1=self._isBlockContext();
  9399. if(!$core.assert($1)){
  9400. return self;
  9401. };
  9402. $3=self._outerContext();
  9403. if(($receiver = $3) == null || $receiver.isNil){
  9404. $2=$3;
  9405. } else {
  9406. var outer;
  9407. outer=$receiver;
  9408. $2=$recv(outer)._methodContext();
  9409. };
  9410. return $2;
  9411. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  9412. },
  9413. args: [],
  9414. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  9415. referencedClasses: [],
  9416. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  9417. }),
  9418. $globals.MethodContext);
  9419. $core.addMethod(
  9420. $core.method({
  9421. selector: "outerContext",
  9422. protocol: 'accessing',
  9423. fn: function (){
  9424. var self=this;
  9425. return $core.withContext(function($ctx1) {
  9426. return self.outerContext || self.homeContext;
  9427. return self;
  9428. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  9429. },
  9430. args: [],
  9431. source: "outerContext\x0a\x09<return self.outerContext || self.homeContext>",
  9432. referencedClasses: [],
  9433. messageSends: []
  9434. }),
  9435. $globals.MethodContext);
  9436. $core.addMethod(
  9437. $core.method({
  9438. selector: "printOn:",
  9439. protocol: 'printing',
  9440. fn: function (aStream){
  9441. var self=this;
  9442. return $core.withContext(function($ctx1) {
  9443. var $1;
  9444. (
  9445. $ctx1.supercall = true,
  9446. $globals.MethodContext.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  9447. $ctx1.supercall = false;
  9448. $recv(aStream)._nextPutAll_("(");
  9449. $ctx1.sendIdx["nextPutAll:"]=1;
  9450. $recv(aStream)._nextPutAll_(self._asString());
  9451. $ctx1.sendIdx["nextPutAll:"]=2;
  9452. $1=$recv(aStream)._nextPutAll_(")");
  9453. return self;
  9454. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  9455. },
  9456. args: ["aStream"],
  9457. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  9458. referencedClasses: [],
  9459. messageSends: ["printOn:", "nextPutAll:", "asString"]
  9460. }),
  9461. $globals.MethodContext);
  9462. $core.addMethod(
  9463. $core.method({
  9464. selector: "receiver",
  9465. protocol: 'accessing',
  9466. fn: function (){
  9467. var self=this;
  9468. return $core.withContext(function($ctx1) {
  9469. var $3,$2,$1;
  9470. $2=$recv(self._isBlockContext())._and_((function(){
  9471. return $core.withContext(function($ctx2) {
  9472. $3=self._outerContext();
  9473. $ctx2.sendIdx["outerContext"]=1;
  9474. return $recv($3)._notNil();
  9475. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9476. }));
  9477. if($core.assert($2)){
  9478. $1=$recv(self._outerContext())._receiver();
  9479. } else {
  9480. $1=self._basicReceiver();
  9481. };
  9482. return $1;
  9483. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  9484. },
  9485. args: [],
  9486. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  9487. referencedClasses: [],
  9488. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  9489. }),
  9490. $globals.MethodContext);
  9491. $core.addMethod(
  9492. $core.method({
  9493. selector: "selector",
  9494. protocol: 'accessing',
  9495. fn: function (){
  9496. var self=this;
  9497. return $core.withContext(function($ctx1) {
  9498. if(self.selector) {
  9499. return $core.js2st(self.selector);
  9500. } else {
  9501. return nil;
  9502. }
  9503. ;
  9504. return self;
  9505. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  9506. },
  9507. args: [],
  9508. source: "selector\x0a\x09<\x0a\x09\x09if(self.selector) {\x0a\x09\x09\x09return $core.js2st(self.selector);\x0a\x09\x09} else {\x0a\x09\x09\x09return nil;\x0a\x09\x09}\x0a\x09>",
  9509. referencedClasses: [],
  9510. messageSends: []
  9511. }),
  9512. $globals.MethodContext);
  9513. $core.addMethod(
  9514. $core.method({
  9515. selector: "sendIndexAt:",
  9516. protocol: 'accessing',
  9517. fn: function (aSelector){
  9518. var self=this;
  9519. return $core.withContext(function($ctx1) {
  9520. return self.sendIdx[aSelector] || 0;
  9521. return self;
  9522. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  9523. },
  9524. args: ["aSelector"],
  9525. source: "sendIndexAt: aSelector\x0a\x09<return self.sendIdx[aSelector] || 0>",
  9526. referencedClasses: [],
  9527. messageSends: []
  9528. }),
  9529. $globals.MethodContext);
  9530. $core.addMethod(
  9531. $core.method({
  9532. selector: "sendIndexes",
  9533. protocol: 'accessing',
  9534. fn: function (){
  9535. var self=this;
  9536. return $core.withContext(function($ctx1) {
  9537. return self.sendIdx;
  9538. return self;
  9539. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  9540. },
  9541. args: [],
  9542. source: "sendIndexes\x0a\x09<return self.sendIdx>",
  9543. referencedClasses: [],
  9544. messageSends: []
  9545. }),
  9546. $globals.MethodContext);
  9547. $core.addMethod(
  9548. $core.method({
  9549. selector: "supercall",
  9550. protocol: 'accessing',
  9551. fn: function (){
  9552. var self=this;
  9553. return $core.withContext(function($ctx1) {
  9554. return self.supercall == true;
  9555. return self;
  9556. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  9557. },
  9558. args: [],
  9559. source: "supercall\x0a\x09<return self.supercall == true>",
  9560. referencedClasses: [],
  9561. messageSends: []
  9562. }),
  9563. $globals.MethodContext);
  9564. $core.addClass('NativeFunction', $globals.Object, [], 'Kernel-Methods');
  9565. $globals.NativeFunction.comment="I am a wrapper around native functions, such as `WebSocket`.\x0aFor 'normal' functions (whose constructor is the JavaScript `Function` object), use `BlockClosure`.\x0a\x0a## API\x0a\x0aSee the class-side `instance creation` methods for instance creation.\x0a\x0aCreated instances will most probably be instance of `JSObjectProxy`.\x0a\x0a## Usage example:\x0a\x0a\x09| ws |\x0a\x09ws := NativeFunction constructor: 'WebSocket' value: 'ws://localhost'.\x0a\x09ws at: 'onopen' put: [ ws send: 'hey there from Amber' ]";
  9566. $core.addMethod(
  9567. $core.method({
  9568. selector: "constructor:",
  9569. protocol: 'instance creation',
  9570. fn: function (aString){
  9571. var self=this;
  9572. return $core.withContext(function($ctx1) {
  9573. self._deprecatedAPI_("Use constructorNamed:");
  9574. var nativeFunc=eval(aString);
  9575. return new nativeFunc();
  9576. ;
  9577. return self;
  9578. }, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},$globals.NativeFunction.klass)});
  9579. },
  9580. args: ["aString"],
  9581. source: "constructor: aString\x0a\x09<\x0a\x09\x09self._deprecatedAPI_(\x22Use constructorNamed:\x22);\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  9582. referencedClasses: [],
  9583. messageSends: []
  9584. }),
  9585. $globals.NativeFunction.klass);
  9586. $core.addMethod(
  9587. $core.method({
  9588. selector: "constructor:value:",
  9589. protocol: 'instance creation',
  9590. fn: function (aString,anObject){
  9591. var self=this;
  9592. return $core.withContext(function($ctx1) {
  9593. self._deprecatedAPI_("Use constructorNamed:value:");
  9594. var nativeFunc=eval(aString);
  9595. return new nativeFunc(anObject);
  9596. ;
  9597. return self;
  9598. }, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9599. },
  9600. args: ["aString", "anObject"],
  9601. source: "constructor: aString value:anObject\x0a\x09<\x0a\x09\x09self._deprecatedAPI_(\x22Use constructorNamed:value:\x22);\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  9602. referencedClasses: [],
  9603. messageSends: []
  9604. }),
  9605. $globals.NativeFunction.klass);
  9606. $core.addMethod(
  9607. $core.method({
  9608. selector: "constructor:value:value:",
  9609. protocol: 'instance creation',
  9610. fn: function (aString,anObject,anObject2){
  9611. var self=this;
  9612. return $core.withContext(function($ctx1) {
  9613. self._deprecatedAPI_("Use constructorNamed:value:value:");
  9614. var nativeFunc=eval(aString);
  9615. return new nativeFunc(anObject,anObject2);
  9616. ;
  9617. return self;
  9618. }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9619. },
  9620. args: ["aString", "anObject", "anObject2"],
  9621. source: "constructor: aString value:anObject value: anObject2\x0a\x09<\x0a\x09\x09self._deprecatedAPI_(\x22Use constructorNamed:value:value:\x22);\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
  9622. referencedClasses: [],
  9623. messageSends: []
  9624. }),
  9625. $globals.NativeFunction.klass);
  9626. $core.addMethod(
  9627. $core.method({
  9628. selector: "constructor:value:value:value:",
  9629. protocol: 'instance creation',
  9630. fn: function (aString,anObject,anObject2,anObject3){
  9631. var self=this;
  9632. return $core.withContext(function($ctx1) {
  9633. self._deprecatedAPI_("Use constructorNamed:value:value:value");
  9634. var nativeFunc=eval(aString);
  9635. return new nativeFunc(anObject,anObject2, anObject3);
  9636. ;
  9637. return self;
  9638. }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9639. },
  9640. args: ["aString", "anObject", "anObject2", "anObject3"],
  9641. source: "constructor: aString value:anObject value: anObject2 value:anObject3\x0a\x09<\x0a\x09\x09self._deprecatedAPI_(\x22Use constructorNamed:value:value:value\x22);\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9642. referencedClasses: [],
  9643. messageSends: []
  9644. }),
  9645. $globals.NativeFunction.klass);
  9646. $core.addMethod(
  9647. $core.method({
  9648. selector: "constructorNamed:",
  9649. protocol: 'instance creation',
  9650. fn: function (aString){
  9651. var self=this;
  9652. return $core.withContext(function($ctx1) {
  9653. var nativeFunc=(new Function('return this'))()[aString];
  9654. return new nativeFunc();
  9655. ;
  9656. return self;
  9657. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.klass)});
  9658. },
  9659. args: ["aString"],
  9660. source: "constructorNamed: aString\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  9661. referencedClasses: [],
  9662. messageSends: []
  9663. }),
  9664. $globals.NativeFunction.klass);
  9665. $core.addMethod(
  9666. $core.method({
  9667. selector: "constructorNamed:value:",
  9668. protocol: 'instance creation',
  9669. fn: function (aString,anObject){
  9670. var self=this;
  9671. return $core.withContext(function($ctx1) {
  9672. var nativeFunc=(new Function('return this'))()[aString];
  9673. return new nativeFunc(anObject);
  9674. ;
  9675. return self;
  9676. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9677. },
  9678. args: ["aString", "anObject"],
  9679. source: "constructorNamed: aString value: anObject\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  9680. referencedClasses: [],
  9681. messageSends: []
  9682. }),
  9683. $globals.NativeFunction.klass);
  9684. $core.addMethod(
  9685. $core.method({
  9686. selector: "constructorNamed:value:value:",
  9687. protocol: 'instance creation',
  9688. fn: function (aString,anObject,anObject2){
  9689. var self=this;
  9690. return $core.withContext(function($ctx1) {
  9691. var nativeFunc=(new Function('return this'))()[aString];
  9692. return new nativeFunc(anObject,anObject2);
  9693. ;
  9694. return self;
  9695. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9696. },
  9697. args: ["aString", "anObject", "anObject2"],
  9698. source: "constructorNamed: aString value: anObject value: anObject2\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
  9699. referencedClasses: [],
  9700. messageSends: []
  9701. }),
  9702. $globals.NativeFunction.klass);
  9703. $core.addMethod(
  9704. $core.method({
  9705. selector: "constructorNamed:value:value:value:",
  9706. protocol: 'instance creation',
  9707. fn: function (aString,anObject,anObject2,anObject3){
  9708. var self=this;
  9709. return $core.withContext(function($ctx1) {
  9710. var nativeFunc=(new Function('return this'))()[aString];
  9711. return new nativeFunc(anObject,anObject2, anObject3);
  9712. ;
  9713. return self;
  9714. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9715. },
  9716. args: ["aString", "anObject", "anObject2", "anObject3"],
  9717. source: "constructorNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9718. referencedClasses: [],
  9719. messageSends: []
  9720. }),
  9721. $globals.NativeFunction.klass);
  9722. $core.addMethod(
  9723. $core.method({
  9724. selector: "constructorOf:",
  9725. protocol: 'instance creation',
  9726. fn: function (nativeFunc){
  9727. var self=this;
  9728. return $core.withContext(function($ctx1) {
  9729. return new nativeFunc();
  9730. ;
  9731. return self;
  9732. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  9733. },
  9734. args: ["nativeFunc"],
  9735. source: "constructorOf: nativeFunc\x0a\x09<\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  9736. referencedClasses: [],
  9737. messageSends: []
  9738. }),
  9739. $globals.NativeFunction.klass);
  9740. $core.addMethod(
  9741. $core.method({
  9742. selector: "constructorOf:value:",
  9743. protocol: 'instance creation',
  9744. fn: function (nativeFunc,anObject){
  9745. var self=this;
  9746. return $core.withContext(function($ctx1) {
  9747. return new nativeFunc(anObject);
  9748. ;
  9749. return self;
  9750. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  9751. },
  9752. args: ["nativeFunc", "anObject"],
  9753. source: "constructorOf: nativeFunc value: anObject\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  9754. referencedClasses: [],
  9755. messageSends: []
  9756. }),
  9757. $globals.NativeFunction.klass);
  9758. $core.addMethod(
  9759. $core.method({
  9760. selector: "constructorOf:value:value:",
  9761. protocol: 'instance creation',
  9762. fn: function (nativeFunc,anObject,anObject2){
  9763. var self=this;
  9764. return $core.withContext(function($ctx1) {
  9765. return new nativeFunc(anObject,anObject2);
  9766. ;
  9767. return self;
  9768. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9769. },
  9770. args: ["nativeFunc", "anObject", "anObject2"],
  9771. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
  9772. referencedClasses: [],
  9773. messageSends: []
  9774. }),
  9775. $globals.NativeFunction.klass);
  9776. $core.addMethod(
  9777. $core.method({
  9778. selector: "constructorOf:value:value:value:",
  9779. protocol: 'instance creation',
  9780. fn: function (nativeFunc,anObject,anObject2,anObject3){
  9781. var self=this;
  9782. return $core.withContext(function($ctx1) {
  9783. return new nativeFunc(anObject,anObject2, anObject3);
  9784. ;
  9785. return self;
  9786. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9787. },
  9788. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  9789. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9790. referencedClasses: [],
  9791. messageSends: []
  9792. }),
  9793. $globals.NativeFunction.klass);
  9794. $core.addMethod(
  9795. $core.method({
  9796. selector: "exists:",
  9797. protocol: 'testing',
  9798. fn: function (aString){
  9799. var self=this;
  9800. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  9801. return $core.withContext(function($ctx1) {
  9802. var $1;
  9803. $1=$recv($Smalltalk())._existsJsGlobal_(aString);
  9804. return $1;
  9805. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.klass)});
  9806. },
  9807. args: ["aString"],
  9808. source: "exists: aString\x0a\x09^ Smalltalk existsJsGlobal: aString",
  9809. referencedClasses: ["Smalltalk"],
  9810. messageSends: ["existsJsGlobal:"]
  9811. }),
  9812. $globals.NativeFunction.klass);
  9813. $core.addMethod(
  9814. $core.method({
  9815. selector: "functionNamed:",
  9816. protocol: 'function calling',
  9817. fn: function (aString){
  9818. var self=this;
  9819. return $core.withContext(function($ctx1) {
  9820. var nativeFunc=(new Function('return this'))()[aString];
  9821. return nativeFunc();
  9822. ;
  9823. return self;
  9824. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.klass)});
  9825. },
  9826. args: ["aString"],
  9827. source: "functionNamed: aString\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc();\x0a\x09>",
  9828. referencedClasses: [],
  9829. messageSends: []
  9830. }),
  9831. $globals.NativeFunction.klass);
  9832. $core.addMethod(
  9833. $core.method({
  9834. selector: "functionNamed:value:",
  9835. protocol: 'function calling',
  9836. fn: function (aString,anObject){
  9837. var self=this;
  9838. return $core.withContext(function($ctx1) {
  9839. var nativeFunc=(new Function('return this'))()[aString];
  9840. return nativeFunc(anObject);
  9841. ;
  9842. return self;
  9843. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9844. },
  9845. args: ["aString", "anObject"],
  9846. source: "functionNamed: aString value: anObject\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09>",
  9847. referencedClasses: [],
  9848. messageSends: []
  9849. }),
  9850. $globals.NativeFunction.klass);
  9851. $core.addMethod(
  9852. $core.method({
  9853. selector: "functionNamed:value:value:",
  9854. protocol: 'function calling',
  9855. fn: function (aString,anObject,anObject2){
  9856. var self=this;
  9857. return $core.withContext(function($ctx1) {
  9858. var nativeFunc=(new Function('return this'))()[aString];
  9859. return nativeFunc(anObject,anObject2);
  9860. ;
  9861. return self;
  9862. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9863. },
  9864. args: ["aString", "anObject", "anObject2"],
  9865. source: "functionNamed: aString value: anObject value: anObject2\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09>",
  9866. referencedClasses: [],
  9867. messageSends: []
  9868. }),
  9869. $globals.NativeFunction.klass);
  9870. $core.addMethod(
  9871. $core.method({
  9872. selector: "functionNamed:value:value:value:",
  9873. protocol: 'function calling',
  9874. fn: function (aString,anObject,anObject2,anObject3){
  9875. var self=this;
  9876. return $core.withContext(function($ctx1) {
  9877. var nativeFunc=(new Function('return this'))()[aString];
  9878. return nativeFunc(anObject,anObject2, anObject3);
  9879. ;
  9880. return self;
  9881. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9882. },
  9883. args: ["aString", "anObject", "anObject2", "anObject3"],
  9884. source: "functionNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9885. referencedClasses: [],
  9886. messageSends: []
  9887. }),
  9888. $globals.NativeFunction.klass);
  9889. $core.addMethod(
  9890. $core.method({
  9891. selector: "functionNamed:valueWithArgs:",
  9892. protocol: 'function calling',
  9893. fn: function (aString,args){
  9894. var self=this;
  9895. return $core.withContext(function($ctx1) {
  9896. var nativeFunc=(new Function('return this'))()[aString];
  9897. return Function.prototype.apply.call(nativeFunc, null, args);
  9898. ;
  9899. return self;
  9900. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.klass)});
  9901. },
  9902. args: ["aString", "args"],
  9903. source: "functionNamed: aString valueWithArgs: args\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09>",
  9904. referencedClasses: [],
  9905. messageSends: []
  9906. }),
  9907. $globals.NativeFunction.klass);
  9908. $core.addMethod(
  9909. $core.method({
  9910. selector: "functionOf:",
  9911. protocol: 'function calling',
  9912. fn: function (nativeFunc){
  9913. var self=this;
  9914. return $core.withContext(function($ctx1) {
  9915. return nativeFunc();
  9916. ;
  9917. return self;
  9918. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  9919. },
  9920. args: ["nativeFunc"],
  9921. source: "functionOf: nativeFunc\x0a\x09<\x0a\x09\x09return nativeFunc();\x0a\x09>",
  9922. referencedClasses: [],
  9923. messageSends: []
  9924. }),
  9925. $globals.NativeFunction.klass);
  9926. $core.addMethod(
  9927. $core.method({
  9928. selector: "functionOf:value:",
  9929. protocol: 'function calling',
  9930. fn: function (nativeFunc,anObject){
  9931. var self=this;
  9932. return $core.withContext(function($ctx1) {
  9933. return nativeFunc(anObject);
  9934. ;
  9935. return self;
  9936. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  9937. },
  9938. args: ["nativeFunc", "anObject"],
  9939. source: "functionOf: nativeFunc value: anObject\x0a\x09<\x0a\x09\x09return nativeFunc(anObject);\x0a\x09>",
  9940. referencedClasses: [],
  9941. messageSends: []
  9942. }),
  9943. $globals.NativeFunction.klass);
  9944. $core.addMethod(
  9945. $core.method({
  9946. selector: "functionOf:value:value:",
  9947. protocol: 'function calling',
  9948. fn: function (nativeFunc,anObject,anObject2){
  9949. var self=this;
  9950. return $core.withContext(function($ctx1) {
  9951. return nativeFunc(anObject,anObject2);
  9952. ;
  9953. return self;
  9954. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9955. },
  9956. args: ["nativeFunc", "anObject", "anObject2"],
  9957. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09>",
  9958. referencedClasses: [],
  9959. messageSends: []
  9960. }),
  9961. $globals.NativeFunction.klass);
  9962. $core.addMethod(
  9963. $core.method({
  9964. selector: "functionOf:value:value:value:",
  9965. protocol: 'function calling',
  9966. fn: function (nativeFunc,anObject,anObject2,anObject3){
  9967. var self=this;
  9968. return $core.withContext(function($ctx1) {
  9969. return nativeFunc(anObject,anObject2, anObject3);
  9970. ;
  9971. return self;
  9972. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9973. },
  9974. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  9975. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9976. referencedClasses: [],
  9977. messageSends: []
  9978. }),
  9979. $globals.NativeFunction.klass);
  9980. $core.addMethod(
  9981. $core.method({
  9982. selector: "functionOf:valueWithArgs:",
  9983. protocol: 'function calling',
  9984. fn: function (nativeFunc,args){
  9985. var self=this;
  9986. return $core.withContext(function($ctx1) {
  9987. return Function.prototype.apply.call(nativeFunc, null, args);
  9988. ;
  9989. return self;
  9990. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.klass)});
  9991. },
  9992. args: ["nativeFunc", "args"],
  9993. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09>",
  9994. referencedClasses: [],
  9995. messageSends: []
  9996. }),
  9997. $globals.NativeFunction.klass);
  9998. $core.addMethod(
  9999. $core.method({
  10000. selector: "methodOf:this:",
  10001. protocol: 'method calling',
  10002. fn: function (nativeFunc,thisObject){
  10003. var self=this;
  10004. return $core.withContext(function($ctx1) {
  10005. return Function.prototype.call.call(nativeFunc, thisObject);
  10006. ;
  10007. return self;
  10008. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.klass)});
  10009. },
  10010. args: ["nativeFunc", "thisObject"],
  10011. source: "methodOf: nativeFunc this: thisObject\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09>",
  10012. referencedClasses: [],
  10013. messageSends: []
  10014. }),
  10015. $globals.NativeFunction.klass);
  10016. $core.addMethod(
  10017. $core.method({
  10018. selector: "methodOf:this:value:",
  10019. protocol: 'method calling',
  10020. fn: function (nativeFunc,thisObject,anObject){
  10021. var self=this;
  10022. return $core.withContext(function($ctx1) {
  10023. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  10024. ;
  10025. return self;
  10026. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.klass)});
  10027. },
  10028. args: ["nativeFunc", "thisObject", "anObject"],
  10029. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09>",
  10030. referencedClasses: [],
  10031. messageSends: []
  10032. }),
  10033. $globals.NativeFunction.klass);
  10034. $core.addMethod(
  10035. $core.method({
  10036. selector: "methodOf:this:value:value:",
  10037. protocol: 'method calling',
  10038. fn: function (nativeFunc,thisObject,anObject,anObject2){
  10039. var self=this;
  10040. return $core.withContext(function($ctx1) {
  10041. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  10042. ;
  10043. return self;
  10044. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10045. },
  10046. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  10047. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);\x0a\x09>",
  10048. referencedClasses: [],
  10049. messageSends: []
  10050. }),
  10051. $globals.NativeFunction.klass);
  10052. $core.addMethod(
  10053. $core.method({
  10054. selector: "methodOf:this:value:value:value:",
  10055. protocol: 'method calling',
  10056. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  10057. var self=this;
  10058. return $core.withContext(function($ctx1) {
  10059. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  10060. ;
  10061. return self;
  10062. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10063. },
  10064. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  10065. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);\x0a\x09>",
  10066. referencedClasses: [],
  10067. messageSends: []
  10068. }),
  10069. $globals.NativeFunction.klass);
  10070. $core.addMethod(
  10071. $core.method({
  10072. selector: "methodOf:this:valueWithArgs:",
  10073. protocol: 'method calling',
  10074. fn: function (nativeFunc,thisObject,args){
  10075. var self=this;
  10076. return $core.withContext(function($ctx1) {
  10077. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  10078. ;
  10079. return self;
  10080. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.klass)});
  10081. },
  10082. args: ["nativeFunc", "thisObject", "args"],
  10083. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09>",
  10084. referencedClasses: [],
  10085. messageSends: []
  10086. }),
  10087. $globals.NativeFunction.klass);
  10088. $core.addClass('Timeout', $globals.Object, ['rawTimeout'], 'Kernel-Methods');
  10089. $globals.Timeout.comment="I am wrapping the returns from `set{Timeout,Interval}`.\x0a\x0a## Motivation\x0a\x0aNumber suffices in browsers, but node.js returns an object.";
  10090. $core.addMethod(
  10091. $core.method({
  10092. selector: "clearInterval",
  10093. protocol: 'timeout/interval',
  10094. fn: function (){
  10095. var self=this;
  10096. return $core.withContext(function($ctx1) {
  10097. var interval = self["@rawTimeout"];
  10098. clearInterval(interval);
  10099. ;
  10100. return self;
  10101. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  10102. },
  10103. args: [],
  10104. source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>",
  10105. referencedClasses: [],
  10106. messageSends: []
  10107. }),
  10108. $globals.Timeout);
  10109. $core.addMethod(
  10110. $core.method({
  10111. selector: "clearTimeout",
  10112. protocol: 'timeout/interval',
  10113. fn: function (){
  10114. var self=this;
  10115. return $core.withContext(function($ctx1) {
  10116. var timeout = self["@rawTimeout"];
  10117. clearTimeout(timeout);
  10118. ;
  10119. return self;
  10120. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  10121. },
  10122. args: [],
  10123. source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>",
  10124. referencedClasses: [],
  10125. messageSends: []
  10126. }),
  10127. $globals.Timeout);
  10128. $core.addMethod(
  10129. $core.method({
  10130. selector: "rawTimeout:",
  10131. protocol: 'accessing',
  10132. fn: function (anObject){
  10133. var self=this;
  10134. self["@rawTimeout"]=anObject;
  10135. return self;
  10136. },
  10137. args: ["anObject"],
  10138. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  10139. referencedClasses: [],
  10140. messageSends: []
  10141. }),
  10142. $globals.Timeout);
  10143. $core.addMethod(
  10144. $core.method({
  10145. selector: "on:",
  10146. protocol: 'instance creation',
  10147. fn: function (anObject){
  10148. var self=this;
  10149. return $core.withContext(function($ctx1) {
  10150. var $2,$3,$1;
  10151. $2=self._new();
  10152. $recv($2)._rawTimeout_(anObject);
  10153. $3=$recv($2)._yourself();
  10154. $1=$3;
  10155. return $1;
  10156. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.klass)});
  10157. },
  10158. args: ["anObject"],
  10159. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  10160. referencedClasses: [],
  10161. messageSends: ["rawTimeout:", "new", "yourself"]
  10162. }),
  10163. $globals.Timeout.klass);
  10164. });
  10165. define("amber_core/Kernel-Collections", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  10166. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  10167. $core.addPackage('Kernel-Collections');
  10168. $core.packages["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  10169. $core.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  10170. $core.addClass('Association', $globals.Object, ['key', 'value'], 'Kernel-Collections');
  10171. $globals.Association.comment="I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.\x0a\x0aInstances can be created with the class-side method `#key:value:`";
  10172. $core.addMethod(
  10173. $core.method({
  10174. selector: "=",
  10175. protocol: 'comparing',
  10176. fn: function (anAssociation){
  10177. var self=this;
  10178. return $core.withContext(function($ctx1) {
  10179. var $3,$2,$5,$4,$6,$1;
  10180. $3=self._class();
  10181. $ctx1.sendIdx["class"]=1;
  10182. $2=$recv($3).__eq($recv(anAssociation)._class());
  10183. $ctx1.sendIdx["="]=1;
  10184. $1=$recv($2)._and_((function(){
  10185. return $core.withContext(function($ctx2) {
  10186. $5=self._key();
  10187. $ctx2.sendIdx["key"]=1;
  10188. $4=$recv($5).__eq($recv(anAssociation)._key());
  10189. $ctx2.sendIdx["="]=2;
  10190. return $recv($4)._and_((function(){
  10191. return $core.withContext(function($ctx3) {
  10192. $6=self._value();
  10193. $ctx3.sendIdx["value"]=1;
  10194. return $recv($6).__eq($recv(anAssociation)._value());
  10195. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  10196. }));
  10197. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10198. }));
  10199. $ctx1.sendIdx["and:"]=1;
  10200. return $1;
  10201. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  10202. },
  10203. args: ["anAssociation"],
  10204. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  10205. referencedClasses: [],
  10206. messageSends: ["and:", "=", "class", "key", "value"]
  10207. }),
  10208. $globals.Association);
  10209. $core.addMethod(
  10210. $core.method({
  10211. selector: "key",
  10212. protocol: 'accessing',
  10213. fn: function (){
  10214. var self=this;
  10215. var $1;
  10216. $1=self["@key"];
  10217. return $1;
  10218. },
  10219. args: [],
  10220. source: "key\x0a\x09^ key",
  10221. referencedClasses: [],
  10222. messageSends: []
  10223. }),
  10224. $globals.Association);
  10225. $core.addMethod(
  10226. $core.method({
  10227. selector: "key:",
  10228. protocol: 'accessing',
  10229. fn: function (aKey){
  10230. var self=this;
  10231. self["@key"]=aKey;
  10232. return self;
  10233. },
  10234. args: ["aKey"],
  10235. source: "key: aKey\x0a\x09key := aKey",
  10236. referencedClasses: [],
  10237. messageSends: []
  10238. }),
  10239. $globals.Association);
  10240. $core.addMethod(
  10241. $core.method({
  10242. selector: "printOn:",
  10243. protocol: 'printing',
  10244. fn: function (aStream){
  10245. var self=this;
  10246. return $core.withContext(function($ctx1) {
  10247. $recv(self._key())._printOn_(aStream);
  10248. $ctx1.sendIdx["printOn:"]=1;
  10249. $recv(aStream)._nextPutAll_(" -> ");
  10250. $recv(self._value())._printOn_(aStream);
  10251. return self;
  10252. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  10253. },
  10254. args: ["aStream"],
  10255. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  10256. referencedClasses: [],
  10257. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  10258. }),
  10259. $globals.Association);
  10260. $core.addMethod(
  10261. $core.method({
  10262. selector: "value",
  10263. protocol: 'accessing',
  10264. fn: function (){
  10265. var self=this;
  10266. var $1;
  10267. $1=self["@value"];
  10268. return $1;
  10269. },
  10270. args: [],
  10271. source: "value\x0a\x09^ value",
  10272. referencedClasses: [],
  10273. messageSends: []
  10274. }),
  10275. $globals.Association);
  10276. $core.addMethod(
  10277. $core.method({
  10278. selector: "value:",
  10279. protocol: 'accessing',
  10280. fn: function (aValue){
  10281. var self=this;
  10282. self["@value"]=aValue;
  10283. return self;
  10284. },
  10285. args: ["aValue"],
  10286. source: "value: aValue\x0a\x09value := aValue",
  10287. referencedClasses: [],
  10288. messageSends: []
  10289. }),
  10290. $globals.Association);
  10291. $core.addMethod(
  10292. $core.method({
  10293. selector: "key:value:",
  10294. protocol: 'instance creation',
  10295. fn: function (aKey,aValue){
  10296. var self=this;
  10297. return $core.withContext(function($ctx1) {
  10298. var $2,$3,$1;
  10299. $2=self._new();
  10300. $recv($2)._key_(aKey);
  10301. $recv($2)._value_(aValue);
  10302. $3=$recv($2)._yourself();
  10303. $1=$3;
  10304. return $1;
  10305. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.klass)});
  10306. },
  10307. args: ["aKey", "aValue"],
  10308. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  10309. referencedClasses: [],
  10310. messageSends: ["key:", "new", "value:", "yourself"]
  10311. }),
  10312. $globals.Association.klass);
  10313. $core.addClass('BucketStore', $globals.Object, ['buckets', 'hashBlock'], 'Kernel-Collections');
  10314. $globals.BucketStore.comment="I am an helper class for hash-based stores.\x0a\x0aI hold buckets which are selected by a hash, specified using `#hashBlock:`.\x0aThe hash can be any object, and\x0ait is used as a JS property (that is, in ES5\x0aits toString() value counts).\x0a\x0a## API\x0aI maintain a list of buckets. Client code can use this API:\x0a - `#bucketOfElement:` (to ask a bucket for element, I can return JS null if n/a)\x0a - `#do:` (to enumerate all elements of all buckets)\x0a - `#removeAll` (to remove all buckets)\x0a\x0aClient code itself should add/remove elements\x0ain a bucket. The `nil` object should not be put into any bucket.\x0a\x0aTypes of buckets are the responsibility of subclasses via `#newBucket`.";
  10315. $core.addMethod(
  10316. $core.method({
  10317. selector: "bucketOfElement:",
  10318. protocol: 'accessing',
  10319. fn: function (anObject){
  10320. var self=this;
  10321. return $core.withContext(function($ctx1) {
  10322. var hash = self['@hashBlock'](anObject);
  10323. if (!hash) return null;
  10324. var buckets = self['@buckets'],
  10325. bucket = buckets[hash];
  10326. if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
  10327. return bucket;
  10328. ;
  10329. return self;
  10330. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  10331. },
  10332. args: ["anObject"],
  10333. source: "bucketOfElement: anObject\x0a\x09<\x0a\x09\x09var hash = self['@hashBlock'](anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = self['@buckets'],\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09>",
  10334. referencedClasses: [],
  10335. messageSends: []
  10336. }),
  10337. $globals.BucketStore);
  10338. $core.addMethod(
  10339. $core.method({
  10340. selector: "do:",
  10341. protocol: 'enumerating',
  10342. fn: function (aBlock){
  10343. var self=this;
  10344. return $core.withContext(function($ctx1) {
  10345. var buckets = self['@buckets'];
  10346. var keys = Object.keys(buckets);
  10347. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  10348. ;
  10349. return self;
  10350. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  10351. },
  10352. args: ["aBlock"],
  10353. source: "do: aBlock\x0a\x09<\x0a\x09\x09var buckets = self['@buckets'];\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09>",
  10354. referencedClasses: [],
  10355. messageSends: []
  10356. }),
  10357. $globals.BucketStore);
  10358. $core.addMethod(
  10359. $core.method({
  10360. selector: "hashBlock:",
  10361. protocol: 'accessing',
  10362. fn: function (aBlock){
  10363. var self=this;
  10364. self["@hashBlock"]=aBlock;
  10365. return self;
  10366. },
  10367. args: ["aBlock"],
  10368. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  10369. referencedClasses: [],
  10370. messageSends: []
  10371. }),
  10372. $globals.BucketStore);
  10373. $core.addMethod(
  10374. $core.method({
  10375. selector: "initialize",
  10376. protocol: 'initialization',
  10377. fn: function (){
  10378. var self=this;
  10379. return $core.withContext(function($ctx1) {
  10380. (
  10381. $ctx1.supercall = true,
  10382. $globals.BucketStore.superclass.fn.prototype._initialize.apply($recv(self), []));
  10383. $ctx1.supercall = false;
  10384. self._removeAll();
  10385. return self;
  10386. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  10387. },
  10388. args: [],
  10389. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  10390. referencedClasses: [],
  10391. messageSends: ["initialize", "removeAll"]
  10392. }),
  10393. $globals.BucketStore);
  10394. $core.addMethod(
  10395. $core.method({
  10396. selector: "newBucket",
  10397. protocol: 'private',
  10398. fn: function (){
  10399. var self=this;
  10400. return $core.withContext(function($ctx1) {
  10401. self._subclassResponsibility();
  10402. return self;
  10403. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  10404. },
  10405. args: [],
  10406. source: "newBucket\x0a\x09self subclassResponsibility",
  10407. referencedClasses: [],
  10408. messageSends: ["subclassResponsibility"]
  10409. }),
  10410. $globals.BucketStore);
  10411. $core.addMethod(
  10412. $core.method({
  10413. selector: "removeAll",
  10414. protocol: 'adding/removing',
  10415. fn: function (){
  10416. var self=this;
  10417. return $core.withContext(function($ctx1) {
  10418. self['@buckets'] = Object.create(null);;
  10419. return self;
  10420. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  10421. },
  10422. args: [],
  10423. source: "removeAll\x0a\x09<self['@buckets'] = Object.create(null);>",
  10424. referencedClasses: [],
  10425. messageSends: []
  10426. }),
  10427. $globals.BucketStore);
  10428. $core.addMethod(
  10429. $core.method({
  10430. selector: "hashBlock:",
  10431. protocol: 'instance creation',
  10432. fn: function (aBlock){
  10433. var self=this;
  10434. return $core.withContext(function($ctx1) {
  10435. var $2,$3,$1;
  10436. $2=self._new();
  10437. $recv($2)._hashBlock_(aBlock);
  10438. $3=$recv($2)._yourself();
  10439. $1=$3;
  10440. return $1;
  10441. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.klass)});
  10442. },
  10443. args: ["aBlock"],
  10444. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  10445. referencedClasses: [],
  10446. messageSends: ["hashBlock:", "new", "yourself"]
  10447. }),
  10448. $globals.BucketStore.klass);
  10449. $core.addClass('ArrayBucketStore', $globals.BucketStore, [], 'Kernel-Collections');
  10450. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  10451. $core.addMethod(
  10452. $core.method({
  10453. selector: "newBucket",
  10454. protocol: 'private',
  10455. fn: function (){
  10456. var self=this;
  10457. var $1;
  10458. $1=[];
  10459. return $1;
  10460. },
  10461. args: [],
  10462. source: "newBucket\x0a\x09^ #()",
  10463. referencedClasses: [],
  10464. messageSends: []
  10465. }),
  10466. $globals.ArrayBucketStore);
  10467. $core.addClass('Collection', $globals.Object, [], 'Kernel-Collections');
  10468. $globals.Collection.comment="I am the abstract superclass of all classes that represent a group of elements.\x0a\x0aI provide a set of useful methods to the Collection hierarchy such as enumerating and converting methods.";
  10469. $core.addMethod(
  10470. $core.method({
  10471. selector: ",",
  10472. protocol: 'copying',
  10473. fn: function (aCollection){
  10474. var self=this;
  10475. return $core.withContext(function($ctx1) {
  10476. var $2,$3,$1;
  10477. $2=self._copy();
  10478. $recv($2)._addAll_(aCollection);
  10479. $3=$recv($2)._yourself();
  10480. $1=$3;
  10481. return $1;
  10482. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  10483. },
  10484. args: ["aCollection"],
  10485. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  10486. referencedClasses: [],
  10487. messageSends: ["addAll:", "copy", "yourself"]
  10488. }),
  10489. $globals.Collection);
  10490. $core.addMethod(
  10491. $core.method({
  10492. selector: "add:",
  10493. protocol: 'adding/removing',
  10494. fn: function (anObject){
  10495. var self=this;
  10496. return $core.withContext(function($ctx1) {
  10497. self._subclassResponsibility();
  10498. return self;
  10499. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  10500. },
  10501. args: ["anObject"],
  10502. source: "add: anObject\x0a\x09self subclassResponsibility",
  10503. referencedClasses: [],
  10504. messageSends: ["subclassResponsibility"]
  10505. }),
  10506. $globals.Collection);
  10507. $core.addMethod(
  10508. $core.method({
  10509. selector: "addAll:",
  10510. protocol: 'adding/removing',
  10511. fn: function (aCollection){
  10512. var self=this;
  10513. return $core.withContext(function($ctx1) {
  10514. $recv(aCollection)._do_((function(each){
  10515. return $core.withContext(function($ctx2) {
  10516. return self._add_(each);
  10517. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10518. }));
  10519. return aCollection;
  10520. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  10521. },
  10522. args: ["aCollection"],
  10523. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  10524. referencedClasses: [],
  10525. messageSends: ["do:", "add:"]
  10526. }),
  10527. $globals.Collection);
  10528. $core.addMethod(
  10529. $core.method({
  10530. selector: "allSatisfy:",
  10531. protocol: 'enumerating',
  10532. fn: function (aBlock){
  10533. var self=this;
  10534. return $core.withContext(function($ctx1) {
  10535. var $1;
  10536. var $early={};
  10537. try {
  10538. self._do_((function(each){
  10539. return $core.withContext(function($ctx2) {
  10540. $1=$recv(aBlock)._value_(each);
  10541. if(!$core.assert($1)){
  10542. throw $early=[false];
  10543. };
  10544. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10545. }));
  10546. return true;
  10547. }
  10548. catch(e) {if(e===$early)return e[0]; throw e}
  10549. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  10550. },
  10551. args: ["aBlock"],
  10552. source: "allSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for any element return false.\x0a\x09Otherwise return true.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  10553. referencedClasses: [],
  10554. messageSends: ["do:", "ifFalse:", "value:"]
  10555. }),
  10556. $globals.Collection);
  10557. $core.addMethod(
  10558. $core.method({
  10559. selector: "anyOne",
  10560. protocol: 'adding/removing',
  10561. fn: function (){
  10562. var self=this;
  10563. return $core.withContext(function($ctx1) {
  10564. var $early={};
  10565. try {
  10566. self._ifEmpty_((function(){
  10567. return $core.withContext(function($ctx2) {
  10568. return self._error_("Collection is empty");
  10569. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10570. }));
  10571. self._do_((function(each){
  10572. throw $early=[each];
  10573. }));
  10574. return self;
  10575. }
  10576. catch(e) {if(e===$early)return e[0]; throw e}
  10577. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  10578. },
  10579. args: [],
  10580. source: "anyOne\x0a\x09\x22Answer a representative sample of the receiver. This method can\x0a\x09be helpful when needing to preinfer the nature of the contents of \x0a\x09semi-homogeneous collections.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self do: [ :each | ^ each ]",
  10581. referencedClasses: [],
  10582. messageSends: ["ifEmpty:", "error:", "do:"]
  10583. }),
  10584. $globals.Collection);
  10585. $core.addMethod(
  10586. $core.method({
  10587. selector: "anySatisfy:",
  10588. protocol: 'enumerating',
  10589. fn: function (aBlock){
  10590. var self=this;
  10591. return $core.withContext(function($ctx1) {
  10592. var $1;
  10593. var $early={};
  10594. try {
  10595. self._do_((function(each){
  10596. return $core.withContext(function($ctx2) {
  10597. $1=$recv(aBlock)._value_(each);
  10598. if($core.assert($1)){
  10599. throw $early=[true];
  10600. };
  10601. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10602. }));
  10603. return false;
  10604. }
  10605. catch(e) {if(e===$early)return e[0]; throw e}
  10606. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  10607. },
  10608. args: ["aBlock"],
  10609. source: "anySatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns true for any element return true.\x0a\x09Otherwise return false.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^ true ] ].\x0a\x09^ false",
  10610. referencedClasses: [],
  10611. messageSends: ["do:", "ifTrue:", "value:"]
  10612. }),
  10613. $globals.Collection);
  10614. $core.addMethod(
  10615. $core.method({
  10616. selector: "asArray",
  10617. protocol: 'converting',
  10618. fn: function (){
  10619. var self=this;
  10620. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  10621. return $core.withContext(function($ctx1) {
  10622. var $1;
  10623. $1=$recv($Array())._withAll_(self);
  10624. return $1;
  10625. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  10626. },
  10627. args: [],
  10628. source: "asArray\x0a\x09^ Array withAll: self",
  10629. referencedClasses: ["Array"],
  10630. messageSends: ["withAll:"]
  10631. }),
  10632. $globals.Collection);
  10633. $core.addMethod(
  10634. $core.method({
  10635. selector: "asJSON",
  10636. protocol: 'converting',
  10637. fn: function (){
  10638. var self=this;
  10639. return $core.withContext(function($ctx1) {
  10640. var $1;
  10641. $1=$recv(self._asArray())._collect_((function(each){
  10642. return $core.withContext(function($ctx2) {
  10643. return $recv(each)._asJSON();
  10644. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10645. }));
  10646. return $1;
  10647. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.Collection)});
  10648. },
  10649. args: [],
  10650. source: "asJSON\x0a\x09^ self asArray collect: [ :each | each asJSON ]",
  10651. referencedClasses: [],
  10652. messageSends: ["collect:", "asArray", "asJSON"]
  10653. }),
  10654. $globals.Collection);
  10655. $core.addMethod(
  10656. $core.method({
  10657. selector: "asOrderedCollection",
  10658. protocol: 'converting',
  10659. fn: function (){
  10660. var self=this;
  10661. return $core.withContext(function($ctx1) {
  10662. var $1;
  10663. $1=self._asArray();
  10664. return $1;
  10665. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  10666. },
  10667. args: [],
  10668. source: "asOrderedCollection\x0a\x09^ self asArray",
  10669. referencedClasses: [],
  10670. messageSends: ["asArray"]
  10671. }),
  10672. $globals.Collection);
  10673. $core.addMethod(
  10674. $core.method({
  10675. selector: "asSet",
  10676. protocol: 'converting',
  10677. fn: function (){
  10678. var self=this;
  10679. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  10680. return $core.withContext(function($ctx1) {
  10681. var $1;
  10682. $1=$recv($Set())._withAll_(self);
  10683. return $1;
  10684. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  10685. },
  10686. args: [],
  10687. source: "asSet\x0a\x09^ Set withAll: self",
  10688. referencedClasses: ["Set"],
  10689. messageSends: ["withAll:"]
  10690. }),
  10691. $globals.Collection);
  10692. $core.addMethod(
  10693. $core.method({
  10694. selector: "collect:",
  10695. protocol: 'enumerating',
  10696. fn: function (aBlock){
  10697. var self=this;
  10698. var stream;
  10699. return $core.withContext(function($ctx1) {
  10700. var $1;
  10701. stream=$recv($recv(self._class())._new())._writeStream();
  10702. self._do_((function(each){
  10703. return $core.withContext(function($ctx2) {
  10704. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  10705. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10706. }));
  10707. $1=$recv(stream)._contents();
  10708. return $1;
  10709. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  10710. },
  10711. args: ["aBlock"],
  10712. source: "collect: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09stream nextPut: (aBlock value: each) ].\x0a\x09^ stream contents",
  10713. referencedClasses: [],
  10714. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  10715. }),
  10716. $globals.Collection);
  10717. $core.addMethod(
  10718. $core.method({
  10719. selector: "copyWith:",
  10720. protocol: 'copying',
  10721. fn: function (anObject){
  10722. var self=this;
  10723. return $core.withContext(function($ctx1) {
  10724. var $2,$3,$1;
  10725. $2=self._copy();
  10726. $recv($2)._add_(anObject);
  10727. $3=$recv($2)._yourself();
  10728. $1=$3;
  10729. return $1;
  10730. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  10731. },
  10732. args: ["anObject"],
  10733. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  10734. referencedClasses: [],
  10735. messageSends: ["add:", "copy", "yourself"]
  10736. }),
  10737. $globals.Collection);
  10738. $core.addMethod(
  10739. $core.method({
  10740. selector: "copyWithAll:",
  10741. protocol: 'copying',
  10742. fn: function (aCollection){
  10743. var self=this;
  10744. return $core.withContext(function($ctx1) {
  10745. var $2,$3,$1;
  10746. $2=self._copy();
  10747. $recv($2)._addAll_(aCollection);
  10748. $3=$recv($2)._yourself();
  10749. $1=$3;
  10750. return $1;
  10751. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  10752. },
  10753. args: ["aCollection"],
  10754. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  10755. referencedClasses: [],
  10756. messageSends: ["addAll:", "copy", "yourself"]
  10757. }),
  10758. $globals.Collection);
  10759. $core.addMethod(
  10760. $core.method({
  10761. selector: "copyWithoutAll:",
  10762. protocol: 'copying',
  10763. fn: function (aCollection){
  10764. var self=this;
  10765. return $core.withContext(function($ctx1) {
  10766. var $1;
  10767. $1=self._reject_((function(each){
  10768. return $core.withContext(function($ctx2) {
  10769. return $recv(aCollection)._includes_(each);
  10770. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10771. }));
  10772. return $1;
  10773. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  10774. },
  10775. args: ["aCollection"],
  10776. source: "copyWithoutAll: aCollection\x0a\x09\x22Answer a copy of the receiver that does not contain any elements\x0a\x09equal to those in aCollection.\x22\x0a\x0a\x09^ self reject: [ :each | aCollection includes: each ]",
  10777. referencedClasses: [],
  10778. messageSends: ["reject:", "includes:"]
  10779. }),
  10780. $globals.Collection);
  10781. $core.addMethod(
  10782. $core.method({
  10783. selector: "deepCopy",
  10784. protocol: 'copying',
  10785. fn: function (){
  10786. var self=this;
  10787. return $core.withContext(function($ctx1) {
  10788. var $1;
  10789. $1=self._collect_((function(each){
  10790. return $core.withContext(function($ctx2) {
  10791. return $recv(each)._deepCopy();
  10792. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10793. }));
  10794. return $1;
  10795. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  10796. },
  10797. args: [],
  10798. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  10799. referencedClasses: [],
  10800. messageSends: ["collect:", "deepCopy"]
  10801. }),
  10802. $globals.Collection);
  10803. $core.addMethod(
  10804. $core.method({
  10805. selector: "detect:",
  10806. protocol: 'enumerating',
  10807. fn: function (aBlock){
  10808. var self=this;
  10809. return $core.withContext(function($ctx1) {
  10810. var $1;
  10811. $1=self._detect_ifNone_(aBlock,(function(){
  10812. return $core.withContext(function($ctx2) {
  10813. return self._errorNotFound();
  10814. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10815. }));
  10816. return $1;
  10817. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  10818. },
  10819. args: ["aBlock"],
  10820. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  10821. referencedClasses: [],
  10822. messageSends: ["detect:ifNone:", "errorNotFound"]
  10823. }),
  10824. $globals.Collection);
  10825. $core.addMethod(
  10826. $core.method({
  10827. selector: "detect:ifNone:",
  10828. protocol: 'enumerating',
  10829. fn: function (aBlock,anotherBlock){
  10830. var self=this;
  10831. return $core.withContext(function($ctx1) {
  10832. self._subclassResponsibility();
  10833. return self;
  10834. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  10835. },
  10836. args: ["aBlock", "anotherBlock"],
  10837. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  10838. referencedClasses: [],
  10839. messageSends: ["subclassResponsibility"]
  10840. }),
  10841. $globals.Collection);
  10842. $core.addMethod(
  10843. $core.method({
  10844. selector: "do:",
  10845. protocol: 'enumerating',
  10846. fn: function (aBlock){
  10847. var self=this;
  10848. return $core.withContext(function($ctx1) {
  10849. self._subclassResponsibility();
  10850. return self;
  10851. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  10852. },
  10853. args: ["aBlock"],
  10854. source: "do: aBlock\x0a\x09self subclassResponsibility",
  10855. referencedClasses: [],
  10856. messageSends: ["subclassResponsibility"]
  10857. }),
  10858. $globals.Collection);
  10859. $core.addMethod(
  10860. $core.method({
  10861. selector: "do:separatedBy:",
  10862. protocol: 'enumerating',
  10863. fn: function (aBlock,anotherBlock){
  10864. var self=this;
  10865. var actionBeforeElement;
  10866. return $core.withContext(function($ctx1) {
  10867. actionBeforeElement=(function(){
  10868. actionBeforeElement=anotherBlock;
  10869. return actionBeforeElement;
  10870. });
  10871. self._do_((function(each){
  10872. return $core.withContext(function($ctx2) {
  10873. $recv(actionBeforeElement)._value();
  10874. return $recv(aBlock)._value_(each);
  10875. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  10876. }));
  10877. return self;
  10878. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  10879. },
  10880. args: ["aBlock", "anotherBlock"],
  10881. 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 ]",
  10882. referencedClasses: [],
  10883. messageSends: ["do:", "value", "value:"]
  10884. }),
  10885. $globals.Collection);
  10886. $core.addMethod(
  10887. $core.method({
  10888. selector: "errorNotFound",
  10889. protocol: 'error handling',
  10890. fn: function (){
  10891. var self=this;
  10892. return $core.withContext(function($ctx1) {
  10893. self._error_("Object is not in the collection");
  10894. return self;
  10895. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  10896. },
  10897. args: [],
  10898. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  10899. referencedClasses: [],
  10900. messageSends: ["error:"]
  10901. }),
  10902. $globals.Collection);
  10903. $core.addMethod(
  10904. $core.method({
  10905. selector: "ifEmpty:",
  10906. protocol: 'testing',
  10907. fn: function (aBlock){
  10908. var self=this;
  10909. return $core.withContext(function($ctx1) {
  10910. var $2,$1;
  10911. $2=self._isEmpty();
  10912. $1=$recv($2)._ifTrue_ifFalse_(aBlock,(function(){
  10913. return self;
  10914. }));
  10915. return $1;
  10916. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  10917. },
  10918. args: ["aBlock"],
  10919. 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 ]",
  10920. referencedClasses: [],
  10921. messageSends: ["ifTrue:ifFalse:", "isEmpty"]
  10922. }),
  10923. $globals.Collection);
  10924. $core.addMethod(
  10925. $core.method({
  10926. selector: "ifEmpty:ifNotEmpty:",
  10927. protocol: 'testing',
  10928. fn: function (aBlock,anotherBlock){
  10929. var self=this;
  10930. return $core.withContext(function($ctx1) {
  10931. var $2,$1;
  10932. $2=self._isEmpty();
  10933. $1=$recv($2)._ifTrue_ifFalse_(aBlock,(function(){
  10934. return $core.withContext(function($ctx2) {
  10935. return $recv(anotherBlock)._value_(self);
  10936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10937. }));
  10938. return $1;
  10939. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  10940. },
  10941. args: ["aBlock", "anotherBlock"],
  10942. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  10943. referencedClasses: [],
  10944. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value:"]
  10945. }),
  10946. $globals.Collection);
  10947. $core.addMethod(
  10948. $core.method({
  10949. selector: "ifNotEmpty:",
  10950. protocol: 'testing',
  10951. fn: function (aBlock){
  10952. var self=this;
  10953. return $core.withContext(function($ctx1) {
  10954. var $2,$1;
  10955. $2=self._notEmpty();
  10956. if($core.assert($2)){
  10957. $1=$recv(aBlock)._value_(self);
  10958. } else {
  10959. $1=self;
  10960. };
  10961. return $1;
  10962. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  10963. },
  10964. args: ["aBlock"],
  10965. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  10966. referencedClasses: [],
  10967. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  10968. }),
  10969. $globals.Collection);
  10970. $core.addMethod(
  10971. $core.method({
  10972. selector: "ifNotEmpty:ifEmpty:",
  10973. protocol: 'testing',
  10974. fn: function (aBlock,anotherBlock){
  10975. var self=this;
  10976. return $core.withContext(function($ctx1) {
  10977. var $2,$1;
  10978. $2=self._notEmpty();
  10979. $1=$recv($2)._ifTrue_ifFalse_((function(){
  10980. return $core.withContext(function($ctx2) {
  10981. return $recv(aBlock)._value_(self);
  10982. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10983. }),anotherBlock);
  10984. return $1;
  10985. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  10986. },
  10987. args: ["aBlock", "anotherBlock"],
  10988. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: anotherBlock",
  10989. referencedClasses: [],
  10990. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  10991. }),
  10992. $globals.Collection);
  10993. $core.addMethod(
  10994. $core.method({
  10995. selector: "includes:",
  10996. protocol: 'testing',
  10997. fn: function (anObject){
  10998. var self=this;
  10999. return $core.withContext(function($ctx1) {
  11000. var $1;
  11001. $1=self._anySatisfy_((function(each){
  11002. return $core.withContext(function($ctx2) {
  11003. return $recv(each).__eq(anObject);
  11004. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11005. }));
  11006. return $1;
  11007. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  11008. },
  11009. args: ["anObject"],
  11010. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  11011. referencedClasses: [],
  11012. messageSends: ["anySatisfy:", "="]
  11013. }),
  11014. $globals.Collection);
  11015. $core.addMethod(
  11016. $core.method({
  11017. selector: "inject:into:",
  11018. protocol: 'enumerating',
  11019. fn: function (anObject,aBlock){
  11020. var self=this;
  11021. var result;
  11022. return $core.withContext(function($ctx1) {
  11023. var $1;
  11024. result=anObject;
  11025. self._do_((function(each){
  11026. return $core.withContext(function($ctx2) {
  11027. result=$recv(aBlock)._value_value_(result,each);
  11028. return result;
  11029. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11030. }));
  11031. $1=result;
  11032. return $1;
  11033. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  11034. },
  11035. args: ["anObject", "aBlock"],
  11036. 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",
  11037. referencedClasses: [],
  11038. messageSends: ["do:", "value:value:"]
  11039. }),
  11040. $globals.Collection);
  11041. $core.addMethod(
  11042. $core.method({
  11043. selector: "intersection:",
  11044. protocol: 'enumerating',
  11045. fn: function (aCollection){
  11046. var self=this;
  11047. var set,outputSet;
  11048. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  11049. return $core.withContext(function($ctx1) {
  11050. var $2,$1,$3;
  11051. set=self._asSet();
  11052. outputSet=$recv($Set())._new();
  11053. $recv(aCollection)._do_((function(each){
  11054. return $core.withContext(function($ctx2) {
  11055. $2=$recv(set)._includes_(each);
  11056. $ctx2.sendIdx["includes:"]=1;
  11057. $1=$recv($2)._and_((function(){
  11058. return $core.withContext(function($ctx3) {
  11059. return $recv($recv(outputSet)._includes_(each))._not();
  11060. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  11061. }));
  11062. if($core.assert($1)){
  11063. return $recv(outputSet)._add_(each);
  11064. };
  11065. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11066. }));
  11067. $3=$recv(self._class())._withAll_($recv(outputSet)._asArray());
  11068. return $3;
  11069. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  11070. },
  11071. args: ["aCollection"],
  11072. 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",
  11073. referencedClasses: ["Set"],
  11074. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  11075. }),
  11076. $globals.Collection);
  11077. $core.addMethod(
  11078. $core.method({
  11079. selector: "isEmpty",
  11080. protocol: 'testing',
  11081. fn: function (){
  11082. var self=this;
  11083. return $core.withContext(function($ctx1) {
  11084. var $1;
  11085. $1=$recv(self._size()).__eq((0));
  11086. return $1;
  11087. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  11088. },
  11089. args: [],
  11090. source: "isEmpty\x0a\x09^ self size = 0",
  11091. referencedClasses: [],
  11092. messageSends: ["=", "size"]
  11093. }),
  11094. $globals.Collection);
  11095. $core.addMethod(
  11096. $core.method({
  11097. selector: "noneSatisfy:",
  11098. protocol: 'enumerating',
  11099. fn: function (aBlock){
  11100. var self=this;
  11101. return $core.withContext(function($ctx1) {
  11102. var $1;
  11103. var $early={};
  11104. try {
  11105. self._do_((function(item){
  11106. return $core.withContext(function($ctx2) {
  11107. $1=$recv(aBlock)._value_(item);
  11108. if($core.assert($1)){
  11109. throw $early=[false];
  11110. };
  11111. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  11112. }));
  11113. return true;
  11114. }
  11115. catch(e) {if(e===$early)return e[0]; throw e}
  11116. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  11117. },
  11118. args: ["aBlock"],
  11119. 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",
  11120. referencedClasses: [],
  11121. messageSends: ["do:", "ifTrue:", "value:"]
  11122. }),
  11123. $globals.Collection);
  11124. $core.addMethod(
  11125. $core.method({
  11126. selector: "notEmpty",
  11127. protocol: 'testing',
  11128. fn: function (){
  11129. var self=this;
  11130. return $core.withContext(function($ctx1) {
  11131. var $1;
  11132. $1=$recv(self._isEmpty())._not();
  11133. return $1;
  11134. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  11135. },
  11136. args: [],
  11137. source: "notEmpty\x0a\x09^ self isEmpty not",
  11138. referencedClasses: [],
  11139. messageSends: ["not", "isEmpty"]
  11140. }),
  11141. $globals.Collection);
  11142. $core.addMethod(
  11143. $core.method({
  11144. selector: "occurrencesOf:",
  11145. protocol: 'accessing',
  11146. fn: function (anObject){
  11147. var self=this;
  11148. var tally;
  11149. return $core.withContext(function($ctx1) {
  11150. var $1,$2;
  11151. tally=(0);
  11152. self._do_((function(each){
  11153. return $core.withContext(function($ctx2) {
  11154. $1=$recv(anObject).__eq(each);
  11155. if($core.assert($1)){
  11156. tally=$recv(tally).__plus((1));
  11157. return tally;
  11158. };
  11159. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11160. }));
  11161. $2=tally;
  11162. return $2;
  11163. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  11164. },
  11165. args: ["anObject"],
  11166. 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",
  11167. referencedClasses: [],
  11168. messageSends: ["do:", "ifTrue:", "=", "+"]
  11169. }),
  11170. $globals.Collection);
  11171. $core.addMethod(
  11172. $core.method({
  11173. selector: "putOn:",
  11174. protocol: 'streaming',
  11175. fn: function (aStream){
  11176. var self=this;
  11177. return $core.withContext(function($ctx1) {
  11178. self._do_((function(each){
  11179. return $core.withContext(function($ctx2) {
  11180. return $recv(each)._putOn_(aStream);
  11181. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11182. }));
  11183. return self;
  11184. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  11185. },
  11186. args: ["aStream"],
  11187. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  11188. referencedClasses: [],
  11189. messageSends: ["do:", "putOn:"]
  11190. }),
  11191. $globals.Collection);
  11192. $core.addMethod(
  11193. $core.method({
  11194. selector: "reject:",
  11195. protocol: 'enumerating',
  11196. fn: function (aBlock){
  11197. var self=this;
  11198. return $core.withContext(function($ctx1) {
  11199. var $1;
  11200. $1=self._select_((function(each){
  11201. return $core.withContext(function($ctx2) {
  11202. return $recv($recv(aBlock)._value_(each)).__eq(false);
  11203. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11204. }));
  11205. return $1;
  11206. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  11207. },
  11208. args: ["aBlock"],
  11209. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  11210. referencedClasses: [],
  11211. messageSends: ["select:", "=", "value:"]
  11212. }),
  11213. $globals.Collection);
  11214. $core.addMethod(
  11215. $core.method({
  11216. selector: "remove:",
  11217. protocol: 'adding/removing',
  11218. fn: function (anObject){
  11219. var self=this;
  11220. return $core.withContext(function($ctx1) {
  11221. var $1;
  11222. $1=self._remove_ifAbsent_(anObject,(function(){
  11223. return $core.withContext(function($ctx2) {
  11224. return self._errorNotFound();
  11225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11226. }));
  11227. return $1;
  11228. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  11229. },
  11230. args: ["anObject"],
  11231. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  11232. referencedClasses: [],
  11233. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  11234. }),
  11235. $globals.Collection);
  11236. $core.addMethod(
  11237. $core.method({
  11238. selector: "remove:ifAbsent:",
  11239. protocol: 'adding/removing',
  11240. fn: function (anObject,aBlock){
  11241. var self=this;
  11242. return $core.withContext(function($ctx1) {
  11243. self._subclassResponsibility();
  11244. return self;
  11245. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  11246. },
  11247. args: ["anObject", "aBlock"],
  11248. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  11249. referencedClasses: [],
  11250. messageSends: ["subclassResponsibility"]
  11251. }),
  11252. $globals.Collection);
  11253. $core.addMethod(
  11254. $core.method({
  11255. selector: "removeAll",
  11256. protocol: 'adding/removing',
  11257. fn: function (){
  11258. var self=this;
  11259. return $core.withContext(function($ctx1) {
  11260. self._subclassResponsibility();
  11261. return self;
  11262. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  11263. },
  11264. args: [],
  11265. source: "removeAll\x0a\x09self subclassResponsibility",
  11266. referencedClasses: [],
  11267. messageSends: ["subclassResponsibility"]
  11268. }),
  11269. $globals.Collection);
  11270. $core.addMethod(
  11271. $core.method({
  11272. selector: "select:",
  11273. protocol: 'enumerating',
  11274. fn: function (aBlock){
  11275. var self=this;
  11276. var stream;
  11277. return $core.withContext(function($ctx1) {
  11278. var $1,$2;
  11279. stream=$recv($recv(self._class())._new())._writeStream();
  11280. self._do_((function(each){
  11281. return $core.withContext(function($ctx2) {
  11282. $1=$recv(aBlock)._value_(each);
  11283. if($core.assert($1)){
  11284. return $recv(stream)._nextPut_(each);
  11285. };
  11286. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11287. }));
  11288. $2=$recv(stream)._contents();
  11289. return $2;
  11290. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  11291. },
  11292. args: ["aBlock"],
  11293. 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",
  11294. referencedClasses: [],
  11295. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  11296. }),
  11297. $globals.Collection);
  11298. $core.addMethod(
  11299. $core.method({
  11300. selector: "select:thenCollect:",
  11301. protocol: 'enumerating',
  11302. fn: function (selectBlock,collectBlock){
  11303. var self=this;
  11304. var stream;
  11305. return $core.withContext(function($ctx1) {
  11306. var $1,$2;
  11307. stream=$recv($recv(self._class())._new())._writeStream();
  11308. self._do_((function(each){
  11309. return $core.withContext(function($ctx2) {
  11310. $1=$recv(selectBlock)._value_(each);
  11311. $ctx2.sendIdx["value:"]=1;
  11312. if($core.assert($1)){
  11313. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  11314. };
  11315. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11316. }));
  11317. $2=$recv(stream)._contents();
  11318. return $2;
  11319. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  11320. },
  11321. args: ["selectBlock", "collectBlock"],
  11322. 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",
  11323. referencedClasses: [],
  11324. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  11325. }),
  11326. $globals.Collection);
  11327. $core.addMethod(
  11328. $core.method({
  11329. selector: "shallowCopy",
  11330. protocol: 'copying',
  11331. fn: function (){
  11332. var self=this;
  11333. return $core.withContext(function($ctx1) {
  11334. var $1;
  11335. $1=self._collect_((function(each){
  11336. return each;
  11337. }));
  11338. return $1;
  11339. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  11340. },
  11341. args: [],
  11342. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  11343. referencedClasses: [],
  11344. messageSends: ["collect:"]
  11345. }),
  11346. $globals.Collection);
  11347. $core.addMethod(
  11348. $core.method({
  11349. selector: "size",
  11350. protocol: 'accessing',
  11351. fn: function (){
  11352. var self=this;
  11353. return $core.withContext(function($ctx1) {
  11354. self._subclassResponsibility();
  11355. return self;
  11356. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  11357. },
  11358. args: [],
  11359. source: "size\x0a\x09self subclassResponsibility",
  11360. referencedClasses: [],
  11361. messageSends: ["subclassResponsibility"]
  11362. }),
  11363. $globals.Collection);
  11364. $core.addMethod(
  11365. $core.method({
  11366. selector: "classTag",
  11367. protocol: 'accessing',
  11368. fn: function (){
  11369. var self=this;
  11370. return "collection";
  11371. },
  11372. args: [],
  11373. 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'",
  11374. referencedClasses: [],
  11375. messageSends: []
  11376. }),
  11377. $globals.Collection.klass);
  11378. $core.addMethod(
  11379. $core.method({
  11380. selector: "new:",
  11381. protocol: 'instance creation',
  11382. fn: function (anInteger){
  11383. var self=this;
  11384. return $core.withContext(function($ctx1) {
  11385. var $1;
  11386. $1=self._new();
  11387. return $1;
  11388. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.klass)});
  11389. },
  11390. args: ["anInteger"],
  11391. source: "new: anInteger\x0a\x09^ self new",
  11392. referencedClasses: [],
  11393. messageSends: ["new"]
  11394. }),
  11395. $globals.Collection.klass);
  11396. $core.addMethod(
  11397. $core.method({
  11398. selector: "with:",
  11399. protocol: 'instance creation',
  11400. fn: function (anObject){
  11401. var self=this;
  11402. return $core.withContext(function($ctx1) {
  11403. var $2,$3,$1;
  11404. $2=self._new();
  11405. $recv($2)._add_(anObject);
  11406. $3=$recv($2)._yourself();
  11407. $1=$3;
  11408. return $1;
  11409. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.klass)});
  11410. },
  11411. args: ["anObject"],
  11412. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  11413. referencedClasses: [],
  11414. messageSends: ["add:", "new", "yourself"]
  11415. }),
  11416. $globals.Collection.klass);
  11417. $core.addMethod(
  11418. $core.method({
  11419. selector: "with:with:",
  11420. protocol: 'instance creation',
  11421. fn: function (anObject,anotherObject){
  11422. var self=this;
  11423. return $core.withContext(function($ctx1) {
  11424. var $2,$3,$1;
  11425. $2=self._new();
  11426. $recv($2)._add_(anObject);
  11427. $ctx1.sendIdx["add:"]=1;
  11428. $recv($2)._add_(anotherObject);
  11429. $3=$recv($2)._yourself();
  11430. $1=$3;
  11431. return $1;
  11432. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.klass)});
  11433. },
  11434. args: ["anObject", "anotherObject"],
  11435. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  11436. referencedClasses: [],
  11437. messageSends: ["add:", "new", "yourself"]
  11438. }),
  11439. $globals.Collection.klass);
  11440. $core.addMethod(
  11441. $core.method({
  11442. selector: "with:with:with:",
  11443. protocol: 'instance creation',
  11444. fn: function (firstObject,secondObject,thirdObject){
  11445. var self=this;
  11446. return $core.withContext(function($ctx1) {
  11447. var $2,$3,$1;
  11448. $2=self._new();
  11449. $recv($2)._add_(firstObject);
  11450. $ctx1.sendIdx["add:"]=1;
  11451. $recv($2)._add_(secondObject);
  11452. $ctx1.sendIdx["add:"]=2;
  11453. $recv($2)._add_(thirdObject);
  11454. $3=$recv($2)._yourself();
  11455. $1=$3;
  11456. return $1;
  11457. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.klass)});
  11458. },
  11459. args: ["firstObject", "secondObject", "thirdObject"],
  11460. 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",
  11461. referencedClasses: [],
  11462. messageSends: ["add:", "new", "yourself"]
  11463. }),
  11464. $globals.Collection.klass);
  11465. $core.addMethod(
  11466. $core.method({
  11467. selector: "withAll:",
  11468. protocol: 'instance creation',
  11469. fn: function (aCollection){
  11470. var self=this;
  11471. return $core.withContext(function($ctx1) {
  11472. var $2,$3,$1;
  11473. $2=self._new();
  11474. $recv($2)._addAll_(aCollection);
  11475. $3=$recv($2)._yourself();
  11476. $1=$3;
  11477. return $1;
  11478. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.klass)});
  11479. },
  11480. args: ["aCollection"],
  11481. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  11482. referencedClasses: [],
  11483. messageSends: ["addAll:", "new", "yourself"]
  11484. }),
  11485. $globals.Collection.klass);
  11486. $core.addClass('IndexableCollection', $globals.Collection, [], 'Kernel-Collections');
  11487. $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.";
  11488. $core.addMethod(
  11489. $core.method({
  11490. selector: "at:",
  11491. protocol: 'accessing',
  11492. fn: function (anIndex){
  11493. var self=this;
  11494. return $core.withContext(function($ctx1) {
  11495. var $1;
  11496. $1=self._at_ifAbsent_(anIndex,(function(){
  11497. return $core.withContext(function($ctx2) {
  11498. return self._errorNotFound();
  11499. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11500. }));
  11501. return $1;
  11502. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  11503. },
  11504. args: ["anIndex"],
  11505. 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 ]",
  11506. referencedClasses: [],
  11507. messageSends: ["at:ifAbsent:", "errorNotFound"]
  11508. }),
  11509. $globals.IndexableCollection);
  11510. $core.addMethod(
  11511. $core.method({
  11512. selector: "at:ifAbsent:",
  11513. protocol: 'accessing',
  11514. fn: function (anIndex,aBlock){
  11515. var self=this;
  11516. return $core.withContext(function($ctx1) {
  11517. self._subclassResponsibility();
  11518. return self;
  11519. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  11520. },
  11521. args: ["anIndex", "aBlock"],
  11522. 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",
  11523. referencedClasses: [],
  11524. messageSends: ["subclassResponsibility"]
  11525. }),
  11526. $globals.IndexableCollection);
  11527. $core.addMethod(
  11528. $core.method({
  11529. selector: "at:ifAbsentPut:",
  11530. protocol: 'accessing',
  11531. fn: function (aKey,aBlock){
  11532. var self=this;
  11533. return $core.withContext(function($ctx1) {
  11534. var $1;
  11535. $1=self._at_ifAbsent_(aKey,(function(){
  11536. return $core.withContext(function($ctx2) {
  11537. return self._at_put_(aKey,$recv(aBlock)._value());
  11538. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11539. }));
  11540. return $1;
  11541. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  11542. },
  11543. args: ["aKey", "aBlock"],
  11544. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  11545. referencedClasses: [],
  11546. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  11547. }),
  11548. $globals.IndexableCollection);
  11549. $core.addMethod(
  11550. $core.method({
  11551. selector: "at:ifPresent:",
  11552. protocol: 'accessing',
  11553. fn: function (anIndex,aBlock){
  11554. var self=this;
  11555. return $core.withContext(function($ctx1) {
  11556. var $1;
  11557. $1=self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  11558. return nil;
  11559. }));
  11560. return $1;
  11561. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  11562. },
  11563. args: ["anIndex", "aBlock"],
  11564. 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 ]",
  11565. referencedClasses: [],
  11566. messageSends: ["at:ifPresent:ifAbsent:"]
  11567. }),
  11568. $globals.IndexableCollection);
  11569. $core.addMethod(
  11570. $core.method({
  11571. selector: "at:ifPresent:ifAbsent:",
  11572. protocol: 'accessing',
  11573. fn: function (anIndex,aBlock,anotherBlock){
  11574. var self=this;
  11575. return $core.withContext(function($ctx1) {
  11576. self._subclassResponsibility();
  11577. return self;
  11578. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  11579. },
  11580. args: ["anIndex", "aBlock", "anotherBlock"],
  11581. 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",
  11582. referencedClasses: [],
  11583. messageSends: ["subclassResponsibility"]
  11584. }),
  11585. $globals.IndexableCollection);
  11586. $core.addMethod(
  11587. $core.method({
  11588. selector: "at:put:",
  11589. protocol: 'accessing',
  11590. fn: function (anIndex,anObject){
  11591. var self=this;
  11592. return $core.withContext(function($ctx1) {
  11593. self._subclassResponsibility();
  11594. return self;
  11595. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  11596. },
  11597. args: ["anIndex", "anObject"],
  11598. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  11599. referencedClasses: [],
  11600. messageSends: ["subclassResponsibility"]
  11601. }),
  11602. $globals.IndexableCollection);
  11603. $core.addMethod(
  11604. $core.method({
  11605. selector: "indexOf:",
  11606. protocol: 'accessing',
  11607. fn: function (anObject){
  11608. var self=this;
  11609. return $core.withContext(function($ctx1) {
  11610. var $1;
  11611. $1=self._indexOf_ifAbsent_(anObject,(function(){
  11612. return $core.withContext(function($ctx2) {
  11613. return self._errorNotFound();
  11614. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11615. }));
  11616. return $1;
  11617. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  11618. },
  11619. args: ["anObject"],
  11620. 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 ]",
  11621. referencedClasses: [],
  11622. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  11623. }),
  11624. $globals.IndexableCollection);
  11625. $core.addMethod(
  11626. $core.method({
  11627. selector: "indexOf:ifAbsent:",
  11628. protocol: 'accessing',
  11629. fn: function (anObject,aBlock){
  11630. var self=this;
  11631. return $core.withContext(function($ctx1) {
  11632. self._subclassResponsibility();
  11633. return self;
  11634. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  11635. },
  11636. args: ["anObject", "aBlock"],
  11637. 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",
  11638. referencedClasses: [],
  11639. messageSends: ["subclassResponsibility"]
  11640. }),
  11641. $globals.IndexableCollection);
  11642. $core.addMethod(
  11643. $core.method({
  11644. selector: "with:do:",
  11645. protocol: 'enumerating',
  11646. fn: function (anotherCollection,aBlock){
  11647. var self=this;
  11648. return $core.withContext(function($ctx1) {
  11649. self._withIndexDo_((function(each,index){
  11650. return $core.withContext(function($ctx2) {
  11651. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  11652. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  11653. }));
  11654. return self;
  11655. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  11656. },
  11657. args: ["anotherCollection", "aBlock"],
  11658. 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) ]",
  11659. referencedClasses: [],
  11660. messageSends: ["withIndexDo:", "value:value:", "at:"]
  11661. }),
  11662. $globals.IndexableCollection);
  11663. $core.addMethod(
  11664. $core.method({
  11665. selector: "withIndexDo:",
  11666. protocol: 'enumerating',
  11667. fn: function (aBlock){
  11668. var self=this;
  11669. return $core.withContext(function($ctx1) {
  11670. self._subclassResponsibility();
  11671. return self;
  11672. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  11673. },
  11674. args: ["aBlock"],
  11675. 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",
  11676. referencedClasses: [],
  11677. messageSends: ["subclassResponsibility"]
  11678. }),
  11679. $globals.IndexableCollection);
  11680. $core.addClass('AssociativeCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  11681. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  11682. $core.addMethod(
  11683. $core.method({
  11684. selector: "=",
  11685. protocol: 'comparing',
  11686. fn: function (anAssocitativeCollection){
  11687. var self=this;
  11688. return $core.withContext(function($ctx1) {
  11689. var $2,$1,$4,$3,$6,$5;
  11690. $2=self._class();
  11691. $ctx1.sendIdx["class"]=1;
  11692. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  11693. $ctx1.sendIdx["="]=1;
  11694. if(!$core.assert($1)){
  11695. return false;
  11696. };
  11697. $4=self._size();
  11698. $ctx1.sendIdx["size"]=1;
  11699. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  11700. $ctx1.sendIdx["="]=2;
  11701. if(!$core.assert($3)){
  11702. return false;
  11703. };
  11704. $6=self._associations();
  11705. $ctx1.sendIdx["associations"]=1;
  11706. $5=$recv($6).__eq($recv(anAssocitativeCollection)._associations());
  11707. return $5;
  11708. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  11709. },
  11710. args: ["anAssocitativeCollection"],
  11711. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  11712. referencedClasses: [],
  11713. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  11714. }),
  11715. $globals.AssociativeCollection);
  11716. $core.addMethod(
  11717. $core.method({
  11718. selector: "add:",
  11719. protocol: 'adding/removing',
  11720. fn: function (anAssociation){
  11721. var self=this;
  11722. return $core.withContext(function($ctx1) {
  11723. self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  11724. return self;
  11725. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  11726. },
  11727. args: ["anAssociation"],
  11728. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  11729. referencedClasses: [],
  11730. messageSends: ["at:put:", "key", "value"]
  11731. }),
  11732. $globals.AssociativeCollection);
  11733. $core.addMethod(
  11734. $core.method({
  11735. selector: "addAll:",
  11736. protocol: 'adding/removing',
  11737. fn: function (anAssociativeCollection){
  11738. var self=this;
  11739. return $core.withContext(function($ctx1) {
  11740. (
  11741. $ctx1.supercall = true,
  11742. $globals.AssociativeCollection.superclass.fn.prototype._addAll_.apply($recv(self), [$recv(anAssociativeCollection)._associations()]));
  11743. $ctx1.supercall = false;
  11744. return anAssociativeCollection;
  11745. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  11746. },
  11747. args: ["anAssociativeCollection"],
  11748. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  11749. referencedClasses: [],
  11750. messageSends: ["addAll:", "associations"]
  11751. }),
  11752. $globals.AssociativeCollection);
  11753. $core.addMethod(
  11754. $core.method({
  11755. selector: "asDictionary",
  11756. protocol: 'converting',
  11757. fn: function (){
  11758. var self=this;
  11759. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  11760. return $core.withContext(function($ctx1) {
  11761. var $1;
  11762. $1=$recv($Dictionary())._from_(self._associations());
  11763. return $1;
  11764. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  11765. },
  11766. args: [],
  11767. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  11768. referencedClasses: ["Dictionary"],
  11769. messageSends: ["from:", "associations"]
  11770. }),
  11771. $globals.AssociativeCollection);
  11772. $core.addMethod(
  11773. $core.method({
  11774. selector: "asHashedCollection",
  11775. protocol: 'converting',
  11776. fn: function (){
  11777. var self=this;
  11778. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  11779. return $core.withContext(function($ctx1) {
  11780. var $1;
  11781. $1=$recv($HashedCollection())._from_(self._associations());
  11782. return $1;
  11783. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  11784. },
  11785. args: [],
  11786. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  11787. referencedClasses: ["HashedCollection"],
  11788. messageSends: ["from:", "associations"]
  11789. }),
  11790. $globals.AssociativeCollection);
  11791. $core.addMethod(
  11792. $core.method({
  11793. selector: "asJSON",
  11794. protocol: 'converting',
  11795. fn: function (){
  11796. var self=this;
  11797. var hash;
  11798. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  11799. return $core.withContext(function($ctx1) {
  11800. var $1;
  11801. hash=$recv($HashedCollection())._new();
  11802. self._keysAndValuesDo_((function(key,value){
  11803. return $core.withContext(function($ctx2) {
  11804. return $recv(hash)._at_put_(key,$recv(value)._asJSON());
  11805. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11806. }));
  11807. $1=hash;
  11808. return $1;
  11809. }, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},$globals.AssociativeCollection)});
  11810. },
  11811. args: [],
  11812. 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",
  11813. referencedClasses: ["HashedCollection"],
  11814. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"]
  11815. }),
  11816. $globals.AssociativeCollection);
  11817. $core.addMethod(
  11818. $core.method({
  11819. selector: "associations",
  11820. protocol: 'accessing',
  11821. fn: function (){
  11822. var self=this;
  11823. var associations;
  11824. return $core.withContext(function($ctx1) {
  11825. var $1;
  11826. associations=[];
  11827. self._associationsDo_((function(each){
  11828. return $core.withContext(function($ctx2) {
  11829. return $recv(associations)._add_(each);
  11830. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11831. }));
  11832. $1=associations;
  11833. return $1;
  11834. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  11835. },
  11836. args: [],
  11837. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  11838. referencedClasses: [],
  11839. messageSends: ["associationsDo:", "add:"]
  11840. }),
  11841. $globals.AssociativeCollection);
  11842. $core.addMethod(
  11843. $core.method({
  11844. selector: "associationsDo:",
  11845. protocol: 'enumerating',
  11846. fn: function (aBlock){
  11847. var self=this;
  11848. function $Association(){return $globals.Association||(typeof Association=="undefined"?nil:Association)}
  11849. return $core.withContext(function($ctx1) {
  11850. self._keysAndValuesDo_((function(key,value){
  11851. return $core.withContext(function($ctx2) {
  11852. return $recv(aBlock)._value_($recv($Association())._key_value_(key,value));
  11853. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11854. }));
  11855. return self;
  11856. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  11857. },
  11858. args: ["aBlock"],
  11859. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  11860. referencedClasses: ["Association"],
  11861. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  11862. }),
  11863. $globals.AssociativeCollection);
  11864. $core.addMethod(
  11865. $core.method({
  11866. selector: "at:ifPresent:ifAbsent:",
  11867. protocol: 'accessing',
  11868. fn: function (aKey,aBlock,anotherBlock){
  11869. var self=this;
  11870. return $core.withContext(function($ctx1) {
  11871. var $2,$1;
  11872. $2=self._includesKey_(aKey);
  11873. if($core.assert($2)){
  11874. $1=$recv(aBlock)._value_(self._at_(aKey));
  11875. } else {
  11876. $1=$recv(anotherBlock)._value();
  11877. };
  11878. return $1;
  11879. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  11880. },
  11881. args: ["aKey", "aBlock", "anotherBlock"],
  11882. 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 ]",
  11883. referencedClasses: [],
  11884. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  11885. }),
  11886. $globals.AssociativeCollection);
  11887. $core.addMethod(
  11888. $core.method({
  11889. selector: "collect:",
  11890. protocol: 'enumerating',
  11891. fn: function (aBlock){
  11892. var self=this;
  11893. var newDict;
  11894. return $core.withContext(function($ctx1) {
  11895. var $1;
  11896. newDict=$recv(self._class())._new();
  11897. self._keysAndValuesDo_((function(key,value){
  11898. return $core.withContext(function($ctx2) {
  11899. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  11900. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11901. }));
  11902. $1=newDict;
  11903. return $1;
  11904. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  11905. },
  11906. args: ["aBlock"],
  11907. 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",
  11908. referencedClasses: [],
  11909. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  11910. }),
  11911. $globals.AssociativeCollection);
  11912. $core.addMethod(
  11913. $core.method({
  11914. selector: "deepCopy",
  11915. protocol: 'copying',
  11916. fn: function (){
  11917. var self=this;
  11918. var copy;
  11919. return $core.withContext(function($ctx1) {
  11920. var $1;
  11921. copy=$recv(self._class())._new();
  11922. self._keysAndValuesDo_((function(key,value){
  11923. return $core.withContext(function($ctx2) {
  11924. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  11925. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11926. }));
  11927. $1=copy;
  11928. return $1;
  11929. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  11930. },
  11931. args: [],
  11932. 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",
  11933. referencedClasses: [],
  11934. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  11935. }),
  11936. $globals.AssociativeCollection);
  11937. $core.addMethod(
  11938. $core.method({
  11939. selector: "detect:ifNone:",
  11940. protocol: 'enumerating',
  11941. fn: function (aBlock,anotherBlock){
  11942. var self=this;
  11943. return $core.withContext(function($ctx1) {
  11944. var $1;
  11945. $1=$recv(self._values())._detect_ifNone_(aBlock,anotherBlock);
  11946. return $1;
  11947. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  11948. },
  11949. args: ["aBlock", "anotherBlock"],
  11950. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  11951. referencedClasses: [],
  11952. messageSends: ["detect:ifNone:", "values"]
  11953. }),
  11954. $globals.AssociativeCollection);
  11955. $core.addMethod(
  11956. $core.method({
  11957. selector: "do:",
  11958. protocol: 'enumerating',
  11959. fn: function (aBlock){
  11960. var self=this;
  11961. return $core.withContext(function($ctx1) {
  11962. self._valuesDo_(aBlock);
  11963. return self;
  11964. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  11965. },
  11966. args: ["aBlock"],
  11967. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  11968. referencedClasses: [],
  11969. messageSends: ["valuesDo:"]
  11970. }),
  11971. $globals.AssociativeCollection);
  11972. $core.addMethod(
  11973. $core.method({
  11974. selector: "includes:",
  11975. protocol: 'enumerating',
  11976. fn: function (anObject){
  11977. var self=this;
  11978. return $core.withContext(function($ctx1) {
  11979. var $1;
  11980. $1=$recv(self._values())._includes_(anObject);
  11981. return $1;
  11982. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  11983. },
  11984. args: ["anObject"],
  11985. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  11986. referencedClasses: [],
  11987. messageSends: ["includes:", "values"]
  11988. }),
  11989. $globals.AssociativeCollection);
  11990. $core.addMethod(
  11991. $core.method({
  11992. selector: "includesKey:",
  11993. protocol: 'testing',
  11994. fn: function (aKey){
  11995. var self=this;
  11996. return $core.withContext(function($ctx1) {
  11997. self._subclassResponsibility();
  11998. return self;
  11999. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  12000. },
  12001. args: ["aKey"],
  12002. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  12003. referencedClasses: [],
  12004. messageSends: ["subclassResponsibility"]
  12005. }),
  12006. $globals.AssociativeCollection);
  12007. $core.addMethod(
  12008. $core.method({
  12009. selector: "indexOf:ifAbsent:",
  12010. protocol: 'accessing',
  12011. fn: function (anObject,aBlock){
  12012. var self=this;
  12013. return $core.withContext(function($ctx1) {
  12014. var $1;
  12015. $1=$recv(self._keys())._detect_ifNone_((function(each){
  12016. return $core.withContext(function($ctx2) {
  12017. return $recv(self._at_(each)).__eq(anObject);
  12018. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12019. }),aBlock);
  12020. return $1;
  12021. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  12022. },
  12023. args: ["anObject", "aBlock"],
  12024. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  12025. referencedClasses: [],
  12026. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  12027. }),
  12028. $globals.AssociativeCollection);
  12029. $core.addMethod(
  12030. $core.method({
  12031. selector: "keyAtValue:",
  12032. protocol: 'accessing',
  12033. fn: function (anObject){
  12034. var self=this;
  12035. return $core.withContext(function($ctx1) {
  12036. var $1;
  12037. $1=self._keyAtValue_ifAbsent_(anObject,(function(){
  12038. return $core.withContext(function($ctx2) {
  12039. return self._errorNotFound();
  12040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12041. }));
  12042. return $1;
  12043. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  12044. },
  12045. args: ["anObject"],
  12046. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  12047. referencedClasses: [],
  12048. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  12049. }),
  12050. $globals.AssociativeCollection);
  12051. $core.addMethod(
  12052. $core.method({
  12053. selector: "keyAtValue:ifAbsent:",
  12054. protocol: 'accessing',
  12055. fn: function (anObject,aBlock){
  12056. var self=this;
  12057. return $core.withContext(function($ctx1) {
  12058. var $1;
  12059. $1=self._indexOf_ifAbsent_(anObject,aBlock);
  12060. return $1;
  12061. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  12062. },
  12063. args: ["anObject", "aBlock"],
  12064. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  12065. referencedClasses: [],
  12066. messageSends: ["indexOf:ifAbsent:"]
  12067. }),
  12068. $globals.AssociativeCollection);
  12069. $core.addMethod(
  12070. $core.method({
  12071. selector: "keys",
  12072. protocol: 'accessing',
  12073. fn: function (){
  12074. var self=this;
  12075. return $core.withContext(function($ctx1) {
  12076. self._subclassResponsibility();
  12077. return self;
  12078. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  12079. },
  12080. args: [],
  12081. source: "keys\x0a\x09self subclassResponsibility",
  12082. referencedClasses: [],
  12083. messageSends: ["subclassResponsibility"]
  12084. }),
  12085. $globals.AssociativeCollection);
  12086. $core.addMethod(
  12087. $core.method({
  12088. selector: "keysAndValuesDo:",
  12089. protocol: 'enumerating',
  12090. fn: function (aBlock){
  12091. var self=this;
  12092. return $core.withContext(function($ctx1) {
  12093. self._keysDo_((function(each){
  12094. return $core.withContext(function($ctx2) {
  12095. return $recv(aBlock)._value_value_(each,self._at_(each));
  12096. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12097. }));
  12098. return self;
  12099. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12100. },
  12101. args: ["aBlock"],
  12102. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  12103. referencedClasses: [],
  12104. messageSends: ["keysDo:", "value:value:", "at:"]
  12105. }),
  12106. $globals.AssociativeCollection);
  12107. $core.addMethod(
  12108. $core.method({
  12109. selector: "keysDo:",
  12110. protocol: 'enumerating',
  12111. fn: function (aBlock){
  12112. var self=this;
  12113. return $core.withContext(function($ctx1) {
  12114. self._subclassResponsibility();
  12115. return self;
  12116. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12117. },
  12118. args: ["aBlock"],
  12119. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  12120. referencedClasses: [],
  12121. messageSends: ["subclassResponsibility"]
  12122. }),
  12123. $globals.AssociativeCollection);
  12124. $core.addMethod(
  12125. $core.method({
  12126. selector: "printOn:",
  12127. protocol: 'printing',
  12128. fn: function (aStream){
  12129. var self=this;
  12130. return $core.withContext(function($ctx1) {
  12131. (
  12132. $ctx1.supercall = true,
  12133. $globals.AssociativeCollection.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  12134. $ctx1.supercall = false;
  12135. $ctx1.sendIdx["printOn:"]=1;
  12136. $recv(aStream)._nextPutAll_(" (");
  12137. $ctx1.sendIdx["nextPutAll:"]=1;
  12138. $recv(self._associations())._do_separatedBy_((function(each){
  12139. return $core.withContext(function($ctx2) {
  12140. return $recv(each)._printOn_(aStream);
  12141. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12142. }),(function(){
  12143. return $core.withContext(function($ctx2) {
  12144. return $recv(aStream)._nextPutAll_(" , ");
  12145. $ctx2.sendIdx["nextPutAll:"]=2;
  12146. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12147. }));
  12148. $recv(aStream)._nextPutAll_(")");
  12149. return self;
  12150. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  12151. },
  12152. args: ["aStream"],
  12153. 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: ')'",
  12154. referencedClasses: [],
  12155. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  12156. }),
  12157. $globals.AssociativeCollection);
  12158. $core.addMethod(
  12159. $core.method({
  12160. selector: "remove:ifAbsent:",
  12161. protocol: 'adding/removing',
  12162. fn: function (aKey,aBlock){
  12163. var self=this;
  12164. return $core.withContext(function($ctx1) {
  12165. var $1;
  12166. $1=self._removeKey_ifAbsent_(aKey,aBlock);
  12167. return $1;
  12168. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  12169. },
  12170. args: ["aKey", "aBlock"],
  12171. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  12172. referencedClasses: [],
  12173. messageSends: ["removeKey:ifAbsent:"]
  12174. }),
  12175. $globals.AssociativeCollection);
  12176. $core.addMethod(
  12177. $core.method({
  12178. selector: "removeAll",
  12179. protocol: 'adding/removing',
  12180. fn: function (){
  12181. var self=this;
  12182. return $core.withContext(function($ctx1) {
  12183. var $1;
  12184. $1=$recv(self._keys())._do_((function(each){
  12185. return $core.withContext(function($ctx2) {
  12186. return self._removeKey_(each);
  12187. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12188. }));
  12189. return $1;
  12190. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  12191. },
  12192. args: [],
  12193. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  12194. referencedClasses: [],
  12195. messageSends: ["do:", "keys", "removeKey:"]
  12196. }),
  12197. $globals.AssociativeCollection);
  12198. $core.addMethod(
  12199. $core.method({
  12200. selector: "removeKey:",
  12201. protocol: 'adding/removing',
  12202. fn: function (aKey){
  12203. var self=this;
  12204. return $core.withContext(function($ctx1) {
  12205. var $1;
  12206. $1=self._remove_(aKey);
  12207. return $1;
  12208. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  12209. },
  12210. args: ["aKey"],
  12211. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  12212. referencedClasses: [],
  12213. messageSends: ["remove:"]
  12214. }),
  12215. $globals.AssociativeCollection);
  12216. $core.addMethod(
  12217. $core.method({
  12218. selector: "removeKey:ifAbsent:",
  12219. protocol: 'adding/removing',
  12220. fn: function (aKey,aBlock){
  12221. var self=this;
  12222. return $core.withContext(function($ctx1) {
  12223. self._subclassResponsibility();
  12224. return self;
  12225. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  12226. },
  12227. args: ["aKey", "aBlock"],
  12228. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  12229. referencedClasses: [],
  12230. messageSends: ["subclassResponsibility"]
  12231. }),
  12232. $globals.AssociativeCollection);
  12233. $core.addMethod(
  12234. $core.method({
  12235. selector: "select:",
  12236. protocol: 'enumerating',
  12237. fn: function (aBlock){
  12238. var self=this;
  12239. var newDict;
  12240. return $core.withContext(function($ctx1) {
  12241. var $1,$2;
  12242. newDict=$recv(self._class())._new();
  12243. self._keysAndValuesDo_((function(key,value){
  12244. return $core.withContext(function($ctx2) {
  12245. $1=$recv(aBlock)._value_(value);
  12246. if($core.assert($1)){
  12247. return $recv(newDict)._at_put_(key,value);
  12248. };
  12249. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12250. }));
  12251. $2=newDict;
  12252. return $2;
  12253. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  12254. },
  12255. args: ["aBlock"],
  12256. 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",
  12257. referencedClasses: [],
  12258. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  12259. }),
  12260. $globals.AssociativeCollection);
  12261. $core.addMethod(
  12262. $core.method({
  12263. selector: "shallowCopy",
  12264. protocol: 'copying',
  12265. fn: function (){
  12266. var self=this;
  12267. var copy;
  12268. return $core.withContext(function($ctx1) {
  12269. var $1;
  12270. copy=$recv(self._class())._new();
  12271. self._keysAndValuesDo_((function(key,value){
  12272. return $core.withContext(function($ctx2) {
  12273. return $recv(copy)._at_put_(key,value);
  12274. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12275. }));
  12276. $1=copy;
  12277. return $1;
  12278. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  12279. },
  12280. args: [],
  12281. 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",
  12282. referencedClasses: [],
  12283. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  12284. }),
  12285. $globals.AssociativeCollection);
  12286. $core.addMethod(
  12287. $core.method({
  12288. selector: "size",
  12289. protocol: 'accessing',
  12290. fn: function (){
  12291. var self=this;
  12292. return $core.withContext(function($ctx1) {
  12293. var $1;
  12294. $1=$recv(self._keys())._size();
  12295. return $1;
  12296. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  12297. },
  12298. args: [],
  12299. source: "size\x0a\x09^ self keys size",
  12300. referencedClasses: [],
  12301. messageSends: ["size", "keys"]
  12302. }),
  12303. $globals.AssociativeCollection);
  12304. $core.addMethod(
  12305. $core.method({
  12306. selector: "values",
  12307. protocol: 'accessing',
  12308. fn: function (){
  12309. var self=this;
  12310. return $core.withContext(function($ctx1) {
  12311. self._subclassResponsibility();
  12312. return self;
  12313. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  12314. },
  12315. args: [],
  12316. source: "values\x0a\x09self subclassResponsibility",
  12317. referencedClasses: [],
  12318. messageSends: ["subclassResponsibility"]
  12319. }),
  12320. $globals.AssociativeCollection);
  12321. $core.addMethod(
  12322. $core.method({
  12323. selector: "valuesDo:",
  12324. protocol: 'enumerating',
  12325. fn: function (aBlock){
  12326. var self=this;
  12327. return $core.withContext(function($ctx1) {
  12328. self._subclassResponsibility();
  12329. return self;
  12330. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12331. },
  12332. args: ["aBlock"],
  12333. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  12334. referencedClasses: [],
  12335. messageSends: ["subclassResponsibility"]
  12336. }),
  12337. $globals.AssociativeCollection);
  12338. $core.addMethod(
  12339. $core.method({
  12340. selector: "withIndexDo:",
  12341. protocol: 'enumerating',
  12342. fn: function (aBlock){
  12343. var self=this;
  12344. return $core.withContext(function($ctx1) {
  12345. self._keysAndValuesDo_((function(key,value){
  12346. return $core.withContext(function($ctx2) {
  12347. return $recv(aBlock)._value_value_(value,key);
  12348. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12349. }));
  12350. return self;
  12351. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12352. },
  12353. args: ["aBlock"],
  12354. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  12355. referencedClasses: [],
  12356. messageSends: ["keysAndValuesDo:", "value:value:"]
  12357. }),
  12358. $globals.AssociativeCollection);
  12359. $core.addMethod(
  12360. $core.method({
  12361. selector: "from:",
  12362. protocol: 'instance creation',
  12363. fn: function (aCollection){
  12364. var self=this;
  12365. var newCollection;
  12366. return $core.withContext(function($ctx1) {
  12367. var $1;
  12368. newCollection=self._new();
  12369. $recv(aCollection)._do_((function(each){
  12370. return $core.withContext(function($ctx2) {
  12371. return $recv(newCollection)._add_(each);
  12372. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12373. }));
  12374. $1=newCollection;
  12375. return $1;
  12376. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  12377. },
  12378. args: ["aCollection"],
  12379. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  12380. referencedClasses: [],
  12381. messageSends: ["new", "do:", "add:"]
  12382. }),
  12383. $globals.AssociativeCollection.klass);
  12384. $core.addMethod(
  12385. $core.method({
  12386. selector: "fromPairs:",
  12387. protocol: 'instance creation',
  12388. fn: function (aCollection){
  12389. var self=this;
  12390. return $core.withContext(function($ctx1) {
  12391. var $1;
  12392. $1=self._from_(aCollection);
  12393. return $1;
  12394. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.klass)});
  12395. },
  12396. args: ["aCollection"],
  12397. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  12398. referencedClasses: [],
  12399. messageSends: ["from:"]
  12400. }),
  12401. $globals.AssociativeCollection.klass);
  12402. $core.addMethod(
  12403. $core.method({
  12404. selector: "newFromPairs:",
  12405. protocol: 'instance creation',
  12406. fn: function (aCollection){
  12407. var self=this;
  12408. var newCollection;
  12409. return $core.withContext(function($ctx1) {
  12410. var $2,$1,$3,$4,$5;
  12411. $2=$recv(aCollection)._size();
  12412. $ctx1.sendIdx["size"]=1;
  12413. $1=$recv($2)._even();
  12414. if(!$core.assert($1)){
  12415. self._error_("#newFromPairs only accepts arrays of an even length");
  12416. };
  12417. newCollection=self._new();
  12418. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  12419. return $core.withContext(function($ctx2) {
  12420. $3=newCollection;
  12421. $4=$recv(aCollection)._at_(each);
  12422. $ctx2.sendIdx["at:"]=1;
  12423. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  12424. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  12425. }));
  12426. $5=newCollection;
  12427. return $5;
  12428. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  12429. },
  12430. args: ["aCollection"],
  12431. 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",
  12432. referencedClasses: [],
  12433. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  12434. }),
  12435. $globals.AssociativeCollection.klass);
  12436. $core.addClass('Dictionary', $globals.AssociativeCollection, ['keys', 'values'], 'Kernel-Collections');
  12437. $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.";
  12438. $core.addMethod(
  12439. $core.method({
  12440. selector: "at:ifAbsent:",
  12441. protocol: 'accessing',
  12442. fn: function (aKey,aBlock){
  12443. var self=this;
  12444. return $core.withContext(function($ctx1) {
  12445. var index = self._positionOfKey_(aKey);
  12446. return index >=0 ? self['@values'][index] : aBlock._value();
  12447. ;
  12448. return self;
  12449. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  12450. },
  12451. args: ["aKey", "aBlock"],
  12452. 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>",
  12453. referencedClasses: [],
  12454. messageSends: []
  12455. }),
  12456. $globals.Dictionary);
  12457. $core.addMethod(
  12458. $core.method({
  12459. selector: "at:put:",
  12460. protocol: 'accessing',
  12461. fn: function (aKey,aValue){
  12462. var self=this;
  12463. return $core.withContext(function($ctx1) {
  12464. var index = self._positionOfKey_(aKey);
  12465. if(index === -1) {
  12466. var keys = self['@keys'];
  12467. index = keys.length;
  12468. keys.push(aKey);
  12469. }
  12470. return self['@values'][index] = aValue;
  12471. ;
  12472. return self;
  12473. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  12474. },
  12475. args: ["aKey", "aValue"],
  12476. 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>",
  12477. referencedClasses: [],
  12478. messageSends: []
  12479. }),
  12480. $globals.Dictionary);
  12481. $core.addMethod(
  12482. $core.method({
  12483. selector: "includesKey:",
  12484. protocol: 'testing',
  12485. fn: function (aKey){
  12486. var self=this;
  12487. return $core.withContext(function($ctx1) {
  12488. return self._positionOfKey_(aKey) >= 0; ;
  12489. return self;
  12490. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  12491. },
  12492. args: ["aKey"],
  12493. source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
  12494. referencedClasses: [],
  12495. messageSends: []
  12496. }),
  12497. $globals.Dictionary);
  12498. $core.addMethod(
  12499. $core.method({
  12500. selector: "indexOf:ifAbsent:",
  12501. protocol: 'accessing',
  12502. fn: function (anObject,aBlock){
  12503. var self=this;
  12504. var index;
  12505. return $core.withContext(function($ctx1) {
  12506. var $2,$1;
  12507. index=$recv(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  12508. return (0);
  12509. }));
  12510. $2=$recv(index).__eq((0));
  12511. if($core.assert($2)){
  12512. $1=$recv(aBlock)._value();
  12513. } else {
  12514. $1=$recv(self["@keys"])._at_(index);
  12515. };
  12516. return $1;
  12517. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  12518. },
  12519. args: ["anObject", "aBlock"],
  12520. 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 ]",
  12521. referencedClasses: [],
  12522. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  12523. }),
  12524. $globals.Dictionary);
  12525. $core.addMethod(
  12526. $core.method({
  12527. selector: "initialize",
  12528. protocol: 'initialization',
  12529. fn: function (){
  12530. var self=this;
  12531. return $core.withContext(function($ctx1) {
  12532. (
  12533. $ctx1.supercall = true,
  12534. $globals.Dictionary.superclass.fn.prototype._initialize.apply($recv(self), []));
  12535. $ctx1.supercall = false;
  12536. self["@keys"]=[];
  12537. self["@values"]=[];
  12538. return self;
  12539. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  12540. },
  12541. args: [],
  12542. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  12543. referencedClasses: [],
  12544. messageSends: ["initialize"]
  12545. }),
  12546. $globals.Dictionary);
  12547. $core.addMethod(
  12548. $core.method({
  12549. selector: "keys",
  12550. protocol: 'accessing',
  12551. fn: function (){
  12552. var self=this;
  12553. return $core.withContext(function($ctx1) {
  12554. var $1;
  12555. $1=$recv(self["@keys"])._copy();
  12556. return $1;
  12557. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  12558. },
  12559. args: [],
  12560. source: "keys\x0a\x09^ keys copy",
  12561. referencedClasses: [],
  12562. messageSends: ["copy"]
  12563. }),
  12564. $globals.Dictionary);
  12565. $core.addMethod(
  12566. $core.method({
  12567. selector: "keysAndValuesDo:",
  12568. protocol: 'enumerating',
  12569. fn: function (aBlock){
  12570. var self=this;
  12571. return $core.withContext(function($ctx1) {
  12572. var $1;
  12573. $1=$recv(self["@keys"])._with_do_(self["@values"],aBlock);
  12574. return $1;
  12575. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  12576. },
  12577. args: ["aBlock"],
  12578. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  12579. referencedClasses: [],
  12580. messageSends: ["with:do:"]
  12581. }),
  12582. $globals.Dictionary);
  12583. $core.addMethod(
  12584. $core.method({
  12585. selector: "keysDo:",
  12586. protocol: 'enumerating',
  12587. fn: function (aBlock){
  12588. var self=this;
  12589. return $core.withContext(function($ctx1) {
  12590. var $1;
  12591. $1=$recv(self["@keys"])._do_(aBlock);
  12592. return $1;
  12593. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  12594. },
  12595. args: ["aBlock"],
  12596. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  12597. referencedClasses: [],
  12598. messageSends: ["do:"]
  12599. }),
  12600. $globals.Dictionary);
  12601. $core.addMethod(
  12602. $core.method({
  12603. selector: "positionOfKey:",
  12604. protocol: 'private',
  12605. fn: function (anObject){
  12606. var self=this;
  12607. return $core.withContext(function($ctx1) {
  12608. var keys = self['@keys'];
  12609. for(var i=0;i<keys.length;i++){
  12610. if(keys[i].__eq(anObject)) { return i;}
  12611. }
  12612. return -1;
  12613. ;
  12614. return self;
  12615. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  12616. },
  12617. args: ["anObject"],
  12618. 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>",
  12619. referencedClasses: [],
  12620. messageSends: []
  12621. }),
  12622. $globals.Dictionary);
  12623. $core.addMethod(
  12624. $core.method({
  12625. selector: "removeAll",
  12626. protocol: 'adding/removing',
  12627. fn: function (){
  12628. var self=this;
  12629. return $core.withContext(function($ctx1) {
  12630. $recv(self["@keys"])._removeAll();
  12631. $ctx1.sendIdx["removeAll"]=1;
  12632. $recv(self["@values"])._removeAll();
  12633. return self;
  12634. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  12635. },
  12636. args: [],
  12637. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  12638. referencedClasses: [],
  12639. messageSends: ["removeAll"]
  12640. }),
  12641. $globals.Dictionary);
  12642. $core.addMethod(
  12643. $core.method({
  12644. selector: "removeKey:ifAbsent:",
  12645. protocol: 'adding/removing',
  12646. fn: function (aKey,aBlock){
  12647. var self=this;
  12648. return $core.withContext(function($ctx1) {
  12649. var index = self._positionOfKey_(aKey);
  12650. if(index === -1) {
  12651. return aBlock._value()
  12652. } else {
  12653. var keys = self['@keys'], values = self['@values'];
  12654. var value = values[index], l = keys.length;
  12655. keys[index] = keys[l-1];
  12656. keys.pop();
  12657. values[index] = values[l-1];
  12658. values.pop();
  12659. return value;
  12660. }
  12661. ;
  12662. return self;
  12663. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  12664. },
  12665. args: ["aKey", "aBlock"],
  12666. 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>",
  12667. referencedClasses: [],
  12668. messageSends: []
  12669. }),
  12670. $globals.Dictionary);
  12671. $core.addMethod(
  12672. $core.method({
  12673. selector: "values",
  12674. protocol: 'accessing',
  12675. fn: function (){
  12676. var self=this;
  12677. var $1;
  12678. $1=self["@values"];
  12679. return $1;
  12680. },
  12681. args: [],
  12682. source: "values\x0a\x09^ values",
  12683. referencedClasses: [],
  12684. messageSends: []
  12685. }),
  12686. $globals.Dictionary);
  12687. $core.addMethod(
  12688. $core.method({
  12689. selector: "valuesDo:",
  12690. protocol: 'enumerating',
  12691. fn: function (aBlock){
  12692. var self=this;
  12693. return $core.withContext(function($ctx1) {
  12694. var $1;
  12695. $1=$recv(self["@values"])._do_(aBlock);
  12696. return $1;
  12697. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  12698. },
  12699. args: ["aBlock"],
  12700. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  12701. referencedClasses: [],
  12702. messageSends: ["do:"]
  12703. }),
  12704. $globals.Dictionary);
  12705. $core.addClass('HashedCollection', $globals.AssociativeCollection, [], 'Kernel-Collections');
  12706. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  12707. $core.addMethod(
  12708. $core.method({
  12709. selector: "at:ifAbsent:",
  12710. protocol: 'accessing',
  12711. fn: function (aKey,aBlock){
  12712. var self=this;
  12713. return $core.withContext(function($ctx1) {
  12714. var $2,$1;
  12715. $2=self._includesKey_(aKey);
  12716. if($core.assert($2)){
  12717. $1=self._basicAt_(aKey);
  12718. } else {
  12719. $1=$recv(aBlock)._value();
  12720. };
  12721. return $1;
  12722. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  12723. },
  12724. args: ["aKey", "aBlock"],
  12725. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  12726. referencedClasses: [],
  12727. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  12728. }),
  12729. $globals.HashedCollection);
  12730. $core.addMethod(
  12731. $core.method({
  12732. selector: "at:put:",
  12733. protocol: 'accessing',
  12734. fn: function (aKey,aValue){
  12735. var self=this;
  12736. return $core.withContext(function($ctx1) {
  12737. var $1;
  12738. $1=self._basicAt_put_(aKey,aValue);
  12739. return $1;
  12740. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  12741. },
  12742. args: ["aKey", "aValue"],
  12743. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  12744. referencedClasses: [],
  12745. messageSends: ["basicAt:put:"]
  12746. }),
  12747. $globals.HashedCollection);
  12748. $core.addMethod(
  12749. $core.method({
  12750. selector: "includesKey:",
  12751. protocol: 'testing',
  12752. fn: function (aKey){
  12753. var self=this;
  12754. return $core.withContext(function($ctx1) {
  12755. return self.hasOwnProperty(aKey);
  12756. return self;
  12757. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  12758. },
  12759. args: ["aKey"],
  12760. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  12761. referencedClasses: [],
  12762. messageSends: []
  12763. }),
  12764. $globals.HashedCollection);
  12765. $core.addMethod(
  12766. $core.method({
  12767. selector: "keys",
  12768. protocol: 'accessing',
  12769. fn: function (){
  12770. var self=this;
  12771. return $core.withContext(function($ctx1) {
  12772. return Object.keys(self);
  12773. return self;
  12774. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  12775. },
  12776. args: [],
  12777. source: "keys\x0a\x09<return Object.keys(self)>",
  12778. referencedClasses: [],
  12779. messageSends: []
  12780. }),
  12781. $globals.HashedCollection);
  12782. $core.addMethod(
  12783. $core.method({
  12784. selector: "keysDo:",
  12785. protocol: 'enumerating',
  12786. fn: function (aBlock){
  12787. var self=this;
  12788. return $core.withContext(function($ctx1) {
  12789. $recv(self._keys())._do_(aBlock);
  12790. return self;
  12791. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  12792. },
  12793. args: ["aBlock"],
  12794. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  12795. referencedClasses: [],
  12796. messageSends: ["do:", "keys"]
  12797. }),
  12798. $globals.HashedCollection);
  12799. $core.addMethod(
  12800. $core.method({
  12801. selector: "removeKey:ifAbsent:",
  12802. protocol: 'adding/removing',
  12803. fn: function (aKey,aBlock){
  12804. var self=this;
  12805. return $core.withContext(function($ctx1) {
  12806. var $1;
  12807. $1=self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  12808. return $core.withContext(function($ctx2) {
  12809. self._basicDelete_(aKey);
  12810. return removed;
  12811. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  12812. }),(function(){
  12813. return $core.withContext(function($ctx2) {
  12814. return $recv(aBlock)._value();
  12815. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12816. }));
  12817. return $1;
  12818. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  12819. },
  12820. args: ["aKey", "aBlock"],
  12821. 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 ]",
  12822. referencedClasses: [],
  12823. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  12824. }),
  12825. $globals.HashedCollection);
  12826. $core.addMethod(
  12827. $core.method({
  12828. selector: "values",
  12829. protocol: 'accessing',
  12830. fn: function (){
  12831. var self=this;
  12832. return $core.withContext(function($ctx1) {
  12833. return self._keys().map(function(key){
  12834. return self._at_(key);
  12835. });
  12836. ;
  12837. return self;
  12838. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  12839. },
  12840. args: [],
  12841. source: "values\x0a\x09<\x0a\x09\x09return self._keys().map(function(key){\x0a\x09\x09\x09return self._at_(key);\x0a\x09\x09});\x0a\x09>",
  12842. referencedClasses: [],
  12843. messageSends: []
  12844. }),
  12845. $globals.HashedCollection);
  12846. $core.addMethod(
  12847. $core.method({
  12848. selector: "valuesDo:",
  12849. protocol: 'enumerating',
  12850. fn: function (aBlock){
  12851. var self=this;
  12852. return $core.withContext(function($ctx1) {
  12853. $recv(self._values())._do_(aBlock);
  12854. return self;
  12855. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  12856. },
  12857. args: ["aBlock"],
  12858. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  12859. referencedClasses: [],
  12860. messageSends: ["do:", "values"]
  12861. }),
  12862. $globals.HashedCollection);
  12863. $core.addClass('SequenceableCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  12864. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  12865. $core.addMethod(
  12866. $core.method({
  12867. selector: "=",
  12868. protocol: 'comparing',
  12869. fn: function (aCollection){
  12870. var self=this;
  12871. return $core.withContext(function($ctx1) {
  12872. var $3,$2,$4,$1,$5;
  12873. var $early={};
  12874. try {
  12875. $3=self._class();
  12876. $ctx1.sendIdx["class"]=1;
  12877. $2=$recv($3).__eq($recv(aCollection)._class());
  12878. $ctx1.sendIdx["="]=1;
  12879. $1=$recv($2)._and_((function(){
  12880. return $core.withContext(function($ctx2) {
  12881. $4=self._size();
  12882. $ctx2.sendIdx["size"]=1;
  12883. return $recv($4).__eq($recv(aCollection)._size());
  12884. $ctx2.sendIdx["="]=2;
  12885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12886. }));
  12887. if(!$core.assert($1)){
  12888. return false;
  12889. };
  12890. self._withIndexDo_((function(each,i){
  12891. return $core.withContext(function($ctx2) {
  12892. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  12893. if(!$core.assert($5)){
  12894. throw $early=[false];
  12895. };
  12896. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  12897. }));
  12898. return true;
  12899. }
  12900. catch(e) {if(e===$early)return e[0]; throw e}
  12901. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  12902. },
  12903. args: ["aCollection"],
  12904. 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",
  12905. referencedClasses: [],
  12906. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  12907. }),
  12908. $globals.SequenceableCollection);
  12909. $core.addMethod(
  12910. $core.method({
  12911. selector: "addLast:",
  12912. protocol: 'adding/removing',
  12913. fn: function (anObject){
  12914. var self=this;
  12915. return $core.withContext(function($ctx1) {
  12916. self._add_(anObject);
  12917. return self;
  12918. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  12919. },
  12920. args: ["anObject"],
  12921. source: "addLast: anObject\x0a\x09self add: anObject",
  12922. referencedClasses: [],
  12923. messageSends: ["add:"]
  12924. }),
  12925. $globals.SequenceableCollection);
  12926. $core.addMethod(
  12927. $core.method({
  12928. selector: "allButFirst",
  12929. protocol: 'accessing',
  12930. fn: function (){
  12931. var self=this;
  12932. return $core.withContext(function($ctx1) {
  12933. var $1;
  12934. $1=self._copyFrom_to_((2),self._size());
  12935. return $1;
  12936. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  12937. },
  12938. args: [],
  12939. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  12940. referencedClasses: [],
  12941. messageSends: ["copyFrom:to:", "size"]
  12942. }),
  12943. $globals.SequenceableCollection);
  12944. $core.addMethod(
  12945. $core.method({
  12946. selector: "allButLast",
  12947. protocol: 'accessing',
  12948. fn: function (){
  12949. var self=this;
  12950. return $core.withContext(function($ctx1) {
  12951. var $1;
  12952. $1=self._copyFrom_to_((1),$recv(self._size()).__minus((1)));
  12953. return $1;
  12954. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  12955. },
  12956. args: [],
  12957. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  12958. referencedClasses: [],
  12959. messageSends: ["copyFrom:to:", "-", "size"]
  12960. }),
  12961. $globals.SequenceableCollection);
  12962. $core.addMethod(
  12963. $core.method({
  12964. selector: "atRandom",
  12965. protocol: 'accessing',
  12966. fn: function (){
  12967. var self=this;
  12968. return $core.withContext(function($ctx1) {
  12969. var $1;
  12970. $1=self._at_($recv(self._size())._atRandom());
  12971. return $1;
  12972. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  12973. },
  12974. args: [],
  12975. source: "atRandom\x0a\x09^ self at: self size atRandom",
  12976. referencedClasses: [],
  12977. messageSends: ["at:", "atRandom", "size"]
  12978. }),
  12979. $globals.SequenceableCollection);
  12980. $core.addMethod(
  12981. $core.method({
  12982. selector: "beginsWith:",
  12983. protocol: 'testing',
  12984. fn: function (prefix){
  12985. var self=this;
  12986. return $core.withContext(function($ctx1) {
  12987. var $2,$3,$1,$4;
  12988. $2=self._size();
  12989. $ctx1.sendIdx["size"]=1;
  12990. $3=$recv(prefix)._size();
  12991. $ctx1.sendIdx["size"]=2;
  12992. $1=$recv($2).__lt($3);
  12993. if($core.assert($1)){
  12994. return false;
  12995. };
  12996. $4=$recv(self._first_($recv(prefix)._size())).__eq(prefix);
  12997. return $4;
  12998. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  12999. },
  13000. args: ["prefix"],
  13001. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  13002. referencedClasses: [],
  13003. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  13004. }),
  13005. $globals.SequenceableCollection);
  13006. $core.addMethod(
  13007. $core.method({
  13008. selector: "copyFrom:to:",
  13009. protocol: 'copying',
  13010. fn: function (anIndex,anotherIndex){
  13011. var self=this;
  13012. return $core.withContext(function($ctx1) {
  13013. self._subclassResponsibility();
  13014. return self;
  13015. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  13016. },
  13017. args: ["anIndex", "anotherIndex"],
  13018. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  13019. referencedClasses: [],
  13020. messageSends: ["subclassResponsibility"]
  13021. }),
  13022. $globals.SequenceableCollection);
  13023. $core.addMethod(
  13024. $core.method({
  13025. selector: "detect:ifNone:",
  13026. protocol: 'enumerating',
  13027. fn: function (aBlock,anotherBlock){
  13028. var self=this;
  13029. return $core.withContext(function($ctx1) {
  13030. self = self._numericallyIndexable();
  13031. for(var i = 0; i < self.length; i++)
  13032. if(aBlock._value_(self[i]))
  13033. return self[i];
  13034. return anotherBlock._value();
  13035. ;
  13036. return self;
  13037. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  13038. },
  13039. args: ["aBlock", "anotherBlock"],
  13040. 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>",
  13041. referencedClasses: [],
  13042. messageSends: []
  13043. }),
  13044. $globals.SequenceableCollection);
  13045. $core.addMethod(
  13046. $core.method({
  13047. selector: "do:",
  13048. protocol: 'enumerating',
  13049. fn: function (aBlock){
  13050. var self=this;
  13051. return $core.withContext(function($ctx1) {
  13052. self = self._numericallyIndexable();
  13053. for(var i=0; i < self.length; i++) {
  13054. aBlock._value_(self[i]);
  13055. }
  13056. ;
  13057. return self;
  13058. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  13059. },
  13060. args: ["aBlock"],
  13061. 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>",
  13062. referencedClasses: [],
  13063. messageSends: []
  13064. }),
  13065. $globals.SequenceableCollection);
  13066. $core.addMethod(
  13067. $core.method({
  13068. selector: "endsWith:",
  13069. protocol: 'testing',
  13070. fn: function (suffix){
  13071. var self=this;
  13072. return $core.withContext(function($ctx1) {
  13073. var $2,$3,$1,$4;
  13074. $2=self._size();
  13075. $ctx1.sendIdx["size"]=1;
  13076. $3=$recv(suffix)._size();
  13077. $ctx1.sendIdx["size"]=2;
  13078. $1=$recv($2).__lt($3);
  13079. if($core.assert($1)){
  13080. return false;
  13081. };
  13082. $4=$recv(self._last_($recv(suffix)._size())).__eq(suffix);
  13083. return $4;
  13084. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  13085. },
  13086. args: ["suffix"],
  13087. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  13088. referencedClasses: [],
  13089. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  13090. }),
  13091. $globals.SequenceableCollection);
  13092. $core.addMethod(
  13093. $core.method({
  13094. selector: "first",
  13095. protocol: 'accessing',
  13096. fn: function (){
  13097. var self=this;
  13098. return $core.withContext(function($ctx1) {
  13099. var $1;
  13100. $1=self._at_((1));
  13101. return $1;
  13102. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  13103. },
  13104. args: [],
  13105. source: "first\x0a\x09^ self at: 1",
  13106. referencedClasses: [],
  13107. messageSends: ["at:"]
  13108. }),
  13109. $globals.SequenceableCollection);
  13110. $core.addMethod(
  13111. $core.method({
  13112. selector: "first:",
  13113. protocol: 'accessing',
  13114. fn: function (aNumber){
  13115. var self=this;
  13116. return $core.withContext(function($ctx1) {
  13117. var $1,$2;
  13118. $1=$recv(self._size()).__lt(aNumber);
  13119. if($core.assert($1)){
  13120. self._error_("Invalid number of elements");
  13121. };
  13122. $2=self._copyFrom_to_((1),aNumber);
  13123. return $2;
  13124. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  13125. },
  13126. args: ["aNumber"],
  13127. 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",
  13128. referencedClasses: [],
  13129. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  13130. }),
  13131. $globals.SequenceableCollection);
  13132. $core.addMethod(
  13133. $core.method({
  13134. selector: "fourth",
  13135. protocol: 'accessing',
  13136. fn: function (){
  13137. var self=this;
  13138. return $core.withContext(function($ctx1) {
  13139. var $1;
  13140. $1=self._at_((4));
  13141. return $1;
  13142. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  13143. },
  13144. args: [],
  13145. source: "fourth\x0a\x09^ self at: 4",
  13146. referencedClasses: [],
  13147. messageSends: ["at:"]
  13148. }),
  13149. $globals.SequenceableCollection);
  13150. $core.addMethod(
  13151. $core.method({
  13152. selector: "includes:",
  13153. protocol: 'testing',
  13154. fn: function (anObject){
  13155. var self=this;
  13156. return $core.withContext(function($ctx1) {
  13157. var $1;
  13158. $1=$recv(self._indexOf_ifAbsent_(anObject,(function(){
  13159. return nil;
  13160. })))._notNil();
  13161. return $1;
  13162. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  13163. },
  13164. args: ["anObject"],
  13165. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  13166. referencedClasses: [],
  13167. messageSends: ["notNil", "indexOf:ifAbsent:"]
  13168. }),
  13169. $globals.SequenceableCollection);
  13170. $core.addMethod(
  13171. $core.method({
  13172. selector: "indexOf:ifAbsent:",
  13173. protocol: 'accessing',
  13174. fn: function (anObject,aBlock){
  13175. var self=this;
  13176. return $core.withContext(function($ctx1) {
  13177. self = self._numericallyIndexable();
  13178. for(var i=0; i < self.length; i++) {
  13179. if($recv(self[i]).__eq(anObject)) {return i+1}
  13180. };
  13181. return aBlock._value();
  13182. ;
  13183. return self;
  13184. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  13185. },
  13186. args: ["anObject", "aBlock"],
  13187. 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>",
  13188. referencedClasses: [],
  13189. messageSends: []
  13190. }),
  13191. $globals.SequenceableCollection);
  13192. $core.addMethod(
  13193. $core.method({
  13194. selector: "indexOf:startingAt:",
  13195. protocol: 'accessing',
  13196. fn: function (anObject,start){
  13197. var self=this;
  13198. return $core.withContext(function($ctx1) {
  13199. var $1;
  13200. $1=self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  13201. return (0);
  13202. }));
  13203. return $1;
  13204. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  13205. },
  13206. args: ["anObject", "start"],
  13207. 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 ]",
  13208. referencedClasses: [],
  13209. messageSends: ["indexOf:startingAt:ifAbsent:"]
  13210. }),
  13211. $globals.SequenceableCollection);
  13212. $core.addMethod(
  13213. $core.method({
  13214. selector: "indexOf:startingAt:ifAbsent:",
  13215. protocol: 'accessing',
  13216. fn: function (anObject,start,aBlock){
  13217. var self=this;
  13218. return $core.withContext(function($ctx1) {
  13219. self = self._numericallyIndexable();
  13220. for(var i=start - 1; i < self.length; i++){
  13221. if($recv(self[i]).__eq(anObject)) {return i+1}
  13222. }
  13223. return aBlock._value();
  13224. ;
  13225. return self;
  13226. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  13227. },
  13228. args: ["anObject", "start", "aBlock"],
  13229. 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>",
  13230. referencedClasses: [],
  13231. messageSends: []
  13232. }),
  13233. $globals.SequenceableCollection);
  13234. $core.addMethod(
  13235. $core.method({
  13236. selector: "last",
  13237. protocol: 'accessing',
  13238. fn: function (){
  13239. var self=this;
  13240. return $core.withContext(function($ctx1) {
  13241. var $1;
  13242. $1=self._at_(self._size());
  13243. return $1;
  13244. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  13245. },
  13246. args: [],
  13247. source: "last\x0a\x09^ self at: self size",
  13248. referencedClasses: [],
  13249. messageSends: ["at:", "size"]
  13250. }),
  13251. $globals.SequenceableCollection);
  13252. $core.addMethod(
  13253. $core.method({
  13254. selector: "last:",
  13255. protocol: 'accessing',
  13256. fn: function (aNumber){
  13257. var self=this;
  13258. return $core.withContext(function($ctx1) {
  13259. var $2,$1,$6,$5,$4,$3;
  13260. $2=self._size();
  13261. $ctx1.sendIdx["size"]=1;
  13262. $1=$recv($2).__lt(aNumber);
  13263. if($core.assert($1)){
  13264. self._error_("Invalid number of elements");
  13265. };
  13266. $6=self._size();
  13267. $ctx1.sendIdx["size"]=2;
  13268. $5=$recv($6).__minus(aNumber);
  13269. $4=$recv($5).__plus((1));
  13270. $3=self._copyFrom_to_($4,self._size());
  13271. return $3;
  13272. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  13273. },
  13274. args: ["aNumber"],
  13275. 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",
  13276. referencedClasses: [],
  13277. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  13278. }),
  13279. $globals.SequenceableCollection);
  13280. $core.addMethod(
  13281. $core.method({
  13282. selector: "newStream",
  13283. protocol: 'streaming',
  13284. fn: function (){
  13285. var self=this;
  13286. return $core.withContext(function($ctx1) {
  13287. var $1;
  13288. $1=$recv(self._streamClass())._on_(self);
  13289. return $1;
  13290. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  13291. },
  13292. args: [],
  13293. source: "newStream\x0a\x09^ self streamClass on: self",
  13294. referencedClasses: [],
  13295. messageSends: ["on:", "streamClass"]
  13296. }),
  13297. $globals.SequenceableCollection);
  13298. $core.addMethod(
  13299. $core.method({
  13300. selector: "numericallyIndexable",
  13301. protocol: 'private',
  13302. fn: function (){
  13303. var self=this;
  13304. return $core.withContext(function($ctx1) {
  13305. self._subclassResponsibility();
  13306. return self;
  13307. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  13308. },
  13309. args: [],
  13310. 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",
  13311. referencedClasses: [],
  13312. messageSends: ["subclassResponsibility"]
  13313. }),
  13314. $globals.SequenceableCollection);
  13315. $core.addMethod(
  13316. $core.method({
  13317. selector: "readStream",
  13318. protocol: 'streaming',
  13319. fn: function (){
  13320. var self=this;
  13321. return $core.withContext(function($ctx1) {
  13322. var $1;
  13323. $1=self._stream();
  13324. return $1;
  13325. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  13326. },
  13327. args: [],
  13328. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  13329. referencedClasses: [],
  13330. messageSends: ["stream"]
  13331. }),
  13332. $globals.SequenceableCollection);
  13333. $core.addMethod(
  13334. $core.method({
  13335. selector: "removeLast",
  13336. protocol: 'adding/removing',
  13337. fn: function (){
  13338. var self=this;
  13339. return $core.withContext(function($ctx1) {
  13340. var $1;
  13341. $1=self._remove_(self._last());
  13342. return $1;
  13343. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  13344. },
  13345. args: [],
  13346. source: "removeLast\x0a\x09^ self remove: self last",
  13347. referencedClasses: [],
  13348. messageSends: ["remove:", "last"]
  13349. }),
  13350. $globals.SequenceableCollection);
  13351. $core.addMethod(
  13352. $core.method({
  13353. selector: "reversed",
  13354. protocol: 'converting',
  13355. fn: function (){
  13356. var self=this;
  13357. return $core.withContext(function($ctx1) {
  13358. self._subclassResponsibility();
  13359. return self;
  13360. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  13361. },
  13362. args: [],
  13363. source: "reversed\x0a\x09self subclassResponsibility",
  13364. referencedClasses: [],
  13365. messageSends: ["subclassResponsibility"]
  13366. }),
  13367. $globals.SequenceableCollection);
  13368. $core.addMethod(
  13369. $core.method({
  13370. selector: "second",
  13371. protocol: 'accessing',
  13372. fn: function (){
  13373. var self=this;
  13374. return $core.withContext(function($ctx1) {
  13375. var $1;
  13376. $1=self._at_((2));
  13377. return $1;
  13378. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  13379. },
  13380. args: [],
  13381. source: "second\x0a\x09^ self at: 2",
  13382. referencedClasses: [],
  13383. messageSends: ["at:"]
  13384. }),
  13385. $globals.SequenceableCollection);
  13386. $core.addMethod(
  13387. $core.method({
  13388. selector: "stream",
  13389. protocol: 'streaming',
  13390. fn: function (){
  13391. var self=this;
  13392. return $core.withContext(function($ctx1) {
  13393. var $1;
  13394. $1=self._newStream();
  13395. return $1;
  13396. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  13397. },
  13398. args: [],
  13399. source: "stream\x0a\x09^ self newStream",
  13400. referencedClasses: [],
  13401. messageSends: ["newStream"]
  13402. }),
  13403. $globals.SequenceableCollection);
  13404. $core.addMethod(
  13405. $core.method({
  13406. selector: "streamClass",
  13407. protocol: 'streaming',
  13408. fn: function (){
  13409. var self=this;
  13410. return $core.withContext(function($ctx1) {
  13411. var $1;
  13412. $1=$recv(self._class())._streamClass();
  13413. return $1;
  13414. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  13415. },
  13416. args: [],
  13417. source: "streamClass\x0a\x09^ self class streamClass",
  13418. referencedClasses: [],
  13419. messageSends: ["streamClass", "class"]
  13420. }),
  13421. $globals.SequenceableCollection);
  13422. $core.addMethod(
  13423. $core.method({
  13424. selector: "third",
  13425. protocol: 'accessing',
  13426. fn: function (){
  13427. var self=this;
  13428. return $core.withContext(function($ctx1) {
  13429. var $1;
  13430. $1=self._at_((3));
  13431. return $1;
  13432. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  13433. },
  13434. args: [],
  13435. source: "third\x0a\x09^ self at: 3",
  13436. referencedClasses: [],
  13437. messageSends: ["at:"]
  13438. }),
  13439. $globals.SequenceableCollection);
  13440. $core.addMethod(
  13441. $core.method({
  13442. selector: "with:do:",
  13443. protocol: 'enumerating',
  13444. fn: function (anotherCollection,aBlock){
  13445. var self=this;
  13446. return $core.withContext(function($ctx1) {
  13447. self = self._numericallyIndexable();
  13448. anotherCollection = anotherCollection._numericallyIndexable();
  13449. for(var i=0; i<self.length; i++) {
  13450. aBlock._value_value_(self[i], anotherCollection[i]);
  13451. }
  13452. ;
  13453. return self;
  13454. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  13455. },
  13456. args: ["anotherCollection", "aBlock"],
  13457. 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>",
  13458. referencedClasses: [],
  13459. messageSends: []
  13460. }),
  13461. $globals.SequenceableCollection);
  13462. $core.addMethod(
  13463. $core.method({
  13464. selector: "withIndexDo:",
  13465. protocol: 'enumerating',
  13466. fn: function (aBlock){
  13467. var self=this;
  13468. return $core.withContext(function($ctx1) {
  13469. self = self._numericallyIndexable();
  13470. for(var i=0; i < self.length; i++) {
  13471. aBlock._value_value_(self[i], i+1);
  13472. }
  13473. ;
  13474. return self;
  13475. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  13476. },
  13477. args: ["aBlock"],
  13478. 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>",
  13479. referencedClasses: [],
  13480. messageSends: []
  13481. }),
  13482. $globals.SequenceableCollection);
  13483. $core.addMethod(
  13484. $core.method({
  13485. selector: "writeStream",
  13486. protocol: 'streaming',
  13487. fn: function (){
  13488. var self=this;
  13489. return $core.withContext(function($ctx1) {
  13490. var $1;
  13491. $1=self._stream();
  13492. return $1;
  13493. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  13494. },
  13495. args: [],
  13496. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  13497. referencedClasses: [],
  13498. messageSends: ["stream"]
  13499. }),
  13500. $globals.SequenceableCollection);
  13501. $core.addMethod(
  13502. $core.method({
  13503. selector: "streamClass",
  13504. protocol: 'accessing',
  13505. fn: function (){
  13506. var self=this;
  13507. function $Stream(){return $globals.Stream||(typeof Stream=="undefined"?nil:Stream)}
  13508. return $Stream();
  13509. },
  13510. args: [],
  13511. source: "streamClass\x0a\x09\x09^ Stream",
  13512. referencedClasses: ["Stream"],
  13513. messageSends: []
  13514. }),
  13515. $globals.SequenceableCollection.klass);
  13516. $core.addMethod(
  13517. $core.method({
  13518. selector: "streamContents:",
  13519. protocol: 'streaming',
  13520. fn: function (aBlock){
  13521. var self=this;
  13522. var stream;
  13523. return $core.withContext(function($ctx1) {
  13524. var $1;
  13525. stream=$recv(self._streamClass())._on_(self._new());
  13526. $recv(aBlock)._value_(stream);
  13527. $1=$recv(stream)._contents();
  13528. return $1;
  13529. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.klass)});
  13530. },
  13531. args: ["aBlock"],
  13532. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  13533. referencedClasses: [],
  13534. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  13535. }),
  13536. $globals.SequenceableCollection.klass);
  13537. $core.addClass('Array', $globals.SequenceableCollection, [], 'Kernel-Collections');
  13538. $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`.";
  13539. $core.addMethod(
  13540. $core.method({
  13541. selector: "add:",
  13542. protocol: 'adding/removing',
  13543. fn: function (anObject){
  13544. var self=this;
  13545. return $core.withContext(function($ctx1) {
  13546. self.push(anObject); return anObject;;
  13547. return self;
  13548. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  13549. },
  13550. args: ["anObject"],
  13551. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  13552. referencedClasses: [],
  13553. messageSends: []
  13554. }),
  13555. $globals.Array);
  13556. $core.addMethod(
  13557. $core.method({
  13558. selector: "addAll:",
  13559. protocol: 'adding/removing',
  13560. fn: function (aCollection){
  13561. var self=this;
  13562. return $core.withContext(function($ctx1) {
  13563. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  13564. else $globals.Array.superclass.fn.prototype._addAll_.call(self, aCollection);
  13565. return aCollection;;
  13566. return self;
  13567. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  13568. },
  13569. args: ["aCollection"],
  13570. 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>",
  13571. referencedClasses: [],
  13572. messageSends: []
  13573. }),
  13574. $globals.Array);
  13575. $core.addMethod(
  13576. $core.method({
  13577. selector: "addFirst:",
  13578. protocol: 'adding/removing',
  13579. fn: function (anObject){
  13580. var self=this;
  13581. return $core.withContext(function($ctx1) {
  13582. self.unshift(anObject); return anObject;;
  13583. return self;
  13584. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  13585. },
  13586. args: ["anObject"],
  13587. source: "addFirst: anObject\x0a\x09<self.unshift(anObject); return anObject;>",
  13588. referencedClasses: [],
  13589. messageSends: []
  13590. }),
  13591. $globals.Array);
  13592. $core.addMethod(
  13593. $core.method({
  13594. selector: "asJavascript",
  13595. protocol: 'converting',
  13596. fn: function (){
  13597. var self=this;
  13598. return $core.withContext(function($ctx1) {
  13599. var $1;
  13600. $1=$recv("[".__comma($recv(self._collect_((function(each){
  13601. return $core.withContext(function($ctx2) {
  13602. return $recv(each)._asJavascript();
  13603. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13604. })))._join_(", "))).__comma("]");
  13605. $ctx1.sendIdx[","]=1;
  13606. return $1;
  13607. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Array)});
  13608. },
  13609. args: [],
  13610. source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'",
  13611. referencedClasses: [],
  13612. messageSends: [",", "join:", "collect:", "asJavascript"]
  13613. }),
  13614. $globals.Array);
  13615. $core.addMethod(
  13616. $core.method({
  13617. selector: "at:ifAbsent:",
  13618. protocol: 'accessing',
  13619. fn: function (anIndex,aBlock){
  13620. var self=this;
  13621. return $core.withContext(function($ctx1) {
  13622. return anIndex >= 1 && anIndex <= self.length
  13623. ? self[anIndex - 1]
  13624. : aBlock._value()
  13625. ;
  13626. return self;
  13627. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  13628. },
  13629. args: ["anIndex", "aBlock"],
  13630. 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>",
  13631. referencedClasses: [],
  13632. messageSends: []
  13633. }),
  13634. $globals.Array);
  13635. $core.addMethod(
  13636. $core.method({
  13637. selector: "at:ifPresent:ifAbsent:",
  13638. protocol: 'accessing',
  13639. fn: function (anIndex,aBlock,anotherBlock){
  13640. var self=this;
  13641. return $core.withContext(function($ctx1) {
  13642. return anIndex >= 1 && anIndex <= self.length
  13643. ? aBlock._value_(self[anIndex - 1])
  13644. : anotherBlock._value()
  13645. ;
  13646. return self;
  13647. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  13648. },
  13649. args: ["anIndex", "aBlock", "anotherBlock"],
  13650. 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>",
  13651. referencedClasses: [],
  13652. messageSends: []
  13653. }),
  13654. $globals.Array);
  13655. $core.addMethod(
  13656. $core.method({
  13657. selector: "at:put:",
  13658. protocol: 'accessing',
  13659. fn: function (anIndex,anObject){
  13660. var self=this;
  13661. return $core.withContext(function($ctx1) {
  13662. return self[anIndex - 1] = anObject;
  13663. return self;
  13664. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  13665. },
  13666. args: ["anIndex", "anObject"],
  13667. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  13668. referencedClasses: [],
  13669. messageSends: []
  13670. }),
  13671. $globals.Array);
  13672. $core.addMethod(
  13673. $core.method({
  13674. selector: "collect:",
  13675. protocol: 'enumerating',
  13676. fn: function (aBlock){
  13677. var self=this;
  13678. return $core.withContext(function($ctx1) {
  13679. return self.map(function(each) {return aBlock._value_(each)});
  13680. return self;
  13681. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  13682. },
  13683. args: ["aBlock"],
  13684. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.map(function(each) {return aBlock._value_(each)})>",
  13685. referencedClasses: [],
  13686. messageSends: []
  13687. }),
  13688. $globals.Array);
  13689. $core.addMethod(
  13690. $core.method({
  13691. selector: "copyFrom:to:",
  13692. protocol: 'copying',
  13693. fn: function (anIndex,anotherIndex){
  13694. var self=this;
  13695. return $core.withContext(function($ctx1) {
  13696. if (anIndex >= 1 && anotherIndex <= self.length) {
  13697. return self.slice(anIndex - 1, anotherIndex);
  13698. } else {
  13699. self._at_(anIndex);
  13700. self._at_(self.length + 1);
  13701. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  13702. };
  13703. return self;
  13704. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  13705. },
  13706. args: ["anIndex", "anotherIndex"],
  13707. 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>",
  13708. referencedClasses: [],
  13709. messageSends: []
  13710. }),
  13711. $globals.Array);
  13712. $core.addMethod(
  13713. $core.method({
  13714. selector: "join:",
  13715. protocol: 'enumerating',
  13716. fn: function (aString){
  13717. var self=this;
  13718. return $core.withContext(function($ctx1) {
  13719. return self.join(aString);
  13720. return self;
  13721. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  13722. },
  13723. args: ["aString"],
  13724. source: "join: aString\x0a\x09<return self.join(aString)>",
  13725. referencedClasses: [],
  13726. messageSends: []
  13727. }),
  13728. $globals.Array);
  13729. $core.addMethod(
  13730. $core.method({
  13731. selector: "numericallyIndexable",
  13732. protocol: 'private',
  13733. fn: function (){
  13734. var self=this;
  13735. return self;
  13736. },
  13737. args: [],
  13738. source: "numericallyIndexable\x0a\x09^ self",
  13739. referencedClasses: [],
  13740. messageSends: []
  13741. }),
  13742. $globals.Array);
  13743. $core.addMethod(
  13744. $core.method({
  13745. selector: "printOn:",
  13746. protocol: 'printing',
  13747. fn: function (aStream){
  13748. var self=this;
  13749. return $core.withContext(function($ctx1) {
  13750. (
  13751. $ctx1.supercall = true,
  13752. $globals.Array.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  13753. $ctx1.supercall = false;
  13754. $ctx1.sendIdx["printOn:"]=1;
  13755. $recv(aStream)._nextPutAll_(" (");
  13756. $ctx1.sendIdx["nextPutAll:"]=1;
  13757. self._do_separatedBy_((function(each){
  13758. return $core.withContext(function($ctx2) {
  13759. return $recv(each)._printOn_(aStream);
  13760. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13761. }),(function(){
  13762. return $core.withContext(function($ctx2) {
  13763. return $recv(aStream)._nextPutAll_(" ");
  13764. $ctx2.sendIdx["nextPutAll:"]=2;
  13765. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13766. }));
  13767. $recv(aStream)._nextPutAll_(")");
  13768. return self;
  13769. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  13770. },
  13771. args: ["aStream"],
  13772. 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: ')'",
  13773. referencedClasses: [],
  13774. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  13775. }),
  13776. $globals.Array);
  13777. $core.addMethod(
  13778. $core.method({
  13779. selector: "remove:ifAbsent:",
  13780. protocol: 'adding/removing',
  13781. fn: function (anObject,aBlock){
  13782. var self=this;
  13783. var index;
  13784. return $core.withContext(function($ctx1) {
  13785. var $2,$1;
  13786. index=self._indexOf_ifAbsent_(anObject,(function(){
  13787. return (0);
  13788. }));
  13789. $2=$recv(index).__eq((0));
  13790. if($core.assert($2)){
  13791. $1=$recv(aBlock)._value();
  13792. } else {
  13793. self._removeIndex_(index);
  13794. $1=anObject;
  13795. };
  13796. return $1;
  13797. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  13798. },
  13799. args: ["anObject", "aBlock"],
  13800. 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 ]",
  13801. referencedClasses: [],
  13802. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  13803. }),
  13804. $globals.Array);
  13805. $core.addMethod(
  13806. $core.method({
  13807. selector: "removeAll",
  13808. protocol: 'adding/removing',
  13809. fn: function (){
  13810. var self=this;
  13811. return $core.withContext(function($ctx1) {
  13812. self.length = 0;
  13813. return self;
  13814. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  13815. },
  13816. args: [],
  13817. source: "removeAll\x0a\x09<self.length = 0>",
  13818. referencedClasses: [],
  13819. messageSends: []
  13820. }),
  13821. $globals.Array);
  13822. $core.addMethod(
  13823. $core.method({
  13824. selector: "removeFrom:to:",
  13825. protocol: 'adding/removing',
  13826. fn: function (aNumber,anotherNumber){
  13827. var self=this;
  13828. return $core.withContext(function($ctx1) {
  13829. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  13830. return self;
  13831. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  13832. },
  13833. args: ["aNumber", "anotherNumber"],
  13834. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber -1, anotherNumber - aNumber + 1)>",
  13835. referencedClasses: [],
  13836. messageSends: []
  13837. }),
  13838. $globals.Array);
  13839. $core.addMethod(
  13840. $core.method({
  13841. selector: "removeIndex:",
  13842. protocol: 'adding/removing',
  13843. fn: function (anInteger){
  13844. var self=this;
  13845. return $core.withContext(function($ctx1) {
  13846. self.splice(anInteger - 1, 1);
  13847. return self;
  13848. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  13849. },
  13850. args: ["anInteger"],
  13851. source: "removeIndex: anInteger\x0a\x09<self.splice(anInteger - 1, 1)>",
  13852. referencedClasses: [],
  13853. messageSends: []
  13854. }),
  13855. $globals.Array);
  13856. $core.addMethod(
  13857. $core.method({
  13858. selector: "removeLast",
  13859. protocol: 'adding/removing',
  13860. fn: function (){
  13861. var self=this;
  13862. return $core.withContext(function($ctx1) {
  13863. return self.pop();;
  13864. return self;
  13865. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  13866. },
  13867. args: [],
  13868. source: "removeLast\x0a\x09<return self.pop();>",
  13869. referencedClasses: [],
  13870. messageSends: []
  13871. }),
  13872. $globals.Array);
  13873. $core.addMethod(
  13874. $core.method({
  13875. selector: "reversed",
  13876. protocol: 'converting',
  13877. fn: function (){
  13878. var self=this;
  13879. return $core.withContext(function($ctx1) {
  13880. return self.slice().reverse();
  13881. return self;
  13882. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  13883. },
  13884. args: [],
  13885. source: "reversed\x0a\x09<return self.slice().reverse()>",
  13886. referencedClasses: [],
  13887. messageSends: []
  13888. }),
  13889. $globals.Array);
  13890. $core.addMethod(
  13891. $core.method({
  13892. selector: "select:",
  13893. protocol: 'enumerating',
  13894. fn: function (aBlock){
  13895. var self=this;
  13896. return $core.withContext(function($ctx1) {
  13897. return self.filter(function(each) {return aBlock._value_(each)});
  13898. return self;
  13899. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  13900. },
  13901. args: ["aBlock"],
  13902. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.filter(function(each) {return aBlock._value_(each)})>",
  13903. referencedClasses: [],
  13904. messageSends: []
  13905. }),
  13906. $globals.Array);
  13907. $core.addMethod(
  13908. $core.method({
  13909. selector: "shallowCopy",
  13910. protocol: 'copying',
  13911. fn: function (){
  13912. var self=this;
  13913. return $core.withContext(function($ctx1) {
  13914. return self.slice();
  13915. return self;
  13916. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  13917. },
  13918. args: [],
  13919. source: "shallowCopy\x0a\x09<return self.slice()>",
  13920. referencedClasses: [],
  13921. messageSends: []
  13922. }),
  13923. $globals.Array);
  13924. $core.addMethod(
  13925. $core.method({
  13926. selector: "size",
  13927. protocol: 'accessing',
  13928. fn: function (){
  13929. var self=this;
  13930. return $core.withContext(function($ctx1) {
  13931. return self.length;
  13932. return self;
  13933. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  13934. },
  13935. args: [],
  13936. source: "size\x0a\x09<return self.length>",
  13937. referencedClasses: [],
  13938. messageSends: []
  13939. }),
  13940. $globals.Array);
  13941. $core.addMethod(
  13942. $core.method({
  13943. selector: "sort",
  13944. protocol: 'enumerating',
  13945. fn: function (){
  13946. var self=this;
  13947. return $core.withContext(function($ctx1) {
  13948. var $1;
  13949. $1=self._sort_((function(a,b){
  13950. return $core.withContext(function($ctx2) {
  13951. return $recv(a).__lt(b);
  13952. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  13953. }));
  13954. return $1;
  13955. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  13956. },
  13957. args: [],
  13958. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  13959. referencedClasses: [],
  13960. messageSends: ["sort:", "<"]
  13961. }),
  13962. $globals.Array);
  13963. $core.addMethod(
  13964. $core.method({
  13965. selector: "sort:",
  13966. protocol: 'enumerating',
  13967. fn: function (aBlock){
  13968. var self=this;
  13969. return $core.withContext(function($ctx1) {
  13970. return self.sort(function(a, b) {
  13971. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  13972. })
  13973. ;
  13974. return self;
  13975. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  13976. },
  13977. args: ["aBlock"],
  13978. 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>",
  13979. referencedClasses: [],
  13980. messageSends: []
  13981. }),
  13982. $globals.Array);
  13983. $core.addMethod(
  13984. $core.method({
  13985. selector: "sorted",
  13986. protocol: 'enumerating',
  13987. fn: function (){
  13988. var self=this;
  13989. return $core.withContext(function($ctx1) {
  13990. var $1;
  13991. $1=$recv(self._copy())._sort();
  13992. return $1;
  13993. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  13994. },
  13995. args: [],
  13996. source: "sorted\x0a\x09^ self copy sort",
  13997. referencedClasses: [],
  13998. messageSends: ["sort", "copy"]
  13999. }),
  14000. $globals.Array);
  14001. $core.addMethod(
  14002. $core.method({
  14003. selector: "sorted:",
  14004. protocol: 'enumerating',
  14005. fn: function (aBlock){
  14006. var self=this;
  14007. return $core.withContext(function($ctx1) {
  14008. var $1;
  14009. $1=$recv(self._copy())._sort_(aBlock);
  14010. return $1;
  14011. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  14012. },
  14013. args: ["aBlock"],
  14014. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  14015. referencedClasses: [],
  14016. messageSends: ["sort:", "copy"]
  14017. }),
  14018. $globals.Array);
  14019. $core.addMethod(
  14020. $core.method({
  14021. selector: "new:",
  14022. protocol: 'instance creation',
  14023. fn: function (anInteger){
  14024. var self=this;
  14025. return $core.withContext(function($ctx1) {
  14026. return new Array(anInteger);
  14027. return self;
  14028. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.klass)});
  14029. },
  14030. args: ["anInteger"],
  14031. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  14032. referencedClasses: [],
  14033. messageSends: []
  14034. }),
  14035. $globals.Array.klass);
  14036. $core.addMethod(
  14037. $core.method({
  14038. selector: "with:",
  14039. protocol: 'instance creation',
  14040. fn: function (anObject){
  14041. var self=this;
  14042. return $core.withContext(function($ctx1) {
  14043. var $2,$3,$1;
  14044. $2=self._new_((1));
  14045. $recv($2)._at_put_((1),anObject);
  14046. $3=$recv($2)._yourself();
  14047. $1=$3;
  14048. return $1;
  14049. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.klass)});
  14050. },
  14051. args: ["anObject"],
  14052. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  14053. referencedClasses: [],
  14054. messageSends: ["at:put:", "new:", "yourself"]
  14055. }),
  14056. $globals.Array.klass);
  14057. $core.addMethod(
  14058. $core.method({
  14059. selector: "with:with:",
  14060. protocol: 'instance creation',
  14061. fn: function (anObject,anObject2){
  14062. var self=this;
  14063. return $core.withContext(function($ctx1) {
  14064. var $2,$3,$1;
  14065. $2=self._new_((2));
  14066. $recv($2)._at_put_((1),anObject);
  14067. $ctx1.sendIdx["at:put:"]=1;
  14068. $recv($2)._at_put_((2),anObject2);
  14069. $3=$recv($2)._yourself();
  14070. $1=$3;
  14071. return $1;
  14072. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.klass)});
  14073. },
  14074. args: ["anObject", "anObject2"],
  14075. 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",
  14076. referencedClasses: [],
  14077. messageSends: ["at:put:", "new:", "yourself"]
  14078. }),
  14079. $globals.Array.klass);
  14080. $core.addMethod(
  14081. $core.method({
  14082. selector: "with:with:with:",
  14083. protocol: 'instance creation',
  14084. fn: function (anObject,anObject2,anObject3){
  14085. var self=this;
  14086. return $core.withContext(function($ctx1) {
  14087. var $2,$3,$1;
  14088. $2=self._new_((3));
  14089. $recv($2)._at_put_((1),anObject);
  14090. $ctx1.sendIdx["at:put:"]=1;
  14091. $recv($2)._at_put_((2),anObject2);
  14092. $ctx1.sendIdx["at:put:"]=2;
  14093. $recv($2)._at_put_((3),anObject3);
  14094. $3=$recv($2)._yourself();
  14095. $1=$3;
  14096. return $1;
  14097. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.klass)});
  14098. },
  14099. args: ["anObject", "anObject2", "anObject3"],
  14100. 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",
  14101. referencedClasses: [],
  14102. messageSends: ["at:put:", "new:", "yourself"]
  14103. }),
  14104. $globals.Array.klass);
  14105. $core.addMethod(
  14106. $core.method({
  14107. selector: "withAll:",
  14108. protocol: 'instance creation',
  14109. fn: function (aCollection){
  14110. var self=this;
  14111. var instance,index;
  14112. return $core.withContext(function($ctx1) {
  14113. var $1;
  14114. index=(1);
  14115. instance=self._new_($recv(aCollection)._size());
  14116. $recv(aCollection)._do_((function(each){
  14117. return $core.withContext(function($ctx2) {
  14118. $recv(instance)._at_put_(index,each);
  14119. index=$recv(index).__plus((1));
  14120. return index;
  14121. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14122. }));
  14123. $1=instance;
  14124. return $1;
  14125. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.klass)});
  14126. },
  14127. args: ["aCollection"],
  14128. 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",
  14129. referencedClasses: [],
  14130. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  14131. }),
  14132. $globals.Array.klass);
  14133. $core.addClass('CharacterArray', $globals.SequenceableCollection, [], 'Kernel-Collections');
  14134. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  14135. $core.addMethod(
  14136. $core.method({
  14137. selector: ",",
  14138. protocol: 'copying',
  14139. fn: function (aString){
  14140. var self=this;
  14141. return $core.withContext(function($ctx1) {
  14142. var $2,$1;
  14143. $2=self._asString();
  14144. $ctx1.sendIdx["asString"]=1;
  14145. $1=$recv($2).__comma($recv(aString)._asString());
  14146. return $1;
  14147. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  14148. },
  14149. args: ["aString"],
  14150. source: ", aString\x0a\x09^ self asString, aString asString",
  14151. referencedClasses: [],
  14152. messageSends: [",", "asString"]
  14153. }),
  14154. $globals.CharacterArray);
  14155. $core.addMethod(
  14156. $core.method({
  14157. selector: "add:",
  14158. protocol: 'adding/removing',
  14159. fn: function (anObject){
  14160. var self=this;
  14161. return $core.withContext(function($ctx1) {
  14162. self._errorReadOnly();
  14163. return self;
  14164. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  14165. },
  14166. args: ["anObject"],
  14167. source: "add: anObject\x0a\x09self errorReadOnly",
  14168. referencedClasses: [],
  14169. messageSends: ["errorReadOnly"]
  14170. }),
  14171. $globals.CharacterArray);
  14172. $core.addMethod(
  14173. $core.method({
  14174. selector: "asLowercase",
  14175. protocol: 'converting',
  14176. fn: function (){
  14177. var self=this;
  14178. return $core.withContext(function($ctx1) {
  14179. var $1;
  14180. $1=$recv(self._class())._fromString_($recv(self._asString())._asLowercase());
  14181. return $1;
  14182. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  14183. },
  14184. args: [],
  14185. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  14186. referencedClasses: [],
  14187. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  14188. }),
  14189. $globals.CharacterArray);
  14190. $core.addMethod(
  14191. $core.method({
  14192. selector: "asNumber",
  14193. protocol: 'converting',
  14194. fn: function (){
  14195. var self=this;
  14196. return $core.withContext(function($ctx1) {
  14197. var $1;
  14198. $1=$recv(self._asString())._asNumber();
  14199. return $1;
  14200. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  14201. },
  14202. args: [],
  14203. source: "asNumber\x0a\x09^ self asString asNumber",
  14204. referencedClasses: [],
  14205. messageSends: ["asNumber", "asString"]
  14206. }),
  14207. $globals.CharacterArray);
  14208. $core.addMethod(
  14209. $core.method({
  14210. selector: "asString",
  14211. protocol: 'converting',
  14212. fn: function (){
  14213. var self=this;
  14214. return $core.withContext(function($ctx1) {
  14215. var $1;
  14216. $1=self._subclassResponsibility();
  14217. return $1;
  14218. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  14219. },
  14220. args: [],
  14221. source: "asString\x0a\x09^ self subclassResponsibility",
  14222. referencedClasses: [],
  14223. messageSends: ["subclassResponsibility"]
  14224. }),
  14225. $globals.CharacterArray);
  14226. $core.addMethod(
  14227. $core.method({
  14228. selector: "asSymbol",
  14229. protocol: 'converting',
  14230. fn: function (){
  14231. var self=this;
  14232. return $core.withContext(function($ctx1) {
  14233. var $1;
  14234. $1=self._asString();
  14235. return $1;
  14236. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  14237. },
  14238. args: [],
  14239. source: "asSymbol\x0a\x09^ self asString",
  14240. referencedClasses: [],
  14241. messageSends: ["asString"]
  14242. }),
  14243. $globals.CharacterArray);
  14244. $core.addMethod(
  14245. $core.method({
  14246. selector: "asUppercase",
  14247. protocol: 'converting',
  14248. fn: function (){
  14249. var self=this;
  14250. return $core.withContext(function($ctx1) {
  14251. var $1;
  14252. $1=$recv(self._class())._fromString_($recv(self._asString())._asUppercase());
  14253. return $1;
  14254. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  14255. },
  14256. args: [],
  14257. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  14258. referencedClasses: [],
  14259. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  14260. }),
  14261. $globals.CharacterArray);
  14262. $core.addMethod(
  14263. $core.method({
  14264. selector: "at:put:",
  14265. protocol: 'accessing',
  14266. fn: function (anIndex,anObject){
  14267. var self=this;
  14268. return $core.withContext(function($ctx1) {
  14269. self._errorReadOnly();
  14270. return self;
  14271. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  14272. },
  14273. args: ["anIndex", "anObject"],
  14274. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  14275. referencedClasses: [],
  14276. messageSends: ["errorReadOnly"]
  14277. }),
  14278. $globals.CharacterArray);
  14279. $core.addMethod(
  14280. $core.method({
  14281. selector: "errorReadOnly",
  14282. protocol: 'error handling',
  14283. fn: function (){
  14284. var self=this;
  14285. return $core.withContext(function($ctx1) {
  14286. self._error_("Object is read-only");
  14287. return self;
  14288. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  14289. },
  14290. args: [],
  14291. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  14292. referencedClasses: [],
  14293. messageSends: ["error:"]
  14294. }),
  14295. $globals.CharacterArray);
  14296. $core.addMethod(
  14297. $core.method({
  14298. selector: "printOn:",
  14299. protocol: 'printing',
  14300. fn: function (aStream){
  14301. var self=this;
  14302. return $core.withContext(function($ctx1) {
  14303. $recv(self._asString())._printOn_(aStream);
  14304. return self;
  14305. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  14306. },
  14307. args: ["aStream"],
  14308. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  14309. referencedClasses: [],
  14310. messageSends: ["printOn:", "asString"]
  14311. }),
  14312. $globals.CharacterArray);
  14313. $core.addMethod(
  14314. $core.method({
  14315. selector: "putOn:",
  14316. protocol: 'streaming',
  14317. fn: function (aStream){
  14318. var self=this;
  14319. return $core.withContext(function($ctx1) {
  14320. $recv(aStream)._nextPutString_(self);
  14321. return self;
  14322. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  14323. },
  14324. args: ["aStream"],
  14325. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  14326. referencedClasses: [],
  14327. messageSends: ["nextPutString:"]
  14328. }),
  14329. $globals.CharacterArray);
  14330. $core.addMethod(
  14331. $core.method({
  14332. selector: "remove:",
  14333. protocol: 'adding/removing',
  14334. fn: function (anObject){
  14335. var self=this;
  14336. return $core.withContext(function($ctx1) {
  14337. self._errorReadOnly();
  14338. return self;
  14339. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  14340. },
  14341. args: ["anObject"],
  14342. source: "remove: anObject\x0a\x09self errorReadOnly",
  14343. referencedClasses: [],
  14344. messageSends: ["errorReadOnly"]
  14345. }),
  14346. $globals.CharacterArray);
  14347. $core.addMethod(
  14348. $core.method({
  14349. selector: "fromString:",
  14350. protocol: 'instance creation',
  14351. fn: function (aString){
  14352. var self=this;
  14353. return $core.withContext(function($ctx1) {
  14354. self._subclassResponsibility();
  14355. return self;
  14356. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.klass)});
  14357. },
  14358. args: ["aString"],
  14359. source: "fromString: aString\x0a\x09self subclassResponsibility",
  14360. referencedClasses: [],
  14361. messageSends: ["subclassResponsibility"]
  14362. }),
  14363. $globals.CharacterArray.klass);
  14364. $core.addClass('String', $globals.CharacterArray, [], 'Kernel-Collections');
  14365. $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 >> #,`";
  14366. $core.addMethod(
  14367. $core.method({
  14368. selector: ",",
  14369. protocol: 'copying',
  14370. fn: function (aString){
  14371. var self=this;
  14372. return $core.withContext(function($ctx1) {
  14373. return String(self) + aString;
  14374. return self;
  14375. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  14376. },
  14377. args: ["aString"],
  14378. source: ", aString\x0a\x09<return String(self) + aString>",
  14379. referencedClasses: [],
  14380. messageSends: []
  14381. }),
  14382. $globals.String);
  14383. $core.addMethod(
  14384. $core.method({
  14385. selector: "<",
  14386. protocol: 'comparing',
  14387. fn: function (aString){
  14388. var self=this;
  14389. return $core.withContext(function($ctx1) {
  14390. return String(self) < aString._asString();
  14391. return self;
  14392. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  14393. },
  14394. args: ["aString"],
  14395. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  14396. referencedClasses: [],
  14397. messageSends: []
  14398. }),
  14399. $globals.String);
  14400. $core.addMethod(
  14401. $core.method({
  14402. selector: "<=",
  14403. protocol: 'comparing',
  14404. fn: function (aString){
  14405. var self=this;
  14406. return $core.withContext(function($ctx1) {
  14407. return String(self) <= aString._asString();
  14408. return self;
  14409. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  14410. },
  14411. args: ["aString"],
  14412. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  14413. referencedClasses: [],
  14414. messageSends: []
  14415. }),
  14416. $globals.String);
  14417. $core.addMethod(
  14418. $core.method({
  14419. selector: "=",
  14420. protocol: 'comparing',
  14421. fn: function (aString){
  14422. var self=this;
  14423. return $core.withContext(function($ctx1) {
  14424. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  14425. return self;
  14426. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  14427. },
  14428. args: ["aString"],
  14429. source: "= aString\x0a<return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())>",
  14430. referencedClasses: [],
  14431. messageSends: []
  14432. }),
  14433. $globals.String);
  14434. $core.addMethod(
  14435. $core.method({
  14436. selector: "==",
  14437. protocol: 'comparing',
  14438. fn: function (aString){
  14439. var self=this;
  14440. return $core.withContext(function($ctx1) {
  14441. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  14442. return self;
  14443. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  14444. },
  14445. args: ["aString"],
  14446. source: "== aString\x0a<return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())>",
  14447. referencedClasses: [],
  14448. messageSends: []
  14449. }),
  14450. $globals.String);
  14451. $core.addMethod(
  14452. $core.method({
  14453. selector: ">",
  14454. protocol: 'comparing',
  14455. fn: function (aString){
  14456. var self=this;
  14457. return $core.withContext(function($ctx1) {
  14458. return String(self) > aString._asString();
  14459. return self;
  14460. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  14461. },
  14462. args: ["aString"],
  14463. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  14464. referencedClasses: [],
  14465. messageSends: []
  14466. }),
  14467. $globals.String);
  14468. $core.addMethod(
  14469. $core.method({
  14470. selector: ">=",
  14471. protocol: 'comparing',
  14472. fn: function (aString){
  14473. var self=this;
  14474. return $core.withContext(function($ctx1) {
  14475. return String(self) >= aString._asString();
  14476. return self;
  14477. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  14478. },
  14479. args: ["aString"],
  14480. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  14481. referencedClasses: [],
  14482. messageSends: []
  14483. }),
  14484. $globals.String);
  14485. $core.addMethod(
  14486. $core.method({
  14487. selector: "asJSON",
  14488. protocol: 'converting',
  14489. fn: function (){
  14490. var self=this;
  14491. return self;
  14492. },
  14493. args: [],
  14494. source: "asJSON\x0a\x09^ self",
  14495. referencedClasses: [],
  14496. messageSends: []
  14497. }),
  14498. $globals.String);
  14499. $core.addMethod(
  14500. $core.method({
  14501. selector: "asJavaScriptMethodName",
  14502. protocol: 'converting',
  14503. fn: function (){
  14504. var self=this;
  14505. return $core.withContext(function($ctx1) {
  14506. return $core.st2js(self);
  14507. return self;
  14508. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  14509. },
  14510. args: [],
  14511. source: "asJavaScriptMethodName\x0a\x09<return $core.st2js(self)>",
  14512. referencedClasses: [],
  14513. messageSends: []
  14514. }),
  14515. $globals.String);
  14516. $core.addMethod(
  14517. $core.method({
  14518. selector: "asJavascript",
  14519. protocol: 'converting',
  14520. fn: function (){
  14521. var self=this;
  14522. return $core.withContext(function($ctx1) {
  14523. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  14524. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  14525. else
  14526. return "\"" + self + "\"";
  14527. ;
  14528. return self;
  14529. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.String)});
  14530. },
  14531. args: [],
  14532. 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>",
  14533. referencedClasses: [],
  14534. messageSends: []
  14535. }),
  14536. $globals.String);
  14537. $core.addMethod(
  14538. $core.method({
  14539. selector: "asLowercase",
  14540. protocol: 'converting',
  14541. fn: function (){
  14542. var self=this;
  14543. return $core.withContext(function($ctx1) {
  14544. return self.toLowerCase();
  14545. return self;
  14546. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  14547. },
  14548. args: [],
  14549. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  14550. referencedClasses: [],
  14551. messageSends: []
  14552. }),
  14553. $globals.String);
  14554. $core.addMethod(
  14555. $core.method({
  14556. selector: "asMutator",
  14557. protocol: 'converting',
  14558. fn: function (){
  14559. var self=this;
  14560. return $core.withContext(function($ctx1) {
  14561. var $1,$2;
  14562. $1=$recv(self._last()).__eq(":");
  14563. if(!$core.assert($1)){
  14564. $2=self.__comma(":");
  14565. return $2;
  14566. };
  14567. return self;
  14568. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  14569. },
  14570. args: [],
  14571. 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",
  14572. referencedClasses: [],
  14573. messageSends: ["ifFalse:", "=", "last", ","]
  14574. }),
  14575. $globals.String);
  14576. $core.addMethod(
  14577. $core.method({
  14578. selector: "asNumber",
  14579. protocol: 'converting',
  14580. fn: function (){
  14581. var self=this;
  14582. return $core.withContext(function($ctx1) {
  14583. return Number(self);
  14584. return self;
  14585. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  14586. },
  14587. args: [],
  14588. source: "asNumber\x0a\x09<return Number(self)>",
  14589. referencedClasses: [],
  14590. messageSends: []
  14591. }),
  14592. $globals.String);
  14593. $core.addMethod(
  14594. $core.method({
  14595. selector: "asRegexp",
  14596. protocol: 'converting',
  14597. fn: function (){
  14598. var self=this;
  14599. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  14600. return $core.withContext(function($ctx1) {
  14601. var $1;
  14602. $1=$recv($RegularExpression())._fromString_(self);
  14603. return $1;
  14604. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  14605. },
  14606. args: [],
  14607. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  14608. referencedClasses: ["RegularExpression"],
  14609. messageSends: ["fromString:"]
  14610. }),
  14611. $globals.String);
  14612. $core.addMethod(
  14613. $core.method({
  14614. selector: "asString",
  14615. protocol: 'converting',
  14616. fn: function (){
  14617. var self=this;
  14618. return self;
  14619. },
  14620. args: [],
  14621. source: "asString\x0a\x09^ self",
  14622. referencedClasses: [],
  14623. messageSends: []
  14624. }),
  14625. $globals.String);
  14626. $core.addMethod(
  14627. $core.method({
  14628. selector: "asSymbol",
  14629. protocol: 'converting',
  14630. fn: function (){
  14631. var self=this;
  14632. return self;
  14633. },
  14634. args: [],
  14635. source: "asSymbol\x0a\x09^ self",
  14636. referencedClasses: [],
  14637. messageSends: []
  14638. }),
  14639. $globals.String);
  14640. $core.addMethod(
  14641. $core.method({
  14642. selector: "asUppercase",
  14643. protocol: 'converting',
  14644. fn: function (){
  14645. var self=this;
  14646. return $core.withContext(function($ctx1) {
  14647. return self.toUpperCase();
  14648. return self;
  14649. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  14650. },
  14651. args: [],
  14652. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  14653. referencedClasses: [],
  14654. messageSends: []
  14655. }),
  14656. $globals.String);
  14657. $core.addMethod(
  14658. $core.method({
  14659. selector: "asciiValue",
  14660. protocol: 'accessing',
  14661. fn: function (){
  14662. var self=this;
  14663. return $core.withContext(function($ctx1) {
  14664. return self.charCodeAt(0);;
  14665. return self;
  14666. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  14667. },
  14668. args: [],
  14669. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  14670. referencedClasses: [],
  14671. messageSends: []
  14672. }),
  14673. $globals.String);
  14674. $core.addMethod(
  14675. $core.method({
  14676. selector: "at:ifAbsent:",
  14677. protocol: 'accessing',
  14678. fn: function (anIndex,aBlock){
  14679. var self=this;
  14680. return $core.withContext(function($ctx1) {
  14681. return String(self)[anIndex - 1] || aBlock._value();
  14682. return self;
  14683. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  14684. },
  14685. args: ["anIndex", "aBlock"],
  14686. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self)[anIndex - 1] || aBlock._value()>",
  14687. referencedClasses: [],
  14688. messageSends: []
  14689. }),
  14690. $globals.String);
  14691. $core.addMethod(
  14692. $core.method({
  14693. selector: "at:ifPresent:ifAbsent:",
  14694. protocol: 'accessing',
  14695. fn: function (anIndex,aBlock,anotherBlock){
  14696. var self=this;
  14697. return $core.withContext(function($ctx1) {
  14698. var result = String(self)[anIndex - 1];
  14699. return result ? aBlock._value_(result) : anotherBlock._value();
  14700. ;
  14701. return self;
  14702. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  14703. },
  14704. args: ["anIndex", "aBlock", "anotherBlock"],
  14705. 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>",
  14706. referencedClasses: [],
  14707. messageSends: []
  14708. }),
  14709. $globals.String);
  14710. $core.addMethod(
  14711. $core.method({
  14712. selector: "capitalized",
  14713. protocol: 'converting',
  14714. fn: function (){
  14715. var self=this;
  14716. return $core.withContext(function($ctx1) {
  14717. var $2,$1;
  14718. $2=self._isEmpty();
  14719. if($core.assert($2)){
  14720. $1=self;
  14721. } else {
  14722. $1=$recv($recv(self._first())._asUppercase()).__comma(self._allButFirst());
  14723. };
  14724. return $1;
  14725. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  14726. },
  14727. args: [],
  14728. source: "capitalized\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self first asUppercase, self allButFirst ]",
  14729. referencedClasses: [],
  14730. messageSends: ["ifTrue:ifFalse:", "isEmpty", ",", "asUppercase", "first", "allButFirst"]
  14731. }),
  14732. $globals.String);
  14733. $core.addMethod(
  14734. $core.method({
  14735. selector: "charCodeAt:",
  14736. protocol: 'accessing',
  14737. fn: function (anInteger){
  14738. var self=this;
  14739. return $core.withContext(function($ctx1) {
  14740. return self.charCodeAt(anInteger - 1);
  14741. return self;
  14742. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  14743. },
  14744. args: ["anInteger"],
  14745. source: "charCodeAt: anInteger\x0a\x09<return self.charCodeAt(anInteger - 1)>",
  14746. referencedClasses: [],
  14747. messageSends: []
  14748. }),
  14749. $globals.String);
  14750. $core.addMethod(
  14751. $core.method({
  14752. selector: "copyFrom:to:",
  14753. protocol: 'copying',
  14754. fn: function (anIndex,anotherIndex){
  14755. var self=this;
  14756. return $core.withContext(function($ctx1) {
  14757. return self.substring(anIndex - 1, anotherIndex);
  14758. return self;
  14759. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  14760. },
  14761. args: ["anIndex", "anotherIndex"],
  14762. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  14763. referencedClasses: [],
  14764. messageSends: []
  14765. }),
  14766. $globals.String);
  14767. $core.addMethod(
  14768. $core.method({
  14769. selector: "crlfSanitized",
  14770. protocol: 'converting',
  14771. fn: function (){
  14772. var self=this;
  14773. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  14774. return $core.withContext(function($ctx1) {
  14775. var $1;
  14776. $1=$recv(self._lines())._join_($recv($String())._lf());
  14777. return $1;
  14778. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  14779. },
  14780. args: [],
  14781. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  14782. referencedClasses: ["String"],
  14783. messageSends: ["join:", "lines", "lf"]
  14784. }),
  14785. $globals.String);
  14786. $core.addMethod(
  14787. $core.method({
  14788. selector: "deepCopy",
  14789. protocol: 'copying',
  14790. fn: function (){
  14791. var self=this;
  14792. return $core.withContext(function($ctx1) {
  14793. var $1;
  14794. $1=self._shallowCopy();
  14795. return $1;
  14796. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  14797. },
  14798. args: [],
  14799. source: "deepCopy\x0a\x09^ self shallowCopy",
  14800. referencedClasses: [],
  14801. messageSends: ["shallowCopy"]
  14802. }),
  14803. $globals.String);
  14804. $core.addMethod(
  14805. $core.method({
  14806. selector: "escaped",
  14807. protocol: 'converting',
  14808. fn: function (){
  14809. var self=this;
  14810. return $core.withContext(function($ctx1) {
  14811. return escape(self);
  14812. return self;
  14813. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  14814. },
  14815. args: [],
  14816. source: "escaped\x0a\x09<return escape(self)>",
  14817. referencedClasses: [],
  14818. messageSends: []
  14819. }),
  14820. $globals.String);
  14821. $core.addMethod(
  14822. $core.method({
  14823. selector: "includesSubString:",
  14824. protocol: 'testing',
  14825. fn: function (subString){
  14826. var self=this;
  14827. return $core.withContext(function($ctx1) {
  14828. return self.indexOf(subString) != -1;
  14829. return self;
  14830. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  14831. },
  14832. args: ["subString"],
  14833. source: "includesSubString: subString\x0a\x09<return self.indexOf(subString) != -1>",
  14834. referencedClasses: [],
  14835. messageSends: []
  14836. }),
  14837. $globals.String);
  14838. $core.addMethod(
  14839. $core.method({
  14840. selector: "isCapitalized",
  14841. protocol: 'testing',
  14842. fn: function (){
  14843. var self=this;
  14844. return $core.withContext(function($ctx1) {
  14845. var $3,$2,$1;
  14846. $3=self._first();
  14847. $ctx1.sendIdx["first"]=1;
  14848. $2=$recv($3)._asUppercase();
  14849. $1=$recv($2).__eq_eq(self._first());
  14850. return $1;
  14851. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  14852. },
  14853. args: [],
  14854. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  14855. referencedClasses: [],
  14856. messageSends: ["==", "asUppercase", "first"]
  14857. }),
  14858. $globals.String);
  14859. $core.addMethod(
  14860. $core.method({
  14861. selector: "isImmutable",
  14862. protocol: 'testing',
  14863. fn: function (){
  14864. var self=this;
  14865. return true;
  14866. },
  14867. args: [],
  14868. source: "isImmutable\x0a\x09^ true",
  14869. referencedClasses: [],
  14870. messageSends: []
  14871. }),
  14872. $globals.String);
  14873. $core.addMethod(
  14874. $core.method({
  14875. selector: "isString",
  14876. protocol: 'testing',
  14877. fn: function (){
  14878. var self=this;
  14879. return true;
  14880. },
  14881. args: [],
  14882. source: "isString\x0a\x09^ true",
  14883. referencedClasses: [],
  14884. messageSends: []
  14885. }),
  14886. $globals.String);
  14887. $core.addMethod(
  14888. $core.method({
  14889. selector: "isVowel",
  14890. protocol: 'testing',
  14891. fn: function (){
  14892. var self=this;
  14893. return $core.withContext(function($ctx1) {
  14894. var $1;
  14895. $1=$recv($recv(self._size()).__eq((1)))._and_((function(){
  14896. return $core.withContext(function($ctx2) {
  14897. return "aeiou"._includes_(self._asLowercase());
  14898. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14899. }));
  14900. return $1;
  14901. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  14902. },
  14903. args: [],
  14904. 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 ]",
  14905. referencedClasses: [],
  14906. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  14907. }),
  14908. $globals.String);
  14909. $core.addMethod(
  14910. $core.method({
  14911. selector: "join:",
  14912. protocol: 'split join',
  14913. fn: function (aCollection){
  14914. var self=this;
  14915. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  14916. return $core.withContext(function($ctx1) {
  14917. var $1;
  14918. $1=$recv($String())._streamContents_((function(stream){
  14919. return $core.withContext(function($ctx2) {
  14920. return $recv(aCollection)._do_separatedBy_((function(each){
  14921. return $core.withContext(function($ctx3) {
  14922. return $recv(stream)._nextPutAll_($recv(each)._asString());
  14923. $ctx3.sendIdx["nextPutAll:"]=1;
  14924. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14925. }),(function(){
  14926. return $core.withContext(function($ctx3) {
  14927. return $recv(stream)._nextPutAll_(self);
  14928. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  14929. }));
  14930. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14931. }));
  14932. return $1;
  14933. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  14934. },
  14935. args: ["aCollection"],
  14936. 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 ]]",
  14937. referencedClasses: ["String"],
  14938. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  14939. }),
  14940. $globals.String);
  14941. $core.addMethod(
  14942. $core.method({
  14943. selector: "lineIndicesDo:",
  14944. protocol: 'split join',
  14945. fn: function (aBlock){
  14946. var self=this;
  14947. var cr,lf,start,sz,nextLF,nextCR;
  14948. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  14949. return $core.withContext(function($ctx1) {
  14950. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  14951. var $early={};
  14952. try {
  14953. start=(1);
  14954. sz=self._size();
  14955. cr=$recv($String())._cr();
  14956. nextCR=self._indexOf_startingAt_(cr,(1));
  14957. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  14958. lf=$recv($String())._lf();
  14959. nextLF=self._indexOf_startingAt_(lf,(1));
  14960. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  14961. $recv((function(){
  14962. return $core.withContext(function($ctx2) {
  14963. return $recv(start).__lt_eq(sz);
  14964. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14965. }))._whileTrue_((function(){
  14966. return $core.withContext(function($ctx2) {
  14967. $2=$recv(nextLF).__eq((0));
  14968. $ctx2.sendIdx["="]=1;
  14969. $1=$recv($2)._and_((function(){
  14970. return $core.withContext(function($ctx3) {
  14971. return $recv(nextCR).__eq((0));
  14972. $ctx3.sendIdx["="]=2;
  14973. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  14974. }));
  14975. $ctx2.sendIdx["and:"]=1;
  14976. if($core.assert($1)){
  14977. $recv(aBlock)._value_value_value_(start,sz,sz);
  14978. $ctx2.sendIdx["value:value:value:"]=1;
  14979. throw $early=[self];
  14980. };
  14981. $4=$recv(nextCR).__eq((0));
  14982. $ctx2.sendIdx["="]=3;
  14983. $3=$recv($4)._or_((function(){
  14984. return $core.withContext(function($ctx3) {
  14985. $5=(0).__lt(nextLF);
  14986. $ctx3.sendIdx["<"]=1;
  14987. return $recv($5)._and_((function(){
  14988. return $core.withContext(function($ctx4) {
  14989. return $recv(nextLF).__lt(nextCR);
  14990. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  14991. }));
  14992. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  14993. }));
  14994. if($core.assert($3)){
  14995. $6=start;
  14996. $7=$recv(nextLF).__minus((1));
  14997. $ctx2.sendIdx["-"]=1;
  14998. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  14999. $ctx2.sendIdx["value:value:value:"]=2;
  15000. start=(1).__plus(nextLF);
  15001. $ctx2.sendIdx["+"]=1;
  15002. start;
  15003. nextLF=self._indexOf_startingAt_(lf,start);
  15004. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  15005. return nextLF;
  15006. } else {
  15007. $9=(1).__plus(nextCR);
  15008. $ctx2.sendIdx["+"]=2;
  15009. $8=$recv($9).__eq(nextLF);
  15010. if($core.assert($8)){
  15011. $10=start;
  15012. $11=$recv(nextCR).__minus((1));
  15013. $ctx2.sendIdx["-"]=2;
  15014. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  15015. $ctx2.sendIdx["value:value:value:"]=3;
  15016. start=(1).__plus(nextLF);
  15017. $ctx2.sendIdx["+"]=3;
  15018. start;
  15019. nextCR=self._indexOf_startingAt_(cr,start);
  15020. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  15021. nextCR;
  15022. nextLF=self._indexOf_startingAt_(lf,start);
  15023. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  15024. return nextLF;
  15025. } else {
  15026. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  15027. start=(1).__plus(nextCR);
  15028. start;
  15029. nextCR=self._indexOf_startingAt_(cr,start);
  15030. return nextCR;
  15031. };
  15032. };
  15033. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15034. }));
  15035. return self;
  15036. }
  15037. catch(e) {if(e===$early)return e[0]; throw e}
  15038. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  15039. },
  15040. args: ["aBlock"],
  15041. 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 ] ]]",
  15042. referencedClasses: ["String"],
  15043. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  15044. }),
  15045. $globals.String);
  15046. $core.addMethod(
  15047. $core.method({
  15048. selector: "lineNumber:",
  15049. protocol: 'split join',
  15050. fn: function (anIndex){
  15051. var self=this;
  15052. var lineCount;
  15053. return $core.withContext(function($ctx1) {
  15054. var $2,$1,$3;
  15055. var $early={};
  15056. try {
  15057. lineCount=(0);
  15058. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  15059. return $core.withContext(function($ctx2) {
  15060. lineCount=$recv(lineCount).__plus((1));
  15061. $2=lineCount;
  15062. $1=$recv($2).__eq(anIndex);
  15063. if($core.assert($1)){
  15064. $3=self._copyFrom_to_(start,endWithoutDelimiters);
  15065. throw $early=[$3];
  15066. };
  15067. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  15068. }));
  15069. return nil;
  15070. }
  15071. catch(e) {if(e===$early)return e[0]; throw e}
  15072. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  15073. },
  15074. args: ["anIndex"],
  15075. 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",
  15076. referencedClasses: [],
  15077. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  15078. }),
  15079. $globals.String);
  15080. $core.addMethod(
  15081. $core.method({
  15082. selector: "lines",
  15083. protocol: 'split join',
  15084. fn: function (){
  15085. var self=this;
  15086. return $core.withContext(function($ctx1) {
  15087. var result = self.split(/\r\n|\r|\n/);
  15088. if (!result[result.length-1]) result.pop();
  15089. return result;;
  15090. return self;
  15091. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  15092. },
  15093. args: [],
  15094. 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>",
  15095. referencedClasses: [],
  15096. messageSends: []
  15097. }),
  15098. $globals.String);
  15099. $core.addMethod(
  15100. $core.method({
  15101. selector: "linesDo:",
  15102. protocol: 'split join',
  15103. fn: function (aBlock){
  15104. var self=this;
  15105. return $core.withContext(function($ctx1) {
  15106. $recv(self._lines())._do_(aBlock);
  15107. return self;
  15108. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  15109. },
  15110. args: ["aBlock"],
  15111. 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",
  15112. referencedClasses: [],
  15113. messageSends: ["do:", "lines"]
  15114. }),
  15115. $globals.String);
  15116. $core.addMethod(
  15117. $core.method({
  15118. selector: "match:",
  15119. protocol: 'regular expressions',
  15120. fn: function (aRegexp){
  15121. var self=this;
  15122. return $core.withContext(function($ctx1) {
  15123. return self.search(aRegexp) != -1;
  15124. return self;
  15125. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  15126. },
  15127. args: ["aRegexp"],
  15128. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  15129. referencedClasses: [],
  15130. messageSends: []
  15131. }),
  15132. $globals.String);
  15133. $core.addMethod(
  15134. $core.method({
  15135. selector: "matchesOf:",
  15136. protocol: 'regular expressions',
  15137. fn: function (aRegularExpression){
  15138. var self=this;
  15139. return $core.withContext(function($ctx1) {
  15140. return self.match(aRegularExpression);
  15141. return self;
  15142. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  15143. },
  15144. args: ["aRegularExpression"],
  15145. source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
  15146. referencedClasses: [],
  15147. messageSends: []
  15148. }),
  15149. $globals.String);
  15150. $core.addMethod(
  15151. $core.method({
  15152. selector: "numericallyIndexable",
  15153. protocol: 'private',
  15154. fn: function (){
  15155. var self=this;
  15156. return $core.withContext(function($ctx1) {
  15157. return String(self);
  15158. return self;
  15159. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  15160. },
  15161. args: [],
  15162. source: "numericallyIndexable\x0a\x09<return String(self)>",
  15163. referencedClasses: [],
  15164. messageSends: []
  15165. }),
  15166. $globals.String);
  15167. $core.addMethod(
  15168. $core.method({
  15169. selector: "printNl",
  15170. protocol: 'printing',
  15171. fn: function (){
  15172. var self=this;
  15173. return $core.withContext(function($ctx1) {
  15174. console.log(self);
  15175. return self;
  15176. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  15177. },
  15178. args: [],
  15179. source: "printNl\x0a\x09<console.log(self)>",
  15180. referencedClasses: [],
  15181. messageSends: []
  15182. }),
  15183. $globals.String);
  15184. $core.addMethod(
  15185. $core.method({
  15186. selector: "printOn:",
  15187. protocol: 'printing',
  15188. fn: function (aStream){
  15189. var self=this;
  15190. return $core.withContext(function($ctx1) {
  15191. var $1;
  15192. $recv(aStream)._nextPutAll_("'");
  15193. $ctx1.sendIdx["nextPutAll:"]=1;
  15194. $recv(aStream)._nextPutAll_(self);
  15195. $ctx1.sendIdx["nextPutAll:"]=2;
  15196. $1=$recv(aStream)._nextPutAll_("'");
  15197. return self;
  15198. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  15199. },
  15200. args: ["aStream"],
  15201. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  15202. referencedClasses: [],
  15203. messageSends: ["nextPutAll:"]
  15204. }),
  15205. $globals.String);
  15206. $core.addMethod(
  15207. $core.method({
  15208. selector: "replace:with:",
  15209. protocol: 'regular expressions',
  15210. fn: function (aString,anotherString){
  15211. var self=this;
  15212. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  15213. return $core.withContext(function($ctx1) {
  15214. var $1;
  15215. $1=self._replaceRegexp_with_($recv($RegularExpression())._fromString_flag_(aString,"g"),anotherString);
  15216. return $1;
  15217. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  15218. },
  15219. args: ["aString", "anotherString"],
  15220. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  15221. referencedClasses: ["RegularExpression"],
  15222. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  15223. }),
  15224. $globals.String);
  15225. $core.addMethod(
  15226. $core.method({
  15227. selector: "replaceRegexp:with:",
  15228. protocol: 'regular expressions',
  15229. fn: function (aRegexp,aString){
  15230. var self=this;
  15231. return $core.withContext(function($ctx1) {
  15232. return self.replace(aRegexp, aString);
  15233. return self;
  15234. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  15235. },
  15236. args: ["aRegexp", "aString"],
  15237. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  15238. referencedClasses: [],
  15239. messageSends: []
  15240. }),
  15241. $globals.String);
  15242. $core.addMethod(
  15243. $core.method({
  15244. selector: "reversed",
  15245. protocol: 'converting',
  15246. fn: function (){
  15247. var self=this;
  15248. return $core.withContext(function($ctx1) {
  15249. return self.split("").reverse().join("");
  15250. return self;
  15251. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  15252. },
  15253. args: [],
  15254. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  15255. referencedClasses: [],
  15256. messageSends: []
  15257. }),
  15258. $globals.String);
  15259. $core.addMethod(
  15260. $core.method({
  15261. selector: "shallowCopy",
  15262. protocol: 'copying',
  15263. fn: function (){
  15264. var self=this;
  15265. return self;
  15266. },
  15267. args: [],
  15268. source: "shallowCopy\x0a\x09^ self",
  15269. referencedClasses: [],
  15270. messageSends: []
  15271. }),
  15272. $globals.String);
  15273. $core.addMethod(
  15274. $core.method({
  15275. selector: "size",
  15276. protocol: 'accessing',
  15277. fn: function (){
  15278. var self=this;
  15279. return $core.withContext(function($ctx1) {
  15280. return self.length;
  15281. return self;
  15282. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  15283. },
  15284. args: [],
  15285. source: "size\x0a\x09<return self.length>",
  15286. referencedClasses: [],
  15287. messageSends: []
  15288. }),
  15289. $globals.String);
  15290. $core.addMethod(
  15291. $core.method({
  15292. selector: "subStrings:",
  15293. protocol: 'split join',
  15294. fn: function (aString){
  15295. var self=this;
  15296. return $core.withContext(function($ctx1) {
  15297. var $1;
  15298. $1=self._tokenize_(aString);
  15299. return $1;
  15300. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  15301. },
  15302. args: ["aString"],
  15303. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  15304. referencedClasses: [],
  15305. messageSends: ["tokenize:"]
  15306. }),
  15307. $globals.String);
  15308. $core.addMethod(
  15309. $core.method({
  15310. selector: "tokenize:",
  15311. protocol: 'split join',
  15312. fn: function (aString){
  15313. var self=this;
  15314. return $core.withContext(function($ctx1) {
  15315. return self.split(aString);
  15316. return self;
  15317. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  15318. },
  15319. args: ["aString"],
  15320. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  15321. referencedClasses: [],
  15322. messageSends: []
  15323. }),
  15324. $globals.String);
  15325. $core.addMethod(
  15326. $core.method({
  15327. selector: "trimBoth",
  15328. protocol: 'regular expressions',
  15329. fn: function (){
  15330. var self=this;
  15331. return $core.withContext(function($ctx1) {
  15332. var $1;
  15333. $1=self._trimBoth_("\x5cs");
  15334. return $1;
  15335. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  15336. },
  15337. args: [],
  15338. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  15339. referencedClasses: [],
  15340. messageSends: ["trimBoth:"]
  15341. }),
  15342. $globals.String);
  15343. $core.addMethod(
  15344. $core.method({
  15345. selector: "trimBoth:",
  15346. protocol: 'regular expressions',
  15347. fn: function (separators){
  15348. var self=this;
  15349. return $core.withContext(function($ctx1) {
  15350. var $1;
  15351. $1=$recv(self._trimLeft_(separators))._trimRight_(separators);
  15352. return $1;
  15353. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  15354. },
  15355. args: ["separators"],
  15356. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  15357. referencedClasses: [],
  15358. messageSends: ["trimRight:", "trimLeft:"]
  15359. }),
  15360. $globals.String);
  15361. $core.addMethod(
  15362. $core.method({
  15363. selector: "trimLeft",
  15364. protocol: 'regular expressions',
  15365. fn: function (){
  15366. var self=this;
  15367. return $core.withContext(function($ctx1) {
  15368. var $1;
  15369. $1=self._trimLeft_("\x5cs");
  15370. return $1;
  15371. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  15372. },
  15373. args: [],
  15374. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  15375. referencedClasses: [],
  15376. messageSends: ["trimLeft:"]
  15377. }),
  15378. $globals.String);
  15379. $core.addMethod(
  15380. $core.method({
  15381. selector: "trimLeft:",
  15382. protocol: 'regular expressions',
  15383. fn: function (separators){
  15384. var self=this;
  15385. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  15386. return $core.withContext(function($ctx1) {
  15387. var $3,$2,$1;
  15388. $3=$recv("^[".__comma(separators)).__comma("]+");
  15389. $ctx1.sendIdx[","]=1;
  15390. $2=$recv($RegularExpression())._fromString_flag_($3,"g");
  15391. $1=self._replaceRegexp_with_($2,"");
  15392. return $1;
  15393. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  15394. },
  15395. args: ["separators"],
  15396. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  15397. referencedClasses: ["RegularExpression"],
  15398. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  15399. }),
  15400. $globals.String);
  15401. $core.addMethod(
  15402. $core.method({
  15403. selector: "trimRight",
  15404. protocol: 'regular expressions',
  15405. fn: function (){
  15406. var self=this;
  15407. return $core.withContext(function($ctx1) {
  15408. var $1;
  15409. $1=self._trimRight_("\x5cs");
  15410. return $1;
  15411. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  15412. },
  15413. args: [],
  15414. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  15415. referencedClasses: [],
  15416. messageSends: ["trimRight:"]
  15417. }),
  15418. $globals.String);
  15419. $core.addMethod(
  15420. $core.method({
  15421. selector: "trimRight:",
  15422. protocol: 'regular expressions',
  15423. fn: function (separators){
  15424. var self=this;
  15425. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  15426. return $core.withContext(function($ctx1) {
  15427. var $3,$2,$1;
  15428. $3=$recv("[".__comma(separators)).__comma("]+$");
  15429. $ctx1.sendIdx[","]=1;
  15430. $2=$recv($RegularExpression())._fromString_flag_($3,"g");
  15431. $1=self._replaceRegexp_with_($2,"");
  15432. return $1;
  15433. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  15434. },
  15435. args: ["separators"],
  15436. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  15437. referencedClasses: ["RegularExpression"],
  15438. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  15439. }),
  15440. $globals.String);
  15441. $core.addMethod(
  15442. $core.method({
  15443. selector: "unescaped",
  15444. protocol: 'converting',
  15445. fn: function (){
  15446. var self=this;
  15447. return $core.withContext(function($ctx1) {
  15448. return unescape(self);
  15449. return self;
  15450. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  15451. },
  15452. args: [],
  15453. source: "unescaped\x0a\x09<return unescape(self)>",
  15454. referencedClasses: [],
  15455. messageSends: []
  15456. }),
  15457. $globals.String);
  15458. $core.addMethod(
  15459. $core.method({
  15460. selector: "uriComponentDecoded",
  15461. protocol: 'converting',
  15462. fn: function (){
  15463. var self=this;
  15464. return $core.withContext(function($ctx1) {
  15465. return decodeURIComponent(self);
  15466. return self;
  15467. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  15468. },
  15469. args: [],
  15470. source: "uriComponentDecoded\x0a\x09<return decodeURIComponent(self)>",
  15471. referencedClasses: [],
  15472. messageSends: []
  15473. }),
  15474. $globals.String);
  15475. $core.addMethod(
  15476. $core.method({
  15477. selector: "uriComponentEncoded",
  15478. protocol: 'converting',
  15479. fn: function (){
  15480. var self=this;
  15481. return $core.withContext(function($ctx1) {
  15482. return encodeURIComponent(self);
  15483. return self;
  15484. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  15485. },
  15486. args: [],
  15487. source: "uriComponentEncoded\x0a\x09<return encodeURIComponent(self)>",
  15488. referencedClasses: [],
  15489. messageSends: []
  15490. }),
  15491. $globals.String);
  15492. $core.addMethod(
  15493. $core.method({
  15494. selector: "uriDecoded",
  15495. protocol: 'converting',
  15496. fn: function (){
  15497. var self=this;
  15498. return $core.withContext(function($ctx1) {
  15499. return decodeURI(self);
  15500. return self;
  15501. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  15502. },
  15503. args: [],
  15504. source: "uriDecoded\x0a\x09<return decodeURI(self)>",
  15505. referencedClasses: [],
  15506. messageSends: []
  15507. }),
  15508. $globals.String);
  15509. $core.addMethod(
  15510. $core.method({
  15511. selector: "uriEncoded",
  15512. protocol: 'converting',
  15513. fn: function (){
  15514. var self=this;
  15515. return $core.withContext(function($ctx1) {
  15516. return encodeURI(self);
  15517. return self;
  15518. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  15519. },
  15520. args: [],
  15521. source: "uriEncoded\x0a\x09<return encodeURI(self)>",
  15522. referencedClasses: [],
  15523. messageSends: []
  15524. }),
  15525. $globals.String);
  15526. $core.addMethod(
  15527. $core.method({
  15528. selector: "value:",
  15529. protocol: 'evaluating',
  15530. fn: function (anObject){
  15531. var self=this;
  15532. return $core.withContext(function($ctx1) {
  15533. var $1;
  15534. $1=$recv(anObject)._perform_(self);
  15535. return $1;
  15536. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  15537. },
  15538. args: ["anObject"],
  15539. source: "value: anObject \x0a\x09^ anObject perform: self",
  15540. referencedClasses: [],
  15541. messageSends: ["perform:"]
  15542. }),
  15543. $globals.String);
  15544. $core.addMethod(
  15545. $core.method({
  15546. selector: "cr",
  15547. protocol: 'accessing',
  15548. fn: function (){
  15549. var self=this;
  15550. return $core.withContext(function($ctx1) {
  15551. return '\r';
  15552. return self;
  15553. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.klass)});
  15554. },
  15555. args: [],
  15556. source: "cr\x0a\x09<return '\x5cr'>",
  15557. referencedClasses: [],
  15558. messageSends: []
  15559. }),
  15560. $globals.String.klass);
  15561. $core.addMethod(
  15562. $core.method({
  15563. selector: "crlf",
  15564. protocol: 'accessing',
  15565. fn: function (){
  15566. var self=this;
  15567. return $core.withContext(function($ctx1) {
  15568. return '\r\n';
  15569. return self;
  15570. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.klass)});
  15571. },
  15572. args: [],
  15573. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  15574. referencedClasses: [],
  15575. messageSends: []
  15576. }),
  15577. $globals.String.klass);
  15578. $core.addMethod(
  15579. $core.method({
  15580. selector: "esc",
  15581. protocol: 'accessing',
  15582. fn: function (){
  15583. var self=this;
  15584. return $core.withContext(function($ctx1) {
  15585. var $1;
  15586. $1=self._fromCharCode_((27));
  15587. return $1;
  15588. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.klass)});
  15589. },
  15590. args: [],
  15591. source: "esc\x0a\x09^ self fromCharCode: 27",
  15592. referencedClasses: [],
  15593. messageSends: ["fromCharCode:"]
  15594. }),
  15595. $globals.String.klass);
  15596. $core.addMethod(
  15597. $core.method({
  15598. selector: "fromCharCode:",
  15599. protocol: 'instance creation',
  15600. fn: function (anInteger){
  15601. var self=this;
  15602. return $core.withContext(function($ctx1) {
  15603. return String.fromCharCode(anInteger);
  15604. return self;
  15605. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.klass)});
  15606. },
  15607. args: ["anInteger"],
  15608. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  15609. referencedClasses: [],
  15610. messageSends: []
  15611. }),
  15612. $globals.String.klass);
  15613. $core.addMethod(
  15614. $core.method({
  15615. selector: "fromString:",
  15616. protocol: 'instance creation',
  15617. fn: function (aString){
  15618. var self=this;
  15619. return $core.withContext(function($ctx1) {
  15620. return String(aString);
  15621. return self;
  15622. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.klass)});
  15623. },
  15624. args: ["aString"],
  15625. source: "fromString: aString\x0a\x09\x09<return String(aString)>",
  15626. referencedClasses: [],
  15627. messageSends: []
  15628. }),
  15629. $globals.String.klass);
  15630. $core.addMethod(
  15631. $core.method({
  15632. selector: "lf",
  15633. protocol: 'accessing',
  15634. fn: function (){
  15635. var self=this;
  15636. return $core.withContext(function($ctx1) {
  15637. return '\n';
  15638. return self;
  15639. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.klass)});
  15640. },
  15641. args: [],
  15642. source: "lf\x0a\x09<return '\x5cn'>",
  15643. referencedClasses: [],
  15644. messageSends: []
  15645. }),
  15646. $globals.String.klass);
  15647. $core.addMethod(
  15648. $core.method({
  15649. selector: "random",
  15650. protocol: 'random',
  15651. fn: function (){
  15652. var self=this;
  15653. return $core.withContext(function($ctx1) {
  15654. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  15655. return self;
  15656. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.klass)});
  15657. },
  15658. args: [],
  15659. 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);>",
  15660. referencedClasses: [],
  15661. messageSends: []
  15662. }),
  15663. $globals.String.klass);
  15664. $core.addMethod(
  15665. $core.method({
  15666. selector: "randomNotIn:",
  15667. protocol: 'random',
  15668. fn: function (aString){
  15669. var self=this;
  15670. var result;
  15671. return $core.withContext(function($ctx1) {
  15672. var $1;
  15673. $recv((function(){
  15674. return $core.withContext(function($ctx2) {
  15675. result=self._random();
  15676. result;
  15677. return $recv(aString)._includesSubString_(result);
  15678. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15679. }))._whileTrue();
  15680. $1=result;
  15681. return $1;
  15682. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.klass)});
  15683. },
  15684. args: ["aString"],
  15685. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  15686. referencedClasses: [],
  15687. messageSends: ["whileTrue", "random", "includesSubString:"]
  15688. }),
  15689. $globals.String.klass);
  15690. $core.addMethod(
  15691. $core.method({
  15692. selector: "space",
  15693. protocol: 'accessing',
  15694. fn: function (){
  15695. var self=this;
  15696. return $core.withContext(function($ctx1) {
  15697. return ' ';
  15698. return self;
  15699. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.klass)});
  15700. },
  15701. args: [],
  15702. source: "space\x0a\x09<return ' '>",
  15703. referencedClasses: [],
  15704. messageSends: []
  15705. }),
  15706. $globals.String.klass);
  15707. $core.addMethod(
  15708. $core.method({
  15709. selector: "streamClass",
  15710. protocol: 'accessing',
  15711. fn: function (){
  15712. var self=this;
  15713. function $StringStream(){return $globals.StringStream||(typeof StringStream=="undefined"?nil:StringStream)}
  15714. return $StringStream();
  15715. },
  15716. args: [],
  15717. source: "streamClass\x0a\x09\x09^ StringStream",
  15718. referencedClasses: ["StringStream"],
  15719. messageSends: []
  15720. }),
  15721. $globals.String.klass);
  15722. $core.addMethod(
  15723. $core.method({
  15724. selector: "tab",
  15725. protocol: 'accessing',
  15726. fn: function (){
  15727. var self=this;
  15728. return $core.withContext(function($ctx1) {
  15729. return '\t';
  15730. return self;
  15731. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.klass)});
  15732. },
  15733. args: [],
  15734. source: "tab\x0a\x09<return '\x5ct'>",
  15735. referencedClasses: [],
  15736. messageSends: []
  15737. }),
  15738. $globals.String.klass);
  15739. $core.addMethod(
  15740. $core.method({
  15741. selector: "value:",
  15742. protocol: 'instance creation',
  15743. fn: function (aUTFCharCode){
  15744. var self=this;
  15745. return $core.withContext(function($ctx1) {
  15746. return String.fromCharCode(aUTFCharCode);;
  15747. return self;
  15748. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.klass)});
  15749. },
  15750. args: ["aUTFCharCode"],
  15751. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  15752. referencedClasses: [],
  15753. messageSends: []
  15754. }),
  15755. $globals.String.klass);
  15756. $core.addClass('Set', $globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections');
  15757. $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`.";
  15758. $core.addMethod(
  15759. $core.method({
  15760. selector: "=",
  15761. protocol: 'comparing',
  15762. fn: function (aCollection){
  15763. var self=this;
  15764. return $core.withContext(function($ctx1) {
  15765. var $2,$1,$4,$3,$5;
  15766. var $early={};
  15767. try {
  15768. $2=self._class();
  15769. $ctx1.sendIdx["class"]=1;
  15770. $1=$recv($2).__eq($recv(aCollection)._class());
  15771. $ctx1.sendIdx["="]=1;
  15772. if(!$core.assert($1)){
  15773. return false;
  15774. };
  15775. $4=self._size();
  15776. $ctx1.sendIdx["size"]=1;
  15777. $3=$recv($4).__eq($recv(aCollection)._size());
  15778. if(!$core.assert($3)){
  15779. return false;
  15780. };
  15781. self._do_((function(each){
  15782. return $core.withContext(function($ctx2) {
  15783. $5=$recv(aCollection)._includes_(each);
  15784. if(!$core.assert($5)){
  15785. throw $early=[false];
  15786. };
  15787. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15788. }));
  15789. return true;
  15790. }
  15791. catch(e) {if(e===$early)return e[0]; throw e}
  15792. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  15793. },
  15794. args: ["aCollection"],
  15795. 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",
  15796. referencedClasses: [],
  15797. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  15798. }),
  15799. $globals.Set);
  15800. $core.addMethod(
  15801. $core.method({
  15802. selector: "add:",
  15803. protocol: 'adding/removing',
  15804. fn: function (anObject){
  15805. var self=this;
  15806. var bucket;
  15807. return $core.withContext(function($ctx1) {
  15808. var $2,$1,$receiver;
  15809. bucket=self._bucketsOfElement_(anObject);
  15810. $2=$recv(bucket)._second();
  15811. if(($receiver = $2) == null || $receiver.isNil){
  15812. var object,slowBucket;
  15813. object=$recv(bucket)._first();
  15814. $ctx1.sendIdx["first"]=1;
  15815. object;
  15816. slowBucket=$recv(bucket)._third();
  15817. slowBucket;
  15818. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  15819. return $core.withContext(function($ctx2) {
  15820. $recv(slowBucket)._add_(object);
  15821. self["@size"]=$recv(self["@size"]).__plus((1));
  15822. return self["@size"];
  15823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15824. }));
  15825. $1=object;
  15826. } else {
  15827. var primitiveBucket;
  15828. primitiveBucket=$receiver;
  15829. $1=self._add_in_($recv(bucket)._first(),primitiveBucket);
  15830. };
  15831. return $1;
  15832. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  15833. },
  15834. args: ["anObject"],
  15835. 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 ]",
  15836. referencedClasses: [],
  15837. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  15838. }),
  15839. $globals.Set);
  15840. $core.addMethod(
  15841. $core.method({
  15842. selector: "add:in:",
  15843. protocol: 'private',
  15844. fn: function (anObject,anotherObject){
  15845. var self=this;
  15846. return $core.withContext(function($ctx1) {
  15847. if (anObject in anotherObject.store) { return false; }
  15848. self['@size']++;
  15849. anotherObject.store[anObject] = true;
  15850. return anObject;
  15851. ;
  15852. return self;
  15853. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  15854. },
  15855. args: ["anObject", "anotherObject"],
  15856. 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>",
  15857. referencedClasses: [],
  15858. messageSends: []
  15859. }),
  15860. $globals.Set);
  15861. $core.addMethod(
  15862. $core.method({
  15863. selector: "bucketsOfElement:",
  15864. protocol: 'private',
  15865. fn: function (anObject){
  15866. var self=this;
  15867. return $core.withContext(function($ctx1) {
  15868. var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();
  15869. if ((type = typeof prim) === "object") {
  15870. if (anObject !== nil) {
  15871. bucket = null;
  15872. self['@slowBucketStores'].some(function (store) {
  15873. return bucket = store._bucketOfElement_(anObject);
  15874. });
  15875. return [ anObject, null, bucket || self['@defaultBucket'] ];
  15876. }
  15877. // include nil to well-known objects under 'boolean' fastBucket
  15878. prim = null;
  15879. type = 'boolean';
  15880. }
  15881. return [ prim, self['@fastBuckets'][type] ];
  15882. ;
  15883. return self;
  15884. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  15885. },
  15886. args: ["anObject"],
  15887. source: "bucketsOfElement: anObject\x0a\x09\x22Find the appropriate bucket for `anObject`.\x0a\x09For optimization purposes, directly answer an array with: \x0a\x09- the object to be store\x0a\x09- the primitive bucket\x0a\x09- the slow bucket\x22\x0a\x09\x0a\x09<\x0a\x09\x09var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();\x0a\x09\x09if ((type = typeof prim) === \x22object\x22) {\x0a\x09\x09\x09if (anObject !== nil) {\x0a\x09\x09\x09\x09bucket = null;\x0a\x09\x09\x09\x09self['@slowBucketStores'].some(function (store) {\x0a\x09\x09\x09\x09\x09return bucket = store._bucketOfElement_(anObject);\x0a\x09\x09\x09\x09});\x0a\x09\x09\x09\x09return [ anObject, null, bucket || self['@defaultBucket'] ];\x0a\x09\x09\x09}\x0a\x09\x09\x09\x0a\x09\x09\x09// include nil to well-known objects under 'boolean' fastBucket\x0a\x09\x09\x09prim = null;\x0a\x09\x09\x09type = 'boolean';\x0a\x09\x09}\x0a\x09\x09return [ prim, self['@fastBuckets'][type] ];\x0a\x09>",
  15888. referencedClasses: [],
  15889. messageSends: []
  15890. }),
  15891. $globals.Set);
  15892. $core.addMethod(
  15893. $core.method({
  15894. selector: "classNameOf:",
  15895. protocol: 'private',
  15896. fn: function (anObject){
  15897. var self=this;
  15898. return $core.withContext(function($ctx1) {
  15899. return anObject.klass != null && anObject.klass.className;
  15900. return self;
  15901. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  15902. },
  15903. args: ["anObject"],
  15904. 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>",
  15905. referencedClasses: [],
  15906. messageSends: []
  15907. }),
  15908. $globals.Set);
  15909. $core.addMethod(
  15910. $core.method({
  15911. selector: "collect:",
  15912. protocol: 'enumerating',
  15913. fn: function (aBlock){
  15914. var self=this;
  15915. var collection;
  15916. return $core.withContext(function($ctx1) {
  15917. var $1;
  15918. collection=$recv(self._class())._new();
  15919. self._do_((function(each){
  15920. return $core.withContext(function($ctx2) {
  15921. return $recv(collection)._add_($recv(aBlock)._value_(each));
  15922. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15923. }));
  15924. $1=collection;
  15925. return $1;
  15926. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  15927. },
  15928. args: ["aBlock"],
  15929. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  15930. referencedClasses: [],
  15931. messageSends: ["new", "class", "do:", "add:", "value:"]
  15932. }),
  15933. $globals.Set);
  15934. $core.addMethod(
  15935. $core.method({
  15936. selector: "detect:ifNone:",
  15937. protocol: 'enumerating',
  15938. fn: function (aBlock,anotherBlock){
  15939. var self=this;
  15940. return $core.withContext(function($ctx1) {
  15941. var $1,$2;
  15942. var $early={};
  15943. try {
  15944. self._do_((function(each){
  15945. return $core.withContext(function($ctx2) {
  15946. $1=$recv(aBlock)._value_(each);
  15947. if($core.assert($1)){
  15948. throw $early=[each];
  15949. };
  15950. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15951. }));
  15952. $2=$recv(anotherBlock)._value();
  15953. return $2;
  15954. }
  15955. catch(e) {if(e===$early)return e[0]; throw e}
  15956. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  15957. },
  15958. args: ["aBlock", "anotherBlock"],
  15959. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  15960. referencedClasses: [],
  15961. messageSends: ["do:", "ifTrue:", "value:", "value"]
  15962. }),
  15963. $globals.Set);
  15964. $core.addMethod(
  15965. $core.method({
  15966. selector: "do:",
  15967. protocol: 'enumerating',
  15968. fn: function (aBlock){
  15969. var self=this;
  15970. return $core.withContext(function($ctx1) {
  15971. var el, keys, i;
  15972. el = self['@fastBuckets'];
  15973. keys = Object.keys(el);
  15974. for (i = 0; i < keys.length; ++i) {
  15975. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  15976. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  15977. else { store._do_(aBlock); }
  15978. }
  15979. el = self['@slowBucketStores'];
  15980. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  15981. self['@defaultBucket']._do_(aBlock);
  15982. ;
  15983. return self;
  15984. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  15985. },
  15986. args: ["aBlock"],
  15987. 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>",
  15988. referencedClasses: [],
  15989. messageSends: []
  15990. }),
  15991. $globals.Set);
  15992. $core.addMethod(
  15993. $core.method({
  15994. selector: "includes:",
  15995. protocol: 'testing',
  15996. fn: function (anObject){
  15997. var self=this;
  15998. var bucket;
  15999. return $core.withContext(function($ctx1) {
  16000. var $2,$3,$4,$1,$receiver;
  16001. bucket=self._bucketsOfElement_(anObject);
  16002. $2=$recv(bucket)._second();
  16003. if(($receiver = $2) == null || $receiver.isNil){
  16004. $3=$recv(bucket)._third();
  16005. $4=$recv(bucket)._first();
  16006. $ctx1.sendIdx["first"]=1;
  16007. $1=$recv($3)._includes_($4);
  16008. } else {
  16009. var primitiveBucket;
  16010. primitiveBucket=$receiver;
  16011. $1=self._includes_in_($recv(bucket)._first(),primitiveBucket);
  16012. };
  16013. return $1;
  16014. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  16015. },
  16016. args: ["anObject"],
  16017. 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 ]",
  16018. referencedClasses: [],
  16019. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  16020. }),
  16021. $globals.Set);
  16022. $core.addMethod(
  16023. $core.method({
  16024. selector: "includes:in:",
  16025. protocol: 'private',
  16026. fn: function (anObject,anotherObject){
  16027. var self=this;
  16028. return $core.withContext(function($ctx1) {
  16029. return anObject in anotherObject.store;
  16030. return self;
  16031. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  16032. },
  16033. args: ["anObject", "anotherObject"],
  16034. source: "includes: anObject in: anotherObject\x0a\x09<return anObject in anotherObject.store>",
  16035. referencedClasses: [],
  16036. messageSends: []
  16037. }),
  16038. $globals.Set);
  16039. $core.addMethod(
  16040. $core.method({
  16041. selector: "initialize",
  16042. protocol: 'initialization',
  16043. fn: function (){
  16044. var self=this;
  16045. return $core.withContext(function($ctx1) {
  16046. var $1;
  16047. (
  16048. $ctx1.supercall = true,
  16049. $globals.Set.superclass.fn.prototype._initialize.apply($recv(self), []));
  16050. $ctx1.supercall = false;
  16051. self["@defaultBucket"]=[];
  16052. self._initializeSlowBucketStores();
  16053. $1=self._removeAll();
  16054. return self;
  16055. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  16056. },
  16057. args: [],
  16058. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  16059. referencedClasses: [],
  16060. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  16061. }),
  16062. $globals.Set);
  16063. $core.addMethod(
  16064. $core.method({
  16065. selector: "initializeSlowBucketStores",
  16066. protocol: 'initialization',
  16067. fn: function (){
  16068. var self=this;
  16069. function $ArrayBucketStore(){return $globals.ArrayBucketStore||(typeof ArrayBucketStore=="undefined"?nil:ArrayBucketStore)}
  16070. return $core.withContext(function($ctx1) {
  16071. var $1;
  16072. $1=$recv($ArrayBucketStore())._hashBlock_((function(x){
  16073. return $core.withContext(function($ctx2) {
  16074. return self._classNameOf_(x);
  16075. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  16076. }));
  16077. $ctx1.sendIdx["hashBlock:"]=1;
  16078. self["@slowBucketStores"]=[$1,$recv($ArrayBucketStore())._hashBlock_((function(x){
  16079. return $core.withContext(function($ctx2) {
  16080. return self._jsConstructorNameOf_(x);
  16081. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  16082. }))];
  16083. return self;
  16084. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  16085. },
  16086. args: [],
  16087. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  16088. referencedClasses: ["ArrayBucketStore"],
  16089. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  16090. }),
  16091. $globals.Set);
  16092. $core.addMethod(
  16093. $core.method({
  16094. selector: "jsConstructorNameOf:",
  16095. protocol: 'private',
  16096. fn: function (anObject){
  16097. var self=this;
  16098. return $core.withContext(function($ctx1) {
  16099. return anObject.constructor && anObject.constructor.name;
  16100. return self;
  16101. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  16102. },
  16103. args: ["anObject"],
  16104. source: "jsConstructorNameOf: anObject\x0a\x09<return anObject.constructor && anObject.constructor.name>",
  16105. referencedClasses: [],
  16106. messageSends: []
  16107. }),
  16108. $globals.Set);
  16109. $core.addMethod(
  16110. $core.method({
  16111. selector: "printOn:",
  16112. protocol: 'printing',
  16113. fn: function (aStream){
  16114. var self=this;
  16115. return $core.withContext(function($ctx1) {
  16116. (
  16117. $ctx1.supercall = true,
  16118. $globals.Set.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  16119. $ctx1.supercall = false;
  16120. $ctx1.sendIdx["printOn:"]=1;
  16121. $recv(aStream)._nextPutAll_(" (");
  16122. $ctx1.sendIdx["nextPutAll:"]=1;
  16123. self._do_separatedBy_((function(each){
  16124. return $core.withContext(function($ctx2) {
  16125. return $recv(each)._printOn_(aStream);
  16126. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16127. }),(function(){
  16128. return $core.withContext(function($ctx2) {
  16129. return $recv(aStream)._nextPutAll_(" ");
  16130. $ctx2.sendIdx["nextPutAll:"]=2;
  16131. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16132. }));
  16133. $recv(aStream)._nextPutAll_(")");
  16134. return self;
  16135. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  16136. },
  16137. args: ["aStream"],
  16138. 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: ')'",
  16139. referencedClasses: [],
  16140. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  16141. }),
  16142. $globals.Set);
  16143. $core.addMethod(
  16144. $core.method({
  16145. selector: "remove:ifAbsent:",
  16146. protocol: 'adding/removing',
  16147. fn: function (anObject,aBlock){
  16148. var self=this;
  16149. var bucket;
  16150. return $core.withContext(function($ctx1) {
  16151. var $2,$3,$4,$5,$1,$receiver;
  16152. var $early={};
  16153. try {
  16154. bucket=self._bucketsOfElement_(anObject);
  16155. $2=$recv(bucket)._second();
  16156. if(($receiver = $2) == null || $receiver.isNil){
  16157. $3=$recv(bucket)._third();
  16158. $4=$recv(bucket)._first();
  16159. $ctx1.sendIdx["first"]=1;
  16160. $recv($3)._remove_ifAbsent_($4,(function(){
  16161. return $core.withContext(function($ctx2) {
  16162. $5=$recv(aBlock)._value();
  16163. throw $early=[$5];
  16164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16165. }));
  16166. self["@size"]=$recv(self["@size"]).__minus((1));
  16167. $1=self["@size"];
  16168. } else {
  16169. var primitiveBucket;
  16170. primitiveBucket=$receiver;
  16171. $1=self._remove_in_($recv(bucket)._first(),primitiveBucket);
  16172. };
  16173. return $1;
  16174. }
  16175. catch(e) {if(e===$early)return e[0]; throw e}
  16176. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  16177. },
  16178. args: ["anObject", "aBlock"],
  16179. 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 ]",
  16180. referencedClasses: [],
  16181. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  16182. }),
  16183. $globals.Set);
  16184. $core.addMethod(
  16185. $core.method({
  16186. selector: "remove:in:",
  16187. protocol: 'private',
  16188. fn: function (anObject,anotherObject){
  16189. var self=this;
  16190. return $core.withContext(function($ctx1) {
  16191. if (delete anotherObject.store[anObject]) self['@size']--;
  16192. return self;
  16193. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  16194. },
  16195. args: ["anObject", "anotherObject"],
  16196. source: "remove: anObject in: anotherObject\x0a\x09<if (delete anotherObject.store[anObject]) self['@size']-->",
  16197. referencedClasses: [],
  16198. messageSends: []
  16199. }),
  16200. $globals.Set);
  16201. $core.addMethod(
  16202. $core.method({
  16203. selector: "removeAll",
  16204. protocol: 'adding/removing',
  16205. fn: function (){
  16206. var self=this;
  16207. return $core.withContext(function($ctx1) {
  16208. self['@fastBuckets'] = {
  16209. 'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },
  16210. 'number': { store: Object.create(null), fn: Number },
  16211. 'string': { store: Object.create(null) }
  16212. };
  16213. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  16214. self['@defaultBucket']._removeAll();
  16215. self['@size'] = 0;
  16216. ;
  16217. return self;
  16218. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  16219. },
  16220. args: [],
  16221. 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>",
  16222. referencedClasses: [],
  16223. messageSends: []
  16224. }),
  16225. $globals.Set);
  16226. $core.addMethod(
  16227. $core.method({
  16228. selector: "select:",
  16229. protocol: 'enumerating',
  16230. fn: function (aBlock){
  16231. var self=this;
  16232. var collection;
  16233. return $core.withContext(function($ctx1) {
  16234. var $1,$2;
  16235. collection=$recv(self._class())._new();
  16236. self._do_((function(each){
  16237. return $core.withContext(function($ctx2) {
  16238. $1=$recv(aBlock)._value_(each);
  16239. if($core.assert($1)){
  16240. return $recv(collection)._add_(each);
  16241. };
  16242. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16243. }));
  16244. $2=collection;
  16245. return $2;
  16246. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  16247. },
  16248. args: ["aBlock"],
  16249. 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",
  16250. referencedClasses: [],
  16251. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  16252. }),
  16253. $globals.Set);
  16254. $core.addMethod(
  16255. $core.method({
  16256. selector: "size",
  16257. protocol: 'accessing',
  16258. fn: function (){
  16259. var self=this;
  16260. var $1;
  16261. $1=self["@size"];
  16262. return $1;
  16263. },
  16264. args: [],
  16265. source: "size\x0a\x09^ size",
  16266. referencedClasses: [],
  16267. messageSends: []
  16268. }),
  16269. $globals.Set);
  16270. $core.addClass('ProtoStream', $globals.Object, [], 'Kernel-Collections');
  16271. $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.";
  16272. $core.addMethod(
  16273. $core.method({
  16274. selector: "<<",
  16275. protocol: 'writing',
  16276. fn: function (anObject){
  16277. var self=this;
  16278. return $core.withContext(function($ctx1) {
  16279. self._write_(anObject);
  16280. return self;
  16281. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  16282. },
  16283. args: ["anObject"],
  16284. source: "<< anObject\x0a\x09self write: anObject",
  16285. referencedClasses: [],
  16286. messageSends: ["write:"]
  16287. }),
  16288. $globals.ProtoStream);
  16289. $core.addMethod(
  16290. $core.method({
  16291. selector: "atEnd",
  16292. protocol: 'testing',
  16293. fn: function (){
  16294. var self=this;
  16295. return $core.withContext(function($ctx1) {
  16296. self._subclassResponsibility();
  16297. return self;
  16298. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  16299. },
  16300. args: [],
  16301. source: "atEnd\x0a\x09self subclassResponsibility",
  16302. referencedClasses: [],
  16303. messageSends: ["subclassResponsibility"]
  16304. }),
  16305. $globals.ProtoStream);
  16306. $core.addMethod(
  16307. $core.method({
  16308. selector: "atStart",
  16309. protocol: 'testing',
  16310. fn: function (){
  16311. var self=this;
  16312. return $core.withContext(function($ctx1) {
  16313. self._subclassResponsibility();
  16314. return self;
  16315. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  16316. },
  16317. args: [],
  16318. source: "atStart\x0a\x09self subclassResponsibility",
  16319. referencedClasses: [],
  16320. messageSends: ["subclassResponsibility"]
  16321. }),
  16322. $globals.ProtoStream);
  16323. $core.addMethod(
  16324. $core.method({
  16325. selector: "contents",
  16326. protocol: 'accessing',
  16327. fn: function (){
  16328. var self=this;
  16329. return $core.withContext(function($ctx1) {
  16330. self._subclassResponsibility();
  16331. return self;
  16332. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  16333. },
  16334. args: [],
  16335. source: "contents\x0a\x09self subclassResponsibility",
  16336. referencedClasses: [],
  16337. messageSends: ["subclassResponsibility"]
  16338. }),
  16339. $globals.ProtoStream);
  16340. $core.addMethod(
  16341. $core.method({
  16342. selector: "do:",
  16343. protocol: 'enumerating',
  16344. fn: function (aBlock){
  16345. var self=this;
  16346. return $core.withContext(function($ctx1) {
  16347. $recv((function(){
  16348. return $core.withContext(function($ctx2) {
  16349. return self._atEnd();
  16350. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16351. }))._whileFalse_((function(){
  16352. return $core.withContext(function($ctx2) {
  16353. return $recv(aBlock)._value_(self._next());
  16354. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16355. }));
  16356. return self;
  16357. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  16358. },
  16359. args: ["aBlock"],
  16360. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  16361. referencedClasses: [],
  16362. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  16363. }),
  16364. $globals.ProtoStream);
  16365. $core.addMethod(
  16366. $core.method({
  16367. selector: "isEmpty",
  16368. protocol: 'testing',
  16369. fn: function (){
  16370. var self=this;
  16371. return $core.withContext(function($ctx1) {
  16372. var $1;
  16373. $1=$recv(self._atStart())._and_((function(){
  16374. return $core.withContext(function($ctx2) {
  16375. return self._atEnd();
  16376. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16377. }));
  16378. return $1;
  16379. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  16380. },
  16381. args: [],
  16382. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  16383. referencedClasses: [],
  16384. messageSends: ["and:", "atStart", "atEnd"]
  16385. }),
  16386. $globals.ProtoStream);
  16387. $core.addMethod(
  16388. $core.method({
  16389. selector: "next",
  16390. protocol: 'reading',
  16391. fn: function (){
  16392. var self=this;
  16393. return $core.withContext(function($ctx1) {
  16394. var $2,$1;
  16395. $2=self._atEnd();
  16396. if($core.assert($2)){
  16397. $1=nil;
  16398. } else {
  16399. $1=self._subclassResponsibility();
  16400. };
  16401. return $1;
  16402. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  16403. },
  16404. args: [],
  16405. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  16406. referencedClasses: [],
  16407. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  16408. }),
  16409. $globals.ProtoStream);
  16410. $core.addMethod(
  16411. $core.method({
  16412. selector: "nextPut:",
  16413. protocol: 'writing',
  16414. fn: function (anObject){
  16415. var self=this;
  16416. return $core.withContext(function($ctx1) {
  16417. self._subclassResponsibility();
  16418. return self;
  16419. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  16420. },
  16421. args: ["anObject"],
  16422. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  16423. referencedClasses: [],
  16424. messageSends: ["subclassResponsibility"]
  16425. }),
  16426. $globals.ProtoStream);
  16427. $core.addMethod(
  16428. $core.method({
  16429. selector: "nextPutAll:",
  16430. protocol: 'writing',
  16431. fn: function (aCollection){
  16432. var self=this;
  16433. return $core.withContext(function($ctx1) {
  16434. $recv(aCollection)._do_((function(each){
  16435. return $core.withContext(function($ctx2) {
  16436. return self._nextPut_(each);
  16437. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16438. }));
  16439. return self;
  16440. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  16441. },
  16442. args: ["aCollection"],
  16443. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  16444. referencedClasses: [],
  16445. messageSends: ["do:", "nextPut:"]
  16446. }),
  16447. $globals.ProtoStream);
  16448. $core.addMethod(
  16449. $core.method({
  16450. selector: "nextPutJSObject:",
  16451. protocol: 'writing',
  16452. fn: function (aJSObject){
  16453. var self=this;
  16454. return $core.withContext(function($ctx1) {
  16455. self._nextPut_(aJSObject);
  16456. return self;
  16457. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  16458. },
  16459. args: ["aJSObject"],
  16460. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  16461. referencedClasses: [],
  16462. messageSends: ["nextPut:"]
  16463. }),
  16464. $globals.ProtoStream);
  16465. $core.addMethod(
  16466. $core.method({
  16467. selector: "nextPutString:",
  16468. protocol: 'writing',
  16469. fn: function (aString){
  16470. var self=this;
  16471. return $core.withContext(function($ctx1) {
  16472. self._nextPut_(aString);
  16473. return self;
  16474. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  16475. },
  16476. args: ["aString"],
  16477. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  16478. referencedClasses: [],
  16479. messageSends: ["nextPut:"]
  16480. }),
  16481. $globals.ProtoStream);
  16482. $core.addMethod(
  16483. $core.method({
  16484. selector: "peek",
  16485. protocol: 'reading',
  16486. fn: function (){
  16487. var self=this;
  16488. return $core.withContext(function($ctx1) {
  16489. var $2,$1;
  16490. $2=self._atEnd();
  16491. if($core.assert($2)){
  16492. $1=nil;
  16493. } else {
  16494. $1=self._subclassResponsibility();
  16495. };
  16496. return $1;
  16497. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  16498. },
  16499. args: [],
  16500. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  16501. referencedClasses: [],
  16502. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  16503. }),
  16504. $globals.ProtoStream);
  16505. $core.addMethod(
  16506. $core.method({
  16507. selector: "reset",
  16508. protocol: 'actions',
  16509. fn: function (){
  16510. var self=this;
  16511. return $core.withContext(function($ctx1) {
  16512. self._subclassResponsibility();
  16513. return self;
  16514. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  16515. },
  16516. args: [],
  16517. source: "reset\x0a\x09self subclassResponsibility",
  16518. referencedClasses: [],
  16519. messageSends: ["subclassResponsibility"]
  16520. }),
  16521. $globals.ProtoStream);
  16522. $core.addMethod(
  16523. $core.method({
  16524. selector: "resetContents",
  16525. protocol: 'actions',
  16526. fn: function (){
  16527. var self=this;
  16528. return $core.withContext(function($ctx1) {
  16529. self._subclassResponsibility();
  16530. return self;
  16531. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  16532. },
  16533. args: [],
  16534. source: "resetContents\x0a\x09self subclassResponsibility",
  16535. referencedClasses: [],
  16536. messageSends: ["subclassResponsibility"]
  16537. }),
  16538. $globals.ProtoStream);
  16539. $core.addMethod(
  16540. $core.method({
  16541. selector: "setToEnd",
  16542. protocol: 'positioning',
  16543. fn: function (){
  16544. var self=this;
  16545. return $core.withContext(function($ctx1) {
  16546. self._subclassResponsibility();
  16547. return self;
  16548. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  16549. },
  16550. args: [],
  16551. source: "setToEnd\x0a\x09self subclassResponsibility",
  16552. referencedClasses: [],
  16553. messageSends: ["subclassResponsibility"]
  16554. }),
  16555. $globals.ProtoStream);
  16556. $core.addMethod(
  16557. $core.method({
  16558. selector: "setToStart",
  16559. protocol: 'positioning',
  16560. fn: function (){
  16561. var self=this;
  16562. return $core.withContext(function($ctx1) {
  16563. self._reset();
  16564. return self;
  16565. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  16566. },
  16567. args: [],
  16568. source: "setToStart\x0a\x09self reset",
  16569. referencedClasses: [],
  16570. messageSends: ["reset"]
  16571. }),
  16572. $globals.ProtoStream);
  16573. $core.addMethod(
  16574. $core.method({
  16575. selector: "write:",
  16576. protocol: 'writing',
  16577. fn: function (anObject){
  16578. var self=this;
  16579. return $core.withContext(function($ctx1) {
  16580. $recv(anObject)._putOn_(self);
  16581. return self;
  16582. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  16583. },
  16584. args: ["anObject"],
  16585. source: "write: anObject\x0a\x09anObject putOn: self",
  16586. referencedClasses: [],
  16587. messageSends: ["putOn:"]
  16588. }),
  16589. $globals.ProtoStream);
  16590. $core.addMethod(
  16591. $core.method({
  16592. selector: "on:",
  16593. protocol: 'instance creation',
  16594. fn: function (aCollection){
  16595. var self=this;
  16596. return $core.withContext(function($ctx1) {
  16597. var $2,$3,$1;
  16598. $2=self._new();
  16599. $recv($2)._setCollection_(aCollection);
  16600. $recv($2)._setStreamSize_($recv(aCollection)._size());
  16601. $3=$recv($2)._yourself();
  16602. $1=$3;
  16603. return $1;
  16604. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.klass)});
  16605. },
  16606. args: ["aCollection"],
  16607. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  16608. referencedClasses: [],
  16609. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  16610. }),
  16611. $globals.ProtoStream.klass);
  16612. $core.addClass('Stream', $globals.ProtoStream, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  16613. $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.";
  16614. $core.addMethod(
  16615. $core.method({
  16616. selector: "atEnd",
  16617. protocol: 'testing',
  16618. fn: function (){
  16619. var self=this;
  16620. return $core.withContext(function($ctx1) {
  16621. var $1;
  16622. $1=$recv(self._position()).__eq(self._size());
  16623. return $1;
  16624. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  16625. },
  16626. args: [],
  16627. source: "atEnd\x0a\x09^ self position = self size",
  16628. referencedClasses: [],
  16629. messageSends: ["=", "position", "size"]
  16630. }),
  16631. $globals.Stream);
  16632. $core.addMethod(
  16633. $core.method({
  16634. selector: "atStart",
  16635. protocol: 'testing',
  16636. fn: function (){
  16637. var self=this;
  16638. return $core.withContext(function($ctx1) {
  16639. var $1;
  16640. $1=$recv(self._position()).__eq((0));
  16641. return $1;
  16642. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  16643. },
  16644. args: [],
  16645. source: "atStart\x0a\x09^ self position = 0",
  16646. referencedClasses: [],
  16647. messageSends: ["=", "position"]
  16648. }),
  16649. $globals.Stream);
  16650. $core.addMethod(
  16651. $core.method({
  16652. selector: "close",
  16653. protocol: 'actions',
  16654. fn: function (){
  16655. var self=this;
  16656. return self;
  16657. },
  16658. args: [],
  16659. source: "close",
  16660. referencedClasses: [],
  16661. messageSends: []
  16662. }),
  16663. $globals.Stream);
  16664. $core.addMethod(
  16665. $core.method({
  16666. selector: "collection",
  16667. protocol: 'accessing',
  16668. fn: function (){
  16669. var self=this;
  16670. var $1;
  16671. $1=self["@collection"];
  16672. return $1;
  16673. },
  16674. args: [],
  16675. source: "collection\x0a\x09^ collection",
  16676. referencedClasses: [],
  16677. messageSends: []
  16678. }),
  16679. $globals.Stream);
  16680. $core.addMethod(
  16681. $core.method({
  16682. selector: "contents",
  16683. protocol: 'accessing',
  16684. fn: function (){
  16685. var self=this;
  16686. return $core.withContext(function($ctx1) {
  16687. var $1;
  16688. $1=$recv(self._collection())._copyFrom_to_((1),self._streamSize());
  16689. return $1;
  16690. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  16691. },
  16692. args: [],
  16693. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  16694. referencedClasses: [],
  16695. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  16696. }),
  16697. $globals.Stream);
  16698. $core.addMethod(
  16699. $core.method({
  16700. selector: "flush",
  16701. protocol: 'actions',
  16702. fn: function (){
  16703. var self=this;
  16704. return self;
  16705. },
  16706. args: [],
  16707. source: "flush",
  16708. referencedClasses: [],
  16709. messageSends: []
  16710. }),
  16711. $globals.Stream);
  16712. $core.addMethod(
  16713. $core.method({
  16714. selector: "isEmpty",
  16715. protocol: 'testing',
  16716. fn: function (){
  16717. var self=this;
  16718. return $core.withContext(function($ctx1) {
  16719. var $1;
  16720. $1=$recv(self._size()).__eq((0));
  16721. return $1;
  16722. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  16723. },
  16724. args: [],
  16725. source: "isEmpty\x0a\x09^ self size = 0",
  16726. referencedClasses: [],
  16727. messageSends: ["=", "size"]
  16728. }),
  16729. $globals.Stream);
  16730. $core.addMethod(
  16731. $core.method({
  16732. selector: "next",
  16733. protocol: 'reading',
  16734. fn: function (){
  16735. var self=this;
  16736. return $core.withContext(function($ctx1) {
  16737. var $2,$4,$3,$1;
  16738. $2=self._atEnd();
  16739. if($core.assert($2)){
  16740. $1=nil;
  16741. } else {
  16742. $4=self._position();
  16743. $ctx1.sendIdx["position"]=1;
  16744. $3=$recv($4).__plus((1));
  16745. self._position_($3);
  16746. $1=$recv(self["@collection"])._at_(self._position());
  16747. };
  16748. return $1;
  16749. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  16750. },
  16751. args: [],
  16752. 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 ]",
  16753. referencedClasses: [],
  16754. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  16755. }),
  16756. $globals.Stream);
  16757. $core.addMethod(
  16758. $core.method({
  16759. selector: "next:",
  16760. protocol: 'reading',
  16761. fn: function (anInteger){
  16762. var self=this;
  16763. var tempCollection;
  16764. return $core.withContext(function($ctx1) {
  16765. var $1,$2;
  16766. tempCollection=$recv($recv(self._collection())._class())._new();
  16767. $recv(anInteger)._timesRepeat_((function(){
  16768. return $core.withContext(function($ctx2) {
  16769. $1=self._atEnd();
  16770. if(!$core.assert($1)){
  16771. return $recv(tempCollection)._add_(self._next());
  16772. };
  16773. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16774. }));
  16775. $2=tempCollection;
  16776. return $2;
  16777. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  16778. },
  16779. args: ["anInteger"],
  16780. 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",
  16781. referencedClasses: [],
  16782. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  16783. }),
  16784. $globals.Stream);
  16785. $core.addMethod(
  16786. $core.method({
  16787. selector: "nextPut:",
  16788. protocol: 'writing',
  16789. fn: function (anObject){
  16790. var self=this;
  16791. return $core.withContext(function($ctx1) {
  16792. var $2,$1,$3,$4;
  16793. $2=self._position();
  16794. $ctx1.sendIdx["position"]=1;
  16795. $1=$recv($2).__plus((1));
  16796. self._position_($1);
  16797. $3=self._collection();
  16798. $4=self._position();
  16799. $ctx1.sendIdx["position"]=2;
  16800. $recv($3)._at_put_($4,anObject);
  16801. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  16802. return self;
  16803. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  16804. },
  16805. args: ["anObject"],
  16806. 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)",
  16807. referencedClasses: [],
  16808. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  16809. }),
  16810. $globals.Stream);
  16811. $core.addMethod(
  16812. $core.method({
  16813. selector: "peek",
  16814. protocol: 'reading',
  16815. fn: function (){
  16816. var self=this;
  16817. return $core.withContext(function($ctx1) {
  16818. var $2,$1;
  16819. $2=self._atEnd();
  16820. if(!$core.assert($2)){
  16821. $1=$recv(self._collection())._at_($recv(self._position()).__plus((1)));
  16822. };
  16823. return $1;
  16824. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  16825. },
  16826. args: [],
  16827. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  16828. referencedClasses: [],
  16829. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  16830. }),
  16831. $globals.Stream);
  16832. $core.addMethod(
  16833. $core.method({
  16834. selector: "position",
  16835. protocol: 'accessing',
  16836. fn: function (){
  16837. var self=this;
  16838. return $core.withContext(function($ctx1) {
  16839. var $2,$1,$receiver;
  16840. $2=self["@position"];
  16841. if(($receiver = $2) == null || $receiver.isNil){
  16842. self["@position"]=(0);
  16843. $1=self["@position"];
  16844. } else {
  16845. $1=$2;
  16846. };
  16847. return $1;
  16848. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  16849. },
  16850. args: [],
  16851. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  16852. referencedClasses: [],
  16853. messageSends: ["ifNil:"]
  16854. }),
  16855. $globals.Stream);
  16856. $core.addMethod(
  16857. $core.method({
  16858. selector: "position:",
  16859. protocol: 'accessing',
  16860. fn: function (anInteger){
  16861. var self=this;
  16862. self["@position"]=anInteger;
  16863. return self;
  16864. },
  16865. args: ["anInteger"],
  16866. source: "position: anInteger\x0a\x09position := anInteger",
  16867. referencedClasses: [],
  16868. messageSends: []
  16869. }),
  16870. $globals.Stream);
  16871. $core.addMethod(
  16872. $core.method({
  16873. selector: "reset",
  16874. protocol: 'actions',
  16875. fn: function (){
  16876. var self=this;
  16877. return $core.withContext(function($ctx1) {
  16878. self._position_((0));
  16879. return self;
  16880. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  16881. },
  16882. args: [],
  16883. source: "reset\x0a\x09self position: 0",
  16884. referencedClasses: [],
  16885. messageSends: ["position:"]
  16886. }),
  16887. $globals.Stream);
  16888. $core.addMethod(
  16889. $core.method({
  16890. selector: "resetContents",
  16891. protocol: 'actions',
  16892. fn: function (){
  16893. var self=this;
  16894. return $core.withContext(function($ctx1) {
  16895. self._reset();
  16896. self._setStreamSize_((0));
  16897. return self;
  16898. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  16899. },
  16900. args: [],
  16901. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  16902. referencedClasses: [],
  16903. messageSends: ["reset", "setStreamSize:"]
  16904. }),
  16905. $globals.Stream);
  16906. $core.addMethod(
  16907. $core.method({
  16908. selector: "setCollection:",
  16909. protocol: 'accessing',
  16910. fn: function (aCollection){
  16911. var self=this;
  16912. self["@collection"]=aCollection;
  16913. return self;
  16914. },
  16915. args: ["aCollection"],
  16916. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  16917. referencedClasses: [],
  16918. messageSends: []
  16919. }),
  16920. $globals.Stream);
  16921. $core.addMethod(
  16922. $core.method({
  16923. selector: "setStreamSize:",
  16924. protocol: 'accessing',
  16925. fn: function (anInteger){
  16926. var self=this;
  16927. self["@streamSize"]=anInteger;
  16928. return self;
  16929. },
  16930. args: ["anInteger"],
  16931. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  16932. referencedClasses: [],
  16933. messageSends: []
  16934. }),
  16935. $globals.Stream);
  16936. $core.addMethod(
  16937. $core.method({
  16938. selector: "setToEnd",
  16939. protocol: 'positioning',
  16940. fn: function (){
  16941. var self=this;
  16942. return $core.withContext(function($ctx1) {
  16943. self._position_(self._size());
  16944. return self;
  16945. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  16946. },
  16947. args: [],
  16948. source: "setToEnd\x0a\x09self position: self size",
  16949. referencedClasses: [],
  16950. messageSends: ["position:", "size"]
  16951. }),
  16952. $globals.Stream);
  16953. $core.addMethod(
  16954. $core.method({
  16955. selector: "size",
  16956. protocol: 'accessing',
  16957. fn: function (){
  16958. var self=this;
  16959. return $core.withContext(function($ctx1) {
  16960. var $1;
  16961. $1=self._streamSize();
  16962. return $1;
  16963. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  16964. },
  16965. args: [],
  16966. source: "size\x0a\x09^ self streamSize",
  16967. referencedClasses: [],
  16968. messageSends: ["streamSize"]
  16969. }),
  16970. $globals.Stream);
  16971. $core.addMethod(
  16972. $core.method({
  16973. selector: "skip:",
  16974. protocol: 'positioning',
  16975. fn: function (anInteger){
  16976. var self=this;
  16977. return $core.withContext(function($ctx1) {
  16978. self._position_($recv($recv(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  16979. return self;
  16980. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  16981. },
  16982. args: ["anInteger"],
  16983. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  16984. referencedClasses: [],
  16985. messageSends: ["position:", "min:max:", "+", "position", "size"]
  16986. }),
  16987. $globals.Stream);
  16988. $core.addMethod(
  16989. $core.method({
  16990. selector: "streamSize",
  16991. protocol: 'accessing',
  16992. fn: function (){
  16993. var self=this;
  16994. var $1;
  16995. $1=self["@streamSize"];
  16996. return $1;
  16997. },
  16998. args: [],
  16999. source: "streamSize\x0a\x09^ streamSize",
  17000. referencedClasses: [],
  17001. messageSends: []
  17002. }),
  17003. $globals.Stream);
  17004. $core.addMethod(
  17005. $core.method({
  17006. selector: "on:",
  17007. protocol: 'instance creation',
  17008. fn: function (aCollection){
  17009. var self=this;
  17010. return $core.withContext(function($ctx1) {
  17011. var $2,$3,$1;
  17012. $2=self._new();
  17013. $recv($2)._setCollection_(aCollection);
  17014. $recv($2)._setStreamSize_($recv(aCollection)._size());
  17015. $3=$recv($2)._yourself();
  17016. $1=$3;
  17017. return $1;
  17018. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.klass)});
  17019. },
  17020. args: ["aCollection"],
  17021. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  17022. referencedClasses: [],
  17023. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  17024. }),
  17025. $globals.Stream.klass);
  17026. $core.addClass('StringStream', $globals.Stream, [], 'Kernel-Collections');
  17027. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  17028. $core.addMethod(
  17029. $core.method({
  17030. selector: "cr",
  17031. protocol: 'writing',
  17032. fn: function (){
  17033. var self=this;
  17034. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  17035. return $core.withContext(function($ctx1) {
  17036. var $1;
  17037. $1=self._nextPutAll_($recv($String())._cr());
  17038. return $1;
  17039. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  17040. },
  17041. args: [],
  17042. source: "cr\x0a\x09^ self nextPutAll: String cr",
  17043. referencedClasses: ["String"],
  17044. messageSends: ["nextPutAll:", "cr"]
  17045. }),
  17046. $globals.StringStream);
  17047. $core.addMethod(
  17048. $core.method({
  17049. selector: "crlf",
  17050. protocol: 'writing',
  17051. fn: function (){
  17052. var self=this;
  17053. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  17054. return $core.withContext(function($ctx1) {
  17055. var $1;
  17056. $1=self._nextPutAll_($recv($String())._crlf());
  17057. return $1;
  17058. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  17059. },
  17060. args: [],
  17061. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  17062. referencedClasses: ["String"],
  17063. messageSends: ["nextPutAll:", "crlf"]
  17064. }),
  17065. $globals.StringStream);
  17066. $core.addMethod(
  17067. $core.method({
  17068. selector: "lf",
  17069. protocol: 'writing',
  17070. fn: function (){
  17071. var self=this;
  17072. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  17073. return $core.withContext(function($ctx1) {
  17074. var $1;
  17075. $1=self._nextPutAll_($recv($String())._lf());
  17076. return $1;
  17077. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  17078. },
  17079. args: [],
  17080. source: "lf\x0a\x09^ self nextPutAll: String lf",
  17081. referencedClasses: ["String"],
  17082. messageSends: ["nextPutAll:", "lf"]
  17083. }),
  17084. $globals.StringStream);
  17085. $core.addMethod(
  17086. $core.method({
  17087. selector: "next:",
  17088. protocol: 'reading',
  17089. fn: function (anInteger){
  17090. var self=this;
  17091. var tempCollection;
  17092. return $core.withContext(function($ctx1) {
  17093. var $1,$2;
  17094. tempCollection=$recv($recv(self._collection())._class())._new();
  17095. $recv(anInteger)._timesRepeat_((function(){
  17096. return $core.withContext(function($ctx2) {
  17097. $1=self._atEnd();
  17098. if(!$core.assert($1)){
  17099. tempCollection=$recv(tempCollection).__comma(self._next());
  17100. return tempCollection;
  17101. };
  17102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17103. }));
  17104. $2=tempCollection;
  17105. return $2;
  17106. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  17107. },
  17108. args: ["anInteger"],
  17109. 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",
  17110. referencedClasses: [],
  17111. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  17112. }),
  17113. $globals.StringStream);
  17114. $core.addMethod(
  17115. $core.method({
  17116. selector: "nextPut:",
  17117. protocol: 'writing',
  17118. fn: function (aString){
  17119. var self=this;
  17120. return $core.withContext(function($ctx1) {
  17121. self._nextPutAll_(aString);
  17122. return self;
  17123. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  17124. },
  17125. args: ["aString"],
  17126. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  17127. referencedClasses: [],
  17128. messageSends: ["nextPutAll:"]
  17129. }),
  17130. $globals.StringStream);
  17131. $core.addMethod(
  17132. $core.method({
  17133. selector: "nextPutAll:",
  17134. protocol: 'writing',
  17135. fn: function (aString){
  17136. var self=this;
  17137. var pre,post;
  17138. return $core.withContext(function($ctx1) {
  17139. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  17140. $1=self._atEnd();
  17141. if($core.assert($1)){
  17142. $3=self._collection();
  17143. $ctx1.sendIdx["collection"]=1;
  17144. $2=$recv($3).__comma(aString);
  17145. $ctx1.sendIdx[","]=1;
  17146. self._setCollection_($2);
  17147. $ctx1.sendIdx["setCollection:"]=1;
  17148. } else {
  17149. $4=self._collection();
  17150. $ctx1.sendIdx["collection"]=2;
  17151. $5=self._position();
  17152. $ctx1.sendIdx["position"]=1;
  17153. pre=$recv($4)._copyFrom_to_((1),$5);
  17154. $ctx1.sendIdx["copyFrom:to:"]=1;
  17155. pre;
  17156. $6=self._collection();
  17157. $ctx1.sendIdx["collection"]=3;
  17158. $9=self._position();
  17159. $ctx1.sendIdx["position"]=2;
  17160. $8=$recv($9).__plus((1));
  17161. $ctx1.sendIdx["+"]=2;
  17162. $10=$recv(aString)._size();
  17163. $ctx1.sendIdx["size"]=1;
  17164. $7=$recv($8).__plus($10);
  17165. $ctx1.sendIdx["+"]=1;
  17166. $11=$recv(self._collection())._size();
  17167. $ctx1.sendIdx["size"]=2;
  17168. post=$recv($6)._copyFrom_to_($7,$11);
  17169. post;
  17170. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  17171. $ctx1.sendIdx[","]=2;
  17172. self._setCollection_($12);
  17173. };
  17174. $14=self._position();
  17175. $ctx1.sendIdx["position"]=3;
  17176. $13=$recv($14).__plus($recv(aString)._size());
  17177. self._position_($13);
  17178. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  17179. return self;
  17180. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  17181. },
  17182. args: ["aString"],
  17183. 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)",
  17184. referencedClasses: [],
  17185. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  17186. }),
  17187. $globals.StringStream);
  17188. $core.addMethod(
  17189. $core.method({
  17190. selector: "nextPutString:",
  17191. protocol: 'writing',
  17192. fn: function (aString){
  17193. var self=this;
  17194. return $core.withContext(function($ctx1) {
  17195. self._nextPutAll_(aString);
  17196. return self;
  17197. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  17198. },
  17199. args: ["aString"],
  17200. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  17201. referencedClasses: [],
  17202. messageSends: ["nextPutAll:"]
  17203. }),
  17204. $globals.StringStream);
  17205. $core.addMethod(
  17206. $core.method({
  17207. selector: "space",
  17208. protocol: 'writing',
  17209. fn: function (){
  17210. var self=this;
  17211. return $core.withContext(function($ctx1) {
  17212. self._nextPut_(" ");
  17213. return self;
  17214. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  17215. },
  17216. args: [],
  17217. source: "space\x0a\x09self nextPut: ' '",
  17218. referencedClasses: [],
  17219. messageSends: ["nextPut:"]
  17220. }),
  17221. $globals.StringStream);
  17222. $core.addMethod(
  17223. $core.method({
  17224. selector: "tab",
  17225. protocol: 'writing',
  17226. fn: function (){
  17227. var self=this;
  17228. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  17229. return $core.withContext(function($ctx1) {
  17230. var $1;
  17231. $1=self._nextPutAll_($recv($String())._tab());
  17232. return $1;
  17233. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  17234. },
  17235. args: [],
  17236. source: "tab\x0a\x09^ self nextPutAll: String tab",
  17237. referencedClasses: ["String"],
  17238. messageSends: ["nextPutAll:", "tab"]
  17239. }),
  17240. $globals.StringStream);
  17241. $core.addClass('Queue', $globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  17242. $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.";
  17243. $core.addMethod(
  17244. $core.method({
  17245. selector: "initialize",
  17246. protocol: 'initialization',
  17247. fn: function (){
  17248. var self=this;
  17249. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  17250. return $core.withContext(function($ctx1) {
  17251. (
  17252. $ctx1.supercall = true,
  17253. $globals.Queue.superclass.fn.prototype._initialize.apply($recv(self), []));
  17254. $ctx1.supercall = false;
  17255. self["@read"]=$recv($OrderedCollection())._new();
  17256. $ctx1.sendIdx["new"]=1;
  17257. self["@write"]=$recv($OrderedCollection())._new();
  17258. self["@readIndex"]=(1);
  17259. return self;
  17260. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  17261. },
  17262. args: [],
  17263. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  17264. referencedClasses: ["OrderedCollection"],
  17265. messageSends: ["initialize", "new"]
  17266. }),
  17267. $globals.Queue);
  17268. $core.addMethod(
  17269. $core.method({
  17270. selector: "next",
  17271. protocol: 'accessing',
  17272. fn: function (){
  17273. var self=this;
  17274. return $core.withContext(function($ctx1) {
  17275. var $1;
  17276. $1=self._nextIfAbsent_((function(){
  17277. return $core.withContext(function($ctx2) {
  17278. return self._error_("Cannot read from empty Queue.");
  17279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17280. }));
  17281. return $1;
  17282. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  17283. },
  17284. args: [],
  17285. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  17286. referencedClasses: [],
  17287. messageSends: ["nextIfAbsent:", "error:"]
  17288. }),
  17289. $globals.Queue);
  17290. $core.addMethod(
  17291. $core.method({
  17292. selector: "nextIfAbsent:",
  17293. protocol: 'accessing',
  17294. fn: function (aBlock){
  17295. var self=this;
  17296. var result;
  17297. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  17298. return $core.withContext(function($ctx1) {
  17299. var $1,$2,$3,$4;
  17300. var $early={};
  17301. try {
  17302. result=$recv(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  17303. return $core.withContext(function($ctx2) {
  17304. $1=$recv(self["@write"])._isEmpty();
  17305. if($core.assert($1)){
  17306. $2=$recv(self["@readIndex"]).__gt((1));
  17307. if($core.assert($2)){
  17308. self["@read"]=[];
  17309. self["@read"];
  17310. self["@readIndex"]=(1);
  17311. self["@readIndex"];
  17312. };
  17313. $3=$recv(aBlock)._value();
  17314. throw $early=[$3];
  17315. };
  17316. self["@read"]=self["@write"];
  17317. self["@read"];
  17318. self["@readIndex"]=(1);
  17319. self["@readIndex"];
  17320. self["@write"]=$recv($OrderedCollection())._new();
  17321. self["@write"];
  17322. return $recv(self["@read"])._first();
  17323. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17324. }));
  17325. $recv(self["@read"])._at_put_(self["@readIndex"],nil);
  17326. self["@readIndex"]=$recv(self["@readIndex"]).__plus((1));
  17327. $4=result;
  17328. return $4;
  17329. }
  17330. catch(e) {if(e===$early)return e[0]; throw e}
  17331. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  17332. },
  17333. args: ["aBlock"],
  17334. 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",
  17335. referencedClasses: ["OrderedCollection"],
  17336. messageSends: ["at:ifAbsent:", "ifTrue:", "isEmpty", ">", "value", "new", "first", "at:put:", "+"]
  17337. }),
  17338. $globals.Queue);
  17339. $core.addMethod(
  17340. $core.method({
  17341. selector: "nextPut:",
  17342. protocol: 'accessing',
  17343. fn: function (anObject){
  17344. var self=this;
  17345. return $core.withContext(function($ctx1) {
  17346. $recv(self["@write"])._add_(anObject);
  17347. return self;
  17348. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  17349. },
  17350. args: ["anObject"],
  17351. source: "nextPut: anObject\x0a\x09write add: anObject",
  17352. referencedClasses: [],
  17353. messageSends: ["add:"]
  17354. }),
  17355. $globals.Queue);
  17356. $core.addClass('RegularExpression', $globals.Object, [], 'Kernel-Collections');
  17357. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  17358. $core.addMethod(
  17359. $core.method({
  17360. selector: "compile:",
  17361. protocol: 'evaluating',
  17362. fn: function (aString){
  17363. var self=this;
  17364. return $core.withContext(function($ctx1) {
  17365. return self.compile(aString);
  17366. return self;
  17367. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  17368. },
  17369. args: ["aString"],
  17370. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  17371. referencedClasses: [],
  17372. messageSends: []
  17373. }),
  17374. $globals.RegularExpression);
  17375. $core.addMethod(
  17376. $core.method({
  17377. selector: "exec:",
  17378. protocol: 'evaluating',
  17379. fn: function (aString){
  17380. var self=this;
  17381. return $core.withContext(function($ctx1) {
  17382. return self.exec(aString) || nil;
  17383. return self;
  17384. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  17385. },
  17386. args: ["aString"],
  17387. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  17388. referencedClasses: [],
  17389. messageSends: []
  17390. }),
  17391. $globals.RegularExpression);
  17392. $core.addMethod(
  17393. $core.method({
  17394. selector: "test:",
  17395. protocol: 'evaluating',
  17396. fn: function (aString){
  17397. var self=this;
  17398. return $core.withContext(function($ctx1) {
  17399. return self.test(aString);
  17400. return self;
  17401. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  17402. },
  17403. args: ["aString"],
  17404. source: "test: aString\x0a\x09<return self.test(aString)>",
  17405. referencedClasses: [],
  17406. messageSends: []
  17407. }),
  17408. $globals.RegularExpression);
  17409. $core.addMethod(
  17410. $core.method({
  17411. selector: "fromString:",
  17412. protocol: 'instance creation',
  17413. fn: function (aString){
  17414. var self=this;
  17415. return $core.withContext(function($ctx1) {
  17416. var $1;
  17417. $1=self._fromString_flag_(aString,"");
  17418. return $1;
  17419. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.klass)});
  17420. },
  17421. args: ["aString"],
  17422. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  17423. referencedClasses: [],
  17424. messageSends: ["fromString:flag:"]
  17425. }),
  17426. $globals.RegularExpression.klass);
  17427. $core.addMethod(
  17428. $core.method({
  17429. selector: "fromString:flag:",
  17430. protocol: 'instance creation',
  17431. fn: function (aString,anotherString){
  17432. var self=this;
  17433. return $core.withContext(function($ctx1) {
  17434. return new RegExp(aString, anotherString);
  17435. return self;
  17436. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.klass)});
  17437. },
  17438. args: ["aString", "anotherString"],
  17439. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  17440. referencedClasses: [],
  17441. messageSends: []
  17442. }),
  17443. $globals.RegularExpression.klass);
  17444. });
  17445. define("amber_core/Kernel-Exceptions", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  17446. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  17447. $core.addPackage('Kernel-Exceptions');
  17448. $core.packages["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
  17449. $core.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17450. $core.addClass('Error', $globals.Object, ['messageText'], 'Kernel-Exceptions');
  17451. $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.";
  17452. $core.addMethod(
  17453. $core.method({
  17454. selector: "beHandled",
  17455. protocol: 'accessing',
  17456. fn: function (){
  17457. var self=this;
  17458. return $core.withContext(function($ctx1) {
  17459. self.amberHandled = true;
  17460. return self;
  17461. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  17462. },
  17463. args: [],
  17464. source: "beHandled\x0a\x09<self.amberHandled = true>",
  17465. referencedClasses: [],
  17466. messageSends: []
  17467. }),
  17468. $globals.Error);
  17469. $core.addMethod(
  17470. $core.method({
  17471. selector: "beUnhandled",
  17472. protocol: 'accessing',
  17473. fn: function (){
  17474. var self=this;
  17475. return $core.withContext(function($ctx1) {
  17476. self.amberHandled = false;
  17477. return self;
  17478. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  17479. },
  17480. args: [],
  17481. source: "beUnhandled\x0a\x09<self.amberHandled = false>",
  17482. referencedClasses: [],
  17483. messageSends: []
  17484. }),
  17485. $globals.Error);
  17486. $core.addMethod(
  17487. $core.method({
  17488. selector: "context",
  17489. protocol: 'accessing',
  17490. fn: function (){
  17491. var self=this;
  17492. return $core.withContext(function($ctx1) {
  17493. return self.context;
  17494. return self;
  17495. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  17496. },
  17497. args: [],
  17498. source: "context\x0a\x09<return self.context>",
  17499. referencedClasses: [],
  17500. messageSends: []
  17501. }),
  17502. $globals.Error);
  17503. $core.addMethod(
  17504. $core.method({
  17505. selector: "initialize",
  17506. protocol: 'initialization',
  17507. fn: function (){
  17508. var self=this;
  17509. return $core.withContext(function($ctx1) {
  17510. self._messageText_("Errorclass: ".__comma($recv(self._class())._name()));
  17511. return self;
  17512. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  17513. },
  17514. args: [],
  17515. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  17516. referencedClasses: [],
  17517. messageSends: ["messageText:", ",", "name", "class"]
  17518. }),
  17519. $globals.Error);
  17520. $core.addMethod(
  17521. $core.method({
  17522. selector: "isSmalltalkError",
  17523. protocol: 'testing',
  17524. fn: function (){
  17525. var self=this;
  17526. return $core.withContext(function($ctx1) {
  17527. return self.smalltalkError === true;
  17528. return self;
  17529. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  17530. },
  17531. args: [],
  17532. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  17533. referencedClasses: [],
  17534. messageSends: []
  17535. }),
  17536. $globals.Error);
  17537. $core.addMethod(
  17538. $core.method({
  17539. selector: "jsStack",
  17540. protocol: 'accessing',
  17541. fn: function (){
  17542. var self=this;
  17543. return $core.withContext(function($ctx1) {
  17544. return self.stack;
  17545. return self;
  17546. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  17547. },
  17548. args: [],
  17549. source: "jsStack\x0a\x09<return self.stack>",
  17550. referencedClasses: [],
  17551. messageSends: []
  17552. }),
  17553. $globals.Error);
  17554. $core.addMethod(
  17555. $core.method({
  17556. selector: "messageText",
  17557. protocol: 'accessing',
  17558. fn: function (){
  17559. var self=this;
  17560. var $1;
  17561. $1=self["@messageText"];
  17562. return $1;
  17563. },
  17564. args: [],
  17565. source: "messageText\x0a\x09^ messageText",
  17566. referencedClasses: [],
  17567. messageSends: []
  17568. }),
  17569. $globals.Error);
  17570. $core.addMethod(
  17571. $core.method({
  17572. selector: "messageText:",
  17573. protocol: 'accessing',
  17574. fn: function (aString){
  17575. var self=this;
  17576. self["@messageText"]=aString;
  17577. return self;
  17578. },
  17579. args: ["aString"],
  17580. source: "messageText: aString\x0a\x09messageText := aString",
  17581. referencedClasses: [],
  17582. messageSends: []
  17583. }),
  17584. $globals.Error);
  17585. $core.addMethod(
  17586. $core.method({
  17587. selector: "resignal",
  17588. protocol: 'signaling',
  17589. fn: function (){
  17590. var self=this;
  17591. return $core.withContext(function($ctx1) {
  17592. self.amberHandled = false;
  17593. throw(self);
  17594. ;
  17595. return self;
  17596. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  17597. },
  17598. args: [],
  17599. 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>",
  17600. referencedClasses: [],
  17601. messageSends: []
  17602. }),
  17603. $globals.Error);
  17604. $core.addMethod(
  17605. $core.method({
  17606. selector: "signal",
  17607. protocol: 'signaling',
  17608. fn: function (){
  17609. var self=this;
  17610. return $core.withContext(function($ctx1) {
  17611. self.amberHandled = false;
  17612. self.context = $core.getThisContext();
  17613. self.smalltalkError = true;
  17614. throw self;
  17615. ;
  17616. return self;
  17617. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  17618. },
  17619. args: [],
  17620. 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>",
  17621. referencedClasses: [],
  17622. messageSends: []
  17623. }),
  17624. $globals.Error);
  17625. $core.addMethod(
  17626. $core.method({
  17627. selector: "signal:",
  17628. protocol: 'signaling',
  17629. fn: function (aString){
  17630. var self=this;
  17631. return $core.withContext(function($ctx1) {
  17632. self._messageText_(aString);
  17633. self._signal();
  17634. return self;
  17635. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  17636. },
  17637. args: ["aString"],
  17638. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  17639. referencedClasses: [],
  17640. messageSends: ["messageText:", "signal"]
  17641. }),
  17642. $globals.Error);
  17643. $core.addMethod(
  17644. $core.method({
  17645. selector: "signalerContext",
  17646. protocol: 'accessing',
  17647. fn: function (){
  17648. var self=this;
  17649. return $core.withContext(function($ctx1) {
  17650. var $1;
  17651. $1=self._signalerContextFrom_(self._context());
  17652. return $1;
  17653. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  17654. },
  17655. args: [],
  17656. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  17657. referencedClasses: [],
  17658. messageSends: ["signalerContextFrom:", "context"]
  17659. }),
  17660. $globals.Error);
  17661. $core.addMethod(
  17662. $core.method({
  17663. selector: "signalerContextFrom:",
  17664. protocol: 'accessing',
  17665. fn: function (aContext){
  17666. var self=this;
  17667. return $core.withContext(function($ctx1) {
  17668. var $4,$3,$2,$1;
  17669. $1=$recv(aContext)._findContextSuchThat_((function(context){
  17670. return $core.withContext(function($ctx2) {
  17671. $4=$recv(context)._receiver();
  17672. $ctx2.sendIdx["receiver"]=1;
  17673. $3=$recv($4).__eq_eq(self);
  17674. $ctx2.sendIdx["=="]=1;
  17675. $2=$recv($3)._or_((function(){
  17676. return $core.withContext(function($ctx3) {
  17677. return $recv($recv(context)._receiver()).__eq_eq(self._class());
  17678. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17679. }));
  17680. return $recv($2)._not();
  17681. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  17682. }));
  17683. return $1;
  17684. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  17685. },
  17686. args: ["aContext"],
  17687. 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 ]",
  17688. referencedClasses: [],
  17689. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  17690. }),
  17691. $globals.Error);
  17692. $core.addMethod(
  17693. $core.method({
  17694. selector: "wasHandled",
  17695. protocol: 'testing',
  17696. fn: function (){
  17697. var self=this;
  17698. return $core.withContext(function($ctx1) {
  17699. return self.amberHandled || false;
  17700. return self;
  17701. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  17702. },
  17703. args: [],
  17704. source: "wasHandled\x0a\x09<return self.amberHandled || false>",
  17705. referencedClasses: [],
  17706. messageSends: []
  17707. }),
  17708. $globals.Error);
  17709. $core.addMethod(
  17710. $core.method({
  17711. selector: "classTag",
  17712. protocol: 'accessing',
  17713. fn: function (){
  17714. var self=this;
  17715. return "exception";
  17716. },
  17717. args: [],
  17718. 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'",
  17719. referencedClasses: [],
  17720. messageSends: []
  17721. }),
  17722. $globals.Error.klass);
  17723. $core.addMethod(
  17724. $core.method({
  17725. selector: "signal",
  17726. protocol: 'instance creation',
  17727. fn: function (){
  17728. var self=this;
  17729. return $core.withContext(function($ctx1) {
  17730. var $1;
  17731. $1=$recv(self._new())._signal();
  17732. return $1;
  17733. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.klass)});
  17734. },
  17735. args: [],
  17736. source: "signal\x0a\x09^ self new signal",
  17737. referencedClasses: [],
  17738. messageSends: ["signal", "new"]
  17739. }),
  17740. $globals.Error.klass);
  17741. $core.addMethod(
  17742. $core.method({
  17743. selector: "signal:",
  17744. protocol: 'instance creation',
  17745. fn: function (aString){
  17746. var self=this;
  17747. return $core.withContext(function($ctx1) {
  17748. var $1;
  17749. $1=$recv(self._new())._signal_(aString);
  17750. return $1;
  17751. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.klass)});
  17752. },
  17753. args: ["aString"],
  17754. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  17755. referencedClasses: [],
  17756. messageSends: ["signal:", "new"]
  17757. }),
  17758. $globals.Error.klass);
  17759. $core.addClass('Halt', $globals.Error, [], 'Kernel-Exceptions');
  17760. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  17761. $core.addMethod(
  17762. $core.method({
  17763. selector: "messageText",
  17764. protocol: 'accessing',
  17765. fn: function (){
  17766. var self=this;
  17767. return "Halt encountered";
  17768. },
  17769. args: [],
  17770. source: "messageText\x0a\x09^ 'Halt encountered'",
  17771. referencedClasses: [],
  17772. messageSends: []
  17773. }),
  17774. $globals.Halt);
  17775. $core.addMethod(
  17776. $core.method({
  17777. selector: "signalerContextFrom:",
  17778. protocol: 'accessing',
  17779. fn: function (aContext){
  17780. var self=this;
  17781. return $core.withContext(function($ctx1) {
  17782. var $4,$3,$2,$1;
  17783. $1=$recv(aContext)._findContextSuchThat_((function(context){
  17784. return $core.withContext(function($ctx2) {
  17785. $4=$recv(context)._receiver();
  17786. $ctx2.sendIdx["receiver"]=1;
  17787. $3=$recv($4).__eq_eq(self);
  17788. $ctx2.sendIdx["=="]=1;
  17789. $2=$recv($3)._or_((function(){
  17790. return $core.withContext(function($ctx3) {
  17791. return $recv($recv($recv(context)._receiver()).__eq_eq(self._class()))._or_((function(){
  17792. return $core.withContext(function($ctx4) {
  17793. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  17794. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  17795. }));
  17796. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17797. }));
  17798. $ctx2.sendIdx["or:"]=1;
  17799. return $recv($2)._not();
  17800. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  17801. }));
  17802. return $1;
  17803. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  17804. },
  17805. args: ["aContext"],
  17806. 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 ]",
  17807. referencedClasses: [],
  17808. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  17809. }),
  17810. $globals.Halt);
  17811. $core.addClass('JavaScriptException', $globals.Error, ['exception'], 'Kernel-Exceptions');
  17812. $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:`";
  17813. $core.addMethod(
  17814. $core.method({
  17815. selector: "context:",
  17816. protocol: 'accessing',
  17817. fn: function (aMethodContext){
  17818. var self=this;
  17819. return $core.withContext(function($ctx1) {
  17820. self.context = aMethodContext;
  17821. return self;
  17822. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  17823. },
  17824. args: ["aMethodContext"],
  17825. 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>",
  17826. referencedClasses: [],
  17827. messageSends: []
  17828. }),
  17829. $globals.JavaScriptException);
  17830. $core.addMethod(
  17831. $core.method({
  17832. selector: "exception",
  17833. protocol: 'accessing',
  17834. fn: function (){
  17835. var self=this;
  17836. var $1;
  17837. $1=self["@exception"];
  17838. return $1;
  17839. },
  17840. args: [],
  17841. source: "exception\x0a\x09^ exception",
  17842. referencedClasses: [],
  17843. messageSends: []
  17844. }),
  17845. $globals.JavaScriptException);
  17846. $core.addMethod(
  17847. $core.method({
  17848. selector: "exception:",
  17849. protocol: 'accessing',
  17850. fn: function (anException){
  17851. var self=this;
  17852. self["@exception"]=anException;
  17853. return self;
  17854. },
  17855. args: ["anException"],
  17856. source: "exception: anException\x0a\x09exception := anException",
  17857. referencedClasses: [],
  17858. messageSends: []
  17859. }),
  17860. $globals.JavaScriptException);
  17861. $core.addMethod(
  17862. $core.method({
  17863. selector: "messageText",
  17864. protocol: 'accessing',
  17865. fn: function (){
  17866. var self=this;
  17867. return $core.withContext(function($ctx1) {
  17868. return 'JavaScript exception: ' + self["@exception"].toString();
  17869. return self;
  17870. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  17871. },
  17872. args: [],
  17873. source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
  17874. referencedClasses: [],
  17875. messageSends: []
  17876. }),
  17877. $globals.JavaScriptException);
  17878. $core.addMethod(
  17879. $core.method({
  17880. selector: "on:",
  17881. protocol: 'instance creation',
  17882. fn: function (anException){
  17883. var self=this;
  17884. return $core.withContext(function($ctx1) {
  17885. var $2,$3,$1;
  17886. $2=self._new();
  17887. $recv($2)._exception_(anException);
  17888. $3=$recv($2)._yourself();
  17889. $1=$3;
  17890. return $1;
  17891. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.klass)});
  17892. },
  17893. args: ["anException"],
  17894. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  17895. referencedClasses: [],
  17896. messageSends: ["exception:", "new", "yourself"]
  17897. }),
  17898. $globals.JavaScriptException.klass);
  17899. $core.addMethod(
  17900. $core.method({
  17901. selector: "on:context:",
  17902. protocol: 'instance creation',
  17903. fn: function (anException,aMethodContext){
  17904. var self=this;
  17905. return $core.withContext(function($ctx1) {
  17906. var $2,$3,$1;
  17907. $2=self._new();
  17908. $recv($2)._exception_(anException);
  17909. $recv($2)._context_(aMethodContext);
  17910. $3=$recv($2)._yourself();
  17911. $1=$3;
  17912. return $1;
  17913. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.klass)});
  17914. },
  17915. args: ["anException", "aMethodContext"],
  17916. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  17917. referencedClasses: [],
  17918. messageSends: ["exception:", "new", "context:", "yourself"]
  17919. }),
  17920. $globals.JavaScriptException.klass);
  17921. $core.addClass('MessageNotUnderstood', $globals.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  17922. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  17923. $core.addMethod(
  17924. $core.method({
  17925. selector: "message",
  17926. protocol: 'accessing',
  17927. fn: function (){
  17928. var self=this;
  17929. var $1;
  17930. $1=self["@message"];
  17931. return $1;
  17932. },
  17933. args: [],
  17934. source: "message\x0a\x09^ message",
  17935. referencedClasses: [],
  17936. messageSends: []
  17937. }),
  17938. $globals.MessageNotUnderstood);
  17939. $core.addMethod(
  17940. $core.method({
  17941. selector: "message:",
  17942. protocol: 'accessing',
  17943. fn: function (aMessage){
  17944. var self=this;
  17945. self["@message"]=aMessage;
  17946. return self;
  17947. },
  17948. args: ["aMessage"],
  17949. source: "message: aMessage\x0a\x09message := aMessage",
  17950. referencedClasses: [],
  17951. messageSends: []
  17952. }),
  17953. $globals.MessageNotUnderstood);
  17954. $core.addMethod(
  17955. $core.method({
  17956. selector: "messageText",
  17957. protocol: 'accessing',
  17958. fn: function (){
  17959. var self=this;
  17960. return $core.withContext(function($ctx1) {
  17961. var $1;
  17962. $1=$recv($recv($recv(self._receiver())._asString()).__comma(" does not understand #")).__comma($recv(self._message())._selector());
  17963. $ctx1.sendIdx[","]=1;
  17964. return $1;
  17965. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  17966. },
  17967. args: [],
  17968. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  17969. referencedClasses: [],
  17970. messageSends: [",", "asString", "receiver", "selector", "message"]
  17971. }),
  17972. $globals.MessageNotUnderstood);
  17973. $core.addMethod(
  17974. $core.method({
  17975. selector: "receiver",
  17976. protocol: 'accessing',
  17977. fn: function (){
  17978. var self=this;
  17979. var $1;
  17980. $1=self["@receiver"];
  17981. return $1;
  17982. },
  17983. args: [],
  17984. source: "receiver\x0a\x09^ receiver",
  17985. referencedClasses: [],
  17986. messageSends: []
  17987. }),
  17988. $globals.MessageNotUnderstood);
  17989. $core.addMethod(
  17990. $core.method({
  17991. selector: "receiver:",
  17992. protocol: 'accessing',
  17993. fn: function (anObject){
  17994. var self=this;
  17995. self["@receiver"]=anObject;
  17996. return self;
  17997. },
  17998. args: ["anObject"],
  17999. source: "receiver: anObject\x0a\x09receiver := anObject",
  18000. referencedClasses: [],
  18001. messageSends: []
  18002. }),
  18003. $globals.MessageNotUnderstood);
  18004. $core.addClass('NonBooleanReceiver', $globals.Error, ['object'], 'Kernel-Exceptions');
  18005. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  18006. $core.addMethod(
  18007. $core.method({
  18008. selector: "object",
  18009. protocol: 'accessing',
  18010. fn: function (){
  18011. var self=this;
  18012. var $1;
  18013. $1=self["@object"];
  18014. return $1;
  18015. },
  18016. args: [],
  18017. source: "object\x0a\x09^ object",
  18018. referencedClasses: [],
  18019. messageSends: []
  18020. }),
  18021. $globals.NonBooleanReceiver);
  18022. $core.addMethod(
  18023. $core.method({
  18024. selector: "object:",
  18025. protocol: 'accessing',
  18026. fn: function (anObject){
  18027. var self=this;
  18028. self["@object"]=anObject;
  18029. return self;
  18030. },
  18031. args: ["anObject"],
  18032. source: "object: anObject\x0a\x09object := anObject",
  18033. referencedClasses: [],
  18034. messageSends: []
  18035. }),
  18036. $globals.NonBooleanReceiver);
  18037. });
  18038. define("amber_core/Kernel-Infrastructure", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Collections"], function($boot){"use strict";
  18039. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  18040. $core.addPackage('Kernel-Infrastructure');
  18041. $core.packages["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  18042. $core.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  18043. $core.addClass('JSObjectProxy', $globals.ProtoObject, ['jsObject'], 'Kernel-Infrastructure');
  18044. $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`.";
  18045. $core.addMethod(
  18046. $core.method({
  18047. selector: "=",
  18048. protocol: 'comparing',
  18049. fn: function (anObject){
  18050. var self=this;
  18051. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  18052. return $core.withContext(function($ctx1) {
  18053. var $2,$1,$3;
  18054. $2=$recv(anObject)._class();
  18055. $ctx1.sendIdx["class"]=1;
  18056. $1=$recv($2).__eq_eq(self._class());
  18057. if(!$core.assert($1)){
  18058. return false;
  18059. };
  18060. $3=$recv($JSObjectProxy())._compareJSObjectOfProxy_withProxy_(self,anObject);
  18061. return $3;
  18062. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  18063. },
  18064. args: ["anObject"],
  18065. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  18066. referencedClasses: ["JSObjectProxy"],
  18067. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  18068. }),
  18069. $globals.JSObjectProxy);
  18070. $core.addMethod(
  18071. $core.method({
  18072. selector: "asJSON",
  18073. protocol: 'enumerating',
  18074. fn: function (){
  18075. var self=this;
  18076. var $1;
  18077. $1=self["@jsObject"];
  18078. return $1;
  18079. },
  18080. args: [],
  18081. source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  18082. referencedClasses: [],
  18083. messageSends: []
  18084. }),
  18085. $globals.JSObjectProxy);
  18086. $core.addMethod(
  18087. $core.method({
  18088. selector: "at:",
  18089. protocol: 'accessing',
  18090. fn: function (aString){
  18091. var self=this;
  18092. return $core.withContext(function($ctx1) {
  18093. return self['@jsObject'][aString];
  18094. return self;
  18095. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  18096. },
  18097. args: ["aString"],
  18098. source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
  18099. referencedClasses: [],
  18100. messageSends: []
  18101. }),
  18102. $globals.JSObjectProxy);
  18103. $core.addMethod(
  18104. $core.method({
  18105. selector: "at:ifAbsent:",
  18106. protocol: 'accessing',
  18107. fn: function (aString,aBlock){
  18108. var self=this;
  18109. return $core.withContext(function($ctx1) {
  18110. var obj = self['@jsObject'];
  18111. return aString in obj ? obj[aString] : aBlock._value();
  18112. ;
  18113. return self;
  18114. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  18115. },
  18116. args: ["aString", "aBlock"],
  18117. 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>",
  18118. referencedClasses: [],
  18119. messageSends: []
  18120. }),
  18121. $globals.JSObjectProxy);
  18122. $core.addMethod(
  18123. $core.method({
  18124. selector: "at:ifPresent:",
  18125. protocol: 'accessing',
  18126. fn: function (aString,aBlock){
  18127. var self=this;
  18128. return $core.withContext(function($ctx1) {
  18129. var obj = self['@jsObject'];
  18130. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  18131. ;
  18132. return self;
  18133. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  18134. },
  18135. args: ["aString", "aBlock"],
  18136. 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>",
  18137. referencedClasses: [],
  18138. messageSends: []
  18139. }),
  18140. $globals.JSObjectProxy);
  18141. $core.addMethod(
  18142. $core.method({
  18143. selector: "at:ifPresent:ifAbsent:",
  18144. protocol: 'accessing',
  18145. fn: function (aString,aBlock,anotherBlock){
  18146. var self=this;
  18147. return $core.withContext(function($ctx1) {
  18148. var obj = self['@jsObject'];
  18149. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  18150. ;
  18151. return self;
  18152. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  18153. },
  18154. args: ["aString", "aBlock", "anotherBlock"],
  18155. 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>",
  18156. referencedClasses: [],
  18157. messageSends: []
  18158. }),
  18159. $globals.JSObjectProxy);
  18160. $core.addMethod(
  18161. $core.method({
  18162. selector: "at:put:",
  18163. protocol: 'accessing',
  18164. fn: function (aString,anObject){
  18165. var self=this;
  18166. return $core.withContext(function($ctx1) {
  18167. return self['@jsObject'][aString] = anObject;
  18168. return self;
  18169. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  18170. },
  18171. args: ["aString", "anObject"],
  18172. source: "at: aString put: anObject\x0a\x09<return self['@jsObject'][aString] = anObject>",
  18173. referencedClasses: [],
  18174. messageSends: []
  18175. }),
  18176. $globals.JSObjectProxy);
  18177. $core.addMethod(
  18178. $core.method({
  18179. selector: "doesNotUnderstand:",
  18180. protocol: 'proxy',
  18181. fn: function (aMessage){
  18182. var self=this;
  18183. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  18184. return $core.withContext(function($ctx1) {
  18185. var $2,$1,$receiver;
  18186. $2=$recv($JSObjectProxy())._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  18187. if(($receiver = $2) == null || $receiver.isNil){
  18188. $1=(
  18189. $ctx1.supercall = true,
  18190. $globals.JSObjectProxy.superclass.fn.prototype._doesNotUnderstand_.apply($recv(self), [aMessage]));
  18191. $ctx1.supercall = false;
  18192. } else {
  18193. var jsSelector;
  18194. jsSelector=$receiver;
  18195. $1=$recv($JSObjectProxy())._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  18196. };
  18197. return $1;
  18198. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  18199. },
  18200. args: ["aMessage"],
  18201. 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 ]",
  18202. referencedClasses: ["JSObjectProxy"],
  18203. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  18204. }),
  18205. $globals.JSObjectProxy);
  18206. $core.addMethod(
  18207. $core.method({
  18208. selector: "in:",
  18209. protocol: 'accessing',
  18210. fn: function (aValuable){
  18211. var self=this;
  18212. return $core.withContext(function($ctx1) {
  18213. var $1;
  18214. $1=$recv(aValuable)._value_(self["@jsObject"]);
  18215. return $1;
  18216. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  18217. },
  18218. args: ["aValuable"],
  18219. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  18220. referencedClasses: [],
  18221. messageSends: ["value:"]
  18222. }),
  18223. $globals.JSObjectProxy);
  18224. $core.addMethod(
  18225. $core.method({
  18226. selector: "jsObject",
  18227. protocol: 'accessing',
  18228. fn: function (){
  18229. var self=this;
  18230. var $1;
  18231. $1=self["@jsObject"];
  18232. return $1;
  18233. },
  18234. args: [],
  18235. source: "jsObject\x0a\x09^ jsObject",
  18236. referencedClasses: [],
  18237. messageSends: []
  18238. }),
  18239. $globals.JSObjectProxy);
  18240. $core.addMethod(
  18241. $core.method({
  18242. selector: "keysAndValuesDo:",
  18243. protocol: 'enumerating',
  18244. fn: function (aBlock){
  18245. var self=this;
  18246. return $core.withContext(function($ctx1) {
  18247. var o = self['@jsObject'];
  18248. for(var i in o) {
  18249. aBlock._value_value_(i, o[i]);
  18250. }
  18251. ;
  18252. return self;
  18253. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  18254. },
  18255. args: ["aBlock"],
  18256. 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>",
  18257. referencedClasses: [],
  18258. messageSends: []
  18259. }),
  18260. $globals.JSObjectProxy);
  18261. $core.addMethod(
  18262. $core.method({
  18263. selector: "printOn:",
  18264. protocol: 'printing',
  18265. fn: function (aStream){
  18266. var self=this;
  18267. return $core.withContext(function($ctx1) {
  18268. $recv(aStream)._nextPutAll_(self._printString());
  18269. return self;
  18270. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  18271. },
  18272. args: ["aStream"],
  18273. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  18274. referencedClasses: [],
  18275. messageSends: ["nextPutAll:", "printString"]
  18276. }),
  18277. $globals.JSObjectProxy);
  18278. $core.addMethod(
  18279. $core.method({
  18280. selector: "printString",
  18281. protocol: 'printing',
  18282. fn: function (){
  18283. var self=this;
  18284. return $core.withContext(function($ctx1) {
  18285. var js = self['@jsObject'];
  18286. return js.toString
  18287. ? js.toString()
  18288. : Object.prototype.toString.call(js)
  18289. ;
  18290. return self;
  18291. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  18292. },
  18293. args: [],
  18294. 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>",
  18295. referencedClasses: [],
  18296. messageSends: []
  18297. }),
  18298. $globals.JSObjectProxy);
  18299. $core.addMethod(
  18300. $core.method({
  18301. selector: "putOn:",
  18302. protocol: 'streaming',
  18303. fn: function (aStream){
  18304. var self=this;
  18305. return $core.withContext(function($ctx1) {
  18306. $recv(aStream)._nextPutJSObject_(self["@jsObject"]);
  18307. return self;
  18308. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  18309. },
  18310. args: ["aStream"],
  18311. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  18312. referencedClasses: [],
  18313. messageSends: ["nextPutJSObject:"]
  18314. }),
  18315. $globals.JSObjectProxy);
  18316. $core.addMethod(
  18317. $core.method({
  18318. selector: "addObjectVariablesTo:ofProxy:",
  18319. protocol: 'proxy',
  18320. fn: function (aDictionary,aProxy){
  18321. var self=this;
  18322. return $core.withContext(function($ctx1) {
  18323. var jsObject = aProxy['@jsObject'];
  18324. for(var i in jsObject) {
  18325. aDictionary._at_put_(i, jsObject[i]);
  18326. }
  18327. ;
  18328. return self;
  18329. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18330. },
  18331. args: ["aDictionary", "aProxy"],
  18332. 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>",
  18333. referencedClasses: [],
  18334. messageSends: []
  18335. }),
  18336. $globals.JSObjectProxy.klass);
  18337. $core.addMethod(
  18338. $core.method({
  18339. selector: "compareJSObjectOfProxy:withProxy:",
  18340. protocol: 'proxy',
  18341. fn: function (aProxy,anotherProxy){
  18342. var self=this;
  18343. return $core.withContext(function($ctx1) {
  18344. var anotherJSObject = anotherProxy.klass ? anotherProxy["@jsObject"] : anotherProxy;
  18345. return aProxy["@jsObject"] === anotherJSObject;
  18346. return self;
  18347. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.klass)});
  18348. },
  18349. args: ["aProxy", "anotherProxy"],
  18350. source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<\x0a\x09var anotherJSObject = anotherProxy.klass ? anotherProxy[\x22@jsObject\x22] : anotherProxy;\x0a\x09return aProxy[\x22@jsObject\x22] === anotherJSObject\x0a>",
  18351. referencedClasses: [],
  18352. messageSends: []
  18353. }),
  18354. $globals.JSObjectProxy.klass);
  18355. $core.addMethod(
  18356. $core.method({
  18357. selector: "forwardMessage:withArguments:ofProxy:",
  18358. protocol: 'proxy',
  18359. fn: function (aString,anArray,aProxy){
  18360. var self=this;
  18361. return $core.withContext(function($ctx1) {
  18362. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  18363. ;
  18364. return self;
  18365. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18366. },
  18367. args: ["aString", "anArray", "aProxy"],
  18368. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09>",
  18369. referencedClasses: [],
  18370. messageSends: []
  18371. }),
  18372. $globals.JSObjectProxy.klass);
  18373. $core.addMethod(
  18374. $core.method({
  18375. selector: "jsObject:ofProxy:",
  18376. protocol: 'proxy',
  18377. fn: function (aJSObject,aProxy){
  18378. var self=this;
  18379. return $core.withContext(function($ctx1) {
  18380. aProxy['@jsObject'] = aJSObject;
  18381. return self;
  18382. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18383. },
  18384. args: ["aJSObject", "aProxy"],
  18385. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<aProxy['@jsObject'] = aJSObject>",
  18386. referencedClasses: [],
  18387. messageSends: []
  18388. }),
  18389. $globals.JSObjectProxy.klass);
  18390. $core.addMethod(
  18391. $core.method({
  18392. selector: "lookupProperty:ofProxy:",
  18393. protocol: 'proxy',
  18394. fn: function (aString,aProxy){
  18395. var self=this;
  18396. return $core.withContext(function($ctx1) {
  18397. return aString in aProxy._jsObject() ? aString : nil;
  18398. return self;
  18399. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18400. },
  18401. args: ["aString", "aProxy"],
  18402. 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>",
  18403. referencedClasses: [],
  18404. messageSends: []
  18405. }),
  18406. $globals.JSObjectProxy.klass);
  18407. $core.addMethod(
  18408. $core.method({
  18409. selector: "on:",
  18410. protocol: 'instance creation',
  18411. fn: function (aJSObject){
  18412. var self=this;
  18413. var instance;
  18414. return $core.withContext(function($ctx1) {
  18415. var $1;
  18416. instance=self._new();
  18417. self._jsObject_ofProxy_(aJSObject,instance);
  18418. $1=instance;
  18419. return $1;
  18420. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.klass)});
  18421. },
  18422. args: ["aJSObject"],
  18423. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  18424. referencedClasses: [],
  18425. messageSends: ["new", "jsObject:ofProxy:"]
  18426. }),
  18427. $globals.JSObjectProxy.klass);
  18428. $core.addClass('Organizer', $globals.Object, [], 'Kernel-Infrastructure');
  18429. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  18430. $core.addMethod(
  18431. $core.method({
  18432. selector: "addElement:",
  18433. protocol: 'accessing',
  18434. fn: function (anObject){
  18435. var self=this;
  18436. return $core.withContext(function($ctx1) {
  18437. self.elements.addElement(anObject);
  18438. return self;
  18439. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  18440. },
  18441. args: ["anObject"],
  18442. source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
  18443. referencedClasses: [],
  18444. messageSends: []
  18445. }),
  18446. $globals.Organizer);
  18447. $core.addMethod(
  18448. $core.method({
  18449. selector: "elements",
  18450. protocol: 'accessing',
  18451. fn: function (){
  18452. var self=this;
  18453. return $core.withContext(function($ctx1) {
  18454. var $1;
  18455. $1=$recv(self._basicAt_("elements"))._copy();
  18456. return $1;
  18457. }, function($ctx1) {$ctx1.fill(self,"elements",{},$globals.Organizer)});
  18458. },
  18459. args: [],
  18460. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  18461. referencedClasses: [],
  18462. messageSends: ["copy", "basicAt:"]
  18463. }),
  18464. $globals.Organizer);
  18465. $core.addMethod(
  18466. $core.method({
  18467. selector: "removeElement:",
  18468. protocol: 'accessing',
  18469. fn: function (anObject){
  18470. var self=this;
  18471. return $core.withContext(function($ctx1) {
  18472. self.elements.removeElement(anObject);
  18473. return self;
  18474. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  18475. },
  18476. args: ["anObject"],
  18477. source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
  18478. referencedClasses: [],
  18479. messageSends: []
  18480. }),
  18481. $globals.Organizer);
  18482. $core.addClass('ClassOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  18483. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  18484. $core.addMethod(
  18485. $core.method({
  18486. selector: "addElement:",
  18487. protocol: 'accessing',
  18488. fn: function (aString){
  18489. var self=this;
  18490. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  18491. function $ProtocolAdded(){return $globals.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)}
  18492. return $core.withContext(function($ctx1) {
  18493. var $1,$2;
  18494. (
  18495. $ctx1.supercall = true,
  18496. $globals.ClassOrganizer.superclass.fn.prototype._addElement_.apply($recv(self), [aString]));
  18497. $ctx1.supercall = false;
  18498. $1=$recv($ProtocolAdded())._new();
  18499. $recv($1)._protocol_(aString);
  18500. $recv($1)._theClass_(self._theClass());
  18501. $2=$recv($1)._yourself();
  18502. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  18503. return self;
  18504. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  18505. },
  18506. args: ["aString"],
  18507. 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)",
  18508. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  18509. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  18510. }),
  18511. $globals.ClassOrganizer);
  18512. $core.addMethod(
  18513. $core.method({
  18514. selector: "removeElement:",
  18515. protocol: 'accessing',
  18516. fn: function (aString){
  18517. var self=this;
  18518. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  18519. function $ProtocolRemoved(){return $globals.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)}
  18520. return $core.withContext(function($ctx1) {
  18521. var $1,$2;
  18522. (
  18523. $ctx1.supercall = true,
  18524. $globals.ClassOrganizer.superclass.fn.prototype._removeElement_.apply($recv(self), [aString]));
  18525. $ctx1.supercall = false;
  18526. $1=$recv($ProtocolRemoved())._new();
  18527. $recv($1)._protocol_(aString);
  18528. $recv($1)._theClass_(self._theClass());
  18529. $2=$recv($1)._yourself();
  18530. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  18531. return self;
  18532. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  18533. },
  18534. args: ["aString"],
  18535. 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)",
  18536. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  18537. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  18538. }),
  18539. $globals.ClassOrganizer);
  18540. $core.addMethod(
  18541. $core.method({
  18542. selector: "theClass",
  18543. protocol: 'accessing',
  18544. fn: function (){
  18545. var self=this;
  18546. return $core.withContext(function($ctx1) {
  18547. return self.theClass ;
  18548. return self;
  18549. }, function($ctx1) {$ctx1.fill(self,"theClass",{},$globals.ClassOrganizer)});
  18550. },
  18551. args: [],
  18552. source: "theClass\x0a\x09< return self.theClass >",
  18553. referencedClasses: [],
  18554. messageSends: []
  18555. }),
  18556. $globals.ClassOrganizer);
  18557. $core.addClass('PackageOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  18558. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  18559. $core.addClass('Package', $globals.Object, ['transport', 'imports', 'dirty'], 'Kernel-Infrastructure');
  18560. $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'";
  18561. $core.addMethod(
  18562. $core.method({
  18563. selector: "basicImports",
  18564. protocol: 'private',
  18565. fn: function (){
  18566. var self=this;
  18567. return $core.withContext(function($ctx1) {
  18568. return self.imports || [];
  18569. return self;
  18570. }, function($ctx1) {$ctx1.fill(self,"basicImports",{},$globals.Package)});
  18571. },
  18572. args: [],
  18573. 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 || []>",
  18574. referencedClasses: [],
  18575. messageSends: []
  18576. }),
  18577. $globals.Package);
  18578. $core.addMethod(
  18579. $core.method({
  18580. selector: "basicName:",
  18581. protocol: 'private',
  18582. fn: function (aString){
  18583. var self=this;
  18584. return $core.withContext(function($ctx1) {
  18585. self.pkgName = aString;
  18586. return self;
  18587. }, function($ctx1) {$ctx1.fill(self,"basicName:",{aString:aString},$globals.Package)});
  18588. },
  18589. args: ["aString"],
  18590. source: "basicName: aString\x0a\x09<self.pkgName = aString>",
  18591. referencedClasses: [],
  18592. messageSends: []
  18593. }),
  18594. $globals.Package);
  18595. $core.addMethod(
  18596. $core.method({
  18597. selector: "basicTransport",
  18598. protocol: 'private',
  18599. fn: function (){
  18600. var self=this;
  18601. return $core.withContext(function($ctx1) {
  18602. return self.transport;
  18603. return self;
  18604. }, function($ctx1) {$ctx1.fill(self,"basicTransport",{},$globals.Package)});
  18605. },
  18606. args: [],
  18607. 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>",
  18608. referencedClasses: [],
  18609. messageSends: []
  18610. }),
  18611. $globals.Package);
  18612. $core.addMethod(
  18613. $core.method({
  18614. selector: "beClean",
  18615. protocol: 'accessing',
  18616. fn: function (){
  18617. var self=this;
  18618. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  18619. function $PackageClean(){return $globals.PackageClean||(typeof PackageClean=="undefined"?nil:PackageClean)}
  18620. return $core.withContext(function($ctx1) {
  18621. var $1,$2;
  18622. self["@dirty"]=false;
  18623. $1=$recv($PackageClean())._new();
  18624. $recv($1)._package_(self);
  18625. $2=$recv($1)._yourself();
  18626. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  18627. return self;
  18628. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  18629. },
  18630. args: [],
  18631. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  18632. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  18633. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  18634. }),
  18635. $globals.Package);
  18636. $core.addMethod(
  18637. $core.method({
  18638. selector: "beDirty",
  18639. protocol: 'accessing',
  18640. fn: function (){
  18641. var self=this;
  18642. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  18643. function $PackageDirty(){return $globals.PackageDirty||(typeof PackageDirty=="undefined"?nil:PackageDirty)}
  18644. return $core.withContext(function($ctx1) {
  18645. var $1,$2;
  18646. self["@dirty"]=true;
  18647. $1=$recv($PackageDirty())._new();
  18648. $recv($1)._package_(self);
  18649. $2=$recv($1)._yourself();
  18650. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  18651. return self;
  18652. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  18653. },
  18654. args: [],
  18655. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  18656. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  18657. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  18658. }),
  18659. $globals.Package);
  18660. $core.addMethod(
  18661. $core.method({
  18662. selector: "classTemplate",
  18663. protocol: 'accessing',
  18664. fn: function (){
  18665. var self=this;
  18666. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  18667. return $core.withContext(function($ctx1) {
  18668. var $3,$4,$2,$5,$6,$7,$1;
  18669. $1=$recv($String())._streamContents_((function(stream){
  18670. return $core.withContext(function($ctx2) {
  18671. $recv(stream)._nextPutAll_("Object");
  18672. $ctx2.sendIdx["nextPutAll:"]=1;
  18673. $recv(stream)._nextPutAll_(" subclass: #NameOfSubclass");
  18674. $ctx2.sendIdx["nextPutAll:"]=2;
  18675. $3=$recv($String())._lf();
  18676. $ctx2.sendIdx["lf"]=1;
  18677. $4=$recv($String())._tab();
  18678. $ctx2.sendIdx["tab"]=1;
  18679. $2=$recv($3).__comma($4);
  18680. $ctx2.sendIdx[","]=1;
  18681. $recv(stream)._nextPutAll_($2);
  18682. $ctx2.sendIdx["nextPutAll:"]=3;
  18683. $5=$recv(stream)._nextPutAll_("instanceVariableNames: ''");
  18684. $ctx2.sendIdx["nextPutAll:"]=4;
  18685. $5;
  18686. $6=$recv("'".__comma($recv($String())._lf())).__comma($recv($String())._tab());
  18687. $ctx2.sendIdx[","]=2;
  18688. $recv(stream)._nextPutAll_($6);
  18689. $ctx2.sendIdx["nextPutAll:"]=5;
  18690. $recv(stream)._nextPutAll_("package: '");
  18691. $ctx2.sendIdx["nextPutAll:"]=6;
  18692. $recv(stream)._nextPutAll_(self._name());
  18693. $ctx2.sendIdx["nextPutAll:"]=7;
  18694. $7=$recv(stream)._nextPutAll_("'");
  18695. return $7;
  18696. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18697. }));
  18698. return $1;
  18699. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  18700. },
  18701. args: [],
  18702. 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: '''' ]",
  18703. referencedClasses: ["String"],
  18704. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab", "name"]
  18705. }),
  18706. $globals.Package);
  18707. $core.addMethod(
  18708. $core.method({
  18709. selector: "classes",
  18710. protocol: 'classes',
  18711. fn: function (){
  18712. var self=this;
  18713. return $core.withContext(function($ctx1) {
  18714. var $1;
  18715. $1=$recv(self._organization())._elements();
  18716. return $1;
  18717. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  18718. },
  18719. args: [],
  18720. source: "classes\x0a\x09^ self organization elements",
  18721. referencedClasses: [],
  18722. messageSends: ["elements", "organization"]
  18723. }),
  18724. $globals.Package);
  18725. $core.addMethod(
  18726. $core.method({
  18727. selector: "definition",
  18728. protocol: 'accessing',
  18729. fn: function (){
  18730. var self=this;
  18731. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  18732. return $core.withContext(function($ctx1) {
  18733. var $2,$4,$5,$3,$7,$6,$9,$10,$8,$11,$12,$1;
  18734. $1=$recv($String())._streamContents_((function(stream){
  18735. return $core.withContext(function($ctx2) {
  18736. $2=$recv(self._class())._name();
  18737. $ctx2.sendIdx["name"]=1;
  18738. $recv(stream)._nextPutAll_($2);
  18739. $ctx2.sendIdx["nextPutAll:"]=1;
  18740. $4=$recv($String())._lf();
  18741. $ctx2.sendIdx["lf"]=1;
  18742. $5=$recv($String())._tab();
  18743. $ctx2.sendIdx["tab"]=1;
  18744. $3=$recv($4).__comma($5);
  18745. $ctx2.sendIdx[","]=1;
  18746. $recv(stream)._nextPutAll_($3);
  18747. $ctx2.sendIdx["nextPutAll:"]=2;
  18748. $recv(stream)._nextPutAll_("named: ");
  18749. $ctx2.sendIdx["nextPutAll:"]=3;
  18750. $7="'".__comma(self._name());
  18751. $ctx2.sendIdx[","]=3;
  18752. $6=$recv($7).__comma("'");
  18753. $ctx2.sendIdx[","]=2;
  18754. $recv(stream)._nextPutAll_($6);
  18755. $ctx2.sendIdx["nextPutAll:"]=4;
  18756. $9=$recv($String())._lf();
  18757. $ctx2.sendIdx["lf"]=2;
  18758. $10=$recv($String())._tab();
  18759. $ctx2.sendIdx["tab"]=2;
  18760. $8=$recv($9).__comma($10);
  18761. $ctx2.sendIdx[","]=4;
  18762. $recv(stream)._nextPutAll_($8);
  18763. $ctx2.sendIdx["nextPutAll:"]=5;
  18764. $recv(stream)._nextPutAll_("imports: ");
  18765. $ctx2.sendIdx["nextPutAll:"]=6;
  18766. $recv(stream)._nextPutAll_(self._importsDefinition());
  18767. $ctx2.sendIdx["nextPutAll:"]=7;
  18768. $11=$recv($recv($String())._lf()).__comma($recv($String())._tab());
  18769. $ctx2.sendIdx[","]=5;
  18770. $recv(stream)._nextPutAll_($11);
  18771. $ctx2.sendIdx["nextPutAll:"]=8;
  18772. $recv(stream)._nextPutAll_("transport: (");
  18773. $ctx2.sendIdx["nextPutAll:"]=9;
  18774. $12=$recv(stream)._nextPutAll_($recv($recv(self._transport())._definition()).__comma(")"));
  18775. return $12;
  18776. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18777. }));
  18778. return $1;
  18779. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  18780. },
  18781. args: [],
  18782. 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, ')' ]",
  18783. referencedClasses: ["String"],
  18784. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "lf", "tab", "importsDefinition", "definition", "transport"]
  18785. }),
  18786. $globals.Package);
  18787. $core.addMethod(
  18788. $core.method({
  18789. selector: "imports",
  18790. protocol: 'accessing',
  18791. fn: function (){
  18792. var self=this;
  18793. return $core.withContext(function($ctx1) {
  18794. var $2,$1,$receiver;
  18795. $2=self["@imports"];
  18796. if(($receiver = $2) == null || $receiver.isNil){
  18797. var parsed;
  18798. parsed=self._importsFromJson_(self._basicImports());
  18799. parsed;
  18800. self._imports_(parsed);
  18801. $1=self["@imports"];
  18802. } else {
  18803. $1=$2;
  18804. };
  18805. return $1;
  18806. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  18807. },
  18808. args: [],
  18809. 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 ]",
  18810. referencedClasses: [],
  18811. messageSends: ["ifNil:", "importsFromJson:", "basicImports", "imports:"]
  18812. }),
  18813. $globals.Package);
  18814. $core.addMethod(
  18815. $core.method({
  18816. selector: "imports:",
  18817. protocol: 'accessing',
  18818. fn: function (anArray){
  18819. var self=this;
  18820. return $core.withContext(function($ctx1) {
  18821. self._validateImports_(anArray);
  18822. self["@imports"]=$recv(anArray)._asSet();
  18823. return self;
  18824. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  18825. },
  18826. args: ["anArray"],
  18827. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  18828. referencedClasses: [],
  18829. messageSends: ["validateImports:", "asSet"]
  18830. }),
  18831. $globals.Package);
  18832. $core.addMethod(
  18833. $core.method({
  18834. selector: "importsAsJson",
  18835. protocol: 'converting',
  18836. fn: function (){
  18837. var self=this;
  18838. return $core.withContext(function($ctx1) {
  18839. var $2,$1;
  18840. $1=$recv(self._sortedImportsAsArray())._collect_((function(each){
  18841. return $core.withContext(function($ctx2) {
  18842. $2=$recv(each)._isString();
  18843. if($core.assert($2)){
  18844. return each;
  18845. } else {
  18846. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  18847. $ctx2.sendIdx[","]=1;
  18848. };
  18849. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18850. }));
  18851. return $1;
  18852. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  18853. },
  18854. args: [],
  18855. 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 ]]",
  18856. referencedClasses: [],
  18857. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  18858. }),
  18859. $globals.Package);
  18860. $core.addMethod(
  18861. $core.method({
  18862. selector: "importsDefinition",
  18863. protocol: 'accessing',
  18864. fn: function (){
  18865. var self=this;
  18866. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  18867. return $core.withContext(function($ctx1) {
  18868. var $1;
  18869. $1=$recv($String())._streamContents_((function(stream){
  18870. return $core.withContext(function($ctx2) {
  18871. $recv(stream)._nextPutAll_("{");
  18872. $ctx2.sendIdx["nextPutAll:"]=1;
  18873. $recv(self._sortedImportsAsArray())._do_separatedBy_((function(each){
  18874. return $core.withContext(function($ctx3) {
  18875. return $recv(stream)._nextPutAll_($recv(each)._importsString());
  18876. $ctx3.sendIdx["nextPutAll:"]=2;
  18877. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  18878. }),(function(){
  18879. return $core.withContext(function($ctx3) {
  18880. return $recv(stream)._nextPutAll_(". ");
  18881. $ctx3.sendIdx["nextPutAll:"]=3;
  18882. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  18883. }));
  18884. return $recv(stream)._nextPutAll_("}");
  18885. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18886. }));
  18887. return $1;
  18888. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  18889. },
  18890. args: [],
  18891. 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: '}' ]",
  18892. referencedClasses: ["String"],
  18893. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "sortedImportsAsArray", "importsString"]
  18894. }),
  18895. $globals.Package);
  18896. $core.addMethod(
  18897. $core.method({
  18898. selector: "importsFromJson:",
  18899. protocol: 'converting',
  18900. fn: function (anArray){
  18901. var self=this;
  18902. return $core.withContext(function($ctx1) {
  18903. var $2,$1;
  18904. $1=$recv(anArray)._collect_((function(each){
  18905. var split;
  18906. return $core.withContext(function($ctx2) {
  18907. split=$recv(each)._tokenize_("=");
  18908. split;
  18909. $2=$recv($recv(split)._size()).__eq((1));
  18910. if($core.assert($2)){
  18911. return $recv(split)._first();
  18912. $ctx2.sendIdx["first"]=1;
  18913. } else {
  18914. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  18915. };
  18916. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  18917. }));
  18918. return $1;
  18919. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  18920. },
  18921. args: ["anArray"],
  18922. 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 ]]",
  18923. referencedClasses: [],
  18924. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  18925. }),
  18926. $globals.Package);
  18927. $core.addMethod(
  18928. $core.method({
  18929. selector: "isDirty",
  18930. protocol: 'testing',
  18931. fn: function (){
  18932. var self=this;
  18933. return $core.withContext(function($ctx1) {
  18934. var $2,$1,$receiver;
  18935. $2=self["@dirty"];
  18936. if(($receiver = $2) == null || $receiver.isNil){
  18937. $1=false;
  18938. } else {
  18939. $1=$2;
  18940. };
  18941. return $1;
  18942. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  18943. },
  18944. args: [],
  18945. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  18946. referencedClasses: [],
  18947. messageSends: ["ifNil:"]
  18948. }),
  18949. $globals.Package);
  18950. $core.addMethod(
  18951. $core.method({
  18952. selector: "isPackage",
  18953. protocol: 'testing',
  18954. fn: function (){
  18955. var self=this;
  18956. return true;
  18957. },
  18958. args: [],
  18959. source: "isPackage\x0a\x09^ true",
  18960. referencedClasses: [],
  18961. messageSends: []
  18962. }),
  18963. $globals.Package);
  18964. $core.addMethod(
  18965. $core.method({
  18966. selector: "loadDependencies",
  18967. protocol: 'dependencies',
  18968. fn: function (){
  18969. var self=this;
  18970. var classes,packages;
  18971. return $core.withContext(function($ctx1) {
  18972. var $2,$3,$1;
  18973. classes=self._loadDependencyClasses();
  18974. $2=$recv($recv(classes)._collect_((function(each){
  18975. return $core.withContext(function($ctx2) {
  18976. return $recv(each)._package();
  18977. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18978. })))._asSet();
  18979. $recv($2)._remove_ifAbsent_(self,(function(){
  18980. }));
  18981. $3=$recv($2)._yourself();
  18982. $1=$3;
  18983. return $1;
  18984. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  18985. },
  18986. args: [],
  18987. 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",
  18988. referencedClasses: [],
  18989. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  18990. }),
  18991. $globals.Package);
  18992. $core.addMethod(
  18993. $core.method({
  18994. selector: "loadDependencyClasses",
  18995. protocol: 'dependencies',
  18996. fn: function (){
  18997. var self=this;
  18998. var starCategoryName;
  18999. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  19000. return $core.withContext(function($ctx1) {
  19001. var $4,$3,$2,$6,$5,$7,$1;
  19002. starCategoryName="*".__comma(self._name());
  19003. $ctx1.sendIdx[","]=1;
  19004. $4=self._classes();
  19005. $ctx1.sendIdx["classes"]=1;
  19006. $3=$recv($4)._collect_((function(each){
  19007. return $core.withContext(function($ctx2) {
  19008. return $recv(each)._superclass();
  19009. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19010. }));
  19011. $2=$recv($3)._asSet();
  19012. $recv($2)._remove_ifAbsent_(nil,(function(){
  19013. }));
  19014. $recv($2)._addAll_($recv($recv($Smalltalk())._classes())._select_((function(each){
  19015. return $core.withContext(function($ctx2) {
  19016. $6=$recv(each)._protocols();
  19017. $ctx2.sendIdx["protocols"]=1;
  19018. $5=$recv($6).__comma($recv($recv(each)._class())._protocols());
  19019. return $recv($5)._includes_(starCategoryName);
  19020. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  19021. })));
  19022. $7=$recv($2)._yourself();
  19023. $1=$7;
  19024. return $1;
  19025. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  19026. },
  19027. args: [],
  19028. 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",
  19029. referencedClasses: ["Smalltalk"],
  19030. messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "includes:", "protocols", "class", "yourself"]
  19031. }),
  19032. $globals.Package);
  19033. $core.addMethod(
  19034. $core.method({
  19035. selector: "name",
  19036. protocol: 'accessing',
  19037. fn: function (){
  19038. var self=this;
  19039. return $core.withContext(function($ctx1) {
  19040. return self.pkgName;
  19041. return self;
  19042. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Package)});
  19043. },
  19044. args: [],
  19045. source: "name\x0a\x09<return self.pkgName>",
  19046. referencedClasses: [],
  19047. messageSends: []
  19048. }),
  19049. $globals.Package);
  19050. $core.addMethod(
  19051. $core.method({
  19052. selector: "name:",
  19053. protocol: 'accessing',
  19054. fn: function (aString){
  19055. var self=this;
  19056. return $core.withContext(function($ctx1) {
  19057. self._basicName_(aString);
  19058. self._beDirty();
  19059. return self;
  19060. }, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},$globals.Package)});
  19061. },
  19062. args: ["aString"],
  19063. source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty",
  19064. referencedClasses: [],
  19065. messageSends: ["basicName:", "beDirty"]
  19066. }),
  19067. $globals.Package);
  19068. $core.addMethod(
  19069. $core.method({
  19070. selector: "organization",
  19071. protocol: 'accessing',
  19072. fn: function (){
  19073. var self=this;
  19074. return $core.withContext(function($ctx1) {
  19075. var $1;
  19076. $1=self._basicAt_("organization");
  19077. return $1;
  19078. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Package)});
  19079. },
  19080. args: [],
  19081. source: "organization\x0a\x09^ self basicAt: 'organization'",
  19082. referencedClasses: [],
  19083. messageSends: ["basicAt:"]
  19084. }),
  19085. $globals.Package);
  19086. $core.addMethod(
  19087. $core.method({
  19088. selector: "printOn:",
  19089. protocol: 'printing',
  19090. fn: function (aStream){
  19091. var self=this;
  19092. return $core.withContext(function($ctx1) {
  19093. var $1;
  19094. (
  19095. $ctx1.supercall = true,
  19096. $globals.Package.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  19097. $ctx1.supercall = false;
  19098. $recv(aStream)._nextPutAll_(" (");
  19099. $ctx1.sendIdx["nextPutAll:"]=1;
  19100. $recv(aStream)._nextPutAll_(self._name());
  19101. $ctx1.sendIdx["nextPutAll:"]=2;
  19102. $1=$recv(aStream)._nextPutAll_(")");
  19103. return self;
  19104. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  19105. },
  19106. args: ["aStream"],
  19107. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  19108. referencedClasses: [],
  19109. messageSends: ["printOn:", "nextPutAll:", "name"]
  19110. }),
  19111. $globals.Package);
  19112. $core.addMethod(
  19113. $core.method({
  19114. selector: "setupClasses",
  19115. protocol: 'classes',
  19116. fn: function (){
  19117. var self=this;
  19118. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  19119. return $core.withContext(function($ctx1) {
  19120. var $1,$2;
  19121. $1=self._classes();
  19122. $recv($1)._do_((function(each){
  19123. return $core.withContext(function($ctx2) {
  19124. return $recv($recv($ClassBuilder())._new())._setupClass_(each);
  19125. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19126. }));
  19127. $ctx1.sendIdx["do:"]=1;
  19128. $2=$recv($1)._do_((function(each){
  19129. return $core.withContext(function($ctx2) {
  19130. return $recv(each)._initialize();
  19131. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  19132. }));
  19133. return self;
  19134. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  19135. },
  19136. args: [],
  19137. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  19138. referencedClasses: ["ClassBuilder"],
  19139. messageSends: ["do:", "classes", "setupClass:", "new", "initialize"]
  19140. }),
  19141. $globals.Package);
  19142. $core.addMethod(
  19143. $core.method({
  19144. selector: "sortedClasses",
  19145. protocol: 'classes',
  19146. fn: function (){
  19147. var self=this;
  19148. return $core.withContext(function($ctx1) {
  19149. var $1;
  19150. $1=$recv(self._class())._sortedClasses_(self._classes());
  19151. return $1;
  19152. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  19153. },
  19154. args: [],
  19155. 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",
  19156. referencedClasses: [],
  19157. messageSends: ["sortedClasses:", "class", "classes"]
  19158. }),
  19159. $globals.Package);
  19160. $core.addMethod(
  19161. $core.method({
  19162. selector: "sortedImportsAsArray",
  19163. protocol: 'private',
  19164. fn: function (){
  19165. var self=this;
  19166. return $core.withContext(function($ctx1) {
  19167. var $4,$3,$5,$2,$7,$6,$8,$1;
  19168. $1=$recv($recv(self._imports())._asArray())._sorted_((function(a,b){
  19169. return $core.withContext(function($ctx2) {
  19170. $4=$recv(a)._isString();
  19171. $ctx2.sendIdx["isString"]=1;
  19172. $3=$recv($4)._not();
  19173. $5=$recv(b)._isString();
  19174. $ctx2.sendIdx["isString"]=2;
  19175. $2=$recv($3).__and($5);
  19176. return $recv($2)._or_((function(){
  19177. return $core.withContext(function($ctx3) {
  19178. $7=$recv(a)._isString();
  19179. $ctx3.sendIdx["isString"]=3;
  19180. $6=$recv($7).__eq($recv(b)._isString());
  19181. return $recv($6)._and_((function(){
  19182. return $core.withContext(function($ctx4) {
  19183. $8=$recv(a)._value();
  19184. $ctx4.sendIdx["value"]=1;
  19185. return $recv($8).__lt_eq($recv(b)._value());
  19186. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  19187. }));
  19188. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  19189. }));
  19190. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  19191. }));
  19192. return $1;
  19193. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  19194. },
  19195. args: [],
  19196. 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 ]]]",
  19197. referencedClasses: [],
  19198. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  19199. }),
  19200. $globals.Package);
  19201. $core.addMethod(
  19202. $core.method({
  19203. selector: "transport",
  19204. protocol: 'accessing',
  19205. fn: function (){
  19206. var self=this;
  19207. function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  19208. return $core.withContext(function($ctx1) {
  19209. var $2,$3,$4,$1,$receiver;
  19210. $2=self["@transport"];
  19211. if(($receiver = $2) == null || $receiver.isNil){
  19212. $3=$recv($PackageTransport())._fromJson_(self._basicTransport());
  19213. $recv($3)._package_(self);
  19214. $4=$recv($3)._yourself();
  19215. self["@transport"]=$4;
  19216. $1=self["@transport"];
  19217. } else {
  19218. $1=$2;
  19219. };
  19220. return $1;
  19221. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  19222. },
  19223. args: [],
  19224. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  19225. referencedClasses: ["PackageTransport"],
  19226. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"]
  19227. }),
  19228. $globals.Package);
  19229. $core.addMethod(
  19230. $core.method({
  19231. selector: "transport:",
  19232. protocol: 'accessing',
  19233. fn: function (aPackageTransport){
  19234. var self=this;
  19235. return $core.withContext(function($ctx1) {
  19236. self["@transport"]=aPackageTransport;
  19237. $recv(aPackageTransport)._package_(self);
  19238. return self;
  19239. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  19240. },
  19241. args: ["aPackageTransport"],
  19242. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  19243. referencedClasses: [],
  19244. messageSends: ["package:"]
  19245. }),
  19246. $globals.Package);
  19247. $core.addMethod(
  19248. $core.method({
  19249. selector: "validateImports:",
  19250. protocol: 'validation',
  19251. fn: function (aCollection){
  19252. var self=this;
  19253. return $core.withContext(function($ctx1) {
  19254. var $1,$2,$5,$4,$3,$6;
  19255. $recv(aCollection)._do_((function(import_){
  19256. return $core.withContext(function($ctx2) {
  19257. $1=$recv(import_)._isString();
  19258. $ctx2.sendIdx["isString"]=1;
  19259. if(!$core.assert($1)){
  19260. $2=$recv(import_)._respondsTo_("key");
  19261. if(!$core.assert($2)){
  19262. self._error_("Imports must be Strings or Associations");
  19263. $ctx2.sendIdx["error:"]=1;
  19264. };
  19265. $5=$recv(import_)._key();
  19266. $ctx2.sendIdx["key"]=1;
  19267. $4=$recv($5)._isString();
  19268. $ctx2.sendIdx["isString"]=2;
  19269. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  19270. if(!$core.assert($3)){
  19271. self._error_("Key and value must be Strings");
  19272. $ctx2.sendIdx["error:"]=2;
  19273. };
  19274. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  19275. if(!$core.assert($6)){
  19276. return self._error_("Keys must be identifiers");
  19277. };
  19278. };
  19279. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  19280. }));
  19281. return self;
  19282. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  19283. },
  19284. args: ["aCollection"],
  19285. 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' ]]]",
  19286. referencedClasses: [],
  19287. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  19288. }),
  19289. $globals.Package);
  19290. $globals.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  19291. $core.addMethod(
  19292. $core.method({
  19293. selector: "named:",
  19294. protocol: 'accessing',
  19295. fn: function (aPackageName){
  19296. var self=this;
  19297. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  19298. return $core.withContext(function($ctx1) {
  19299. var $1;
  19300. $1=$recv($Smalltalk())._packageAt_ifAbsent_(aPackageName,(function(){
  19301. return $core.withContext(function($ctx2) {
  19302. return $recv($Smalltalk())._createPackage_(aPackageName);
  19303. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19304. }));
  19305. return $1;
  19306. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.klass)});
  19307. },
  19308. args: ["aPackageName"],
  19309. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  19310. referencedClasses: ["Smalltalk"],
  19311. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  19312. }),
  19313. $globals.Package.klass);
  19314. $core.addMethod(
  19315. $core.method({
  19316. selector: "named:ifAbsent:",
  19317. protocol: 'accessing',
  19318. fn: function (aPackageName,aBlock){
  19319. var self=this;
  19320. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  19321. return $core.withContext(function($ctx1) {
  19322. var $1;
  19323. $1=$recv($Smalltalk())._packageAt_ifAbsent_(aPackageName,aBlock);
  19324. return $1;
  19325. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.klass)});
  19326. },
  19327. args: ["aPackageName", "aBlock"],
  19328. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  19329. referencedClasses: ["Smalltalk"],
  19330. messageSends: ["packageAt:ifAbsent:"]
  19331. }),
  19332. $globals.Package.klass);
  19333. $core.addMethod(
  19334. $core.method({
  19335. selector: "named:imports:transport:",
  19336. protocol: 'accessing',
  19337. fn: function (aPackageName,anArray,aTransport){
  19338. var self=this;
  19339. var package_;
  19340. return $core.withContext(function($ctx1) {
  19341. var $1;
  19342. package_=self._named_(aPackageName);
  19343. $recv(package_)._imports_(anArray);
  19344. $recv(package_)._transport_(aTransport);
  19345. $1=package_;
  19346. return $1;
  19347. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  19348. },
  19349. args: ["aPackageName", "anArray", "aTransport"],
  19350. 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",
  19351. referencedClasses: [],
  19352. messageSends: ["named:", "imports:", "transport:"]
  19353. }),
  19354. $globals.Package.klass);
  19355. $core.addMethod(
  19356. $core.method({
  19357. selector: "named:transport:",
  19358. protocol: 'accessing',
  19359. fn: function (aPackageName,aTransport){
  19360. var self=this;
  19361. var package_;
  19362. return $core.withContext(function($ctx1) {
  19363. var $1;
  19364. package_=self._named_(aPackageName);
  19365. $recv(package_)._transport_(aTransport);
  19366. $1=package_;
  19367. return $1;
  19368. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  19369. },
  19370. args: ["aPackageName", "aTransport"],
  19371. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  19372. referencedClasses: [],
  19373. messageSends: ["named:", "transport:"]
  19374. }),
  19375. $globals.Package.klass);
  19376. $core.addMethod(
  19377. $core.method({
  19378. selector: "sortedClasses:",
  19379. protocol: 'sorting',
  19380. fn: function (classes){
  19381. var self=this;
  19382. var children,others,nodes,expandedClasses;
  19383. function $ClassSorterNode(){return $globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  19384. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  19385. return $core.withContext(function($ctx1) {
  19386. var $1,$3,$2,$4;
  19387. children=[];
  19388. others=[];
  19389. $recv(classes)._do_((function(each){
  19390. return $core.withContext(function($ctx2) {
  19391. $1=$recv(classes)._includes_($recv(each)._superclass());
  19392. if($core.assert($1)){
  19393. return $recv(others)._add_(each);
  19394. } else {
  19395. return $recv(children)._add_(each);
  19396. $ctx2.sendIdx["add:"]=1;
  19397. };
  19398. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19399. }));
  19400. $ctx1.sendIdx["do:"]=1;
  19401. nodes=$recv(children)._collect_((function(each){
  19402. return $core.withContext(function($ctx2) {
  19403. return $recv($ClassSorterNode())._on_classes_level_(each,others,(0));
  19404. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  19405. }));
  19406. nodes=$recv(nodes)._sorted_((function(a,b){
  19407. return $core.withContext(function($ctx2) {
  19408. $3=$recv(a)._theClass();
  19409. $ctx2.sendIdx["theClass"]=1;
  19410. $2=$recv($3)._name();
  19411. $ctx2.sendIdx["name"]=1;
  19412. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  19413. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  19414. }));
  19415. expandedClasses=$recv($Array())._new();
  19416. $recv(nodes)._do_((function(aNode){
  19417. return $core.withContext(function($ctx2) {
  19418. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  19419. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  19420. }));
  19421. $4=expandedClasses;
  19422. return $4;
  19423. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.klass)});
  19424. },
  19425. args: ["classes"],
  19426. 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",
  19427. referencedClasses: ["ClassSorterNode", "Array"],
  19428. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  19429. }),
  19430. $globals.Package.klass);
  19431. $core.addClass('PackageStateObserver', $globals.Object, [], 'Kernel-Infrastructure');
  19432. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  19433. $core.addMethod(
  19434. $core.method({
  19435. selector: "announcer",
  19436. protocol: 'accessing',
  19437. fn: function (){
  19438. var self=this;
  19439. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  19440. return $core.withContext(function($ctx1) {
  19441. var $1;
  19442. $1=$recv($SystemAnnouncer())._current();
  19443. return $1;
  19444. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  19445. },
  19446. args: [],
  19447. source: "announcer\x0a\x09^ SystemAnnouncer current",
  19448. referencedClasses: ["SystemAnnouncer"],
  19449. messageSends: ["current"]
  19450. }),
  19451. $globals.PackageStateObserver);
  19452. $core.addMethod(
  19453. $core.method({
  19454. selector: "observeSystem",
  19455. protocol: 'actions',
  19456. fn: function (){
  19457. var self=this;
  19458. function $PackageAdded(){return $globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
  19459. function $ClassAnnouncement(){return $globals.ClassAnnouncement||(typeof ClassAnnouncement=="undefined"?nil:ClassAnnouncement)}
  19460. function $MethodAnnouncement(){return $globals.MethodAnnouncement||(typeof MethodAnnouncement=="undefined"?nil:MethodAnnouncement)}
  19461. function $ProtocolAnnouncement(){return $globals.ProtocolAnnouncement||(typeof ProtocolAnnouncement=="undefined"?nil:ProtocolAnnouncement)}
  19462. return $core.withContext(function($ctx1) {
  19463. var $1,$2;
  19464. $1=self._announcer();
  19465. $recv($1)._on_send_to_($PackageAdded(),"onPackageAdded:",self);
  19466. $ctx1.sendIdx["on:send:to:"]=1;
  19467. $recv($1)._on_send_to_($ClassAnnouncement(),"onClassModification:",self);
  19468. $ctx1.sendIdx["on:send:to:"]=2;
  19469. $recv($1)._on_send_to_($MethodAnnouncement(),"onMethodModification:",self);
  19470. $ctx1.sendIdx["on:send:to:"]=3;
  19471. $2=$recv($1)._on_send_to_($ProtocolAnnouncement(),"onProtocolModification:",self);
  19472. return self;
  19473. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  19474. },
  19475. args: [],
  19476. 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",
  19477. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  19478. messageSends: ["on:send:to:", "announcer"]
  19479. }),
  19480. $globals.PackageStateObserver);
  19481. $core.addMethod(
  19482. $core.method({
  19483. selector: "onClassModification:",
  19484. protocol: 'reactions',
  19485. fn: function (anAnnouncement){
  19486. var self=this;
  19487. return $core.withContext(function($ctx1) {
  19488. var $1,$receiver;
  19489. $1=$recv(anAnnouncement)._theClass();
  19490. if(($receiver = $1) == null || $receiver.isNil){
  19491. $1;
  19492. } else {
  19493. var theClass;
  19494. theClass=$receiver;
  19495. $recv($recv(theClass)._package())._beDirty();
  19496. };
  19497. return self;
  19498. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19499. },
  19500. args: ["anAnnouncement"],
  19501. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  19502. referencedClasses: [],
  19503. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  19504. }),
  19505. $globals.PackageStateObserver);
  19506. $core.addMethod(
  19507. $core.method({
  19508. selector: "onMethodModification:",
  19509. protocol: 'reactions',
  19510. fn: function (anAnnouncement){
  19511. var self=this;
  19512. return $core.withContext(function($ctx1) {
  19513. var $1,$receiver;
  19514. $1=$recv($recv(anAnnouncement)._method())._package();
  19515. if(($receiver = $1) == null || $receiver.isNil){
  19516. $1;
  19517. } else {
  19518. var package_;
  19519. package_=$receiver;
  19520. $recv(package_)._beDirty();
  19521. };
  19522. return self;
  19523. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19524. },
  19525. args: ["anAnnouncement"],
  19526. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  19527. referencedClasses: [],
  19528. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  19529. }),
  19530. $globals.PackageStateObserver);
  19531. $core.addMethod(
  19532. $core.method({
  19533. selector: "onPackageAdded:",
  19534. protocol: 'reactions',
  19535. fn: function (anAnnouncement){
  19536. var self=this;
  19537. return $core.withContext(function($ctx1) {
  19538. $recv($recv(anAnnouncement)._package())._beDirty();
  19539. return self;
  19540. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19541. },
  19542. args: ["anAnnouncement"],
  19543. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  19544. referencedClasses: [],
  19545. messageSends: ["beDirty", "package"]
  19546. }),
  19547. $globals.PackageStateObserver);
  19548. $core.addMethod(
  19549. $core.method({
  19550. selector: "onProtocolModification:",
  19551. protocol: 'reactions',
  19552. fn: function (anAnnouncement){
  19553. var self=this;
  19554. return $core.withContext(function($ctx1) {
  19555. var $1,$receiver;
  19556. $1=$recv(anAnnouncement)._package();
  19557. if(($receiver = $1) == null || $receiver.isNil){
  19558. $1;
  19559. } else {
  19560. var package_;
  19561. package_=$receiver;
  19562. $recv(package_)._beDirty();
  19563. };
  19564. return self;
  19565. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19566. },
  19567. args: ["anAnnouncement"],
  19568. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  19569. referencedClasses: [],
  19570. messageSends: ["ifNotNil:", "package", "beDirty"]
  19571. }),
  19572. $globals.PackageStateObserver);
  19573. $globals.PackageStateObserver.klass.iVarNames = ['current'];
  19574. $core.addMethod(
  19575. $core.method({
  19576. selector: "current",
  19577. protocol: 'accessing',
  19578. fn: function (){
  19579. var self=this;
  19580. return $core.withContext(function($ctx1) {
  19581. var $2,$1,$receiver;
  19582. $2=self["@current"];
  19583. if(($receiver = $2) == null || $receiver.isNil){
  19584. self["@current"]=self._new();
  19585. $1=self["@current"];
  19586. } else {
  19587. $1=$2;
  19588. };
  19589. return $1;
  19590. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.klass)});
  19591. },
  19592. args: [],
  19593. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  19594. referencedClasses: [],
  19595. messageSends: ["ifNil:", "new"]
  19596. }),
  19597. $globals.PackageStateObserver.klass);
  19598. $core.addMethod(
  19599. $core.method({
  19600. selector: "initialize",
  19601. protocol: 'initialization',
  19602. fn: function (){
  19603. var self=this;
  19604. return $core.withContext(function($ctx1) {
  19605. $recv(self._current())._observeSystem();
  19606. return self;
  19607. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.klass)});
  19608. },
  19609. args: [],
  19610. source: "initialize\x0a\x09self current observeSystem",
  19611. referencedClasses: [],
  19612. messageSends: ["observeSystem", "current"]
  19613. }),
  19614. $globals.PackageStateObserver.klass);
  19615. $core.addClass('ParseError', $globals.Error, [], 'Kernel-Infrastructure');
  19616. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  19617. $core.addClass('RethrowErrorHandler', $globals.Object, [], 'Kernel-Infrastructure');
  19618. $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.";
  19619. $core.addMethod(
  19620. $core.method({
  19621. selector: "basicSignal:",
  19622. protocol: 'error handling',
  19623. fn: function (anError){
  19624. var self=this;
  19625. return $core.withContext(function($ctx1) {
  19626. throw anError;
  19627. return self;
  19628. }, function($ctx1) {$ctx1.fill(self,"basicSignal:",{anError:anError},$globals.RethrowErrorHandler)});
  19629. },
  19630. args: ["anError"],
  19631. source: "basicSignal: anError\x0a <throw anError>",
  19632. referencedClasses: [],
  19633. messageSends: []
  19634. }),
  19635. $globals.RethrowErrorHandler);
  19636. $core.addMethod(
  19637. $core.method({
  19638. selector: "handleError:",
  19639. protocol: 'error handling',
  19640. fn: function (anError){
  19641. var self=this;
  19642. return $core.withContext(function($ctx1) {
  19643. self._basicSignal_(anError);
  19644. return self;
  19645. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.RethrowErrorHandler)});
  19646. },
  19647. args: ["anError"],
  19648. source: "handleError: anError\x0a self basicSignal: anError",
  19649. referencedClasses: [],
  19650. messageSends: ["basicSignal:"]
  19651. }),
  19652. $globals.RethrowErrorHandler);
  19653. $core.addClass('Setting', $globals.Object, ['key', 'value', 'defaultValue'], 'Kernel-Infrastructure');
  19654. $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`";
  19655. $core.addMethod(
  19656. $core.method({
  19657. selector: "defaultValue",
  19658. protocol: 'accessing',
  19659. fn: function (){
  19660. var self=this;
  19661. var $1;
  19662. $1=self["@defaultValue"];
  19663. return $1;
  19664. },
  19665. args: [],
  19666. source: "defaultValue\x0a\x09^ defaultValue",
  19667. referencedClasses: [],
  19668. messageSends: []
  19669. }),
  19670. $globals.Setting);
  19671. $core.addMethod(
  19672. $core.method({
  19673. selector: "defaultValue:",
  19674. protocol: 'accessing',
  19675. fn: function (aStringifiableObject){
  19676. var self=this;
  19677. self["@defaultValue"]=aStringifiableObject;
  19678. return self;
  19679. },
  19680. args: ["aStringifiableObject"],
  19681. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  19682. referencedClasses: [],
  19683. messageSends: []
  19684. }),
  19685. $globals.Setting);
  19686. $core.addMethod(
  19687. $core.method({
  19688. selector: "key",
  19689. protocol: 'accessing',
  19690. fn: function (){
  19691. var self=this;
  19692. var $1;
  19693. $1=self["@key"];
  19694. return $1;
  19695. },
  19696. args: [],
  19697. source: "key\x0a\x09^ key",
  19698. referencedClasses: [],
  19699. messageSends: []
  19700. }),
  19701. $globals.Setting);
  19702. $core.addMethod(
  19703. $core.method({
  19704. selector: "key:",
  19705. protocol: 'accessing',
  19706. fn: function (aString){
  19707. var self=this;
  19708. self["@key"]=aString;
  19709. return self;
  19710. },
  19711. args: ["aString"],
  19712. source: "key: aString\x0a\x09key := aString",
  19713. referencedClasses: [],
  19714. messageSends: []
  19715. }),
  19716. $globals.Setting);
  19717. $core.addMethod(
  19718. $core.method({
  19719. selector: "value",
  19720. protocol: 'accessing',
  19721. fn: function (){
  19722. var self=this;
  19723. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  19724. return $core.withContext(function($ctx1) {
  19725. var $1;
  19726. $1=$recv($recv($Smalltalk())._settings())._at_ifAbsent_(self._key(),(function(){
  19727. return $core.withContext(function($ctx2) {
  19728. return self._defaultValue();
  19729. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19730. }));
  19731. return $1;
  19732. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  19733. },
  19734. args: [],
  19735. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  19736. referencedClasses: ["Smalltalk"],
  19737. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  19738. }),
  19739. $globals.Setting);
  19740. $core.addMethod(
  19741. $core.method({
  19742. selector: "value:",
  19743. protocol: 'accessing',
  19744. fn: function (aStringifiableObject){
  19745. var self=this;
  19746. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  19747. return $core.withContext(function($ctx1) {
  19748. var $1;
  19749. $1=$recv($recv($Smalltalk())._settings())._at_put_(self._key(),aStringifiableObject);
  19750. return $1;
  19751. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  19752. },
  19753. args: ["aStringifiableObject"],
  19754. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  19755. referencedClasses: ["Smalltalk"],
  19756. messageSends: ["at:put:", "settings", "key"]
  19757. }),
  19758. $globals.Setting);
  19759. $core.addMethod(
  19760. $core.method({
  19761. selector: "at:ifAbsent:",
  19762. protocol: 'instance creation',
  19763. fn: function (aString,aDefaultValue){
  19764. var self=this;
  19765. return $core.withContext(function($ctx1) {
  19766. var $2,$3,$1;
  19767. $2=(
  19768. $ctx1.supercall = true,
  19769. $globals.Setting.klass.superclass.fn.prototype._new.apply($recv(self), []));
  19770. $ctx1.supercall = false;
  19771. $recv($2)._key_(aString);
  19772. $recv($2)._defaultValue_(aDefaultValue);
  19773. $3=$recv($2)._yourself();
  19774. $1=$3;
  19775. return $1;
  19776. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.klass)});
  19777. },
  19778. args: ["aString", "aDefaultValue"],
  19779. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  19780. referencedClasses: [],
  19781. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  19782. }),
  19783. $globals.Setting.klass);
  19784. $core.addMethod(
  19785. $core.method({
  19786. selector: "new",
  19787. protocol: 'instance creation',
  19788. fn: function (){
  19789. var self=this;
  19790. return $core.withContext(function($ctx1) {
  19791. self._shouldNotImplement();
  19792. return self;
  19793. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.klass)});
  19794. },
  19795. args: [],
  19796. source: "new\x0a\x09self shouldNotImplement",
  19797. referencedClasses: [],
  19798. messageSends: ["shouldNotImplement"]
  19799. }),
  19800. $globals.Setting.klass);
  19801. $core.addClass('SmalltalkImage', $globals.Object, [], 'Kernel-Infrastructure');
  19802. $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.";
  19803. $core.addMethod(
  19804. $core.method({
  19805. selector: "addGlobalJsVariable:",
  19806. protocol: 'globals',
  19807. fn: function (aString){
  19808. var self=this;
  19809. return $core.withContext(function($ctx1) {
  19810. $recv(self._globalJsVariables())._add_(aString);
  19811. return self;
  19812. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  19813. },
  19814. args: ["aString"],
  19815. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  19816. referencedClasses: [],
  19817. messageSends: ["add:", "globalJsVariables"]
  19818. }),
  19819. $globals.SmalltalkImage);
  19820. $core.addMethod(
  19821. $core.method({
  19822. selector: "amdRequire",
  19823. protocol: 'accessing amd',
  19824. fn: function (){
  19825. var self=this;
  19826. return $core.withContext(function($ctx1) {
  19827. var $1;
  19828. $1=$recv(self._core())._at_("amdRequire");
  19829. return $1;
  19830. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  19831. },
  19832. args: [],
  19833. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  19834. referencedClasses: [],
  19835. messageSends: ["at:", "core"]
  19836. }),
  19837. $globals.SmalltalkImage);
  19838. $core.addMethod(
  19839. $core.method({
  19840. selector: "asSmalltalkException:",
  19841. protocol: 'error handling',
  19842. fn: function (anObject){
  19843. var self=this;
  19844. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  19845. function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  19846. return $core.withContext(function($ctx1) {
  19847. var $2,$1;
  19848. $2=$recv(self._isSmalltalkObject_(anObject))._and_((function(){
  19849. return $core.withContext(function($ctx2) {
  19850. return $recv(anObject)._isKindOf_($Error());
  19851. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19852. }));
  19853. if($core.assert($2)){
  19854. $1=anObject;
  19855. } else {
  19856. $1=$recv($JavaScriptException())._on_(anObject);
  19857. };
  19858. return $1;
  19859. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  19860. },
  19861. args: ["anObject"],
  19862. 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 ]",
  19863. referencedClasses: ["Error", "JavaScriptException"],
  19864. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  19865. }),
  19866. $globals.SmalltalkImage);
  19867. $core.addMethod(
  19868. $core.method({
  19869. selector: "basicCreatePackage:",
  19870. protocol: 'private',
  19871. fn: function (packageName){
  19872. var self=this;
  19873. return $core.withContext(function($ctx1) {
  19874. return $core.addPackage(packageName);
  19875. return self;
  19876. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  19877. },
  19878. args: ["packageName"],
  19879. 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)>",
  19880. referencedClasses: [],
  19881. messageSends: []
  19882. }),
  19883. $globals.SmalltalkImage);
  19884. $core.addMethod(
  19885. $core.method({
  19886. selector: "basicParse:",
  19887. protocol: 'private',
  19888. fn: function (aString){
  19889. var self=this;
  19890. function $SmalltalkParser(){return $globals.SmalltalkParser||(typeof SmalltalkParser=="undefined"?nil:SmalltalkParser)}
  19891. return $core.withContext(function($ctx1) {
  19892. var $1;
  19893. $1=$recv($SmalltalkParser())._parse_(aString);
  19894. return $1;
  19895. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  19896. },
  19897. args: ["aString"],
  19898. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  19899. referencedClasses: ["SmalltalkParser"],
  19900. messageSends: ["parse:"]
  19901. }),
  19902. $globals.SmalltalkImage);
  19903. $core.addMethod(
  19904. $core.method({
  19905. selector: "basicRegisterPackage:",
  19906. protocol: 'private',
  19907. fn: function (aPackage){
  19908. var self=this;
  19909. return $core.withContext(function($ctx1) {
  19910. $core.packages[aPackage.pkgName]=aPackage;
  19911. return self;
  19912. }, function($ctx1) {$ctx1.fill(self,"basicRegisterPackage:",{aPackage:aPackage},$globals.SmalltalkImage)});
  19913. },
  19914. args: ["aPackage"],
  19915. source: "basicRegisterPackage: aPackage\x0a\x09\x22Put aPackage in $core.packages object.\x22\x0a\x09<$core.packages[aPackage.pkgName]=aPackage>",
  19916. referencedClasses: [],
  19917. messageSends: []
  19918. }),
  19919. $globals.SmalltalkImage);
  19920. $core.addMethod(
  19921. $core.method({
  19922. selector: "cancelOptOut:",
  19923. protocol: 'accessing',
  19924. fn: function (anObject){
  19925. var self=this;
  19926. return $core.withContext(function($ctx1) {
  19927. delete anObject.klass;
  19928. return self;
  19929. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  19930. },
  19931. args: ["anObject"],
  19932. 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>",
  19933. referencedClasses: [],
  19934. messageSends: []
  19935. }),
  19936. $globals.SmalltalkImage);
  19937. $core.addMethod(
  19938. $core.method({
  19939. selector: "classes",
  19940. protocol: 'classes',
  19941. fn: function (){
  19942. var self=this;
  19943. return $core.withContext(function($ctx1) {
  19944. return $core.classes();
  19945. return self;
  19946. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  19947. },
  19948. args: [],
  19949. source: "classes\x0a\x09<return $core.classes()>",
  19950. referencedClasses: [],
  19951. messageSends: []
  19952. }),
  19953. $globals.SmalltalkImage);
  19954. $core.addMethod(
  19955. $core.method({
  19956. selector: "core",
  19957. protocol: 'accessing',
  19958. fn: function (){
  19959. var self=this;
  19960. return $core.withContext(function($ctx1) {
  19961. return $core;
  19962. return self;
  19963. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  19964. },
  19965. args: [],
  19966. source: "core\x0a\x09<return $core>",
  19967. referencedClasses: [],
  19968. messageSends: []
  19969. }),
  19970. $globals.SmalltalkImage);
  19971. $core.addMethod(
  19972. $core.method({
  19973. selector: "createPackage:",
  19974. protocol: 'packages',
  19975. fn: function (packageName){
  19976. var self=this;
  19977. var package_,announcement;
  19978. function $PackageAdded(){return $globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
  19979. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  19980. return $core.withContext(function($ctx1) {
  19981. var $1,$2,$3;
  19982. package_=self._basicCreatePackage_(packageName);
  19983. $1=$recv($PackageAdded())._new();
  19984. $recv($1)._package_(package_);
  19985. $2=$recv($1)._yourself();
  19986. announcement=$2;
  19987. $recv($recv($SystemAnnouncer())._current())._announce_(announcement);
  19988. $3=package_;
  19989. return $3;
  19990. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  19991. },
  19992. args: ["packageName"],
  19993. 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",
  19994. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  19995. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  19996. }),
  19997. $globals.SmalltalkImage);
  19998. $core.addMethod(
  19999. $core.method({
  20000. selector: "defaultAmdNamespace",
  20001. protocol: 'accessing amd',
  20002. fn: function (){
  20003. var self=this;
  20004. return $core.withContext(function($ctx1) {
  20005. var $1;
  20006. $1="transport.defaultAmdNamespace"._settingValue();
  20007. return $1;
  20008. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  20009. },
  20010. args: [],
  20011. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  20012. referencedClasses: [],
  20013. messageSends: ["settingValue"]
  20014. }),
  20015. $globals.SmalltalkImage);
  20016. $core.addMethod(
  20017. $core.method({
  20018. selector: "defaultAmdNamespace:",
  20019. protocol: 'accessing amd',
  20020. fn: function (aString){
  20021. var self=this;
  20022. return $core.withContext(function($ctx1) {
  20023. "transport.defaultAmdNamespace"._settingValue_(aString);
  20024. return self;
  20025. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  20026. },
  20027. args: ["aString"],
  20028. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  20029. referencedClasses: [],
  20030. messageSends: ["settingValue:"]
  20031. }),
  20032. $globals.SmalltalkImage);
  20033. $core.addMethod(
  20034. $core.method({
  20035. selector: "deleteClass:",
  20036. protocol: 'private',
  20037. fn: function (aClass){
  20038. var self=this;
  20039. return $core.withContext(function($ctx1) {
  20040. $core.removeClass(aClass);
  20041. return self;
  20042. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  20043. },
  20044. args: ["aClass"],
  20045. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<$core.removeClass(aClass)>",
  20046. referencedClasses: [],
  20047. messageSends: []
  20048. }),
  20049. $globals.SmalltalkImage);
  20050. $core.addMethod(
  20051. $core.method({
  20052. selector: "deleteGlobalJsVariable:",
  20053. protocol: 'globals',
  20054. fn: function (aString){
  20055. var self=this;
  20056. return $core.withContext(function($ctx1) {
  20057. $recv(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  20058. }));
  20059. return self;
  20060. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  20061. },
  20062. args: ["aString"],
  20063. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  20064. referencedClasses: [],
  20065. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  20066. }),
  20067. $globals.SmalltalkImage);
  20068. $core.addMethod(
  20069. $core.method({
  20070. selector: "deletePackage:",
  20071. protocol: 'private',
  20072. fn: function (packageName){
  20073. var self=this;
  20074. return $core.withContext(function($ctx1) {
  20075. delete $core.packages[packageName];
  20076. return self;
  20077. }, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  20078. },
  20079. args: ["packageName"],
  20080. 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]>",
  20081. referencedClasses: [],
  20082. messageSends: []
  20083. }),
  20084. $globals.SmalltalkImage);
  20085. $core.addMethod(
  20086. $core.method({
  20087. selector: "existsJsGlobal:",
  20088. protocol: 'testing',
  20089. fn: function (aString){
  20090. var self=this;
  20091. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  20092. return $core.withContext(function($ctx1) {
  20093. var $1;
  20094. $1=$recv($recv($Platform())._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  20095. return true;
  20096. }),(function(){
  20097. return false;
  20098. }));
  20099. return $1;
  20100. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  20101. },
  20102. args: ["aString"],
  20103. source: "existsJsGlobal: aString\x0a\x09^ Platform globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  20104. referencedClasses: ["Platform"],
  20105. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  20106. }),
  20107. $globals.SmalltalkImage);
  20108. $core.addMethod(
  20109. $core.method({
  20110. selector: "globalJsVariables",
  20111. protocol: 'globals',
  20112. fn: function (){
  20113. var self=this;
  20114. return $core.withContext(function($ctx1) {
  20115. return $core.globalJsVariables;
  20116. return self;
  20117. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  20118. },
  20119. args: [],
  20120. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<return $core.globalJsVariables>",
  20121. referencedClasses: [],
  20122. messageSends: []
  20123. }),
  20124. $globals.SmalltalkImage);
  20125. $core.addMethod(
  20126. $core.method({
  20127. selector: "globals",
  20128. protocol: 'accessing',
  20129. fn: function (){
  20130. var self=this;
  20131. return $core.withContext(function($ctx1) {
  20132. return $globals;
  20133. return self;
  20134. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  20135. },
  20136. args: [],
  20137. source: "globals\x0a\x09<return $globals>",
  20138. referencedClasses: [],
  20139. messageSends: []
  20140. }),
  20141. $globals.SmalltalkImage);
  20142. $core.addMethod(
  20143. $core.method({
  20144. selector: "includesKey:",
  20145. protocol: 'accessing',
  20146. fn: function (aKey){
  20147. var self=this;
  20148. return $core.withContext(function($ctx1) {
  20149. return $core.hasOwnProperty(aKey);
  20150. return self;
  20151. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  20152. },
  20153. args: ["aKey"],
  20154. source: "includesKey: aKey\x0a\x09<return $core.hasOwnProperty(aKey)>",
  20155. referencedClasses: [],
  20156. messageSends: []
  20157. }),
  20158. $globals.SmalltalkImage);
  20159. $core.addMethod(
  20160. $core.method({
  20161. selector: "isSmalltalkObject:",
  20162. protocol: 'testing',
  20163. fn: function (anObject){
  20164. var self=this;
  20165. return $core.withContext(function($ctx1) {
  20166. return anObject.klass != null;
  20167. return self;
  20168. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  20169. },
  20170. args: ["anObject"],
  20171. 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>",
  20172. referencedClasses: [],
  20173. messageSends: []
  20174. }),
  20175. $globals.SmalltalkImage);
  20176. $core.addMethod(
  20177. $core.method({
  20178. selector: "optOut:",
  20179. protocol: 'accessing',
  20180. fn: function (anObject){
  20181. var self=this;
  20182. return $core.withContext(function($ctx1) {
  20183. anObject.klass = null;
  20184. return self;
  20185. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  20186. },
  20187. args: ["anObject"],
  20188. 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>",
  20189. referencedClasses: [],
  20190. messageSends: []
  20191. }),
  20192. $globals.SmalltalkImage);
  20193. $core.addMethod(
  20194. $core.method({
  20195. selector: "packageAt:",
  20196. protocol: 'packages',
  20197. fn: function (packageName){
  20198. var self=this;
  20199. return $core.withContext(function($ctx1) {
  20200. return $core.packages[packageName];
  20201. return self;
  20202. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
  20203. },
  20204. args: ["packageName"],
  20205. source: "packageAt: packageName\x0a\x09<return $core.packages[packageName]>",
  20206. referencedClasses: [],
  20207. messageSends: []
  20208. }),
  20209. $globals.SmalltalkImage);
  20210. $core.addMethod(
  20211. $core.method({
  20212. selector: "packageAt:ifAbsent:",
  20213. protocol: 'packages',
  20214. fn: function (packageName,aBlock){
  20215. var self=this;
  20216. return $core.withContext(function($ctx1) {
  20217. var $2,$1;
  20218. $2=self._packageAt_(packageName);
  20219. $1=$recv($2)._ifNil_(aBlock);
  20220. return $1;
  20221. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  20222. },
  20223. args: ["packageName", "aBlock"],
  20224. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
  20225. referencedClasses: [],
  20226. messageSends: ["ifNil:", "packageAt:"]
  20227. }),
  20228. $globals.SmalltalkImage);
  20229. $core.addMethod(
  20230. $core.method({
  20231. selector: "packages",
  20232. protocol: 'packages',
  20233. fn: function (){
  20234. var self=this;
  20235. return $core.withContext(function($ctx1) {
  20236. return Object.keys($core.packages).map(function(k) {
  20237. return $core.packages[k];
  20238. })
  20239. ;
  20240. return self;
  20241. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  20242. },
  20243. args: [],
  20244. 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>",
  20245. referencedClasses: [],
  20246. messageSends: []
  20247. }),
  20248. $globals.SmalltalkImage);
  20249. $core.addMethod(
  20250. $core.method({
  20251. selector: "parse:",
  20252. protocol: 'accessing',
  20253. fn: function (aString){
  20254. var self=this;
  20255. var result;
  20256. return $core.withContext(function($ctx1) {
  20257. var $2,$3,$1;
  20258. $recv((function(){
  20259. return $core.withContext(function($ctx2) {
  20260. result=self._basicParse_(aString);
  20261. return result;
  20262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20263. }))._tryCatch_((function(ex){
  20264. return $core.withContext(function($ctx2) {
  20265. return $recv(self._parseError_parsing_(ex,aString))._signal();
  20266. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  20267. }));
  20268. $2=result;
  20269. $recv($2)._source_(aString);
  20270. $3=$recv($2)._yourself();
  20271. $1=$3;
  20272. return $1;
  20273. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  20274. },
  20275. args: ["aString"],
  20276. 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",
  20277. referencedClasses: [],
  20278. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  20279. }),
  20280. $globals.SmalltalkImage);
  20281. $core.addMethod(
  20282. $core.method({
  20283. selector: "parseError:parsing:",
  20284. protocol: 'error handling',
  20285. fn: function (anException,aString){
  20286. var self=this;
  20287. function $ParseError(){return $globals.ParseError||(typeof ParseError=="undefined"?nil:ParseError)}
  20288. return $core.withContext(function($ctx1) {
  20289. var $2,$8,$7,$6,$9,$5,$4,$3,$1;
  20290. $2=$recv($ParseError())._new();
  20291. $8=$recv(anException)._basicAt_("line");
  20292. $ctx1.sendIdx["basicAt:"]=1;
  20293. $7="Parse error on line ".__comma($8);
  20294. $6=$recv($7).__comma(" column ");
  20295. $ctx1.sendIdx[","]=4;
  20296. $9=$recv(anException)._basicAt_("column");
  20297. $ctx1.sendIdx["basicAt:"]=2;
  20298. $5=$recv($6).__comma($9);
  20299. $ctx1.sendIdx[","]=3;
  20300. $4=$recv($5).__comma(" : Unexpected character ");
  20301. $ctx1.sendIdx[","]=2;
  20302. $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
  20303. $ctx1.sendIdx[","]=1;
  20304. $1=$recv($2)._messageText_($3);
  20305. return $1;
  20306. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  20307. },
  20308. args: ["anException", "aString"],
  20309. 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')",
  20310. referencedClasses: ["ParseError"],
  20311. messageSends: ["messageText:", "new", ",", "basicAt:"]
  20312. }),
  20313. $globals.SmalltalkImage);
  20314. $core.addMethod(
  20315. $core.method({
  20316. selector: "pseudoVariableNames",
  20317. protocol: 'accessing',
  20318. fn: function (){
  20319. var self=this;
  20320. var $1;
  20321. $1=["self", "super", "nil", "true", "false", "thisContext"];
  20322. return $1;
  20323. },
  20324. args: [],
  20325. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  20326. referencedClasses: [],
  20327. messageSends: []
  20328. }),
  20329. $globals.SmalltalkImage);
  20330. $core.addMethod(
  20331. $core.method({
  20332. selector: "readJSObject:",
  20333. protocol: 'accessing',
  20334. fn: function (anObject){
  20335. var self=this;
  20336. return $core.withContext(function($ctx1) {
  20337. return $core.readJSObject(anObject);
  20338. return self;
  20339. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  20340. },
  20341. args: ["anObject"],
  20342. source: "readJSObject: anObject\x0a\x09<return $core.readJSObject(anObject)>",
  20343. referencedClasses: [],
  20344. messageSends: []
  20345. }),
  20346. $globals.SmalltalkImage);
  20347. $core.addMethod(
  20348. $core.method({
  20349. selector: "removeClass:",
  20350. protocol: 'classes',
  20351. fn: function (aClass){
  20352. var self=this;
  20353. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  20354. function $ClassRemoved(){return $globals.ClassRemoved||(typeof ClassRemoved=="undefined"?nil:ClassRemoved)}
  20355. return $core.withContext(function($ctx1) {
  20356. var $1,$2,$3;
  20357. $1=$recv(aClass)._isMetaclass();
  20358. if($core.assert($1)){
  20359. self._error_($recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  20360. };
  20361. self._deleteClass_(aClass);
  20362. $2=$recv($ClassRemoved())._new();
  20363. $recv($2)._theClass_(aClass);
  20364. $3=$recv($2)._yourself();
  20365. $recv($recv($SystemAnnouncer())._current())._announce_($3);
  20366. return self;
  20367. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  20368. },
  20369. args: ["aClass"],
  20370. 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)",
  20371. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  20372. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"]
  20373. }),
  20374. $globals.SmalltalkImage);
  20375. $core.addMethod(
  20376. $core.method({
  20377. selector: "removePackage:",
  20378. protocol: 'packages',
  20379. fn: function (packageName){
  20380. var self=this;
  20381. var pkg;
  20382. return $core.withContext(function($ctx1) {
  20383. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  20384. return $core.withContext(function($ctx2) {
  20385. return self._error_("Missing package: ".__comma(packageName));
  20386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20387. }));
  20388. $recv($recv(pkg)._classes())._do_((function(each){
  20389. return $core.withContext(function($ctx2) {
  20390. return self._removeClass_(each);
  20391. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  20392. }));
  20393. self._deletePackage_(packageName);
  20394. return self;
  20395. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  20396. },
  20397. args: ["packageName"],
  20398. 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",
  20399. referencedClasses: [],
  20400. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"]
  20401. }),
  20402. $globals.SmalltalkImage);
  20403. $core.addMethod(
  20404. $core.method({
  20405. selector: "renamePackage:to:",
  20406. protocol: 'packages',
  20407. fn: function (packageName,newName){
  20408. var self=this;
  20409. var pkg;
  20410. return $core.withContext(function($ctx1) {
  20411. var $1,$2,$receiver;
  20412. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  20413. return $core.withContext(function($ctx2) {
  20414. $1="Missing package: ".__comma(packageName);
  20415. $ctx2.sendIdx[","]=1;
  20416. return self._error_($1);
  20417. $ctx2.sendIdx["error:"]=1;
  20418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20419. }));
  20420. $2=self._packageAt_(newName);
  20421. if(($receiver = $2) == null || $receiver.isNil){
  20422. $2;
  20423. } else {
  20424. self._error_("Already exists a package called: ".__comma(newName));
  20425. };
  20426. $recv(pkg)._name_(newName);
  20427. self._basicRegisterPackage_(pkg);
  20428. self._deletePackage_(packageName);
  20429. return self;
  20430. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  20431. },
  20432. args: ["packageName", "newName"],
  20433. 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.",
  20434. referencedClasses: [],
  20435. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "basicRegisterPackage:", "deletePackage:"]
  20436. }),
  20437. $globals.SmalltalkImage);
  20438. $core.addMethod(
  20439. $core.method({
  20440. selector: "reservedWords",
  20441. protocol: 'accessing',
  20442. fn: function (){
  20443. var self=this;
  20444. return $core.withContext(function($ctx1) {
  20445. return $core.reservedWords;
  20446. return self;
  20447. }, function($ctx1) {$ctx1.fill(self,"reservedWords",{},$globals.SmalltalkImage)});
  20448. },
  20449. args: [],
  20450. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return $core.reservedWords>",
  20451. referencedClasses: [],
  20452. messageSends: []
  20453. }),
  20454. $globals.SmalltalkImage);
  20455. $core.addMethod(
  20456. $core.method({
  20457. selector: "settings",
  20458. protocol: 'accessing',
  20459. fn: function (){
  20460. var self=this;
  20461. function $SmalltalkSettings(){return $globals.SmalltalkSettings||(typeof SmalltalkSettings=="undefined"?nil:SmalltalkSettings)}
  20462. return $SmalltalkSettings();
  20463. },
  20464. args: [],
  20465. source: "settings\x0a\x09^ SmalltalkSettings",
  20466. referencedClasses: ["SmalltalkSettings"],
  20467. messageSends: []
  20468. }),
  20469. $globals.SmalltalkImage);
  20470. $core.addMethod(
  20471. $core.method({
  20472. selector: "version",
  20473. protocol: 'accessing',
  20474. fn: function (){
  20475. var self=this;
  20476. return "0.15.0-pre";
  20477. },
  20478. args: [],
  20479. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.15.0-pre'",
  20480. referencedClasses: [],
  20481. messageSends: []
  20482. }),
  20483. $globals.SmalltalkImage);
  20484. $globals.SmalltalkImage.klass.iVarNames = ['current'];
  20485. $core.addMethod(
  20486. $core.method({
  20487. selector: "current",
  20488. protocol: 'instance creation',
  20489. fn: function (){
  20490. var self=this;
  20491. return $core.withContext(function($ctx1) {
  20492. var $2,$1,$receiver;
  20493. $2=self["@current"];
  20494. if(($receiver = $2) == null || $receiver.isNil){
  20495. self["@current"]=(
  20496. $ctx1.supercall = true,
  20497. $globals.SmalltalkImage.klass.superclass.fn.prototype._new.apply($recv(self), []));
  20498. $ctx1.supercall = false;
  20499. $1=self["@current"];
  20500. } else {
  20501. self._deprecatedAPI();
  20502. $1=self["@current"];
  20503. };
  20504. return $1;
  20505. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.klass)});
  20506. },
  20507. args: [],
  20508. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  20509. referencedClasses: [],
  20510. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  20511. }),
  20512. $globals.SmalltalkImage.klass);
  20513. $core.addMethod(
  20514. $core.method({
  20515. selector: "initialize",
  20516. protocol: 'initialization',
  20517. fn: function (){
  20518. var self=this;
  20519. var st;
  20520. return $core.withContext(function($ctx1) {
  20521. st=self._current();
  20522. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  20523. return self;
  20524. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.klass)});
  20525. },
  20526. args: [],
  20527. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  20528. referencedClasses: [],
  20529. messageSends: ["current", "at:put:", "globals"]
  20530. }),
  20531. $globals.SmalltalkImage.klass);
  20532. $core.addMethod(
  20533. $core.method({
  20534. selector: "new",
  20535. protocol: 'instance creation',
  20536. fn: function (){
  20537. var self=this;
  20538. return $core.withContext(function($ctx1) {
  20539. self._shouldNotImplement();
  20540. return self;
  20541. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.klass)});
  20542. },
  20543. args: [],
  20544. source: "new\x0a\x09self shouldNotImplement",
  20545. referencedClasses: [],
  20546. messageSends: ["shouldNotImplement"]
  20547. }),
  20548. $globals.SmalltalkImage.klass);
  20549. $core.addMethod(
  20550. $core.method({
  20551. selector: "importsString",
  20552. protocol: '*Kernel-Infrastructure',
  20553. fn: function (){
  20554. var self=this;
  20555. return $core.withContext(function($ctx1) {
  20556. var $3,$2,$1;
  20557. $3=$recv(self._key())._importsString();
  20558. $ctx1.sendIdx["importsString"]=1;
  20559. $2=$recv($3).__comma(" -> ");
  20560. $1=$recv($2).__comma($recv(self._value())._importsString());
  20561. $ctx1.sendIdx[","]=1;
  20562. return $1;
  20563. }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.Association)});
  20564. },
  20565. args: [],
  20566. 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",
  20567. referencedClasses: [],
  20568. messageSends: [",", "importsString", "key", "value"]
  20569. }),
  20570. $globals.Association);
  20571. $core.addMethod(
  20572. $core.method({
  20573. selector: "asJavaScriptPropertyName",
  20574. protocol: '*Kernel-Infrastructure',
  20575. fn: function (){
  20576. var self=this;
  20577. return $core.withContext(function($ctx1) {
  20578. return $core.st2prop(self);
  20579. return self;
  20580. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  20581. },
  20582. args: [],
  20583. source: "asJavaScriptPropertyName\x0a<return $core.st2prop(self)>",
  20584. referencedClasses: [],
  20585. messageSends: []
  20586. }),
  20587. $globals.String);
  20588. $core.addMethod(
  20589. $core.method({
  20590. selector: "asSetting",
  20591. protocol: '*Kernel-Infrastructure',
  20592. fn: function (){
  20593. var self=this;
  20594. function $Setting(){return $globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
  20595. return $core.withContext(function($ctx1) {
  20596. var $1;
  20597. $1=$recv($Setting())._at_ifAbsent_(self,nil);
  20598. return $1;
  20599. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  20600. },
  20601. args: [],
  20602. 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",
  20603. referencedClasses: ["Setting"],
  20604. messageSends: ["at:ifAbsent:"]
  20605. }),
  20606. $globals.String);
  20607. $core.addMethod(
  20608. $core.method({
  20609. selector: "asSettingIfAbsent:",
  20610. protocol: '*Kernel-Infrastructure',
  20611. fn: function (aDefaultValue){
  20612. var self=this;
  20613. function $Setting(){return $globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
  20614. return $core.withContext(function($ctx1) {
  20615. var $1;
  20616. $1=$recv($Setting())._at_ifAbsent_(self,aDefaultValue);
  20617. return $1;
  20618. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  20619. },
  20620. args: ["aDefaultValue"],
  20621. 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",
  20622. referencedClasses: ["Setting"],
  20623. messageSends: ["at:ifAbsent:"]
  20624. }),
  20625. $globals.String);
  20626. $core.addMethod(
  20627. $core.method({
  20628. selector: "importsString",
  20629. protocol: '*Kernel-Infrastructure',
  20630. fn: function (){
  20631. var self=this;
  20632. return $core.withContext(function($ctx1) {
  20633. var $1;
  20634. $1=$recv("'".__comma(self._replace_with_("'","''"))).__comma("'");
  20635. $ctx1.sendIdx[","]=1;
  20636. return $1;
  20637. }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.String)});
  20638. },
  20639. args: [],
  20640. source: "importsString\x0a\x09\x22Answer receiver as Smalltalk expression\x22\x0a\x09^ '''', (self replace: '''' with: ''''''), ''''",
  20641. referencedClasses: [],
  20642. messageSends: [",", "replace:with:"]
  20643. }),
  20644. $globals.String);
  20645. $core.addMethod(
  20646. $core.method({
  20647. selector: "settingValue",
  20648. protocol: '*Kernel-Infrastructure',
  20649. fn: function (){
  20650. var self=this;
  20651. return $core.withContext(function($ctx1) {
  20652. var $1;
  20653. $1=$recv(self._asSetting())._value();
  20654. return $1;
  20655. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  20656. },
  20657. args: [],
  20658. source: "settingValue\x0a\x09^ self asSetting value",
  20659. referencedClasses: [],
  20660. messageSends: ["value", "asSetting"]
  20661. }),
  20662. $globals.String);
  20663. $core.addMethod(
  20664. $core.method({
  20665. selector: "settingValue:",
  20666. protocol: '*Kernel-Infrastructure',
  20667. fn: function (aValue){
  20668. var self=this;
  20669. return $core.withContext(function($ctx1) {
  20670. var $1;
  20671. $1=$recv(self._asSetting())._value_(aValue);
  20672. return $1;
  20673. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  20674. },
  20675. args: ["aValue"],
  20676. 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",
  20677. referencedClasses: [],
  20678. messageSends: ["value:", "asSetting"]
  20679. }),
  20680. $globals.String);
  20681. $core.addMethod(
  20682. $core.method({
  20683. selector: "settingValueIfAbsent:",
  20684. protocol: '*Kernel-Infrastructure',
  20685. fn: function (aDefaultValue){
  20686. var self=this;
  20687. return $core.withContext(function($ctx1) {
  20688. var $1;
  20689. $1=$recv(self._asSettingIfAbsent_(aDefaultValue))._value();
  20690. return $1;
  20691. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  20692. },
  20693. args: ["aDefaultValue"],
  20694. 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",
  20695. referencedClasses: [],
  20696. messageSends: ["value", "asSettingIfAbsent:"]
  20697. }),
  20698. $globals.String);
  20699. });
  20700. define("amber_core/Kernel-Announcements", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20701. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  20702. $core.addPackage('Kernel-Announcements');
  20703. $core.packages["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  20704. $core.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20705. $core.addClass('AnnouncementSubscription', $globals.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
  20706. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  20707. $core.addMethod(
  20708. $core.method({
  20709. selector: "announcementClass",
  20710. protocol: 'accessing',
  20711. fn: function (){
  20712. var self=this;
  20713. var $1;
  20714. $1=self["@announcementClass"];
  20715. return $1;
  20716. },
  20717. args: [],
  20718. source: "announcementClass\x0a\x09^ announcementClass",
  20719. referencedClasses: [],
  20720. messageSends: []
  20721. }),
  20722. $globals.AnnouncementSubscription);
  20723. $core.addMethod(
  20724. $core.method({
  20725. selector: "announcementClass:",
  20726. protocol: 'accessing',
  20727. fn: function (aClass){
  20728. var self=this;
  20729. self["@announcementClass"]=aClass;
  20730. return self;
  20731. },
  20732. args: ["aClass"],
  20733. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  20734. referencedClasses: [],
  20735. messageSends: []
  20736. }),
  20737. $globals.AnnouncementSubscription);
  20738. $core.addMethod(
  20739. $core.method({
  20740. selector: "deliver:",
  20741. protocol: 'announcing',
  20742. fn: function (anAnnouncement){
  20743. var self=this;
  20744. return $core.withContext(function($ctx1) {
  20745. var $1;
  20746. $1=self._handlesAnnouncement_(anAnnouncement);
  20747. if($core.assert($1)){
  20748. $recv(self._valuable())._value_(anAnnouncement);
  20749. };
  20750. return self;
  20751. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  20752. },
  20753. args: ["anAnnouncement"],
  20754. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  20755. referencedClasses: [],
  20756. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  20757. }),
  20758. $globals.AnnouncementSubscription);
  20759. $core.addMethod(
  20760. $core.method({
  20761. selector: "handlesAnnouncement:",
  20762. protocol: 'announcing',
  20763. fn: function (anAnnouncement){
  20764. var self=this;
  20765. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  20766. return $core.withContext(function($ctx1) {
  20767. var $3,$4,$2,$1,$receiver;
  20768. $3=$recv($Smalltalk())._globals();
  20769. $ctx1.sendIdx["globals"]=1;
  20770. $4=$recv(self._announcementClass())._name();
  20771. $ctx1.sendIdx["name"]=1;
  20772. $2=$recv($3)._at_($4);
  20773. $ctx1.sendIdx["at:"]=1;
  20774. if(($receiver = $2) == null || $receiver.isNil){
  20775. return false;
  20776. } else {
  20777. var class_;
  20778. class_=$receiver;
  20779. $1=$recv($recv($recv($Smalltalk())._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  20780. };
  20781. return $1;
  20782. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  20783. },
  20784. args: ["anAnnouncement"],
  20785. 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 ]",
  20786. referencedClasses: ["Smalltalk"],
  20787. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  20788. }),
  20789. $globals.AnnouncementSubscription);
  20790. $core.addMethod(
  20791. $core.method({
  20792. selector: "receiver",
  20793. protocol: 'accessing',
  20794. fn: function (){
  20795. var self=this;
  20796. return $core.withContext(function($ctx1) {
  20797. var $1;
  20798. $1=$recv(self._valuable())._receiver();
  20799. return $1;
  20800. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  20801. },
  20802. args: [],
  20803. source: "receiver\x0a\x09^ self valuable receiver",
  20804. referencedClasses: [],
  20805. messageSends: ["receiver", "valuable"]
  20806. }),
  20807. $globals.AnnouncementSubscription);
  20808. $core.addMethod(
  20809. $core.method({
  20810. selector: "valuable",
  20811. protocol: 'accessing',
  20812. fn: function (){
  20813. var self=this;
  20814. var $1;
  20815. $1=self["@valuable"];
  20816. return $1;
  20817. },
  20818. args: [],
  20819. source: "valuable\x0a\x09^ valuable",
  20820. referencedClasses: [],
  20821. messageSends: []
  20822. }),
  20823. $globals.AnnouncementSubscription);
  20824. $core.addMethod(
  20825. $core.method({
  20826. selector: "valuable:",
  20827. protocol: 'accessing',
  20828. fn: function (aValuable){
  20829. var self=this;
  20830. self["@valuable"]=aValuable;
  20831. return self;
  20832. },
  20833. args: ["aValuable"],
  20834. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  20835. referencedClasses: [],
  20836. messageSends: []
  20837. }),
  20838. $globals.AnnouncementSubscription);
  20839. $core.addClass('AnnouncementValuable', $globals.Object, ['valuable', 'receiver'], 'Kernel-Announcements');
  20840. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  20841. $core.addMethod(
  20842. $core.method({
  20843. selector: "receiver",
  20844. protocol: 'accessing',
  20845. fn: function (){
  20846. var self=this;
  20847. var $1;
  20848. $1=self["@receiver"];
  20849. return $1;
  20850. },
  20851. args: [],
  20852. source: "receiver\x0a\x09^ receiver",
  20853. referencedClasses: [],
  20854. messageSends: []
  20855. }),
  20856. $globals.AnnouncementValuable);
  20857. $core.addMethod(
  20858. $core.method({
  20859. selector: "receiver:",
  20860. protocol: 'accessing',
  20861. fn: function (anObject){
  20862. var self=this;
  20863. self["@receiver"]=anObject;
  20864. return self;
  20865. },
  20866. args: ["anObject"],
  20867. source: "receiver: anObject\x0a\x09receiver := anObject",
  20868. referencedClasses: [],
  20869. messageSends: []
  20870. }),
  20871. $globals.AnnouncementValuable);
  20872. $core.addMethod(
  20873. $core.method({
  20874. selector: "valuable",
  20875. protocol: 'accessing',
  20876. fn: function (){
  20877. var self=this;
  20878. var $1;
  20879. $1=self["@valuable"];
  20880. return $1;
  20881. },
  20882. args: [],
  20883. source: "valuable\x0a\x09^ valuable",
  20884. referencedClasses: [],
  20885. messageSends: []
  20886. }),
  20887. $globals.AnnouncementValuable);
  20888. $core.addMethod(
  20889. $core.method({
  20890. selector: "valuable:",
  20891. protocol: 'accessing',
  20892. fn: function (anObject){
  20893. var self=this;
  20894. self["@valuable"]=anObject;
  20895. return self;
  20896. },
  20897. args: ["anObject"],
  20898. source: "valuable: anObject\x0a\x09valuable := anObject",
  20899. referencedClasses: [],
  20900. messageSends: []
  20901. }),
  20902. $globals.AnnouncementValuable);
  20903. $core.addMethod(
  20904. $core.method({
  20905. selector: "value",
  20906. protocol: 'evaluating',
  20907. fn: function (){
  20908. var self=this;
  20909. return $core.withContext(function($ctx1) {
  20910. var $1;
  20911. $1=$recv(self._valuable())._value();
  20912. return $1;
  20913. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  20914. },
  20915. args: [],
  20916. source: "value\x0a\x09^ self valuable value",
  20917. referencedClasses: [],
  20918. messageSends: ["value", "valuable"]
  20919. }),
  20920. $globals.AnnouncementValuable);
  20921. $core.addMethod(
  20922. $core.method({
  20923. selector: "value:",
  20924. protocol: 'evaluating',
  20925. fn: function (anObject){
  20926. var self=this;
  20927. return $core.withContext(function($ctx1) {
  20928. var $1;
  20929. $1=$recv(self._valuable())._value_(anObject);
  20930. return $1;
  20931. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  20932. },
  20933. args: ["anObject"],
  20934. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  20935. referencedClasses: [],
  20936. messageSends: ["value:", "valuable"]
  20937. }),
  20938. $globals.AnnouncementValuable);
  20939. $core.addClass('Announcer', $globals.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  20940. $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' ].";
  20941. $core.addMethod(
  20942. $core.method({
  20943. selector: "announce:",
  20944. protocol: 'announcing',
  20945. fn: function (anAnnouncement){
  20946. var self=this;
  20947. return $core.withContext(function($ctx1) {
  20948. $recv(self["@subscriptions"])._do_((function(each){
  20949. return $core.withContext(function($ctx2) {
  20950. return $recv(each)._deliver_(anAnnouncement);
  20951. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20952. }));
  20953. return self;
  20954. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  20955. },
  20956. args: ["anAnnouncement"],
  20957. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  20958. referencedClasses: [],
  20959. messageSends: ["do:", "deliver:"]
  20960. }),
  20961. $globals.Announcer);
  20962. $core.addMethod(
  20963. $core.method({
  20964. selector: "initialize",
  20965. protocol: 'initialization',
  20966. fn: function (){
  20967. var self=this;
  20968. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  20969. return $core.withContext(function($ctx1) {
  20970. (
  20971. $ctx1.supercall = true,
  20972. $globals.Announcer.superclass.fn.prototype._initialize.apply($recv(self), []));
  20973. $ctx1.supercall = false;
  20974. self["@subscriptions"]=$recv($OrderedCollection())._new();
  20975. return self;
  20976. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  20977. },
  20978. args: [],
  20979. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  20980. referencedClasses: ["OrderedCollection"],
  20981. messageSends: ["initialize", "new"]
  20982. }),
  20983. $globals.Announcer);
  20984. $core.addMethod(
  20985. $core.method({
  20986. selector: "on:do:",
  20987. protocol: 'subscribing',
  20988. fn: function (aClass,aBlock){
  20989. var self=this;
  20990. return $core.withContext(function($ctx1) {
  20991. self._on_do_for_(aClass,aBlock,nil);
  20992. return self;
  20993. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  20994. },
  20995. args: ["aClass", "aBlock"],
  20996. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  20997. referencedClasses: [],
  20998. messageSends: ["on:do:for:"]
  20999. }),
  21000. $globals.Announcer);
  21001. $core.addMethod(
  21002. $core.method({
  21003. selector: "on:do:for:",
  21004. protocol: 'subscribing',
  21005. fn: function (aClass,aBlock,aReceiver){
  21006. var self=this;
  21007. function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  21008. function $AnnouncementValuable(){return $globals.AnnouncementValuable||(typeof AnnouncementValuable=="undefined"?nil:AnnouncementValuable)}
  21009. return $core.withContext(function($ctx1) {
  21010. var $1,$3,$4,$6,$7,$5,$8,$2;
  21011. $1=self["@subscriptions"];
  21012. $3=$recv($AnnouncementSubscription())._new();
  21013. $ctx1.sendIdx["new"]=1;
  21014. $4=$3;
  21015. $6=$recv($AnnouncementValuable())._new();
  21016. $recv($6)._valuable_(aBlock);
  21017. $recv($6)._receiver_(aReceiver);
  21018. $7=$recv($6)._yourself();
  21019. $ctx1.sendIdx["yourself"]=1;
  21020. $5=$7;
  21021. $recv($4)._valuable_($5);
  21022. $ctx1.sendIdx["valuable:"]=1;
  21023. $recv($3)._announcementClass_(aClass);
  21024. $8=$recv($3)._yourself();
  21025. $2=$8;
  21026. $recv($1)._add_($2);
  21027. return self;
  21028. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  21029. },
  21030. args: ["aClass", "aBlock", "aReceiver"],
  21031. 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)",
  21032. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  21033. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  21034. }),
  21035. $globals.Announcer);
  21036. $core.addMethod(
  21037. $core.method({
  21038. selector: "on:doOnce:",
  21039. protocol: 'subscribing',
  21040. fn: function (aClass,aBlock){
  21041. var self=this;
  21042. var subscription;
  21043. function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  21044. return $core.withContext(function($ctx1) {
  21045. var $1,$2;
  21046. $1=$recv($AnnouncementSubscription())._new();
  21047. $recv($1)._announcementClass_(aClass);
  21048. $2=$recv($1)._yourself();
  21049. subscription=$2;
  21050. $recv(subscription)._valuable_((function(ann){
  21051. return $core.withContext(function($ctx2) {
  21052. $recv(self["@subscriptions"])._remove_(subscription);
  21053. return $recv(aBlock)._value_(ann);
  21054. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  21055. }));
  21056. $recv(self["@subscriptions"])._add_(subscription);
  21057. return self;
  21058. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  21059. },
  21060. args: ["aClass", "aBlock"],
  21061. 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",
  21062. referencedClasses: ["AnnouncementSubscription"],
  21063. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  21064. }),
  21065. $globals.Announcer);
  21066. $core.addMethod(
  21067. $core.method({
  21068. selector: "on:send:to:",
  21069. protocol: 'subscribing',
  21070. fn: function (aClass,aSelector,anObject){
  21071. var self=this;
  21072. function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  21073. function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  21074. return $core.withContext(function($ctx1) {
  21075. var $1,$3,$4,$6,$7,$5,$8,$2;
  21076. $1=self["@subscriptions"];
  21077. $3=$recv($AnnouncementSubscription())._new();
  21078. $ctx1.sendIdx["new"]=1;
  21079. $4=$3;
  21080. $6=$recv($MessageSend())._new();
  21081. $recv($6)._receiver_(anObject);
  21082. $recv($6)._selector_(aSelector);
  21083. $7=$recv($6)._yourself();
  21084. $ctx1.sendIdx["yourself"]=1;
  21085. $5=$7;
  21086. $recv($4)._valuable_($5);
  21087. $recv($3)._announcementClass_(aClass);
  21088. $8=$recv($3)._yourself();
  21089. $2=$8;
  21090. $recv($1)._add_($2);
  21091. return self;
  21092. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  21093. },
  21094. args: ["aClass", "aSelector", "anObject"],
  21095. 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)",
  21096. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  21097. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  21098. }),
  21099. $globals.Announcer);
  21100. $core.addMethod(
  21101. $core.method({
  21102. selector: "unsubscribe:",
  21103. protocol: 'subscribing',
  21104. fn: function (anObject){
  21105. var self=this;
  21106. return $core.withContext(function($ctx1) {
  21107. self["@subscriptions"]=$recv(self["@subscriptions"])._reject_((function(each){
  21108. return $core.withContext(function($ctx2) {
  21109. return $recv($recv(each)._receiver()).__eq(anObject);
  21110. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21111. }));
  21112. return self;
  21113. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  21114. },
  21115. args: ["anObject"],
  21116. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  21117. referencedClasses: [],
  21118. messageSends: ["reject:", "=", "receiver"]
  21119. }),
  21120. $globals.Announcer);
  21121. $core.addClass('SystemAnnouncer', $globals.Announcer, [], 'Kernel-Announcements');
  21122. $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`";
  21123. $globals.SystemAnnouncer.klass.iVarNames = ['current'];
  21124. $core.addMethod(
  21125. $core.method({
  21126. selector: "current",
  21127. protocol: 'accessing',
  21128. fn: function (){
  21129. var self=this;
  21130. return $core.withContext(function($ctx1) {
  21131. var $2,$1,$receiver;
  21132. $2=self["@current"];
  21133. if(($receiver = $2) == null || $receiver.isNil){
  21134. self["@current"]=(
  21135. $ctx1.supercall = true,
  21136. $globals.SystemAnnouncer.klass.superclass.fn.prototype._new.apply($recv(self), []));
  21137. $ctx1.supercall = false;
  21138. $1=self["@current"];
  21139. } else {
  21140. $1=$2;
  21141. };
  21142. return $1;
  21143. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.klass)});
  21144. },
  21145. args: [],
  21146. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  21147. referencedClasses: [],
  21148. messageSends: ["ifNil:", "new"]
  21149. }),
  21150. $globals.SystemAnnouncer.klass);
  21151. $core.addMethod(
  21152. $core.method({
  21153. selector: "new",
  21154. protocol: 'instance creation',
  21155. fn: function (){
  21156. var self=this;
  21157. return $core.withContext(function($ctx1) {
  21158. self._shouldNotImplement();
  21159. return self;
  21160. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.klass)});
  21161. },
  21162. args: [],
  21163. source: "new\x0a\x09self shouldNotImplement",
  21164. referencedClasses: [],
  21165. messageSends: ["shouldNotImplement"]
  21166. }),
  21167. $globals.SystemAnnouncer.klass);
  21168. $core.addClass('SystemAnnouncement', $globals.Object, [], 'Kernel-Announcements');
  21169. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  21170. $core.addMethod(
  21171. $core.method({
  21172. selector: "classTag",
  21173. protocol: 'accessing',
  21174. fn: function (){
  21175. var self=this;
  21176. return "announcement";
  21177. },
  21178. args: [],
  21179. 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'",
  21180. referencedClasses: [],
  21181. messageSends: []
  21182. }),
  21183. $globals.SystemAnnouncement.klass);
  21184. $core.addClass('ClassAnnouncement', $globals.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
  21185. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  21186. $core.addMethod(
  21187. $core.method({
  21188. selector: "theClass",
  21189. protocol: 'accessing',
  21190. fn: function (){
  21191. var self=this;
  21192. var $1;
  21193. $1=self["@theClass"];
  21194. return $1;
  21195. },
  21196. args: [],
  21197. source: "theClass\x0a\x09^ theClass",
  21198. referencedClasses: [],
  21199. messageSends: []
  21200. }),
  21201. $globals.ClassAnnouncement);
  21202. $core.addMethod(
  21203. $core.method({
  21204. selector: "theClass:",
  21205. protocol: 'accessing',
  21206. fn: function (aClass){
  21207. var self=this;
  21208. self["@theClass"]=aClass;
  21209. return self;
  21210. },
  21211. args: ["aClass"],
  21212. source: "theClass: aClass\x0a\x09theClass := aClass",
  21213. referencedClasses: [],
  21214. messageSends: []
  21215. }),
  21216. $globals.ClassAnnouncement);
  21217. $core.addClass('ClassAdded', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21218. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  21219. $core.addClass('ClassCommentChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21220. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  21221. $core.addClass('ClassDefinitionChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21222. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  21223. $core.addClass('ClassMigrated', $globals.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements');
  21224. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  21225. $core.addMethod(
  21226. $core.method({
  21227. selector: "oldClass",
  21228. protocol: 'accessing',
  21229. fn: function (){
  21230. var self=this;
  21231. var $1;
  21232. $1=self["@oldClass"];
  21233. return $1;
  21234. },
  21235. args: [],
  21236. source: "oldClass\x0a\x09^ oldClass",
  21237. referencedClasses: [],
  21238. messageSends: []
  21239. }),
  21240. $globals.ClassMigrated);
  21241. $core.addMethod(
  21242. $core.method({
  21243. selector: "oldClass:",
  21244. protocol: 'accessing',
  21245. fn: function (aClass){
  21246. var self=this;
  21247. self["@oldClass"]=aClass;
  21248. return self;
  21249. },
  21250. args: ["aClass"],
  21251. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  21252. referencedClasses: [],
  21253. messageSends: []
  21254. }),
  21255. $globals.ClassMigrated);
  21256. $core.addClass('ClassMoved', $globals.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
  21257. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  21258. $core.addMethod(
  21259. $core.method({
  21260. selector: "oldPackage",
  21261. protocol: 'accessing',
  21262. fn: function (){
  21263. var self=this;
  21264. var $1;
  21265. $1=self["@oldPackage"];
  21266. return $1;
  21267. },
  21268. args: [],
  21269. source: "oldPackage\x0a\x09^ oldPackage",
  21270. referencedClasses: [],
  21271. messageSends: []
  21272. }),
  21273. $globals.ClassMoved);
  21274. $core.addMethod(
  21275. $core.method({
  21276. selector: "oldPackage:",
  21277. protocol: 'accessing',
  21278. fn: function (aPackage){
  21279. var self=this;
  21280. self["@oldPackage"]=aPackage;
  21281. return self;
  21282. },
  21283. args: ["aPackage"],
  21284. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  21285. referencedClasses: [],
  21286. messageSends: []
  21287. }),
  21288. $globals.ClassMoved);
  21289. $core.addClass('ClassRemoved', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21290. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  21291. $core.addClass('ClassRenamed', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21292. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  21293. $core.addClass('MethodAnnouncement', $globals.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  21294. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  21295. $core.addMethod(
  21296. $core.method({
  21297. selector: "method",
  21298. protocol: 'accessing',
  21299. fn: function (){
  21300. var self=this;
  21301. var $1;
  21302. $1=self["@method"];
  21303. return $1;
  21304. },
  21305. args: [],
  21306. source: "method\x0a\x09^ method",
  21307. referencedClasses: [],
  21308. messageSends: []
  21309. }),
  21310. $globals.MethodAnnouncement);
  21311. $core.addMethod(
  21312. $core.method({
  21313. selector: "method:",
  21314. protocol: 'accessing',
  21315. fn: function (aCompiledMethod){
  21316. var self=this;
  21317. self["@method"]=aCompiledMethod;
  21318. return self;
  21319. },
  21320. args: ["aCompiledMethod"],
  21321. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  21322. referencedClasses: [],
  21323. messageSends: []
  21324. }),
  21325. $globals.MethodAnnouncement);
  21326. $core.addClass('MethodAdded', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  21327. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  21328. $core.addClass('MethodModified', $globals.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
  21329. $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.";
  21330. $core.addMethod(
  21331. $core.method({
  21332. selector: "oldMethod",
  21333. protocol: 'accessing',
  21334. fn: function (){
  21335. var self=this;
  21336. var $1;
  21337. $1=self["@oldMethod"];
  21338. return $1;
  21339. },
  21340. args: [],
  21341. source: "oldMethod\x0a\x09^ oldMethod",
  21342. referencedClasses: [],
  21343. messageSends: []
  21344. }),
  21345. $globals.MethodModified);
  21346. $core.addMethod(
  21347. $core.method({
  21348. selector: "oldMethod:",
  21349. protocol: 'accessing',
  21350. fn: function (aMethod){
  21351. var self=this;
  21352. self["@oldMethod"]=aMethod;
  21353. return self;
  21354. },
  21355. args: ["aMethod"],
  21356. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  21357. referencedClasses: [],
  21358. messageSends: []
  21359. }),
  21360. $globals.MethodModified);
  21361. $core.addClass('MethodMoved', $globals.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
  21362. $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.";
  21363. $core.addMethod(
  21364. $core.method({
  21365. selector: "oldProtocol",
  21366. protocol: 'accessing',
  21367. fn: function (){
  21368. var self=this;
  21369. var $1;
  21370. $1=self["@oldProtocol"];
  21371. return $1;
  21372. },
  21373. args: [],
  21374. source: "oldProtocol\x0a\x09^ oldProtocol",
  21375. referencedClasses: [],
  21376. messageSends: []
  21377. }),
  21378. $globals.MethodMoved);
  21379. $core.addMethod(
  21380. $core.method({
  21381. selector: "oldProtocol:",
  21382. protocol: 'accessing',
  21383. fn: function (aString){
  21384. var self=this;
  21385. self["@oldProtocol"]=aString;
  21386. return self;
  21387. },
  21388. args: ["aString"],
  21389. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  21390. referencedClasses: [],
  21391. messageSends: []
  21392. }),
  21393. $globals.MethodMoved);
  21394. $core.addClass('MethodRemoved', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  21395. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  21396. $core.addClass('PackageAnnouncement', $globals.SystemAnnouncement, ['package'], 'Kernel-Announcements');
  21397. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  21398. $core.addMethod(
  21399. $core.method({
  21400. selector: "package",
  21401. protocol: 'accessing',
  21402. fn: function (){
  21403. var self=this;
  21404. var $1;
  21405. $1=self["@package"];
  21406. return $1;
  21407. },
  21408. args: [],
  21409. source: "package\x0a\x09^ package",
  21410. referencedClasses: [],
  21411. messageSends: []
  21412. }),
  21413. $globals.PackageAnnouncement);
  21414. $core.addMethod(
  21415. $core.method({
  21416. selector: "package:",
  21417. protocol: 'accessing',
  21418. fn: function (aPackage){
  21419. var self=this;
  21420. self["@package"]=aPackage;
  21421. return self;
  21422. },
  21423. args: ["aPackage"],
  21424. source: "package: aPackage\x0a\x09package := aPackage",
  21425. referencedClasses: [],
  21426. messageSends: []
  21427. }),
  21428. $globals.PackageAnnouncement);
  21429. $core.addClass('PackageAdded', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21430. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  21431. $core.addClass('PackageClean', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21432. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  21433. $core.addClass('PackageDirty', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21434. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  21435. $core.addClass('PackageRemoved', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21436. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  21437. $core.addClass('ProtocolAnnouncement', $globals.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
  21438. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  21439. $core.addMethod(
  21440. $core.method({
  21441. selector: "package",
  21442. protocol: 'accessing',
  21443. fn: function (){
  21444. var self=this;
  21445. return $core.withContext(function($ctx1) {
  21446. var $2,$1,$receiver;
  21447. $2=self._theClass();
  21448. if(($receiver = $2) == null || $receiver.isNil){
  21449. $1=$2;
  21450. } else {
  21451. var class_;
  21452. class_=$receiver;
  21453. $1=$recv(class_)._packageOfProtocol_(self._protocol());
  21454. };
  21455. return $1;
  21456. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  21457. },
  21458. args: [],
  21459. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  21460. referencedClasses: [],
  21461. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  21462. }),
  21463. $globals.ProtocolAnnouncement);
  21464. $core.addMethod(
  21465. $core.method({
  21466. selector: "protocol",
  21467. protocol: 'accessing',
  21468. fn: function (){
  21469. var self=this;
  21470. var $1;
  21471. $1=self["@protocol"];
  21472. return $1;
  21473. },
  21474. args: [],
  21475. source: "protocol\x0a\x09^ protocol",
  21476. referencedClasses: [],
  21477. messageSends: []
  21478. }),
  21479. $globals.ProtocolAnnouncement);
  21480. $core.addMethod(
  21481. $core.method({
  21482. selector: "protocol:",
  21483. protocol: 'accessing',
  21484. fn: function (aString){
  21485. var self=this;
  21486. self["@protocol"]=aString;
  21487. return self;
  21488. },
  21489. args: ["aString"],
  21490. source: "protocol: aString\x0a\x09protocol := aString",
  21491. referencedClasses: [],
  21492. messageSends: []
  21493. }),
  21494. $globals.ProtocolAnnouncement);
  21495. $core.addMethod(
  21496. $core.method({
  21497. selector: "theClass",
  21498. protocol: 'accessing',
  21499. fn: function (){
  21500. var self=this;
  21501. var $1;
  21502. $1=self["@theClass"];
  21503. return $1;
  21504. },
  21505. args: [],
  21506. source: "theClass\x0a\x09^ theClass",
  21507. referencedClasses: [],
  21508. messageSends: []
  21509. }),
  21510. $globals.ProtocolAnnouncement);
  21511. $core.addMethod(
  21512. $core.method({
  21513. selector: "theClass:",
  21514. protocol: 'accessing',
  21515. fn: function (aClass){
  21516. var self=this;
  21517. self["@theClass"]=aClass;
  21518. return self;
  21519. },
  21520. args: ["aClass"],
  21521. source: "theClass: aClass\x0a\x09theClass := aClass",
  21522. referencedClasses: [],
  21523. messageSends: []
  21524. }),
  21525. $globals.ProtocolAnnouncement);
  21526. $core.addClass('ProtocolAdded', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  21527. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  21528. $core.addClass('ProtocolRemoved', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  21529. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  21530. });
  21531. 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";
  21532. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  21533. $core.addPackage('Platform-Services');
  21534. $core.packages["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  21535. $core.packages["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21536. $core.addClass('ConsoleErrorHandler', $globals.Object, [], 'Platform-Services');
  21537. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  21538. $core.addMethod(
  21539. $core.method({
  21540. selector: "handleError:",
  21541. protocol: 'error handling',
  21542. fn: function (anError){
  21543. var self=this;
  21544. return $core.withContext(function($ctx1) {
  21545. var $1,$receiver;
  21546. $1=$recv(anError)._context();
  21547. $ctx1.sendIdx["context"]=1;
  21548. if(($receiver = $1) == null || $receiver.isNil){
  21549. $1;
  21550. } else {
  21551. self._logErrorContext_($recv(anError)._context());
  21552. };
  21553. self._logError_(anError);
  21554. return self;
  21555. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  21556. },
  21557. args: ["anError"],
  21558. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  21559. referencedClasses: [],
  21560. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  21561. }),
  21562. $globals.ConsoleErrorHandler);
  21563. $core.addMethod(
  21564. $core.method({
  21565. selector: "log:",
  21566. protocol: 'private',
  21567. fn: function (aString){
  21568. var self=this;
  21569. return $core.withContext(function($ctx1) {
  21570. $recv(console)._log_(aString);
  21571. return self;
  21572. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  21573. },
  21574. args: ["aString"],
  21575. source: "log: aString\x0a\x09console log: aString",
  21576. referencedClasses: [],
  21577. messageSends: ["log:"]
  21578. }),
  21579. $globals.ConsoleErrorHandler);
  21580. $core.addMethod(
  21581. $core.method({
  21582. selector: "logContext:",
  21583. protocol: 'private',
  21584. fn: function (aContext){
  21585. var self=this;
  21586. return $core.withContext(function($ctx1) {
  21587. var $1,$receiver;
  21588. $1=$recv(aContext)._home();
  21589. $ctx1.sendIdx["home"]=1;
  21590. if(($receiver = $1) == null || $receiver.isNil){
  21591. $1;
  21592. } else {
  21593. self._logContext_($recv(aContext)._home());
  21594. };
  21595. self._log_($recv(aContext)._asString());
  21596. return self;
  21597. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  21598. },
  21599. args: ["aContext"],
  21600. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  21601. referencedClasses: [],
  21602. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  21603. }),
  21604. $globals.ConsoleErrorHandler);
  21605. $core.addMethod(
  21606. $core.method({
  21607. selector: "logError:",
  21608. protocol: 'private',
  21609. fn: function (anError){
  21610. var self=this;
  21611. return $core.withContext(function($ctx1) {
  21612. self._log_($recv(anError)._messageText());
  21613. return self;
  21614. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  21615. },
  21616. args: ["anError"],
  21617. source: "logError: anError\x0a\x09self log: anError messageText",
  21618. referencedClasses: [],
  21619. messageSends: ["log:", "messageText"]
  21620. }),
  21621. $globals.ConsoleErrorHandler);
  21622. $core.addMethod(
  21623. $core.method({
  21624. selector: "logErrorContext:",
  21625. protocol: 'private',
  21626. fn: function (aContext){
  21627. var self=this;
  21628. return $core.withContext(function($ctx1) {
  21629. var $1,$receiver;
  21630. if(($receiver = aContext) == null || $receiver.isNil){
  21631. aContext;
  21632. } else {
  21633. $1=$recv(aContext)._home();
  21634. $ctx1.sendIdx["home"]=1;
  21635. if(($receiver = $1) == null || $receiver.isNil){
  21636. $1;
  21637. } else {
  21638. self._logContext_($recv(aContext)._home());
  21639. };
  21640. };
  21641. return self;
  21642. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  21643. },
  21644. args: ["aContext"],
  21645. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  21646. referencedClasses: [],
  21647. messageSends: ["ifNotNil:", "home", "logContext:"]
  21648. }),
  21649. $globals.ConsoleErrorHandler);
  21650. $globals.ConsoleErrorHandler.klass.iVarNames = ['current'];
  21651. $core.addMethod(
  21652. $core.method({
  21653. selector: "initialize",
  21654. protocol: 'initialization',
  21655. fn: function (){
  21656. var self=this;
  21657. function $ErrorHandler(){return $globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  21658. return $core.withContext(function($ctx1) {
  21659. $recv($ErrorHandler())._registerIfNone_(self._new());
  21660. return self;
  21661. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.klass)});
  21662. },
  21663. args: [],
  21664. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  21665. referencedClasses: ["ErrorHandler"],
  21666. messageSends: ["registerIfNone:", "new"]
  21667. }),
  21668. $globals.ConsoleErrorHandler.klass);
  21669. $core.addClass('ConsoleTranscript', $globals.Object, ['textarea'], 'Platform-Services');
  21670. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  21671. $core.addMethod(
  21672. $core.method({
  21673. selector: "clear",
  21674. protocol: 'printing',
  21675. fn: function (){
  21676. var self=this;
  21677. return self;
  21678. },
  21679. args: [],
  21680. source: "clear\x0a\x09\x22no op\x22",
  21681. referencedClasses: [],
  21682. messageSends: []
  21683. }),
  21684. $globals.ConsoleTranscript);
  21685. $core.addMethod(
  21686. $core.method({
  21687. selector: "cr",
  21688. protocol: 'printing',
  21689. fn: function (){
  21690. var self=this;
  21691. return self;
  21692. },
  21693. args: [],
  21694. source: "cr\x0a\x09\x22no op\x22",
  21695. referencedClasses: [],
  21696. messageSends: []
  21697. }),
  21698. $globals.ConsoleTranscript);
  21699. $core.addMethod(
  21700. $core.method({
  21701. selector: "open",
  21702. protocol: 'actions',
  21703. fn: function (){
  21704. var self=this;
  21705. return self;
  21706. },
  21707. args: [],
  21708. source: "open",
  21709. referencedClasses: [],
  21710. messageSends: []
  21711. }),
  21712. $globals.ConsoleTranscript);
  21713. $core.addMethod(
  21714. $core.method({
  21715. selector: "show:",
  21716. protocol: 'printing',
  21717. fn: function (anObject){
  21718. var self=this;
  21719. return $core.withContext(function($ctx1) {
  21720. console.log(String($recv(anObject)._asString()));
  21721. return self;
  21722. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  21723. },
  21724. args: ["anObject"],
  21725. 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()))>",
  21726. referencedClasses: [],
  21727. messageSends: []
  21728. }),
  21729. $globals.ConsoleTranscript);
  21730. $core.addMethod(
  21731. $core.method({
  21732. selector: "initialize",
  21733. protocol: 'initialization',
  21734. fn: function (){
  21735. var self=this;
  21736. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  21737. return $core.withContext(function($ctx1) {
  21738. $recv($Transcript())._registerIfNone_(self._new());
  21739. return self;
  21740. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.klass)});
  21741. },
  21742. args: [],
  21743. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  21744. referencedClasses: ["Transcript"],
  21745. messageSends: ["registerIfNone:", "new"]
  21746. }),
  21747. $globals.ConsoleTranscript.klass);
  21748. $core.addClass('InterfacingObject', $globals.Object, [], 'Platform-Services');
  21749. $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 }.";
  21750. $core.addMethod(
  21751. $core.method({
  21752. selector: "ajax:",
  21753. protocol: 'actions',
  21754. fn: function (anObject){
  21755. var self=this;
  21756. function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  21757. return $core.withContext(function($ctx1) {
  21758. var $1;
  21759. self._deprecatedAPI();
  21760. $1=$recv($PlatformInterface())._ajax_(anObject);
  21761. return $1;
  21762. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.InterfacingObject)});
  21763. },
  21764. args: ["anObject"],
  21765. source: "ajax: anObject\x0a\x09self deprecatedAPI.\x0a\x09^ PlatformInterface ajax: anObject",
  21766. referencedClasses: ["PlatformInterface"],
  21767. messageSends: ["deprecatedAPI", "ajax:"]
  21768. }),
  21769. $globals.InterfacingObject);
  21770. $core.addMethod(
  21771. $core.method({
  21772. selector: "alert:",
  21773. protocol: 'actions',
  21774. fn: function (aString){
  21775. var self=this;
  21776. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21777. return $core.withContext(function($ctx1) {
  21778. var $1;
  21779. $1=$recv($Terminal())._alert_(aString);
  21780. return $1;
  21781. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.InterfacingObject)});
  21782. },
  21783. args: ["aString"],
  21784. source: "alert: aString\x0a\x09^ Terminal alert: aString",
  21785. referencedClasses: ["Terminal"],
  21786. messageSends: ["alert:"]
  21787. }),
  21788. $globals.InterfacingObject);
  21789. $core.addMethod(
  21790. $core.method({
  21791. selector: "confirm:",
  21792. protocol: 'actions',
  21793. fn: function (aString){
  21794. var self=this;
  21795. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21796. return $core.withContext(function($ctx1) {
  21797. var $1;
  21798. $1=$recv($Terminal())._confirm_(aString);
  21799. return $1;
  21800. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.InterfacingObject)});
  21801. },
  21802. args: ["aString"],
  21803. source: "confirm: aString\x0a\x09^ Terminal confirm: aString",
  21804. referencedClasses: ["Terminal"],
  21805. messageSends: ["confirm:"]
  21806. }),
  21807. $globals.InterfacingObject);
  21808. $core.addMethod(
  21809. $core.method({
  21810. selector: "prompt:",
  21811. protocol: 'actions',
  21812. fn: function (aString){
  21813. var self=this;
  21814. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21815. return $core.withContext(function($ctx1) {
  21816. var $1;
  21817. $1=$recv($Terminal())._prompt_(aString);
  21818. return $1;
  21819. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.InterfacingObject)});
  21820. },
  21821. args: ["aString"],
  21822. source: "prompt: aString\x0a\x09^ Terminal prompt: aString",
  21823. referencedClasses: ["Terminal"],
  21824. messageSends: ["prompt:"]
  21825. }),
  21826. $globals.InterfacingObject);
  21827. $core.addMethod(
  21828. $core.method({
  21829. selector: "prompt:default:",
  21830. protocol: 'actions',
  21831. fn: function (aString,defaultString){
  21832. var self=this;
  21833. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21834. return $core.withContext(function($ctx1) {
  21835. var $1;
  21836. $1=$recv($Terminal())._prompt_default_(aString,defaultString);
  21837. return $1;
  21838. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.InterfacingObject)});
  21839. },
  21840. args: ["aString", "defaultString"],
  21841. source: "prompt: aString default: defaultString\x0a\x09^ Terminal prompt: aString default: defaultString",
  21842. referencedClasses: ["Terminal"],
  21843. messageSends: ["prompt:default:"]
  21844. }),
  21845. $globals.InterfacingObject);
  21846. $core.addClass('Environment', $globals.InterfacingObject, [], 'Platform-Services');
  21847. $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.";
  21848. $core.addMethod(
  21849. $core.method({
  21850. selector: "addInstVarNamed:to:",
  21851. protocol: 'compiling',
  21852. fn: function (aString,aClass){
  21853. var self=this;
  21854. return $core.withContext(function($ctx1) {
  21855. var $1,$2,$3,$4,$5;
  21856. $1=self._classBuilder();
  21857. $2=$recv(aClass)._superclass();
  21858. $3=$recv(aClass)._name();
  21859. $ctx1.sendIdx["name"]=1;
  21860. $4=$recv($recv(aClass)._instanceVariableNames())._copy();
  21861. $recv($4)._add_(aString);
  21862. $5=$recv($4)._yourself();
  21863. $recv($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$5,$recv($recv(aClass)._package())._name());
  21864. return self;
  21865. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},$globals.Environment)});
  21866. },
  21867. args: ["aString", "aClass"],
  21868. 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",
  21869. referencedClasses: [],
  21870. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"]
  21871. }),
  21872. $globals.Environment);
  21873. $core.addMethod(
  21874. $core.method({
  21875. selector: "allSelectors",
  21876. protocol: 'accessing',
  21877. fn: function (){
  21878. var self=this;
  21879. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21880. return $core.withContext(function($ctx1) {
  21881. var $1;
  21882. $1=$recv($recv($Smalltalk())._core())._allSelectors();
  21883. return $1;
  21884. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  21885. },
  21886. args: [],
  21887. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  21888. referencedClasses: ["Smalltalk"],
  21889. messageSends: ["allSelectors", "core"]
  21890. }),
  21891. $globals.Environment);
  21892. $core.addMethod(
  21893. $core.method({
  21894. selector: "availableClassNames",
  21895. protocol: 'accessing',
  21896. fn: function (){
  21897. var self=this;
  21898. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21899. return $core.withContext(function($ctx1) {
  21900. var $1;
  21901. $1=$recv($recv($Smalltalk())._classes())._collect_((function(each){
  21902. return $core.withContext(function($ctx2) {
  21903. return $recv(each)._name();
  21904. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21905. }));
  21906. return $1;
  21907. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  21908. },
  21909. args: [],
  21910. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  21911. referencedClasses: ["Smalltalk"],
  21912. messageSends: ["collect:", "classes", "name"]
  21913. }),
  21914. $globals.Environment);
  21915. $core.addMethod(
  21916. $core.method({
  21917. selector: "availablePackageNames",
  21918. protocol: 'accessing',
  21919. fn: function (){
  21920. var self=this;
  21921. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21922. return $core.withContext(function($ctx1) {
  21923. var $1;
  21924. $1=$recv($recv($Smalltalk())._packages())._collect_((function(each){
  21925. return $core.withContext(function($ctx2) {
  21926. return $recv(each)._name();
  21927. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21928. }));
  21929. return $1;
  21930. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  21931. },
  21932. args: [],
  21933. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  21934. referencedClasses: ["Smalltalk"],
  21935. messageSends: ["collect:", "packages", "name"]
  21936. }),
  21937. $globals.Environment);
  21938. $core.addMethod(
  21939. $core.method({
  21940. selector: "availableProtocolsFor:",
  21941. protocol: 'accessing',
  21942. fn: function (aClass){
  21943. var self=this;
  21944. var protocols;
  21945. return $core.withContext(function($ctx1) {
  21946. var $1,$2,$receiver;
  21947. protocols=$recv(aClass)._protocols();
  21948. $1=$recv(aClass)._superclass();
  21949. $ctx1.sendIdx["superclass"]=1;
  21950. if(($receiver = $1) == null || $receiver.isNil){
  21951. $1;
  21952. } else {
  21953. $recv(protocols)._addAll_(self._availableProtocolsFor_($recv(aClass)._superclass()));
  21954. };
  21955. $2=$recv($recv($recv(protocols)._asSet())._asArray())._sort();
  21956. return $2;
  21957. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  21958. },
  21959. args: ["aClass"],
  21960. 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",
  21961. referencedClasses: [],
  21962. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  21963. }),
  21964. $globals.Environment);
  21965. $core.addMethod(
  21966. $core.method({
  21967. selector: "classBuilder",
  21968. protocol: 'accessing',
  21969. fn: function (){
  21970. var self=this;
  21971. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  21972. return $core.withContext(function($ctx1) {
  21973. var $1;
  21974. $1=$recv($ClassBuilder())._new();
  21975. return $1;
  21976. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  21977. },
  21978. args: [],
  21979. source: "classBuilder\x0a\x09^ ClassBuilder new",
  21980. referencedClasses: ["ClassBuilder"],
  21981. messageSends: ["new"]
  21982. }),
  21983. $globals.Environment);
  21984. $core.addMethod(
  21985. $core.method({
  21986. selector: "classNamed:",
  21987. protocol: 'accessing',
  21988. fn: function (aString){
  21989. var self=this;
  21990. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21991. return $core.withContext(function($ctx1) {
  21992. var $2,$1,$receiver;
  21993. $2=$recv($recv($Smalltalk())._globals())._at_($recv(aString)._asSymbol());
  21994. if(($receiver = $2) == null || $receiver.isNil){
  21995. $1=self._error_("Invalid class name");
  21996. } else {
  21997. $1=$2;
  21998. };
  21999. return $1;
  22000. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  22001. },
  22002. args: ["aString"],
  22003. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  22004. referencedClasses: ["Smalltalk"],
  22005. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  22006. }),
  22007. $globals.Environment);
  22008. $core.addMethod(
  22009. $core.method({
  22010. selector: "classes",
  22011. protocol: 'accessing',
  22012. fn: function (){
  22013. var self=this;
  22014. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22015. return $core.withContext(function($ctx1) {
  22016. var $1;
  22017. $1=$recv($Smalltalk())._classes();
  22018. return $1;
  22019. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  22020. },
  22021. args: [],
  22022. source: "classes\x0a\x09^ Smalltalk classes",
  22023. referencedClasses: ["Smalltalk"],
  22024. messageSends: ["classes"]
  22025. }),
  22026. $globals.Environment);
  22027. $core.addMethod(
  22028. $core.method({
  22029. selector: "commitPackage:onSuccess:onError:",
  22030. protocol: 'actions',
  22031. fn: function (aPackage,aBlock,anotherBlock){
  22032. var self=this;
  22033. return $core.withContext(function($ctx1) {
  22034. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  22035. return self;
  22036. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  22037. },
  22038. args: ["aPackage", "aBlock", "anotherBlock"],
  22039. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  22040. referencedClasses: [],
  22041. messageSends: ["commitOnSuccess:onError:", "transport"]
  22042. }),
  22043. $globals.Environment);
  22044. $core.addMethod(
  22045. $core.method({
  22046. selector: "compileClassComment:for:",
  22047. protocol: 'compiling',
  22048. fn: function (aString,aClass){
  22049. var self=this;
  22050. return $core.withContext(function($ctx1) {
  22051. $recv(aClass)._comment_(aString);
  22052. return self;
  22053. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  22054. },
  22055. args: ["aString", "aClass"],
  22056. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  22057. referencedClasses: [],
  22058. messageSends: ["comment:"]
  22059. }),
  22060. $globals.Environment);
  22061. $core.addMethod(
  22062. $core.method({
  22063. selector: "compileClassDefinition:",
  22064. protocol: 'compiling',
  22065. fn: function (aString){
  22066. var self=this;
  22067. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  22068. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  22069. return $core.withContext(function($ctx1) {
  22070. $recv((function(){
  22071. return $core.withContext(function($ctx2) {
  22072. return self._evaluate_for_(aString,$recv($DoIt())._new());
  22073. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22074. }))._on_do_($Error(),(function(error){
  22075. return $core.withContext(function($ctx2) {
  22076. return self._alert_($recv(error)._messageText());
  22077. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  22078. }));
  22079. return self;
  22080. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  22081. },
  22082. args: ["aString"],
  22083. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | self alert: error messageText ]",
  22084. referencedClasses: ["DoIt", "Error"],
  22085. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  22086. }),
  22087. $globals.Environment);
  22088. $core.addMethod(
  22089. $core.method({
  22090. selector: "compileMethod:for:protocol:",
  22091. protocol: 'compiling',
  22092. fn: function (sourceCode,class_,protocol){
  22093. var self=this;
  22094. return $core.withContext(function($ctx1) {
  22095. var $1;
  22096. $1=$recv(class_)._compile_protocol_(sourceCode,protocol);
  22097. return $1;
  22098. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  22099. },
  22100. args: ["sourceCode", "class", "protocol"],
  22101. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  22102. referencedClasses: [],
  22103. messageSends: ["compile:protocol:"]
  22104. }),
  22105. $globals.Environment);
  22106. $core.addMethod(
  22107. $core.method({
  22108. selector: "copyClass:to:",
  22109. protocol: 'actions',
  22110. fn: function (aClass,aClassName){
  22111. var self=this;
  22112. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22113. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  22114. return $core.withContext(function($ctx1) {
  22115. var $1,$2,$receiver;
  22116. $1=$recv($recv($Smalltalk())._globals())._at_(aClassName);
  22117. if(($receiver = $1) == null || $receiver.isNil){
  22118. $1;
  22119. } else {
  22120. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  22121. $ctx1.sendIdx[","]=1;
  22122. self._error_($2);
  22123. };
  22124. $recv($recv($ClassBuilder())._new())._copyClass_named_(aClass,aClassName);
  22125. return self;
  22126. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  22127. },
  22128. args: ["aClass", "aClassName"],
  22129. 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",
  22130. referencedClasses: ["Smalltalk", "ClassBuilder"],
  22131. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  22132. }),
  22133. $globals.Environment);
  22134. $core.addMethod(
  22135. $core.method({
  22136. selector: "doItReceiver",
  22137. protocol: 'accessing',
  22138. fn: function (){
  22139. var self=this;
  22140. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  22141. return $core.withContext(function($ctx1) {
  22142. var $1;
  22143. $1=$recv($DoIt())._new();
  22144. return $1;
  22145. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  22146. },
  22147. args: [],
  22148. source: "doItReceiver\x0a\x09^ DoIt new",
  22149. referencedClasses: ["DoIt"],
  22150. messageSends: ["new"]
  22151. }),
  22152. $globals.Environment);
  22153. $core.addMethod(
  22154. $core.method({
  22155. selector: "evaluate:for:",
  22156. protocol: 'evaluating',
  22157. fn: function (aString,anObject){
  22158. var self=this;
  22159. function $Evaluator(){return $globals.Evaluator||(typeof Evaluator=="undefined"?nil:Evaluator)}
  22160. return $core.withContext(function($ctx1) {
  22161. var $1;
  22162. $1=$recv($Evaluator())._evaluate_for_(aString,anObject);
  22163. return $1;
  22164. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  22165. },
  22166. args: ["aString", "anObject"],
  22167. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  22168. referencedClasses: ["Evaluator"],
  22169. messageSends: ["evaluate:for:"]
  22170. }),
  22171. $globals.Environment);
  22172. $core.addMethod(
  22173. $core.method({
  22174. selector: "evaluate:on:do:",
  22175. protocol: 'error handling',
  22176. fn: function (aBlock,anErrorClass,exceptionBlock){
  22177. var self=this;
  22178. return $core.withContext(function($ctx1) {
  22179. var $1;
  22180. $recv(aBlock)._tryCatch_((function(exception){
  22181. return $core.withContext(function($ctx2) {
  22182. $1=$recv(exception)._isKindOf_(self._classNamed_($recv(anErrorClass)._name()));
  22183. if($core.assert($1)){
  22184. return $recv(exceptionBlock)._value_(exception);
  22185. } else {
  22186. return $recv(exception)._resignal();
  22187. };
  22188. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  22189. }));
  22190. return self;
  22191. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  22192. },
  22193. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  22194. 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 ] ]",
  22195. referencedClasses: [],
  22196. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "resignal"]
  22197. }),
  22198. $globals.Environment);
  22199. $core.addMethod(
  22200. $core.method({
  22201. selector: "inspect:",
  22202. protocol: 'actions',
  22203. fn: function (anObject){
  22204. var self=this;
  22205. function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  22206. return $core.withContext(function($ctx1) {
  22207. $recv($Inspector())._inspect_(anObject);
  22208. return self;
  22209. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  22210. },
  22211. args: ["anObject"],
  22212. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  22213. referencedClasses: ["Inspector"],
  22214. messageSends: ["inspect:"]
  22215. }),
  22216. $globals.Environment);
  22217. $core.addMethod(
  22218. $core.method({
  22219. selector: "moveClass:toPackage:",
  22220. protocol: 'actions',
  22221. fn: function (aClass,aPackageName){
  22222. var self=this;
  22223. var package_;
  22224. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  22225. return $core.withContext(function($ctx1) {
  22226. var $1,$2,$receiver;
  22227. package_=$recv($Package())._named_(aPackageName);
  22228. $1=package_;
  22229. if(($receiver = $1) == null || $receiver.isNil){
  22230. self._error_("Invalid package name");
  22231. } else {
  22232. $1;
  22233. };
  22234. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  22235. if($core.assert($2)){
  22236. return self;
  22237. };
  22238. $recv(aClass)._package_(package_);
  22239. return self;
  22240. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  22241. },
  22242. args: ["aClass", "aPackageName"],
  22243. 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",
  22244. referencedClasses: ["Package"],
  22245. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"]
  22246. }),
  22247. $globals.Environment);
  22248. $core.addMethod(
  22249. $core.method({
  22250. selector: "moveMethod:toClass:",
  22251. protocol: 'actions',
  22252. fn: function (aMethod,aClassName){
  22253. var self=this;
  22254. var destinationClass;
  22255. return $core.withContext(function($ctx1) {
  22256. var $2,$3,$1,$5,$4;
  22257. destinationClass=self._classNamed_(aClassName);
  22258. $2=destinationClass;
  22259. $3=$recv(aMethod)._methodClass();
  22260. $ctx1.sendIdx["methodClass"]=1;
  22261. $1=$recv($2).__eq_eq($3);
  22262. if($core.assert($1)){
  22263. return self;
  22264. };
  22265. $5=$recv(aMethod)._methodClass();
  22266. $ctx1.sendIdx["methodClass"]=2;
  22267. $4=$recv($5)._isMetaclass();
  22268. if($core.assert($4)){
  22269. destinationClass=$recv(destinationClass)._class();
  22270. destinationClass;
  22271. };
  22272. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  22273. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  22274. return self;
  22275. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  22276. },
  22277. args: ["aMethod", "aClassName"],
  22278. 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",
  22279. referencedClasses: [],
  22280. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "class", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  22281. }),
  22282. $globals.Environment);
  22283. $core.addMethod(
  22284. $core.method({
  22285. selector: "moveMethod:toProtocol:",
  22286. protocol: 'actions',
  22287. fn: function (aMethod,aProtocol){
  22288. var self=this;
  22289. return $core.withContext(function($ctx1) {
  22290. $recv(aMethod)._protocol_(aProtocol);
  22291. return self;
  22292. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  22293. },
  22294. args: ["aMethod", "aProtocol"],
  22295. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol",
  22296. referencedClasses: [],
  22297. messageSends: ["protocol:"]
  22298. }),
  22299. $globals.Environment);
  22300. $core.addMethod(
  22301. $core.method({
  22302. selector: "packages",
  22303. protocol: 'accessing',
  22304. fn: function (){
  22305. var self=this;
  22306. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22307. return $core.withContext(function($ctx1) {
  22308. var $1;
  22309. $1=$recv($Smalltalk())._packages();
  22310. return $1;
  22311. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  22312. },
  22313. args: [],
  22314. source: "packages\x0a\x09^ Smalltalk packages",
  22315. referencedClasses: ["Smalltalk"],
  22316. messageSends: ["packages"]
  22317. }),
  22318. $globals.Environment);
  22319. $core.addMethod(
  22320. $core.method({
  22321. selector: "registerErrorHandler:",
  22322. protocol: 'services',
  22323. fn: function (anErrorHandler){
  22324. var self=this;
  22325. function $ErrorHandler(){return $globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  22326. return $core.withContext(function($ctx1) {
  22327. $recv($ErrorHandler())._register_(anErrorHandler);
  22328. return self;
  22329. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  22330. },
  22331. args: ["anErrorHandler"],
  22332. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  22333. referencedClasses: ["ErrorHandler"],
  22334. messageSends: ["register:"]
  22335. }),
  22336. $globals.Environment);
  22337. $core.addMethod(
  22338. $core.method({
  22339. selector: "registerFinder:",
  22340. protocol: 'services',
  22341. fn: function (aFinder){
  22342. var self=this;
  22343. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  22344. return $core.withContext(function($ctx1) {
  22345. $recv($Finder())._register_(aFinder);
  22346. return self;
  22347. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  22348. },
  22349. args: ["aFinder"],
  22350. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  22351. referencedClasses: ["Finder"],
  22352. messageSends: ["register:"]
  22353. }),
  22354. $globals.Environment);
  22355. $core.addMethod(
  22356. $core.method({
  22357. selector: "registerInspector:",
  22358. protocol: 'services',
  22359. fn: function (anInspector){
  22360. var self=this;
  22361. function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  22362. return $core.withContext(function($ctx1) {
  22363. $recv($Inspector())._register_(anInspector);
  22364. return self;
  22365. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  22366. },
  22367. args: ["anInspector"],
  22368. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  22369. referencedClasses: ["Inspector"],
  22370. messageSends: ["register:"]
  22371. }),
  22372. $globals.Environment);
  22373. $core.addMethod(
  22374. $core.method({
  22375. selector: "registerProgressHandler:",
  22376. protocol: 'services',
  22377. fn: function (aProgressHandler){
  22378. var self=this;
  22379. function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  22380. return $core.withContext(function($ctx1) {
  22381. $recv($ProgressHandler())._register_(aProgressHandler);
  22382. return self;
  22383. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  22384. },
  22385. args: ["aProgressHandler"],
  22386. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  22387. referencedClasses: ["ProgressHandler"],
  22388. messageSends: ["register:"]
  22389. }),
  22390. $globals.Environment);
  22391. $core.addMethod(
  22392. $core.method({
  22393. selector: "registerTranscript:",
  22394. protocol: 'services',
  22395. fn: function (aTranscript){
  22396. var self=this;
  22397. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  22398. return $core.withContext(function($ctx1) {
  22399. $recv($Transcript())._register_(aTranscript);
  22400. return self;
  22401. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  22402. },
  22403. args: ["aTranscript"],
  22404. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  22405. referencedClasses: ["Transcript"],
  22406. messageSends: ["register:"]
  22407. }),
  22408. $globals.Environment);
  22409. $core.addMethod(
  22410. $core.method({
  22411. selector: "removeClass:",
  22412. protocol: 'actions',
  22413. fn: function (aClass){
  22414. var self=this;
  22415. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22416. return $core.withContext(function($ctx1) {
  22417. $recv($Smalltalk())._removeClass_(aClass);
  22418. return self;
  22419. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  22420. },
  22421. args: ["aClass"],
  22422. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  22423. referencedClasses: ["Smalltalk"],
  22424. messageSends: ["removeClass:"]
  22425. }),
  22426. $globals.Environment);
  22427. $core.addMethod(
  22428. $core.method({
  22429. selector: "removeMethod:",
  22430. protocol: 'actions',
  22431. fn: function (aMethod){
  22432. var self=this;
  22433. return $core.withContext(function($ctx1) {
  22434. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  22435. return self;
  22436. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  22437. },
  22438. args: ["aMethod"],
  22439. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  22440. referencedClasses: [],
  22441. messageSends: ["removeCompiledMethod:", "methodClass"]
  22442. }),
  22443. $globals.Environment);
  22444. $core.addMethod(
  22445. $core.method({
  22446. selector: "removeProtocol:from:",
  22447. protocol: 'actions',
  22448. fn: function (aString,aClass){
  22449. var self=this;
  22450. return $core.withContext(function($ctx1) {
  22451. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  22452. return $core.withContext(function($ctx2) {
  22453. return $recv(aClass)._removeCompiledMethod_(each);
  22454. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22455. }));
  22456. return self;
  22457. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  22458. },
  22459. args: ["aString", "aClass"],
  22460. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  22461. referencedClasses: [],
  22462. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  22463. }),
  22464. $globals.Environment);
  22465. $core.addMethod(
  22466. $core.method({
  22467. selector: "renameClass:to:",
  22468. protocol: 'actions',
  22469. fn: function (aClass,aClassName){
  22470. var self=this;
  22471. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22472. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  22473. return $core.withContext(function($ctx1) {
  22474. var $1,$2,$receiver;
  22475. $1=$recv($recv($Smalltalk())._globals())._at_(aClassName);
  22476. if(($receiver = $1) == null || $receiver.isNil){
  22477. $1;
  22478. } else {
  22479. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  22480. $ctx1.sendIdx[","]=1;
  22481. self._error_($2);
  22482. };
  22483. $recv($recv($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
  22484. return self;
  22485. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  22486. },
  22487. args: ["aClass", "aClassName"],
  22488. 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",
  22489. referencedClasses: ["Smalltalk", "ClassBuilder"],
  22490. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  22491. }),
  22492. $globals.Environment);
  22493. $core.addMethod(
  22494. $core.method({
  22495. selector: "renamePackage:to:",
  22496. protocol: 'actions',
  22497. fn: function (aPackageName,aNewPackageName){
  22498. var self=this;
  22499. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22500. return $core.withContext(function($ctx1) {
  22501. var $1,$2,$receiver;
  22502. $1=$recv($recv($Smalltalk())._globals())._at_(aNewPackageName);
  22503. if(($receiver = $1) == null || $receiver.isNil){
  22504. $1;
  22505. } else {
  22506. $2=$recv("A package named ".__comma(aNewPackageName)).__comma(" already exists");
  22507. $ctx1.sendIdx[","]=1;
  22508. self._error_($2);
  22509. };
  22510. $recv($Smalltalk())._renamePackage_to_(aPackageName,aNewPackageName);
  22511. return self;
  22512. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  22513. },
  22514. args: ["aPackageName", "aNewPackageName"],
  22515. 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",
  22516. referencedClasses: ["Smalltalk"],
  22517. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renamePackage:to:"]
  22518. }),
  22519. $globals.Environment);
  22520. $core.addMethod(
  22521. $core.method({
  22522. selector: "renameProtocol:to:in:",
  22523. protocol: 'actions',
  22524. fn: function (aString,anotherString,aClass){
  22525. var self=this;
  22526. return $core.withContext(function($ctx1) {
  22527. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  22528. return $core.withContext(function($ctx2) {
  22529. return $recv(each)._protocol_(anotherString);
  22530. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22531. }));
  22532. return self;
  22533. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  22534. },
  22535. args: ["aString", "anotherString", "aClass"],
  22536. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  22537. referencedClasses: [],
  22538. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  22539. }),
  22540. $globals.Environment);
  22541. $core.addMethod(
  22542. $core.method({
  22543. selector: "setClassCommentOf:to:",
  22544. protocol: 'actions',
  22545. fn: function (aClass,aString){
  22546. var self=this;
  22547. return $core.withContext(function($ctx1) {
  22548. $recv(aClass)._comment_(aString);
  22549. return self;
  22550. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  22551. },
  22552. args: ["aClass", "aString"],
  22553. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  22554. referencedClasses: [],
  22555. messageSends: ["comment:"]
  22556. }),
  22557. $globals.Environment);
  22558. $core.addMethod(
  22559. $core.method({
  22560. selector: "systemAnnouncer",
  22561. protocol: 'accessing',
  22562. fn: function (){
  22563. var self=this;
  22564. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22565. return $core.withContext(function($ctx1) {
  22566. var $1;
  22567. $1=$recv($recv($recv($Smalltalk())._globals())._at_("SystemAnnouncer"))._current();
  22568. return $1;
  22569. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  22570. },
  22571. args: [],
  22572. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  22573. referencedClasses: ["Smalltalk"],
  22574. messageSends: ["current", "at:", "globals"]
  22575. }),
  22576. $globals.Environment);
  22577. $core.addClass('NullProgressHandler', $globals.Object, [], 'Platform-Services');
  22578. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  22579. $core.addMethod(
  22580. $core.method({
  22581. selector: "do:on:displaying:",
  22582. protocol: 'progress handling',
  22583. fn: function (aBlock,aCollection,aString){
  22584. var self=this;
  22585. return $core.withContext(function($ctx1) {
  22586. $recv(aCollection)._do_(aBlock);
  22587. return self;
  22588. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  22589. },
  22590. args: ["aBlock", "aCollection", "aString"],
  22591. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  22592. referencedClasses: [],
  22593. messageSends: ["do:"]
  22594. }),
  22595. $globals.NullProgressHandler);
  22596. $globals.NullProgressHandler.klass.iVarNames = ['current'];
  22597. $core.addMethod(
  22598. $core.method({
  22599. selector: "initialize",
  22600. protocol: 'initialization',
  22601. fn: function (){
  22602. var self=this;
  22603. function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  22604. return $core.withContext(function($ctx1) {
  22605. $recv($ProgressHandler())._registerIfNone_(self._new());
  22606. return self;
  22607. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.klass)});
  22608. },
  22609. args: [],
  22610. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  22611. referencedClasses: ["ProgressHandler"],
  22612. messageSends: ["registerIfNone:", "new"]
  22613. }),
  22614. $globals.NullProgressHandler.klass);
  22615. $core.addClass('PlatformInterface', $globals.Object, [], 'Platform-Services');
  22616. $globals.PlatformInterface.comment="Deprecated. Use `Platform` or `Terminal`.";
  22617. $core.addMethod(
  22618. $core.method({
  22619. selector: "ajax:",
  22620. protocol: 'actions',
  22621. fn: function (anObject){
  22622. var self=this;
  22623. function $JQuery(){return $globals.JQuery||(typeof JQuery=="undefined"?nil:JQuery)}
  22624. return $core.withContext(function($ctx1) {
  22625. var $1,$receiver;
  22626. self._deprecatedAPI_("Use Platform newXhr or dedicated library.");
  22627. if(($receiver = $JQuery()) == null || $receiver.isNil){
  22628. $1=self._error_("JQuery wrapper not loaded, cannot do AJAX.");
  22629. } else {
  22630. $1=$recv($recv($JQuery())._current())._ajax_(anObject);
  22631. };
  22632. return $1;
  22633. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.PlatformInterface.klass)});
  22634. },
  22635. args: ["anObject"],
  22636. 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.' ]",
  22637. referencedClasses: ["JQuery"],
  22638. messageSends: ["deprecatedAPI:", "ifNotNil:ifNil:", "ajax:", "current", "error:"]
  22639. }),
  22640. $globals.PlatformInterface.klass);
  22641. $core.addMethod(
  22642. $core.method({
  22643. selector: "alert:",
  22644. protocol: 'actions',
  22645. fn: function (aString){
  22646. var self=this;
  22647. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  22648. return $core.withContext(function($ctx1) {
  22649. var $1;
  22650. self._deprecatedAPI_("Use Terminal alert:");
  22651. $1=$recv($Terminal())._alert_(aString);
  22652. return $1;
  22653. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.PlatformInterface.klass)});
  22654. },
  22655. args: ["aString"],
  22656. source: "alert: aString\x0a\x09self deprecatedAPI: 'Use Terminal alert:'.\x0a\x09^ Terminal alert: aString",
  22657. referencedClasses: ["Terminal"],
  22658. messageSends: ["deprecatedAPI:", "alert:"]
  22659. }),
  22660. $globals.PlatformInterface.klass);
  22661. $core.addMethod(
  22662. $core.method({
  22663. selector: "confirm:",
  22664. protocol: 'actions',
  22665. fn: function (aString){
  22666. var self=this;
  22667. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  22668. return $core.withContext(function($ctx1) {
  22669. var $1;
  22670. self._deprecatedAPI_("Use Terminal confirm:");
  22671. $1=$recv($Terminal())._confirm_(aString);
  22672. return $1;
  22673. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.PlatformInterface.klass)});
  22674. },
  22675. args: ["aString"],
  22676. source: "confirm: aString\x0a\x09self deprecatedAPI: 'Use Terminal confirm:'.\x0a\x09^ Terminal confirm: aString",
  22677. referencedClasses: ["Terminal"],
  22678. messageSends: ["deprecatedAPI:", "confirm:"]
  22679. }),
  22680. $globals.PlatformInterface.klass);
  22681. $core.addMethod(
  22682. $core.method({
  22683. selector: "existsGlobal:",
  22684. protocol: 'actions',
  22685. fn: function (aString){
  22686. var self=this;
  22687. function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  22688. return $core.withContext(function($ctx1) {
  22689. var $1;
  22690. self._deprecatedAPI_("Use Smalltalk existsJsGlobal:");
  22691. $1=$recv($recv($PlatformInterface())._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  22692. return true;
  22693. }),(function(){
  22694. return false;
  22695. }));
  22696. return $1;
  22697. }, function($ctx1) {$ctx1.fill(self,"existsGlobal:",{aString:aString},$globals.PlatformInterface.klass)});
  22698. },
  22699. args: ["aString"],
  22700. 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 ]",
  22701. referencedClasses: ["PlatformInterface"],
  22702. messageSends: ["deprecatedAPI:", "at:ifPresent:ifAbsent:", "globals"]
  22703. }),
  22704. $globals.PlatformInterface.klass);
  22705. $core.addMethod(
  22706. $core.method({
  22707. selector: "globals",
  22708. protocol: 'accessing',
  22709. fn: function (){
  22710. var self=this;
  22711. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  22712. return $core.withContext(function($ctx1) {
  22713. var $1;
  22714. self._deprecatedAPI_("Use Platform globals");
  22715. $1=$recv($Platform())._globals();
  22716. return $1;
  22717. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.PlatformInterface.klass)});
  22718. },
  22719. args: [],
  22720. source: "globals\x0a\x09self deprecatedAPI: 'Use Platform globals'.\x0a\x09^ Platform globals",
  22721. referencedClasses: ["Platform"],
  22722. messageSends: ["deprecatedAPI:", "globals"]
  22723. }),
  22724. $globals.PlatformInterface.klass);
  22725. $core.addMethod(
  22726. $core.method({
  22727. selector: "newXhr",
  22728. protocol: 'actions',
  22729. fn: function (){
  22730. var self=this;
  22731. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  22732. return $core.withContext(function($ctx1) {
  22733. var $1;
  22734. self._deprecatedAPI_("Use Platform newXhr");
  22735. $1=$recv($Platform())._newXhr();
  22736. return $1;
  22737. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.PlatformInterface.klass)});
  22738. },
  22739. args: [],
  22740. source: "newXhr\x0a\x09self deprecatedAPI: 'Use Platform newXhr'.\x0a\x09^ Platform newXhr",
  22741. referencedClasses: ["Platform"],
  22742. messageSends: ["deprecatedAPI:", "newXhr"]
  22743. }),
  22744. $globals.PlatformInterface.klass);
  22745. $core.addMethod(
  22746. $core.method({
  22747. selector: "prompt:",
  22748. protocol: 'actions',
  22749. fn: function (aString){
  22750. var self=this;
  22751. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  22752. return $core.withContext(function($ctx1) {
  22753. var $1;
  22754. self._deprecatedAPI_("Use Terminal prompt:");
  22755. $1=$recv($Terminal())._prompt_(aString);
  22756. return $1;
  22757. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.PlatformInterface.klass)});
  22758. },
  22759. args: ["aString"],
  22760. source: "prompt: aString\x0a\x09self deprecatedAPI: 'Use Terminal prompt:'.\x0a\x09^ Terminal prompt: aString",
  22761. referencedClasses: ["Terminal"],
  22762. messageSends: ["deprecatedAPI:", "prompt:"]
  22763. }),
  22764. $globals.PlatformInterface.klass);
  22765. $core.addMethod(
  22766. $core.method({
  22767. selector: "prompt:default:",
  22768. protocol: 'actions',
  22769. fn: function (aString,defaultString){
  22770. var self=this;
  22771. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  22772. return $core.withContext(function($ctx1) {
  22773. var $1;
  22774. self._deprecatedAPI_("Use Terminal prompt:default:");
  22775. $1=$recv($Terminal())._prompt_default_(aString,defaultString);
  22776. return $1;
  22777. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.PlatformInterface.klass)});
  22778. },
  22779. args: ["aString", "defaultString"],
  22780. source: "prompt: aString default: defaultString\x0a\x09self deprecatedAPI: 'Use Terminal prompt:default:'.\x0a\x09^ Terminal prompt: aString default: defaultString",
  22781. referencedClasses: ["Terminal"],
  22782. messageSends: ["deprecatedAPI:", "prompt:default:"]
  22783. }),
  22784. $globals.PlatformInterface.klass);
  22785. $core.addClass('Service', $globals.Object, [], 'Platform-Services');
  22786. $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.";
  22787. $globals.Service.klass.iVarNames = ['current'];
  22788. $core.addMethod(
  22789. $core.method({
  22790. selector: "current",
  22791. protocol: 'accessing',
  22792. fn: function (){
  22793. var self=this;
  22794. var $1;
  22795. $1=self["@current"];
  22796. return $1;
  22797. },
  22798. args: [],
  22799. source: "current\x0a\x09^ current",
  22800. referencedClasses: [],
  22801. messageSends: []
  22802. }),
  22803. $globals.Service.klass);
  22804. $core.addMethod(
  22805. $core.method({
  22806. selector: "new",
  22807. protocol: 'instance creation',
  22808. fn: function (){
  22809. var self=this;
  22810. return $core.withContext(function($ctx1) {
  22811. self._shouldNotImplement();
  22812. return self;
  22813. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.klass)});
  22814. },
  22815. args: [],
  22816. source: "new\x0a\x09self shouldNotImplement",
  22817. referencedClasses: [],
  22818. messageSends: ["shouldNotImplement"]
  22819. }),
  22820. $globals.Service.klass);
  22821. $core.addMethod(
  22822. $core.method({
  22823. selector: "register:",
  22824. protocol: 'registration',
  22825. fn: function (anObject){
  22826. var self=this;
  22827. self["@current"]=anObject;
  22828. return self;
  22829. },
  22830. args: ["anObject"],
  22831. source: "register: anObject\x0a\x09current := anObject",
  22832. referencedClasses: [],
  22833. messageSends: []
  22834. }),
  22835. $globals.Service.klass);
  22836. $core.addMethod(
  22837. $core.method({
  22838. selector: "registerIfNone:",
  22839. protocol: 'registration',
  22840. fn: function (anObject){
  22841. var self=this;
  22842. return $core.withContext(function($ctx1) {
  22843. var $1,$receiver;
  22844. $1=self._current();
  22845. if(($receiver = $1) == null || $receiver.isNil){
  22846. self._register_(anObject);
  22847. } else {
  22848. $1;
  22849. };
  22850. return self;
  22851. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.klass)});
  22852. },
  22853. args: ["anObject"],
  22854. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  22855. referencedClasses: [],
  22856. messageSends: ["ifNil:", "current", "register:"]
  22857. }),
  22858. $globals.Service.klass);
  22859. $core.addClass('ErrorHandler', $globals.Service, [], 'Platform-Services');
  22860. $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.";
  22861. $core.addMethod(
  22862. $core.method({
  22863. selector: "handleError:",
  22864. protocol: 'error handling',
  22865. fn: function (anError){
  22866. var self=this;
  22867. return $core.withContext(function($ctx1) {
  22868. self._handleUnhandledError_(anError);
  22869. return self;
  22870. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.klass)});
  22871. },
  22872. args: ["anError"],
  22873. source: "handleError: anError\x0a\x09self handleUnhandledError: anError",
  22874. referencedClasses: [],
  22875. messageSends: ["handleUnhandledError:"]
  22876. }),
  22877. $globals.ErrorHandler.klass);
  22878. $core.addMethod(
  22879. $core.method({
  22880. selector: "handleUnhandledError:",
  22881. protocol: 'error handling',
  22882. fn: function (anError){
  22883. var self=this;
  22884. return $core.withContext(function($ctx1) {
  22885. var $1,$2;
  22886. $1=$recv(anError)._wasHandled();
  22887. if($core.assert($1)){
  22888. return self;
  22889. };
  22890. $2=$recv(self._current())._handleError_(anError);
  22891. return $2;
  22892. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.klass)});
  22893. },
  22894. args: ["anError"],
  22895. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifTrue: [ ^ self ].\x0a\x09\x0a\x09^ self current handleError: anError",
  22896. referencedClasses: [],
  22897. messageSends: ["ifTrue:", "wasHandled", "handleError:", "current"]
  22898. }),
  22899. $globals.ErrorHandler.klass);
  22900. $core.addClass('Finder', $globals.Service, [], 'Platform-Services');
  22901. $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.";
  22902. $core.addMethod(
  22903. $core.method({
  22904. selector: "findClass:",
  22905. protocol: 'finding',
  22906. fn: function (aClass){
  22907. var self=this;
  22908. return $core.withContext(function($ctx1) {
  22909. var $1;
  22910. $1=$recv(self._current())._findClass_(aClass);
  22911. return $1;
  22912. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.klass)});
  22913. },
  22914. args: ["aClass"],
  22915. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  22916. referencedClasses: [],
  22917. messageSends: ["findClass:", "current"]
  22918. }),
  22919. $globals.Finder.klass);
  22920. $core.addMethod(
  22921. $core.method({
  22922. selector: "findMethod:",
  22923. protocol: 'finding',
  22924. fn: function (aCompiledMethod){
  22925. var self=this;
  22926. return $core.withContext(function($ctx1) {
  22927. var $1;
  22928. $1=$recv(self._current())._findMethod_(aCompiledMethod);
  22929. return $1;
  22930. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.klass)});
  22931. },
  22932. args: ["aCompiledMethod"],
  22933. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  22934. referencedClasses: [],
  22935. messageSends: ["findMethod:", "current"]
  22936. }),
  22937. $globals.Finder.klass);
  22938. $core.addMethod(
  22939. $core.method({
  22940. selector: "findString:",
  22941. protocol: 'finding',
  22942. fn: function (aString){
  22943. var self=this;
  22944. return $core.withContext(function($ctx1) {
  22945. var $1;
  22946. $1=$recv(self._current())._findString_(aString);
  22947. return $1;
  22948. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.klass)});
  22949. },
  22950. args: ["aString"],
  22951. source: "findString: aString\x0a\x09^ self current findString: aString",
  22952. referencedClasses: [],
  22953. messageSends: ["findString:", "current"]
  22954. }),
  22955. $globals.Finder.klass);
  22956. $core.addClass('Inspector', $globals.Service, [], 'Platform-Services');
  22957. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  22958. $core.addMethod(
  22959. $core.method({
  22960. selector: "inspect:",
  22961. protocol: 'inspecting',
  22962. fn: function (anObject){
  22963. var self=this;
  22964. return $core.withContext(function($ctx1) {
  22965. var $1;
  22966. $1=$recv(self._current())._inspect_(anObject);
  22967. return $1;
  22968. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.klass)});
  22969. },
  22970. args: ["anObject"],
  22971. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  22972. referencedClasses: [],
  22973. messageSends: ["inspect:", "current"]
  22974. }),
  22975. $globals.Inspector.klass);
  22976. $core.addClass('Platform', $globals.Service, [], 'Platform-Services');
  22977. $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";
  22978. $core.addMethod(
  22979. $core.method({
  22980. selector: "globals",
  22981. protocol: 'accessing',
  22982. fn: function (){
  22983. var self=this;
  22984. return $core.withContext(function($ctx1) {
  22985. var $1;
  22986. $1=$recv(self._current())._globals();
  22987. return $1;
  22988. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.klass)});
  22989. },
  22990. args: [],
  22991. source: "globals\x0a\x09^ self current globals",
  22992. referencedClasses: [],
  22993. messageSends: ["globals", "current"]
  22994. }),
  22995. $globals.Platform.klass);
  22996. $core.addMethod(
  22997. $core.method({
  22998. selector: "newXhr",
  22999. protocol: 'accessing',
  23000. fn: function (){
  23001. var self=this;
  23002. return $core.withContext(function($ctx1) {
  23003. var $1;
  23004. $1=$recv(self._current())._newXhr();
  23005. return $1;
  23006. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.klass)});
  23007. },
  23008. args: [],
  23009. source: "newXhr\x0a\x09^ self current newXhr",
  23010. referencedClasses: [],
  23011. messageSends: ["newXhr", "current"]
  23012. }),
  23013. $globals.Platform.klass);
  23014. $core.addClass('ProgressHandler', $globals.Service, [], 'Platform-Services');
  23015. $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`.";
  23016. $core.addMethod(
  23017. $core.method({
  23018. selector: "do:on:displaying:",
  23019. protocol: 'progress handling',
  23020. fn: function (aBlock,aCollection,aString){
  23021. var self=this;
  23022. return $core.withContext(function($ctx1) {
  23023. $recv(self._current())._do_on_displaying_(aBlock,aCollection,aString);
  23024. return self;
  23025. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.klass)});
  23026. },
  23027. args: ["aBlock", "aCollection", "aString"],
  23028. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  23029. referencedClasses: [],
  23030. messageSends: ["do:on:displaying:", "current"]
  23031. }),
  23032. $globals.ProgressHandler.klass);
  23033. $core.addClass('Terminal', $globals.Service, [], 'Platform-Services');
  23034. $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:'.";
  23035. $core.addMethod(
  23036. $core.method({
  23037. selector: "alert:",
  23038. protocol: 'dialogs',
  23039. fn: function (aString){
  23040. var self=this;
  23041. return $core.withContext(function($ctx1) {
  23042. var $1;
  23043. $1=$recv(self._current())._alert_(aString);
  23044. return $1;
  23045. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.klass)});
  23046. },
  23047. args: ["aString"],
  23048. source: "alert: aString\x0a\x09^ self current alert: aString",
  23049. referencedClasses: [],
  23050. messageSends: ["alert:", "current"]
  23051. }),
  23052. $globals.Terminal.klass);
  23053. $core.addMethod(
  23054. $core.method({
  23055. selector: "confirm:",
  23056. protocol: 'dialogs',
  23057. fn: function (aString){
  23058. var self=this;
  23059. return $core.withContext(function($ctx1) {
  23060. var $1;
  23061. $1=$recv(self._current())._confirm_(aString);
  23062. return $1;
  23063. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.klass)});
  23064. },
  23065. args: ["aString"],
  23066. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  23067. referencedClasses: [],
  23068. messageSends: ["confirm:", "current"]
  23069. }),
  23070. $globals.Terminal.klass);
  23071. $core.addMethod(
  23072. $core.method({
  23073. selector: "prompt:",
  23074. protocol: 'dialogs',
  23075. fn: function (aString){
  23076. var self=this;
  23077. return $core.withContext(function($ctx1) {
  23078. var $1;
  23079. $1=$recv(self._current())._prompt_(aString);
  23080. return $1;
  23081. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.klass)});
  23082. },
  23083. args: ["aString"],
  23084. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  23085. referencedClasses: [],
  23086. messageSends: ["prompt:", "current"]
  23087. }),
  23088. $globals.Terminal.klass);
  23089. $core.addMethod(
  23090. $core.method({
  23091. selector: "prompt:default:",
  23092. protocol: 'dialogs',
  23093. fn: function (aString,defaultString){
  23094. var self=this;
  23095. return $core.withContext(function($ctx1) {
  23096. var $1;
  23097. $1=$recv(self._current())._prompt_default_(aString,defaultString);
  23098. return $1;
  23099. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.klass)});
  23100. },
  23101. args: ["aString", "defaultString"],
  23102. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  23103. referencedClasses: [],
  23104. messageSends: ["prompt:default:", "current"]
  23105. }),
  23106. $globals.Terminal.klass);
  23107. $core.addClass('Transcript', $globals.Service, [], 'Platform-Services');
  23108. $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.";
  23109. $core.addMethod(
  23110. $core.method({
  23111. selector: "clear",
  23112. protocol: 'printing',
  23113. fn: function (){
  23114. var self=this;
  23115. return $core.withContext(function($ctx1) {
  23116. $recv(self._current())._clear();
  23117. return self;
  23118. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.klass)});
  23119. },
  23120. args: [],
  23121. source: "clear\x0a\x09self current clear",
  23122. referencedClasses: [],
  23123. messageSends: ["clear", "current"]
  23124. }),
  23125. $globals.Transcript.klass);
  23126. $core.addMethod(
  23127. $core.method({
  23128. selector: "cr",
  23129. protocol: 'printing',
  23130. fn: function (){
  23131. var self=this;
  23132. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  23133. return $core.withContext(function($ctx1) {
  23134. $recv(self._current())._show_($recv($String())._cr());
  23135. return self;
  23136. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.klass)});
  23137. },
  23138. args: [],
  23139. source: "cr\x0a\x09self current show: String cr",
  23140. referencedClasses: ["String"],
  23141. messageSends: ["show:", "current", "cr"]
  23142. }),
  23143. $globals.Transcript.klass);
  23144. $core.addMethod(
  23145. $core.method({
  23146. selector: "inspect:",
  23147. protocol: 'printing',
  23148. fn: function (anObject){
  23149. var self=this;
  23150. return $core.withContext(function($ctx1) {
  23151. self._show_(anObject);
  23152. return self;
  23153. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.klass)});
  23154. },
  23155. args: ["anObject"],
  23156. source: "inspect: anObject\x0a\x09self show: anObject",
  23157. referencedClasses: [],
  23158. messageSends: ["show:"]
  23159. }),
  23160. $globals.Transcript.klass);
  23161. $core.addMethod(
  23162. $core.method({
  23163. selector: "open",
  23164. protocol: 'instance creation',
  23165. fn: function (){
  23166. var self=this;
  23167. return $core.withContext(function($ctx1) {
  23168. $recv(self._current())._open();
  23169. return self;
  23170. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.klass)});
  23171. },
  23172. args: [],
  23173. source: "open\x0a\x09self current open",
  23174. referencedClasses: [],
  23175. messageSends: ["open", "current"]
  23176. }),
  23177. $globals.Transcript.klass);
  23178. $core.addMethod(
  23179. $core.method({
  23180. selector: "show:",
  23181. protocol: 'printing',
  23182. fn: function (anObject){
  23183. var self=this;
  23184. return $core.withContext(function($ctx1) {
  23185. $recv(self._current())._show_(anObject);
  23186. return self;
  23187. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.klass)});
  23188. },
  23189. args: ["anObject"],
  23190. source: "show: anObject\x0a\x09self current show: anObject",
  23191. referencedClasses: [],
  23192. messageSends: ["show:", "current"]
  23193. }),
  23194. $globals.Transcript.klass);
  23195. $core.addMethod(
  23196. $core.method({
  23197. selector: "inspectOn:",
  23198. protocol: '*Platform-Services',
  23199. fn: function (anInspector){
  23200. var self=this;
  23201. var variables;
  23202. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23203. return $core.withContext(function($ctx1) {
  23204. var $1;
  23205. variables=$recv($Dictionary())._new();
  23206. $recv(variables)._at_put_("#self",self);
  23207. $ctx1.sendIdx["at:put:"]=1;
  23208. $recv(variables)._at_put_("#keys",self._keys());
  23209. $ctx1.sendIdx["at:put:"]=2;
  23210. self._keysAndValuesDo_((function(key,value){
  23211. return $core.withContext(function($ctx2) {
  23212. return $recv(variables)._at_put_(key,value);
  23213. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  23214. }));
  23215. $recv(anInspector)._setLabel_(self._printString());
  23216. $1=$recv(anInspector)._setVariables_(variables);
  23217. return self;
  23218. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  23219. },
  23220. args: ["anInspector"],
  23221. 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",
  23222. referencedClasses: ["Dictionary"],
  23223. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  23224. }),
  23225. $globals.AssociativeCollection);
  23226. $core.addMethod(
  23227. $core.method({
  23228. selector: "inspectOn:",
  23229. protocol: '*Platform-Services',
  23230. fn: function (anInspector){
  23231. var self=this;
  23232. var variables;
  23233. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23234. return $core.withContext(function($ctx1) {
  23235. var $1;
  23236. variables=$recv($Dictionary())._new();
  23237. $recv(variables)._at_put_("#self",self);
  23238. $ctx1.sendIdx["at:put:"]=1;
  23239. self._withIndexDo_((function(each,i){
  23240. return $core.withContext(function($ctx2) {
  23241. return $recv(variables)._at_put_(i,each);
  23242. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  23243. }));
  23244. $recv(anInspector)._setLabel_(self._printString());
  23245. $1=$recv(anInspector)._setVariables_(variables);
  23246. return self;
  23247. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  23248. },
  23249. args: ["anInspector"],
  23250. 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",
  23251. referencedClasses: ["Dictionary"],
  23252. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  23253. }),
  23254. $globals.Collection);
  23255. $core.addMethod(
  23256. $core.method({
  23257. selector: "inspectOn:",
  23258. protocol: '*Platform-Services',
  23259. fn: function (anInspector){
  23260. var self=this;
  23261. var variables;
  23262. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23263. return $core.withContext(function($ctx1) {
  23264. var $1;
  23265. variables=$recv($Dictionary())._new();
  23266. $recv(variables)._at_put_("#self",self);
  23267. $ctx1.sendIdx["at:put:"]=1;
  23268. $recv(variables)._at_put_("#year",self._year());
  23269. $ctx1.sendIdx["at:put:"]=2;
  23270. $recv(variables)._at_put_("#month",self._month());
  23271. $ctx1.sendIdx["at:put:"]=3;
  23272. $recv(variables)._at_put_("#day",self._day());
  23273. $ctx1.sendIdx["at:put:"]=4;
  23274. $recv(variables)._at_put_("#hours",self._hours());
  23275. $ctx1.sendIdx["at:put:"]=5;
  23276. $recv(variables)._at_put_("#minutes",self._minutes());
  23277. $ctx1.sendIdx["at:put:"]=6;
  23278. $recv(variables)._at_put_("#seconds",self._seconds());
  23279. $ctx1.sendIdx["at:put:"]=7;
  23280. $recv(variables)._at_put_("#milliseconds",self._milliseconds());
  23281. $recv(anInspector)._setLabel_(self._printString());
  23282. $1=$recv(anInspector)._setVariables_(variables);
  23283. return self;
  23284. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  23285. },
  23286. args: ["anInspector"],
  23287. 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",
  23288. referencedClasses: ["Dictionary"],
  23289. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  23290. }),
  23291. $globals.Date);
  23292. $core.addMethod(
  23293. $core.method({
  23294. selector: "inspectOn:",
  23295. protocol: '*Platform-Services',
  23296. fn: function (anInspector){
  23297. var self=this;
  23298. var variables;
  23299. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23300. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  23301. return $core.withContext(function($ctx1) {
  23302. variables=$recv($Dictionary())._new();
  23303. $recv(variables)._at_put_("#self",self._jsObject());
  23304. $recv(anInspector)._setLabel_(self._printString());
  23305. $recv($JSObjectProxy())._addObjectVariablesTo_ofProxy_(variables,self);
  23306. $recv(anInspector)._setVariables_(variables);
  23307. return self;
  23308. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  23309. },
  23310. args: ["anInspector"],
  23311. 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",
  23312. referencedClasses: ["Dictionary", "JSObjectProxy"],
  23313. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  23314. }),
  23315. $globals.JSObjectProxy);
  23316. $core.addMethod(
  23317. $core.method({
  23318. selector: "inspectOn:",
  23319. protocol: '*Platform-Services',
  23320. fn: function (anInspector){
  23321. var self=this;
  23322. var variables;
  23323. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23324. return $core.withContext(function($ctx1) {
  23325. var $1;
  23326. variables=$recv($Dictionary())._new();
  23327. $recv(variables)._at_put_("#self",self);
  23328. $ctx1.sendIdx["at:put:"]=1;
  23329. $recv(variables)._at_put_("#home",self._home());
  23330. $ctx1.sendIdx["at:put:"]=2;
  23331. $recv(variables)._at_put_("#receiver",self._receiver());
  23332. $ctx1.sendIdx["at:put:"]=3;
  23333. $recv(variables)._at_put_("#selector",self._selector());
  23334. $ctx1.sendIdx["at:put:"]=4;
  23335. $recv(variables)._at_put_("#locals",self._locals());
  23336. $ctx1.sendIdx["at:put:"]=5;
  23337. $recv($recv(self._class())._instanceVariableNames())._do_((function(each){
  23338. return $core.withContext(function($ctx2) {
  23339. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  23340. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23341. }));
  23342. $recv(anInspector)._setLabel_(self._printString());
  23343. $1=$recv(anInspector)._setVariables_(variables);
  23344. return self;
  23345. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  23346. },
  23347. args: ["anInspector"],
  23348. 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",
  23349. referencedClasses: ["Dictionary"],
  23350. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  23351. }),
  23352. $globals.MethodContext);
  23353. $core.addMethod(
  23354. $core.method({
  23355. selector: "inspectOn:",
  23356. protocol: '*Platform-Services',
  23357. fn: function (anInspector){
  23358. var self=this;
  23359. var variables;
  23360. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23361. return $core.withContext(function($ctx1) {
  23362. var $1;
  23363. variables=$recv($Dictionary())._new();
  23364. $recv(variables)._at_put_("#self",self);
  23365. $ctx1.sendIdx["at:put:"]=1;
  23366. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  23367. return $core.withContext(function($ctx2) {
  23368. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  23369. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23370. }));
  23371. $recv(anInspector)._setLabel_(self._printString());
  23372. $1=$recv(anInspector)._setVariables_(variables);
  23373. return self;
  23374. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  23375. },
  23376. args: ["anInspector"],
  23377. 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",
  23378. referencedClasses: ["Dictionary"],
  23379. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  23380. }),
  23381. $globals.Object);
  23382. $core.addMethod(
  23383. $core.method({
  23384. selector: "do:displayingProgress:",
  23385. protocol: '*Platform-Services',
  23386. fn: function (aBlock,aString){
  23387. var self=this;
  23388. function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  23389. return $core.withContext(function($ctx1) {
  23390. $recv($ProgressHandler())._do_on_displaying_(aBlock,self,aString);
  23391. return self;
  23392. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  23393. },
  23394. args: ["aBlock", "aString"],
  23395. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  23396. referencedClasses: ["ProgressHandler"],
  23397. messageSends: ["do:on:displaying:"]
  23398. }),
  23399. $globals.SequenceableCollection);
  23400. $core.addMethod(
  23401. $core.method({
  23402. selector: "inspectOn:",
  23403. protocol: '*Platform-Services',
  23404. fn: function (anInspector){
  23405. var self=this;
  23406. var variables,i;
  23407. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23408. return $core.withContext(function($ctx1) {
  23409. var $1;
  23410. variables=$recv($Dictionary())._new();
  23411. $recv(variables)._at_put_("#self",self);
  23412. $ctx1.sendIdx["at:put:"]=1;
  23413. i=(1);
  23414. self._do_((function(each){
  23415. return $core.withContext(function($ctx2) {
  23416. $recv(variables)._at_put_(i,each);
  23417. i=$recv(i).__plus((1));
  23418. return i;
  23419. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23420. }));
  23421. $recv(anInspector)._setLabel_(self._printString());
  23422. $1=$recv(anInspector)._setVariables_(variables);
  23423. return self;
  23424. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  23425. },
  23426. args: ["anInspector"],
  23427. 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",
  23428. referencedClasses: ["Dictionary"],
  23429. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  23430. }),
  23431. $globals.Set);
  23432. $core.addMethod(
  23433. $core.method({
  23434. selector: "inspectOn:",
  23435. protocol: '*Platform-Services',
  23436. fn: function (anInspector){
  23437. var self=this;
  23438. var label;
  23439. return $core.withContext(function($ctx1) {
  23440. var $3,$2,$1,$5,$4;
  23441. (
  23442. $ctx1.supercall = true,
  23443. $globals.String.superclass.fn.prototype._inspectOn_.apply($recv(self), [anInspector]));
  23444. $ctx1.supercall = false;
  23445. $3=self._printString();
  23446. $ctx1.sendIdx["printString"]=1;
  23447. $2=$recv($3)._size();
  23448. $1=$recv($2).__gt((30));
  23449. if($core.assert($1)){
  23450. $5=self._printString();
  23451. $ctx1.sendIdx["printString"]=2;
  23452. $4=$recv($5)._copyFrom_to_((1),(30));
  23453. label=$recv($4).__comma("...'");
  23454. label;
  23455. } else {
  23456. label=self._printString();
  23457. label;
  23458. };
  23459. $recv(anInspector)._setLabel_(label);
  23460. return self;
  23461. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  23462. },
  23463. args: ["anInspector"],
  23464. 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",
  23465. referencedClasses: [],
  23466. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  23467. }),
  23468. $globals.String);
  23469. });
  23470. define("amber_core/Platform-Node", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  23471. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  23472. $core.addPackage('Platform-Node');
  23473. $core.packages["Platform-Node"].innerEval = function (expr) { return eval(expr); };
  23474. $core.packages["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
  23475. $core.addClass('NodePlatform', $globals.Object, [], 'Platform-Node');
  23476. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  23477. $core.addMethod(
  23478. $core.method({
  23479. selector: "globals",
  23480. protocol: 'accessing',
  23481. fn: function (){
  23482. var self=this;
  23483. var $1;
  23484. $1=global;
  23485. return $1;
  23486. },
  23487. args: [],
  23488. source: "globals\x0a\x09^ global",
  23489. referencedClasses: [],
  23490. messageSends: []
  23491. }),
  23492. $globals.NodePlatform);
  23493. $core.addMethod(
  23494. $core.method({
  23495. selector: "newXhr",
  23496. protocol: 'accessing',
  23497. fn: function (){
  23498. var self=this;
  23499. function $XMLHttpRequest(){return $globals.XMLHttpRequest||(typeof XMLHttpRequest=="undefined"?nil:XMLHttpRequest)}
  23500. return $core.withContext(function($ctx1) {
  23501. var $1,$receiver;
  23502. if(($receiver = $XMLHttpRequest()) == null || $receiver.isNil){
  23503. self._error_("XMLHttpRequest not available.");
  23504. } else {
  23505. $1=$recv($XMLHttpRequest())._new();
  23506. return $1;
  23507. };
  23508. return self;
  23509. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  23510. },
  23511. args: [],
  23512. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  23513. referencedClasses: ["XMLHttpRequest"],
  23514. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  23515. }),
  23516. $globals.NodePlatform);
  23517. $core.addMethod(
  23518. $core.method({
  23519. selector: "initialize",
  23520. protocol: 'testing',
  23521. fn: function (){
  23522. var self=this;
  23523. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  23524. return $core.withContext(function($ctx1) {
  23525. var $1;
  23526. $1=self._isFeasible();
  23527. if($core.assert($1)){
  23528. $recv($Platform())._registerIfNone_(self._new());
  23529. };
  23530. return self;
  23531. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.klass)});
  23532. },
  23533. args: [],
  23534. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  23535. referencedClasses: ["Platform"],
  23536. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  23537. }),
  23538. $globals.NodePlatform.klass);
  23539. $core.addMethod(
  23540. $core.method({
  23541. selector: "isFeasible",
  23542. protocol: 'testing',
  23543. fn: function (){
  23544. var self=this;
  23545. return $core.withContext(function($ctx1) {
  23546. return typeof global !== "undefined";
  23547. return self;
  23548. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.klass)});
  23549. },
  23550. args: [],
  23551. source: "isFeasible\x0a<return typeof global !== \x22undefined\x22>",
  23552. referencedClasses: [],
  23553. messageSends: []
  23554. }),
  23555. $globals.NodePlatform.klass);
  23556. });
  23557. define('amber/deploy',[
  23558. './helpers',
  23559. // --- packages of the core Amber begin here ---
  23560. 'amber_core/Kernel-Objects',
  23561. 'amber_core/Kernel-Classes',
  23562. 'amber_core/Kernel-Methods',
  23563. 'amber_core/Kernel-Collections',
  23564. 'amber_core/Kernel-Infrastructure',
  23565. 'amber_core/Kernel-Exceptions',
  23566. 'amber_core/Kernel-Announcements',
  23567. 'amber_core/Platform-Services',
  23568. 'amber/Platform'
  23569. // --- packages of the core Amber end here ---
  23570. ], function (amber) { return amber; });
  23571. define("amber/parser", ["./boot"], function($boot) {
  23572. var $globals = $boot.globals, nil = $boot.nil;
  23573. $globals.SmalltalkParser = (function() {
  23574. /*
  23575. * Generated by PEG.js 0.8.0.
  23576. *
  23577. * http://pegjs.majda.cz/
  23578. */
  23579. function peg$subclass(child, parent) {
  23580. function ctor() { this.constructor = child; }
  23581. ctor.prototype = parent.prototype;
  23582. child.prototype = new ctor();
  23583. }
  23584. function SyntaxError(message, expected, found, offset, line, column) {
  23585. this.message = message;
  23586. this.expected = expected;
  23587. this.found = found;
  23588. this.offset = offset;
  23589. this.line = line;
  23590. this.column = column;
  23591. this.name = "SyntaxError";
  23592. }
  23593. peg$subclass(SyntaxError, Error);
  23594. function parse(input) {
  23595. var options = arguments.length > 1 ? arguments[1] : {},
  23596. peg$FAILED = {},
  23597. peg$startRuleFunctions = { start: peg$parsestart },
  23598. peg$startRuleFunction = peg$parsestart,
  23599. peg$c0 = [],
  23600. peg$c1 = peg$FAILED,
  23601. peg$c2 = /^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/,
  23602. peg$c3 = { type: "class", value: "[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]", description: "[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]" },
  23603. peg$c4 = "\"",
  23604. peg$c5 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  23605. peg$c6 = /^[^"]/,
  23606. peg$c7 = { type: "class", value: "[^\"]", description: "[^\"]" },
  23607. peg$c8 = /^[a-zA-Z]/,
  23608. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  23609. peg$c10 = /^[a-zA-Z0-9]/,
  23610. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  23611. peg$c12 = function(first, others) {return first + others.join("");},
  23612. peg$c13 = ":",
  23613. peg$c14 = { type: "literal", value: ":", description: "\":\"" },
  23614. peg$c15 = function(first, last) {return first + last;},
  23615. peg$c16 = /^[a-zA-Z0-9:]/,
  23616. peg$c17 = { type: "class", value: "[a-zA-Z0-9:]", description: "[a-zA-Z0-9:]" },
  23617. peg$c18 = /^[A-Z]/,
  23618. peg$c19 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  23619. peg$c20 = "'",
  23620. peg$c21 = { type: "literal", value: "'", description: "\"'\"" },
  23621. peg$c22 = "''",
  23622. peg$c23 = { type: "literal", value: "''", description: "\"''\"" },
  23623. peg$c24 = function() {return "'";},
  23624. peg$c25 = /^[^']/,
  23625. peg$c26 = { type: "class", value: "[^']", description: "[^']" },
  23626. peg$c27 = function(val) {
  23627. return $globals.ValueNode._new()
  23628. ._position_((line()).__at(column()))
  23629. ._source_(text())
  23630. ._value_(val.join(""));
  23631. },
  23632. peg$c28 = "$",
  23633. peg$c29 = { type: "literal", value: "$", description: "\"$\"" },
  23634. peg$c30 = { type: "any", description: "any character" },
  23635. peg$c31 = function(char) {
  23636. return $globals.ValueNode._new()
  23637. ._position_((line()).__at(column()))
  23638. ._source_(text())
  23639. ._value_(char);
  23640. },
  23641. peg$c32 = "#",
  23642. peg$c33 = { type: "literal", value: "#", description: "\"#\"" },
  23643. peg$c34 = function(rest) {return rest;},
  23644. peg$c35 = function(node) {return node._value();},
  23645. peg$c36 = function(val) {
  23646. return $globals.ValueNode._new()
  23647. ._position_((line()).__at(column()))
  23648. ._source_(text())
  23649. ._value_(val);
  23650. },
  23651. peg$c37 = function(n) {
  23652. return $globals.ValueNode._new()
  23653. ._position_((line()).__at(column()))
  23654. ._source_(text())
  23655. ._value_(n);
  23656. },
  23657. peg$c38 = "e",
  23658. peg$c39 = { type: "literal", value: "e", description: "\"e\"" },
  23659. peg$c40 = function(n) {return parseFloat(n.join(""));},
  23660. peg$c41 = null,
  23661. peg$c42 = "-",
  23662. peg$c43 = { type: "literal", value: "-", description: "\"-\"" },
  23663. peg$c44 = "16r",
  23664. peg$c45 = { type: "literal", value: "16r", description: "\"16r\"" },
  23665. peg$c46 = /^[0-9a-fA-F]/,
  23666. peg$c47 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  23667. peg$c48 = function(neg, num) {return parseInt(((neg || '') + num.join("")), 16);},
  23668. peg$c49 = /^[0-9]/,
  23669. peg$c50 = { type: "class", value: "[0-9]", description: "[0-9]" },
  23670. peg$c51 = ".",
  23671. peg$c52 = { type: "literal", value: ".", description: "\".\"" },
  23672. peg$c53 = function(neg, digits, dec) {return parseFloat(((neg || '') + digits.join("") + "." + dec.join("")), 10);},
  23673. peg$c54 = function(neg, digits) {return (parseInt((neg || '') + digits.join(""), 10));},
  23674. peg$c55 = "#(",
  23675. peg$c56 = { type: "literal", value: "#(", description: "\"#(\"" },
  23676. peg$c57 = "(",
  23677. peg$c58 = { type: "literal", value: "(", description: "\"(\"" },
  23678. peg$c59 = function(lit) {return lit._value();},
  23679. peg$c60 = ")",
  23680. peg$c61 = { type: "literal", value: ")", description: "\")\"" },
  23681. peg$c62 = function(lits) {
  23682. return $globals.ValueNode._new()
  23683. ._position_((line()).__at(column()))
  23684. ._source_(text())
  23685. ._value_(lits);
  23686. },
  23687. peg$c63 = "{",
  23688. peg$c64 = { type: "literal", value: "{", description: "\"{\"" },
  23689. peg$c65 = "}",
  23690. peg$c66 = { type: "literal", value: "}", description: "\"}\"" },
  23691. peg$c67 = function(expressions) {
  23692. return $globals.DynamicArrayNode._new()
  23693. ._position_((line()).__at(column()))
  23694. ._source_(text())
  23695. ._nodes_(expressions || []);
  23696. },
  23697. peg$c68 = "#{",
  23698. peg$c69 = { type: "literal", value: "#{", description: "\"#{\"" },
  23699. peg$c70 = function(expressions) {
  23700. return $globals.DynamicDictionaryNode._new()
  23701. ._position_((line()).__at(column()))
  23702. ._source_(text())
  23703. ._nodes_(expressions || []);
  23704. },
  23705. peg$c71 = "true",
  23706. peg$c72 = { type: "literal", value: "true", description: "\"true\"" },
  23707. peg$c73 = function() {return true;},
  23708. peg$c74 = "false",
  23709. peg$c75 = { type: "literal", value: "false", description: "\"false\"" },
  23710. peg$c76 = function() {return false;},
  23711. peg$c77 = "nil",
  23712. peg$c78 = { type: "literal", value: "nil", description: "\"nil\"" },
  23713. peg$c79 = function() {return nil;},
  23714. peg$c80 = function(val) {
  23715. return $globals.ValueNode._new()
  23716. ._position_((line()).__at(column()))
  23717. ._source_(text())
  23718. ._value_(val);
  23719. },
  23720. peg$c81 = function(identifier) {
  23721. return $globals.VariableNode._new()
  23722. ._position_((line()).__at(column()))
  23723. ._source_(text())
  23724. ._value_(identifier);
  23725. },
  23726. peg$c82 = function(key, arg) {return {key:key, arg:arg};},
  23727. peg$c83 = /^[\\+*\/=><,@%~|&\-]/,
  23728. peg$c84 = { type: "class", value: "[\\\\+*\\/=><,@%~|&\\-]", description: "[\\\\+*\\/=><,@%~|&\\-]" },
  23729. peg$c85 = function(bin) {return bin.join("");},
  23730. peg$c86 = function(pairs) {
  23731. var keywords = [];
  23732. var params = [];
  23733. var i = 0;
  23734. for(i = 0; i < pairs.length; i++){
  23735. keywords.push(pairs[i].key);
  23736. }
  23737. for(i = 0; i < pairs.length; i++){
  23738. params.push(pairs[i].arg);
  23739. }
  23740. return [keywords.join(""), params];
  23741. },
  23742. peg$c87 = function(selector, arg) {return [selector, [arg]];},
  23743. peg$c88 = function(selector) {return [selector, []];},
  23744. peg$c89 = function(expression) {return expression;},
  23745. peg$c90 = function(first, others) { return [first].concat(others); },
  23746. peg$c91 = ":=",
  23747. peg$c92 = { type: "literal", value: ":=", description: "\":=\"" },
  23748. peg$c93 = function(variable, expression) {
  23749. return $globals.AssignmentNode._new()
  23750. ._position_((line()).__at(column()))
  23751. ._source_(text())
  23752. ._left_(variable)
  23753. ._right_(expression);
  23754. },
  23755. peg$c94 = "^",
  23756. peg$c95 = { type: "literal", value: "^", description: "\"^\"" },
  23757. peg$c96 = function(expression) {
  23758. return $globals.ReturnNode._new()
  23759. ._position_((line()).__at(column()))
  23760. ._source_(text())
  23761. ._nodes_([expression]);
  23762. },
  23763. peg$c97 = "|",
  23764. peg$c98 = { type: "literal", value: "|", description: "\"|\"" },
  23765. peg$c99 = function(variable) {return variable;},
  23766. peg$c100 = function(vars) {return vars;},
  23767. peg$c101 = function(param) {return param;},
  23768. peg$c102 = function(params) {return params;},
  23769. peg$c103 = function(ret) {return [ret];},
  23770. peg$c104 = function(exps, ret) {
  23771. var expressions = exps;
  23772. expressions.push(ret);
  23773. return expressions;
  23774. },
  23775. peg$c105 = function(expressions) {
  23776. return expressions || [];
  23777. },
  23778. peg$c106 = function(temps, statements) {
  23779. return $globals.SequenceNode._new()
  23780. ._position_((line()).__at(column()))
  23781. ._source_(text())
  23782. ._temps_(temps || [])
  23783. ._nodes_(statements || []);
  23784. },
  23785. peg$c107 = "[",
  23786. peg$c108 = { type: "literal", value: "[", description: "\"[\"" },
  23787. peg$c109 = "]",
  23788. peg$c110 = { type: "literal", value: "]", description: "\"]\"" },
  23789. peg$c111 = function(params, sequence) {
  23790. return $globals.BlockNode._new()
  23791. ._position_((line()).__at(column()))
  23792. ._source_(text())
  23793. ._parameters_(params || [])
  23794. ._nodes_([sequence._asBlockSequenceNode()]);
  23795. },
  23796. peg$c112 = void 0,
  23797. peg$c113 = function(selector) {
  23798. return $globals.SendNode._new()
  23799. ._position_((line()).__at(column()))
  23800. ._source_(text())
  23801. ._selector_(selector);
  23802. },
  23803. peg$c114 = function(message, tail) {
  23804. if(tail) {
  23805. return tail._valueForReceiver_(message);
  23806. }
  23807. else {
  23808. return message;
  23809. }
  23810. },
  23811. peg$c115 = function(receiver, tail) {
  23812. if(tail) {
  23813. return tail._valueForReceiver_(receiver);
  23814. }
  23815. else {
  23816. return receiver;
  23817. }
  23818. },
  23819. peg$c116 = function(selector, arg) {
  23820. return $globals.SendNode._new()
  23821. ._position_((line()).__at(column()))
  23822. ._source_(text())
  23823. ._selector_(selector)
  23824. ._arguments_([arg]);
  23825. },
  23826. peg$c117 = function(message, tail) {
  23827. if(tail) {
  23828. return tail._valueForReceiver_(message);
  23829. }
  23830. else {
  23831. return message;
  23832. }
  23833. },
  23834. peg$c118 = function(pairs) {
  23835. var selector = [];
  23836. var args = [];
  23837. for(var i = 0; i < pairs.length; i++) {
  23838. selector.push(pairs[i].key);
  23839. args.push(pairs[i].arg);
  23840. }
  23841. return $globals.SendNode._new()
  23842. ._position_((line()).__at(column()))
  23843. ._source_(text())
  23844. ._selector_(selector.join(""))
  23845. ._arguments_(args);
  23846. },
  23847. peg$c119 = function(receiver, tail) {
  23848. return tail._valueForReceiver_(receiver);
  23849. },
  23850. peg$c120 = ";",
  23851. peg$c121 = { type: "literal", value: ";", description: "\";\"" },
  23852. peg$c122 = function(mess) {return mess;},
  23853. peg$c123 = function(send, messages) {
  23854. var cascade = [];
  23855. cascade.push(send);
  23856. for(var i = 0; i < messages.length; i++) {
  23857. cascade.push(messages[i]);
  23858. }
  23859. return $globals.CascadeNode._new()
  23860. ._position_((line()).__at(column()))
  23861. ._source_(text())
  23862. ._receiver_(send._receiver())
  23863. ._nodes_(cascade);
  23864. },
  23865. peg$c124 = "<",
  23866. peg$c125 = { type: "literal", value: "<", description: "\"<\"" },
  23867. peg$c126 = ">>",
  23868. peg$c127 = { type: "literal", value: ">>", description: "\">>\"" },
  23869. peg$c128 = function() {return ">";},
  23870. peg$c129 = /^[^>]/,
  23871. peg$c130 = { type: "class", value: "[^>]", description: "[^>]" },
  23872. peg$c131 = ">",
  23873. peg$c132 = { type: "literal", value: ">", description: "\">\"" },
  23874. peg$c133 = function(val) {
  23875. return $globals.JSStatementNode._new()
  23876. ._position_((line()).__at(column()))
  23877. ._source_(val.join(""))
  23878. },
  23879. peg$c134 = function(pattern, sequence) {
  23880. return $globals.MethodNode._new()
  23881. ._position_((line()).__at(column()))
  23882. ._source_(text())
  23883. ._selector_(pattern[0])
  23884. ._arguments_(pattern[1])
  23885. ._nodes_([sequence]);
  23886. },
  23887. peg$c135 = function(send) { return send._selector() === "->" },
  23888. peg$c136 = function(send) { return [send._receiver(), send._arguments()[0]]; },
  23889. peg$c137 = function(first, others) { return first.concat.apply(first, others); },
  23890. peg$currPos = 0,
  23891. peg$reportedPos = 0,
  23892. peg$cachedPos = 0,
  23893. peg$cachedPosDetails = { line: 1, column: 1, seenCR: false },
  23894. peg$maxFailPos = 0,
  23895. peg$maxFailExpected = [],
  23896. peg$silentFails = 0,
  23897. peg$cache = {},
  23898. peg$result;
  23899. if ("startRule" in options) {
  23900. if (!(options.startRule in peg$startRuleFunctions)) {
  23901. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  23902. }
  23903. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  23904. }
  23905. function text() {
  23906. return input.substring(peg$reportedPos, peg$currPos);
  23907. }
  23908. function offset() {
  23909. return peg$reportedPos;
  23910. }
  23911. function line() {
  23912. return peg$computePosDetails(peg$reportedPos).line;
  23913. }
  23914. function column() {
  23915. return peg$computePosDetails(peg$reportedPos).column;
  23916. }
  23917. function expected(description) {
  23918. throw peg$buildException(
  23919. null,
  23920. [{ type: "other", description: description }],
  23921. peg$reportedPos
  23922. );
  23923. }
  23924. function error(message) {
  23925. throw peg$buildException(message, null, peg$reportedPos);
  23926. }
  23927. function peg$computePosDetails(pos) {
  23928. function advance(details, startPos, endPos) {
  23929. var p, ch;
  23930. for (p = startPos; p < endPos; p++) {
  23931. ch = input.charAt(p);
  23932. if (ch === "\n") {
  23933. if (!details.seenCR) { details.line++; }
  23934. details.column = 1;
  23935. details.seenCR = false;
  23936. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  23937. details.line++;
  23938. details.column = 1;
  23939. details.seenCR = true;
  23940. } else {
  23941. details.column++;
  23942. details.seenCR = false;
  23943. }
  23944. }
  23945. }
  23946. if (peg$cachedPos !== pos) {
  23947. if (peg$cachedPos > pos) {
  23948. peg$cachedPos = 0;
  23949. peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
  23950. }
  23951. advance(peg$cachedPosDetails, peg$cachedPos, pos);
  23952. peg$cachedPos = pos;
  23953. }
  23954. return peg$cachedPosDetails;
  23955. }
  23956. function peg$fail(expected) {
  23957. if (peg$currPos < peg$maxFailPos) { return; }
  23958. if (peg$currPos > peg$maxFailPos) {
  23959. peg$maxFailPos = peg$currPos;
  23960. peg$maxFailExpected = [];
  23961. }
  23962. peg$maxFailExpected.push(expected);
  23963. }
  23964. function peg$buildException(message, expected, pos) {
  23965. function cleanupExpected(expected) {
  23966. var i = 1;
  23967. expected.sort(function(a, b) {
  23968. if (a.description < b.description) {
  23969. return -1;
  23970. } else if (a.description > b.description) {
  23971. return 1;
  23972. } else {
  23973. return 0;
  23974. }
  23975. });
  23976. while (i < expected.length) {
  23977. if (expected[i - 1] === expected[i]) {
  23978. expected.splice(i, 1);
  23979. } else {
  23980. i++;
  23981. }
  23982. }
  23983. }
  23984. function buildMessage(expected, found) {
  23985. function stringEscape(s) {
  23986. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  23987. return s
  23988. .replace(/\\/g, '\\\\')
  23989. .replace(/"/g, '\\"')
  23990. .replace(/\x08/g, '\\b')
  23991. .replace(/\t/g, '\\t')
  23992. .replace(/\n/g, '\\n')
  23993. .replace(/\f/g, '\\f')
  23994. .replace(/\r/g, '\\r')
  23995. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  23996. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  23997. .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  23998. .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  23999. }
  24000. var expectedDescs = new Array(expected.length),
  24001. expectedDesc, foundDesc, i;
  24002. for (i = 0; i < expected.length; i++) {
  24003. expectedDescs[i] = expected[i].description;
  24004. }
  24005. expectedDesc = expected.length > 1
  24006. ? expectedDescs.slice(0, -1).join(", ")
  24007. + " or "
  24008. + expectedDescs[expected.length - 1]
  24009. : expectedDescs[0];
  24010. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  24011. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  24012. }
  24013. var posDetails = peg$computePosDetails(pos),
  24014. found = pos < input.length ? input.charAt(pos) : null;
  24015. if (expected !== null) {
  24016. cleanupExpected(expected);
  24017. }
  24018. return new SyntaxError(
  24019. message !== null ? message : buildMessage(expected, found),
  24020. expected,
  24021. found,
  24022. pos,
  24023. posDetails.line,
  24024. posDetails.column
  24025. );
  24026. }
  24027. function peg$parsestart() {
  24028. var s0;
  24029. var key = peg$currPos * 60 + 0,
  24030. cached = peg$cache[key];
  24031. if (cached) {
  24032. peg$currPos = cached.nextPos;
  24033. return cached.result;
  24034. }
  24035. s0 = peg$parsemethod();
  24036. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24037. return s0;
  24038. }
  24039. function peg$parseseparator() {
  24040. var s0, s1;
  24041. var key = peg$currPos * 60 + 1,
  24042. cached = peg$cache[key];
  24043. if (cached) {
  24044. peg$currPos = cached.nextPos;
  24045. return cached.result;
  24046. }
  24047. s0 = [];
  24048. if (peg$c2.test(input.charAt(peg$currPos))) {
  24049. s1 = input.charAt(peg$currPos);
  24050. peg$currPos++;
  24051. } else {
  24052. s1 = peg$FAILED;
  24053. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  24054. }
  24055. if (s1 !== peg$FAILED) {
  24056. while (s1 !== peg$FAILED) {
  24057. s0.push(s1);
  24058. if (peg$c2.test(input.charAt(peg$currPos))) {
  24059. s1 = input.charAt(peg$currPos);
  24060. peg$currPos++;
  24061. } else {
  24062. s1 = peg$FAILED;
  24063. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  24064. }
  24065. }
  24066. } else {
  24067. s0 = peg$c1;
  24068. }
  24069. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24070. return s0;
  24071. }
  24072. function peg$parsecomments() {
  24073. var s0, s1, s2, s3, s4;
  24074. var key = peg$currPos * 60 + 2,
  24075. cached = peg$cache[key];
  24076. if (cached) {
  24077. peg$currPos = cached.nextPos;
  24078. return cached.result;
  24079. }
  24080. s0 = [];
  24081. s1 = peg$currPos;
  24082. if (input.charCodeAt(peg$currPos) === 34) {
  24083. s2 = peg$c4;
  24084. peg$currPos++;
  24085. } else {
  24086. s2 = peg$FAILED;
  24087. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24088. }
  24089. if (s2 !== peg$FAILED) {
  24090. s3 = [];
  24091. if (peg$c6.test(input.charAt(peg$currPos))) {
  24092. s4 = input.charAt(peg$currPos);
  24093. peg$currPos++;
  24094. } else {
  24095. s4 = peg$FAILED;
  24096. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24097. }
  24098. while (s4 !== peg$FAILED) {
  24099. s3.push(s4);
  24100. if (peg$c6.test(input.charAt(peg$currPos))) {
  24101. s4 = input.charAt(peg$currPos);
  24102. peg$currPos++;
  24103. } else {
  24104. s4 = peg$FAILED;
  24105. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24106. }
  24107. }
  24108. if (s3 !== peg$FAILED) {
  24109. if (input.charCodeAt(peg$currPos) === 34) {
  24110. s4 = peg$c4;
  24111. peg$currPos++;
  24112. } else {
  24113. s4 = peg$FAILED;
  24114. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24115. }
  24116. if (s4 !== peg$FAILED) {
  24117. s2 = [s2, s3, s4];
  24118. s1 = s2;
  24119. } else {
  24120. peg$currPos = s1;
  24121. s1 = peg$c1;
  24122. }
  24123. } else {
  24124. peg$currPos = s1;
  24125. s1 = peg$c1;
  24126. }
  24127. } else {
  24128. peg$currPos = s1;
  24129. s1 = peg$c1;
  24130. }
  24131. if (s1 !== peg$FAILED) {
  24132. while (s1 !== peg$FAILED) {
  24133. s0.push(s1);
  24134. s1 = peg$currPos;
  24135. if (input.charCodeAt(peg$currPos) === 34) {
  24136. s2 = peg$c4;
  24137. peg$currPos++;
  24138. } else {
  24139. s2 = peg$FAILED;
  24140. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24141. }
  24142. if (s2 !== peg$FAILED) {
  24143. s3 = [];
  24144. if (peg$c6.test(input.charAt(peg$currPos))) {
  24145. s4 = input.charAt(peg$currPos);
  24146. peg$currPos++;
  24147. } else {
  24148. s4 = peg$FAILED;
  24149. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24150. }
  24151. while (s4 !== peg$FAILED) {
  24152. s3.push(s4);
  24153. if (peg$c6.test(input.charAt(peg$currPos))) {
  24154. s4 = input.charAt(peg$currPos);
  24155. peg$currPos++;
  24156. } else {
  24157. s4 = peg$FAILED;
  24158. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24159. }
  24160. }
  24161. if (s3 !== peg$FAILED) {
  24162. if (input.charCodeAt(peg$currPos) === 34) {
  24163. s4 = peg$c4;
  24164. peg$currPos++;
  24165. } else {
  24166. s4 = peg$FAILED;
  24167. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24168. }
  24169. if (s4 !== peg$FAILED) {
  24170. s2 = [s2, s3, s4];
  24171. s1 = s2;
  24172. } else {
  24173. peg$currPos = s1;
  24174. s1 = peg$c1;
  24175. }
  24176. } else {
  24177. peg$currPos = s1;
  24178. s1 = peg$c1;
  24179. }
  24180. } else {
  24181. peg$currPos = s1;
  24182. s1 = peg$c1;
  24183. }
  24184. }
  24185. } else {
  24186. s0 = peg$c1;
  24187. }
  24188. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24189. return s0;
  24190. }
  24191. function peg$parsews() {
  24192. var s0, s1;
  24193. var key = peg$currPos * 60 + 3,
  24194. cached = peg$cache[key];
  24195. if (cached) {
  24196. peg$currPos = cached.nextPos;
  24197. return cached.result;
  24198. }
  24199. s0 = [];
  24200. s1 = peg$parseseparator();
  24201. if (s1 === peg$FAILED) {
  24202. s1 = peg$parsecomments();
  24203. }
  24204. while (s1 !== peg$FAILED) {
  24205. s0.push(s1);
  24206. s1 = peg$parseseparator();
  24207. if (s1 === peg$FAILED) {
  24208. s1 = peg$parsecomments();
  24209. }
  24210. }
  24211. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24212. return s0;
  24213. }
  24214. function peg$parseidentifier() {
  24215. var s0, s1, s2, s3;
  24216. var key = peg$currPos * 60 + 4,
  24217. cached = peg$cache[key];
  24218. if (cached) {
  24219. peg$currPos = cached.nextPos;
  24220. return cached.result;
  24221. }
  24222. s0 = peg$currPos;
  24223. if (peg$c8.test(input.charAt(peg$currPos))) {
  24224. s1 = input.charAt(peg$currPos);
  24225. peg$currPos++;
  24226. } else {
  24227. s1 = peg$FAILED;
  24228. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  24229. }
  24230. if (s1 !== peg$FAILED) {
  24231. s2 = [];
  24232. if (peg$c10.test(input.charAt(peg$currPos))) {
  24233. s3 = input.charAt(peg$currPos);
  24234. peg$currPos++;
  24235. } else {
  24236. s3 = peg$FAILED;
  24237. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24238. }
  24239. while (s3 !== peg$FAILED) {
  24240. s2.push(s3);
  24241. if (peg$c10.test(input.charAt(peg$currPos))) {
  24242. s3 = input.charAt(peg$currPos);
  24243. peg$currPos++;
  24244. } else {
  24245. s3 = peg$FAILED;
  24246. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24247. }
  24248. }
  24249. if (s2 !== peg$FAILED) {
  24250. peg$reportedPos = s0;
  24251. s1 = peg$c12(s1, s2);
  24252. s0 = s1;
  24253. } else {
  24254. peg$currPos = s0;
  24255. s0 = peg$c1;
  24256. }
  24257. } else {
  24258. peg$currPos = s0;
  24259. s0 = peg$c1;
  24260. }
  24261. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24262. return s0;
  24263. }
  24264. function peg$parsekeyword() {
  24265. var s0, s1, s2;
  24266. var key = peg$currPos * 60 + 5,
  24267. cached = peg$cache[key];
  24268. if (cached) {
  24269. peg$currPos = cached.nextPos;
  24270. return cached.result;
  24271. }
  24272. s0 = peg$currPos;
  24273. s1 = peg$parseidentifier();
  24274. if (s1 !== peg$FAILED) {
  24275. if (input.charCodeAt(peg$currPos) === 58) {
  24276. s2 = peg$c13;
  24277. peg$currPos++;
  24278. } else {
  24279. s2 = peg$FAILED;
  24280. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  24281. }
  24282. if (s2 !== peg$FAILED) {
  24283. peg$reportedPos = s0;
  24284. s1 = peg$c15(s1, s2);
  24285. s0 = s1;
  24286. } else {
  24287. peg$currPos = s0;
  24288. s0 = peg$c1;
  24289. }
  24290. } else {
  24291. peg$currPos = s0;
  24292. s0 = peg$c1;
  24293. }
  24294. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24295. return s0;
  24296. }
  24297. function peg$parseselector() {
  24298. var s0, s1, s2, s3;
  24299. var key = peg$currPos * 60 + 6,
  24300. cached = peg$cache[key];
  24301. if (cached) {
  24302. peg$currPos = cached.nextPos;
  24303. return cached.result;
  24304. }
  24305. s0 = peg$currPos;
  24306. if (peg$c8.test(input.charAt(peg$currPos))) {
  24307. s1 = input.charAt(peg$currPos);
  24308. peg$currPos++;
  24309. } else {
  24310. s1 = peg$FAILED;
  24311. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  24312. }
  24313. if (s1 !== peg$FAILED) {
  24314. s2 = [];
  24315. if (peg$c16.test(input.charAt(peg$currPos))) {
  24316. s3 = input.charAt(peg$currPos);
  24317. peg$currPos++;
  24318. } else {
  24319. s3 = peg$FAILED;
  24320. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  24321. }
  24322. while (s3 !== peg$FAILED) {
  24323. s2.push(s3);
  24324. if (peg$c16.test(input.charAt(peg$currPos))) {
  24325. s3 = input.charAt(peg$currPos);
  24326. peg$currPos++;
  24327. } else {
  24328. s3 = peg$FAILED;
  24329. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  24330. }
  24331. }
  24332. if (s2 !== peg$FAILED) {
  24333. peg$reportedPos = s0;
  24334. s1 = peg$c12(s1, s2);
  24335. s0 = s1;
  24336. } else {
  24337. peg$currPos = s0;
  24338. s0 = peg$c1;
  24339. }
  24340. } else {
  24341. peg$currPos = s0;
  24342. s0 = peg$c1;
  24343. }
  24344. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24345. return s0;
  24346. }
  24347. function peg$parseclassName() {
  24348. var s0, s1, s2, s3;
  24349. var key = peg$currPos * 60 + 7,
  24350. cached = peg$cache[key];
  24351. if (cached) {
  24352. peg$currPos = cached.nextPos;
  24353. return cached.result;
  24354. }
  24355. s0 = peg$currPos;
  24356. if (peg$c18.test(input.charAt(peg$currPos))) {
  24357. s1 = input.charAt(peg$currPos);
  24358. peg$currPos++;
  24359. } else {
  24360. s1 = peg$FAILED;
  24361. if (peg$silentFails === 0) { peg$fail(peg$c19); }
  24362. }
  24363. if (s1 !== peg$FAILED) {
  24364. s2 = [];
  24365. if (peg$c10.test(input.charAt(peg$currPos))) {
  24366. s3 = input.charAt(peg$currPos);
  24367. peg$currPos++;
  24368. } else {
  24369. s3 = peg$FAILED;
  24370. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24371. }
  24372. while (s3 !== peg$FAILED) {
  24373. s2.push(s3);
  24374. if (peg$c10.test(input.charAt(peg$currPos))) {
  24375. s3 = input.charAt(peg$currPos);
  24376. peg$currPos++;
  24377. } else {
  24378. s3 = peg$FAILED;
  24379. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24380. }
  24381. }
  24382. if (s2 !== peg$FAILED) {
  24383. peg$reportedPos = s0;
  24384. s1 = peg$c12(s1, s2);
  24385. s0 = s1;
  24386. } else {
  24387. peg$currPos = s0;
  24388. s0 = peg$c1;
  24389. }
  24390. } else {
  24391. peg$currPos = s0;
  24392. s0 = peg$c1;
  24393. }
  24394. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24395. return s0;
  24396. }
  24397. function peg$parsestring() {
  24398. var s0, s1, s2, s3, s4;
  24399. var key = peg$currPos * 60 + 8,
  24400. cached = peg$cache[key];
  24401. if (cached) {
  24402. peg$currPos = cached.nextPos;
  24403. return cached.result;
  24404. }
  24405. s0 = peg$currPos;
  24406. if (input.charCodeAt(peg$currPos) === 39) {
  24407. s1 = peg$c20;
  24408. peg$currPos++;
  24409. } else {
  24410. s1 = peg$FAILED;
  24411. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  24412. }
  24413. if (s1 !== peg$FAILED) {
  24414. s2 = [];
  24415. s3 = peg$currPos;
  24416. if (input.substr(peg$currPos, 2) === peg$c22) {
  24417. s4 = peg$c22;
  24418. peg$currPos += 2;
  24419. } else {
  24420. s4 = peg$FAILED;
  24421. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  24422. }
  24423. if (s4 !== peg$FAILED) {
  24424. peg$reportedPos = s3;
  24425. s4 = peg$c24();
  24426. }
  24427. s3 = s4;
  24428. if (s3 === peg$FAILED) {
  24429. if (peg$c25.test(input.charAt(peg$currPos))) {
  24430. s3 = input.charAt(peg$currPos);
  24431. peg$currPos++;
  24432. } else {
  24433. s3 = peg$FAILED;
  24434. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  24435. }
  24436. }
  24437. while (s3 !== peg$FAILED) {
  24438. s2.push(s3);
  24439. s3 = peg$currPos;
  24440. if (input.substr(peg$currPos, 2) === peg$c22) {
  24441. s4 = peg$c22;
  24442. peg$currPos += 2;
  24443. } else {
  24444. s4 = peg$FAILED;
  24445. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  24446. }
  24447. if (s4 !== peg$FAILED) {
  24448. peg$reportedPos = s3;
  24449. s4 = peg$c24();
  24450. }
  24451. s3 = s4;
  24452. if (s3 === peg$FAILED) {
  24453. if (peg$c25.test(input.charAt(peg$currPos))) {
  24454. s3 = input.charAt(peg$currPos);
  24455. peg$currPos++;
  24456. } else {
  24457. s3 = peg$FAILED;
  24458. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  24459. }
  24460. }
  24461. }
  24462. if (s2 !== peg$FAILED) {
  24463. if (input.charCodeAt(peg$currPos) === 39) {
  24464. s3 = peg$c20;
  24465. peg$currPos++;
  24466. } else {
  24467. s3 = peg$FAILED;
  24468. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  24469. }
  24470. if (s3 !== peg$FAILED) {
  24471. peg$reportedPos = s0;
  24472. s1 = peg$c27(s2);
  24473. s0 = s1;
  24474. } else {
  24475. peg$currPos = s0;
  24476. s0 = peg$c1;
  24477. }
  24478. } else {
  24479. peg$currPos = s0;
  24480. s0 = peg$c1;
  24481. }
  24482. } else {
  24483. peg$currPos = s0;
  24484. s0 = peg$c1;
  24485. }
  24486. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24487. return s0;
  24488. }
  24489. function peg$parsecharacter() {
  24490. var s0, s1, s2;
  24491. var key = peg$currPos * 60 + 9,
  24492. cached = peg$cache[key];
  24493. if (cached) {
  24494. peg$currPos = cached.nextPos;
  24495. return cached.result;
  24496. }
  24497. s0 = peg$currPos;
  24498. if (input.charCodeAt(peg$currPos) === 36) {
  24499. s1 = peg$c28;
  24500. peg$currPos++;
  24501. } else {
  24502. s1 = peg$FAILED;
  24503. if (peg$silentFails === 0) { peg$fail(peg$c29); }
  24504. }
  24505. if (s1 !== peg$FAILED) {
  24506. if (input.length > peg$currPos) {
  24507. s2 = input.charAt(peg$currPos);
  24508. peg$currPos++;
  24509. } else {
  24510. s2 = peg$FAILED;
  24511. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  24512. }
  24513. if (s2 !== peg$FAILED) {
  24514. peg$reportedPos = s0;
  24515. s1 = peg$c31(s2);
  24516. s0 = s1;
  24517. } else {
  24518. peg$currPos = s0;
  24519. s0 = peg$c1;
  24520. }
  24521. } else {
  24522. peg$currPos = s0;
  24523. s0 = peg$c1;
  24524. }
  24525. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24526. return s0;
  24527. }
  24528. function peg$parsesymbol() {
  24529. var s0, s1, s2;
  24530. var key = peg$currPos * 60 + 10,
  24531. cached = peg$cache[key];
  24532. if (cached) {
  24533. peg$currPos = cached.nextPos;
  24534. return cached.result;
  24535. }
  24536. s0 = peg$currPos;
  24537. if (input.charCodeAt(peg$currPos) === 35) {
  24538. s1 = peg$c32;
  24539. peg$currPos++;
  24540. } else {
  24541. s1 = peg$FAILED;
  24542. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  24543. }
  24544. if (s1 !== peg$FAILED) {
  24545. s2 = peg$parsebareSymbol();
  24546. if (s2 !== peg$FAILED) {
  24547. peg$reportedPos = s0;
  24548. s1 = peg$c34(s2);
  24549. s0 = s1;
  24550. } else {
  24551. peg$currPos = s0;
  24552. s0 = peg$c1;
  24553. }
  24554. } else {
  24555. peg$currPos = s0;
  24556. s0 = peg$c1;
  24557. }
  24558. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24559. return s0;
  24560. }
  24561. function peg$parsebareSymbol() {
  24562. var s0, s1, s2;
  24563. var key = peg$currPos * 60 + 11,
  24564. cached = peg$cache[key];
  24565. if (cached) {
  24566. peg$currPos = cached.nextPos;
  24567. return cached.result;
  24568. }
  24569. s0 = peg$currPos;
  24570. s1 = peg$parseselector();
  24571. if (s1 === peg$FAILED) {
  24572. s1 = peg$parsebinarySelector();
  24573. if (s1 === peg$FAILED) {
  24574. s1 = peg$currPos;
  24575. s2 = peg$parsestring();
  24576. if (s2 !== peg$FAILED) {
  24577. peg$reportedPos = s1;
  24578. s2 = peg$c35(s2);
  24579. }
  24580. s1 = s2;
  24581. }
  24582. }
  24583. if (s1 !== peg$FAILED) {
  24584. peg$reportedPos = s0;
  24585. s1 = peg$c36(s1);
  24586. }
  24587. s0 = s1;
  24588. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24589. return s0;
  24590. }
  24591. function peg$parsenumber() {
  24592. var s0, s1;
  24593. var key = peg$currPos * 60 + 12,
  24594. cached = peg$cache[key];
  24595. if (cached) {
  24596. peg$currPos = cached.nextPos;
  24597. return cached.result;
  24598. }
  24599. s0 = peg$currPos;
  24600. s1 = peg$parsenumberExp();
  24601. if (s1 === peg$FAILED) {
  24602. s1 = peg$parsehex();
  24603. if (s1 === peg$FAILED) {
  24604. s1 = peg$parsefloat();
  24605. if (s1 === peg$FAILED) {
  24606. s1 = peg$parseinteger();
  24607. }
  24608. }
  24609. }
  24610. if (s1 !== peg$FAILED) {
  24611. peg$reportedPos = s0;
  24612. s1 = peg$c37(s1);
  24613. }
  24614. s0 = s1;
  24615. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24616. return s0;
  24617. }
  24618. function peg$parsenumberExp() {
  24619. var s0, s1, s2, s3, s4;
  24620. var key = peg$currPos * 60 + 13,
  24621. cached = peg$cache[key];
  24622. if (cached) {
  24623. peg$currPos = cached.nextPos;
  24624. return cached.result;
  24625. }
  24626. s0 = peg$currPos;
  24627. s1 = peg$currPos;
  24628. s2 = peg$parsefloat();
  24629. if (s2 === peg$FAILED) {
  24630. s2 = peg$parseinteger();
  24631. }
  24632. if (s2 !== peg$FAILED) {
  24633. if (input.charCodeAt(peg$currPos) === 101) {
  24634. s3 = peg$c38;
  24635. peg$currPos++;
  24636. } else {
  24637. s3 = peg$FAILED;
  24638. if (peg$silentFails === 0) { peg$fail(peg$c39); }
  24639. }
  24640. if (s3 !== peg$FAILED) {
  24641. s4 = peg$parseinteger();
  24642. if (s4 !== peg$FAILED) {
  24643. s2 = [s2, s3, s4];
  24644. s1 = s2;
  24645. } else {
  24646. peg$currPos = s1;
  24647. s1 = peg$c1;
  24648. }
  24649. } else {
  24650. peg$currPos = s1;
  24651. s1 = peg$c1;
  24652. }
  24653. } else {
  24654. peg$currPos = s1;
  24655. s1 = peg$c1;
  24656. }
  24657. if (s1 !== peg$FAILED) {
  24658. peg$reportedPos = s0;
  24659. s1 = peg$c40(s1);
  24660. }
  24661. s0 = s1;
  24662. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24663. return s0;
  24664. }
  24665. function peg$parsehex() {
  24666. var s0, s1, s2, s3, s4;
  24667. var key = peg$currPos * 60 + 14,
  24668. cached = peg$cache[key];
  24669. if (cached) {
  24670. peg$currPos = cached.nextPos;
  24671. return cached.result;
  24672. }
  24673. s0 = peg$currPos;
  24674. if (input.charCodeAt(peg$currPos) === 45) {
  24675. s1 = peg$c42;
  24676. peg$currPos++;
  24677. } else {
  24678. s1 = peg$FAILED;
  24679. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  24680. }
  24681. if (s1 === peg$FAILED) {
  24682. s1 = peg$c41;
  24683. }
  24684. if (s1 !== peg$FAILED) {
  24685. if (input.substr(peg$currPos, 3) === peg$c44) {
  24686. s2 = peg$c44;
  24687. peg$currPos += 3;
  24688. } else {
  24689. s2 = peg$FAILED;
  24690. if (peg$silentFails === 0) { peg$fail(peg$c45); }
  24691. }
  24692. if (s2 !== peg$FAILED) {
  24693. s3 = [];
  24694. if (peg$c46.test(input.charAt(peg$currPos))) {
  24695. s4 = input.charAt(peg$currPos);
  24696. peg$currPos++;
  24697. } else {
  24698. s4 = peg$FAILED;
  24699. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  24700. }
  24701. if (s4 !== peg$FAILED) {
  24702. while (s4 !== peg$FAILED) {
  24703. s3.push(s4);
  24704. if (peg$c46.test(input.charAt(peg$currPos))) {
  24705. s4 = input.charAt(peg$currPos);
  24706. peg$currPos++;
  24707. } else {
  24708. s4 = peg$FAILED;
  24709. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  24710. }
  24711. }
  24712. } else {
  24713. s3 = peg$c1;
  24714. }
  24715. if (s3 !== peg$FAILED) {
  24716. peg$reportedPos = s0;
  24717. s1 = peg$c48(s1, s3);
  24718. s0 = s1;
  24719. } else {
  24720. peg$currPos = s0;
  24721. s0 = peg$c1;
  24722. }
  24723. } else {
  24724. peg$currPos = s0;
  24725. s0 = peg$c1;
  24726. }
  24727. } else {
  24728. peg$currPos = s0;
  24729. s0 = peg$c1;
  24730. }
  24731. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24732. return s0;
  24733. }
  24734. function peg$parsefloat() {
  24735. var s0, s1, s2, s3, s4, s5;
  24736. var key = peg$currPos * 60 + 15,
  24737. cached = peg$cache[key];
  24738. if (cached) {
  24739. peg$currPos = cached.nextPos;
  24740. return cached.result;
  24741. }
  24742. s0 = peg$currPos;
  24743. if (input.charCodeAt(peg$currPos) === 45) {
  24744. s1 = peg$c42;
  24745. peg$currPos++;
  24746. } else {
  24747. s1 = peg$FAILED;
  24748. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  24749. }
  24750. if (s1 === peg$FAILED) {
  24751. s1 = peg$c41;
  24752. }
  24753. if (s1 !== peg$FAILED) {
  24754. s2 = [];
  24755. if (peg$c49.test(input.charAt(peg$currPos))) {
  24756. s3 = input.charAt(peg$currPos);
  24757. peg$currPos++;
  24758. } else {
  24759. s3 = peg$FAILED;
  24760. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24761. }
  24762. if (s3 !== peg$FAILED) {
  24763. while (s3 !== peg$FAILED) {
  24764. s2.push(s3);
  24765. if (peg$c49.test(input.charAt(peg$currPos))) {
  24766. s3 = input.charAt(peg$currPos);
  24767. peg$currPos++;
  24768. } else {
  24769. s3 = peg$FAILED;
  24770. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24771. }
  24772. }
  24773. } else {
  24774. s2 = peg$c1;
  24775. }
  24776. if (s2 !== peg$FAILED) {
  24777. if (input.charCodeAt(peg$currPos) === 46) {
  24778. s3 = peg$c51;
  24779. peg$currPos++;
  24780. } else {
  24781. s3 = peg$FAILED;
  24782. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  24783. }
  24784. if (s3 !== peg$FAILED) {
  24785. s4 = [];
  24786. if (peg$c49.test(input.charAt(peg$currPos))) {
  24787. s5 = input.charAt(peg$currPos);
  24788. peg$currPos++;
  24789. } else {
  24790. s5 = peg$FAILED;
  24791. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24792. }
  24793. if (s5 !== peg$FAILED) {
  24794. while (s5 !== peg$FAILED) {
  24795. s4.push(s5);
  24796. if (peg$c49.test(input.charAt(peg$currPos))) {
  24797. s5 = input.charAt(peg$currPos);
  24798. peg$currPos++;
  24799. } else {
  24800. s5 = peg$FAILED;
  24801. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24802. }
  24803. }
  24804. } else {
  24805. s4 = peg$c1;
  24806. }
  24807. if (s4 !== peg$FAILED) {
  24808. peg$reportedPos = s0;
  24809. s1 = peg$c53(s1, s2, s4);
  24810. s0 = s1;
  24811. } else {
  24812. peg$currPos = s0;
  24813. s0 = peg$c1;
  24814. }
  24815. } else {
  24816. peg$currPos = s0;
  24817. s0 = peg$c1;
  24818. }
  24819. } else {
  24820. peg$currPos = s0;
  24821. s0 = peg$c1;
  24822. }
  24823. } else {
  24824. peg$currPos = s0;
  24825. s0 = peg$c1;
  24826. }
  24827. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24828. return s0;
  24829. }
  24830. function peg$parseinteger() {
  24831. var s0, s1, s2, s3;
  24832. var key = peg$currPos * 60 + 16,
  24833. cached = peg$cache[key];
  24834. if (cached) {
  24835. peg$currPos = cached.nextPos;
  24836. return cached.result;
  24837. }
  24838. s0 = peg$currPos;
  24839. if (input.charCodeAt(peg$currPos) === 45) {
  24840. s1 = peg$c42;
  24841. peg$currPos++;
  24842. } else {
  24843. s1 = peg$FAILED;
  24844. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  24845. }
  24846. if (s1 === peg$FAILED) {
  24847. s1 = peg$c41;
  24848. }
  24849. if (s1 !== peg$FAILED) {
  24850. s2 = [];
  24851. if (peg$c49.test(input.charAt(peg$currPos))) {
  24852. s3 = input.charAt(peg$currPos);
  24853. peg$currPos++;
  24854. } else {
  24855. s3 = peg$FAILED;
  24856. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24857. }
  24858. if (s3 !== peg$FAILED) {
  24859. while (s3 !== peg$FAILED) {
  24860. s2.push(s3);
  24861. if (peg$c49.test(input.charAt(peg$currPos))) {
  24862. s3 = input.charAt(peg$currPos);
  24863. peg$currPos++;
  24864. } else {
  24865. s3 = peg$FAILED;
  24866. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24867. }
  24868. }
  24869. } else {
  24870. s2 = peg$c1;
  24871. }
  24872. if (s2 !== peg$FAILED) {
  24873. peg$reportedPos = s0;
  24874. s1 = peg$c54(s1, s2);
  24875. s0 = s1;
  24876. } else {
  24877. peg$currPos = s0;
  24878. s0 = peg$c1;
  24879. }
  24880. } else {
  24881. peg$currPos = s0;
  24882. s0 = peg$c1;
  24883. }
  24884. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24885. return s0;
  24886. }
  24887. function peg$parseliteralArray() {
  24888. var s0, s1, s2;
  24889. var key = peg$currPos * 60 + 17,
  24890. cached = peg$cache[key];
  24891. if (cached) {
  24892. peg$currPos = cached.nextPos;
  24893. return cached.result;
  24894. }
  24895. s0 = peg$currPos;
  24896. if (input.substr(peg$currPos, 2) === peg$c55) {
  24897. s1 = peg$c55;
  24898. peg$currPos += 2;
  24899. } else {
  24900. s1 = peg$FAILED;
  24901. if (peg$silentFails === 0) { peg$fail(peg$c56); }
  24902. }
  24903. if (s1 !== peg$FAILED) {
  24904. s2 = peg$parseliteralArrayRest();
  24905. if (s2 !== peg$FAILED) {
  24906. peg$reportedPos = s0;
  24907. s1 = peg$c34(s2);
  24908. s0 = s1;
  24909. } else {
  24910. peg$currPos = s0;
  24911. s0 = peg$c1;
  24912. }
  24913. } else {
  24914. peg$currPos = s0;
  24915. s0 = peg$c1;
  24916. }
  24917. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24918. return s0;
  24919. }
  24920. function peg$parsebareLiteralArray() {
  24921. var s0, s1, s2;
  24922. var key = peg$currPos * 60 + 18,
  24923. cached = peg$cache[key];
  24924. if (cached) {
  24925. peg$currPos = cached.nextPos;
  24926. return cached.result;
  24927. }
  24928. s0 = peg$currPos;
  24929. if (input.charCodeAt(peg$currPos) === 40) {
  24930. s1 = peg$c57;
  24931. peg$currPos++;
  24932. } else {
  24933. s1 = peg$FAILED;
  24934. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  24935. }
  24936. if (s1 !== peg$FAILED) {
  24937. s2 = peg$parseliteralArrayRest();
  24938. if (s2 !== peg$FAILED) {
  24939. peg$reportedPos = s0;
  24940. s1 = peg$c34(s2);
  24941. s0 = s1;
  24942. } else {
  24943. peg$currPos = s0;
  24944. s0 = peg$c1;
  24945. }
  24946. } else {
  24947. peg$currPos = s0;
  24948. s0 = peg$c1;
  24949. }
  24950. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24951. return s0;
  24952. }
  24953. function peg$parseliteralArrayRest() {
  24954. var s0, s1, s2, s3, s4;
  24955. var key = peg$currPos * 60 + 19,
  24956. cached = peg$cache[key];
  24957. if (cached) {
  24958. peg$currPos = cached.nextPos;
  24959. return cached.result;
  24960. }
  24961. s0 = peg$currPos;
  24962. s1 = [];
  24963. s2 = peg$currPos;
  24964. s3 = peg$parsews();
  24965. if (s3 !== peg$FAILED) {
  24966. s4 = peg$parseparseTimeLiteral();
  24967. if (s4 === peg$FAILED) {
  24968. s4 = peg$parsebareLiteralArray();
  24969. if (s4 === peg$FAILED) {
  24970. s4 = peg$parsebareSymbol();
  24971. }
  24972. }
  24973. if (s4 !== peg$FAILED) {
  24974. peg$reportedPos = s2;
  24975. s3 = peg$c59(s4);
  24976. s2 = s3;
  24977. } else {
  24978. peg$currPos = s2;
  24979. s2 = peg$c1;
  24980. }
  24981. } else {
  24982. peg$currPos = s2;
  24983. s2 = peg$c1;
  24984. }
  24985. while (s2 !== peg$FAILED) {
  24986. s1.push(s2);
  24987. s2 = peg$currPos;
  24988. s3 = peg$parsews();
  24989. if (s3 !== peg$FAILED) {
  24990. s4 = peg$parseparseTimeLiteral();
  24991. if (s4 === peg$FAILED) {
  24992. s4 = peg$parsebareLiteralArray();
  24993. if (s4 === peg$FAILED) {
  24994. s4 = peg$parsebareSymbol();
  24995. }
  24996. }
  24997. if (s4 !== peg$FAILED) {
  24998. peg$reportedPos = s2;
  24999. s3 = peg$c59(s4);
  25000. s2 = s3;
  25001. } else {
  25002. peg$currPos = s2;
  25003. s2 = peg$c1;
  25004. }
  25005. } else {
  25006. peg$currPos = s2;
  25007. s2 = peg$c1;
  25008. }
  25009. }
  25010. if (s1 !== peg$FAILED) {
  25011. s2 = peg$parsews();
  25012. if (s2 !== peg$FAILED) {
  25013. if (input.charCodeAt(peg$currPos) === 41) {
  25014. s3 = peg$c60;
  25015. peg$currPos++;
  25016. } else {
  25017. s3 = peg$FAILED;
  25018. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  25019. }
  25020. if (s3 !== peg$FAILED) {
  25021. peg$reportedPos = s0;
  25022. s1 = peg$c62(s1);
  25023. s0 = s1;
  25024. } else {
  25025. peg$currPos = s0;
  25026. s0 = peg$c1;
  25027. }
  25028. } else {
  25029. peg$currPos = s0;
  25030. s0 = peg$c1;
  25031. }
  25032. } else {
  25033. peg$currPos = s0;
  25034. s0 = peg$c1;
  25035. }
  25036. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25037. return s0;
  25038. }
  25039. function peg$parsedynamicArray() {
  25040. var s0, s1, s2, s3, s4, s5, s6;
  25041. var key = peg$currPos * 60 + 20,
  25042. cached = peg$cache[key];
  25043. if (cached) {
  25044. peg$currPos = cached.nextPos;
  25045. return cached.result;
  25046. }
  25047. s0 = peg$currPos;
  25048. if (input.charCodeAt(peg$currPos) === 123) {
  25049. s1 = peg$c63;
  25050. peg$currPos++;
  25051. } else {
  25052. s1 = peg$FAILED;
  25053. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  25054. }
  25055. if (s1 !== peg$FAILED) {
  25056. s2 = peg$parsews();
  25057. if (s2 !== peg$FAILED) {
  25058. s3 = peg$parseexpressions();
  25059. if (s3 === peg$FAILED) {
  25060. s3 = peg$c41;
  25061. }
  25062. if (s3 !== peg$FAILED) {
  25063. s4 = peg$parsews();
  25064. if (s4 !== peg$FAILED) {
  25065. if (input.charCodeAt(peg$currPos) === 46) {
  25066. s5 = peg$c51;
  25067. peg$currPos++;
  25068. } else {
  25069. s5 = peg$FAILED;
  25070. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25071. }
  25072. if (s5 === peg$FAILED) {
  25073. s5 = peg$c41;
  25074. }
  25075. if (s5 !== peg$FAILED) {
  25076. if (input.charCodeAt(peg$currPos) === 125) {
  25077. s6 = peg$c65;
  25078. peg$currPos++;
  25079. } else {
  25080. s6 = peg$FAILED;
  25081. if (peg$silentFails === 0) { peg$fail(peg$c66); }
  25082. }
  25083. if (s6 !== peg$FAILED) {
  25084. peg$reportedPos = s0;
  25085. s1 = peg$c67(s3);
  25086. s0 = s1;
  25087. } else {
  25088. peg$currPos = s0;
  25089. s0 = peg$c1;
  25090. }
  25091. } else {
  25092. peg$currPos = s0;
  25093. s0 = peg$c1;
  25094. }
  25095. } else {
  25096. peg$currPos = s0;
  25097. s0 = peg$c1;
  25098. }
  25099. } else {
  25100. peg$currPos = s0;
  25101. s0 = peg$c1;
  25102. }
  25103. } else {
  25104. peg$currPos = s0;
  25105. s0 = peg$c1;
  25106. }
  25107. } else {
  25108. peg$currPos = s0;
  25109. s0 = peg$c1;
  25110. }
  25111. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25112. return s0;
  25113. }
  25114. function peg$parsedynamicDictionary() {
  25115. var s0, s1, s2, s3, s4, s5;
  25116. var key = peg$currPos * 60 + 21,
  25117. cached = peg$cache[key];
  25118. if (cached) {
  25119. peg$currPos = cached.nextPos;
  25120. return cached.result;
  25121. }
  25122. s0 = peg$currPos;
  25123. if (input.substr(peg$currPos, 2) === peg$c68) {
  25124. s1 = peg$c68;
  25125. peg$currPos += 2;
  25126. } else {
  25127. s1 = peg$FAILED;
  25128. if (peg$silentFails === 0) { peg$fail(peg$c69); }
  25129. }
  25130. if (s1 !== peg$FAILED) {
  25131. s2 = peg$parsews();
  25132. if (s2 !== peg$FAILED) {
  25133. s3 = peg$parseassociations();
  25134. if (s3 === peg$FAILED) {
  25135. s3 = peg$c41;
  25136. }
  25137. if (s3 !== peg$FAILED) {
  25138. s4 = peg$parsews();
  25139. if (s4 !== peg$FAILED) {
  25140. if (input.charCodeAt(peg$currPos) === 125) {
  25141. s5 = peg$c65;
  25142. peg$currPos++;
  25143. } else {
  25144. s5 = peg$FAILED;
  25145. if (peg$silentFails === 0) { peg$fail(peg$c66); }
  25146. }
  25147. if (s5 !== peg$FAILED) {
  25148. peg$reportedPos = s0;
  25149. s1 = peg$c70(s3);
  25150. s0 = s1;
  25151. } else {
  25152. peg$currPos = s0;
  25153. s0 = peg$c1;
  25154. }
  25155. } else {
  25156. peg$currPos = s0;
  25157. s0 = peg$c1;
  25158. }
  25159. } else {
  25160. peg$currPos = s0;
  25161. s0 = peg$c1;
  25162. }
  25163. } else {
  25164. peg$currPos = s0;
  25165. s0 = peg$c1;
  25166. }
  25167. } else {
  25168. peg$currPos = s0;
  25169. s0 = peg$c1;
  25170. }
  25171. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25172. return s0;
  25173. }
  25174. function peg$parsepseudoVariable() {
  25175. var s0, s1, s2;
  25176. var key = peg$currPos * 60 + 22,
  25177. cached = peg$cache[key];
  25178. if (cached) {
  25179. peg$currPos = cached.nextPos;
  25180. return cached.result;
  25181. }
  25182. s0 = peg$currPos;
  25183. s1 = peg$currPos;
  25184. if (input.substr(peg$currPos, 4) === peg$c71) {
  25185. s2 = peg$c71;
  25186. peg$currPos += 4;
  25187. } else {
  25188. s2 = peg$FAILED;
  25189. if (peg$silentFails === 0) { peg$fail(peg$c72); }
  25190. }
  25191. if (s2 !== peg$FAILED) {
  25192. peg$reportedPos = s1;
  25193. s2 = peg$c73();
  25194. }
  25195. s1 = s2;
  25196. if (s1 === peg$FAILED) {
  25197. s1 = peg$currPos;
  25198. if (input.substr(peg$currPos, 5) === peg$c74) {
  25199. s2 = peg$c74;
  25200. peg$currPos += 5;
  25201. } else {
  25202. s2 = peg$FAILED;
  25203. if (peg$silentFails === 0) { peg$fail(peg$c75); }
  25204. }
  25205. if (s2 !== peg$FAILED) {
  25206. peg$reportedPos = s1;
  25207. s2 = peg$c76();
  25208. }
  25209. s1 = s2;
  25210. if (s1 === peg$FAILED) {
  25211. s1 = peg$currPos;
  25212. if (input.substr(peg$currPos, 3) === peg$c77) {
  25213. s2 = peg$c77;
  25214. peg$currPos += 3;
  25215. } else {
  25216. s2 = peg$FAILED;
  25217. if (peg$silentFails === 0) { peg$fail(peg$c78); }
  25218. }
  25219. if (s2 !== peg$FAILED) {
  25220. peg$reportedPos = s1;
  25221. s2 = peg$c79();
  25222. }
  25223. s1 = s2;
  25224. }
  25225. }
  25226. if (s1 !== peg$FAILED) {
  25227. peg$reportedPos = s0;
  25228. s1 = peg$c80(s1);
  25229. }
  25230. s0 = s1;
  25231. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25232. return s0;
  25233. }
  25234. function peg$parseparseTimeLiteral() {
  25235. var s0;
  25236. var key = peg$currPos * 60 + 23,
  25237. cached = peg$cache[key];
  25238. if (cached) {
  25239. peg$currPos = cached.nextPos;
  25240. return cached.result;
  25241. }
  25242. s0 = peg$parsepseudoVariable();
  25243. if (s0 === peg$FAILED) {
  25244. s0 = peg$parsenumber();
  25245. if (s0 === peg$FAILED) {
  25246. s0 = peg$parseliteralArray();
  25247. if (s0 === peg$FAILED) {
  25248. s0 = peg$parsestring();
  25249. if (s0 === peg$FAILED) {
  25250. s0 = peg$parsesymbol();
  25251. if (s0 === peg$FAILED) {
  25252. s0 = peg$parsecharacter();
  25253. }
  25254. }
  25255. }
  25256. }
  25257. }
  25258. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25259. return s0;
  25260. }
  25261. function peg$parseruntimeLiteral() {
  25262. var s0;
  25263. var key = peg$currPos * 60 + 24,
  25264. cached = peg$cache[key];
  25265. if (cached) {
  25266. peg$currPos = cached.nextPos;
  25267. return cached.result;
  25268. }
  25269. s0 = peg$parsedynamicDictionary();
  25270. if (s0 === peg$FAILED) {
  25271. s0 = peg$parsedynamicArray();
  25272. if (s0 === peg$FAILED) {
  25273. s0 = peg$parseblock();
  25274. }
  25275. }
  25276. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25277. return s0;
  25278. }
  25279. function peg$parseliteral() {
  25280. var s0;
  25281. var key = peg$currPos * 60 + 25,
  25282. cached = peg$cache[key];
  25283. if (cached) {
  25284. peg$currPos = cached.nextPos;
  25285. return cached.result;
  25286. }
  25287. s0 = peg$parseruntimeLiteral();
  25288. if (s0 === peg$FAILED) {
  25289. s0 = peg$parseparseTimeLiteral();
  25290. }
  25291. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25292. return s0;
  25293. }
  25294. function peg$parsevariable() {
  25295. var s0, s1;
  25296. var key = peg$currPos * 60 + 26,
  25297. cached = peg$cache[key];
  25298. if (cached) {
  25299. peg$currPos = cached.nextPos;
  25300. return cached.result;
  25301. }
  25302. s0 = peg$currPos;
  25303. s1 = peg$parseidentifier();
  25304. if (s1 !== peg$FAILED) {
  25305. peg$reportedPos = s0;
  25306. s1 = peg$c81(s1);
  25307. }
  25308. s0 = s1;
  25309. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25310. return s0;
  25311. }
  25312. function peg$parsekeywordPair() {
  25313. var s0, s1, s2, s3, s4;
  25314. var key = peg$currPos * 60 + 27,
  25315. cached = peg$cache[key];
  25316. if (cached) {
  25317. peg$currPos = cached.nextPos;
  25318. return cached.result;
  25319. }
  25320. s0 = peg$currPos;
  25321. s1 = peg$parsews();
  25322. if (s1 !== peg$FAILED) {
  25323. s2 = peg$parsekeyword();
  25324. if (s2 !== peg$FAILED) {
  25325. s3 = peg$parsews();
  25326. if (s3 !== peg$FAILED) {
  25327. s4 = peg$parsebinarySend();
  25328. if (s4 !== peg$FAILED) {
  25329. peg$reportedPos = s0;
  25330. s1 = peg$c82(s2, s4);
  25331. s0 = s1;
  25332. } else {
  25333. peg$currPos = s0;
  25334. s0 = peg$c1;
  25335. }
  25336. } else {
  25337. peg$currPos = s0;
  25338. s0 = peg$c1;
  25339. }
  25340. } else {
  25341. peg$currPos = s0;
  25342. s0 = peg$c1;
  25343. }
  25344. } else {
  25345. peg$currPos = s0;
  25346. s0 = peg$c1;
  25347. }
  25348. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25349. return s0;
  25350. }
  25351. function peg$parsebinarySelector() {
  25352. var s0, s1, s2;
  25353. var key = peg$currPos * 60 + 28,
  25354. cached = peg$cache[key];
  25355. if (cached) {
  25356. peg$currPos = cached.nextPos;
  25357. return cached.result;
  25358. }
  25359. s0 = peg$currPos;
  25360. s1 = [];
  25361. if (peg$c83.test(input.charAt(peg$currPos))) {
  25362. s2 = input.charAt(peg$currPos);
  25363. peg$currPos++;
  25364. } else {
  25365. s2 = peg$FAILED;
  25366. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  25367. }
  25368. if (s2 !== peg$FAILED) {
  25369. while (s2 !== peg$FAILED) {
  25370. s1.push(s2);
  25371. if (peg$c83.test(input.charAt(peg$currPos))) {
  25372. s2 = input.charAt(peg$currPos);
  25373. peg$currPos++;
  25374. } else {
  25375. s2 = peg$FAILED;
  25376. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  25377. }
  25378. }
  25379. } else {
  25380. s1 = peg$c1;
  25381. }
  25382. if (s1 !== peg$FAILED) {
  25383. peg$reportedPos = s0;
  25384. s1 = peg$c85(s1);
  25385. }
  25386. s0 = s1;
  25387. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25388. return s0;
  25389. }
  25390. function peg$parsekeywordPattern() {
  25391. var s0, s1, s2, s3, s4, s5, s6;
  25392. var key = peg$currPos * 60 + 29,
  25393. cached = peg$cache[key];
  25394. if (cached) {
  25395. peg$currPos = cached.nextPos;
  25396. return cached.result;
  25397. }
  25398. s0 = peg$currPos;
  25399. s1 = [];
  25400. s2 = peg$currPos;
  25401. s3 = peg$parsews();
  25402. if (s3 !== peg$FAILED) {
  25403. s4 = peg$parsekeyword();
  25404. if (s4 !== peg$FAILED) {
  25405. s5 = peg$parsews();
  25406. if (s5 !== peg$FAILED) {
  25407. s6 = peg$parseidentifier();
  25408. if (s6 !== peg$FAILED) {
  25409. peg$reportedPos = s2;
  25410. s3 = peg$c82(s4, s6);
  25411. s2 = s3;
  25412. } else {
  25413. peg$currPos = s2;
  25414. s2 = peg$c1;
  25415. }
  25416. } else {
  25417. peg$currPos = s2;
  25418. s2 = peg$c1;
  25419. }
  25420. } else {
  25421. peg$currPos = s2;
  25422. s2 = peg$c1;
  25423. }
  25424. } else {
  25425. peg$currPos = s2;
  25426. s2 = peg$c1;
  25427. }
  25428. if (s2 !== peg$FAILED) {
  25429. while (s2 !== peg$FAILED) {
  25430. s1.push(s2);
  25431. s2 = peg$currPos;
  25432. s3 = peg$parsews();
  25433. if (s3 !== peg$FAILED) {
  25434. s4 = peg$parsekeyword();
  25435. if (s4 !== peg$FAILED) {
  25436. s5 = peg$parsews();
  25437. if (s5 !== peg$FAILED) {
  25438. s6 = peg$parseidentifier();
  25439. if (s6 !== peg$FAILED) {
  25440. peg$reportedPos = s2;
  25441. s3 = peg$c82(s4, s6);
  25442. s2 = s3;
  25443. } else {
  25444. peg$currPos = s2;
  25445. s2 = peg$c1;
  25446. }
  25447. } else {
  25448. peg$currPos = s2;
  25449. s2 = peg$c1;
  25450. }
  25451. } else {
  25452. peg$currPos = s2;
  25453. s2 = peg$c1;
  25454. }
  25455. } else {
  25456. peg$currPos = s2;
  25457. s2 = peg$c1;
  25458. }
  25459. }
  25460. } else {
  25461. s1 = peg$c1;
  25462. }
  25463. if (s1 !== peg$FAILED) {
  25464. peg$reportedPos = s0;
  25465. s1 = peg$c86(s1);
  25466. }
  25467. s0 = s1;
  25468. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25469. return s0;
  25470. }
  25471. function peg$parsebinaryPattern() {
  25472. var s0, s1, s2, s3, s4;
  25473. var key = peg$currPos * 60 + 30,
  25474. cached = peg$cache[key];
  25475. if (cached) {
  25476. peg$currPos = cached.nextPos;
  25477. return cached.result;
  25478. }
  25479. s0 = peg$currPos;
  25480. s1 = peg$parsews();
  25481. if (s1 !== peg$FAILED) {
  25482. s2 = peg$parsebinarySelector();
  25483. if (s2 !== peg$FAILED) {
  25484. s3 = peg$parsews();
  25485. if (s3 !== peg$FAILED) {
  25486. s4 = peg$parseidentifier();
  25487. if (s4 !== peg$FAILED) {
  25488. peg$reportedPos = s0;
  25489. s1 = peg$c87(s2, s4);
  25490. s0 = s1;
  25491. } else {
  25492. peg$currPos = s0;
  25493. s0 = peg$c1;
  25494. }
  25495. } else {
  25496. peg$currPos = s0;
  25497. s0 = peg$c1;
  25498. }
  25499. } else {
  25500. peg$currPos = s0;
  25501. s0 = peg$c1;
  25502. }
  25503. } else {
  25504. peg$currPos = s0;
  25505. s0 = peg$c1;
  25506. }
  25507. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25508. return s0;
  25509. }
  25510. function peg$parseunaryPattern() {
  25511. var s0, s1, s2;
  25512. var key = peg$currPos * 60 + 31,
  25513. cached = peg$cache[key];
  25514. if (cached) {
  25515. peg$currPos = cached.nextPos;
  25516. return cached.result;
  25517. }
  25518. s0 = peg$currPos;
  25519. s1 = peg$parsews();
  25520. if (s1 !== peg$FAILED) {
  25521. s2 = peg$parseidentifier();
  25522. if (s2 !== peg$FAILED) {
  25523. peg$reportedPos = s0;
  25524. s1 = peg$c88(s2);
  25525. s0 = s1;
  25526. } else {
  25527. peg$currPos = s0;
  25528. s0 = peg$c1;
  25529. }
  25530. } else {
  25531. peg$currPos = s0;
  25532. s0 = peg$c1;
  25533. }
  25534. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25535. return s0;
  25536. }
  25537. function peg$parseexpression() {
  25538. var s0;
  25539. var key = peg$currPos * 60 + 32,
  25540. cached = peg$cache[key];
  25541. if (cached) {
  25542. peg$currPos = cached.nextPos;
  25543. return cached.result;
  25544. }
  25545. s0 = peg$parseassignment();
  25546. if (s0 === peg$FAILED) {
  25547. s0 = peg$parsecascade();
  25548. if (s0 === peg$FAILED) {
  25549. s0 = peg$parsekeywordSend();
  25550. if (s0 === peg$FAILED) {
  25551. s0 = peg$parsebinarySend();
  25552. }
  25553. }
  25554. }
  25555. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25556. return s0;
  25557. }
  25558. function peg$parseexpressionList() {
  25559. var s0, s1, s2, s3, s4;
  25560. var key = peg$currPos * 60 + 33,
  25561. cached = peg$cache[key];
  25562. if (cached) {
  25563. peg$currPos = cached.nextPos;
  25564. return cached.result;
  25565. }
  25566. s0 = peg$currPos;
  25567. s1 = peg$parsews();
  25568. if (s1 !== peg$FAILED) {
  25569. if (input.charCodeAt(peg$currPos) === 46) {
  25570. s2 = peg$c51;
  25571. peg$currPos++;
  25572. } else {
  25573. s2 = peg$FAILED;
  25574. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25575. }
  25576. if (s2 !== peg$FAILED) {
  25577. s3 = peg$parsews();
  25578. if (s3 !== peg$FAILED) {
  25579. s4 = peg$parseexpression();
  25580. if (s4 !== peg$FAILED) {
  25581. peg$reportedPos = s0;
  25582. s1 = peg$c89(s4);
  25583. s0 = s1;
  25584. } else {
  25585. peg$currPos = s0;
  25586. s0 = peg$c1;
  25587. }
  25588. } else {
  25589. peg$currPos = s0;
  25590. s0 = peg$c1;
  25591. }
  25592. } else {
  25593. peg$currPos = s0;
  25594. s0 = peg$c1;
  25595. }
  25596. } else {
  25597. peg$currPos = s0;
  25598. s0 = peg$c1;
  25599. }
  25600. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25601. return s0;
  25602. }
  25603. function peg$parseexpressions() {
  25604. var s0, s1, s2, s3;
  25605. var key = peg$currPos * 60 + 34,
  25606. cached = peg$cache[key];
  25607. if (cached) {
  25608. peg$currPos = cached.nextPos;
  25609. return cached.result;
  25610. }
  25611. s0 = peg$currPos;
  25612. s1 = peg$parseexpression();
  25613. if (s1 !== peg$FAILED) {
  25614. s2 = [];
  25615. s3 = peg$parseexpressionList();
  25616. while (s3 !== peg$FAILED) {
  25617. s2.push(s3);
  25618. s3 = peg$parseexpressionList();
  25619. }
  25620. if (s2 !== peg$FAILED) {
  25621. peg$reportedPos = s0;
  25622. s1 = peg$c90(s1, s2);
  25623. s0 = s1;
  25624. } else {
  25625. peg$currPos = s0;
  25626. s0 = peg$c1;
  25627. }
  25628. } else {
  25629. peg$currPos = s0;
  25630. s0 = peg$c1;
  25631. }
  25632. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25633. return s0;
  25634. }
  25635. function peg$parseassignment() {
  25636. var s0, s1, s2, s3, s4, s5;
  25637. var key = peg$currPos * 60 + 35,
  25638. cached = peg$cache[key];
  25639. if (cached) {
  25640. peg$currPos = cached.nextPos;
  25641. return cached.result;
  25642. }
  25643. s0 = peg$currPos;
  25644. s1 = peg$parsevariable();
  25645. if (s1 !== peg$FAILED) {
  25646. s2 = peg$parsews();
  25647. if (s2 !== peg$FAILED) {
  25648. if (input.substr(peg$currPos, 2) === peg$c91) {
  25649. s3 = peg$c91;
  25650. peg$currPos += 2;
  25651. } else {
  25652. s3 = peg$FAILED;
  25653. if (peg$silentFails === 0) { peg$fail(peg$c92); }
  25654. }
  25655. if (s3 !== peg$FAILED) {
  25656. s4 = peg$parsews();
  25657. if (s4 !== peg$FAILED) {
  25658. s5 = peg$parseexpression();
  25659. if (s5 !== peg$FAILED) {
  25660. peg$reportedPos = s0;
  25661. s1 = peg$c93(s1, s5);
  25662. s0 = s1;
  25663. } else {
  25664. peg$currPos = s0;
  25665. s0 = peg$c1;
  25666. }
  25667. } else {
  25668. peg$currPos = s0;
  25669. s0 = peg$c1;
  25670. }
  25671. } else {
  25672. peg$currPos = s0;
  25673. s0 = peg$c1;
  25674. }
  25675. } else {
  25676. peg$currPos = s0;
  25677. s0 = peg$c1;
  25678. }
  25679. } else {
  25680. peg$currPos = s0;
  25681. s0 = peg$c1;
  25682. }
  25683. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25684. return s0;
  25685. }
  25686. function peg$parseret() {
  25687. var s0, s1, s2, s3, s4, s5;
  25688. var key = peg$currPos * 60 + 36,
  25689. cached = peg$cache[key];
  25690. if (cached) {
  25691. peg$currPos = cached.nextPos;
  25692. return cached.result;
  25693. }
  25694. s0 = peg$currPos;
  25695. if (input.charCodeAt(peg$currPos) === 94) {
  25696. s1 = peg$c94;
  25697. peg$currPos++;
  25698. } else {
  25699. s1 = peg$FAILED;
  25700. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  25701. }
  25702. if (s1 !== peg$FAILED) {
  25703. s2 = peg$parsews();
  25704. if (s2 !== peg$FAILED) {
  25705. s3 = peg$parseexpression();
  25706. if (s3 !== peg$FAILED) {
  25707. s4 = peg$parsews();
  25708. if (s4 !== peg$FAILED) {
  25709. if (input.charCodeAt(peg$currPos) === 46) {
  25710. s5 = peg$c51;
  25711. peg$currPos++;
  25712. } else {
  25713. s5 = peg$FAILED;
  25714. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25715. }
  25716. if (s5 === peg$FAILED) {
  25717. s5 = peg$c41;
  25718. }
  25719. if (s5 !== peg$FAILED) {
  25720. peg$reportedPos = s0;
  25721. s1 = peg$c96(s3);
  25722. s0 = s1;
  25723. } else {
  25724. peg$currPos = s0;
  25725. s0 = peg$c1;
  25726. }
  25727. } else {
  25728. peg$currPos = s0;
  25729. s0 = peg$c1;
  25730. }
  25731. } else {
  25732. peg$currPos = s0;
  25733. s0 = peg$c1;
  25734. }
  25735. } else {
  25736. peg$currPos = s0;
  25737. s0 = peg$c1;
  25738. }
  25739. } else {
  25740. peg$currPos = s0;
  25741. s0 = peg$c1;
  25742. }
  25743. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25744. return s0;
  25745. }
  25746. function peg$parsetemps() {
  25747. var s0, s1, s2, s3, s4, s5;
  25748. var key = peg$currPos * 60 + 37,
  25749. cached = peg$cache[key];
  25750. if (cached) {
  25751. peg$currPos = cached.nextPos;
  25752. return cached.result;
  25753. }
  25754. s0 = peg$currPos;
  25755. if (input.charCodeAt(peg$currPos) === 124) {
  25756. s1 = peg$c97;
  25757. peg$currPos++;
  25758. } else {
  25759. s1 = peg$FAILED;
  25760. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  25761. }
  25762. if (s1 !== peg$FAILED) {
  25763. s2 = [];
  25764. s3 = peg$currPos;
  25765. s4 = peg$parsews();
  25766. if (s4 !== peg$FAILED) {
  25767. s5 = peg$parseidentifier();
  25768. if (s5 !== peg$FAILED) {
  25769. peg$reportedPos = s3;
  25770. s4 = peg$c99(s5);
  25771. s3 = s4;
  25772. } else {
  25773. peg$currPos = s3;
  25774. s3 = peg$c1;
  25775. }
  25776. } else {
  25777. peg$currPos = s3;
  25778. s3 = peg$c1;
  25779. }
  25780. while (s3 !== peg$FAILED) {
  25781. s2.push(s3);
  25782. s3 = peg$currPos;
  25783. s4 = peg$parsews();
  25784. if (s4 !== peg$FAILED) {
  25785. s5 = peg$parseidentifier();
  25786. if (s5 !== peg$FAILED) {
  25787. peg$reportedPos = s3;
  25788. s4 = peg$c99(s5);
  25789. s3 = s4;
  25790. } else {
  25791. peg$currPos = s3;
  25792. s3 = peg$c1;
  25793. }
  25794. } else {
  25795. peg$currPos = s3;
  25796. s3 = peg$c1;
  25797. }
  25798. }
  25799. if (s2 !== peg$FAILED) {
  25800. s3 = peg$parsews();
  25801. if (s3 !== peg$FAILED) {
  25802. if (input.charCodeAt(peg$currPos) === 124) {
  25803. s4 = peg$c97;
  25804. peg$currPos++;
  25805. } else {
  25806. s4 = peg$FAILED;
  25807. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  25808. }
  25809. if (s4 !== peg$FAILED) {
  25810. peg$reportedPos = s0;
  25811. s1 = peg$c100(s2);
  25812. s0 = s1;
  25813. } else {
  25814. peg$currPos = s0;
  25815. s0 = peg$c1;
  25816. }
  25817. } else {
  25818. peg$currPos = s0;
  25819. s0 = peg$c1;
  25820. }
  25821. } else {
  25822. peg$currPos = s0;
  25823. s0 = peg$c1;
  25824. }
  25825. } else {
  25826. peg$currPos = s0;
  25827. s0 = peg$c1;
  25828. }
  25829. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25830. return s0;
  25831. }
  25832. function peg$parseblockParamList() {
  25833. var s0, s1, s2, s3, s4, s5, s6;
  25834. var key = peg$currPos * 60 + 38,
  25835. cached = peg$cache[key];
  25836. if (cached) {
  25837. peg$currPos = cached.nextPos;
  25838. return cached.result;
  25839. }
  25840. s0 = peg$currPos;
  25841. s1 = [];
  25842. s2 = peg$currPos;
  25843. s3 = peg$parsews();
  25844. if (s3 !== peg$FAILED) {
  25845. if (input.charCodeAt(peg$currPos) === 58) {
  25846. s4 = peg$c13;
  25847. peg$currPos++;
  25848. } else {
  25849. s4 = peg$FAILED;
  25850. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  25851. }
  25852. if (s4 !== peg$FAILED) {
  25853. s5 = peg$parsews();
  25854. if (s5 !== peg$FAILED) {
  25855. s6 = peg$parseidentifier();
  25856. if (s6 !== peg$FAILED) {
  25857. peg$reportedPos = s2;
  25858. s3 = peg$c101(s6);
  25859. s2 = s3;
  25860. } else {
  25861. peg$currPos = s2;
  25862. s2 = peg$c1;
  25863. }
  25864. } else {
  25865. peg$currPos = s2;
  25866. s2 = peg$c1;
  25867. }
  25868. } else {
  25869. peg$currPos = s2;
  25870. s2 = peg$c1;
  25871. }
  25872. } else {
  25873. peg$currPos = s2;
  25874. s2 = peg$c1;
  25875. }
  25876. if (s2 !== peg$FAILED) {
  25877. while (s2 !== peg$FAILED) {
  25878. s1.push(s2);
  25879. s2 = peg$currPos;
  25880. s3 = peg$parsews();
  25881. if (s3 !== peg$FAILED) {
  25882. if (input.charCodeAt(peg$currPos) === 58) {
  25883. s4 = peg$c13;
  25884. peg$currPos++;
  25885. } else {
  25886. s4 = peg$FAILED;
  25887. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  25888. }
  25889. if (s4 !== peg$FAILED) {
  25890. s5 = peg$parsews();
  25891. if (s5 !== peg$FAILED) {
  25892. s6 = peg$parseidentifier();
  25893. if (s6 !== peg$FAILED) {
  25894. peg$reportedPos = s2;
  25895. s3 = peg$c101(s6);
  25896. s2 = s3;
  25897. } else {
  25898. peg$currPos = s2;
  25899. s2 = peg$c1;
  25900. }
  25901. } else {
  25902. peg$currPos = s2;
  25903. s2 = peg$c1;
  25904. }
  25905. } else {
  25906. peg$currPos = s2;
  25907. s2 = peg$c1;
  25908. }
  25909. } else {
  25910. peg$currPos = s2;
  25911. s2 = peg$c1;
  25912. }
  25913. }
  25914. } else {
  25915. s1 = peg$c1;
  25916. }
  25917. if (s1 !== peg$FAILED) {
  25918. s2 = peg$parsews();
  25919. if (s2 !== peg$FAILED) {
  25920. if (input.charCodeAt(peg$currPos) === 124) {
  25921. s3 = peg$c97;
  25922. peg$currPos++;
  25923. } else {
  25924. s3 = peg$FAILED;
  25925. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  25926. }
  25927. if (s3 !== peg$FAILED) {
  25928. peg$reportedPos = s0;
  25929. s1 = peg$c102(s1);
  25930. s0 = s1;
  25931. } else {
  25932. peg$currPos = s0;
  25933. s0 = peg$c1;
  25934. }
  25935. } else {
  25936. peg$currPos = s0;
  25937. s0 = peg$c1;
  25938. }
  25939. } else {
  25940. peg$currPos = s0;
  25941. s0 = peg$c1;
  25942. }
  25943. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25944. return s0;
  25945. }
  25946. function peg$parsesubexpression() {
  25947. var s0, s1, s2, s3, s4, s5;
  25948. var key = peg$currPos * 60 + 39,
  25949. cached = peg$cache[key];
  25950. if (cached) {
  25951. peg$currPos = cached.nextPos;
  25952. return cached.result;
  25953. }
  25954. s0 = peg$currPos;
  25955. if (input.charCodeAt(peg$currPos) === 40) {
  25956. s1 = peg$c57;
  25957. peg$currPos++;
  25958. } else {
  25959. s1 = peg$FAILED;
  25960. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  25961. }
  25962. if (s1 !== peg$FAILED) {
  25963. s2 = peg$parsews();
  25964. if (s2 !== peg$FAILED) {
  25965. s3 = peg$parseexpression();
  25966. if (s3 !== peg$FAILED) {
  25967. s4 = peg$parsews();
  25968. if (s4 !== peg$FAILED) {
  25969. if (input.charCodeAt(peg$currPos) === 41) {
  25970. s5 = peg$c60;
  25971. peg$currPos++;
  25972. } else {
  25973. s5 = peg$FAILED;
  25974. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  25975. }
  25976. if (s5 !== peg$FAILED) {
  25977. peg$reportedPos = s0;
  25978. s1 = peg$c89(s3);
  25979. s0 = s1;
  25980. } else {
  25981. peg$currPos = s0;
  25982. s0 = peg$c1;
  25983. }
  25984. } else {
  25985. peg$currPos = s0;
  25986. s0 = peg$c1;
  25987. }
  25988. } else {
  25989. peg$currPos = s0;
  25990. s0 = peg$c1;
  25991. }
  25992. } else {
  25993. peg$currPos = s0;
  25994. s0 = peg$c1;
  25995. }
  25996. } else {
  25997. peg$currPos = s0;
  25998. s0 = peg$c1;
  25999. }
  26000. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26001. return s0;
  26002. }
  26003. function peg$parsestatements() {
  26004. var s0, s1, s2, s3, s4, s5, s6, s7;
  26005. var key = peg$currPos * 60 + 40,
  26006. cached = peg$cache[key];
  26007. if (cached) {
  26008. peg$currPos = cached.nextPos;
  26009. return cached.result;
  26010. }
  26011. s0 = peg$currPos;
  26012. s1 = peg$parseret();
  26013. if (s1 !== peg$FAILED) {
  26014. s2 = [];
  26015. if (input.charCodeAt(peg$currPos) === 46) {
  26016. s3 = peg$c51;
  26017. peg$currPos++;
  26018. } else {
  26019. s3 = peg$FAILED;
  26020. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26021. }
  26022. while (s3 !== peg$FAILED) {
  26023. s2.push(s3);
  26024. if (input.charCodeAt(peg$currPos) === 46) {
  26025. s3 = peg$c51;
  26026. peg$currPos++;
  26027. } else {
  26028. s3 = peg$FAILED;
  26029. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26030. }
  26031. }
  26032. if (s2 !== peg$FAILED) {
  26033. peg$reportedPos = s0;
  26034. s1 = peg$c103(s1);
  26035. s0 = s1;
  26036. } else {
  26037. peg$currPos = s0;
  26038. s0 = peg$c1;
  26039. }
  26040. } else {
  26041. peg$currPos = s0;
  26042. s0 = peg$c1;
  26043. }
  26044. if (s0 === peg$FAILED) {
  26045. s0 = peg$currPos;
  26046. s1 = peg$parseexpressions();
  26047. if (s1 !== peg$FAILED) {
  26048. s2 = peg$parsews();
  26049. if (s2 !== peg$FAILED) {
  26050. s3 = [];
  26051. if (input.charCodeAt(peg$currPos) === 46) {
  26052. s4 = peg$c51;
  26053. peg$currPos++;
  26054. } else {
  26055. s4 = peg$FAILED;
  26056. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26057. }
  26058. if (s4 !== peg$FAILED) {
  26059. while (s4 !== peg$FAILED) {
  26060. s3.push(s4);
  26061. if (input.charCodeAt(peg$currPos) === 46) {
  26062. s4 = peg$c51;
  26063. peg$currPos++;
  26064. } else {
  26065. s4 = peg$FAILED;
  26066. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26067. }
  26068. }
  26069. } else {
  26070. s3 = peg$c1;
  26071. }
  26072. if (s3 !== peg$FAILED) {
  26073. s4 = peg$parsews();
  26074. if (s4 !== peg$FAILED) {
  26075. s5 = peg$parseret();
  26076. if (s5 !== peg$FAILED) {
  26077. s6 = [];
  26078. if (input.charCodeAt(peg$currPos) === 46) {
  26079. s7 = peg$c51;
  26080. peg$currPos++;
  26081. } else {
  26082. s7 = peg$FAILED;
  26083. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26084. }
  26085. while (s7 !== peg$FAILED) {
  26086. s6.push(s7);
  26087. if (input.charCodeAt(peg$currPos) === 46) {
  26088. s7 = peg$c51;
  26089. peg$currPos++;
  26090. } else {
  26091. s7 = peg$FAILED;
  26092. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26093. }
  26094. }
  26095. if (s6 !== peg$FAILED) {
  26096. peg$reportedPos = s0;
  26097. s1 = peg$c104(s1, s5);
  26098. s0 = s1;
  26099. } else {
  26100. peg$currPos = s0;
  26101. s0 = peg$c1;
  26102. }
  26103. } else {
  26104. peg$currPos = s0;
  26105. s0 = peg$c1;
  26106. }
  26107. } else {
  26108. peg$currPos = s0;
  26109. s0 = peg$c1;
  26110. }
  26111. } else {
  26112. peg$currPos = s0;
  26113. s0 = peg$c1;
  26114. }
  26115. } else {
  26116. peg$currPos = s0;
  26117. s0 = peg$c1;
  26118. }
  26119. } else {
  26120. peg$currPos = s0;
  26121. s0 = peg$c1;
  26122. }
  26123. if (s0 === peg$FAILED) {
  26124. s0 = peg$currPos;
  26125. s1 = peg$parseexpressions();
  26126. if (s1 === peg$FAILED) {
  26127. s1 = peg$c41;
  26128. }
  26129. if (s1 !== peg$FAILED) {
  26130. s2 = [];
  26131. if (input.charCodeAt(peg$currPos) === 46) {
  26132. s3 = peg$c51;
  26133. peg$currPos++;
  26134. } else {
  26135. s3 = peg$FAILED;
  26136. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26137. }
  26138. while (s3 !== peg$FAILED) {
  26139. s2.push(s3);
  26140. if (input.charCodeAt(peg$currPos) === 46) {
  26141. s3 = peg$c51;
  26142. peg$currPos++;
  26143. } else {
  26144. s3 = peg$FAILED;
  26145. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26146. }
  26147. }
  26148. if (s2 !== peg$FAILED) {
  26149. peg$reportedPos = s0;
  26150. s1 = peg$c105(s1);
  26151. s0 = s1;
  26152. } else {
  26153. peg$currPos = s0;
  26154. s0 = peg$c1;
  26155. }
  26156. } else {
  26157. peg$currPos = s0;
  26158. s0 = peg$c1;
  26159. }
  26160. }
  26161. }
  26162. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26163. return s0;
  26164. }
  26165. function peg$parsesequence() {
  26166. var s0;
  26167. var key = peg$currPos * 60 + 41,
  26168. cached = peg$cache[key];
  26169. if (cached) {
  26170. peg$currPos = cached.nextPos;
  26171. return cached.result;
  26172. }
  26173. s0 = peg$parsejsStatement();
  26174. if (s0 === peg$FAILED) {
  26175. s0 = peg$parsestSequence();
  26176. }
  26177. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26178. return s0;
  26179. }
  26180. function peg$parsestSequence() {
  26181. var s0, s1, s2, s3, s4;
  26182. var key = peg$currPos * 60 + 42,
  26183. cached = peg$cache[key];
  26184. if (cached) {
  26185. peg$currPos = cached.nextPos;
  26186. return cached.result;
  26187. }
  26188. s0 = peg$currPos;
  26189. s1 = peg$parsetemps();
  26190. if (s1 === peg$FAILED) {
  26191. s1 = peg$c41;
  26192. }
  26193. if (s1 !== peg$FAILED) {
  26194. s2 = peg$parsews();
  26195. if (s2 !== peg$FAILED) {
  26196. s3 = peg$parsestatements();
  26197. if (s3 === peg$FAILED) {
  26198. s3 = peg$c41;
  26199. }
  26200. if (s3 !== peg$FAILED) {
  26201. s4 = peg$parsews();
  26202. if (s4 !== peg$FAILED) {
  26203. peg$reportedPos = s0;
  26204. s1 = peg$c106(s1, s3);
  26205. s0 = s1;
  26206. } else {
  26207. peg$currPos = s0;
  26208. s0 = peg$c1;
  26209. }
  26210. } else {
  26211. peg$currPos = s0;
  26212. s0 = peg$c1;
  26213. }
  26214. } else {
  26215. peg$currPos = s0;
  26216. s0 = peg$c1;
  26217. }
  26218. } else {
  26219. peg$currPos = s0;
  26220. s0 = peg$c1;
  26221. }
  26222. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26223. return s0;
  26224. }
  26225. function peg$parseblock() {
  26226. var s0, s1, s2, s3, s4, s5, s6;
  26227. var key = peg$currPos * 60 + 43,
  26228. cached = peg$cache[key];
  26229. if (cached) {
  26230. peg$currPos = cached.nextPos;
  26231. return cached.result;
  26232. }
  26233. s0 = peg$currPos;
  26234. if (input.charCodeAt(peg$currPos) === 91) {
  26235. s1 = peg$c107;
  26236. peg$currPos++;
  26237. } else {
  26238. s1 = peg$FAILED;
  26239. if (peg$silentFails === 0) { peg$fail(peg$c108); }
  26240. }
  26241. if (s1 !== peg$FAILED) {
  26242. s2 = peg$parseblockParamList();
  26243. if (s2 === peg$FAILED) {
  26244. s2 = peg$c41;
  26245. }
  26246. if (s2 !== peg$FAILED) {
  26247. s3 = peg$parsews();
  26248. if (s3 !== peg$FAILED) {
  26249. s4 = peg$parsesequence();
  26250. if (s4 === peg$FAILED) {
  26251. s4 = peg$c41;
  26252. }
  26253. if (s4 !== peg$FAILED) {
  26254. s5 = peg$parsews();
  26255. if (s5 !== peg$FAILED) {
  26256. if (input.charCodeAt(peg$currPos) === 93) {
  26257. s6 = peg$c109;
  26258. peg$currPos++;
  26259. } else {
  26260. s6 = peg$FAILED;
  26261. if (peg$silentFails === 0) { peg$fail(peg$c110); }
  26262. }
  26263. if (s6 !== peg$FAILED) {
  26264. peg$reportedPos = s0;
  26265. s1 = peg$c111(s2, s4);
  26266. s0 = s1;
  26267. } else {
  26268. peg$currPos = s0;
  26269. s0 = peg$c1;
  26270. }
  26271. } else {
  26272. peg$currPos = s0;
  26273. s0 = peg$c1;
  26274. }
  26275. } else {
  26276. peg$currPos = s0;
  26277. s0 = peg$c1;
  26278. }
  26279. } else {
  26280. peg$currPos = s0;
  26281. s0 = peg$c1;
  26282. }
  26283. } else {
  26284. peg$currPos = s0;
  26285. s0 = peg$c1;
  26286. }
  26287. } else {
  26288. peg$currPos = s0;
  26289. s0 = peg$c1;
  26290. }
  26291. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26292. return s0;
  26293. }
  26294. function peg$parseoperand() {
  26295. var s0;
  26296. var key = peg$currPos * 60 + 44,
  26297. cached = peg$cache[key];
  26298. if (cached) {
  26299. peg$currPos = cached.nextPos;
  26300. return cached.result;
  26301. }
  26302. s0 = peg$parseliteral();
  26303. if (s0 === peg$FAILED) {
  26304. s0 = peg$parsevariable();
  26305. if (s0 === peg$FAILED) {
  26306. s0 = peg$parsesubexpression();
  26307. }
  26308. }
  26309. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26310. return s0;
  26311. }
  26312. function peg$parseunaryMessage() {
  26313. var s0, s1, s2, s3, s4;
  26314. var key = peg$currPos * 60 + 45,
  26315. cached = peg$cache[key];
  26316. if (cached) {
  26317. peg$currPos = cached.nextPos;
  26318. return cached.result;
  26319. }
  26320. s0 = peg$currPos;
  26321. s1 = peg$parsews();
  26322. if (s1 !== peg$FAILED) {
  26323. s2 = peg$parseidentifier();
  26324. if (s2 !== peg$FAILED) {
  26325. s3 = peg$currPos;
  26326. peg$silentFails++;
  26327. if (input.charCodeAt(peg$currPos) === 58) {
  26328. s4 = peg$c13;
  26329. peg$currPos++;
  26330. } else {
  26331. s4 = peg$FAILED;
  26332. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  26333. }
  26334. peg$silentFails--;
  26335. if (s4 === peg$FAILED) {
  26336. s3 = peg$c112;
  26337. } else {
  26338. peg$currPos = s3;
  26339. s3 = peg$c1;
  26340. }
  26341. if (s3 !== peg$FAILED) {
  26342. peg$reportedPos = s0;
  26343. s1 = peg$c113(s2);
  26344. s0 = s1;
  26345. } else {
  26346. peg$currPos = s0;
  26347. s0 = peg$c1;
  26348. }
  26349. } else {
  26350. peg$currPos = s0;
  26351. s0 = peg$c1;
  26352. }
  26353. } else {
  26354. peg$currPos = s0;
  26355. s0 = peg$c1;
  26356. }
  26357. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26358. return s0;
  26359. }
  26360. function peg$parseunaryTail() {
  26361. var s0, s1, s2, s3, s4;
  26362. var key = peg$currPos * 60 + 46,
  26363. cached = peg$cache[key];
  26364. if (cached) {
  26365. peg$currPos = cached.nextPos;
  26366. return cached.result;
  26367. }
  26368. s0 = peg$currPos;
  26369. s1 = peg$parseunaryMessage();
  26370. if (s1 !== peg$FAILED) {
  26371. s2 = peg$parsews();
  26372. if (s2 !== peg$FAILED) {
  26373. s3 = peg$parseunaryTail();
  26374. if (s3 === peg$FAILED) {
  26375. s3 = peg$c41;
  26376. }
  26377. if (s3 !== peg$FAILED) {
  26378. s4 = peg$parsews();
  26379. if (s4 !== peg$FAILED) {
  26380. peg$reportedPos = s0;
  26381. s1 = peg$c114(s1, s3);
  26382. s0 = s1;
  26383. } else {
  26384. peg$currPos = s0;
  26385. s0 = peg$c1;
  26386. }
  26387. } else {
  26388. peg$currPos = s0;
  26389. s0 = peg$c1;
  26390. }
  26391. } else {
  26392. peg$currPos = s0;
  26393. s0 = peg$c1;
  26394. }
  26395. } else {
  26396. peg$currPos = s0;
  26397. s0 = peg$c1;
  26398. }
  26399. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26400. return s0;
  26401. }
  26402. function peg$parseunarySend() {
  26403. var s0, s1, s2, s3;
  26404. var key = peg$currPos * 60 + 47,
  26405. cached = peg$cache[key];
  26406. if (cached) {
  26407. peg$currPos = cached.nextPos;
  26408. return cached.result;
  26409. }
  26410. s0 = peg$currPos;
  26411. s1 = peg$parseoperand();
  26412. if (s1 !== peg$FAILED) {
  26413. s2 = peg$parsews();
  26414. if (s2 !== peg$FAILED) {
  26415. s3 = peg$parseunaryTail();
  26416. if (s3 === peg$FAILED) {
  26417. s3 = peg$c41;
  26418. }
  26419. if (s3 !== peg$FAILED) {
  26420. peg$reportedPos = s0;
  26421. s1 = peg$c115(s1, s3);
  26422. s0 = s1;
  26423. } else {
  26424. peg$currPos = s0;
  26425. s0 = peg$c1;
  26426. }
  26427. } else {
  26428. peg$currPos = s0;
  26429. s0 = peg$c1;
  26430. }
  26431. } else {
  26432. peg$currPos = s0;
  26433. s0 = peg$c1;
  26434. }
  26435. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26436. return s0;
  26437. }
  26438. function peg$parsebinaryMessage() {
  26439. var s0, s1, s2, s3, s4;
  26440. var key = peg$currPos * 60 + 48,
  26441. cached = peg$cache[key];
  26442. if (cached) {
  26443. peg$currPos = cached.nextPos;
  26444. return cached.result;
  26445. }
  26446. s0 = peg$currPos;
  26447. s1 = peg$parsews();
  26448. if (s1 !== peg$FAILED) {
  26449. s2 = peg$parsebinarySelector();
  26450. if (s2 !== peg$FAILED) {
  26451. s3 = peg$parsews();
  26452. if (s3 !== peg$FAILED) {
  26453. s4 = peg$parseunarySend();
  26454. if (s4 === peg$FAILED) {
  26455. s4 = peg$parseoperand();
  26456. }
  26457. if (s4 !== peg$FAILED) {
  26458. peg$reportedPos = s0;
  26459. s1 = peg$c116(s2, s4);
  26460. s0 = s1;
  26461. } else {
  26462. peg$currPos = s0;
  26463. s0 = peg$c1;
  26464. }
  26465. } else {
  26466. peg$currPos = s0;
  26467. s0 = peg$c1;
  26468. }
  26469. } else {
  26470. peg$currPos = s0;
  26471. s0 = peg$c1;
  26472. }
  26473. } else {
  26474. peg$currPos = s0;
  26475. s0 = peg$c1;
  26476. }
  26477. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26478. return s0;
  26479. }
  26480. function peg$parsebinaryTail() {
  26481. var s0, s1, s2;
  26482. var key = peg$currPos * 60 + 49,
  26483. cached = peg$cache[key];
  26484. if (cached) {
  26485. peg$currPos = cached.nextPos;
  26486. return cached.result;
  26487. }
  26488. s0 = peg$currPos;
  26489. s1 = peg$parsebinaryMessage();
  26490. if (s1 !== peg$FAILED) {
  26491. s2 = peg$parsebinaryTail();
  26492. if (s2 === peg$FAILED) {
  26493. s2 = peg$c41;
  26494. }
  26495. if (s2 !== peg$FAILED) {
  26496. peg$reportedPos = s0;
  26497. s1 = peg$c117(s1, s2);
  26498. s0 = s1;
  26499. } else {
  26500. peg$currPos = s0;
  26501. s0 = peg$c1;
  26502. }
  26503. } else {
  26504. peg$currPos = s0;
  26505. s0 = peg$c1;
  26506. }
  26507. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26508. return s0;
  26509. }
  26510. function peg$parsebinarySend() {
  26511. var s0, s1, s2;
  26512. var key = peg$currPos * 60 + 50,
  26513. cached = peg$cache[key];
  26514. if (cached) {
  26515. peg$currPos = cached.nextPos;
  26516. return cached.result;
  26517. }
  26518. s0 = peg$currPos;
  26519. s1 = peg$parseunarySend();
  26520. if (s1 !== peg$FAILED) {
  26521. s2 = peg$parsebinaryTail();
  26522. if (s2 === peg$FAILED) {
  26523. s2 = peg$c41;
  26524. }
  26525. if (s2 !== peg$FAILED) {
  26526. peg$reportedPos = s0;
  26527. s1 = peg$c115(s1, s2);
  26528. s0 = s1;
  26529. } else {
  26530. peg$currPos = s0;
  26531. s0 = peg$c1;
  26532. }
  26533. } else {
  26534. peg$currPos = s0;
  26535. s0 = peg$c1;
  26536. }
  26537. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26538. return s0;
  26539. }
  26540. function peg$parsekeywordMessage() {
  26541. var s0, s1, s2;
  26542. var key = peg$currPos * 60 + 51,
  26543. cached = peg$cache[key];
  26544. if (cached) {
  26545. peg$currPos = cached.nextPos;
  26546. return cached.result;
  26547. }
  26548. s0 = peg$currPos;
  26549. s1 = [];
  26550. s2 = peg$parsekeywordPair();
  26551. if (s2 !== peg$FAILED) {
  26552. while (s2 !== peg$FAILED) {
  26553. s1.push(s2);
  26554. s2 = peg$parsekeywordPair();
  26555. }
  26556. } else {
  26557. s1 = peg$c1;
  26558. }
  26559. if (s1 !== peg$FAILED) {
  26560. peg$reportedPos = s0;
  26561. s1 = peg$c118(s1);
  26562. }
  26563. s0 = s1;
  26564. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26565. return s0;
  26566. }
  26567. function peg$parsekeywordSend() {
  26568. var s0, s1, s2;
  26569. var key = peg$currPos * 60 + 52,
  26570. cached = peg$cache[key];
  26571. if (cached) {
  26572. peg$currPos = cached.nextPos;
  26573. return cached.result;
  26574. }
  26575. s0 = peg$currPos;
  26576. s1 = peg$parsebinarySend();
  26577. if (s1 !== peg$FAILED) {
  26578. s2 = peg$parsekeywordMessage();
  26579. if (s2 !== peg$FAILED) {
  26580. peg$reportedPos = s0;
  26581. s1 = peg$c119(s1, s2);
  26582. s0 = s1;
  26583. } else {
  26584. peg$currPos = s0;
  26585. s0 = peg$c1;
  26586. }
  26587. } else {
  26588. peg$currPos = s0;
  26589. s0 = peg$c1;
  26590. }
  26591. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26592. return s0;
  26593. }
  26594. function peg$parsemessage() {
  26595. var s0;
  26596. var key = peg$currPos * 60 + 53,
  26597. cached = peg$cache[key];
  26598. if (cached) {
  26599. peg$currPos = cached.nextPos;
  26600. return cached.result;
  26601. }
  26602. s0 = peg$parsebinaryMessage();
  26603. if (s0 === peg$FAILED) {
  26604. s0 = peg$parseunaryMessage();
  26605. if (s0 === peg$FAILED) {
  26606. s0 = peg$parsekeywordMessage();
  26607. }
  26608. }
  26609. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26610. return s0;
  26611. }
  26612. function peg$parsecascade() {
  26613. var s0, s1, s2, s3, s4, s5, s6, s7, s8;
  26614. var key = peg$currPos * 60 + 54,
  26615. cached = peg$cache[key];
  26616. if (cached) {
  26617. peg$currPos = cached.nextPos;
  26618. return cached.result;
  26619. }
  26620. s0 = peg$currPos;
  26621. s1 = peg$parsews();
  26622. if (s1 !== peg$FAILED) {
  26623. s2 = peg$parsekeywordSend();
  26624. if (s2 === peg$FAILED) {
  26625. s2 = peg$parsebinarySend();
  26626. }
  26627. if (s2 !== peg$FAILED) {
  26628. s3 = [];
  26629. s4 = peg$currPos;
  26630. s5 = peg$parsews();
  26631. if (s5 !== peg$FAILED) {
  26632. if (input.charCodeAt(peg$currPos) === 59) {
  26633. s6 = peg$c120;
  26634. peg$currPos++;
  26635. } else {
  26636. s6 = peg$FAILED;
  26637. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  26638. }
  26639. if (s6 !== peg$FAILED) {
  26640. s7 = peg$parsews();
  26641. if (s7 !== peg$FAILED) {
  26642. s8 = peg$parsemessage();
  26643. if (s8 !== peg$FAILED) {
  26644. peg$reportedPos = s4;
  26645. s5 = peg$c122(s8);
  26646. s4 = s5;
  26647. } else {
  26648. peg$currPos = s4;
  26649. s4 = peg$c1;
  26650. }
  26651. } else {
  26652. peg$currPos = s4;
  26653. s4 = peg$c1;
  26654. }
  26655. } else {
  26656. peg$currPos = s4;
  26657. s4 = peg$c1;
  26658. }
  26659. } else {
  26660. peg$currPos = s4;
  26661. s4 = peg$c1;
  26662. }
  26663. if (s4 !== peg$FAILED) {
  26664. while (s4 !== peg$FAILED) {
  26665. s3.push(s4);
  26666. s4 = peg$currPos;
  26667. s5 = peg$parsews();
  26668. if (s5 !== peg$FAILED) {
  26669. if (input.charCodeAt(peg$currPos) === 59) {
  26670. s6 = peg$c120;
  26671. peg$currPos++;
  26672. } else {
  26673. s6 = peg$FAILED;
  26674. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  26675. }
  26676. if (s6 !== peg$FAILED) {
  26677. s7 = peg$parsews();
  26678. if (s7 !== peg$FAILED) {
  26679. s8 = peg$parsemessage();
  26680. if (s8 !== peg$FAILED) {
  26681. peg$reportedPos = s4;
  26682. s5 = peg$c122(s8);
  26683. s4 = s5;
  26684. } else {
  26685. peg$currPos = s4;
  26686. s4 = peg$c1;
  26687. }
  26688. } else {
  26689. peg$currPos = s4;
  26690. s4 = peg$c1;
  26691. }
  26692. } else {
  26693. peg$currPos = s4;
  26694. s4 = peg$c1;
  26695. }
  26696. } else {
  26697. peg$currPos = s4;
  26698. s4 = peg$c1;
  26699. }
  26700. }
  26701. } else {
  26702. s3 = peg$c1;
  26703. }
  26704. if (s3 !== peg$FAILED) {
  26705. peg$reportedPos = s0;
  26706. s1 = peg$c123(s2, s3);
  26707. s0 = s1;
  26708. } else {
  26709. peg$currPos = s0;
  26710. s0 = peg$c1;
  26711. }
  26712. } else {
  26713. peg$currPos = s0;
  26714. s0 = peg$c1;
  26715. }
  26716. } else {
  26717. peg$currPos = s0;
  26718. s0 = peg$c1;
  26719. }
  26720. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26721. return s0;
  26722. }
  26723. function peg$parsejsStatement() {
  26724. var s0, s1, s2, s3, s4;
  26725. var key = peg$currPos * 60 + 55,
  26726. cached = peg$cache[key];
  26727. if (cached) {
  26728. peg$currPos = cached.nextPos;
  26729. return cached.result;
  26730. }
  26731. s0 = peg$currPos;
  26732. if (input.charCodeAt(peg$currPos) === 60) {
  26733. s1 = peg$c124;
  26734. peg$currPos++;
  26735. } else {
  26736. s1 = peg$FAILED;
  26737. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  26738. }
  26739. if (s1 !== peg$FAILED) {
  26740. s2 = [];
  26741. s3 = peg$currPos;
  26742. if (input.substr(peg$currPos, 2) === peg$c126) {
  26743. s4 = peg$c126;
  26744. peg$currPos += 2;
  26745. } else {
  26746. s4 = peg$FAILED;
  26747. if (peg$silentFails === 0) { peg$fail(peg$c127); }
  26748. }
  26749. if (s4 !== peg$FAILED) {
  26750. peg$reportedPos = s3;
  26751. s4 = peg$c128();
  26752. }
  26753. s3 = s4;
  26754. if (s3 === peg$FAILED) {
  26755. if (peg$c129.test(input.charAt(peg$currPos))) {
  26756. s3 = input.charAt(peg$currPos);
  26757. peg$currPos++;
  26758. } else {
  26759. s3 = peg$FAILED;
  26760. if (peg$silentFails === 0) { peg$fail(peg$c130); }
  26761. }
  26762. }
  26763. while (s3 !== peg$FAILED) {
  26764. s2.push(s3);
  26765. s3 = peg$currPos;
  26766. if (input.substr(peg$currPos, 2) === peg$c126) {
  26767. s4 = peg$c126;
  26768. peg$currPos += 2;
  26769. } else {
  26770. s4 = peg$FAILED;
  26771. if (peg$silentFails === 0) { peg$fail(peg$c127); }
  26772. }
  26773. if (s4 !== peg$FAILED) {
  26774. peg$reportedPos = s3;
  26775. s4 = peg$c128();
  26776. }
  26777. s3 = s4;
  26778. if (s3 === peg$FAILED) {
  26779. if (peg$c129.test(input.charAt(peg$currPos))) {
  26780. s3 = input.charAt(peg$currPos);
  26781. peg$currPos++;
  26782. } else {
  26783. s3 = peg$FAILED;
  26784. if (peg$silentFails === 0) { peg$fail(peg$c130); }
  26785. }
  26786. }
  26787. }
  26788. if (s2 !== peg$FAILED) {
  26789. if (input.charCodeAt(peg$currPos) === 62) {
  26790. s3 = peg$c131;
  26791. peg$currPos++;
  26792. } else {
  26793. s3 = peg$FAILED;
  26794. if (peg$silentFails === 0) { peg$fail(peg$c132); }
  26795. }
  26796. if (s3 !== peg$FAILED) {
  26797. peg$reportedPos = s0;
  26798. s1 = peg$c133(s2);
  26799. s0 = s1;
  26800. } else {
  26801. peg$currPos = s0;
  26802. s0 = peg$c1;
  26803. }
  26804. } else {
  26805. peg$currPos = s0;
  26806. s0 = peg$c1;
  26807. }
  26808. } else {
  26809. peg$currPos = s0;
  26810. s0 = peg$c1;
  26811. }
  26812. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26813. return s0;
  26814. }
  26815. function peg$parsemethod() {
  26816. var s0, s1, s2, s3, s4;
  26817. var key = peg$currPos * 60 + 56,
  26818. cached = peg$cache[key];
  26819. if (cached) {
  26820. peg$currPos = cached.nextPos;
  26821. return cached.result;
  26822. }
  26823. s0 = peg$currPos;
  26824. s1 = peg$parsekeywordPattern();
  26825. if (s1 === peg$FAILED) {
  26826. s1 = peg$parsebinaryPattern();
  26827. if (s1 === peg$FAILED) {
  26828. s1 = peg$parseunaryPattern();
  26829. }
  26830. }
  26831. if (s1 !== peg$FAILED) {
  26832. s2 = peg$parsews();
  26833. if (s2 !== peg$FAILED) {
  26834. s3 = peg$parsesequence();
  26835. if (s3 === peg$FAILED) {
  26836. s3 = peg$c41;
  26837. }
  26838. if (s3 !== peg$FAILED) {
  26839. s4 = peg$parsews();
  26840. if (s4 !== peg$FAILED) {
  26841. peg$reportedPos = s0;
  26842. s1 = peg$c134(s1, s3);
  26843. s0 = s1;
  26844. } else {
  26845. peg$currPos = s0;
  26846. s0 = peg$c1;
  26847. }
  26848. } else {
  26849. peg$currPos = s0;
  26850. s0 = peg$c1;
  26851. }
  26852. } else {
  26853. peg$currPos = s0;
  26854. s0 = peg$c1;
  26855. }
  26856. } else {
  26857. peg$currPos = s0;
  26858. s0 = peg$c1;
  26859. }
  26860. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26861. return s0;
  26862. }
  26863. function peg$parseassociationSend() {
  26864. var s0, s1, s2;
  26865. var key = peg$currPos * 60 + 57,
  26866. cached = peg$cache[key];
  26867. if (cached) {
  26868. peg$currPos = cached.nextPos;
  26869. return cached.result;
  26870. }
  26871. s0 = peg$currPos;
  26872. s1 = peg$parsebinarySend();
  26873. if (s1 !== peg$FAILED) {
  26874. peg$reportedPos = peg$currPos;
  26875. s2 = peg$c135(s1);
  26876. if (s2) {
  26877. s2 = peg$c112;
  26878. } else {
  26879. s2 = peg$c1;
  26880. }
  26881. if (s2 !== peg$FAILED) {
  26882. peg$reportedPos = s0;
  26883. s1 = peg$c136(s1);
  26884. s0 = s1;
  26885. } else {
  26886. peg$currPos = s0;
  26887. s0 = peg$c1;
  26888. }
  26889. } else {
  26890. peg$currPos = s0;
  26891. s0 = peg$c1;
  26892. }
  26893. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26894. return s0;
  26895. }
  26896. function peg$parseassociationList() {
  26897. var s0, s1, s2, s3, s4;
  26898. var key = peg$currPos * 60 + 58,
  26899. cached = peg$cache[key];
  26900. if (cached) {
  26901. peg$currPos = cached.nextPos;
  26902. return cached.result;
  26903. }
  26904. s0 = peg$currPos;
  26905. s1 = peg$parsews();
  26906. if (s1 !== peg$FAILED) {
  26907. if (input.charCodeAt(peg$currPos) === 46) {
  26908. s2 = peg$c51;
  26909. peg$currPos++;
  26910. } else {
  26911. s2 = peg$FAILED;
  26912. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26913. }
  26914. if (s2 !== peg$FAILED) {
  26915. s3 = peg$parsews();
  26916. if (s3 !== peg$FAILED) {
  26917. s4 = peg$parseassociationSend();
  26918. if (s4 !== peg$FAILED) {
  26919. peg$reportedPos = s0;
  26920. s1 = peg$c89(s4);
  26921. s0 = s1;
  26922. } else {
  26923. peg$currPos = s0;
  26924. s0 = peg$c1;
  26925. }
  26926. } else {
  26927. peg$currPos = s0;
  26928. s0 = peg$c1;
  26929. }
  26930. } else {
  26931. peg$currPos = s0;
  26932. s0 = peg$c1;
  26933. }
  26934. } else {
  26935. peg$currPos = s0;
  26936. s0 = peg$c1;
  26937. }
  26938. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26939. return s0;
  26940. }
  26941. function peg$parseassociations() {
  26942. var s0, s1, s2, s3;
  26943. var key = peg$currPos * 60 + 59,
  26944. cached = peg$cache[key];
  26945. if (cached) {
  26946. peg$currPos = cached.nextPos;
  26947. return cached.result;
  26948. }
  26949. s0 = peg$currPos;
  26950. s1 = peg$parseassociationSend();
  26951. if (s1 !== peg$FAILED) {
  26952. s2 = [];
  26953. s3 = peg$parseassociationList();
  26954. while (s3 !== peg$FAILED) {
  26955. s2.push(s3);
  26956. s3 = peg$parseassociationList();
  26957. }
  26958. if (s2 !== peg$FAILED) {
  26959. peg$reportedPos = s0;
  26960. s1 = peg$c137(s1, s2);
  26961. s0 = s1;
  26962. } else {
  26963. peg$currPos = s0;
  26964. s0 = peg$c1;
  26965. }
  26966. } else {
  26967. peg$currPos = s0;
  26968. s0 = peg$c1;
  26969. }
  26970. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26971. return s0;
  26972. }
  26973. peg$result = peg$startRuleFunction();
  26974. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  26975. return peg$result;
  26976. } else {
  26977. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  26978. peg$fail({ type: "end", description: "end of input" });
  26979. }
  26980. throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
  26981. }
  26982. }
  26983. return {
  26984. SyntaxError: SyntaxError,
  26985. parse: parse
  26986. };
  26987. })();
  26988. });
  26989. 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";
  26990. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  26991. $core.addPackage('Platform-ImportExport');
  26992. $core.packages["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
  26993. $core.packages["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  26994. $core.addClass('AbstractExporter', $globals.Object, [], 'Platform-ImportExport');
  26995. $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.";
  26996. $core.addMethod(
  26997. $core.method({
  26998. selector: "classNameFor:",
  26999. protocol: 'convenience',
  27000. fn: function (aClass){
  27001. var self=this;
  27002. return $core.withContext(function($ctx1) {
  27003. var $2,$3,$4,$1;
  27004. $2=$recv(aClass)._isMetaclass();
  27005. if($core.assert($2)){
  27006. $3=$recv($recv(aClass)._instanceClass())._name();
  27007. $ctx1.sendIdx["name"]=1;
  27008. $1=$recv($3).__comma(" class");
  27009. } else {
  27010. $4=$recv(aClass)._isNil();
  27011. if($core.assert($4)){
  27012. $1="nil";
  27013. } else {
  27014. $1=$recv(aClass)._name();
  27015. };
  27016. };
  27017. return $1;
  27018. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractExporter)});
  27019. },
  27020. args: ["aClass"],
  27021. 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 ] ]",
  27022. referencedClasses: [],
  27023. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"]
  27024. }),
  27025. $globals.AbstractExporter);
  27026. $core.addMethod(
  27027. $core.method({
  27028. selector: "exportPackage:on:",
  27029. protocol: 'output',
  27030. fn: function (aPackage,aStream){
  27031. var self=this;
  27032. return $core.withContext(function($ctx1) {
  27033. self._subclassResponsibility();
  27034. return self;
  27035. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  27036. },
  27037. args: ["aPackage", "aStream"],
  27038. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  27039. referencedClasses: [],
  27040. messageSends: ["subclassResponsibility"]
  27041. }),
  27042. $globals.AbstractExporter);
  27043. $core.addMethod(
  27044. $core.method({
  27045. selector: "extensionMethodsOfPackage:",
  27046. protocol: 'accessing',
  27047. fn: function (aPackage){
  27048. var self=this;
  27049. var result;
  27050. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  27051. return $core.withContext(function($ctx1) {
  27052. var $1;
  27053. result=$recv($OrderedCollection())._new();
  27054. $recv(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  27055. return $core.withContext(function($ctx2) {
  27056. return $recv(result)._addAll_($recv(each)._methods());
  27057. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27058. }));
  27059. $1=result;
  27060. return $1;
  27061. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  27062. },
  27063. args: ["aPackage"],
  27064. 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",
  27065. referencedClasses: ["OrderedCollection"],
  27066. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "methods"]
  27067. }),
  27068. $globals.AbstractExporter);
  27069. $core.addMethod(
  27070. $core.method({
  27071. selector: "extensionProtocolsOfPackage:",
  27072. protocol: 'accessing',
  27073. fn: function (aPackage){
  27074. var self=this;
  27075. var extensionName,result;
  27076. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  27077. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  27078. function $ExportMethodProtocol(){return $globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  27079. return $core.withContext(function($ctx1) {
  27080. var $1,$2,$3,$4;
  27081. $1=$recv(aPackage)._name();
  27082. $ctx1.sendIdx["name"]=1;
  27083. extensionName="*".__comma($1);
  27084. result=$recv($OrderedCollection())._new();
  27085. $recv($recv($recv($recv($Smalltalk())._classes())._asArray())._sorted_((function(a,b){
  27086. return $core.withContext(function($ctx2) {
  27087. $2=$recv(a)._name();
  27088. $ctx2.sendIdx["name"]=2;
  27089. return $recv($2).__lt($recv(b)._name());
  27090. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  27091. })))._do_((function(each){
  27092. return $core.withContext(function($ctx2) {
  27093. return $recv([each,$recv(each)._class()])._do_((function(behavior){
  27094. return $core.withContext(function($ctx3) {
  27095. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  27096. if($core.assert($3)){
  27097. return $recv(result)._add_($recv($ExportMethodProtocol())._name_theClass_(extensionName,behavior));
  27098. };
  27099. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  27100. }));
  27101. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27102. }));
  27103. $ctx1.sendIdx["do:"]=1;
  27104. $4=result;
  27105. return $4;
  27106. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  27107. },
  27108. args: ["aPackage"],
  27109. 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",
  27110. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  27111. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "class", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  27112. }),
  27113. $globals.AbstractExporter);
  27114. $core.addClass('ChunkExporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
  27115. $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.";
  27116. $core.addMethod(
  27117. $core.method({
  27118. selector: "chunkEscape:",
  27119. protocol: 'convenience',
  27120. fn: function (aString){
  27121. var self=this;
  27122. return $core.withContext(function($ctx1) {
  27123. var $1;
  27124. $1=$recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  27125. return $1;
  27126. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  27127. },
  27128. args: ["aString"],
  27129. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  27130. referencedClasses: [],
  27131. messageSends: ["trimBoth", "replace:with:"]
  27132. }),
  27133. $globals.ChunkExporter);
  27134. $core.addMethod(
  27135. $core.method({
  27136. selector: "exportCategoryEpilogueOf:on:",
  27137. protocol: 'output',
  27138. fn: function (aCategory,aStream){
  27139. var self=this;
  27140. return $core.withContext(function($ctx1) {
  27141. var $1;
  27142. $recv(aStream)._nextPutAll_(" !");
  27143. $recv(aStream)._lf();
  27144. $ctx1.sendIdx["lf"]=1;
  27145. $1=$recv(aStream)._lf();
  27146. return self;
  27147. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  27148. },
  27149. args: ["aCategory", "aStream"],
  27150. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  27151. referencedClasses: [],
  27152. messageSends: ["nextPutAll:", "lf"]
  27153. }),
  27154. $globals.ChunkExporter);
  27155. $core.addMethod(
  27156. $core.method({
  27157. selector: "exportCategoryPrologueOf:on:",
  27158. protocol: 'output',
  27159. fn: function (aCategory,aStream){
  27160. var self=this;
  27161. return $core.withContext(function($ctx1) {
  27162. var $1,$3,$2;
  27163. $1="!".__comma(self._classNameFor_($recv(aCategory)._theClass()));
  27164. $ctx1.sendIdx[","]=1;
  27165. $recv(aStream)._nextPutAll_($1);
  27166. $ctx1.sendIdx["nextPutAll:"]=1;
  27167. $3=$recv(" methodsFor: '".__comma($recv(aCategory)._name())).__comma("'!");
  27168. $ctx1.sendIdx[","]=2;
  27169. $2=$recv(aStream)._nextPutAll_($3);
  27170. return self;
  27171. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  27172. },
  27173. args: ["aCategory", "aStream"],
  27174. source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aCategory theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aCategory name, '''!'",
  27175. referencedClasses: [],
  27176. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  27177. }),
  27178. $globals.ChunkExporter);
  27179. $core.addMethod(
  27180. $core.method({
  27181. selector: "exportDefinitionOf:on:",
  27182. protocol: 'output',
  27183. fn: function (aClass,aStream){
  27184. var self=this;
  27185. return $core.withContext(function($ctx1) {
  27186. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$11,$10,$12;
  27187. $1=self._classNameFor_($recv(aClass)._superclass());
  27188. $ctx1.sendIdx["classNameFor:"]=1;
  27189. $recv(aStream)._nextPutAll_($1);
  27190. $ctx1.sendIdx["nextPutAll:"]=1;
  27191. $3=self._classNameFor_(aClass);
  27192. $ctx1.sendIdx["classNameFor:"]=2;
  27193. $2=" subclass: #".__comma($3);
  27194. $ctx1.sendIdx[","]=1;
  27195. $recv(aStream)._nextPutAll_($2);
  27196. $ctx1.sendIdx["nextPutAll:"]=2;
  27197. $recv(aStream)._lf();
  27198. $ctx1.sendIdx["lf"]=1;
  27199. $recv(aStream)._tab();
  27200. $ctx1.sendIdx["tab"]=1;
  27201. $4=$recv(aStream)._nextPutAll_("instanceVariableNames: '");
  27202. $ctx1.sendIdx["nextPutAll:"]=3;
  27203. $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  27204. return $core.withContext(function($ctx2) {
  27205. return $recv(aStream)._nextPutAll_(each);
  27206. $ctx2.sendIdx["nextPutAll:"]=4;
  27207. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27208. }),(function(){
  27209. return $core.withContext(function($ctx2) {
  27210. return $recv(aStream)._nextPutAll_(" ");
  27211. $ctx2.sendIdx["nextPutAll:"]=5;
  27212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  27213. }));
  27214. $recv(aStream)._nextPutAll_("'");
  27215. $ctx1.sendIdx["nextPutAll:"]=6;
  27216. $recv(aStream)._lf();
  27217. $ctx1.sendIdx["lf"]=2;
  27218. $recv(aStream)._tab();
  27219. $6="package: '".__comma($recv(aClass)._category());
  27220. $ctx1.sendIdx[","]=3;
  27221. $5=$recv($6).__comma("'!");
  27222. $ctx1.sendIdx[","]=2;
  27223. $recv(aStream)._nextPutAll_($5);
  27224. $ctx1.sendIdx["nextPutAll:"]=7;
  27225. $7=$recv(aStream)._lf();
  27226. $ctx1.sendIdx["lf"]=3;
  27227. $9=$recv(aClass)._comment();
  27228. $ctx1.sendIdx["comment"]=1;
  27229. $8=$recv($9)._notEmpty();
  27230. if($core.assert($8)){
  27231. $11="!".__comma(self._classNameFor_(aClass));
  27232. $ctx1.sendIdx[","]=5;
  27233. $10=$recv($11).__comma(" commentStamp!");
  27234. $ctx1.sendIdx[","]=4;
  27235. $recv(aStream)._nextPutAll_($10);
  27236. $ctx1.sendIdx["nextPutAll:"]=8;
  27237. $recv(aStream)._lf();
  27238. $ctx1.sendIdx["lf"]=4;
  27239. $recv(aStream)._nextPutAll_($recv(self._chunkEscape_($recv(aClass)._comment())).__comma("!"));
  27240. $12=$recv(aStream)._lf();
  27241. $ctx1.sendIdx["lf"]=5;
  27242. $12;
  27243. };
  27244. $recv(aStream)._lf();
  27245. return self;
  27246. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  27247. },
  27248. args: ["aClass", "aStream"],
  27249. 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",
  27250. referencedClasses: [],
  27251. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "chunkEscape:"]
  27252. }),
  27253. $globals.ChunkExporter);
  27254. $core.addMethod(
  27255. $core.method({
  27256. selector: "exportMetaDefinitionOf:on:",
  27257. protocol: 'output',
  27258. fn: function (aClass,aStream){
  27259. var self=this;
  27260. return $core.withContext(function($ctx1) {
  27261. var $3,$2,$1,$5,$4,$6,$7;
  27262. $3=$recv(aClass)._class();
  27263. $ctx1.sendIdx["class"]=1;
  27264. $2=$recv($3)._instanceVariableNames();
  27265. $ctx1.sendIdx["instanceVariableNames"]=1;
  27266. $1=$recv($2)._isEmpty();
  27267. if(!$core.assert($1)){
  27268. $5=$recv(aClass)._class();
  27269. $ctx1.sendIdx["class"]=2;
  27270. $4=self._classNameFor_($5);
  27271. $recv(aStream)._nextPutAll_($4);
  27272. $ctx1.sendIdx["nextPutAll:"]=1;
  27273. $6=$recv(aStream)._nextPutAll_(" instanceVariableNames: '");
  27274. $ctx1.sendIdx["nextPutAll:"]=2;
  27275. $6;
  27276. $recv($recv($recv(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  27277. return $core.withContext(function($ctx2) {
  27278. return $recv(aStream)._nextPutAll_(each);
  27279. $ctx2.sendIdx["nextPutAll:"]=3;
  27280. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27281. }),(function(){
  27282. return $core.withContext(function($ctx2) {
  27283. return $recv(aStream)._nextPutAll_(" ");
  27284. $ctx2.sendIdx["nextPutAll:"]=4;
  27285. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  27286. }));
  27287. $recv(aStream)._nextPutAll_("'!");
  27288. $recv(aStream)._lf();
  27289. $ctx1.sendIdx["lf"]=1;
  27290. $7=$recv(aStream)._lf();
  27291. $7;
  27292. };
  27293. return self;
  27294. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  27295. },
  27296. args: ["aClass", "aStream"],
  27297. 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 ]",
  27298. referencedClasses: [],
  27299. messageSends: ["ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "classNameFor:", "do:separatedBy:", "lf"]
  27300. }),
  27301. $globals.ChunkExporter);
  27302. $core.addMethod(
  27303. $core.method({
  27304. selector: "exportMethod:on:",
  27305. protocol: 'output',
  27306. fn: function (aMethod,aStream){
  27307. var self=this;
  27308. return $core.withContext(function($ctx1) {
  27309. var $1;
  27310. $recv(aStream)._lf();
  27311. $ctx1.sendIdx["lf"]=1;
  27312. $recv(aStream)._lf();
  27313. $ctx1.sendIdx["lf"]=2;
  27314. $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aMethod)._source()));
  27315. $ctx1.sendIdx["nextPutAll:"]=1;
  27316. $recv(aStream)._lf();
  27317. $1=$recv(aStream)._nextPutAll_("!");
  27318. return self;
  27319. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  27320. },
  27321. args: ["aMethod", "aStream"],
  27322. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
  27323. referencedClasses: [],
  27324. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"]
  27325. }),
  27326. $globals.ChunkExporter);
  27327. $core.addMethod(
  27328. $core.method({
  27329. selector: "exportPackage:on:",
  27330. protocol: 'output',
  27331. fn: function (aPackage,aStream){
  27332. var self=this;
  27333. return $core.withContext(function($ctx1) {
  27334. var $1,$2;
  27335. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  27336. $1=self._exportPackageImportsOf_on_(aPackage,aStream);
  27337. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  27338. return $core.withContext(function($ctx2) {
  27339. self._exportDefinitionOf_on_(each,aStream);
  27340. $2=self._ownMethodProtocolsOfClass_(each);
  27341. $ctx2.sendIdx["ownMethodProtocolsOfClass:"]=1;
  27342. self._exportProtocols_on_($2,aStream);
  27343. $ctx2.sendIdx["exportProtocols:on:"]=1;
  27344. self._exportMetaDefinitionOf_on_(each,aStream);
  27345. return self._exportProtocols_on_(self._ownMethodProtocolsOfClass_($recv(each)._class()),aStream);
  27346. $ctx2.sendIdx["exportProtocols:on:"]=2;
  27347. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27348. }));
  27349. self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream);
  27350. return self;
  27351. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27352. },
  27353. args: ["aPackage", "aStream"],
  27354. 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",
  27355. referencedClasses: [],
  27356. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "exportProtocols:on:", "ownMethodProtocolsOfClass:", "exportMetaDefinitionOf:on:", "class", "extensionProtocolsOfPackage:"]
  27357. }),
  27358. $globals.ChunkExporter);
  27359. $core.addMethod(
  27360. $core.method({
  27361. selector: "exportPackageDefinitionOf:on:",
  27362. protocol: 'output',
  27363. fn: function (aPackage,aStream){
  27364. var self=this;
  27365. return $core.withContext(function($ctx1) {
  27366. var $1,$2;
  27367. $1=$recv("Smalltalk createPackage: '".__comma($recv(aPackage)._name())).__comma("'!");
  27368. $ctx1.sendIdx[","]=1;
  27369. $recv(aStream)._nextPutAll_($1);
  27370. $2=$recv(aStream)._lf();
  27371. return self;
  27372. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27373. },
  27374. args: ["aPackage", "aStream"],
  27375. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf",
  27376. referencedClasses: [],
  27377. messageSends: ["nextPutAll:", ",", "name", "lf"]
  27378. }),
  27379. $globals.ChunkExporter);
  27380. $core.addMethod(
  27381. $core.method({
  27382. selector: "exportPackageImportsOf:on:",
  27383. protocol: 'output',
  27384. fn: function (aPackage,aStream){
  27385. var self=this;
  27386. return $core.withContext(function($ctx1) {
  27387. var $1;
  27388. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  27389. return $core.withContext(function($ctx2) {
  27390. $recv(aStream)._nextPutAll_("(Smalltalk packageAt: '");
  27391. $ctx2.sendIdx["nextPutAll:"]=1;
  27392. $recv(aStream)._nextPutAll_($recv(aPackage)._name());
  27393. $ctx2.sendIdx["nextPutAll:"]=2;
  27394. $recv(aStream)._nextPutAll_("') imports: ");
  27395. $ctx2.sendIdx["nextPutAll:"]=3;
  27396. $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aPackage)._importsDefinition()));
  27397. $ctx2.sendIdx["nextPutAll:"]=4;
  27398. $recv(aStream)._nextPutAll_("!");
  27399. $1=$recv(aStream)._lf();
  27400. return $1;
  27401. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  27402. }));
  27403. return self;
  27404. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27405. },
  27406. args: ["aPackage", "aStream"],
  27407. 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 ]",
  27408. referencedClasses: [],
  27409. messageSends: ["ifNotEmpty:", "imports", "nextPutAll:", "name", "chunkEscape:", "importsDefinition", "lf"]
  27410. }),
  27411. $globals.ChunkExporter);
  27412. $core.addMethod(
  27413. $core.method({
  27414. selector: "exportProtocol:on:",
  27415. protocol: 'output',
  27416. fn: function (aProtocol,aStream){
  27417. var self=this;
  27418. return $core.withContext(function($ctx1) {
  27419. self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  27420. $recv($recv(aProtocol)._methods())._do_((function(method){
  27421. return $core.withContext(function($ctx2) {
  27422. return self._exportMethod_on_(method,aStream);
  27423. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  27424. }));
  27425. self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  27426. return self;
  27427. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27428. },
  27429. args: ["aProtocol", "aStream"],
  27430. 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",
  27431. referencedClasses: [],
  27432. messageSends: ["exportProtocolPrologueOf:on:", "do:", "methods", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  27433. }),
  27434. $globals.ChunkExporter);
  27435. $core.addMethod(
  27436. $core.method({
  27437. selector: "exportProtocolEpilogueOf:on:",
  27438. protocol: 'output',
  27439. fn: function (aProtocol,aStream){
  27440. var self=this;
  27441. return $core.withContext(function($ctx1) {
  27442. var $1;
  27443. $recv(aStream)._nextPutAll_(" !");
  27444. $recv(aStream)._lf();
  27445. $ctx1.sendIdx["lf"]=1;
  27446. $1=$recv(aStream)._lf();
  27447. return self;
  27448. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27449. },
  27450. args: ["aProtocol", "aStream"],
  27451. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  27452. referencedClasses: [],
  27453. messageSends: ["nextPutAll:", "lf"]
  27454. }),
  27455. $globals.ChunkExporter);
  27456. $core.addMethod(
  27457. $core.method({
  27458. selector: "exportProtocolPrologueOf:on:",
  27459. protocol: 'output',
  27460. fn: function (aProtocol,aStream){
  27461. var self=this;
  27462. return $core.withContext(function($ctx1) {
  27463. var $1,$3,$2;
  27464. $1="!".__comma(self._classNameFor_($recv(aProtocol)._theClass()));
  27465. $ctx1.sendIdx[","]=1;
  27466. $recv(aStream)._nextPutAll_($1);
  27467. $ctx1.sendIdx["nextPutAll:"]=1;
  27468. $3=$recv(" methodsFor: '".__comma($recv(aProtocol)._name())).__comma("'!");
  27469. $ctx1.sendIdx[","]=2;
  27470. $2=$recv(aStream)._nextPutAll_($3);
  27471. return self;
  27472. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27473. },
  27474. args: ["aProtocol", "aStream"],
  27475. source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aProtocol theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aProtocol name, '''!'",
  27476. referencedClasses: [],
  27477. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  27478. }),
  27479. $globals.ChunkExporter);
  27480. $core.addMethod(
  27481. $core.method({
  27482. selector: "exportProtocols:on:",
  27483. protocol: 'output',
  27484. fn: function (aCollection,aStream){
  27485. var self=this;
  27486. return $core.withContext(function($ctx1) {
  27487. $recv(aCollection)._do_((function(each){
  27488. return $core.withContext(function($ctx2) {
  27489. return self._exportProtocol_on_(each,aStream);
  27490. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27491. }));
  27492. return self;
  27493. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  27494. },
  27495. args: ["aCollection", "aStream"],
  27496. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  27497. referencedClasses: [],
  27498. messageSends: ["do:", "exportProtocol:on:"]
  27499. }),
  27500. $globals.ChunkExporter);
  27501. $core.addMethod(
  27502. $core.method({
  27503. selector: "extensionCategoriesOfPackage:",
  27504. protocol: 'accessing',
  27505. fn: function (aPackage){
  27506. var self=this;
  27507. var name,map,result;
  27508. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  27509. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  27510. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  27511. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  27512. function $MethodCategory(){return $globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  27513. return $core.withContext(function($ctx1) {
  27514. var $1,$2;
  27515. name=$recv(aPackage)._name();
  27516. result=$recv($OrderedCollection())._new();
  27517. $ctx1.sendIdx["new"]=1;
  27518. $recv($recv($Package())._sortedClasses_($recv($Smalltalk())._classes()))._do_((function(each){
  27519. return $core.withContext(function($ctx2) {
  27520. return $recv([each,$recv(each)._class()])._do_((function(aClass){
  27521. return $core.withContext(function($ctx3) {
  27522. map=$recv($Dictionary())._new();
  27523. map;
  27524. $recv(aClass)._protocolsDo_((function(category,methods){
  27525. return $core.withContext(function($ctx4) {
  27526. $1=$recv(category).__eq("*".__comma(name));
  27527. if($core.assert($1)){
  27528. return $recv(map)._at_put_(category,methods);
  27529. };
  27530. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  27531. }));
  27532. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  27533. return $core.withContext(function($ctx4) {
  27534. return $recv(a).__lt_eq(b);
  27535. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  27536. })))._collect_((function(category){
  27537. return $core.withContext(function($ctx4) {
  27538. return $recv($MethodCategory())._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  27539. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  27540. })));
  27541. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  27542. }));
  27543. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27544. }));
  27545. $ctx1.sendIdx["do:"]=1;
  27546. $2=result;
  27547. return $2;
  27548. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  27549. },
  27550. args: ["aPackage"],
  27551. 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",
  27552. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  27553. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "class", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  27554. }),
  27555. $globals.ChunkExporter);
  27556. $core.addMethod(
  27557. $core.method({
  27558. selector: "ownCategoriesOfClass:",
  27559. protocol: 'accessing',
  27560. fn: function (aClass){
  27561. var self=this;
  27562. var map;
  27563. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  27564. function $MethodCategory(){return $globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  27565. return $core.withContext(function($ctx1) {
  27566. var $1,$2;
  27567. map=$recv($Dictionary())._new();
  27568. $recv(aClass)._protocolsDo_((function(each,methods){
  27569. return $core.withContext(function($ctx2) {
  27570. $1=$recv(each)._match_("^\x5c*");
  27571. if(!$core.assert($1)){
  27572. return $recv(map)._at_put_(each,methods);
  27573. };
  27574. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  27575. }));
  27576. $2=$recv($recv($recv(map)._keys())._sorted_((function(a,b){
  27577. return $core.withContext(function($ctx2) {
  27578. return $recv(a).__lt_eq(b);
  27579. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  27580. })))._collect_((function(each){
  27581. return $core.withContext(function($ctx2) {
  27582. return $recv($MethodCategory())._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  27583. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  27584. }));
  27585. return $2;
  27586. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  27587. },
  27588. args: ["aClass"],
  27589. 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) ]",
  27590. referencedClasses: ["Dictionary", "MethodCategory"],
  27591. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  27592. }),
  27593. $globals.ChunkExporter);
  27594. $core.addMethod(
  27595. $core.method({
  27596. selector: "ownCategoriesOfMetaClass:",
  27597. protocol: 'accessing',
  27598. fn: function (aClass){
  27599. var self=this;
  27600. return $core.withContext(function($ctx1) {
  27601. var $1;
  27602. $1=self._ownCategoriesOfClass_($recv(aClass)._class());
  27603. return $1;
  27604. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  27605. },
  27606. args: ["aClass"],
  27607. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass class",
  27608. referencedClasses: [],
  27609. messageSends: ["ownCategoriesOfClass:", "class"]
  27610. }),
  27611. $globals.ChunkExporter);
  27612. $core.addMethod(
  27613. $core.method({
  27614. selector: "ownMethodProtocolsOfClass:",
  27615. protocol: 'accessing',
  27616. fn: function (aClass){
  27617. var self=this;
  27618. function $ExportMethodProtocol(){return $globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  27619. return $core.withContext(function($ctx1) {
  27620. var $1;
  27621. $1=$recv($recv(aClass)._ownProtocols())._collect_((function(each){
  27622. return $core.withContext(function($ctx2) {
  27623. return $recv($ExportMethodProtocol())._name_theClass_(each,aClass);
  27624. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27625. }));
  27626. return $1;
  27627. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  27628. },
  27629. args: ["aClass"],
  27630. 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 ]",
  27631. referencedClasses: ["ExportMethodProtocol"],
  27632. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  27633. }),
  27634. $globals.ChunkExporter);
  27635. $core.addClass('Exporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
  27636. $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.).";
  27637. $core.addMethod(
  27638. $core.method({
  27639. selector: "exportDefinitionOf:on:",
  27640. protocol: 'output',
  27641. fn: function (aClass,aStream){
  27642. var self=this;
  27643. return $core.withContext(function($ctx1) {
  27644. var $2,$1,$3,$4,$6,$5,$7,$9,$8,$10;
  27645. $recv(aStream)._lf();
  27646. $ctx1.sendIdx["lf"]=1;
  27647. $recv(aStream)._nextPutAll_("$core.addClass(");
  27648. $ctx1.sendIdx["nextPutAll:"]=1;
  27649. $2="'".__comma(self._classNameFor_(aClass));
  27650. $ctx1.sendIdx[","]=2;
  27651. $1=$recv($2).__comma("', ");
  27652. $ctx1.sendIdx[","]=1;
  27653. $recv(aStream)._nextPutAll_($1);
  27654. $ctx1.sendIdx["nextPutAll:"]=2;
  27655. $3=self._jsClassNameFor_($recv(aClass)._superclass());
  27656. $ctx1.sendIdx["jsClassNameFor:"]=1;
  27657. $recv(aStream)._nextPutAll_($3);
  27658. $ctx1.sendIdx["nextPutAll:"]=3;
  27659. $4=$recv(aStream)._nextPutAll_(", [");
  27660. $ctx1.sendIdx["nextPutAll:"]=4;
  27661. $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  27662. return $core.withContext(function($ctx2) {
  27663. $6="'".__comma(each);
  27664. $ctx2.sendIdx[","]=4;
  27665. $5=$recv($6).__comma("'");
  27666. $ctx2.sendIdx[","]=3;
  27667. return $recv(aStream)._nextPutAll_($5);
  27668. $ctx2.sendIdx["nextPutAll:"]=5;
  27669. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27670. }),(function(){
  27671. return $core.withContext(function($ctx2) {
  27672. return $recv(aStream)._nextPutAll_(", ");
  27673. $ctx2.sendIdx["nextPutAll:"]=6;
  27674. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  27675. }));
  27676. $recv(aStream)._nextPutAll_("], '");
  27677. $ctx1.sendIdx["nextPutAll:"]=7;
  27678. $recv(aStream)._nextPutAll_($recv($recv(aClass)._category()).__comma("'"));
  27679. $ctx1.sendIdx["nextPutAll:"]=8;
  27680. $7=$recv(aStream)._nextPutAll_(");");
  27681. $ctx1.sendIdx["nextPutAll:"]=9;
  27682. $9=$recv(aClass)._comment();
  27683. $ctx1.sendIdx["comment"]=1;
  27684. $8=$recv($9)._notEmpty();
  27685. if($core.assert($8)){
  27686. $recv(aStream)._lf();
  27687. $ctx1.sendIdx["lf"]=2;
  27688. $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  27689. $ctx1.sendIdx["nextPutAll:"]=10;
  27690. $recv(aStream)._lf();
  27691. $ctx1.sendIdx["lf"]=3;
  27692. $recv(aStream)._nextPutAll_(self._jsClassNameFor_(aClass));
  27693. $ctx1.sendIdx["nextPutAll:"]=11;
  27694. $recv(aStream)._nextPutAll_(".comment=");
  27695. $ctx1.sendIdx["nextPutAll:"]=12;
  27696. $recv(aStream)._nextPutAll_($recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavascript());
  27697. $ctx1.sendIdx["nextPutAll:"]=13;
  27698. $recv(aStream)._nextPutAll_(";");
  27699. $ctx1.sendIdx["nextPutAll:"]=14;
  27700. $recv(aStream)._lf();
  27701. $ctx1.sendIdx["lf"]=4;
  27702. $10=$recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  27703. $10;
  27704. };
  27705. $recv(aStream)._lf();
  27706. return self;
  27707. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  27708. },
  27709. args: ["aClass", "aStream"],
  27710. 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",
  27711. referencedClasses: [],
  27712. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "jsClassNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "asJavascript", "crlfSanitized"]
  27713. }),
  27714. $globals.Exporter);
  27715. $core.addMethod(
  27716. $core.method({
  27717. selector: "exportMetaDefinitionOf:on:",
  27718. protocol: 'output',
  27719. fn: function (aClass,aStream){
  27720. var self=this;
  27721. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  27722. return $core.withContext(function($ctx1) {
  27723. var $3,$2,$1,$5,$4,$6,$8,$7;
  27724. $recv(aStream)._lf();
  27725. $ctx1.sendIdx["lf"]=1;
  27726. $3=$recv(aClass)._class();
  27727. $ctx1.sendIdx["class"]=1;
  27728. $2=$recv($3)._instanceVariableNames();
  27729. $ctx1.sendIdx["instanceVariableNames"]=1;
  27730. $1=$recv($2)._isEmpty();
  27731. if(!$core.assert($1)){
  27732. $5=$recv(aClass)._class();
  27733. $ctx1.sendIdx["class"]=2;
  27734. $4=self._jsClassNameFor_($5);
  27735. $recv(aStream)._nextPutAll_($4);
  27736. $ctx1.sendIdx["nextPutAll:"]=1;
  27737. $6=$recv(aStream)._nextPutAll_(".iVarNames = [");
  27738. $ctx1.sendIdx["nextPutAll:"]=2;
  27739. $6;
  27740. $recv($recv($recv(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  27741. return $core.withContext(function($ctx2) {
  27742. $8="'".__comma(each);
  27743. $ctx2.sendIdx[","]=2;
  27744. $7=$recv($8).__comma("'");
  27745. $ctx2.sendIdx[","]=1;
  27746. return $recv(aStream)._nextPutAll_($7);
  27747. $ctx2.sendIdx["nextPutAll:"]=3;
  27748. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27749. }),(function(){
  27750. return $core.withContext(function($ctx2) {
  27751. return $recv(aStream)._nextPutAll_(",");
  27752. $ctx2.sendIdx["nextPutAll:"]=4;
  27753. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  27754. }));
  27755. $recv(aStream)._nextPutAll_("];".__comma($recv($String())._lf()));
  27756. };
  27757. return self;
  27758. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  27759. },
  27760. args: ["aClass", "aStream"],
  27761. 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 ]",
  27762. referencedClasses: ["String"],
  27763. messageSends: ["lf", "ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "jsClassNameFor:", "do:separatedBy:", ","]
  27764. }),
  27765. $globals.Exporter);
  27766. $core.addMethod(
  27767. $core.method({
  27768. selector: "exportMethod:on:",
  27769. protocol: 'output',
  27770. fn: function (aMethod,aStream){
  27771. var self=this;
  27772. return $core.withContext(function($ctx1) {
  27773. var $3,$2,$1,$5,$4,$7,$6,$10,$9,$8,$13,$12,$11,$16,$15,$14,$17;
  27774. $recv(aStream)._nextPutAll_("$core.addMethod(");
  27775. $ctx1.sendIdx["nextPutAll:"]=1;
  27776. $recv(aStream)._lf();
  27777. $ctx1.sendIdx["lf"]=1;
  27778. $recv(aStream)._nextPutAll_("$core.method({");
  27779. $ctx1.sendIdx["nextPutAll:"]=2;
  27780. $recv(aStream)._lf();
  27781. $ctx1.sendIdx["lf"]=2;
  27782. $3=$recv($recv(aMethod)._selector())._asJavascript();
  27783. $ctx1.sendIdx["asJavascript"]=1;
  27784. $2="selector: ".__comma($3);
  27785. $ctx1.sendIdx[","]=2;
  27786. $1=$recv($2).__comma(",");
  27787. $ctx1.sendIdx[","]=1;
  27788. $recv(aStream)._nextPutAll_($1);
  27789. $ctx1.sendIdx["nextPutAll:"]=3;
  27790. $recv(aStream)._lf();
  27791. $ctx1.sendIdx["lf"]=3;
  27792. $5="protocol: '".__comma($recv(aMethod)._protocol());
  27793. $ctx1.sendIdx[","]=4;
  27794. $4=$recv($5).__comma("',");
  27795. $ctx1.sendIdx[","]=3;
  27796. $recv(aStream)._nextPutAll_($4);
  27797. $ctx1.sendIdx["nextPutAll:"]=4;
  27798. $recv(aStream)._lf();
  27799. $ctx1.sendIdx["lf"]=4;
  27800. $7="fn: ".__comma($recv($recv(aMethod)._fn())._compiledSource());
  27801. $ctx1.sendIdx[","]=6;
  27802. $6=$recv($7).__comma(",");
  27803. $ctx1.sendIdx[","]=5;
  27804. $recv(aStream)._nextPutAll_($6);
  27805. $ctx1.sendIdx["nextPutAll:"]=5;
  27806. $recv(aStream)._lf();
  27807. $ctx1.sendIdx["lf"]=5;
  27808. $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  27809. $ctx1.sendIdx["nextPutAll:"]=6;
  27810. $recv(aStream)._lf();
  27811. $ctx1.sendIdx["lf"]=6;
  27812. $10=$recv($recv(aMethod)._arguments())._asJavascript();
  27813. $ctx1.sendIdx["asJavascript"]=2;
  27814. $9="args: ".__comma($10);
  27815. $ctx1.sendIdx[","]=8;
  27816. $8=$recv($9).__comma(",");
  27817. $ctx1.sendIdx[","]=7;
  27818. $recv(aStream)._nextPutAll_($8);
  27819. $ctx1.sendIdx["nextPutAll:"]=7;
  27820. $recv(aStream)._lf();
  27821. $ctx1.sendIdx["lf"]=7;
  27822. $13=$recv($recv(aMethod)._source())._asJavascript();
  27823. $ctx1.sendIdx["asJavascript"]=3;
  27824. $12="source: ".__comma($13);
  27825. $ctx1.sendIdx[","]=10;
  27826. $11=$recv($12).__comma(",");
  27827. $ctx1.sendIdx[","]=9;
  27828. $recv(aStream)._nextPutAll_($11);
  27829. $ctx1.sendIdx["nextPutAll:"]=8;
  27830. $recv(aStream)._lf();
  27831. $ctx1.sendIdx["lf"]=8;
  27832. $16=$recv($recv(aMethod)._referencedClasses())._asJavascript();
  27833. $ctx1.sendIdx["asJavascript"]=4;
  27834. $15="referencedClasses: ".__comma($16);
  27835. $ctx1.sendIdx[","]=12;
  27836. $14=$recv($15).__comma(",");
  27837. $ctx1.sendIdx[","]=11;
  27838. $recv(aStream)._nextPutAll_($14);
  27839. $ctx1.sendIdx["nextPutAll:"]=9;
  27840. $recv(aStream)._lf();
  27841. $ctx1.sendIdx["lf"]=9;
  27842. $recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  27843. $ctx1.sendIdx["nextPutAll:"]=10;
  27844. $recv(aStream)._lf();
  27845. $ctx1.sendIdx["lf"]=10;
  27846. $recv(aStream)._nextPutAll_("messageSends: ".__comma($recv($recv(aMethod)._messageSends())._asJavascript()));
  27847. $ctx1.sendIdx["nextPutAll:"]=11;
  27848. $recv(aStream)._lf();
  27849. $ctx1.sendIdx["lf"]=11;
  27850. $recv(aStream)._nextPutAll_("}),");
  27851. $ctx1.sendIdx["nextPutAll:"]=12;
  27852. $recv(aStream)._lf();
  27853. $ctx1.sendIdx["lf"]=12;
  27854. $recv(aStream)._nextPutAll_(self._jsClassNameFor_($recv(aMethod)._methodClass()));
  27855. $ctx1.sendIdx["nextPutAll:"]=13;
  27856. $recv(aStream)._nextPutAll_(");");
  27857. $recv(aStream)._lf();
  27858. $ctx1.sendIdx["lf"]=13;
  27859. $17=$recv(aStream)._lf();
  27860. return self;
  27861. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  27862. },
  27863. args: ["aMethod", "aStream"],
  27864. 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",
  27865. referencedClasses: [],
  27866. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "jsClassNameFor:", "methodClass"]
  27867. }),
  27868. $globals.Exporter);
  27869. $core.addMethod(
  27870. $core.method({
  27871. selector: "exportPackage:on:",
  27872. protocol: 'output',
  27873. fn: function (aPackage,aStream){
  27874. var self=this;
  27875. return $core.withContext(function($ctx1) {
  27876. var $1,$2;
  27877. self._exportPackagePrologueOf_on_(aPackage,aStream);
  27878. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  27879. self._exportPackageContextOf_on_(aPackage,aStream);
  27880. self._exportPackageImportsOf_on_(aPackage,aStream);
  27881. $1=self._exportPackageTransportOf_on_(aPackage,aStream);
  27882. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  27883. return $core.withContext(function($ctx2) {
  27884. self._exportDefinitionOf_on_(each,aStream);
  27885. $2=$recv(each)._ownMethods();
  27886. $ctx2.sendIdx["ownMethods"]=1;
  27887. $recv($2)._do_((function(method){
  27888. return $core.withContext(function($ctx3) {
  27889. return self._exportMethod_on_(method,aStream);
  27890. $ctx3.sendIdx["exportMethod:on:"]=1;
  27891. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  27892. }));
  27893. $ctx2.sendIdx["do:"]=2;
  27894. self._exportMetaDefinitionOf_on_(each,aStream);
  27895. return $recv($recv($recv(each)._class())._ownMethods())._do_((function(method){
  27896. return $core.withContext(function($ctx3) {
  27897. return self._exportMethod_on_(method,aStream);
  27898. $ctx3.sendIdx["exportMethod:on:"]=2;
  27899. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,3)});
  27900. }));
  27901. $ctx2.sendIdx["do:"]=3;
  27902. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27903. }));
  27904. $ctx1.sendIdx["do:"]=1;
  27905. $recv(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  27906. return $core.withContext(function($ctx2) {
  27907. return self._exportMethod_on_(each,aStream);
  27908. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  27909. }));
  27910. self._exportPackageEpilogueOf_on_(aPackage,aStream);
  27911. return self;
  27912. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27913. },
  27914. args: ["aPackage", "aStream"],
  27915. 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",
  27916. referencedClasses: [],
  27917. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "ownMethods", "exportMethod:on:", "exportMetaDefinitionOf:on:", "class", "extensionMethodsOfPackage:", "exportPackageEpilogueOf:on:"]
  27918. }),
  27919. $globals.Exporter);
  27920. $core.addMethod(
  27921. $core.method({
  27922. selector: "exportPackageContextOf:on:",
  27923. protocol: 'output',
  27924. fn: function (aPackage,aStream){
  27925. var self=this;
  27926. return $core.withContext(function($ctx1) {
  27927. var $1;
  27928. $recv(aStream)._nextPutAll_("$core.packages[");
  27929. $ctx1.sendIdx["nextPutAll:"]=1;
  27930. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
  27931. $ctx1.sendIdx["nextPutAll:"]=2;
  27932. $recv(aStream)._nextPutAll_("].innerEval = ");
  27933. $ctx1.sendIdx["nextPutAll:"]=3;
  27934. $recv(aStream)._nextPutAll_("function (expr) { return eval(expr); }");
  27935. $ctx1.sendIdx["nextPutAll:"]=4;
  27936. $recv(aStream)._nextPutAll_(";");
  27937. $1=$recv(aStream)._lf();
  27938. return self;
  27939. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27940. },
  27941. args: ["aPackage", "aStream"],
  27942. 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",
  27943. referencedClasses: [],
  27944. messageSends: ["nextPutAll:", "asJavascript", "name", "lf"]
  27945. }),
  27946. $globals.Exporter);
  27947. $core.addMethod(
  27948. $core.method({
  27949. selector: "exportPackageDefinitionOf:on:",
  27950. protocol: 'output',
  27951. fn: function (aPackage,aStream){
  27952. var self=this;
  27953. return $core.withContext(function($ctx1) {
  27954. var $1,$2;
  27955. $recv(aStream)._nextPutAll_("$core.addPackage(");
  27956. $ctx1.sendIdx["nextPutAll:"]=1;
  27957. $1=$recv("'".__comma($recv(aPackage)._name())).__comma("');");
  27958. $ctx1.sendIdx[","]=1;
  27959. $recv(aStream)._nextPutAll_($1);
  27960. $2=$recv(aStream)._lf();
  27961. return self;
  27962. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27963. },
  27964. args: ["aPackage", "aStream"],
  27965. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.addPackage(';\x0a\x09\x09nextPutAll: '''', aPackage name, ''');';\x0a\x09\x09lf",
  27966. referencedClasses: [],
  27967. messageSends: ["nextPutAll:", ",", "name", "lf"]
  27968. }),
  27969. $globals.Exporter);
  27970. $core.addMethod(
  27971. $core.method({
  27972. selector: "exportPackageEpilogueOf:on:",
  27973. protocol: 'output',
  27974. fn: function (aPackage,aStream){
  27975. var self=this;
  27976. return $core.withContext(function($ctx1) {
  27977. self._subclassResponsibility();
  27978. return self;
  27979. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27980. },
  27981. args: ["aPackage", "aStream"],
  27982. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  27983. referencedClasses: [],
  27984. messageSends: ["subclassResponsibility"]
  27985. }),
  27986. $globals.Exporter);
  27987. $core.addMethod(
  27988. $core.method({
  27989. selector: "exportPackageImportsOf:on:",
  27990. protocol: 'output',
  27991. fn: function (aPackage,aStream){
  27992. var self=this;
  27993. return $core.withContext(function($ctx1) {
  27994. var $1,$2;
  27995. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  27996. return $core.withContext(function($ctx2) {
  27997. $recv(aStream)._nextPutAll_("$core.packages[");
  27998. $ctx2.sendIdx["nextPutAll:"]=1;
  27999. $1=$recv($recv(aPackage)._name())._asJavascript();
  28000. $ctx2.sendIdx["asJavascript"]=1;
  28001. $recv(aStream)._nextPutAll_($1);
  28002. $ctx2.sendIdx["nextPutAll:"]=2;
  28003. $recv(aStream)._nextPutAll_("].imports = ");
  28004. $ctx2.sendIdx["nextPutAll:"]=3;
  28005. $recv(aStream)._nextPutAll_($recv(imports)._asJavascript());
  28006. $ctx2.sendIdx["nextPutAll:"]=4;
  28007. $recv(aStream)._nextPutAll_(";");
  28008. $2=$recv(aStream)._lf();
  28009. return $2;
  28010. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  28011. }));
  28012. return self;
  28013. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28014. },
  28015. args: ["aPackage", "aStream"],
  28016. 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 ]",
  28017. referencedClasses: [],
  28018. messageSends: ["ifNotEmpty:", "importsAsJson", "nextPutAll:", "asJavascript", "name", "lf"]
  28019. }),
  28020. $globals.Exporter);
  28021. $core.addMethod(
  28022. $core.method({
  28023. selector: "exportPackagePrologueOf:on:",
  28024. protocol: 'output',
  28025. fn: function (aPackage,aStream){
  28026. var self=this;
  28027. return $core.withContext(function($ctx1) {
  28028. self._subclassResponsibility();
  28029. return self;
  28030. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28031. },
  28032. args: ["aPackage", "aStream"],
  28033. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  28034. referencedClasses: [],
  28035. messageSends: ["subclassResponsibility"]
  28036. }),
  28037. $globals.Exporter);
  28038. $core.addMethod(
  28039. $core.method({
  28040. selector: "exportPackageTransportOf:on:",
  28041. protocol: 'output',
  28042. fn: function (aPackage,aStream){
  28043. var self=this;
  28044. return $core.withContext(function($ctx1) {
  28045. var $1;
  28046. $recv(aStream)._nextPutAll_("$core.packages[");
  28047. $ctx1.sendIdx["nextPutAll:"]=1;
  28048. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
  28049. $ctx1.sendIdx["nextPutAll:"]=2;
  28050. $recv(aStream)._nextPutAll_("].transport = ");
  28051. $ctx1.sendIdx["nextPutAll:"]=3;
  28052. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._transport())._asJSONString());
  28053. $ctx1.sendIdx["nextPutAll:"]=4;
  28054. $recv(aStream)._nextPutAll_(";");
  28055. $1=$recv(aStream)._lf();
  28056. return self;
  28057. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28058. },
  28059. args: ["aPackage", "aStream"],
  28060. 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",
  28061. referencedClasses: [],
  28062. messageSends: ["nextPutAll:", "asJavascript", "name", "asJSONString", "transport", "lf"]
  28063. }),
  28064. $globals.Exporter);
  28065. $core.addMethod(
  28066. $core.method({
  28067. selector: "jsClassNameFor:",
  28068. protocol: 'convenience',
  28069. fn: function (aClass){
  28070. var self=this;
  28071. return $core.withContext(function($ctx1) {
  28072. var $2,$1,$receiver;
  28073. $2=$recv(aClass)._isMetaclass();
  28074. if($core.assert($2)){
  28075. $1=$recv(self._jsClassNameFor_($recv(aClass)._instanceClass())).__comma(".klass");
  28076. $ctx1.sendIdx[","]=1;
  28077. } else {
  28078. if(($receiver = aClass) == null || $receiver.isNil){
  28079. $1="null";
  28080. } else {
  28081. $1="$globals.".__comma($recv(aClass)._name());
  28082. };
  28083. };
  28084. return $1;
  28085. }, function($ctx1) {$ctx1.fill(self,"jsClassNameFor:",{aClass:aClass},$globals.Exporter)});
  28086. },
  28087. args: ["aClass"],
  28088. 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 ] ]",
  28089. referencedClasses: [],
  28090. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "jsClassNameFor:", "instanceClass", "ifNil:ifNotNil:", "name"]
  28091. }),
  28092. $globals.Exporter);
  28093. $core.addMethod(
  28094. $core.method({
  28095. selector: "ownMethodsOfClass:",
  28096. protocol: 'accessing',
  28097. fn: function (aClass){
  28098. var self=this;
  28099. return $core.withContext(function($ctx1) {
  28100. var $2,$1;
  28101. $1=$recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  28102. return $core.withContext(function($ctx2) {
  28103. $2=$recv(a)._selector();
  28104. $ctx2.sendIdx["selector"]=1;
  28105. return $recv($2).__lt_eq($recv(b)._selector());
  28106. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  28107. })))._reject_((function(each){
  28108. return $core.withContext(function($ctx2) {
  28109. return $recv($recv(each)._protocol())._match_("^\x5c*");
  28110. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  28111. }));
  28112. return $1;
  28113. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  28114. },
  28115. args: ["aClass"],
  28116. 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*') ]",
  28117. referencedClasses: [],
  28118. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  28119. }),
  28120. $globals.Exporter);
  28121. $core.addMethod(
  28122. $core.method({
  28123. selector: "ownMethodsOfMetaClass:",
  28124. protocol: 'accessing',
  28125. fn: function (aClass){
  28126. var self=this;
  28127. return $core.withContext(function($ctx1) {
  28128. var $1;
  28129. $1=self._ownMethodsOfClass_($recv(aClass)._class());
  28130. return $1;
  28131. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  28132. },
  28133. args: ["aClass"],
  28134. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass class",
  28135. referencedClasses: [],
  28136. messageSends: ["ownMethodsOfClass:", "class"]
  28137. }),
  28138. $globals.Exporter);
  28139. $core.addClass('AmdExporter', $globals.Exporter, ['namespace'], 'Platform-ImportExport');
  28140. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  28141. $core.addMethod(
  28142. $core.method({
  28143. selector: "amdNamesOfPackages:",
  28144. protocol: 'private',
  28145. fn: function (anArray){
  28146. var self=this;
  28147. return $core.withContext(function($ctx1) {
  28148. var $2,$1;
  28149. $1=$recv($recv(anArray)._select_((function(each){
  28150. return $core.withContext(function($ctx2) {
  28151. $2=self._amdNamespaceOfPackage_(each);
  28152. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  28153. return $recv($2)._notNil();
  28154. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28155. })))._collect_((function(each){
  28156. return $core.withContext(function($ctx2) {
  28157. return $recv($recv(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  28158. $ctx2.sendIdx[","]=1;
  28159. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  28160. }));
  28161. return $1;
  28162. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  28163. },
  28164. args: ["anArray"],
  28165. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  28166. referencedClasses: [],
  28167. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  28168. }),
  28169. $globals.AmdExporter);
  28170. $core.addMethod(
  28171. $core.method({
  28172. selector: "amdNamespaceOfPackage:",
  28173. protocol: 'private',
  28174. fn: function (aPackage){
  28175. var self=this;
  28176. return $core.withContext(function($ctx1) {
  28177. var $4,$3,$2,$1;
  28178. $4=$recv(aPackage)._transport();
  28179. $ctx1.sendIdx["transport"]=1;
  28180. $3=$recv($4)._type();
  28181. $2=$recv($3).__eq("amd");
  28182. if($core.assert($2)){
  28183. $1=$recv($recv(aPackage)._transport())._namespace();
  28184. } else {
  28185. $1=nil;
  28186. };
  28187. return $1;
  28188. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  28189. },
  28190. args: ["aPackage"],
  28191. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  28192. referencedClasses: [],
  28193. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  28194. }),
  28195. $globals.AmdExporter);
  28196. $core.addMethod(
  28197. $core.method({
  28198. selector: "exportPackageEpilogueOf:on:",
  28199. protocol: 'output',
  28200. fn: function (aPackage,aStream){
  28201. var self=this;
  28202. return $core.withContext(function($ctx1) {
  28203. var $1;
  28204. $recv(aStream)._nextPutAll_("});");
  28205. $1=$recv(aStream)._lf();
  28206. return self;
  28207. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  28208. },
  28209. args: ["aPackage", "aStream"],
  28210. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf",
  28211. referencedClasses: [],
  28212. messageSends: ["nextPutAll:", "lf"]
  28213. }),
  28214. $globals.AmdExporter);
  28215. $core.addMethod(
  28216. $core.method({
  28217. selector: "exportPackagePrologueOf:on:",
  28218. protocol: 'output',
  28219. fn: function (aPackage,aStream){
  28220. var self=this;
  28221. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  28222. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  28223. return $core.withContext(function($ctx1) {
  28224. var $1,$3,$2,$4,$6,$5,$7,$13,$12,$11,$10,$9,$8,$17,$16,$15,$14,$18;
  28225. pragmaStart="";
  28226. pragmaEnd="";
  28227. importsForOutput=self._importsForOutput_(aPackage);
  28228. loadDependencies=self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  28229. $1=$recv(importsForOutput)._value();
  28230. $ctx1.sendIdx["value"]=1;
  28231. $recv($1)._ifNotEmpty_((function(){
  28232. return $core.withContext(function($ctx2) {
  28233. $3=$recv($String())._lf();
  28234. $ctx2.sendIdx["lf"]=1;
  28235. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  28236. $ctx2.sendIdx[","]=2;
  28237. $4=$recv($String())._lf();
  28238. $ctx2.sendIdx["lf"]=2;
  28239. pragmaStart=$recv($2).__comma($4);
  28240. $ctx2.sendIdx[","]=1;
  28241. pragmaStart;
  28242. $6=$recv($String())._lf();
  28243. $ctx2.sendIdx["lf"]=3;
  28244. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  28245. $ctx2.sendIdx[","]=4;
  28246. $7=$recv($String())._lf();
  28247. $ctx2.sendIdx["lf"]=4;
  28248. pragmaEnd=$recv($5).__comma($7);
  28249. $ctx2.sendIdx[","]=3;
  28250. return pragmaEnd;
  28251. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28252. }));
  28253. $recv(aStream)._nextPutAll_("define(\x22");
  28254. $ctx1.sendIdx["nextPutAll:"]=1;
  28255. $recv(aStream)._nextPutAll_(self._amdNamespaceOfPackage_(aPackage));
  28256. $ctx1.sendIdx["nextPutAll:"]=2;
  28257. $recv(aStream)._nextPutAll_("/");
  28258. $ctx1.sendIdx["nextPutAll:"]=3;
  28259. $recv(aStream)._nextPutAll_($recv(aPackage)._name());
  28260. $ctx1.sendIdx["nextPutAll:"]=4;
  28261. $recv(aStream)._nextPutAll_("\x22, ");
  28262. $ctx1.sendIdx["nextPutAll:"]=5;
  28263. $13=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  28264. $ctx1.sendIdx[","]=7;
  28265. $12=$recv($13).__comma([":2:"]);
  28266. $ctx1.sendIdx[","]=6;
  28267. $11=$recv($12).__comma(loadDependencies);
  28268. $ctx1.sendIdx[","]=5;
  28269. $10=$recv($11)._asJavascript();
  28270. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  28271. $ctx1.sendIdx["replace:with:"]=2;
  28272. $8=$recv($9)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  28273. $ctx1.sendIdx["replace:with:"]=1;
  28274. $recv(aStream)._nextPutAll_($8);
  28275. $ctx1.sendIdx["nextPutAll:"]=6;
  28276. $recv(aStream)._nextPutAll_(", function(");
  28277. $ctx1.sendIdx["nextPutAll:"]=7;
  28278. $17=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  28279. $ctx1.sendIdx[","]=8;
  28280. $16=$recv($17)._join_(",");
  28281. $15=$recv($16)._replace_with_(",\x5cs*:1:",pragmaStart);
  28282. $14=$recv($15)._replace_with_(",\x5cs*:2:",pragmaEnd);
  28283. $ctx1.sendIdx["replace:with:"]=3;
  28284. $recv(aStream)._nextPutAll_($14);
  28285. $ctx1.sendIdx["nextPutAll:"]=8;
  28286. $recv(aStream)._nextPutAll_("){\x22use strict\x22;");
  28287. $ctx1.sendIdx["nextPutAll:"]=9;
  28288. $recv(aStream)._lf();
  28289. $ctx1.sendIdx["lf"]=5;
  28290. $recv(aStream)._nextPutAll_("var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;");
  28291. $18=$recv(aStream)._lf();
  28292. return self;
  28293. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  28294. },
  28295. args: ["aPackage", "aStream"],
  28296. 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",
  28297. referencedClasses: ["String"],
  28298. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "nextPutAll:", "amdNamespaceOfPackage:", "name", "replace:with:", "asJavascript", "join:", "key"]
  28299. }),
  28300. $globals.AmdExporter);
  28301. $core.addMethod(
  28302. $core.method({
  28303. selector: "importsForOutput:",
  28304. protocol: 'private',
  28305. fn: function (aPackage){
  28306. var self=this;
  28307. var namedImports,anonImports,importVarNames;
  28308. return $core.withContext(function($ctx1) {
  28309. var $1,$2;
  28310. namedImports=[];
  28311. anonImports=[];
  28312. importVarNames=[];
  28313. $recv($recv(aPackage)._imports())._do_((function(each){
  28314. return $core.withContext(function($ctx2) {
  28315. $1=$recv(each)._isString();
  28316. if($core.assert($1)){
  28317. return $recv(anonImports)._add_(each);
  28318. $ctx2.sendIdx["add:"]=1;
  28319. } else {
  28320. $recv(namedImports)._add_($recv(each)._value());
  28321. $ctx2.sendIdx["add:"]=2;
  28322. return $recv(importVarNames)._add_($recv(each)._key());
  28323. };
  28324. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28325. }));
  28326. $2=$recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  28327. return $2;
  28328. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  28329. },
  28330. args: ["aPackage"],
  28331. 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)",
  28332. referencedClasses: [],
  28333. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  28334. }),
  28335. $globals.AmdExporter);
  28336. $core.addClass('ChunkParser', $globals.Object, ['stream', 'last'], 'Platform-ImportExport');
  28337. $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";
  28338. $core.addMethod(
  28339. $core.method({
  28340. selector: "last",
  28341. protocol: 'accessing',
  28342. fn: function (){
  28343. var self=this;
  28344. var $1;
  28345. $1=self["@last"];
  28346. return $1;
  28347. },
  28348. args: [],
  28349. source: "last\x0a\x09^ last",
  28350. referencedClasses: [],
  28351. messageSends: []
  28352. }),
  28353. $globals.ChunkParser);
  28354. $core.addMethod(
  28355. $core.method({
  28356. selector: "nextChunk",
  28357. protocol: 'reading',
  28358. fn: function (){
  28359. var self=this;
  28360. var char,result,chunk;
  28361. return $core.withContext(function($ctx1) {
  28362. var $1,$2,$3,$4;
  28363. var $early={};
  28364. try {
  28365. result=""._writeStream();
  28366. $recv((function(){
  28367. return $core.withContext(function($ctx2) {
  28368. char=$recv(self["@stream"])._next();
  28369. $ctx2.sendIdx["next"]=1;
  28370. char;
  28371. return $recv(char)._notNil();
  28372. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28373. }))._whileTrue_((function(){
  28374. return $core.withContext(function($ctx2) {
  28375. $1=$recv(char).__eq("!");
  28376. $ctx2.sendIdx["="]=1;
  28377. if($core.assert($1)){
  28378. $2=$recv($recv(self["@stream"])._peek()).__eq("!");
  28379. if($core.assert($2)){
  28380. $recv(self["@stream"])._next();
  28381. } else {
  28382. self["@last"]=$recv($recv(result)._contents())._trimBoth();
  28383. $3=self["@last"];
  28384. throw $early=[$3];
  28385. };
  28386. };
  28387. return $recv(result)._nextPut_(char);
  28388. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  28389. }));
  28390. self["@last"]=nil;
  28391. $4=self["@last"];
  28392. return $4;
  28393. }
  28394. catch(e) {if(e===$early)return e[0]; throw e}
  28395. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  28396. },
  28397. args: [],
  28398. 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",
  28399. referencedClasses: [],
  28400. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  28401. }),
  28402. $globals.ChunkParser);
  28403. $core.addMethod(
  28404. $core.method({
  28405. selector: "stream:",
  28406. protocol: 'accessing',
  28407. fn: function (aStream){
  28408. var self=this;
  28409. self["@stream"]=aStream;
  28410. return self;
  28411. },
  28412. args: ["aStream"],
  28413. source: "stream: aStream\x0a\x09stream := aStream",
  28414. referencedClasses: [],
  28415. messageSends: []
  28416. }),
  28417. $globals.ChunkParser);
  28418. $core.addMethod(
  28419. $core.method({
  28420. selector: "on:",
  28421. protocol: 'instance creation',
  28422. fn: function (aStream){
  28423. var self=this;
  28424. return $core.withContext(function($ctx1) {
  28425. var $1;
  28426. $1=$recv(self._new())._stream_(aStream);
  28427. return $1;
  28428. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.klass)});
  28429. },
  28430. args: ["aStream"],
  28431. source: "on: aStream\x0a\x09^ self new stream: aStream",
  28432. referencedClasses: [],
  28433. messageSends: ["stream:", "new"]
  28434. }),
  28435. $globals.ChunkParser.klass);
  28436. $core.addClass('ClassCommentReader', $globals.Object, ['class'], 'Platform-ImportExport');
  28437. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  28438. $core.addMethod(
  28439. $core.method({
  28440. selector: "class:",
  28441. protocol: 'accessing',
  28442. fn: function (aClass){
  28443. var self=this;
  28444. self["@class"]=aClass;
  28445. return self;
  28446. },
  28447. args: ["aClass"],
  28448. source: "class: aClass\x0a\x09class := aClass",
  28449. referencedClasses: [],
  28450. messageSends: []
  28451. }),
  28452. $globals.ClassCommentReader);
  28453. $core.addMethod(
  28454. $core.method({
  28455. selector: "initialize",
  28456. protocol: 'initialization',
  28457. fn: function (){
  28458. var self=this;
  28459. return $core.withContext(function($ctx1) {
  28460. (
  28461. $ctx1.supercall = true,
  28462. $globals.ClassCommentReader.superclass.fn.prototype._initialize.apply($recv(self), []));
  28463. $ctx1.supercall = false;
  28464. return self;
  28465. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  28466. },
  28467. args: [],
  28468. source: "initialize\x0a\x09super initialize.",
  28469. referencedClasses: [],
  28470. messageSends: ["initialize"]
  28471. }),
  28472. $globals.ClassCommentReader);
  28473. $core.addMethod(
  28474. $core.method({
  28475. selector: "scanFrom:",
  28476. protocol: 'fileIn',
  28477. fn: function (aChunkParser){
  28478. var self=this;
  28479. var chunk;
  28480. return $core.withContext(function($ctx1) {
  28481. var $1;
  28482. chunk=$recv(aChunkParser)._nextChunk();
  28483. $1=$recv(chunk)._isEmpty();
  28484. if(!$core.assert($1)){
  28485. self._setComment_(chunk);
  28486. };
  28487. return self;
  28488. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  28489. },
  28490. args: ["aChunkParser"],
  28491. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk ].",
  28492. referencedClasses: [],
  28493. messageSends: ["nextChunk", "ifFalse:", "isEmpty", "setComment:"]
  28494. }),
  28495. $globals.ClassCommentReader);
  28496. $core.addMethod(
  28497. $core.method({
  28498. selector: "setComment:",
  28499. protocol: 'private',
  28500. fn: function (aString){
  28501. var self=this;
  28502. return $core.withContext(function($ctx1) {
  28503. $recv(self["@class"])._comment_(aString);
  28504. return self;
  28505. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  28506. },
  28507. args: ["aString"],
  28508. source: "setComment: aString\x0a\x09class comment: aString",
  28509. referencedClasses: [],
  28510. messageSends: ["comment:"]
  28511. }),
  28512. $globals.ClassCommentReader);
  28513. $core.addClass('ClassProtocolReader', $globals.Object, ['class', 'category'], 'Platform-ImportExport');
  28514. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  28515. $core.addMethod(
  28516. $core.method({
  28517. selector: "class:category:",
  28518. protocol: 'accessing',
  28519. fn: function (aClass,aString){
  28520. var self=this;
  28521. self["@class"]=aClass;
  28522. self["@category"]=aString;
  28523. return self;
  28524. },
  28525. args: ["aClass", "aString"],
  28526. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  28527. referencedClasses: [],
  28528. messageSends: []
  28529. }),
  28530. $globals.ClassProtocolReader);
  28531. $core.addMethod(
  28532. $core.method({
  28533. selector: "compileMethod:",
  28534. protocol: 'private',
  28535. fn: function (aString){
  28536. var self=this;
  28537. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  28538. return $core.withContext(function($ctx1) {
  28539. $recv($recv($Compiler())._new())._install_forClass_protocol_(aString,self["@class"],self["@category"]);
  28540. return self;
  28541. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  28542. },
  28543. args: ["aString"],
  28544. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  28545. referencedClasses: ["Compiler"],
  28546. messageSends: ["install:forClass:protocol:", "new"]
  28547. }),
  28548. $globals.ClassProtocolReader);
  28549. $core.addMethod(
  28550. $core.method({
  28551. selector: "initialize",
  28552. protocol: 'initialization',
  28553. fn: function (){
  28554. var self=this;
  28555. return $core.withContext(function($ctx1) {
  28556. (
  28557. $ctx1.supercall = true,
  28558. $globals.ClassProtocolReader.superclass.fn.prototype._initialize.apply($recv(self), []));
  28559. $ctx1.supercall = false;
  28560. return self;
  28561. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  28562. },
  28563. args: [],
  28564. source: "initialize\x0a\x09super initialize.",
  28565. referencedClasses: [],
  28566. messageSends: ["initialize"]
  28567. }),
  28568. $globals.ClassProtocolReader);
  28569. $core.addMethod(
  28570. $core.method({
  28571. selector: "scanFrom:",
  28572. protocol: 'fileIn',
  28573. fn: function (aChunkParser){
  28574. var self=this;
  28575. var chunk;
  28576. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  28577. return $core.withContext(function($ctx1) {
  28578. $recv((function(){
  28579. return $core.withContext(function($ctx2) {
  28580. chunk=$recv(aChunkParser)._nextChunk();
  28581. chunk;
  28582. return $recv(chunk)._isEmpty();
  28583. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28584. }))._whileFalse_((function(){
  28585. return $core.withContext(function($ctx2) {
  28586. return self._compileMethod_(chunk);
  28587. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  28588. }));
  28589. $recv($recv($ClassBuilder())._new())._setupClass_(self["@class"]);
  28590. return self;
  28591. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  28592. },
  28593. args: ["aChunkParser"],
  28594. 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",
  28595. referencedClasses: ["ClassBuilder"],
  28596. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:", "setupClass:", "new"]
  28597. }),
  28598. $globals.ClassProtocolReader);
  28599. $core.addClass('ExportMethodProtocol', $globals.Object, ['name', 'theClass'], 'Platform-ImportExport');
  28600. $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.";
  28601. $core.addMethod(
  28602. $core.method({
  28603. selector: "methods",
  28604. protocol: 'accessing',
  28605. fn: function (){
  28606. var self=this;
  28607. return $core.withContext(function($ctx1) {
  28608. var $2,$1;
  28609. $1=$recv($recv(self._theClass())._methodsInProtocol_(self._name()))._sorted_((function(a,b){
  28610. return $core.withContext(function($ctx2) {
  28611. $2=$recv(a)._selector();
  28612. $ctx2.sendIdx["selector"]=1;
  28613. return $recv($2).__lt_eq($recv(b)._selector());
  28614. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  28615. }));
  28616. return $1;
  28617. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  28618. },
  28619. args: [],
  28620. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  28621. referencedClasses: [],
  28622. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  28623. }),
  28624. $globals.ExportMethodProtocol);
  28625. $core.addMethod(
  28626. $core.method({
  28627. selector: "name",
  28628. protocol: 'accessing',
  28629. fn: function (){
  28630. var self=this;
  28631. var $1;
  28632. $1=self["@name"];
  28633. return $1;
  28634. },
  28635. args: [],
  28636. source: "name\x0a\x09^ name",
  28637. referencedClasses: [],
  28638. messageSends: []
  28639. }),
  28640. $globals.ExportMethodProtocol);
  28641. $core.addMethod(
  28642. $core.method({
  28643. selector: "name:",
  28644. protocol: 'accessing',
  28645. fn: function (aString){
  28646. var self=this;
  28647. self["@name"]=aString;
  28648. return self;
  28649. },
  28650. args: ["aString"],
  28651. source: "name: aString\x0a\x09name := aString",
  28652. referencedClasses: [],
  28653. messageSends: []
  28654. }),
  28655. $globals.ExportMethodProtocol);
  28656. $core.addMethod(
  28657. $core.method({
  28658. selector: "theClass",
  28659. protocol: 'accessing',
  28660. fn: function (){
  28661. var self=this;
  28662. var $1;
  28663. $1=self["@theClass"];
  28664. return $1;
  28665. },
  28666. args: [],
  28667. source: "theClass\x0a\x09^ theClass",
  28668. referencedClasses: [],
  28669. messageSends: []
  28670. }),
  28671. $globals.ExportMethodProtocol);
  28672. $core.addMethod(
  28673. $core.method({
  28674. selector: "theClass:",
  28675. protocol: 'accessing',
  28676. fn: function (aClass){
  28677. var self=this;
  28678. self["@theClass"]=aClass;
  28679. return self;
  28680. },
  28681. args: ["aClass"],
  28682. source: "theClass: aClass\x0a\x09theClass := aClass",
  28683. referencedClasses: [],
  28684. messageSends: []
  28685. }),
  28686. $globals.ExportMethodProtocol);
  28687. $core.addMethod(
  28688. $core.method({
  28689. selector: "name:theClass:",
  28690. protocol: 'instance creation',
  28691. fn: function (aString,aClass){
  28692. var self=this;
  28693. return $core.withContext(function($ctx1) {
  28694. var $2,$3,$1;
  28695. $2=self._new();
  28696. $recv($2)._name_(aString);
  28697. $recv($2)._theClass_(aClass);
  28698. $3=$recv($2)._yourself();
  28699. $1=$3;
  28700. return $1;
  28701. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.klass)});
  28702. },
  28703. args: ["aString", "aClass"],
  28704. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  28705. referencedClasses: [],
  28706. messageSends: ["name:", "new", "theClass:", "yourself"]
  28707. }),
  28708. $globals.ExportMethodProtocol.klass);
  28709. $core.addClass('Importer', $globals.Object, ['lastSection', 'lastChunk'], 'Platform-ImportExport');
  28710. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  28711. $core.addMethod(
  28712. $core.method({
  28713. selector: "import:",
  28714. protocol: 'fileIn',
  28715. fn: function (aStream){
  28716. var self=this;
  28717. var chunk,result,parser,lastEmpty;
  28718. function $ChunkParser(){return $globals.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)}
  28719. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  28720. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  28721. return $core.withContext(function($ctx1) {
  28722. var $1,$2;
  28723. parser=$recv($ChunkParser())._on_(aStream);
  28724. lastEmpty=false;
  28725. self["@lastSection"]="n/a, not started";
  28726. self["@lastChunk"]=nil;
  28727. $recv((function(){
  28728. return $core.withContext(function($ctx2) {
  28729. $recv((function(){
  28730. return $core.withContext(function($ctx3) {
  28731. chunk=$recv(parser)._nextChunk();
  28732. chunk;
  28733. return $recv(chunk)._isNil();
  28734. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28735. }))._whileFalse_((function(){
  28736. return $core.withContext(function($ctx3) {
  28737. $1=$recv(chunk)._isEmpty();
  28738. if($core.assert($1)){
  28739. lastEmpty=true;
  28740. return lastEmpty;
  28741. } else {
  28742. self["@lastSection"]=chunk;
  28743. self["@lastSection"];
  28744. result=$recv($recv($Compiler())._new())._evaluateExpression_(chunk);
  28745. result;
  28746. $2=lastEmpty;
  28747. if($core.assert($2)){
  28748. lastEmpty=false;
  28749. lastEmpty;
  28750. return $recv(result)._scanFrom_(parser);
  28751. };
  28752. };
  28753. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  28754. }));
  28755. self["@lastSection"]="n/a, finished";
  28756. return self["@lastSection"];
  28757. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28758. }))._on_do_($Error(),(function(e){
  28759. return $core.withContext(function($ctx2) {
  28760. self["@lastChunk"]=$recv(parser)._last();
  28761. self["@lastChunk"];
  28762. return $recv(e)._resignal();
  28763. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  28764. }));
  28765. return self;
  28766. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  28767. },
  28768. args: ["aStream"],
  28769. 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 ].",
  28770. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  28771. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifTrue:ifFalse:", "isEmpty", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "resignal"]
  28772. }),
  28773. $globals.Importer);
  28774. $core.addMethod(
  28775. $core.method({
  28776. selector: "lastChunk",
  28777. protocol: 'accessing',
  28778. fn: function (){
  28779. var self=this;
  28780. var $1;
  28781. $1=self["@lastChunk"];
  28782. return $1;
  28783. },
  28784. args: [],
  28785. source: "lastChunk\x0a\x09^ lastChunk",
  28786. referencedClasses: [],
  28787. messageSends: []
  28788. }),
  28789. $globals.Importer);
  28790. $core.addMethod(
  28791. $core.method({
  28792. selector: "lastSection",
  28793. protocol: 'accessing',
  28794. fn: function (){
  28795. var self=this;
  28796. var $1;
  28797. $1=self["@lastSection"];
  28798. return $1;
  28799. },
  28800. args: [],
  28801. source: "lastSection\x0a\x09^ lastSection",
  28802. referencedClasses: [],
  28803. messageSends: []
  28804. }),
  28805. $globals.Importer);
  28806. $core.addClass('PackageCommitError', $globals.Error, [], 'Platform-ImportExport');
  28807. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  28808. $core.addClass('PackageHandler', $globals.InterfacingObject, [], 'Platform-ImportExport');
  28809. $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.";
  28810. $core.addMethod(
  28811. $core.method({
  28812. selector: "ajaxPutAt:data:onSuccess:onError:",
  28813. protocol: 'private',
  28814. fn: function (aURL,aString,aBlock,anotherBlock){
  28815. var self=this;
  28816. var xhr;
  28817. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  28818. return $core.withContext(function($ctx1) {
  28819. var $1,$4,$3,$2;
  28820. xhr=$recv($Platform())._newXhr();
  28821. $recv(xhr)._open_url_async_("PUT",aURL,true);
  28822. $recv(xhr)._onreadystatechange_((function(){
  28823. return $core.withContext(function($ctx2) {
  28824. $1=$recv($recv(xhr)._readyState()).__eq((4));
  28825. if($core.assert($1)){
  28826. $4=$recv(xhr)._status();
  28827. $ctx2.sendIdx["status"]=1;
  28828. $3=$recv($4).__gt_eq((200));
  28829. $2=$recv($3)._and_((function(){
  28830. return $core.withContext(function($ctx3) {
  28831. return $recv($recv(xhr)._status()).__lt((300));
  28832. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  28833. }));
  28834. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  28835. };
  28836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28837. }));
  28838. $recv(xhr)._send_(aString);
  28839. return self;
  28840. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  28841. },
  28842. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  28843. 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",
  28844. referencedClasses: ["Platform"],
  28845. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  28846. }),
  28847. $globals.PackageHandler);
  28848. $core.addMethod(
  28849. $core.method({
  28850. selector: "chunkContentsFor:",
  28851. protocol: 'accessing',
  28852. fn: function (aPackage){
  28853. var self=this;
  28854. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  28855. return $core.withContext(function($ctx1) {
  28856. var $1;
  28857. $1=$recv($String())._streamContents_((function(str){
  28858. return $core.withContext(function($ctx2) {
  28859. return $recv(self._chunkExporter())._exportPackage_on_(aPackage,str);
  28860. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  28861. }));
  28862. return $1;
  28863. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28864. },
  28865. args: ["aPackage"],
  28866. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  28867. referencedClasses: ["String"],
  28868. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  28869. }),
  28870. $globals.PackageHandler);
  28871. $core.addMethod(
  28872. $core.method({
  28873. selector: "chunkExporter",
  28874. protocol: 'factory',
  28875. fn: function (){
  28876. var self=this;
  28877. return $core.withContext(function($ctx1) {
  28878. var $1;
  28879. $1=$recv(self._chunkExporterClass())._new();
  28880. return $1;
  28881. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  28882. },
  28883. args: [],
  28884. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  28885. referencedClasses: [],
  28886. messageSends: ["new", "chunkExporterClass"]
  28887. }),
  28888. $globals.PackageHandler);
  28889. $core.addMethod(
  28890. $core.method({
  28891. selector: "chunkExporterClass",
  28892. protocol: 'accessing',
  28893. fn: function (){
  28894. var self=this;
  28895. function $ChunkExporter(){return $globals.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  28896. return $ChunkExporter();
  28897. },
  28898. args: [],
  28899. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  28900. referencedClasses: ["ChunkExporter"],
  28901. messageSends: []
  28902. }),
  28903. $globals.PackageHandler);
  28904. $core.addMethod(
  28905. $core.method({
  28906. selector: "commit:",
  28907. protocol: 'committing',
  28908. fn: function (aPackage){
  28909. var self=this;
  28910. function $PackageCommitError(){return $globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)}
  28911. return $core.withContext(function($ctx1) {
  28912. var $1,$2,$3,$4;
  28913. self._commit_onSuccess_onError_(aPackage,(function(){
  28914. }),(function(error){
  28915. return $core.withContext(function($ctx2) {
  28916. $1=$recv($PackageCommitError())._new();
  28917. $2=$1;
  28918. $3=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  28919. $ctx2.sendIdx[","]=1;
  28920. $recv($2)._messageText_($3);
  28921. $4=$recv($1)._signal();
  28922. return $4;
  28923. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  28924. }));
  28925. return self;
  28926. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  28927. },
  28928. args: ["aPackage"],
  28929. 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 ]",
  28930. referencedClasses: ["PackageCommitError"],
  28931. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  28932. }),
  28933. $globals.PackageHandler);
  28934. $core.addMethod(
  28935. $core.method({
  28936. selector: "commit:onSuccess:onError:",
  28937. protocol: 'committing',
  28938. fn: function (aPackage,aBlock,anotherBlock){
  28939. var self=this;
  28940. return $core.withContext(function($ctx1) {
  28941. self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  28942. return $core.withContext(function($ctx2) {
  28943. return self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  28944. return $core.withContext(function($ctx3) {
  28945. $recv(aPackage)._beClean();
  28946. return $recv(aBlock)._value();
  28947. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28948. }),anotherBlock);
  28949. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28950. }),anotherBlock);
  28951. return self;
  28952. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28953. },
  28954. args: ["aPackage", "aBlock", "anotherBlock"],
  28955. 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",
  28956. referencedClasses: [],
  28957. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  28958. }),
  28959. $globals.PackageHandler);
  28960. $core.addMethod(
  28961. $core.method({
  28962. selector: "commitJsFileFor:onSuccess:onError:",
  28963. protocol: 'committing',
  28964. fn: function (aPackage,aBlock,anotherBlock){
  28965. var self=this;
  28966. return $core.withContext(function($ctx1) {
  28967. var $2,$1;
  28968. $2=$recv($recv(self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  28969. $ctx1.sendIdx[","]=2;
  28970. $1=$recv($2).__comma(".js");
  28971. $ctx1.sendIdx[","]=1;
  28972. self._ajaxPutAt_data_onSuccess_onError_($1,self._contentsFor_(aPackage),aBlock,anotherBlock);
  28973. return self;
  28974. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28975. },
  28976. args: ["aPackage", "aBlock", "anotherBlock"],
  28977. 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",
  28978. referencedClasses: [],
  28979. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  28980. }),
  28981. $globals.PackageHandler);
  28982. $core.addMethod(
  28983. $core.method({
  28984. selector: "commitPathJsFor:",
  28985. protocol: 'accessing',
  28986. fn: function (aPackage){
  28987. var self=this;
  28988. return $core.withContext(function($ctx1) {
  28989. self._subclassResponsibility();
  28990. return self;
  28991. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28992. },
  28993. args: ["aPackage"],
  28994. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  28995. referencedClasses: [],
  28996. messageSends: ["subclassResponsibility"]
  28997. }),
  28998. $globals.PackageHandler);
  28999. $core.addMethod(
  29000. $core.method({
  29001. selector: "commitPathStFor:",
  29002. protocol: 'accessing',
  29003. fn: function (aPackage){
  29004. var self=this;
  29005. return $core.withContext(function($ctx1) {
  29006. self._subclassResponsibility();
  29007. return self;
  29008. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  29009. },
  29010. args: ["aPackage"],
  29011. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  29012. referencedClasses: [],
  29013. messageSends: ["subclassResponsibility"]
  29014. }),
  29015. $globals.PackageHandler);
  29016. $core.addMethod(
  29017. $core.method({
  29018. selector: "commitStFileFor:onSuccess:onError:",
  29019. protocol: 'committing',
  29020. fn: function (aPackage,aBlock,anotherBlock){
  29021. var self=this;
  29022. return $core.withContext(function($ctx1) {
  29023. var $2,$1;
  29024. $2=$recv($recv(self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  29025. $ctx1.sendIdx[","]=2;
  29026. $1=$recv($2).__comma(".st");
  29027. $ctx1.sendIdx[","]=1;
  29028. self._ajaxPutAt_data_onSuccess_onError_($1,self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  29029. return self;
  29030. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  29031. },
  29032. args: ["aPackage", "aBlock", "anotherBlock"],
  29033. 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",
  29034. referencedClasses: [],
  29035. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  29036. }),
  29037. $globals.PackageHandler);
  29038. $core.addMethod(
  29039. $core.method({
  29040. selector: "contentsFor:",
  29041. protocol: 'accessing',
  29042. fn: function (aPackage){
  29043. var self=this;
  29044. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  29045. return $core.withContext(function($ctx1) {
  29046. var $1;
  29047. $1=$recv($String())._streamContents_((function(str){
  29048. return $core.withContext(function($ctx2) {
  29049. return $recv(self._exporter())._exportPackage_on_(aPackage,str);
  29050. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  29051. }));
  29052. return $1;
  29053. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  29054. },
  29055. args: ["aPackage"],
  29056. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  29057. referencedClasses: ["String"],
  29058. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  29059. }),
  29060. $globals.PackageHandler);
  29061. $core.addMethod(
  29062. $core.method({
  29063. selector: "exporter",
  29064. protocol: 'factory',
  29065. fn: function (){
  29066. var self=this;
  29067. return $core.withContext(function($ctx1) {
  29068. var $1;
  29069. $1=$recv(self._exporterClass())._new();
  29070. return $1;
  29071. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  29072. },
  29073. args: [],
  29074. source: "exporter\x0a\x09^ self exporterClass new",
  29075. referencedClasses: [],
  29076. messageSends: ["new", "exporterClass"]
  29077. }),
  29078. $globals.PackageHandler);
  29079. $core.addMethod(
  29080. $core.method({
  29081. selector: "exporterClass",
  29082. protocol: 'accessing',
  29083. fn: function (){
  29084. var self=this;
  29085. return $core.withContext(function($ctx1) {
  29086. self._subclassResponsibility();
  29087. return self;
  29088. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  29089. },
  29090. args: [],
  29091. source: "exporterClass\x0a\x09self subclassResponsibility",
  29092. referencedClasses: [],
  29093. messageSends: ["subclassResponsibility"]
  29094. }),
  29095. $globals.PackageHandler);
  29096. $core.addMethod(
  29097. $core.method({
  29098. selector: "load:",
  29099. protocol: 'loading',
  29100. fn: function (aPackage){
  29101. var self=this;
  29102. return $core.withContext(function($ctx1) {
  29103. self._subclassResponsibility();
  29104. return self;
  29105. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  29106. },
  29107. args: ["aPackage"],
  29108. source: "load: aPackage\x0a\x09self subclassResponsibility",
  29109. referencedClasses: [],
  29110. messageSends: ["subclassResponsibility"]
  29111. }),
  29112. $globals.PackageHandler);
  29113. $core.addMethod(
  29114. $core.method({
  29115. selector: "onCommitError:",
  29116. protocol: 'error handling',
  29117. fn: function (anError){
  29118. var self=this;
  29119. function $PackageCommitError(){return $globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)}
  29120. return $core.withContext(function($ctx1) {
  29121. var $1,$2,$3,$4;
  29122. $1=$recv($PackageCommitError())._new();
  29123. $2=$1;
  29124. $3=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  29125. $ctx1.sendIdx[","]=1;
  29126. $recv($2)._messageText_($3);
  29127. $4=$recv($1)._signal();
  29128. return self;
  29129. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  29130. },
  29131. args: ["anError"],
  29132. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  29133. referencedClasses: ["PackageCommitError"],
  29134. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  29135. }),
  29136. $globals.PackageHandler);
  29137. $core.addClass('AmdPackageHandler', $globals.PackageHandler, [], 'Platform-ImportExport');
  29138. $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.";
  29139. $core.addMethod(
  29140. $core.method({
  29141. selector: "commitPathJsFor:",
  29142. protocol: 'accessing',
  29143. fn: function (aPackage){
  29144. var self=this;
  29145. return $core.withContext(function($ctx1) {
  29146. var $1;
  29147. $1=self._toUrl_(self._namespaceFor_(aPackage));
  29148. return $1;
  29149. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29150. },
  29151. args: ["aPackage"],
  29152. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  29153. referencedClasses: [],
  29154. messageSends: ["toUrl:", "namespaceFor:"]
  29155. }),
  29156. $globals.AmdPackageHandler);
  29157. $core.addMethod(
  29158. $core.method({
  29159. selector: "commitPathStFor:",
  29160. protocol: 'accessing',
  29161. fn: function (aPackage){
  29162. var self=this;
  29163. var path,pathWithout;
  29164. return $core.withContext(function($ctx1) {
  29165. var $1,$3,$2;
  29166. $1=$recv(self._namespaceFor_(aPackage)).__comma("/_source");
  29167. $ctx1.sendIdx[","]=1;
  29168. path=self._toUrl_($1);
  29169. pathWithout=self._commitPathJsFor_(aPackage);
  29170. $3=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  29171. if($core.assert($3)){
  29172. $2=pathWithout;
  29173. } else {
  29174. $2=path;
  29175. };
  29176. return $2;
  29177. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  29178. },
  29179. args: ["aPackage"],
  29180. 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 ]",
  29181. referencedClasses: [],
  29182. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  29183. }),
  29184. $globals.AmdPackageHandler);
  29185. $core.addMethod(
  29186. $core.method({
  29187. selector: "exporterClass",
  29188. protocol: 'accessing',
  29189. fn: function (){
  29190. var self=this;
  29191. function $AmdExporter(){return $globals.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)}
  29192. return $AmdExporter();
  29193. },
  29194. args: [],
  29195. source: "exporterClass\x0a\x09^ AmdExporter",
  29196. referencedClasses: ["AmdExporter"],
  29197. messageSends: []
  29198. }),
  29199. $globals.AmdPackageHandler);
  29200. $core.addMethod(
  29201. $core.method({
  29202. selector: "load:",
  29203. protocol: 'loading',
  29204. fn: function (aPackage){
  29205. var self=this;
  29206. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29207. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  29208. return $core.withContext(function($ctx1) {
  29209. var $1,$3,$2,$receiver;
  29210. $1=$recv($Smalltalk())._amdRequire();
  29211. if(($receiver = $1) == null || $receiver.isNil){
  29212. self._error_("AMD loader not present");
  29213. } else {
  29214. var require;
  29215. require=$receiver;
  29216. $3=$recv($recv(self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  29217. $ctx1.sendIdx[","]=1;
  29218. $2=$recv($Array())._with_($3);
  29219. $recv(require)._value_($2);
  29220. };
  29221. return self;
  29222. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29223. },
  29224. args: ["aPackage"],
  29225. 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 ) ]",
  29226. referencedClasses: ["Smalltalk", "Array"],
  29227. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "with:", ",", "namespaceFor:", "name"]
  29228. }),
  29229. $globals.AmdPackageHandler);
  29230. $core.addMethod(
  29231. $core.method({
  29232. selector: "namespaceFor:",
  29233. protocol: 'committing',
  29234. fn: function (aPackage){
  29235. var self=this;
  29236. return $core.withContext(function($ctx1) {
  29237. var $1;
  29238. $1=$recv($recv(aPackage)._transport())._namespace();
  29239. return $1;
  29240. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29241. },
  29242. args: ["aPackage"],
  29243. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  29244. referencedClasses: [],
  29245. messageSends: ["namespace", "transport"]
  29246. }),
  29247. $globals.AmdPackageHandler);
  29248. $core.addMethod(
  29249. $core.method({
  29250. selector: "toUrl:",
  29251. protocol: 'private',
  29252. fn: function (aString){
  29253. var self=this;
  29254. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29255. return $core.withContext(function($ctx1) {
  29256. var $2,$1,$receiver;
  29257. $2=$recv($Smalltalk())._amdRequire();
  29258. if(($receiver = $2) == null || $receiver.isNil){
  29259. $1=self._error_("AMD loader not present");
  29260. } else {
  29261. var require;
  29262. require=$receiver;
  29263. $1=$recv($recv(require)._basicAt_("toUrl"))._value_(aString);
  29264. };
  29265. return $1;
  29266. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  29267. },
  29268. args: ["aString"],
  29269. 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 ]",
  29270. referencedClasses: ["Smalltalk"],
  29271. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"]
  29272. }),
  29273. $globals.AmdPackageHandler);
  29274. $core.addMethod(
  29275. $core.method({
  29276. selector: "defaultNamespace",
  29277. protocol: 'commit paths',
  29278. fn: function (){
  29279. var self=this;
  29280. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29281. return $core.withContext(function($ctx1) {
  29282. var $1;
  29283. $1=$recv($Smalltalk())._defaultAmdNamespace();
  29284. return $1;
  29285. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.klass)});
  29286. },
  29287. args: [],
  29288. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  29289. referencedClasses: ["Smalltalk"],
  29290. messageSends: ["defaultAmdNamespace"]
  29291. }),
  29292. $globals.AmdPackageHandler.klass);
  29293. $core.addMethod(
  29294. $core.method({
  29295. selector: "defaultNamespace:",
  29296. protocol: 'commit paths',
  29297. fn: function (aString){
  29298. var self=this;
  29299. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29300. return $core.withContext(function($ctx1) {
  29301. $recv($Smalltalk())._defaultAmdNamespace_(aString);
  29302. return self;
  29303. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.klass)});
  29304. },
  29305. args: ["aString"],
  29306. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  29307. referencedClasses: ["Smalltalk"],
  29308. messageSends: ["defaultAmdNamespace:"]
  29309. }),
  29310. $globals.AmdPackageHandler.klass);
  29311. $core.addClass('PackageTransport', $globals.Object, ['package'], 'Platform-ImportExport');
  29312. $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.";
  29313. $core.addMethod(
  29314. $core.method({
  29315. selector: "asJSON",
  29316. protocol: 'converting',
  29317. fn: function (){
  29318. var self=this;
  29319. return $core.withContext(function($ctx1) {
  29320. var $1;
  29321. $1=$globals.HashedCollection._newFromPairs_(["type",self._type()]);
  29322. return $1;
  29323. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.PackageTransport)});
  29324. },
  29325. args: [],
  29326. source: "asJSON\x0a\x09^ #{ 'type' -> self type }",
  29327. referencedClasses: [],
  29328. messageSends: ["type"]
  29329. }),
  29330. $globals.PackageTransport);
  29331. $core.addMethod(
  29332. $core.method({
  29333. selector: "commit",
  29334. protocol: 'committing',
  29335. fn: function (){
  29336. var self=this;
  29337. return $core.withContext(function($ctx1) {
  29338. $recv(self._commitHandler())._commit_(self._package());
  29339. return self;
  29340. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  29341. },
  29342. args: [],
  29343. source: "commit\x0a\x09self commitHandler commit: self package",
  29344. referencedClasses: [],
  29345. messageSends: ["commit:", "commitHandler", "package"]
  29346. }),
  29347. $globals.PackageTransport);
  29348. $core.addMethod(
  29349. $core.method({
  29350. selector: "commitHandler",
  29351. protocol: 'factory',
  29352. fn: function (){
  29353. var self=this;
  29354. return $core.withContext(function($ctx1) {
  29355. var $1;
  29356. $1=$recv(self._commitHandlerClass())._new();
  29357. return $1;
  29358. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  29359. },
  29360. args: [],
  29361. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  29362. referencedClasses: [],
  29363. messageSends: ["new", "commitHandlerClass"]
  29364. }),
  29365. $globals.PackageTransport);
  29366. $core.addMethod(
  29367. $core.method({
  29368. selector: "commitHandlerClass",
  29369. protocol: 'accessing',
  29370. fn: function (){
  29371. var self=this;
  29372. return $core.withContext(function($ctx1) {
  29373. self._subclassResponsibility();
  29374. return self;
  29375. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  29376. },
  29377. args: [],
  29378. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  29379. referencedClasses: [],
  29380. messageSends: ["subclassResponsibility"]
  29381. }),
  29382. $globals.PackageTransport);
  29383. $core.addMethod(
  29384. $core.method({
  29385. selector: "commitOnSuccess:onError:",
  29386. protocol: 'committing',
  29387. fn: function (aBlock,anotherBlock){
  29388. var self=this;
  29389. return $core.withContext(function($ctx1) {
  29390. $recv(self._commitHandler())._commit_onSuccess_onError_(self._package(),aBlock,anotherBlock);
  29391. return self;
  29392. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  29393. },
  29394. args: ["aBlock", "anotherBlock"],
  29395. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  29396. referencedClasses: [],
  29397. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  29398. }),
  29399. $globals.PackageTransport);
  29400. $core.addMethod(
  29401. $core.method({
  29402. selector: "definition",
  29403. protocol: 'accessing',
  29404. fn: function (){
  29405. var self=this;
  29406. return "";
  29407. },
  29408. args: [],
  29409. source: "definition\x0a\x09^ ''",
  29410. referencedClasses: [],
  29411. messageSends: []
  29412. }),
  29413. $globals.PackageTransport);
  29414. $core.addMethod(
  29415. $core.method({
  29416. selector: "load",
  29417. protocol: 'loading',
  29418. fn: function (){
  29419. var self=this;
  29420. return $core.withContext(function($ctx1) {
  29421. $recv(self._commitHandler())._load_(self._package());
  29422. return self;
  29423. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  29424. },
  29425. args: [],
  29426. source: "load\x0a\x09self commitHandler load: self package",
  29427. referencedClasses: [],
  29428. messageSends: ["load:", "commitHandler", "package"]
  29429. }),
  29430. $globals.PackageTransport);
  29431. $core.addMethod(
  29432. $core.method({
  29433. selector: "package",
  29434. protocol: 'accessing',
  29435. fn: function (){
  29436. var self=this;
  29437. var $1;
  29438. $1=self["@package"];
  29439. return $1;
  29440. },
  29441. args: [],
  29442. source: "package\x0a\x09^ package",
  29443. referencedClasses: [],
  29444. messageSends: []
  29445. }),
  29446. $globals.PackageTransport);
  29447. $core.addMethod(
  29448. $core.method({
  29449. selector: "package:",
  29450. protocol: 'accessing',
  29451. fn: function (aPackage){
  29452. var self=this;
  29453. self["@package"]=aPackage;
  29454. return self;
  29455. },
  29456. args: ["aPackage"],
  29457. source: "package: aPackage\x0a\x09package := aPackage",
  29458. referencedClasses: [],
  29459. messageSends: []
  29460. }),
  29461. $globals.PackageTransport);
  29462. $core.addMethod(
  29463. $core.method({
  29464. selector: "setupFromJson:",
  29465. protocol: 'initialization',
  29466. fn: function (anObject){
  29467. var self=this;
  29468. return self;
  29469. },
  29470. args: ["anObject"],
  29471. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  29472. referencedClasses: [],
  29473. messageSends: []
  29474. }),
  29475. $globals.PackageTransport);
  29476. $core.addMethod(
  29477. $core.method({
  29478. selector: "type",
  29479. protocol: 'accessing',
  29480. fn: function (){
  29481. var self=this;
  29482. return $core.withContext(function($ctx1) {
  29483. var $1;
  29484. $1=$recv(self._class())._type();
  29485. return $1;
  29486. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  29487. },
  29488. args: [],
  29489. source: "type\x0a\x09^ self class type",
  29490. referencedClasses: [],
  29491. messageSends: ["type", "class"]
  29492. }),
  29493. $globals.PackageTransport);
  29494. $globals.PackageTransport.klass.iVarNames = ['registry'];
  29495. $core.addMethod(
  29496. $core.method({
  29497. selector: "classRegisteredFor:",
  29498. protocol: 'accessing',
  29499. fn: function (aString){
  29500. var self=this;
  29501. return $core.withContext(function($ctx1) {
  29502. var $1;
  29503. $1=$recv(self["@registry"])._at_(aString);
  29504. return $1;
  29505. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.klass)});
  29506. },
  29507. args: ["aString"],
  29508. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  29509. referencedClasses: [],
  29510. messageSends: ["at:"]
  29511. }),
  29512. $globals.PackageTransport.klass);
  29513. $core.addMethod(
  29514. $core.method({
  29515. selector: "defaultType",
  29516. protocol: 'accessing',
  29517. fn: function (){
  29518. var self=this;
  29519. function $AmdPackageTransport(){return $globals.AmdPackageTransport||(typeof AmdPackageTransport=="undefined"?nil:AmdPackageTransport)}
  29520. return $core.withContext(function($ctx1) {
  29521. var $1;
  29522. $1=$recv($AmdPackageTransport())._type();
  29523. return $1;
  29524. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.klass)});
  29525. },
  29526. args: [],
  29527. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  29528. referencedClasses: ["AmdPackageTransport"],
  29529. messageSends: ["type"]
  29530. }),
  29531. $globals.PackageTransport.klass);
  29532. $core.addMethod(
  29533. $core.method({
  29534. selector: "for:",
  29535. protocol: 'instance creation',
  29536. fn: function (aString){
  29537. var self=this;
  29538. return $core.withContext(function($ctx1) {
  29539. var $1;
  29540. $1=$recv(self._classRegisteredFor_(aString))._new();
  29541. return $1;
  29542. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.klass)});
  29543. },
  29544. args: ["aString"],
  29545. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  29546. referencedClasses: [],
  29547. messageSends: ["new", "classRegisteredFor:"]
  29548. }),
  29549. $globals.PackageTransport.klass);
  29550. $core.addMethod(
  29551. $core.method({
  29552. selector: "fromJson:",
  29553. protocol: 'instance creation',
  29554. fn: function (anObject){
  29555. var self=this;
  29556. return $core.withContext(function($ctx1) {
  29557. var $1,$3,$4,$2,$receiver;
  29558. if(($receiver = anObject) == null || $receiver.isNil){
  29559. $1=self._for_(self._defaultType());
  29560. $ctx1.sendIdx["for:"]=1;
  29561. return $1;
  29562. } else {
  29563. anObject;
  29564. };
  29565. $3=self._for_($recv(anObject)._type());
  29566. $recv($3)._setupFromJson_(anObject);
  29567. $4=$recv($3)._yourself();
  29568. $2=$4;
  29569. return $2;
  29570. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.klass)});
  29571. },
  29572. args: ["anObject"],
  29573. 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",
  29574. referencedClasses: [],
  29575. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  29576. }),
  29577. $globals.PackageTransport.klass);
  29578. $core.addMethod(
  29579. $core.method({
  29580. selector: "initialize",
  29581. protocol: 'initialization',
  29582. fn: function (){
  29583. var self=this;
  29584. function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  29585. return $core.withContext(function($ctx1) {
  29586. var $1;
  29587. (
  29588. $ctx1.supercall = true,
  29589. $globals.PackageTransport.klass.superclass.fn.prototype._initialize.apply($recv(self), []));
  29590. $ctx1.supercall = false;
  29591. $1=self.__eq_eq($PackageTransport());
  29592. if($core.assert($1)){
  29593. self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  29594. self["@registry"];
  29595. } else {
  29596. self._register();
  29597. };
  29598. return self;
  29599. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.klass)});
  29600. },
  29601. args: [],
  29602. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  29603. referencedClasses: ["PackageTransport"],
  29604. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  29605. }),
  29606. $globals.PackageTransport.klass);
  29607. $core.addMethod(
  29608. $core.method({
  29609. selector: "register",
  29610. protocol: 'registration',
  29611. fn: function (){
  29612. var self=this;
  29613. function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  29614. return $core.withContext(function($ctx1) {
  29615. $recv($PackageTransport())._register_(self);
  29616. return self;
  29617. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.klass)});
  29618. },
  29619. args: [],
  29620. source: "register\x0a\x09PackageTransport register: self",
  29621. referencedClasses: ["PackageTransport"],
  29622. messageSends: ["register:"]
  29623. }),
  29624. $globals.PackageTransport.klass);
  29625. $core.addMethod(
  29626. $core.method({
  29627. selector: "register:",
  29628. protocol: 'registration',
  29629. fn: function (aClass){
  29630. var self=this;
  29631. return $core.withContext(function($ctx1) {
  29632. var $1,$receiver;
  29633. $1=$recv(aClass)._type();
  29634. $ctx1.sendIdx["type"]=1;
  29635. if(($receiver = $1) == null || $receiver.isNil){
  29636. $1;
  29637. } else {
  29638. $recv(self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  29639. };
  29640. return self;
  29641. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.klass)});
  29642. },
  29643. args: ["aClass"],
  29644. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  29645. referencedClasses: [],
  29646. messageSends: ["ifNotNil:", "type", "at:put:"]
  29647. }),
  29648. $globals.PackageTransport.klass);
  29649. $core.addMethod(
  29650. $core.method({
  29651. selector: "type",
  29652. protocol: 'accessing',
  29653. fn: function (){
  29654. var self=this;
  29655. return nil;
  29656. },
  29657. args: [],
  29658. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  29659. referencedClasses: [],
  29660. messageSends: []
  29661. }),
  29662. $globals.PackageTransport.klass);
  29663. $core.addClass('AmdPackageTransport', $globals.PackageTransport, ['namespace'], 'Platform-ImportExport');
  29664. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  29665. $core.addMethod(
  29666. $core.method({
  29667. selector: "asJSON",
  29668. protocol: 'converting',
  29669. fn: function (){
  29670. var self=this;
  29671. return $core.withContext(function($ctx1) {
  29672. var $2,$3,$1;
  29673. $2=(
  29674. $ctx1.supercall = true,
  29675. $globals.AmdPackageTransport.superclass.fn.prototype._asJSON.apply($recv(self), []));
  29676. $ctx1.supercall = false;
  29677. $recv($2)._at_put_("amdNamespace",self._namespace());
  29678. $3=$recv($2)._yourself();
  29679. $1=$3;
  29680. return $1;
  29681. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.AmdPackageTransport)});
  29682. },
  29683. args: [],
  29684. source: "asJSON\x0a\x09^ super asJSON\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  29685. referencedClasses: [],
  29686. messageSends: ["at:put:", "asJSON", "namespace", "yourself"]
  29687. }),
  29688. $globals.AmdPackageTransport);
  29689. $core.addMethod(
  29690. $core.method({
  29691. selector: "commitHandlerClass",
  29692. protocol: 'accessing',
  29693. fn: function (){
  29694. var self=this;
  29695. function $AmdPackageHandler(){return $globals.AmdPackageHandler||(typeof AmdPackageHandler=="undefined"?nil:AmdPackageHandler)}
  29696. return $AmdPackageHandler();
  29697. },
  29698. args: [],
  29699. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  29700. referencedClasses: ["AmdPackageHandler"],
  29701. messageSends: []
  29702. }),
  29703. $globals.AmdPackageTransport);
  29704. $core.addMethod(
  29705. $core.method({
  29706. selector: "defaultNamespace",
  29707. protocol: 'defaults',
  29708. fn: function (){
  29709. var self=this;
  29710. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29711. return $core.withContext(function($ctx1) {
  29712. var $1;
  29713. $1=$recv($Smalltalk())._defaultAmdNamespace();
  29714. return $1;
  29715. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  29716. },
  29717. args: [],
  29718. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  29719. referencedClasses: ["Smalltalk"],
  29720. messageSends: ["defaultAmdNamespace"]
  29721. }),
  29722. $globals.AmdPackageTransport);
  29723. $core.addMethod(
  29724. $core.method({
  29725. selector: "definition",
  29726. protocol: 'accessing',
  29727. fn: function (){
  29728. var self=this;
  29729. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  29730. return $core.withContext(function($ctx1) {
  29731. var $3,$2,$1;
  29732. $1=$recv($String())._streamContents_((function(stream){
  29733. return $core.withContext(function($ctx2) {
  29734. $recv(stream)._nextPutAll_($recv(self._class())._name());
  29735. $ctx2.sendIdx["nextPutAll:"]=1;
  29736. $recv(stream)._nextPutAll_(" namespace: ");
  29737. $ctx2.sendIdx["nextPutAll:"]=2;
  29738. $3=$recv("'".__comma(self._namespace())).__comma("'");
  29739. $ctx2.sendIdx[","]=1;
  29740. $2=$recv(stream)._nextPutAll_($3);
  29741. return $2;
  29742. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  29743. }));
  29744. return $1;
  29745. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  29746. },
  29747. args: [],
  29748. 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, '''' ]",
  29749. referencedClasses: ["String"],
  29750. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "namespace"]
  29751. }),
  29752. $globals.AmdPackageTransport);
  29753. $core.addMethod(
  29754. $core.method({
  29755. selector: "namespace",
  29756. protocol: 'accessing',
  29757. fn: function (){
  29758. var self=this;
  29759. return $core.withContext(function($ctx1) {
  29760. var $2,$1,$receiver;
  29761. $2=self["@namespace"];
  29762. if(($receiver = $2) == null || $receiver.isNil){
  29763. $1=self._defaultNamespace();
  29764. } else {
  29765. $1=$2;
  29766. };
  29767. return $1;
  29768. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  29769. },
  29770. args: [],
  29771. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  29772. referencedClasses: [],
  29773. messageSends: ["ifNil:", "defaultNamespace"]
  29774. }),
  29775. $globals.AmdPackageTransport);
  29776. $core.addMethod(
  29777. $core.method({
  29778. selector: "namespace:",
  29779. protocol: 'accessing',
  29780. fn: function (aString){
  29781. var self=this;
  29782. self["@namespace"]=aString;
  29783. return self;
  29784. },
  29785. args: ["aString"],
  29786. source: "namespace: aString\x0a\x09namespace := aString",
  29787. referencedClasses: [],
  29788. messageSends: []
  29789. }),
  29790. $globals.AmdPackageTransport);
  29791. $core.addMethod(
  29792. $core.method({
  29793. selector: "printOn:",
  29794. protocol: 'printing',
  29795. fn: function (aStream){
  29796. var self=this;
  29797. return $core.withContext(function($ctx1) {
  29798. var $1;
  29799. (
  29800. $ctx1.supercall = true,
  29801. $globals.AmdPackageTransport.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  29802. $ctx1.supercall = false;
  29803. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  29804. $ctx1.sendIdx["nextPutAll:"]=1;
  29805. $recv(aStream)._nextPutAll_(self._namespace());
  29806. $ctx1.sendIdx["nextPutAll:"]=2;
  29807. $1=$recv(aStream)._nextPutAll_(")");
  29808. return self;
  29809. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  29810. },
  29811. args: ["aStream"],
  29812. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  29813. referencedClasses: [],
  29814. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  29815. }),
  29816. $globals.AmdPackageTransport);
  29817. $core.addMethod(
  29818. $core.method({
  29819. selector: "setPath:",
  29820. protocol: 'actions',
  29821. fn: function (aString){
  29822. var self=this;
  29823. return $core.withContext(function($ctx1) {
  29824. $recv($recv(require)._basicAt_("config"))._value_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([self._namespace(),aString])]));
  29825. return self;
  29826. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  29827. },
  29828. args: ["aString"],
  29829. 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}.",
  29830. referencedClasses: [],
  29831. messageSends: ["value:", "basicAt:", "namespace"]
  29832. }),
  29833. $globals.AmdPackageTransport);
  29834. $core.addMethod(
  29835. $core.method({
  29836. selector: "setupFromJson:",
  29837. protocol: 'initialization',
  29838. fn: function (anObject){
  29839. var self=this;
  29840. return $core.withContext(function($ctx1) {
  29841. self._namespace_($recv(anObject)._at_("amdNamespace"));
  29842. return self;
  29843. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  29844. },
  29845. args: ["anObject"],
  29846. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  29847. referencedClasses: [],
  29848. messageSends: ["namespace:", "at:"]
  29849. }),
  29850. $globals.AmdPackageTransport);
  29851. $core.addMethod(
  29852. $core.method({
  29853. selector: "namespace:",
  29854. protocol: 'instance creation',
  29855. fn: function (aString){
  29856. var self=this;
  29857. return $core.withContext(function($ctx1) {
  29858. var $2,$3,$1;
  29859. $2=self._new();
  29860. $recv($2)._namespace_(aString);
  29861. $3=$recv($2)._yourself();
  29862. $1=$3;
  29863. return $1;
  29864. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.klass)});
  29865. },
  29866. args: ["aString"],
  29867. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  29868. referencedClasses: [],
  29869. messageSends: ["namespace:", "new", "yourself"]
  29870. }),
  29871. $globals.AmdPackageTransport.klass);
  29872. $core.addMethod(
  29873. $core.method({
  29874. selector: "type",
  29875. protocol: 'accessing',
  29876. fn: function (){
  29877. var self=this;
  29878. return "amd";
  29879. },
  29880. args: [],
  29881. source: "type\x0a\x09^ 'amd'",
  29882. referencedClasses: [],
  29883. messageSends: []
  29884. }),
  29885. $globals.AmdPackageTransport.klass);
  29886. $core.addMethod(
  29887. $core.method({
  29888. selector: "commentStamp",
  29889. protocol: '*Platform-ImportExport',
  29890. fn: function (){
  29891. var self=this;
  29892. function $ClassCommentReader(){return $globals.ClassCommentReader||(typeof ClassCommentReader=="undefined"?nil:ClassCommentReader)}
  29893. return $core.withContext(function($ctx1) {
  29894. var $2,$3,$1;
  29895. $2=$recv($ClassCommentReader())._new();
  29896. $recv($2)._class_(self);
  29897. $3=$recv($2)._yourself();
  29898. $1=$3;
  29899. return $1;
  29900. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.Behavior)});
  29901. },
  29902. args: [],
  29903. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  29904. referencedClasses: ["ClassCommentReader"],
  29905. messageSends: ["class:", "new", "yourself"]
  29906. }),
  29907. $globals.Behavior);
  29908. $core.addMethod(
  29909. $core.method({
  29910. selector: "commentStamp:prior:",
  29911. protocol: '*Platform-ImportExport',
  29912. fn: function (aStamp,prior){
  29913. var self=this;
  29914. return $core.withContext(function($ctx1) {
  29915. var $1;
  29916. $1=self._commentStamp();
  29917. return $1;
  29918. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.Behavior)});
  29919. },
  29920. args: ["aStamp", "prior"],
  29921. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  29922. referencedClasses: [],
  29923. messageSends: ["commentStamp"]
  29924. }),
  29925. $globals.Behavior);
  29926. $core.addMethod(
  29927. $core.method({
  29928. selector: "methodsFor:",
  29929. protocol: '*Platform-ImportExport',
  29930. fn: function (aString){
  29931. var self=this;
  29932. function $ClassProtocolReader(){return $globals.ClassProtocolReader||(typeof ClassProtocolReader=="undefined"?nil:ClassProtocolReader)}
  29933. return $core.withContext(function($ctx1) {
  29934. var $2,$3,$1;
  29935. $2=$recv($ClassProtocolReader())._new();
  29936. $recv($2)._class_category_(self,aString);
  29937. $3=$recv($2)._yourself();
  29938. $1=$3;
  29939. return $1;
  29940. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.Behavior)});
  29941. },
  29942. args: ["aString"],
  29943. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  29944. referencedClasses: ["ClassProtocolReader"],
  29945. messageSends: ["class:category:", "new", "yourself"]
  29946. }),
  29947. $globals.Behavior);
  29948. $core.addMethod(
  29949. $core.method({
  29950. selector: "methodsFor:stamp:",
  29951. protocol: '*Platform-ImportExport',
  29952. fn: function (aString,aStamp){
  29953. var self=this;
  29954. return $core.withContext(function($ctx1) {
  29955. var $1;
  29956. $1=self._methodsFor_(aString);
  29957. return $1;
  29958. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.Behavior)});
  29959. },
  29960. args: ["aString", "aStamp"],
  29961. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  29962. referencedClasses: [],
  29963. messageSends: ["methodsFor:"]
  29964. }),
  29965. $globals.Behavior);
  29966. $core.addMethod(
  29967. $core.method({
  29968. selector: "commit",
  29969. protocol: '*Platform-ImportExport',
  29970. fn: function (){
  29971. var self=this;
  29972. return $core.withContext(function($ctx1) {
  29973. var $1;
  29974. $1=$recv(self._transport())._commit();
  29975. return $1;
  29976. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  29977. },
  29978. args: [],
  29979. source: "commit\x0a\x09^ self transport commit",
  29980. referencedClasses: [],
  29981. messageSends: ["commit", "transport"]
  29982. }),
  29983. $globals.Package);
  29984. $core.addMethod(
  29985. $core.method({
  29986. selector: "load",
  29987. protocol: '*Platform-ImportExport',
  29988. fn: function (){
  29989. var self=this;
  29990. return $core.withContext(function($ctx1) {
  29991. var $1;
  29992. $1=$recv(self._transport())._load();
  29993. return $1;
  29994. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  29995. },
  29996. args: [],
  29997. source: "load\x0a\x09^ self transport load",
  29998. referencedClasses: [],
  29999. messageSends: ["load", "transport"]
  30000. }),
  30001. $globals.Package);
  30002. $core.addMethod(
  30003. $core.method({
  30004. selector: "loadFromNamespace:",
  30005. protocol: '*Platform-ImportExport',
  30006. fn: function (aString){
  30007. var self=this;
  30008. return $core.withContext(function($ctx1) {
  30009. var $2,$3,$1;
  30010. $2=self._transport();
  30011. $recv($2)._namespace_(aString);
  30012. $3=$recv($2)._load();
  30013. $1=$3;
  30014. return $1;
  30015. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  30016. },
  30017. args: ["aString"],
  30018. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  30019. referencedClasses: [],
  30020. messageSends: ["namespace:", "transport", "load"]
  30021. }),
  30022. $globals.Package);
  30023. $core.addMethod(
  30024. $core.method({
  30025. selector: "load:",
  30026. protocol: '*Platform-ImportExport',
  30027. fn: function (aPackageName){
  30028. var self=this;
  30029. return $core.withContext(function($ctx1) {
  30030. $recv(self._named_(aPackageName))._load();
  30031. return self;
  30032. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.klass)});
  30033. },
  30034. args: ["aPackageName"],
  30035. source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
  30036. referencedClasses: [],
  30037. messageSends: ["load", "named:"]
  30038. }),
  30039. $globals.Package.klass);
  30040. $core.addMethod(
  30041. $core.method({
  30042. selector: "load:fromNamespace:",
  30043. protocol: '*Platform-ImportExport',
  30044. fn: function (aPackageName,aString){
  30045. var self=this;
  30046. return $core.withContext(function($ctx1) {
  30047. $recv(self._named_(aPackageName))._loadFromNamespace_(aString);
  30048. return self;
  30049. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.klass)});
  30050. },
  30051. args: ["aPackageName", "aString"],
  30052. source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
  30053. referencedClasses: [],
  30054. messageSends: ["loadFromNamespace:", "named:"]
  30055. }),
  30056. $globals.Package.klass);
  30057. });
  30058. 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";
  30059. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  30060. $core.addPackage('Compiler-Core');
  30061. $core.packages["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
  30062. $core.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30063. $core.addClass('AbstractCodeGenerator', $globals.Object, ['currentClass', 'currentPackage', 'source'], 'Compiler-Core');
  30064. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  30065. $core.addMethod(
  30066. $core.method({
  30067. selector: "classNameFor:",
  30068. protocol: 'accessing',
  30069. fn: function (aClass){
  30070. var self=this;
  30071. return $core.withContext(function($ctx1) {
  30072. var $2,$3,$4,$1;
  30073. $2=$recv(aClass)._isMetaclass();
  30074. if($core.assert($2)){
  30075. $3=$recv($recv(aClass)._instanceClass())._name();
  30076. $ctx1.sendIdx["name"]=1;
  30077. $1=$recv($3).__comma(".klass");
  30078. } else {
  30079. $4=$recv(aClass)._isNil();
  30080. if($core.assert($4)){
  30081. $1="nil";
  30082. } else {
  30083. $1=$recv(aClass)._name();
  30084. };
  30085. };
  30086. return $1;
  30087. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractCodeGenerator)});
  30088. },
  30089. args: ["aClass"],
  30090. 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 ]]",
  30091. referencedClasses: [],
  30092. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"]
  30093. }),
  30094. $globals.AbstractCodeGenerator);
  30095. $core.addMethod(
  30096. $core.method({
  30097. selector: "compileNode:",
  30098. protocol: 'compiling',
  30099. fn: function (aNode){
  30100. var self=this;
  30101. return $core.withContext(function($ctx1) {
  30102. self._subclassResponsibility();
  30103. return self;
  30104. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  30105. },
  30106. args: ["aNode"],
  30107. source: "compileNode: aNode\x0a\x09self subclassResponsibility",
  30108. referencedClasses: [],
  30109. messageSends: ["subclassResponsibility"]
  30110. }),
  30111. $globals.AbstractCodeGenerator);
  30112. $core.addMethod(
  30113. $core.method({
  30114. selector: "currentClass",
  30115. protocol: 'accessing',
  30116. fn: function (){
  30117. var self=this;
  30118. var $1;
  30119. $1=self["@currentClass"];
  30120. return $1;
  30121. },
  30122. args: [],
  30123. source: "currentClass\x0a\x09^ currentClass",
  30124. referencedClasses: [],
  30125. messageSends: []
  30126. }),
  30127. $globals.AbstractCodeGenerator);
  30128. $core.addMethod(
  30129. $core.method({
  30130. selector: "currentClass:",
  30131. protocol: 'accessing',
  30132. fn: function (aClass){
  30133. var self=this;
  30134. self["@currentClass"]=aClass;
  30135. return self;
  30136. },
  30137. args: ["aClass"],
  30138. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  30139. referencedClasses: [],
  30140. messageSends: []
  30141. }),
  30142. $globals.AbstractCodeGenerator);
  30143. $core.addMethod(
  30144. $core.method({
  30145. selector: "currentPackage",
  30146. protocol: 'accessing',
  30147. fn: function (){
  30148. var self=this;
  30149. var $1;
  30150. $1=self["@currentPackage"];
  30151. return $1;
  30152. },
  30153. args: [],
  30154. source: "currentPackage\x0a\x09^ currentPackage",
  30155. referencedClasses: [],
  30156. messageSends: []
  30157. }),
  30158. $globals.AbstractCodeGenerator);
  30159. $core.addMethod(
  30160. $core.method({
  30161. selector: "currentPackage:",
  30162. protocol: 'accessing',
  30163. fn: function (anObject){
  30164. var self=this;
  30165. self["@currentPackage"]=anObject;
  30166. return self;
  30167. },
  30168. args: ["anObject"],
  30169. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  30170. referencedClasses: [],
  30171. messageSends: []
  30172. }),
  30173. $globals.AbstractCodeGenerator);
  30174. $core.addMethod(
  30175. $core.method({
  30176. selector: "pseudoVariables",
  30177. protocol: 'accessing',
  30178. fn: function (){
  30179. var self=this;
  30180. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30181. return $core.withContext(function($ctx1) {
  30182. var $1;
  30183. $1=$recv($Smalltalk())._pseudoVariableNames();
  30184. return $1;
  30185. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  30186. },
  30187. args: [],
  30188. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  30189. referencedClasses: ["Smalltalk"],
  30190. messageSends: ["pseudoVariableNames"]
  30191. }),
  30192. $globals.AbstractCodeGenerator);
  30193. $core.addMethod(
  30194. $core.method({
  30195. selector: "source",
  30196. protocol: 'accessing',
  30197. fn: function (){
  30198. var self=this;
  30199. return $core.withContext(function($ctx1) {
  30200. var $2,$1,$receiver;
  30201. $2=self["@source"];
  30202. if(($receiver = $2) == null || $receiver.isNil){
  30203. $1="";
  30204. } else {
  30205. $1=$2;
  30206. };
  30207. return $1;
  30208. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  30209. },
  30210. args: [],
  30211. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30212. referencedClasses: [],
  30213. messageSends: ["ifNil:"]
  30214. }),
  30215. $globals.AbstractCodeGenerator);
  30216. $core.addMethod(
  30217. $core.method({
  30218. selector: "source:",
  30219. protocol: 'accessing',
  30220. fn: function (aString){
  30221. var self=this;
  30222. self["@source"]=aString;
  30223. return self;
  30224. },
  30225. args: ["aString"],
  30226. source: "source: aString\x0a\x09source := aString",
  30227. referencedClasses: [],
  30228. messageSends: []
  30229. }),
  30230. $globals.AbstractCodeGenerator);
  30231. $core.addClass('CodeGenerator', $globals.AbstractCodeGenerator, [], 'Compiler-Core');
  30232. $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.";
  30233. $core.addMethod(
  30234. $core.method({
  30235. selector: "compileNode:",
  30236. protocol: 'compiling',
  30237. fn: function (aNode){
  30238. var self=this;
  30239. var ir,stream;
  30240. return $core.withContext(function($ctx1) {
  30241. var $2,$3,$1;
  30242. $recv(self._semanticAnalyzer())._visit_(aNode);
  30243. $ctx1.sendIdx["visit:"]=1;
  30244. ir=$recv(self._translator())._visit_(aNode);
  30245. $ctx1.sendIdx["visit:"]=2;
  30246. $2=self._irTranslator();
  30247. $recv($2)._currentClass_(self._currentClass());
  30248. $recv($2)._visit_(ir);
  30249. $3=$recv($2)._contents();
  30250. $1=$3;
  30251. return $1;
  30252. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.CodeGenerator)});
  30253. },
  30254. args: ["aNode"],
  30255. 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",
  30256. referencedClasses: [],
  30257. messageSends: ["visit:", "semanticAnalyzer", "translator", "currentClass:", "irTranslator", "currentClass", "contents"]
  30258. }),
  30259. $globals.CodeGenerator);
  30260. $core.addMethod(
  30261. $core.method({
  30262. selector: "irTranslator",
  30263. protocol: 'compiling',
  30264. fn: function (){
  30265. var self=this;
  30266. function $IRJSTranslator(){return $globals.IRJSTranslator||(typeof IRJSTranslator=="undefined"?nil:IRJSTranslator)}
  30267. return $core.withContext(function($ctx1) {
  30268. var $1;
  30269. $1=$recv($IRJSTranslator())._new();
  30270. return $1;
  30271. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  30272. },
  30273. args: [],
  30274. source: "irTranslator\x0a\x09^ IRJSTranslator new",
  30275. referencedClasses: ["IRJSTranslator"],
  30276. messageSends: ["new"]
  30277. }),
  30278. $globals.CodeGenerator);
  30279. $core.addMethod(
  30280. $core.method({
  30281. selector: "semanticAnalyzer",
  30282. protocol: 'compiling',
  30283. fn: function (){
  30284. var self=this;
  30285. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  30286. return $core.withContext(function($ctx1) {
  30287. var $2,$3,$1;
  30288. $2=$recv($SemanticAnalyzer())._on_(self._currentClass());
  30289. $recv($2)._thePackage_(self._currentPackage());
  30290. $3=$recv($2)._yourself();
  30291. $1=$3;
  30292. return $1;
  30293. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  30294. },
  30295. args: [],
  30296. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  30297. referencedClasses: ["SemanticAnalyzer"],
  30298. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  30299. }),
  30300. $globals.CodeGenerator);
  30301. $core.addMethod(
  30302. $core.method({
  30303. selector: "translator",
  30304. protocol: 'compiling',
  30305. fn: function (){
  30306. var self=this;
  30307. function $IRASTTranslator(){return $globals.IRASTTranslator||(typeof IRASTTranslator=="undefined"?nil:IRASTTranslator)}
  30308. return $core.withContext(function($ctx1) {
  30309. var $2,$3,$1;
  30310. $2=$recv($IRASTTranslator())._new();
  30311. $recv($2)._source_(self._source());
  30312. $recv($2)._theClass_(self._currentClass());
  30313. $3=$recv($2)._yourself();
  30314. $1=$3;
  30315. return $1;
  30316. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  30317. },
  30318. args: [],
  30319. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  30320. referencedClasses: ["IRASTTranslator"],
  30321. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  30322. }),
  30323. $globals.CodeGenerator);
  30324. $core.addClass('Compiler', $globals.Object, ['currentClass', 'currentPackage', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
  30325. $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`";
  30326. $core.addMethod(
  30327. $core.method({
  30328. selector: "codeGeneratorClass",
  30329. protocol: 'accessing',
  30330. fn: function (){
  30331. var self=this;
  30332. function $InliningCodeGenerator(){return $globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  30333. return $core.withContext(function($ctx1) {
  30334. var $2,$1,$receiver;
  30335. $2=self["@codeGeneratorClass"];
  30336. if(($receiver = $2) == null || $receiver.isNil){
  30337. $1=$InliningCodeGenerator();
  30338. } else {
  30339. $1=$2;
  30340. };
  30341. return $1;
  30342. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  30343. },
  30344. args: [],
  30345. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  30346. referencedClasses: ["InliningCodeGenerator"],
  30347. messageSends: ["ifNil:"]
  30348. }),
  30349. $globals.Compiler);
  30350. $core.addMethod(
  30351. $core.method({
  30352. selector: "codeGeneratorClass:",
  30353. protocol: 'accessing',
  30354. fn: function (aClass){
  30355. var self=this;
  30356. self["@codeGeneratorClass"]=aClass;
  30357. return self;
  30358. },
  30359. args: ["aClass"],
  30360. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  30361. referencedClasses: [],
  30362. messageSends: []
  30363. }),
  30364. $globals.Compiler);
  30365. $core.addMethod(
  30366. $core.method({
  30367. selector: "compile:forClass:protocol:",
  30368. protocol: 'compiling',
  30369. fn: function (aString,aClass,anotherString){
  30370. var self=this;
  30371. return $core.withContext(function($ctx1) {
  30372. var $2,$1;
  30373. self._source_(aString);
  30374. $2=self._compileNode_forClass_package_(self._parse_(aString),aClass,$recv(aClass)._packageOfProtocol_(anotherString));
  30375. $1=$2;
  30376. return $1;
  30377. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  30378. },
  30379. args: ["aString", "aClass", "anotherString"],
  30380. 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)",
  30381. referencedClasses: [],
  30382. messageSends: ["source:", "compileNode:forClass:package:", "parse:", "packageOfProtocol:"]
  30383. }),
  30384. $globals.Compiler);
  30385. $core.addMethod(
  30386. $core.method({
  30387. selector: "compileExpression:on:",
  30388. protocol: 'compiling',
  30389. fn: function (aString,anObject){
  30390. var self=this;
  30391. return $core.withContext(function($ctx1) {
  30392. var $2,$1;
  30393. $2=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  30394. $ctx1.sendIdx[","]=1;
  30395. $1=self._compile_forClass_protocol_($2,$recv(anObject)._class(),"**xxxDoIt");
  30396. return $1;
  30397. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  30398. },
  30399. args: ["aString", "anObject"],
  30400. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  30401. referencedClasses: [],
  30402. messageSends: ["compile:forClass:protocol:", ",", "class"]
  30403. }),
  30404. $globals.Compiler);
  30405. $core.addMethod(
  30406. $core.method({
  30407. selector: "compileNode:",
  30408. protocol: 'compiling',
  30409. fn: function (aNode){
  30410. var self=this;
  30411. var generator,result;
  30412. return $core.withContext(function($ctx1) {
  30413. var $1,$2,$3;
  30414. generator=$recv(self._codeGeneratorClass())._new();
  30415. $1=generator;
  30416. $recv($1)._source_(self._source());
  30417. $recv($1)._currentClass_(self._currentClass());
  30418. $2=$recv($1)._currentPackage_(self._currentPackage());
  30419. result=$recv(generator)._compileNode_(aNode);
  30420. self._unknownVariables_([]);
  30421. $3=result;
  30422. return $3;
  30423. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},$globals.Compiler)});
  30424. },
  30425. args: ["aNode"],
  30426. 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",
  30427. referencedClasses: [],
  30428. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "compileNode:", "unknownVariables:"]
  30429. }),
  30430. $globals.Compiler);
  30431. $core.addMethod(
  30432. $core.method({
  30433. selector: "compileNode:forClass:package:",
  30434. protocol: 'compiling',
  30435. fn: function (aNode,aClass,aPackage){
  30436. var self=this;
  30437. return $core.withContext(function($ctx1) {
  30438. var $2,$1;
  30439. self._currentClass_(aClass);
  30440. self._currentPackage_(aPackage);
  30441. $2=self._compileNode_(aNode);
  30442. $1=$2;
  30443. return $1;
  30444. }, function($ctx1) {$ctx1.fill(self,"compileNode:forClass:package:",{aNode:aNode,aClass:aClass,aPackage:aPackage},$globals.Compiler)});
  30445. },
  30446. args: ["aNode", "aClass", "aPackage"],
  30447. source: "compileNode: aNode forClass: aClass package: aPackage\x0a\x09^ self\x0a\x09\x09currentClass: aClass;\x0a\x09\x09currentPackage: aPackage;\x0a\x09\x09compileNode: aNode",
  30448. referencedClasses: [],
  30449. messageSends: ["currentClass:", "currentPackage:", "compileNode:"]
  30450. }),
  30451. $globals.Compiler);
  30452. $core.addMethod(
  30453. $core.method({
  30454. selector: "currentClass",
  30455. protocol: 'accessing',
  30456. fn: function (){
  30457. var self=this;
  30458. var $1;
  30459. $1=self["@currentClass"];
  30460. return $1;
  30461. },
  30462. args: [],
  30463. source: "currentClass\x0a\x09^ currentClass",
  30464. referencedClasses: [],
  30465. messageSends: []
  30466. }),
  30467. $globals.Compiler);
  30468. $core.addMethod(
  30469. $core.method({
  30470. selector: "currentClass:",
  30471. protocol: 'accessing',
  30472. fn: function (aClass){
  30473. var self=this;
  30474. self["@currentClass"]=aClass;
  30475. return self;
  30476. },
  30477. args: ["aClass"],
  30478. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  30479. referencedClasses: [],
  30480. messageSends: []
  30481. }),
  30482. $globals.Compiler);
  30483. $core.addMethod(
  30484. $core.method({
  30485. selector: "currentPackage",
  30486. protocol: 'accessing',
  30487. fn: function (){
  30488. var self=this;
  30489. var $1;
  30490. $1=self["@currentPackage"];
  30491. return $1;
  30492. },
  30493. args: [],
  30494. source: "currentPackage\x0a\x09^ currentPackage",
  30495. referencedClasses: [],
  30496. messageSends: []
  30497. }),
  30498. $globals.Compiler);
  30499. $core.addMethod(
  30500. $core.method({
  30501. selector: "currentPackage:",
  30502. protocol: 'accessing',
  30503. fn: function (anObject){
  30504. var self=this;
  30505. self["@currentPackage"]=anObject;
  30506. return self;
  30507. },
  30508. args: ["anObject"],
  30509. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  30510. referencedClasses: [],
  30511. messageSends: []
  30512. }),
  30513. $globals.Compiler);
  30514. $core.addMethod(
  30515. $core.method({
  30516. selector: "eval:",
  30517. protocol: 'compiling',
  30518. fn: function (aString){
  30519. var self=this;
  30520. return $core.withContext(function($ctx1) {
  30521. return eval(aString);
  30522. return self;
  30523. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  30524. },
  30525. args: ["aString"],
  30526. source: "eval: aString\x0a\x09<return eval(aString)>",
  30527. referencedClasses: [],
  30528. messageSends: []
  30529. }),
  30530. $globals.Compiler);
  30531. $core.addMethod(
  30532. $core.method({
  30533. selector: "eval:forPackage:",
  30534. protocol: 'compiling',
  30535. fn: function (aString,aPackage){
  30536. var self=this;
  30537. return $core.withContext(function($ctx1) {
  30538. return aPackage && aPackage.innerEval
  30539. ? aPackage.innerEval(aString)
  30540. : eval(aString);
  30541. return self;
  30542. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  30543. },
  30544. args: ["aString", "aPackage"],
  30545. source: "eval: aString forPackage: aPackage\x0a\x09<return aPackage && aPackage.innerEval\x0a\x09\x09? aPackage.innerEval(aString)\x0a\x09\x09: eval(aString)>",
  30546. referencedClasses: [],
  30547. messageSends: []
  30548. }),
  30549. $globals.Compiler);
  30550. $core.addMethod(
  30551. $core.method({
  30552. selector: "evaluateExpression:",
  30553. protocol: 'compiling',
  30554. fn: function (aString){
  30555. var self=this;
  30556. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  30557. return $core.withContext(function($ctx1) {
  30558. var $1;
  30559. $1=self._evaluateExpression_on_(aString,$recv($DoIt())._new());
  30560. return $1;
  30561. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  30562. },
  30563. args: ["aString"],
  30564. 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",
  30565. referencedClasses: ["DoIt"],
  30566. messageSends: ["evaluateExpression:on:", "new"]
  30567. }),
  30568. $globals.Compiler);
  30569. $core.addMethod(
  30570. $core.method({
  30571. selector: "evaluateExpression:on:",
  30572. protocol: 'compiling',
  30573. fn: function (aString,anObject){
  30574. var self=this;
  30575. var result,method;
  30576. return $core.withContext(function($ctx1) {
  30577. var $1,$2;
  30578. method=self._eval_(self._compileExpression_on_(aString,anObject));
  30579. $recv(method)._protocol_("**xxxDoIt");
  30580. $1=$recv(anObject)._class();
  30581. $ctx1.sendIdx["class"]=1;
  30582. $recv($1)._addCompiledMethod_(method);
  30583. result=$recv(anObject)._xxxDoIt();
  30584. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  30585. $2=result;
  30586. return $2;
  30587. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  30588. },
  30589. args: ["aString", "anObject"],
  30590. 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",
  30591. referencedClasses: [],
  30592. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  30593. }),
  30594. $globals.Compiler);
  30595. $core.addMethod(
  30596. $core.method({
  30597. selector: "install:forClass:protocol:",
  30598. protocol: 'compiling',
  30599. fn: function (aString,aBehavior,anotherString){
  30600. var self=this;
  30601. var compiledMethod;
  30602. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  30603. return $core.withContext(function($ctx1) {
  30604. var $1;
  30605. compiledMethod=self._eval_forPackage_(self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  30606. $1=$recv($recv($ClassBuilder())._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  30607. return $1;
  30608. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  30609. },
  30610. args: ["aString", "aBehavior", "anotherString"],
  30611. 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",
  30612. referencedClasses: ["ClassBuilder"],
  30613. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  30614. }),
  30615. $globals.Compiler);
  30616. $core.addMethod(
  30617. $core.method({
  30618. selector: "parse:",
  30619. protocol: 'compiling',
  30620. fn: function (aString){
  30621. var self=this;
  30622. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30623. return $core.withContext(function($ctx1) {
  30624. var $1;
  30625. $1=$recv($Smalltalk())._parse_(aString);
  30626. return $1;
  30627. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  30628. },
  30629. args: ["aString"],
  30630. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  30631. referencedClasses: ["Smalltalk"],
  30632. messageSends: ["parse:"]
  30633. }),
  30634. $globals.Compiler);
  30635. $core.addMethod(
  30636. $core.method({
  30637. selector: "parseExpression:",
  30638. protocol: 'compiling',
  30639. fn: function (aString){
  30640. var self=this;
  30641. return $core.withContext(function($ctx1) {
  30642. var $2,$1;
  30643. $2=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  30644. $ctx1.sendIdx[","]=1;
  30645. $1=self._parse_($2);
  30646. return $1;
  30647. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  30648. },
  30649. args: ["aString"],
  30650. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  30651. referencedClasses: [],
  30652. messageSends: ["parse:", ","]
  30653. }),
  30654. $globals.Compiler);
  30655. $core.addMethod(
  30656. $core.method({
  30657. selector: "recompile:",
  30658. protocol: 'compiling',
  30659. fn: function (aClass){
  30660. var self=this;
  30661. return $core.withContext(function($ctx1) {
  30662. var $1;
  30663. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  30664. return $core.withContext(function($ctx2) {
  30665. return self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  30666. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30667. }),"Recompiling ".__comma($recv(aClass)._name()));
  30668. $1=$recv(aClass)._isMetaclass();
  30669. if(!$core.assert($1)){
  30670. self._recompile_($recv(aClass)._class());
  30671. };
  30672. return self;
  30673. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  30674. },
  30675. args: ["aClass"],
  30676. 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 ]",
  30677. referencedClasses: [],
  30678. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifFalse:", "isMetaclass", "recompile:", "class"]
  30679. }),
  30680. $globals.Compiler);
  30681. $core.addMethod(
  30682. $core.method({
  30683. selector: "recompileAll",
  30684. protocol: 'compiling',
  30685. fn: function (){
  30686. var self=this;
  30687. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30688. return $core.withContext(function($ctx1) {
  30689. $recv($recv($Smalltalk())._classes())._do_displayingProgress_((function(each){
  30690. return $core.withContext(function($ctx2) {
  30691. return self._recompile_(each);
  30692. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30693. }),"Compiling all classes...");
  30694. return self;
  30695. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  30696. },
  30697. args: [],
  30698. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  30699. referencedClasses: ["Smalltalk"],
  30700. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  30701. }),
  30702. $globals.Compiler);
  30703. $core.addMethod(
  30704. $core.method({
  30705. selector: "source",
  30706. protocol: 'accessing',
  30707. fn: function (){
  30708. var self=this;
  30709. return $core.withContext(function($ctx1) {
  30710. var $2,$1,$receiver;
  30711. $2=self["@source"];
  30712. if(($receiver = $2) == null || $receiver.isNil){
  30713. $1="";
  30714. } else {
  30715. $1=$2;
  30716. };
  30717. return $1;
  30718. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  30719. },
  30720. args: [],
  30721. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30722. referencedClasses: [],
  30723. messageSends: ["ifNil:"]
  30724. }),
  30725. $globals.Compiler);
  30726. $core.addMethod(
  30727. $core.method({
  30728. selector: "source:",
  30729. protocol: 'accessing',
  30730. fn: function (aString){
  30731. var self=this;
  30732. self["@source"]=aString;
  30733. return self;
  30734. },
  30735. args: ["aString"],
  30736. source: "source: aString\x0a\x09source := aString",
  30737. referencedClasses: [],
  30738. messageSends: []
  30739. }),
  30740. $globals.Compiler);
  30741. $core.addMethod(
  30742. $core.method({
  30743. selector: "unknownVariables",
  30744. protocol: 'accessing',
  30745. fn: function (){
  30746. var self=this;
  30747. var $1;
  30748. $1=self["@unknownVariables"];
  30749. return $1;
  30750. },
  30751. args: [],
  30752. source: "unknownVariables\x0a\x09^ unknownVariables",
  30753. referencedClasses: [],
  30754. messageSends: []
  30755. }),
  30756. $globals.Compiler);
  30757. $core.addMethod(
  30758. $core.method({
  30759. selector: "unknownVariables:",
  30760. protocol: 'accessing',
  30761. fn: function (aCollection){
  30762. var self=this;
  30763. self["@unknownVariables"]=aCollection;
  30764. return self;
  30765. },
  30766. args: ["aCollection"],
  30767. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  30768. referencedClasses: [],
  30769. messageSends: []
  30770. }),
  30771. $globals.Compiler);
  30772. $core.addMethod(
  30773. $core.method({
  30774. selector: "recompile:",
  30775. protocol: 'compiling',
  30776. fn: function (aClass){
  30777. var self=this;
  30778. return $core.withContext(function($ctx1) {
  30779. $recv(self._new())._recompile_(aClass);
  30780. return self;
  30781. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.klass)});
  30782. },
  30783. args: ["aClass"],
  30784. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  30785. referencedClasses: [],
  30786. messageSends: ["recompile:", "new"]
  30787. }),
  30788. $globals.Compiler.klass);
  30789. $core.addMethod(
  30790. $core.method({
  30791. selector: "recompileAll",
  30792. protocol: 'compiling',
  30793. fn: function (){
  30794. var self=this;
  30795. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30796. return $core.withContext(function($ctx1) {
  30797. $recv($recv($Smalltalk())._classes())._do_((function(each){
  30798. return $core.withContext(function($ctx2) {
  30799. return self._recompile_(each);
  30800. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30801. }));
  30802. return self;
  30803. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.klass)});
  30804. },
  30805. args: [],
  30806. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  30807. referencedClasses: ["Smalltalk"],
  30808. messageSends: ["do:", "classes", "recompile:"]
  30809. }),
  30810. $globals.Compiler.klass);
  30811. $core.addClass('CompilerError', $globals.Error, [], 'Compiler-Core');
  30812. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  30813. $core.addClass('DoIt', $globals.Object, [], 'Compiler-Core');
  30814. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  30815. $core.addClass('Evaluator', $globals.InterfacingObject, [], 'Compiler-Core');
  30816. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  30817. $core.addMethod(
  30818. $core.method({
  30819. selector: "evaluate:context:",
  30820. protocol: 'evaluating',
  30821. fn: function (aString,aContext){
  30822. var self=this;
  30823. var compiler,ast;
  30824. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  30825. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  30826. function $AISemanticAnalyzer(){return $globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)}
  30827. return $core.withContext(function($ctx1) {
  30828. var $1,$2,$3,$4;
  30829. var $early={};
  30830. try {
  30831. compiler=$recv($Compiler())._new();
  30832. $recv((function(){
  30833. return $core.withContext(function($ctx2) {
  30834. ast=$recv(compiler)._parseExpression_(aString);
  30835. return ast;
  30836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30837. }))._on_do_($Error(),(function(ex){
  30838. return $core.withContext(function($ctx2) {
  30839. $1=self._alert_($recv(ex)._messageText());
  30840. throw $early=[$1];
  30841. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  30842. }));
  30843. $2=$recv($AISemanticAnalyzer())._on_($recv($recv(aContext)._receiver())._class());
  30844. $recv($2)._context_(aContext);
  30845. $3=$recv($2)._visit_(ast);
  30846. $4=$recv(aContext)._evaluateNode_(ast);
  30847. return $4;
  30848. }
  30849. catch(e) {if(e===$early)return e[0]; throw e}
  30850. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  30851. },
  30852. args: ["aString", "aContext"],
  30853. 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",
  30854. referencedClasses: ["Compiler", "Error", "AISemanticAnalyzer"],
  30855. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  30856. }),
  30857. $globals.Evaluator);
  30858. $core.addMethod(
  30859. $core.method({
  30860. selector: "evaluate:for:",
  30861. protocol: 'evaluating',
  30862. fn: function (aString,anObject){
  30863. var self=this;
  30864. return $core.withContext(function($ctx1) {
  30865. var $1;
  30866. $1=$recv(anObject)._evaluate_on_(aString,self);
  30867. return $1;
  30868. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  30869. },
  30870. args: ["aString", "anObject"],
  30871. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  30872. referencedClasses: [],
  30873. messageSends: ["evaluate:on:"]
  30874. }),
  30875. $globals.Evaluator);
  30876. $core.addMethod(
  30877. $core.method({
  30878. selector: "evaluate:receiver:",
  30879. protocol: 'evaluating',
  30880. fn: function (aString,anObject){
  30881. var self=this;
  30882. var compiler;
  30883. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  30884. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  30885. return $core.withContext(function($ctx1) {
  30886. var $1,$2;
  30887. var $early={};
  30888. try {
  30889. compiler=$recv($Compiler())._new();
  30890. $recv((function(){
  30891. return $core.withContext(function($ctx2) {
  30892. return $recv(compiler)._parseExpression_(aString);
  30893. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30894. }))._on_do_($Error(),(function(ex){
  30895. return $core.withContext(function($ctx2) {
  30896. $1=self._alert_($recv(ex)._messageText());
  30897. throw $early=[$1];
  30898. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  30899. }));
  30900. $2=$recv(compiler)._evaluateExpression_on_(aString,anObject);
  30901. return $2;
  30902. }
  30903. catch(e) {if(e===$early)return e[0]; throw e}
  30904. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  30905. },
  30906. args: ["aString", "anObject"],
  30907. 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",
  30908. referencedClasses: ["Compiler", "Error"],
  30909. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  30910. }),
  30911. $globals.Evaluator);
  30912. $core.addMethod(
  30913. $core.method({
  30914. selector: "evaluate:for:",
  30915. protocol: 'instance creation',
  30916. fn: function (aString,anObject){
  30917. var self=this;
  30918. return $core.withContext(function($ctx1) {
  30919. var $1;
  30920. $1=$recv(self._new())._evaluate_for_(aString,anObject);
  30921. return $1;
  30922. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.klass)});
  30923. },
  30924. args: ["aString", "anObject"],
  30925. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  30926. referencedClasses: [],
  30927. messageSends: ["evaluate:for:", "new"]
  30928. }),
  30929. $globals.Evaluator.klass);
  30930. $core.addMethod(
  30931. $core.method({
  30932. selector: "asVariableName",
  30933. protocol: '*Compiler-Core',
  30934. fn: function (){
  30935. var self=this;
  30936. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30937. return $core.withContext(function($ctx1) {
  30938. var $2,$1;
  30939. $2=$recv($recv($Smalltalk())._reservedWords())._includes_(self);
  30940. if($core.assert($2)){
  30941. $1=self.__comma("_");
  30942. } else {
  30943. $1=self;
  30944. };
  30945. return $1;
  30946. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  30947. },
  30948. args: [],
  30949. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  30950. referencedClasses: ["Smalltalk"],
  30951. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  30952. }),
  30953. $globals.String);
  30954. });
  30955. define("amber_core/Compiler-AST", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){"use strict";
  30956. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  30957. $core.addPackage('Compiler-AST');
  30958. $core.packages["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
  30959. $core.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30960. $core.addClass('Node', $globals.Object, ['parent', 'position', 'source', 'nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST');
  30961. $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.";
  30962. $core.addMethod(
  30963. $core.method({
  30964. selector: "accept:",
  30965. protocol: 'visiting',
  30966. fn: function (aVisitor){
  30967. var self=this;
  30968. return $core.withContext(function($ctx1) {
  30969. var $1;
  30970. $1=$recv(aVisitor)._visitNode_(self);
  30971. return $1;
  30972. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.Node)});
  30973. },
  30974. args: ["aVisitor"],
  30975. source: "accept: aVisitor\x0a\x09^ aVisitor visitNode: self",
  30976. referencedClasses: [],
  30977. messageSends: ["visitNode:"]
  30978. }),
  30979. $globals.Node);
  30980. $core.addMethod(
  30981. $core.method({
  30982. selector: "addNode:",
  30983. protocol: 'accessing',
  30984. fn: function (aNode){
  30985. var self=this;
  30986. return $core.withContext(function($ctx1) {
  30987. $recv(self._nodes())._add_(aNode);
  30988. $recv(aNode)._parent_(self);
  30989. return self;
  30990. }, function($ctx1) {$ctx1.fill(self,"addNode:",{aNode:aNode},$globals.Node)});
  30991. },
  30992. args: ["aNode"],
  30993. source: "addNode: aNode\x0a\x09self nodes add: aNode.\x0a\x09aNode parent: self",
  30994. referencedClasses: [],
  30995. messageSends: ["add:", "nodes", "parent:"]
  30996. }),
  30997. $globals.Node);
  30998. $core.addMethod(
  30999. $core.method({
  31000. selector: "allNodes",
  31001. protocol: 'accessing',
  31002. fn: function (){
  31003. var self=this;
  31004. var allNodes;
  31005. return $core.withContext(function($ctx1) {
  31006. var $1,$2;
  31007. $1=self._nodes();
  31008. $ctx1.sendIdx["nodes"]=1;
  31009. allNodes=$recv($1)._asSet();
  31010. $recv(self._nodes())._do_((function(each){
  31011. return $core.withContext(function($ctx2) {
  31012. return $recv(allNodes)._addAll_($recv(each)._allNodes());
  31013. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31014. }));
  31015. $2=allNodes;
  31016. return $2;
  31017. }, function($ctx1) {$ctx1.fill(self,"allNodes",{allNodes:allNodes},$globals.Node)});
  31018. },
  31019. args: [],
  31020. 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",
  31021. referencedClasses: [],
  31022. messageSends: ["asSet", "nodes", "do:", "addAll:", "allNodes"]
  31023. }),
  31024. $globals.Node);
  31025. $core.addMethod(
  31026. $core.method({
  31027. selector: "inPosition:",
  31028. protocol: 'testing',
  31029. fn: function (aPoint){
  31030. var self=this;
  31031. return $core.withContext(function($ctx1) {
  31032. var $1;
  31033. $1=$recv($recv(self._positionStart()).__lt_eq(aPoint))._and_((function(){
  31034. return $core.withContext(function($ctx2) {
  31035. return $recv(self._positionEnd()).__gt_eq(aPoint);
  31036. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31037. }));
  31038. return $1;
  31039. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.Node)});
  31040. },
  31041. args: ["aPoint"],
  31042. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  31043. referencedClasses: [],
  31044. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  31045. }),
  31046. $globals.Node);
  31047. $core.addMethod(
  31048. $core.method({
  31049. selector: "isAssignmentNode",
  31050. protocol: 'testing',
  31051. fn: function (){
  31052. var self=this;
  31053. return false;
  31054. },
  31055. args: [],
  31056. source: "isAssignmentNode\x0a\x09^ false",
  31057. referencedClasses: [],
  31058. messageSends: []
  31059. }),
  31060. $globals.Node);
  31061. $core.addMethod(
  31062. $core.method({
  31063. selector: "isBlockNode",
  31064. protocol: 'testing',
  31065. fn: function (){
  31066. var self=this;
  31067. return false;
  31068. },
  31069. args: [],
  31070. source: "isBlockNode\x0a\x09^ false",
  31071. referencedClasses: [],
  31072. messageSends: []
  31073. }),
  31074. $globals.Node);
  31075. $core.addMethod(
  31076. $core.method({
  31077. selector: "isBlockSequenceNode",
  31078. protocol: 'testing',
  31079. fn: function (){
  31080. var self=this;
  31081. return false;
  31082. },
  31083. args: [],
  31084. source: "isBlockSequenceNode\x0a\x09^ false",
  31085. referencedClasses: [],
  31086. messageSends: []
  31087. }),
  31088. $globals.Node);
  31089. $core.addMethod(
  31090. $core.method({
  31091. selector: "isCascadeNode",
  31092. protocol: 'testing',
  31093. fn: function (){
  31094. var self=this;
  31095. return false;
  31096. },
  31097. args: [],
  31098. source: "isCascadeNode\x0a\x09^ false",
  31099. referencedClasses: [],
  31100. messageSends: []
  31101. }),
  31102. $globals.Node);
  31103. $core.addMethod(
  31104. $core.method({
  31105. selector: "isImmutable",
  31106. protocol: 'testing',
  31107. fn: function (){
  31108. var self=this;
  31109. return false;
  31110. },
  31111. args: [],
  31112. source: "isImmutable\x0a\x09^ false",
  31113. referencedClasses: [],
  31114. messageSends: []
  31115. }),
  31116. $globals.Node);
  31117. $core.addMethod(
  31118. $core.method({
  31119. selector: "isJSStatementNode",
  31120. protocol: 'testing',
  31121. fn: function (){
  31122. var self=this;
  31123. return false;
  31124. },
  31125. args: [],
  31126. source: "isJSStatementNode\x0a\x09^ false",
  31127. referencedClasses: [],
  31128. messageSends: []
  31129. }),
  31130. $globals.Node);
  31131. $core.addMethod(
  31132. $core.method({
  31133. selector: "isLastChild",
  31134. protocol: 'testing',
  31135. fn: function (){
  31136. var self=this;
  31137. return $core.withContext(function($ctx1) {
  31138. var $1;
  31139. $1=$recv($recv($recv(self._parent())._nodes())._last()).__eq(self);
  31140. return $1;
  31141. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.Node)});
  31142. },
  31143. args: [],
  31144. source: "isLastChild\x0a\x09^ self parent nodes last = self",
  31145. referencedClasses: [],
  31146. messageSends: ["=", "last", "nodes", "parent"]
  31147. }),
  31148. $globals.Node);
  31149. $core.addMethod(
  31150. $core.method({
  31151. selector: "isNavigationNode",
  31152. protocol: 'testing',
  31153. fn: function (){
  31154. var self=this;
  31155. return false;
  31156. },
  31157. args: [],
  31158. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  31159. referencedClasses: [],
  31160. messageSends: []
  31161. }),
  31162. $globals.Node);
  31163. $core.addMethod(
  31164. $core.method({
  31165. selector: "isNode",
  31166. protocol: 'testing',
  31167. fn: function (){
  31168. var self=this;
  31169. return true;
  31170. },
  31171. args: [],
  31172. source: "isNode\x0a\x09^ true",
  31173. referencedClasses: [],
  31174. messageSends: []
  31175. }),
  31176. $globals.Node);
  31177. $core.addMethod(
  31178. $core.method({
  31179. selector: "isReferenced",
  31180. protocol: 'testing',
  31181. fn: function (){
  31182. var self=this;
  31183. return $core.withContext(function($ctx1) {
  31184. var $4,$3,$2,$1;
  31185. $4=self._parent();
  31186. $ctx1.sendIdx["parent"]=1;
  31187. $3=$recv($4)._isSequenceNode();
  31188. $2=$recv($3)._or_((function(){
  31189. return $core.withContext(function($ctx2) {
  31190. return $recv(self._parent())._isAssignmentNode();
  31191. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31192. }));
  31193. $1=$recv($2)._not();
  31194. return $1;
  31195. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.Node)});
  31196. },
  31197. args: [],
  31198. 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",
  31199. referencedClasses: [],
  31200. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  31201. }),
  31202. $globals.Node);
  31203. $core.addMethod(
  31204. $core.method({
  31205. selector: "isReturnNode",
  31206. protocol: 'testing',
  31207. fn: function (){
  31208. var self=this;
  31209. return false;
  31210. },
  31211. args: [],
  31212. source: "isReturnNode\x0a\x09^ false",
  31213. referencedClasses: [],
  31214. messageSends: []
  31215. }),
  31216. $globals.Node);
  31217. $core.addMethod(
  31218. $core.method({
  31219. selector: "isSendNode",
  31220. protocol: 'testing',
  31221. fn: function (){
  31222. var self=this;
  31223. return false;
  31224. },
  31225. args: [],
  31226. source: "isSendNode\x0a\x09^ false",
  31227. referencedClasses: [],
  31228. messageSends: []
  31229. }),
  31230. $globals.Node);
  31231. $core.addMethod(
  31232. $core.method({
  31233. selector: "isSequenceNode",
  31234. protocol: 'testing',
  31235. fn: function (){
  31236. var self=this;
  31237. return false;
  31238. },
  31239. args: [],
  31240. source: "isSequenceNode\x0a\x09^ false",
  31241. referencedClasses: [],
  31242. messageSends: []
  31243. }),
  31244. $globals.Node);
  31245. $core.addMethod(
  31246. $core.method({
  31247. selector: "isValueNode",
  31248. protocol: 'testing',
  31249. fn: function (){
  31250. var self=this;
  31251. return false;
  31252. },
  31253. args: [],
  31254. source: "isValueNode\x0a\x09^ false",
  31255. referencedClasses: [],
  31256. messageSends: []
  31257. }),
  31258. $globals.Node);
  31259. $core.addMethod(
  31260. $core.method({
  31261. selector: "isVariableNode",
  31262. protocol: 'testing',
  31263. fn: function (){
  31264. var self=this;
  31265. return false;
  31266. },
  31267. args: [],
  31268. source: "isVariableNode\x0a\x09^ false",
  31269. referencedClasses: [],
  31270. messageSends: []
  31271. }),
  31272. $globals.Node);
  31273. $core.addMethod(
  31274. $core.method({
  31275. selector: "method",
  31276. protocol: 'accessing',
  31277. fn: function (){
  31278. var self=this;
  31279. return $core.withContext(function($ctx1) {
  31280. var $2,$1,$receiver;
  31281. $2=self._parent();
  31282. if(($receiver = $2) == null || $receiver.isNil){
  31283. $1=$2;
  31284. } else {
  31285. var node;
  31286. node=$receiver;
  31287. $1=$recv(node)._method();
  31288. };
  31289. return $1;
  31290. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.Node)});
  31291. },
  31292. args: [],
  31293. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  31294. referencedClasses: [],
  31295. messageSends: ["ifNotNil:", "parent", "method"]
  31296. }),
  31297. $globals.Node);
  31298. $core.addMethod(
  31299. $core.method({
  31300. selector: "navigationNodeAt:ifAbsent:",
  31301. protocol: 'accessing',
  31302. fn: function (aPoint,aBlock){
  31303. var self=this;
  31304. var children;
  31305. return $core.withContext(function($ctx1) {
  31306. var $1,$4,$3,$2;
  31307. var $early={};
  31308. try {
  31309. children=$recv(self._allNodes())._select_((function(each){
  31310. return $core.withContext(function($ctx2) {
  31311. return $recv($recv(each)._isNavigationNode())._and_((function(){
  31312. return $core.withContext(function($ctx3) {
  31313. return $recv(each)._inPosition_(aPoint);
  31314. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  31315. }));
  31316. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31317. }));
  31318. $recv(children)._ifEmpty_((function(){
  31319. return $core.withContext(function($ctx2) {
  31320. $1=$recv(aBlock)._value();
  31321. throw $early=[$1];
  31322. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  31323. }));
  31324. $2=$recv($recv($recv(children)._asArray())._sort_((function(a,b){
  31325. return $core.withContext(function($ctx2) {
  31326. $4=$recv(a)._positionStart();
  31327. $ctx2.sendIdx["positionStart"]=1;
  31328. $3=$recv($4)._dist_(aPoint);
  31329. $ctx2.sendIdx["dist:"]=1;
  31330. return $recv($3).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  31331. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  31332. })))._first();
  31333. return $2;
  31334. }
  31335. catch(e) {if(e===$early)return e[0]; throw e}
  31336. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.Node)});
  31337. },
  31338. args: ["aPoint", "aBlock"],
  31339. 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",
  31340. referencedClasses: [],
  31341. messageSends: ["select:", "allNodes", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  31342. }),
  31343. $globals.Node);
  31344. $core.addMethod(
  31345. $core.method({
  31346. selector: "nodes",
  31347. protocol: 'accessing',
  31348. fn: function (){
  31349. var self=this;
  31350. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  31351. return $core.withContext(function($ctx1) {
  31352. var $2,$1,$receiver;
  31353. $2=self["@nodes"];
  31354. if(($receiver = $2) == null || $receiver.isNil){
  31355. self["@nodes"]=$recv($Array())._new();
  31356. $1=self["@nodes"];
  31357. } else {
  31358. $1=$2;
  31359. };
  31360. return $1;
  31361. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.Node)});
  31362. },
  31363. args: [],
  31364. source: "nodes\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  31365. referencedClasses: ["Array"],
  31366. messageSends: ["ifNil:", "new"]
  31367. }),
  31368. $globals.Node);
  31369. $core.addMethod(
  31370. $core.method({
  31371. selector: "nodes:",
  31372. protocol: 'building',
  31373. fn: function (aCollection){
  31374. var self=this;
  31375. return $core.withContext(function($ctx1) {
  31376. self["@nodes"]=aCollection;
  31377. $recv(aCollection)._do_((function(each){
  31378. return $core.withContext(function($ctx2) {
  31379. return $recv(each)._parent_(self);
  31380. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31381. }));
  31382. return self;
  31383. }, function($ctx1) {$ctx1.fill(self,"nodes:",{aCollection:aCollection},$globals.Node)});
  31384. },
  31385. args: ["aCollection"],
  31386. source: "nodes: aCollection\x0a\x09nodes := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  31387. referencedClasses: [],
  31388. messageSends: ["do:", "parent:"]
  31389. }),
  31390. $globals.Node);
  31391. $core.addMethod(
  31392. $core.method({
  31393. selector: "parent",
  31394. protocol: 'accessing',
  31395. fn: function (){
  31396. var self=this;
  31397. var $1;
  31398. $1=self["@parent"];
  31399. return $1;
  31400. },
  31401. args: [],
  31402. source: "parent\x0a\x09^ parent",
  31403. referencedClasses: [],
  31404. messageSends: []
  31405. }),
  31406. $globals.Node);
  31407. $core.addMethod(
  31408. $core.method({
  31409. selector: "parent:",
  31410. protocol: 'accessing',
  31411. fn: function (aNode){
  31412. var self=this;
  31413. self["@parent"]=aNode;
  31414. return self;
  31415. },
  31416. args: ["aNode"],
  31417. source: "parent: aNode\x0a\x09parent := aNode",
  31418. referencedClasses: [],
  31419. messageSends: []
  31420. }),
  31421. $globals.Node);
  31422. $core.addMethod(
  31423. $core.method({
  31424. selector: "position",
  31425. protocol: 'accessing',
  31426. fn: function (){
  31427. var self=this;
  31428. return $core.withContext(function($ctx1) {
  31429. var $2,$3,$1,$receiver;
  31430. $2=self["@position"];
  31431. if(($receiver = $2) == null || $receiver.isNil){
  31432. $3=self._parent();
  31433. if(($receiver = $3) == null || $receiver.isNil){
  31434. $1=$3;
  31435. } else {
  31436. var node;
  31437. node=$receiver;
  31438. $1=$recv(node)._position();
  31439. };
  31440. } else {
  31441. $1=$2;
  31442. };
  31443. return $1;
  31444. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Node)});
  31445. },
  31446. args: [],
  31447. 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 ] ]",
  31448. referencedClasses: [],
  31449. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  31450. }),
  31451. $globals.Node);
  31452. $core.addMethod(
  31453. $core.method({
  31454. selector: "position:",
  31455. protocol: 'accessing',
  31456. fn: function (aPosition){
  31457. var self=this;
  31458. self["@position"]=aPosition;
  31459. return self;
  31460. },
  31461. args: ["aPosition"],
  31462. source: "position: aPosition\x0a\x09position := aPosition",
  31463. referencedClasses: [],
  31464. messageSends: []
  31465. }),
  31466. $globals.Node);
  31467. $core.addMethod(
  31468. $core.method({
  31469. selector: "positionEnd",
  31470. protocol: 'accessing',
  31471. fn: function (){
  31472. var self=this;
  31473. return $core.withContext(function($ctx1) {
  31474. var $2,$7,$6,$5,$4,$3,$1;
  31475. $2=self._positionStart();
  31476. $7=self._source();
  31477. $ctx1.sendIdx["source"]=1;
  31478. $6=$recv($7)._lines();
  31479. $ctx1.sendIdx["lines"]=1;
  31480. $5=$recv($6)._size();
  31481. $ctx1.sendIdx["size"]=1;
  31482. $4=$recv($5).__minus((1));
  31483. $ctx1.sendIdx["-"]=1;
  31484. $3=$recv($4).__at($recv($recv($recv($recv(self._source())._lines())._last())._size()).__minus((1)));
  31485. $1=$recv($2).__plus($3);
  31486. return $1;
  31487. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.Node)});
  31488. },
  31489. args: [],
  31490. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  31491. referencedClasses: [],
  31492. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  31493. }),
  31494. $globals.Node);
  31495. $core.addMethod(
  31496. $core.method({
  31497. selector: "positionStart",
  31498. protocol: 'accessing',
  31499. fn: function (){
  31500. var self=this;
  31501. return $core.withContext(function($ctx1) {
  31502. var $1;
  31503. $1=self._position();
  31504. return $1;
  31505. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.Node)});
  31506. },
  31507. args: [],
  31508. source: "positionStart\x0a\x09^ self position",
  31509. referencedClasses: [],
  31510. messageSends: ["position"]
  31511. }),
  31512. $globals.Node);
  31513. $core.addMethod(
  31514. $core.method({
  31515. selector: "postCopy",
  31516. protocol: 'copying',
  31517. fn: function (){
  31518. var self=this;
  31519. return $core.withContext(function($ctx1) {
  31520. (
  31521. $ctx1.supercall = true,
  31522. $globals.Node.superclass.fn.prototype._postCopy.apply($recv(self), []));
  31523. $ctx1.supercall = false;
  31524. $recv(self._nodes())._do_((function(each){
  31525. return $core.withContext(function($ctx2) {
  31526. return $recv(each)._parent_(self);
  31527. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31528. }));
  31529. return self;
  31530. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.Node)});
  31531. },
  31532. args: [],
  31533. source: "postCopy\x0a\x09super postCopy.\x0a\x09self nodes do: [ :each | each parent: self ]",
  31534. referencedClasses: [],
  31535. messageSends: ["postCopy", "do:", "nodes", "parent:"]
  31536. }),
  31537. $globals.Node);
  31538. $core.addMethod(
  31539. $core.method({
  31540. selector: "requiresSmalltalkContext",
  31541. protocol: 'testing',
  31542. fn: function (){
  31543. var self=this;
  31544. return $core.withContext(function($ctx1) {
  31545. var $1;
  31546. $1=$recv($recv(self._nodes())._detect_ifNone_((function(each){
  31547. return $core.withContext(function($ctx2) {
  31548. return $recv(each)._requiresSmalltalkContext();
  31549. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31550. }),(function(){
  31551. return nil;
  31552. })))._notNil();
  31553. return $1;
  31554. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.Node)});
  31555. },
  31556. args: [],
  31557. 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",
  31558. referencedClasses: [],
  31559. messageSends: ["notNil", "detect:ifNone:", "nodes", "requiresSmalltalkContext"]
  31560. }),
  31561. $globals.Node);
  31562. $core.addMethod(
  31563. $core.method({
  31564. selector: "shouldBeAliased",
  31565. protocol: 'accessing',
  31566. fn: function (){
  31567. var self=this;
  31568. return $core.withContext(function($ctx1) {
  31569. var $2,$1,$receiver;
  31570. $2=self["@shouldBeAliased"];
  31571. if(($receiver = $2) == null || $receiver.isNil){
  31572. $1=false;
  31573. } else {
  31574. $1=$2;
  31575. };
  31576. return $1;
  31577. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.Node)});
  31578. },
  31579. args: [],
  31580. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  31581. referencedClasses: [],
  31582. messageSends: ["ifNil:"]
  31583. }),
  31584. $globals.Node);
  31585. $core.addMethod(
  31586. $core.method({
  31587. selector: "shouldBeAliased:",
  31588. protocol: 'accessing',
  31589. fn: function (aBoolean){
  31590. var self=this;
  31591. self["@shouldBeAliased"]=aBoolean;
  31592. return self;
  31593. },
  31594. args: ["aBoolean"],
  31595. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  31596. referencedClasses: [],
  31597. messageSends: []
  31598. }),
  31599. $globals.Node);
  31600. $core.addMethod(
  31601. $core.method({
  31602. selector: "shouldBeInlined",
  31603. protocol: 'accessing',
  31604. fn: function (){
  31605. var self=this;
  31606. return $core.withContext(function($ctx1) {
  31607. var $2,$1,$receiver;
  31608. $2=self["@shouldBeInlined"];
  31609. if(($receiver = $2) == null || $receiver.isNil){
  31610. $1=false;
  31611. } else {
  31612. $1=$2;
  31613. };
  31614. return $1;
  31615. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.Node)});
  31616. },
  31617. args: [],
  31618. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  31619. referencedClasses: [],
  31620. messageSends: ["ifNil:"]
  31621. }),
  31622. $globals.Node);
  31623. $core.addMethod(
  31624. $core.method({
  31625. selector: "shouldBeInlined:",
  31626. protocol: 'accessing',
  31627. fn: function (aBoolean){
  31628. var self=this;
  31629. self["@shouldBeInlined"]=aBoolean;
  31630. return self;
  31631. },
  31632. args: ["aBoolean"],
  31633. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  31634. referencedClasses: [],
  31635. messageSends: []
  31636. }),
  31637. $globals.Node);
  31638. $core.addMethod(
  31639. $core.method({
  31640. selector: "size",
  31641. protocol: 'accessing',
  31642. fn: function (){
  31643. var self=this;
  31644. return $core.withContext(function($ctx1) {
  31645. var $1;
  31646. $1=$recv(self._source())._size();
  31647. return $1;
  31648. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Node)});
  31649. },
  31650. args: [],
  31651. source: "size\x0a\x09^ self source size",
  31652. referencedClasses: [],
  31653. messageSends: ["size", "source"]
  31654. }),
  31655. $globals.Node);
  31656. $core.addMethod(
  31657. $core.method({
  31658. selector: "source",
  31659. protocol: 'accessing',
  31660. fn: function (){
  31661. var self=this;
  31662. return $core.withContext(function($ctx1) {
  31663. var $2,$1,$receiver;
  31664. $2=self["@source"];
  31665. if(($receiver = $2) == null || $receiver.isNil){
  31666. $1="";
  31667. } else {
  31668. $1=$2;
  31669. };
  31670. return $1;
  31671. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Node)});
  31672. },
  31673. args: [],
  31674. source: "source\x0a\x09^ source ifNil: [ '' ]",
  31675. referencedClasses: [],
  31676. messageSends: ["ifNil:"]
  31677. }),
  31678. $globals.Node);
  31679. $core.addMethod(
  31680. $core.method({
  31681. selector: "source:",
  31682. protocol: 'accessing',
  31683. fn: function (aString){
  31684. var self=this;
  31685. self["@source"]=aString;
  31686. return self;
  31687. },
  31688. args: ["aString"],
  31689. source: "source: aString\x0a\x09source := aString",
  31690. referencedClasses: [],
  31691. messageSends: []
  31692. }),
  31693. $globals.Node);
  31694. $core.addMethod(
  31695. $core.method({
  31696. selector: "subtreeNeedsAliasing",
  31697. protocol: 'testing',
  31698. fn: function (){
  31699. var self=this;
  31700. return $core.withContext(function($ctx1) {
  31701. var $1;
  31702. $1=$recv($recv(self._shouldBeAliased())._or_((function(){
  31703. return $core.withContext(function($ctx2) {
  31704. return self._shouldBeInlined();
  31705. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31706. })))._or_((function(){
  31707. return $core.withContext(function($ctx2) {
  31708. return $recv(self._nodes())._anySatisfy_((function(each){
  31709. return $core.withContext(function($ctx3) {
  31710. return $recv(each)._subtreeNeedsAliasing();
  31711. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  31712. }));
  31713. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31714. }));
  31715. $ctx1.sendIdx["or:"]=1;
  31716. return $1;
  31717. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.Node)});
  31718. },
  31719. args: [],
  31720. source: "subtreeNeedsAliasing\x0a\x09^ (self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a\x09\x09self nodes anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  31721. referencedClasses: [],
  31722. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined", "anySatisfy:", "nodes", "subtreeNeedsAliasing"]
  31723. }),
  31724. $globals.Node);
  31725. $core.addClass('AssignmentNode', $globals.Node, ['left', 'right'], 'Compiler-AST');
  31726. $globals.AssignmentNode.comment="I represent an assignment node.";
  31727. $core.addMethod(
  31728. $core.method({
  31729. selector: "accept:",
  31730. protocol: 'visiting',
  31731. fn: function (aVisitor){
  31732. var self=this;
  31733. return $core.withContext(function($ctx1) {
  31734. var $1;
  31735. $1=$recv(aVisitor)._visitAssignmentNode_(self);
  31736. return $1;
  31737. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  31738. },
  31739. args: ["aVisitor"],
  31740. source: "accept: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  31741. referencedClasses: [],
  31742. messageSends: ["visitAssignmentNode:"]
  31743. }),
  31744. $globals.AssignmentNode);
  31745. $core.addMethod(
  31746. $core.method({
  31747. selector: "isAssignmentNode",
  31748. protocol: 'testing',
  31749. fn: function (){
  31750. var self=this;
  31751. return true;
  31752. },
  31753. args: [],
  31754. source: "isAssignmentNode\x0a\x09^ true",
  31755. referencedClasses: [],
  31756. messageSends: []
  31757. }),
  31758. $globals.AssignmentNode);
  31759. $core.addMethod(
  31760. $core.method({
  31761. selector: "left",
  31762. protocol: 'accessing',
  31763. fn: function (){
  31764. var self=this;
  31765. var $1;
  31766. $1=self["@left"];
  31767. return $1;
  31768. },
  31769. args: [],
  31770. source: "left\x0a\x09^ left",
  31771. referencedClasses: [],
  31772. messageSends: []
  31773. }),
  31774. $globals.AssignmentNode);
  31775. $core.addMethod(
  31776. $core.method({
  31777. selector: "left:",
  31778. protocol: 'accessing',
  31779. fn: function (aNode){
  31780. var self=this;
  31781. return $core.withContext(function($ctx1) {
  31782. self["@left"]=aNode;
  31783. $recv(aNode)._parent_(self);
  31784. return self;
  31785. }, function($ctx1) {$ctx1.fill(self,"left:",{aNode:aNode},$globals.AssignmentNode)});
  31786. },
  31787. args: ["aNode"],
  31788. source: "left: aNode\x0a\x09left := aNode.\x0a\x09aNode parent: self",
  31789. referencedClasses: [],
  31790. messageSends: ["parent:"]
  31791. }),
  31792. $globals.AssignmentNode);
  31793. $core.addMethod(
  31794. $core.method({
  31795. selector: "nodes",
  31796. protocol: 'accessing',
  31797. fn: function (){
  31798. var self=this;
  31799. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  31800. return $core.withContext(function($ctx1) {
  31801. var $1;
  31802. $1=$recv($Array())._with_with_(self._left(),self._right());
  31803. return $1;
  31804. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.AssignmentNode)});
  31805. },
  31806. args: [],
  31807. source: "nodes\x0a\x09^ Array with: self left with: self right",
  31808. referencedClasses: ["Array"],
  31809. messageSends: ["with:with:", "left", "right"]
  31810. }),
  31811. $globals.AssignmentNode);
  31812. $core.addMethod(
  31813. $core.method({
  31814. selector: "right",
  31815. protocol: 'accessing',
  31816. fn: function (){
  31817. var self=this;
  31818. var $1;
  31819. $1=self["@right"];
  31820. return $1;
  31821. },
  31822. args: [],
  31823. source: "right\x0a\x09^ right",
  31824. referencedClasses: [],
  31825. messageSends: []
  31826. }),
  31827. $globals.AssignmentNode);
  31828. $core.addMethod(
  31829. $core.method({
  31830. selector: "right:",
  31831. protocol: 'accessing',
  31832. fn: function (aNode){
  31833. var self=this;
  31834. return $core.withContext(function($ctx1) {
  31835. self["@right"]=aNode;
  31836. $recv(aNode)._parent_(self);
  31837. return self;
  31838. }, function($ctx1) {$ctx1.fill(self,"right:",{aNode:aNode},$globals.AssignmentNode)});
  31839. },
  31840. args: ["aNode"],
  31841. source: "right: aNode\x0a\x09right := aNode.\x0a\x09aNode parent: self",
  31842. referencedClasses: [],
  31843. messageSends: ["parent:"]
  31844. }),
  31845. $globals.AssignmentNode);
  31846. $core.addMethod(
  31847. $core.method({
  31848. selector: "shouldBeAliased",
  31849. protocol: 'testing',
  31850. fn: function (){
  31851. var self=this;
  31852. return $core.withContext(function($ctx1) {
  31853. var $2,$1;
  31854. $2=(
  31855. $ctx1.supercall = true,
  31856. $globals.AssignmentNode.superclass.fn.prototype._shouldBeAliased.apply($recv(self), []));
  31857. $ctx1.supercall = false;
  31858. $1=$recv($2)._or_((function(){
  31859. return $core.withContext(function($ctx2) {
  31860. return self._isReferenced();
  31861. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31862. }));
  31863. return $1;
  31864. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  31865. },
  31866. args: [],
  31867. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  31868. referencedClasses: [],
  31869. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  31870. }),
  31871. $globals.AssignmentNode);
  31872. $core.addClass('BlockNode', $globals.Node, ['parameters', 'scope'], 'Compiler-AST');
  31873. $globals.BlockNode.comment="I represent an block closure node.";
  31874. $core.addMethod(
  31875. $core.method({
  31876. selector: "accept:",
  31877. protocol: 'visiting',
  31878. fn: function (aVisitor){
  31879. var self=this;
  31880. return $core.withContext(function($ctx1) {
  31881. var $1;
  31882. $1=$recv(aVisitor)._visitBlockNode_(self);
  31883. return $1;
  31884. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockNode)});
  31885. },
  31886. args: ["aVisitor"],
  31887. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  31888. referencedClasses: [],
  31889. messageSends: ["visitBlockNode:"]
  31890. }),
  31891. $globals.BlockNode);
  31892. $core.addMethod(
  31893. $core.method({
  31894. selector: "isBlockNode",
  31895. protocol: 'testing',
  31896. fn: function (){
  31897. var self=this;
  31898. return true;
  31899. },
  31900. args: [],
  31901. source: "isBlockNode\x0a\x09^ true",
  31902. referencedClasses: [],
  31903. messageSends: []
  31904. }),
  31905. $globals.BlockNode);
  31906. $core.addMethod(
  31907. $core.method({
  31908. selector: "parameters",
  31909. protocol: 'accessing',
  31910. fn: function (){
  31911. var self=this;
  31912. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  31913. return $core.withContext(function($ctx1) {
  31914. var $2,$1,$receiver;
  31915. $2=self["@parameters"];
  31916. if(($receiver = $2) == null || $receiver.isNil){
  31917. self["@parameters"]=$recv($Array())._new();
  31918. $1=self["@parameters"];
  31919. } else {
  31920. $1=$2;
  31921. };
  31922. return $1;
  31923. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  31924. },
  31925. args: [],
  31926. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  31927. referencedClasses: ["Array"],
  31928. messageSends: ["ifNil:", "new"]
  31929. }),
  31930. $globals.BlockNode);
  31931. $core.addMethod(
  31932. $core.method({
  31933. selector: "parameters:",
  31934. protocol: 'accessing',
  31935. fn: function (aCollection){
  31936. var self=this;
  31937. self["@parameters"]=aCollection;
  31938. return self;
  31939. },
  31940. args: ["aCollection"],
  31941. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  31942. referencedClasses: [],
  31943. messageSends: []
  31944. }),
  31945. $globals.BlockNode);
  31946. $core.addMethod(
  31947. $core.method({
  31948. selector: "scope",
  31949. protocol: 'accessing',
  31950. fn: function (){
  31951. var self=this;
  31952. var $1;
  31953. $1=self["@scope"];
  31954. return $1;
  31955. },
  31956. args: [],
  31957. source: "scope\x0a\x09^ scope",
  31958. referencedClasses: [],
  31959. messageSends: []
  31960. }),
  31961. $globals.BlockNode);
  31962. $core.addMethod(
  31963. $core.method({
  31964. selector: "scope:",
  31965. protocol: 'accessing',
  31966. fn: function (aLexicalScope){
  31967. var self=this;
  31968. self["@scope"]=aLexicalScope;
  31969. return self;
  31970. },
  31971. args: ["aLexicalScope"],
  31972. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  31973. referencedClasses: [],
  31974. messageSends: []
  31975. }),
  31976. $globals.BlockNode);
  31977. $core.addMethod(
  31978. $core.method({
  31979. selector: "subtreeNeedsAliasing",
  31980. protocol: 'testing',
  31981. fn: function (){
  31982. var self=this;
  31983. return $core.withContext(function($ctx1) {
  31984. var $1;
  31985. $1=$recv(self._shouldBeAliased())._or_((function(){
  31986. return $core.withContext(function($ctx2) {
  31987. return self._shouldBeInlined();
  31988. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31989. }));
  31990. return $1;
  31991. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  31992. },
  31993. args: [],
  31994. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [ self shouldBeInlined ]",
  31995. referencedClasses: [],
  31996. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined"]
  31997. }),
  31998. $globals.BlockNode);
  31999. $core.addClass('CascadeNode', $globals.Node, ['receiver'], 'Compiler-AST');
  32000. $globals.CascadeNode.comment="I represent an cascade node.";
  32001. $core.addMethod(
  32002. $core.method({
  32003. selector: "accept:",
  32004. protocol: 'visiting',
  32005. fn: function (aVisitor){
  32006. var self=this;
  32007. return $core.withContext(function($ctx1) {
  32008. var $1;
  32009. $1=$recv(aVisitor)._visitCascadeNode_(self);
  32010. return $1;
  32011. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.CascadeNode)});
  32012. },
  32013. args: ["aVisitor"],
  32014. source: "accept: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  32015. referencedClasses: [],
  32016. messageSends: ["visitCascadeNode:"]
  32017. }),
  32018. $globals.CascadeNode);
  32019. $core.addMethod(
  32020. $core.method({
  32021. selector: "isCascadeNode",
  32022. protocol: 'testing',
  32023. fn: function (){
  32024. var self=this;
  32025. return true;
  32026. },
  32027. args: [],
  32028. source: "isCascadeNode\x0a\x09^ true",
  32029. referencedClasses: [],
  32030. messageSends: []
  32031. }),
  32032. $globals.CascadeNode);
  32033. $core.addMethod(
  32034. $core.method({
  32035. selector: "receiver",
  32036. protocol: 'accessing',
  32037. fn: function (){
  32038. var self=this;
  32039. var $1;
  32040. $1=self["@receiver"];
  32041. return $1;
  32042. },
  32043. args: [],
  32044. source: "receiver\x0a\x09^ receiver",
  32045. referencedClasses: [],
  32046. messageSends: []
  32047. }),
  32048. $globals.CascadeNode);
  32049. $core.addMethod(
  32050. $core.method({
  32051. selector: "receiver:",
  32052. protocol: 'accessing',
  32053. fn: function (aNode){
  32054. var self=this;
  32055. self["@receiver"]=aNode;
  32056. return self;
  32057. },
  32058. args: ["aNode"],
  32059. source: "receiver: aNode\x0a\x09receiver := aNode",
  32060. referencedClasses: [],
  32061. messageSends: []
  32062. }),
  32063. $globals.CascadeNode);
  32064. $core.addClass('DynamicArrayNode', $globals.Node, [], 'Compiler-AST');
  32065. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  32066. $core.addMethod(
  32067. $core.method({
  32068. selector: "accept:",
  32069. protocol: 'visiting',
  32070. fn: function (aVisitor){
  32071. var self=this;
  32072. return $core.withContext(function($ctx1) {
  32073. var $1;
  32074. $1=$recv(aVisitor)._visitDynamicArrayNode_(self);
  32075. return $1;
  32076. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  32077. },
  32078. args: ["aVisitor"],
  32079. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  32080. referencedClasses: [],
  32081. messageSends: ["visitDynamicArrayNode:"]
  32082. }),
  32083. $globals.DynamicArrayNode);
  32084. $core.addClass('DynamicDictionaryNode', $globals.Node, [], 'Compiler-AST');
  32085. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  32086. $core.addMethod(
  32087. $core.method({
  32088. selector: "accept:",
  32089. protocol: 'visiting',
  32090. fn: function (aVisitor){
  32091. var self=this;
  32092. return $core.withContext(function($ctx1) {
  32093. var $1;
  32094. $1=$recv(aVisitor)._visitDynamicDictionaryNode_(self);
  32095. return $1;
  32096. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  32097. },
  32098. args: ["aVisitor"],
  32099. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  32100. referencedClasses: [],
  32101. messageSends: ["visitDynamicDictionaryNode:"]
  32102. }),
  32103. $globals.DynamicDictionaryNode);
  32104. $core.addClass('JSStatementNode', $globals.Node, [], 'Compiler-AST');
  32105. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  32106. $core.addMethod(
  32107. $core.method({
  32108. selector: "accept:",
  32109. protocol: 'visiting',
  32110. fn: function (aVisitor){
  32111. var self=this;
  32112. return $core.withContext(function($ctx1) {
  32113. var $1;
  32114. $1=$recv(aVisitor)._visitJSStatementNode_(self);
  32115. return $1;
  32116. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  32117. },
  32118. args: ["aVisitor"],
  32119. source: "accept: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  32120. referencedClasses: [],
  32121. messageSends: ["visitJSStatementNode:"]
  32122. }),
  32123. $globals.JSStatementNode);
  32124. $core.addMethod(
  32125. $core.method({
  32126. selector: "isJSStatementNode",
  32127. protocol: 'testing',
  32128. fn: function (){
  32129. var self=this;
  32130. return true;
  32131. },
  32132. args: [],
  32133. source: "isJSStatementNode\x0a\x09^ true",
  32134. referencedClasses: [],
  32135. messageSends: []
  32136. }),
  32137. $globals.JSStatementNode);
  32138. $core.addMethod(
  32139. $core.method({
  32140. selector: "requiresSmalltalkContext",
  32141. protocol: 'testing',
  32142. fn: function (){
  32143. var self=this;
  32144. return true;
  32145. },
  32146. args: [],
  32147. source: "requiresSmalltalkContext\x0a\x09^ true",
  32148. referencedClasses: [],
  32149. messageSends: []
  32150. }),
  32151. $globals.JSStatementNode);
  32152. $core.addClass('MethodNode', $globals.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'sendIndexes', 'superSends'], 'Compiler-AST');
  32153. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  32154. $core.addMethod(
  32155. $core.method({
  32156. selector: "accept:",
  32157. protocol: 'visiting',
  32158. fn: function (aVisitor){
  32159. var self=this;
  32160. return $core.withContext(function($ctx1) {
  32161. var $1;
  32162. $1=$recv(aVisitor)._visitMethodNode_(self);
  32163. return $1;
  32164. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.MethodNode)});
  32165. },
  32166. args: ["aVisitor"],
  32167. source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  32168. referencedClasses: [],
  32169. messageSends: ["visitMethodNode:"]
  32170. }),
  32171. $globals.MethodNode);
  32172. $core.addMethod(
  32173. $core.method({
  32174. selector: "arguments",
  32175. protocol: 'accessing',
  32176. fn: function (){
  32177. var self=this;
  32178. return $core.withContext(function($ctx1) {
  32179. var $2,$1,$receiver;
  32180. $2=self["@arguments"];
  32181. if(($receiver = $2) == null || $receiver.isNil){
  32182. $1=[];
  32183. } else {
  32184. $1=$2;
  32185. };
  32186. return $1;
  32187. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  32188. },
  32189. args: [],
  32190. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  32191. referencedClasses: [],
  32192. messageSends: ["ifNil:"]
  32193. }),
  32194. $globals.MethodNode);
  32195. $core.addMethod(
  32196. $core.method({
  32197. selector: "arguments:",
  32198. protocol: 'accessing',
  32199. fn: function (aCollection){
  32200. var self=this;
  32201. self["@arguments"]=aCollection;
  32202. return self;
  32203. },
  32204. args: ["aCollection"],
  32205. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  32206. referencedClasses: [],
  32207. messageSends: []
  32208. }),
  32209. $globals.MethodNode);
  32210. $core.addMethod(
  32211. $core.method({
  32212. selector: "classReferences",
  32213. protocol: 'accessing',
  32214. fn: function (){
  32215. var self=this;
  32216. var $1;
  32217. $1=self["@classReferences"];
  32218. return $1;
  32219. },
  32220. args: [],
  32221. source: "classReferences\x0a\x09^ classReferences",
  32222. referencedClasses: [],
  32223. messageSends: []
  32224. }),
  32225. $globals.MethodNode);
  32226. $core.addMethod(
  32227. $core.method({
  32228. selector: "classReferences:",
  32229. protocol: 'accessing',
  32230. fn: function (aCollection){
  32231. var self=this;
  32232. self["@classReferences"]=aCollection;
  32233. return self;
  32234. },
  32235. args: ["aCollection"],
  32236. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  32237. referencedClasses: [],
  32238. messageSends: []
  32239. }),
  32240. $globals.MethodNode);
  32241. $core.addMethod(
  32242. $core.method({
  32243. selector: "messageSends",
  32244. protocol: 'accessing',
  32245. fn: function (){
  32246. var self=this;
  32247. return $core.withContext(function($ctx1) {
  32248. var $1;
  32249. $1=$recv(self._sendIndexes())._keys();
  32250. return $1;
  32251. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  32252. },
  32253. args: [],
  32254. source: "messageSends\x0a\x09^ self sendIndexes keys",
  32255. referencedClasses: [],
  32256. messageSends: ["keys", "sendIndexes"]
  32257. }),
  32258. $globals.MethodNode);
  32259. $core.addMethod(
  32260. $core.method({
  32261. selector: "method",
  32262. protocol: 'accessing',
  32263. fn: function (){
  32264. var self=this;
  32265. return self;
  32266. },
  32267. args: [],
  32268. source: "method\x0a\x09^ self",
  32269. referencedClasses: [],
  32270. messageSends: []
  32271. }),
  32272. $globals.MethodNode);
  32273. $core.addMethod(
  32274. $core.method({
  32275. selector: "scope",
  32276. protocol: 'accessing',
  32277. fn: function (){
  32278. var self=this;
  32279. var $1;
  32280. $1=self["@scope"];
  32281. return $1;
  32282. },
  32283. args: [],
  32284. source: "scope\x0a\x09^ scope",
  32285. referencedClasses: [],
  32286. messageSends: []
  32287. }),
  32288. $globals.MethodNode);
  32289. $core.addMethod(
  32290. $core.method({
  32291. selector: "scope:",
  32292. protocol: 'accessing',
  32293. fn: function (aMethodScope){
  32294. var self=this;
  32295. self["@scope"]=aMethodScope;
  32296. return self;
  32297. },
  32298. args: ["aMethodScope"],
  32299. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  32300. referencedClasses: [],
  32301. messageSends: []
  32302. }),
  32303. $globals.MethodNode);
  32304. $core.addMethod(
  32305. $core.method({
  32306. selector: "selector",
  32307. protocol: 'accessing',
  32308. fn: function (){
  32309. var self=this;
  32310. var $1;
  32311. $1=self["@selector"];
  32312. return $1;
  32313. },
  32314. args: [],
  32315. source: "selector\x0a\x09^ selector",
  32316. referencedClasses: [],
  32317. messageSends: []
  32318. }),
  32319. $globals.MethodNode);
  32320. $core.addMethod(
  32321. $core.method({
  32322. selector: "selector:",
  32323. protocol: 'accessing',
  32324. fn: function (aString){
  32325. var self=this;
  32326. self["@selector"]=aString;
  32327. return self;
  32328. },
  32329. args: ["aString"],
  32330. source: "selector: aString\x0a\x09selector := aString",
  32331. referencedClasses: [],
  32332. messageSends: []
  32333. }),
  32334. $globals.MethodNode);
  32335. $core.addMethod(
  32336. $core.method({
  32337. selector: "sendIndexes",
  32338. protocol: 'accessing',
  32339. fn: function (){
  32340. var self=this;
  32341. var $1;
  32342. $1=self["@sendIndexes"];
  32343. return $1;
  32344. },
  32345. args: [],
  32346. source: "sendIndexes\x0a\x09^ sendIndexes",
  32347. referencedClasses: [],
  32348. messageSends: []
  32349. }),
  32350. $globals.MethodNode);
  32351. $core.addMethod(
  32352. $core.method({
  32353. selector: "sendIndexes:",
  32354. protocol: 'accessing',
  32355. fn: function (aDictionary){
  32356. var self=this;
  32357. self["@sendIndexes"]=aDictionary;
  32358. return self;
  32359. },
  32360. args: ["aDictionary"],
  32361. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  32362. referencedClasses: [],
  32363. messageSends: []
  32364. }),
  32365. $globals.MethodNode);
  32366. $core.addMethod(
  32367. $core.method({
  32368. selector: "sequenceNode",
  32369. protocol: 'accessing',
  32370. fn: function (){
  32371. var self=this;
  32372. return $core.withContext(function($ctx1) {
  32373. var $1;
  32374. var $early={};
  32375. try {
  32376. $recv(self._nodes())._do_((function(each){
  32377. return $core.withContext(function($ctx2) {
  32378. $1=$recv(each)._isSequenceNode();
  32379. if($core.assert($1)){
  32380. throw $early=[each];
  32381. };
  32382. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32383. }));
  32384. return nil;
  32385. }
  32386. catch(e) {if(e===$early)return e[0]; throw e}
  32387. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  32388. },
  32389. args: [],
  32390. source: "sequenceNode\x0a\x09self nodes do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  32391. referencedClasses: [],
  32392. messageSends: ["do:", "nodes", "ifTrue:", "isSequenceNode"]
  32393. }),
  32394. $globals.MethodNode);
  32395. $core.addMethod(
  32396. $core.method({
  32397. selector: "source",
  32398. protocol: 'accessing',
  32399. fn: function (){
  32400. var self=this;
  32401. var $1;
  32402. $1=self["@source"];
  32403. return $1;
  32404. },
  32405. args: [],
  32406. source: "source\x0a\x09^ source",
  32407. referencedClasses: [],
  32408. messageSends: []
  32409. }),
  32410. $globals.MethodNode);
  32411. $core.addMethod(
  32412. $core.method({
  32413. selector: "source:",
  32414. protocol: 'accessing',
  32415. fn: function (aString){
  32416. var self=this;
  32417. self["@source"]=aString;
  32418. return self;
  32419. },
  32420. args: ["aString"],
  32421. source: "source: aString\x0a\x09source := aString",
  32422. referencedClasses: [],
  32423. messageSends: []
  32424. }),
  32425. $globals.MethodNode);
  32426. $core.addMethod(
  32427. $core.method({
  32428. selector: "superSends",
  32429. protocol: 'accessing',
  32430. fn: function (){
  32431. var self=this;
  32432. var $1;
  32433. $1=self["@superSends"];
  32434. return $1;
  32435. },
  32436. args: [],
  32437. source: "superSends\x0a\x09^ superSends",
  32438. referencedClasses: [],
  32439. messageSends: []
  32440. }),
  32441. $globals.MethodNode);
  32442. $core.addMethod(
  32443. $core.method({
  32444. selector: "superSends:",
  32445. protocol: 'accessing',
  32446. fn: function (aCollection){
  32447. var self=this;
  32448. self["@superSends"]=aCollection;
  32449. return self;
  32450. },
  32451. args: ["aCollection"],
  32452. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  32453. referencedClasses: [],
  32454. messageSends: []
  32455. }),
  32456. $globals.MethodNode);
  32457. $core.addClass('ReturnNode', $globals.Node, ['scope'], 'Compiler-AST');
  32458. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  32459. $core.addMethod(
  32460. $core.method({
  32461. selector: "accept:",
  32462. protocol: 'visiting',
  32463. fn: function (aVisitor){
  32464. var self=this;
  32465. return $core.withContext(function($ctx1) {
  32466. var $1;
  32467. $1=$recv(aVisitor)._visitReturnNode_(self);
  32468. return $1;
  32469. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ReturnNode)});
  32470. },
  32471. args: ["aVisitor"],
  32472. source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  32473. referencedClasses: [],
  32474. messageSends: ["visitReturnNode:"]
  32475. }),
  32476. $globals.ReturnNode);
  32477. $core.addMethod(
  32478. $core.method({
  32479. selector: "isReturnNode",
  32480. protocol: 'testing',
  32481. fn: function (){
  32482. var self=this;
  32483. return true;
  32484. },
  32485. args: [],
  32486. source: "isReturnNode\x0a\x09^ true",
  32487. referencedClasses: [],
  32488. messageSends: []
  32489. }),
  32490. $globals.ReturnNode);
  32491. $core.addMethod(
  32492. $core.method({
  32493. selector: "nonLocalReturn",
  32494. protocol: 'testing',
  32495. fn: function (){
  32496. var self=this;
  32497. return $core.withContext(function($ctx1) {
  32498. var $1;
  32499. $1=$recv($recv(self._scope())._isMethodScope())._not();
  32500. return $1;
  32501. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  32502. },
  32503. args: [],
  32504. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  32505. referencedClasses: [],
  32506. messageSends: ["not", "isMethodScope", "scope"]
  32507. }),
  32508. $globals.ReturnNode);
  32509. $core.addMethod(
  32510. $core.method({
  32511. selector: "scope",
  32512. protocol: 'accessing',
  32513. fn: function (){
  32514. var self=this;
  32515. var $1;
  32516. $1=self["@scope"];
  32517. return $1;
  32518. },
  32519. args: [],
  32520. source: "scope\x0a\x09^ scope",
  32521. referencedClasses: [],
  32522. messageSends: []
  32523. }),
  32524. $globals.ReturnNode);
  32525. $core.addMethod(
  32526. $core.method({
  32527. selector: "scope:",
  32528. protocol: 'accessing',
  32529. fn: function (aLexicalScope){
  32530. var self=this;
  32531. self["@scope"]=aLexicalScope;
  32532. return self;
  32533. },
  32534. args: ["aLexicalScope"],
  32535. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  32536. referencedClasses: [],
  32537. messageSends: []
  32538. }),
  32539. $globals.ReturnNode);
  32540. $core.addClass('SendNode', $globals.Node, ['selector', 'arguments', 'receiver', 'superSend', 'index'], 'Compiler-AST');
  32541. $globals.SendNode.comment="I represent an message send node.";
  32542. $core.addMethod(
  32543. $core.method({
  32544. selector: "accept:",
  32545. protocol: 'visiting',
  32546. fn: function (aVisitor){
  32547. var self=this;
  32548. return $core.withContext(function($ctx1) {
  32549. var $1;
  32550. $1=$recv(aVisitor)._visitSendNode_(self);
  32551. return $1;
  32552. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SendNode)});
  32553. },
  32554. args: ["aVisitor"],
  32555. source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  32556. referencedClasses: [],
  32557. messageSends: ["visitSendNode:"]
  32558. }),
  32559. $globals.SendNode);
  32560. $core.addMethod(
  32561. $core.method({
  32562. selector: "arguments",
  32563. protocol: 'accessing',
  32564. fn: function (){
  32565. var self=this;
  32566. return $core.withContext(function($ctx1) {
  32567. var $2,$1,$receiver;
  32568. $2=self["@arguments"];
  32569. if(($receiver = $2) == null || $receiver.isNil){
  32570. self["@arguments"]=[];
  32571. $1=self["@arguments"];
  32572. } else {
  32573. $1=$2;
  32574. };
  32575. return $1;
  32576. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  32577. },
  32578. args: [],
  32579. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  32580. referencedClasses: [],
  32581. messageSends: ["ifNil:"]
  32582. }),
  32583. $globals.SendNode);
  32584. $core.addMethod(
  32585. $core.method({
  32586. selector: "arguments:",
  32587. protocol: 'accessing',
  32588. fn: function (aCollection){
  32589. var self=this;
  32590. return $core.withContext(function($ctx1) {
  32591. self["@arguments"]=aCollection;
  32592. $recv(aCollection)._do_((function(each){
  32593. return $core.withContext(function($ctx2) {
  32594. return $recv(each)._parent_(self);
  32595. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32596. }));
  32597. return self;
  32598. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.SendNode)});
  32599. },
  32600. args: ["aCollection"],
  32601. source: "arguments: aCollection\x0a\x09arguments := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  32602. referencedClasses: [],
  32603. messageSends: ["do:", "parent:"]
  32604. }),
  32605. $globals.SendNode);
  32606. $core.addMethod(
  32607. $core.method({
  32608. selector: "cascadeNodeWithMessages:",
  32609. protocol: 'accessing',
  32610. fn: function (aCollection){
  32611. var self=this;
  32612. var first;
  32613. function $SendNode(){return $globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  32614. function $CascadeNode(){return $globals.CascadeNode||(typeof CascadeNode=="undefined"?nil:CascadeNode)}
  32615. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  32616. return $core.withContext(function($ctx1) {
  32617. var $1,$2,$4,$5,$3;
  32618. $1=$recv($SendNode())._new();
  32619. $ctx1.sendIdx["new"]=1;
  32620. $recv($1)._selector_(self._selector());
  32621. $recv($1)._arguments_(self._arguments());
  32622. $2=$recv($1)._yourself();
  32623. $ctx1.sendIdx["yourself"]=1;
  32624. first=$2;
  32625. $4=$recv($CascadeNode())._new();
  32626. $recv($4)._receiver_(self._receiver());
  32627. $recv($4)._nodes_($recv($recv($Array())._with_(first)).__comma(aCollection));
  32628. $5=$recv($4)._yourself();
  32629. $3=$5;
  32630. return $3;
  32631. }, function($ctx1) {$ctx1.fill(self,"cascadeNodeWithMessages:",{aCollection:aCollection,first:first},$globals.SendNode)});
  32632. },
  32633. args: ["aCollection"],
  32634. 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",
  32635. referencedClasses: ["SendNode", "CascadeNode", "Array"],
  32636. messageSends: ["selector:", "new", "selector", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"]
  32637. }),
  32638. $globals.SendNode);
  32639. $core.addMethod(
  32640. $core.method({
  32641. selector: "index",
  32642. protocol: 'accessing',
  32643. fn: function (){
  32644. var self=this;
  32645. var $1;
  32646. $1=self["@index"];
  32647. return $1;
  32648. },
  32649. args: [],
  32650. source: "index\x0a\x09^ index",
  32651. referencedClasses: [],
  32652. messageSends: []
  32653. }),
  32654. $globals.SendNode);
  32655. $core.addMethod(
  32656. $core.method({
  32657. selector: "index:",
  32658. protocol: 'accessing',
  32659. fn: function (anInteger){
  32660. var self=this;
  32661. self["@index"]=anInteger;
  32662. return self;
  32663. },
  32664. args: ["anInteger"],
  32665. source: "index: anInteger\x0a\x09index := anInteger",
  32666. referencedClasses: [],
  32667. messageSends: []
  32668. }),
  32669. $globals.SendNode);
  32670. $core.addMethod(
  32671. $core.method({
  32672. selector: "isCascadeSendNode",
  32673. protocol: 'testing',
  32674. fn: function (){
  32675. var self=this;
  32676. return $core.withContext(function($ctx1) {
  32677. var $1;
  32678. $1=$recv(self._parent())._isCascadeNode();
  32679. return $1;
  32680. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  32681. },
  32682. args: [],
  32683. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  32684. referencedClasses: [],
  32685. messageSends: ["isCascadeNode", "parent"]
  32686. }),
  32687. $globals.SendNode);
  32688. $core.addMethod(
  32689. $core.method({
  32690. selector: "isNavigationNode",
  32691. protocol: 'testing',
  32692. fn: function (){
  32693. var self=this;
  32694. return true;
  32695. },
  32696. args: [],
  32697. source: "isNavigationNode\x0a\x09^ true",
  32698. referencedClasses: [],
  32699. messageSends: []
  32700. }),
  32701. $globals.SendNode);
  32702. $core.addMethod(
  32703. $core.method({
  32704. selector: "isSendNode",
  32705. protocol: 'testing',
  32706. fn: function (){
  32707. var self=this;
  32708. return true;
  32709. },
  32710. args: [],
  32711. source: "isSendNode\x0a\x09^ true",
  32712. referencedClasses: [],
  32713. messageSends: []
  32714. }),
  32715. $globals.SendNode);
  32716. $core.addMethod(
  32717. $core.method({
  32718. selector: "navigationLink",
  32719. protocol: 'accessing',
  32720. fn: function (){
  32721. var self=this;
  32722. return $core.withContext(function($ctx1) {
  32723. var $1;
  32724. $1=self._selector();
  32725. return $1;
  32726. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  32727. },
  32728. args: [],
  32729. source: "navigationLink\x0a\x09^ self selector",
  32730. referencedClasses: [],
  32731. messageSends: ["selector"]
  32732. }),
  32733. $globals.SendNode);
  32734. $core.addMethod(
  32735. $core.method({
  32736. selector: "nodes",
  32737. protocol: 'accessing',
  32738. fn: function (){
  32739. var self=this;
  32740. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  32741. return $core.withContext(function($ctx1) {
  32742. var $1,$3,$2,$5,$6,$4,$receiver;
  32743. $1=self._receiver();
  32744. $ctx1.sendIdx["receiver"]=1;
  32745. if(($receiver = $1) == null || $receiver.isNil){
  32746. $3=self._arguments();
  32747. $ctx1.sendIdx["arguments"]=1;
  32748. $2=$recv($3)._copy();
  32749. return $2;
  32750. } else {
  32751. $1;
  32752. };
  32753. $5=$recv($Array())._with_(self._receiver());
  32754. $recv($5)._addAll_(self._arguments());
  32755. $6=$recv($5)._yourself();
  32756. $4=$6;
  32757. return $4;
  32758. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.SendNode)});
  32759. },
  32760. args: [],
  32761. 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",
  32762. referencedClasses: ["Array"],
  32763. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  32764. }),
  32765. $globals.SendNode);
  32766. $core.addMethod(
  32767. $core.method({
  32768. selector: "receiver",
  32769. protocol: 'accessing',
  32770. fn: function (){
  32771. var self=this;
  32772. var $1;
  32773. $1=self["@receiver"];
  32774. return $1;
  32775. },
  32776. args: [],
  32777. source: "receiver\x0a\x09^ receiver",
  32778. referencedClasses: [],
  32779. messageSends: []
  32780. }),
  32781. $globals.SendNode);
  32782. $core.addMethod(
  32783. $core.method({
  32784. selector: "receiver:",
  32785. protocol: 'accessing',
  32786. fn: function (aNode){
  32787. var self=this;
  32788. return $core.withContext(function($ctx1) {
  32789. var $1;
  32790. self["@receiver"]=aNode;
  32791. $1=$recv(aNode)._isNode();
  32792. if($core.assert($1)){
  32793. $recv(aNode)._parent_(self);
  32794. };
  32795. return self;
  32796. }, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},$globals.SendNode)});
  32797. },
  32798. args: ["aNode"],
  32799. source: "receiver: aNode\x0a\x09receiver := aNode.\x0a\x09aNode isNode ifTrue: [\x0a\x09\x09aNode parent: self ]",
  32800. referencedClasses: [],
  32801. messageSends: ["ifTrue:", "isNode", "parent:"]
  32802. }),
  32803. $globals.SendNode);
  32804. $core.addMethod(
  32805. $core.method({
  32806. selector: "requiresSmalltalkContext",
  32807. protocol: 'testing',
  32808. fn: function (){
  32809. var self=this;
  32810. return true;
  32811. },
  32812. args: [],
  32813. source: "requiresSmalltalkContext\x0a\x09^ true",
  32814. referencedClasses: [],
  32815. messageSends: []
  32816. }),
  32817. $globals.SendNode);
  32818. $core.addMethod(
  32819. $core.method({
  32820. selector: "selector",
  32821. protocol: 'accessing',
  32822. fn: function (){
  32823. var self=this;
  32824. var $1;
  32825. $1=self["@selector"];
  32826. return $1;
  32827. },
  32828. args: [],
  32829. source: "selector\x0a\x09^ selector",
  32830. referencedClasses: [],
  32831. messageSends: []
  32832. }),
  32833. $globals.SendNode);
  32834. $core.addMethod(
  32835. $core.method({
  32836. selector: "selector:",
  32837. protocol: 'accessing',
  32838. fn: function (aString){
  32839. var self=this;
  32840. self["@selector"]=aString;
  32841. return self;
  32842. },
  32843. args: ["aString"],
  32844. source: "selector: aString\x0a\x09selector := aString",
  32845. referencedClasses: [],
  32846. messageSends: []
  32847. }),
  32848. $globals.SendNode);
  32849. $core.addMethod(
  32850. $core.method({
  32851. selector: "shouldBeAliased",
  32852. protocol: 'testing',
  32853. fn: function (){
  32854. var self=this;
  32855. var sends;
  32856. return $core.withContext(function($ctx1) {
  32857. var $2,$1;
  32858. sends=$recv($recv($recv(self._method())._sendIndexes())._at_(self._selector()))._size();
  32859. $2=(
  32860. $ctx1.supercall = true,
  32861. $globals.SendNode.superclass.fn.prototype._shouldBeAliased.apply($recv(self), []));
  32862. $ctx1.supercall = false;
  32863. $1=$recv($2)._or_((function(){
  32864. return $core.withContext(function($ctx2) {
  32865. return $recv(self._isReferenced())._and_((function(){
  32866. return $core.withContext(function($ctx3) {
  32867. return $recv($recv($recv(sends).__gt((1)))._and_((function(){
  32868. return $core.withContext(function($ctx4) {
  32869. return $recv(self._index()).__lt(sends);
  32870. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  32871. })))._or_((function(){
  32872. return $core.withContext(function($ctx4) {
  32873. return self._superSend();
  32874. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  32875. }));
  32876. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32877. }));
  32878. $ctx2.sendIdx["and:"]=1;
  32879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32880. }));
  32881. $ctx1.sendIdx["or:"]=1;
  32882. return $1;
  32883. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  32884. },
  32885. args: [],
  32886. 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 ] ] ])",
  32887. referencedClasses: [],
  32888. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", ">", "<", "index", "superSend"]
  32889. }),
  32890. $globals.SendNode);
  32891. $core.addMethod(
  32892. $core.method({
  32893. selector: "superSend",
  32894. protocol: 'accessing',
  32895. fn: function (){
  32896. var self=this;
  32897. return $core.withContext(function($ctx1) {
  32898. var $2,$1,$receiver;
  32899. $2=self["@superSend"];
  32900. if(($receiver = $2) == null || $receiver.isNil){
  32901. $1=false;
  32902. } else {
  32903. $1=$2;
  32904. };
  32905. return $1;
  32906. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  32907. },
  32908. args: [],
  32909. source: "superSend\x0a\x09^ superSend ifNil: [ false ]",
  32910. referencedClasses: [],
  32911. messageSends: ["ifNil:"]
  32912. }),
  32913. $globals.SendNode);
  32914. $core.addMethod(
  32915. $core.method({
  32916. selector: "superSend:",
  32917. protocol: 'accessing',
  32918. fn: function (aBoolean){
  32919. var self=this;
  32920. self["@superSend"]=aBoolean;
  32921. return self;
  32922. },
  32923. args: ["aBoolean"],
  32924. source: "superSend: aBoolean\x0a\x09superSend := aBoolean",
  32925. referencedClasses: [],
  32926. messageSends: []
  32927. }),
  32928. $globals.SendNode);
  32929. $core.addMethod(
  32930. $core.method({
  32931. selector: "valueForReceiver:",
  32932. protocol: 'building',
  32933. fn: function (anObject){
  32934. var self=this;
  32935. function $SendNode(){return $globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  32936. return $core.withContext(function($ctx1) {
  32937. var $2,$3,$5,$4,$6,$1,$receiver;
  32938. $2=$recv($SendNode())._new();
  32939. $recv($2)._position_(self._position());
  32940. $recv($2)._source_(self._source());
  32941. $3=$2;
  32942. $5=self._receiver();
  32943. $ctx1.sendIdx["receiver"]=1;
  32944. if(($receiver = $5) == null || $receiver.isNil){
  32945. $4=anObject;
  32946. } else {
  32947. $4=$recv(self._receiver())._valueForReceiver_(anObject);
  32948. };
  32949. $recv($3)._receiver_($4);
  32950. $recv($2)._selector_(self._selector());
  32951. $recv($2)._arguments_(self._arguments());
  32952. $6=$recv($2)._yourself();
  32953. $1=$6;
  32954. return $1;
  32955. }, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},$globals.SendNode)});
  32956. },
  32957. args: ["anObject"],
  32958. 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",
  32959. referencedClasses: ["SendNode"],
  32960. messageSends: ["position:", "new", "position", "source:", "source", "receiver:", "ifNil:ifNotNil:", "receiver", "valueForReceiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  32961. }),
  32962. $globals.SendNode);
  32963. $core.addClass('SequenceNode', $globals.Node, ['temps', 'scope'], 'Compiler-AST');
  32964. $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).";
  32965. $core.addMethod(
  32966. $core.method({
  32967. selector: "accept:",
  32968. protocol: 'visiting',
  32969. fn: function (aVisitor){
  32970. var self=this;
  32971. return $core.withContext(function($ctx1) {
  32972. var $1;
  32973. $1=$recv(aVisitor)._visitSequenceNode_(self);
  32974. return $1;
  32975. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SequenceNode)});
  32976. },
  32977. args: ["aVisitor"],
  32978. source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  32979. referencedClasses: [],
  32980. messageSends: ["visitSequenceNode:"]
  32981. }),
  32982. $globals.SequenceNode);
  32983. $core.addMethod(
  32984. $core.method({
  32985. selector: "asBlockSequenceNode",
  32986. protocol: 'building',
  32987. fn: function (){
  32988. var self=this;
  32989. function $BlockSequenceNode(){return $globals.BlockSequenceNode||(typeof BlockSequenceNode=="undefined"?nil:BlockSequenceNode)}
  32990. return $core.withContext(function($ctx1) {
  32991. var $2,$3,$1;
  32992. $2=$recv($BlockSequenceNode())._new();
  32993. $recv($2)._position_(self._position());
  32994. $recv($2)._source_(self._source());
  32995. $recv($2)._nodes_(self._nodes());
  32996. $recv($2)._temps_(self._temps());
  32997. $3=$recv($2)._yourself();
  32998. $1=$3;
  32999. return $1;
  33000. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  33001. },
  33002. args: [],
  33003. 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",
  33004. referencedClasses: ["BlockSequenceNode"],
  33005. messageSends: ["position:", "new", "position", "source:", "source", "nodes:", "nodes", "temps:", "temps", "yourself"]
  33006. }),
  33007. $globals.SequenceNode);
  33008. $core.addMethod(
  33009. $core.method({
  33010. selector: "isSequenceNode",
  33011. protocol: 'testing',
  33012. fn: function (){
  33013. var self=this;
  33014. return true;
  33015. },
  33016. args: [],
  33017. source: "isSequenceNode\x0a\x09^ true",
  33018. referencedClasses: [],
  33019. messageSends: []
  33020. }),
  33021. $globals.SequenceNode);
  33022. $core.addMethod(
  33023. $core.method({
  33024. selector: "scope",
  33025. protocol: 'accessing',
  33026. fn: function (){
  33027. var self=this;
  33028. var $1;
  33029. $1=self["@scope"];
  33030. return $1;
  33031. },
  33032. args: [],
  33033. source: "scope\x0a\x09^ scope",
  33034. referencedClasses: [],
  33035. messageSends: []
  33036. }),
  33037. $globals.SequenceNode);
  33038. $core.addMethod(
  33039. $core.method({
  33040. selector: "scope:",
  33041. protocol: 'accessing',
  33042. fn: function (aLexicalScope){
  33043. var self=this;
  33044. self["@scope"]=aLexicalScope;
  33045. return self;
  33046. },
  33047. args: ["aLexicalScope"],
  33048. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  33049. referencedClasses: [],
  33050. messageSends: []
  33051. }),
  33052. $globals.SequenceNode);
  33053. $core.addMethod(
  33054. $core.method({
  33055. selector: "temps",
  33056. protocol: 'accessing',
  33057. fn: function (){
  33058. var self=this;
  33059. return $core.withContext(function($ctx1) {
  33060. var $2,$1,$receiver;
  33061. $2=self["@temps"];
  33062. if(($receiver = $2) == null || $receiver.isNil){
  33063. $1=[];
  33064. } else {
  33065. $1=$2;
  33066. };
  33067. return $1;
  33068. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  33069. },
  33070. args: [],
  33071. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  33072. referencedClasses: [],
  33073. messageSends: ["ifNil:"]
  33074. }),
  33075. $globals.SequenceNode);
  33076. $core.addMethod(
  33077. $core.method({
  33078. selector: "temps:",
  33079. protocol: 'accessing',
  33080. fn: function (aCollection){
  33081. var self=this;
  33082. self["@temps"]=aCollection;
  33083. return self;
  33084. },
  33085. args: ["aCollection"],
  33086. source: "temps: aCollection\x0a\x09temps := aCollection",
  33087. referencedClasses: [],
  33088. messageSends: []
  33089. }),
  33090. $globals.SequenceNode);
  33091. $core.addClass('BlockSequenceNode', $globals.SequenceNode, [], 'Compiler-AST');
  33092. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  33093. $core.addMethod(
  33094. $core.method({
  33095. selector: "accept:",
  33096. protocol: 'visiting',
  33097. fn: function (aVisitor){
  33098. var self=this;
  33099. return $core.withContext(function($ctx1) {
  33100. var $1;
  33101. $1=$recv(aVisitor)._visitBlockSequenceNode_(self);
  33102. return $1;
  33103. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  33104. },
  33105. args: ["aVisitor"],
  33106. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  33107. referencedClasses: [],
  33108. messageSends: ["visitBlockSequenceNode:"]
  33109. }),
  33110. $globals.BlockSequenceNode);
  33111. $core.addMethod(
  33112. $core.method({
  33113. selector: "isBlockSequenceNode",
  33114. protocol: 'testing',
  33115. fn: function (){
  33116. var self=this;
  33117. return true;
  33118. },
  33119. args: [],
  33120. source: "isBlockSequenceNode\x0a\x09^ true",
  33121. referencedClasses: [],
  33122. messageSends: []
  33123. }),
  33124. $globals.BlockSequenceNode);
  33125. $core.addClass('ValueNode', $globals.Node, ['value'], 'Compiler-AST');
  33126. $globals.ValueNode.comment="I represent a value node.";
  33127. $core.addMethod(
  33128. $core.method({
  33129. selector: "accept:",
  33130. protocol: 'visiting',
  33131. fn: function (aVisitor){
  33132. var self=this;
  33133. return $core.withContext(function($ctx1) {
  33134. var $1;
  33135. $1=$recv(aVisitor)._visitValueNode_(self);
  33136. return $1;
  33137. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ValueNode)});
  33138. },
  33139. args: ["aVisitor"],
  33140. source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  33141. referencedClasses: [],
  33142. messageSends: ["visitValueNode:"]
  33143. }),
  33144. $globals.ValueNode);
  33145. $core.addMethod(
  33146. $core.method({
  33147. selector: "isImmutable",
  33148. protocol: 'testing',
  33149. fn: function (){
  33150. var self=this;
  33151. return $core.withContext(function($ctx1) {
  33152. var $1;
  33153. $1=$recv(self._value())._isImmutable();
  33154. return $1;
  33155. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  33156. },
  33157. args: [],
  33158. source: "isImmutable\x0a\x09^ self value isImmutable",
  33159. referencedClasses: [],
  33160. messageSends: ["isImmutable", "value"]
  33161. }),
  33162. $globals.ValueNode);
  33163. $core.addMethod(
  33164. $core.method({
  33165. selector: "isValueNode",
  33166. protocol: 'testing',
  33167. fn: function (){
  33168. var self=this;
  33169. return true;
  33170. },
  33171. args: [],
  33172. source: "isValueNode\x0a\x09^ true",
  33173. referencedClasses: [],
  33174. messageSends: []
  33175. }),
  33176. $globals.ValueNode);
  33177. $core.addMethod(
  33178. $core.method({
  33179. selector: "value",
  33180. protocol: 'accessing',
  33181. fn: function (){
  33182. var self=this;
  33183. var $1;
  33184. $1=self["@value"];
  33185. return $1;
  33186. },
  33187. args: [],
  33188. source: "value\x0a\x09^ value",
  33189. referencedClasses: [],
  33190. messageSends: []
  33191. }),
  33192. $globals.ValueNode);
  33193. $core.addMethod(
  33194. $core.method({
  33195. selector: "value:",
  33196. protocol: 'accessing',
  33197. fn: function (anObject){
  33198. var self=this;
  33199. self["@value"]=anObject;
  33200. return self;
  33201. },
  33202. args: ["anObject"],
  33203. source: "value: anObject\x0a\x09value := anObject",
  33204. referencedClasses: [],
  33205. messageSends: []
  33206. }),
  33207. $globals.ValueNode);
  33208. $core.addClass('VariableNode', $globals.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
  33209. $globals.VariableNode.comment="I represent an variable node.";
  33210. $core.addMethod(
  33211. $core.method({
  33212. selector: "accept:",
  33213. protocol: 'visiting',
  33214. fn: function (aVisitor){
  33215. var self=this;
  33216. return $core.withContext(function($ctx1) {
  33217. var $1;
  33218. $1=$recv(aVisitor)._visitVariableNode_(self);
  33219. return $1;
  33220. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.VariableNode)});
  33221. },
  33222. args: ["aVisitor"],
  33223. source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  33224. referencedClasses: [],
  33225. messageSends: ["visitVariableNode:"]
  33226. }),
  33227. $globals.VariableNode);
  33228. $core.addMethod(
  33229. $core.method({
  33230. selector: "alias",
  33231. protocol: 'accessing',
  33232. fn: function (){
  33233. var self=this;
  33234. return $core.withContext(function($ctx1) {
  33235. var $1;
  33236. $1=$recv(self._binding())._alias();
  33237. return $1;
  33238. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  33239. },
  33240. args: [],
  33241. source: "alias\x0a\x09^ self binding alias",
  33242. referencedClasses: [],
  33243. messageSends: ["alias", "binding"]
  33244. }),
  33245. $globals.VariableNode);
  33246. $core.addMethod(
  33247. $core.method({
  33248. selector: "assigned",
  33249. protocol: 'accessing',
  33250. fn: function (){
  33251. var self=this;
  33252. return $core.withContext(function($ctx1) {
  33253. var $2,$1,$receiver;
  33254. $2=self["@assigned"];
  33255. if(($receiver = $2) == null || $receiver.isNil){
  33256. $1=false;
  33257. } else {
  33258. $1=$2;
  33259. };
  33260. return $1;
  33261. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  33262. },
  33263. args: [],
  33264. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  33265. referencedClasses: [],
  33266. messageSends: ["ifNil:"]
  33267. }),
  33268. $globals.VariableNode);
  33269. $core.addMethod(
  33270. $core.method({
  33271. selector: "assigned:",
  33272. protocol: 'accessing',
  33273. fn: function (aBoolean){
  33274. var self=this;
  33275. self["@assigned"]=aBoolean;
  33276. return self;
  33277. },
  33278. args: ["aBoolean"],
  33279. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  33280. referencedClasses: [],
  33281. messageSends: []
  33282. }),
  33283. $globals.VariableNode);
  33284. $core.addMethod(
  33285. $core.method({
  33286. selector: "beAssigned",
  33287. protocol: 'accessing',
  33288. fn: function (){
  33289. var self=this;
  33290. return $core.withContext(function($ctx1) {
  33291. $recv(self._binding())._validateAssignment();
  33292. self["@assigned"]=true;
  33293. return self;
  33294. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  33295. },
  33296. args: [],
  33297. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  33298. referencedClasses: [],
  33299. messageSends: ["validateAssignment", "binding"]
  33300. }),
  33301. $globals.VariableNode);
  33302. $core.addMethod(
  33303. $core.method({
  33304. selector: "binding",
  33305. protocol: 'accessing',
  33306. fn: function (){
  33307. var self=this;
  33308. var $1;
  33309. $1=self["@binding"];
  33310. return $1;
  33311. },
  33312. args: [],
  33313. source: "binding\x0a\x09^ binding",
  33314. referencedClasses: [],
  33315. messageSends: []
  33316. }),
  33317. $globals.VariableNode);
  33318. $core.addMethod(
  33319. $core.method({
  33320. selector: "binding:",
  33321. protocol: 'accessing',
  33322. fn: function (aScopeVar){
  33323. var self=this;
  33324. self["@binding"]=aScopeVar;
  33325. return self;
  33326. },
  33327. args: ["aScopeVar"],
  33328. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  33329. referencedClasses: [],
  33330. messageSends: []
  33331. }),
  33332. $globals.VariableNode);
  33333. $core.addMethod(
  33334. $core.method({
  33335. selector: "isArgument",
  33336. protocol: 'testing',
  33337. fn: function (){
  33338. var self=this;
  33339. return $core.withContext(function($ctx1) {
  33340. var $1;
  33341. $1=$recv(self._binding())._isArgVar();
  33342. return $1;
  33343. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  33344. },
  33345. args: [],
  33346. source: "isArgument\x0a\x09^ self binding isArgVar",
  33347. referencedClasses: [],
  33348. messageSends: ["isArgVar", "binding"]
  33349. }),
  33350. $globals.VariableNode);
  33351. $core.addMethod(
  33352. $core.method({
  33353. selector: "isImmutable",
  33354. protocol: 'testing',
  33355. fn: function (){
  33356. var self=this;
  33357. return $core.withContext(function($ctx1) {
  33358. var $1;
  33359. $1=$recv(self._binding())._isImmutable();
  33360. return $1;
  33361. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  33362. },
  33363. args: [],
  33364. source: "isImmutable\x0a\x09^ self binding isImmutable",
  33365. referencedClasses: [],
  33366. messageSends: ["isImmutable", "binding"]
  33367. }),
  33368. $globals.VariableNode);
  33369. $core.addMethod(
  33370. $core.method({
  33371. selector: "isNavigationNode",
  33372. protocol: 'testing',
  33373. fn: function (){
  33374. var self=this;
  33375. return true;
  33376. },
  33377. args: [],
  33378. source: "isNavigationNode\x0a\x09^ true",
  33379. referencedClasses: [],
  33380. messageSends: []
  33381. }),
  33382. $globals.VariableNode);
  33383. $core.addMethod(
  33384. $core.method({
  33385. selector: "isVariableNode",
  33386. protocol: 'testing',
  33387. fn: function (){
  33388. var self=this;
  33389. return true;
  33390. },
  33391. args: [],
  33392. source: "isVariableNode\x0a\x09^ true",
  33393. referencedClasses: [],
  33394. messageSends: []
  33395. }),
  33396. $globals.VariableNode);
  33397. $core.addMethod(
  33398. $core.method({
  33399. selector: "navigationLink",
  33400. protocol: 'accessing',
  33401. fn: function (){
  33402. var self=this;
  33403. return $core.withContext(function($ctx1) {
  33404. var $1;
  33405. $1=self._value();
  33406. return $1;
  33407. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  33408. },
  33409. args: [],
  33410. source: "navigationLink\x0a\x09^ self value",
  33411. referencedClasses: [],
  33412. messageSends: ["value"]
  33413. }),
  33414. $globals.VariableNode);
  33415. $core.addClass('NodeVisitor', $globals.Object, [], 'Compiler-AST');
  33416. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  33417. $core.addMethod(
  33418. $core.method({
  33419. selector: "visit:",
  33420. protocol: 'visiting',
  33421. fn: function (aNode){
  33422. var self=this;
  33423. return $core.withContext(function($ctx1) {
  33424. var $1;
  33425. $1=$recv(aNode)._accept_(self);
  33426. return $1;
  33427. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.NodeVisitor)});
  33428. },
  33429. args: ["aNode"],
  33430. source: "visit: aNode\x0a\x09^ aNode accept: self",
  33431. referencedClasses: [],
  33432. messageSends: ["accept:"]
  33433. }),
  33434. $globals.NodeVisitor);
  33435. $core.addMethod(
  33436. $core.method({
  33437. selector: "visitAll:",
  33438. protocol: 'visiting',
  33439. fn: function (aCollection){
  33440. var self=this;
  33441. return $core.withContext(function($ctx1) {
  33442. var $1;
  33443. $1=$recv(aCollection)._collect_((function(each){
  33444. return $core.withContext(function($ctx2) {
  33445. return self._visit_(each);
  33446. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33447. }));
  33448. return $1;
  33449. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.NodeVisitor)});
  33450. },
  33451. args: ["aCollection"],
  33452. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  33453. referencedClasses: [],
  33454. messageSends: ["collect:", "visit:"]
  33455. }),
  33456. $globals.NodeVisitor);
  33457. $core.addMethod(
  33458. $core.method({
  33459. selector: "visitAssignmentNode:",
  33460. protocol: 'visiting',
  33461. fn: function (aNode){
  33462. var self=this;
  33463. return $core.withContext(function($ctx1) {
  33464. var $1;
  33465. $1=self._visitNode_(aNode);
  33466. return $1;
  33467. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  33468. },
  33469. args: ["aNode"],
  33470. source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
  33471. referencedClasses: [],
  33472. messageSends: ["visitNode:"]
  33473. }),
  33474. $globals.NodeVisitor);
  33475. $core.addMethod(
  33476. $core.method({
  33477. selector: "visitBlockNode:",
  33478. protocol: 'visiting',
  33479. fn: function (aNode){
  33480. var self=this;
  33481. return $core.withContext(function($ctx1) {
  33482. var $1;
  33483. $1=self._visitNode_(aNode);
  33484. return $1;
  33485. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  33486. },
  33487. args: ["aNode"],
  33488. source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
  33489. referencedClasses: [],
  33490. messageSends: ["visitNode:"]
  33491. }),
  33492. $globals.NodeVisitor);
  33493. $core.addMethod(
  33494. $core.method({
  33495. selector: "visitBlockSequenceNode:",
  33496. protocol: 'visiting',
  33497. fn: function (aNode){
  33498. var self=this;
  33499. return $core.withContext(function($ctx1) {
  33500. var $1;
  33501. $1=self._visitSequenceNode_(aNode);
  33502. return $1;
  33503. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  33504. },
  33505. args: ["aNode"],
  33506. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  33507. referencedClasses: [],
  33508. messageSends: ["visitSequenceNode:"]
  33509. }),
  33510. $globals.NodeVisitor);
  33511. $core.addMethod(
  33512. $core.method({
  33513. selector: "visitCascadeNode:",
  33514. protocol: 'visiting',
  33515. fn: function (aNode){
  33516. var self=this;
  33517. return $core.withContext(function($ctx1) {
  33518. var $1;
  33519. $1=self._visitNode_(aNode);
  33520. return $1;
  33521. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  33522. },
  33523. args: ["aNode"],
  33524. source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
  33525. referencedClasses: [],
  33526. messageSends: ["visitNode:"]
  33527. }),
  33528. $globals.NodeVisitor);
  33529. $core.addMethod(
  33530. $core.method({
  33531. selector: "visitDynamicArrayNode:",
  33532. protocol: 'visiting',
  33533. fn: function (aNode){
  33534. var self=this;
  33535. return $core.withContext(function($ctx1) {
  33536. var $1;
  33537. $1=self._visitNode_(aNode);
  33538. return $1;
  33539. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  33540. },
  33541. args: ["aNode"],
  33542. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
  33543. referencedClasses: [],
  33544. messageSends: ["visitNode:"]
  33545. }),
  33546. $globals.NodeVisitor);
  33547. $core.addMethod(
  33548. $core.method({
  33549. selector: "visitDynamicDictionaryNode:",
  33550. protocol: 'visiting',
  33551. fn: function (aNode){
  33552. var self=this;
  33553. return $core.withContext(function($ctx1) {
  33554. var $1;
  33555. $1=self._visitNode_(aNode);
  33556. return $1;
  33557. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  33558. },
  33559. args: ["aNode"],
  33560. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
  33561. referencedClasses: [],
  33562. messageSends: ["visitNode:"]
  33563. }),
  33564. $globals.NodeVisitor);
  33565. $core.addMethod(
  33566. $core.method({
  33567. selector: "visitJSStatementNode:",
  33568. protocol: 'visiting',
  33569. fn: function (aNode){
  33570. var self=this;
  33571. return $core.withContext(function($ctx1) {
  33572. var $1;
  33573. $1=self._visitNode_(aNode);
  33574. return $1;
  33575. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  33576. },
  33577. args: ["aNode"],
  33578. source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
  33579. referencedClasses: [],
  33580. messageSends: ["visitNode:"]
  33581. }),
  33582. $globals.NodeVisitor);
  33583. $core.addMethod(
  33584. $core.method({
  33585. selector: "visitMethodNode:",
  33586. protocol: 'visiting',
  33587. fn: function (aNode){
  33588. var self=this;
  33589. return $core.withContext(function($ctx1) {
  33590. var $1;
  33591. $1=self._visitNode_(aNode);
  33592. return $1;
  33593. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  33594. },
  33595. args: ["aNode"],
  33596. source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
  33597. referencedClasses: [],
  33598. messageSends: ["visitNode:"]
  33599. }),
  33600. $globals.NodeVisitor);
  33601. $core.addMethod(
  33602. $core.method({
  33603. selector: "visitNode:",
  33604. protocol: 'visiting',
  33605. fn: function (aNode){
  33606. var self=this;
  33607. return $core.withContext(function($ctx1) {
  33608. var $1;
  33609. $1=self._visitAll_($recv(aNode)._nodes());
  33610. return $1;
  33611. }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},$globals.NodeVisitor)});
  33612. },
  33613. args: ["aNode"],
  33614. source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
  33615. referencedClasses: [],
  33616. messageSends: ["visitAll:", "nodes"]
  33617. }),
  33618. $globals.NodeVisitor);
  33619. $core.addMethod(
  33620. $core.method({
  33621. selector: "visitReturnNode:",
  33622. protocol: 'visiting',
  33623. fn: function (aNode){
  33624. var self=this;
  33625. return $core.withContext(function($ctx1) {
  33626. var $1;
  33627. $1=self._visitNode_(aNode);
  33628. return $1;
  33629. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  33630. },
  33631. args: ["aNode"],
  33632. source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
  33633. referencedClasses: [],
  33634. messageSends: ["visitNode:"]
  33635. }),
  33636. $globals.NodeVisitor);
  33637. $core.addMethod(
  33638. $core.method({
  33639. selector: "visitSendNode:",
  33640. protocol: 'visiting',
  33641. fn: function (aNode){
  33642. var self=this;
  33643. return $core.withContext(function($ctx1) {
  33644. var $1;
  33645. $1=self._visitNode_(aNode);
  33646. return $1;
  33647. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  33648. },
  33649. args: ["aNode"],
  33650. source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
  33651. referencedClasses: [],
  33652. messageSends: ["visitNode:"]
  33653. }),
  33654. $globals.NodeVisitor);
  33655. $core.addMethod(
  33656. $core.method({
  33657. selector: "visitSequenceNode:",
  33658. protocol: 'visiting',
  33659. fn: function (aNode){
  33660. var self=this;
  33661. return $core.withContext(function($ctx1) {
  33662. var $1;
  33663. $1=self._visitNode_(aNode);
  33664. return $1;
  33665. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  33666. },
  33667. args: ["aNode"],
  33668. source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
  33669. referencedClasses: [],
  33670. messageSends: ["visitNode:"]
  33671. }),
  33672. $globals.NodeVisitor);
  33673. $core.addMethod(
  33674. $core.method({
  33675. selector: "visitValueNode:",
  33676. protocol: 'visiting',
  33677. fn: function (aNode){
  33678. var self=this;
  33679. return $core.withContext(function($ctx1) {
  33680. var $1;
  33681. $1=self._visitNode_(aNode);
  33682. return $1;
  33683. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  33684. },
  33685. args: ["aNode"],
  33686. source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
  33687. referencedClasses: [],
  33688. messageSends: ["visitNode:"]
  33689. }),
  33690. $globals.NodeVisitor);
  33691. $core.addMethod(
  33692. $core.method({
  33693. selector: "visitVariableNode:",
  33694. protocol: 'visiting',
  33695. fn: function (aNode){
  33696. var self=this;
  33697. return $core.withContext(function($ctx1) {
  33698. var $1;
  33699. $1=self._visitNode_(aNode);
  33700. return $1;
  33701. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  33702. },
  33703. args: ["aNode"],
  33704. source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
  33705. referencedClasses: [],
  33706. messageSends: ["visitNode:"]
  33707. }),
  33708. $globals.NodeVisitor);
  33709. $core.addMethod(
  33710. $core.method({
  33711. selector: "ast",
  33712. protocol: '*Compiler-AST',
  33713. fn: function (){
  33714. var self=this;
  33715. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  33716. return $core.withContext(function($ctx1) {
  33717. var $1,$2;
  33718. $1=self._source();
  33719. $ctx1.sendIdx["source"]=1;
  33720. $recv($1)._ifEmpty_((function(){
  33721. return $core.withContext(function($ctx2) {
  33722. return self._error_("Method source is empty");
  33723. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33724. }));
  33725. $2=$recv($Smalltalk())._parse_(self._source());
  33726. return $2;
  33727. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  33728. },
  33729. args: [],
  33730. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  33731. referencedClasses: ["Smalltalk"],
  33732. messageSends: ["ifEmpty:", "source", "error:", "parse:"]
  33733. }),
  33734. $globals.CompiledMethod);
  33735. $core.addMethod(
  33736. $core.method({
  33737. selector: "isNode",
  33738. protocol: '*Compiler-AST',
  33739. fn: function (){
  33740. var self=this;
  33741. return false;
  33742. },
  33743. args: [],
  33744. source: "isNode\x0a\x09^ false",
  33745. referencedClasses: [],
  33746. messageSends: []
  33747. }),
  33748. $globals.Object);
  33749. });
  33750. define("amber_core/Compiler-Semantic", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Compiler-AST", "amber_core/Compiler-Core"], function($boot){"use strict";
  33751. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  33752. $core.addPackage('Compiler-Semantic');
  33753. $core.packages["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  33754. $core.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  33755. $core.addClass('LexicalScope', $globals.Object, ['node', 'instruction', 'temps', 'args', 'outerScope', 'blockIndex'], 'Compiler-Semantic');
  33756. $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.";
  33757. $core.addMethod(
  33758. $core.method({
  33759. selector: "addArg:",
  33760. protocol: 'adding',
  33761. fn: function (aString){
  33762. var self=this;
  33763. function $ArgVar(){return $globals.ArgVar||(typeof ArgVar=="undefined"?nil:ArgVar)}
  33764. return $core.withContext(function($ctx1) {
  33765. var $1;
  33766. $1=self._args();
  33767. $ctx1.sendIdx["args"]=1;
  33768. $recv($1)._at_put_(aString,$recv($ArgVar())._on_(aString));
  33769. $recv($recv(self._args())._at_(aString))._scope_(self);
  33770. return self;
  33771. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  33772. },
  33773. args: ["aString"],
  33774. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  33775. referencedClasses: ["ArgVar"],
  33776. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  33777. }),
  33778. $globals.LexicalScope);
  33779. $core.addMethod(
  33780. $core.method({
  33781. selector: "addTemp:",
  33782. protocol: 'adding',
  33783. fn: function (aString){
  33784. var self=this;
  33785. function $TempVar(){return $globals.TempVar||(typeof TempVar=="undefined"?nil:TempVar)}
  33786. return $core.withContext(function($ctx1) {
  33787. var $1;
  33788. $1=self._temps();
  33789. $ctx1.sendIdx["temps"]=1;
  33790. $recv($1)._at_put_(aString,$recv($TempVar())._on_(aString));
  33791. $recv($recv(self._temps())._at_(aString))._scope_(self);
  33792. return self;
  33793. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  33794. },
  33795. args: ["aString"],
  33796. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  33797. referencedClasses: ["TempVar"],
  33798. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  33799. }),
  33800. $globals.LexicalScope);
  33801. $core.addMethod(
  33802. $core.method({
  33803. selector: "alias",
  33804. protocol: 'accessing',
  33805. fn: function (){
  33806. var self=this;
  33807. return $core.withContext(function($ctx1) {
  33808. var $1;
  33809. $1="$ctx".__comma($recv(self._scopeLevel())._asString());
  33810. return $1;
  33811. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  33812. },
  33813. args: [],
  33814. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  33815. referencedClasses: [],
  33816. messageSends: [",", "asString", "scopeLevel"]
  33817. }),
  33818. $globals.LexicalScope);
  33819. $core.addMethod(
  33820. $core.method({
  33821. selector: "allVariableNames",
  33822. protocol: 'accessing',
  33823. fn: function (){
  33824. var self=this;
  33825. return $core.withContext(function($ctx1) {
  33826. var $2,$1;
  33827. $2=$recv(self._args())._keys();
  33828. $ctx1.sendIdx["keys"]=1;
  33829. $1=$recv($2).__comma($recv(self._temps())._keys());
  33830. return $1;
  33831. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  33832. },
  33833. args: [],
  33834. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  33835. referencedClasses: [],
  33836. messageSends: [",", "keys", "args", "temps"]
  33837. }),
  33838. $globals.LexicalScope);
  33839. $core.addMethod(
  33840. $core.method({
  33841. selector: "args",
  33842. protocol: 'accessing',
  33843. fn: function (){
  33844. var self=this;
  33845. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  33846. return $core.withContext(function($ctx1) {
  33847. var $2,$1,$receiver;
  33848. $2=self["@args"];
  33849. if(($receiver = $2) == null || $receiver.isNil){
  33850. self["@args"]=$recv($Dictionary())._new();
  33851. $1=self["@args"];
  33852. } else {
  33853. $1=$2;
  33854. };
  33855. return $1;
  33856. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  33857. },
  33858. args: [],
  33859. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  33860. referencedClasses: ["Dictionary"],
  33861. messageSends: ["ifNil:", "new"]
  33862. }),
  33863. $globals.LexicalScope);
  33864. $core.addMethod(
  33865. $core.method({
  33866. selector: "bindingFor:",
  33867. protocol: 'accessing',
  33868. fn: function (aStringOrNode){
  33869. var self=this;
  33870. return $core.withContext(function($ctx1) {
  33871. var $2,$3,$4,$5,$1;
  33872. $2=self._pseudoVars();
  33873. $3=$recv(aStringOrNode)._value();
  33874. $ctx1.sendIdx["value"]=1;
  33875. $1=$recv($2)._at_ifAbsent_($3,(function(){
  33876. return $core.withContext(function($ctx2) {
  33877. $4=self._args();
  33878. $5=$recv(aStringOrNode)._value();
  33879. $ctx2.sendIdx["value"]=2;
  33880. return $recv($4)._at_ifAbsent_($5,(function(){
  33881. return $core.withContext(function($ctx3) {
  33882. return $recv(self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  33883. return nil;
  33884. }));
  33885. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33886. }));
  33887. $ctx2.sendIdx["at:ifAbsent:"]=2;
  33888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33889. }));
  33890. $ctx1.sendIdx["at:ifAbsent:"]=1;
  33891. return $1;
  33892. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  33893. },
  33894. args: ["aStringOrNode"],
  33895. 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 ]]]",
  33896. referencedClasses: [],
  33897. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  33898. }),
  33899. $globals.LexicalScope);
  33900. $core.addMethod(
  33901. $core.method({
  33902. selector: "blockIndex",
  33903. protocol: 'accessing',
  33904. fn: function (){
  33905. var self=this;
  33906. return $core.withContext(function($ctx1) {
  33907. var $2,$1,$receiver;
  33908. $2=self["@blockIndex"];
  33909. if(($receiver = $2) == null || $receiver.isNil){
  33910. $1=(0);
  33911. } else {
  33912. $1=$2;
  33913. };
  33914. return $1;
  33915. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  33916. },
  33917. args: [],
  33918. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  33919. referencedClasses: [],
  33920. messageSends: ["ifNil:"]
  33921. }),
  33922. $globals.LexicalScope);
  33923. $core.addMethod(
  33924. $core.method({
  33925. selector: "blockIndex:",
  33926. protocol: 'accessing',
  33927. fn: function (anInteger){
  33928. var self=this;
  33929. self["@blockIndex"]=anInteger;
  33930. return self;
  33931. },
  33932. args: ["anInteger"],
  33933. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  33934. referencedClasses: [],
  33935. messageSends: []
  33936. }),
  33937. $globals.LexicalScope);
  33938. $core.addMethod(
  33939. $core.method({
  33940. selector: "canInlineNonLocalReturns",
  33941. protocol: 'testing',
  33942. fn: function (){
  33943. var self=this;
  33944. return $core.withContext(function($ctx1) {
  33945. var $1;
  33946. $1=$recv(self._isInlined())._and_((function(){
  33947. return $core.withContext(function($ctx2) {
  33948. return $recv(self._outerScope())._canInlineNonLocalReturns();
  33949. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33950. }));
  33951. return $1;
  33952. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  33953. },
  33954. args: [],
  33955. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  33956. referencedClasses: [],
  33957. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  33958. }),
  33959. $globals.LexicalScope);
  33960. $core.addMethod(
  33961. $core.method({
  33962. selector: "instruction",
  33963. protocol: 'accessing',
  33964. fn: function (){
  33965. var self=this;
  33966. var $1;
  33967. $1=self["@instruction"];
  33968. return $1;
  33969. },
  33970. args: [],
  33971. source: "instruction\x0a\x09^ instruction",
  33972. referencedClasses: [],
  33973. messageSends: []
  33974. }),
  33975. $globals.LexicalScope);
  33976. $core.addMethod(
  33977. $core.method({
  33978. selector: "instruction:",
  33979. protocol: 'accessing',
  33980. fn: function (anIRInstruction){
  33981. var self=this;
  33982. self["@instruction"]=anIRInstruction;
  33983. return self;
  33984. },
  33985. args: ["anIRInstruction"],
  33986. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  33987. referencedClasses: [],
  33988. messageSends: []
  33989. }),
  33990. $globals.LexicalScope);
  33991. $core.addMethod(
  33992. $core.method({
  33993. selector: "isBlockScope",
  33994. protocol: 'testing',
  33995. fn: function (){
  33996. var self=this;
  33997. return $core.withContext(function($ctx1) {
  33998. var $1;
  33999. $1=$recv(self._isMethodScope())._not();
  34000. return $1;
  34001. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  34002. },
  34003. args: [],
  34004. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  34005. referencedClasses: [],
  34006. messageSends: ["not", "isMethodScope"]
  34007. }),
  34008. $globals.LexicalScope);
  34009. $core.addMethod(
  34010. $core.method({
  34011. selector: "isInlined",
  34012. protocol: 'testing',
  34013. fn: function (){
  34014. var self=this;
  34015. return $core.withContext(function($ctx1) {
  34016. var $3,$2,$1;
  34017. $3=self._instruction();
  34018. $ctx1.sendIdx["instruction"]=1;
  34019. $2=$recv($3)._notNil();
  34020. $1=$recv($2)._and_((function(){
  34021. return $core.withContext(function($ctx2) {
  34022. return $recv(self._instruction())._isInlined();
  34023. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34024. }));
  34025. return $1;
  34026. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  34027. },
  34028. args: [],
  34029. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  34030. referencedClasses: [],
  34031. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  34032. }),
  34033. $globals.LexicalScope);
  34034. $core.addMethod(
  34035. $core.method({
  34036. selector: "isMethodScope",
  34037. protocol: 'testing',
  34038. fn: function (){
  34039. var self=this;
  34040. return false;
  34041. },
  34042. args: [],
  34043. source: "isMethodScope\x0a\x09^ false",
  34044. referencedClasses: [],
  34045. messageSends: []
  34046. }),
  34047. $globals.LexicalScope);
  34048. $core.addMethod(
  34049. $core.method({
  34050. selector: "lookupVariable:",
  34051. protocol: 'accessing',
  34052. fn: function (aNode){
  34053. var self=this;
  34054. var lookup;
  34055. return $core.withContext(function($ctx1) {
  34056. var $1,$2,$3,$receiver;
  34057. lookup=self._bindingFor_(aNode);
  34058. $1=lookup;
  34059. if(($receiver = $1) == null || $receiver.isNil){
  34060. $2=self._outerScope();
  34061. $ctx1.sendIdx["outerScope"]=1;
  34062. if(($receiver = $2) == null || $receiver.isNil){
  34063. lookup=$2;
  34064. } else {
  34065. lookup=$recv(self._outerScope())._lookupVariable_(aNode);
  34066. };
  34067. lookup;
  34068. } else {
  34069. $1;
  34070. };
  34071. $3=lookup;
  34072. return $3;
  34073. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  34074. },
  34075. args: ["aNode"],
  34076. 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",
  34077. referencedClasses: [],
  34078. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  34079. }),
  34080. $globals.LexicalScope);
  34081. $core.addMethod(
  34082. $core.method({
  34083. selector: "methodScope",
  34084. protocol: 'accessing',
  34085. fn: function (){
  34086. var self=this;
  34087. return $core.withContext(function($ctx1) {
  34088. var $2,$1,$receiver;
  34089. $2=self._outerScope();
  34090. $ctx1.sendIdx["outerScope"]=1;
  34091. if(($receiver = $2) == null || $receiver.isNil){
  34092. $1=$2;
  34093. } else {
  34094. $1=$recv(self._outerScope())._methodScope();
  34095. };
  34096. return $1;
  34097. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  34098. },
  34099. args: [],
  34100. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  34101. referencedClasses: [],
  34102. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  34103. }),
  34104. $globals.LexicalScope);
  34105. $core.addMethod(
  34106. $core.method({
  34107. selector: "node",
  34108. protocol: 'accessing',
  34109. fn: function (){
  34110. var self=this;
  34111. var $1;
  34112. $1=self["@node"];
  34113. return $1;
  34114. },
  34115. args: [],
  34116. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  34117. referencedClasses: [],
  34118. messageSends: []
  34119. }),
  34120. $globals.LexicalScope);
  34121. $core.addMethod(
  34122. $core.method({
  34123. selector: "node:",
  34124. protocol: 'accessing',
  34125. fn: function (aNode){
  34126. var self=this;
  34127. self["@node"]=aNode;
  34128. return self;
  34129. },
  34130. args: ["aNode"],
  34131. source: "node: aNode\x0a\x09node := aNode",
  34132. referencedClasses: [],
  34133. messageSends: []
  34134. }),
  34135. $globals.LexicalScope);
  34136. $core.addMethod(
  34137. $core.method({
  34138. selector: "outerScope",
  34139. protocol: 'accessing',
  34140. fn: function (){
  34141. var self=this;
  34142. var $1;
  34143. $1=self["@outerScope"];
  34144. return $1;
  34145. },
  34146. args: [],
  34147. source: "outerScope\x0a\x09^ outerScope",
  34148. referencedClasses: [],
  34149. messageSends: []
  34150. }),
  34151. $globals.LexicalScope);
  34152. $core.addMethod(
  34153. $core.method({
  34154. selector: "outerScope:",
  34155. protocol: 'accessing',
  34156. fn: function (aLexicalScope){
  34157. var self=this;
  34158. self["@outerScope"]=aLexicalScope;
  34159. return self;
  34160. },
  34161. args: ["aLexicalScope"],
  34162. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  34163. referencedClasses: [],
  34164. messageSends: []
  34165. }),
  34166. $globals.LexicalScope);
  34167. $core.addMethod(
  34168. $core.method({
  34169. selector: "pseudoVars",
  34170. protocol: 'accessing',
  34171. fn: function (){
  34172. var self=this;
  34173. return $core.withContext(function($ctx1) {
  34174. var $1;
  34175. $1=$recv(self._methodScope())._pseudoVars();
  34176. return $1;
  34177. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  34178. },
  34179. args: [],
  34180. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  34181. referencedClasses: [],
  34182. messageSends: ["pseudoVars", "methodScope"]
  34183. }),
  34184. $globals.LexicalScope);
  34185. $core.addMethod(
  34186. $core.method({
  34187. selector: "scopeLevel",
  34188. protocol: 'accessing',
  34189. fn: function (){
  34190. var self=this;
  34191. return $core.withContext(function($ctx1) {
  34192. var $1,$2,$4,$3,$5,$receiver;
  34193. $1=self._outerScope();
  34194. $ctx1.sendIdx["outerScope"]=1;
  34195. if(($receiver = $1) == null || $receiver.isNil){
  34196. return (1);
  34197. } else {
  34198. $1;
  34199. };
  34200. $2=self._isInlined();
  34201. if($core.assert($2)){
  34202. $4=self._outerScope();
  34203. $ctx1.sendIdx["outerScope"]=2;
  34204. $3=$recv($4)._scopeLevel();
  34205. $ctx1.sendIdx["scopeLevel"]=1;
  34206. return $3;
  34207. };
  34208. $5=$recv($recv(self._outerScope())._scopeLevel()).__plus((1));
  34209. return $5;
  34210. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  34211. },
  34212. args: [],
  34213. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  34214. referencedClasses: [],
  34215. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  34216. }),
  34217. $globals.LexicalScope);
  34218. $core.addMethod(
  34219. $core.method({
  34220. selector: "temps",
  34221. protocol: 'accessing',
  34222. fn: function (){
  34223. var self=this;
  34224. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  34225. return $core.withContext(function($ctx1) {
  34226. var $2,$1,$receiver;
  34227. $2=self["@temps"];
  34228. if(($receiver = $2) == null || $receiver.isNil){
  34229. self["@temps"]=$recv($Dictionary())._new();
  34230. $1=self["@temps"];
  34231. } else {
  34232. $1=$2;
  34233. };
  34234. return $1;
  34235. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  34236. },
  34237. args: [],
  34238. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  34239. referencedClasses: ["Dictionary"],
  34240. messageSends: ["ifNil:", "new"]
  34241. }),
  34242. $globals.LexicalScope);
  34243. $core.addClass('MethodLexicalScope', $globals.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
  34244. $globals.MethodLexicalScope.comment="I represent a method scope.";
  34245. $core.addMethod(
  34246. $core.method({
  34247. selector: "addIVar:",
  34248. protocol: 'adding',
  34249. fn: function (aString){
  34250. var self=this;
  34251. function $InstanceVar(){return $globals.InstanceVar||(typeof InstanceVar=="undefined"?nil:InstanceVar)}
  34252. return $core.withContext(function($ctx1) {
  34253. var $1;
  34254. $1=self._iVars();
  34255. $ctx1.sendIdx["iVars"]=1;
  34256. $recv($1)._at_put_(aString,$recv($InstanceVar())._on_(aString));
  34257. $recv($recv(self._iVars())._at_(aString))._scope_(self);
  34258. return self;
  34259. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  34260. },
  34261. args: ["aString"],
  34262. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  34263. referencedClasses: ["InstanceVar"],
  34264. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  34265. }),
  34266. $globals.MethodLexicalScope);
  34267. $core.addMethod(
  34268. $core.method({
  34269. selector: "addNonLocalReturn:",
  34270. protocol: 'adding',
  34271. fn: function (aScope){
  34272. var self=this;
  34273. return $core.withContext(function($ctx1) {
  34274. $recv(self._nonLocalReturns())._add_(aScope);
  34275. return self;
  34276. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  34277. },
  34278. args: ["aScope"],
  34279. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  34280. referencedClasses: [],
  34281. messageSends: ["add:", "nonLocalReturns"]
  34282. }),
  34283. $globals.MethodLexicalScope);
  34284. $core.addMethod(
  34285. $core.method({
  34286. selector: "allVariableNames",
  34287. protocol: 'accessing',
  34288. fn: function (){
  34289. var self=this;
  34290. return $core.withContext(function($ctx1) {
  34291. var $2,$1;
  34292. $2=(
  34293. $ctx1.supercall = true,
  34294. $globals.MethodLexicalScope.superclass.fn.prototype._allVariableNames.apply($recv(self), []));
  34295. $ctx1.supercall = false;
  34296. $1=$recv($2).__comma($recv(self._iVars())._keys());
  34297. return $1;
  34298. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  34299. },
  34300. args: [],
  34301. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  34302. referencedClasses: [],
  34303. messageSends: [",", "allVariableNames", "keys", "iVars"]
  34304. }),
  34305. $globals.MethodLexicalScope);
  34306. $core.addMethod(
  34307. $core.method({
  34308. selector: "bindingFor:",
  34309. protocol: 'accessing',
  34310. fn: function (aNode){
  34311. var self=this;
  34312. return $core.withContext(function($ctx1) {
  34313. var $2,$1,$receiver;
  34314. $2=(
  34315. $ctx1.supercall = true,
  34316. $globals.MethodLexicalScope.superclass.fn.prototype._bindingFor_.apply($recv(self), [aNode]));
  34317. $ctx1.supercall = false;
  34318. if(($receiver = $2) == null || $receiver.isNil){
  34319. $1=$recv(self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  34320. return nil;
  34321. }));
  34322. } else {
  34323. $1=$2;
  34324. };
  34325. return $1;
  34326. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  34327. },
  34328. args: ["aNode"],
  34329. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  34330. referencedClasses: [],
  34331. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  34332. }),
  34333. $globals.MethodLexicalScope);
  34334. $core.addMethod(
  34335. $core.method({
  34336. selector: "canInlineNonLocalReturns",
  34337. protocol: 'testing',
  34338. fn: function (){
  34339. var self=this;
  34340. return true;
  34341. },
  34342. args: [],
  34343. source: "canInlineNonLocalReturns\x0a\x09^ true",
  34344. referencedClasses: [],
  34345. messageSends: []
  34346. }),
  34347. $globals.MethodLexicalScope);
  34348. $core.addMethod(
  34349. $core.method({
  34350. selector: "hasLocalReturn",
  34351. protocol: 'testing',
  34352. fn: function (){
  34353. var self=this;
  34354. return $core.withContext(function($ctx1) {
  34355. var $1;
  34356. $1=self._localReturn();
  34357. return $1;
  34358. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  34359. },
  34360. args: [],
  34361. source: "hasLocalReturn\x0a\x09^ self localReturn",
  34362. referencedClasses: [],
  34363. messageSends: ["localReturn"]
  34364. }),
  34365. $globals.MethodLexicalScope);
  34366. $core.addMethod(
  34367. $core.method({
  34368. selector: "hasNonLocalReturn",
  34369. protocol: 'testing',
  34370. fn: function (){
  34371. var self=this;
  34372. return $core.withContext(function($ctx1) {
  34373. var $1;
  34374. $1=$recv(self._nonLocalReturns())._notEmpty();
  34375. return $1;
  34376. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  34377. },
  34378. args: [],
  34379. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  34380. referencedClasses: [],
  34381. messageSends: ["notEmpty", "nonLocalReturns"]
  34382. }),
  34383. $globals.MethodLexicalScope);
  34384. $core.addMethod(
  34385. $core.method({
  34386. selector: "iVars",
  34387. protocol: 'accessing',
  34388. fn: function (){
  34389. var self=this;
  34390. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  34391. return $core.withContext(function($ctx1) {
  34392. var $2,$1,$receiver;
  34393. $2=self["@iVars"];
  34394. if(($receiver = $2) == null || $receiver.isNil){
  34395. self["@iVars"]=$recv($Dictionary())._new();
  34396. $1=self["@iVars"];
  34397. } else {
  34398. $1=$2;
  34399. };
  34400. return $1;
  34401. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  34402. },
  34403. args: [],
  34404. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  34405. referencedClasses: ["Dictionary"],
  34406. messageSends: ["ifNil:", "new"]
  34407. }),
  34408. $globals.MethodLexicalScope);
  34409. $core.addMethod(
  34410. $core.method({
  34411. selector: "isMethodScope",
  34412. protocol: 'testing',
  34413. fn: function (){
  34414. var self=this;
  34415. return true;
  34416. },
  34417. args: [],
  34418. source: "isMethodScope\x0a\x09^ true",
  34419. referencedClasses: [],
  34420. messageSends: []
  34421. }),
  34422. $globals.MethodLexicalScope);
  34423. $core.addMethod(
  34424. $core.method({
  34425. selector: "localReturn",
  34426. protocol: 'accessing',
  34427. fn: function (){
  34428. var self=this;
  34429. return $core.withContext(function($ctx1) {
  34430. var $2,$1,$receiver;
  34431. $2=self["@localReturn"];
  34432. if(($receiver = $2) == null || $receiver.isNil){
  34433. $1=false;
  34434. } else {
  34435. $1=$2;
  34436. };
  34437. return $1;
  34438. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  34439. },
  34440. args: [],
  34441. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  34442. referencedClasses: [],
  34443. messageSends: ["ifNil:"]
  34444. }),
  34445. $globals.MethodLexicalScope);
  34446. $core.addMethod(
  34447. $core.method({
  34448. selector: "localReturn:",
  34449. protocol: 'accessing',
  34450. fn: function (aBoolean){
  34451. var self=this;
  34452. self["@localReturn"]=aBoolean;
  34453. return self;
  34454. },
  34455. args: ["aBoolean"],
  34456. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  34457. referencedClasses: [],
  34458. messageSends: []
  34459. }),
  34460. $globals.MethodLexicalScope);
  34461. $core.addMethod(
  34462. $core.method({
  34463. selector: "methodScope",
  34464. protocol: 'accessing',
  34465. fn: function (){
  34466. var self=this;
  34467. return self;
  34468. },
  34469. args: [],
  34470. source: "methodScope\x0a\x09^ self",
  34471. referencedClasses: [],
  34472. messageSends: []
  34473. }),
  34474. $globals.MethodLexicalScope);
  34475. $core.addMethod(
  34476. $core.method({
  34477. selector: "nonLocalReturns",
  34478. protocol: 'accessing',
  34479. fn: function (){
  34480. var self=this;
  34481. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  34482. return $core.withContext(function($ctx1) {
  34483. var $2,$1,$receiver;
  34484. $2=self["@nonLocalReturns"];
  34485. if(($receiver = $2) == null || $receiver.isNil){
  34486. self["@nonLocalReturns"]=$recv($OrderedCollection())._new();
  34487. $1=self["@nonLocalReturns"];
  34488. } else {
  34489. $1=$2;
  34490. };
  34491. return $1;
  34492. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  34493. },
  34494. args: [],
  34495. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  34496. referencedClasses: ["OrderedCollection"],
  34497. messageSends: ["ifNil:", "new"]
  34498. }),
  34499. $globals.MethodLexicalScope);
  34500. $core.addMethod(
  34501. $core.method({
  34502. selector: "pseudoVars",
  34503. protocol: 'accessing',
  34504. fn: function (){
  34505. var self=this;
  34506. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  34507. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  34508. function $PseudoVar(){return $globals.PseudoVar||(typeof PseudoVar=="undefined"?nil:PseudoVar)}
  34509. return $core.withContext(function($ctx1) {
  34510. var $1,$2,$3,$4,$receiver;
  34511. $1=self["@pseudoVars"];
  34512. if(($receiver = $1) == null || $receiver.isNil){
  34513. self["@pseudoVars"]=$recv($Dictionary())._new();
  34514. self["@pseudoVars"];
  34515. $recv($recv($Smalltalk())._pseudoVariableNames())._do_((function(each){
  34516. return $core.withContext(function($ctx2) {
  34517. $2=$recv($PseudoVar())._on_(each);
  34518. $recv($2)._scope_(self._methodScope());
  34519. $3=$recv($2)._yourself();
  34520. return $recv(self["@pseudoVars"])._at_put_(each,$3);
  34521. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  34522. }));
  34523. } else {
  34524. $1;
  34525. };
  34526. $4=self["@pseudoVars"];
  34527. return $4;
  34528. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  34529. },
  34530. args: [],
  34531. 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",
  34532. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  34533. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  34534. }),
  34535. $globals.MethodLexicalScope);
  34536. $core.addMethod(
  34537. $core.method({
  34538. selector: "removeNonLocalReturn:",
  34539. protocol: 'adding',
  34540. fn: function (aScope){
  34541. var self=this;
  34542. return $core.withContext(function($ctx1) {
  34543. $recv(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  34544. }));
  34545. return self;
  34546. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  34547. },
  34548. args: ["aScope"],
  34549. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  34550. referencedClasses: [],
  34551. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  34552. }),
  34553. $globals.MethodLexicalScope);
  34554. $core.addMethod(
  34555. $core.method({
  34556. selector: "unknownVariables",
  34557. protocol: 'accessing',
  34558. fn: function (){
  34559. var self=this;
  34560. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  34561. return $core.withContext(function($ctx1) {
  34562. var $2,$1,$receiver;
  34563. $2=self["@unknownVariables"];
  34564. if(($receiver = $2) == null || $receiver.isNil){
  34565. self["@unknownVariables"]=$recv($OrderedCollection())._new();
  34566. $1=self["@unknownVariables"];
  34567. } else {
  34568. $1=$2;
  34569. };
  34570. return $1;
  34571. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  34572. },
  34573. args: [],
  34574. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  34575. referencedClasses: ["OrderedCollection"],
  34576. messageSends: ["ifNil:", "new"]
  34577. }),
  34578. $globals.MethodLexicalScope);
  34579. $core.addClass('ScopeVar', $globals.Object, ['scope', 'name'], 'Compiler-Semantic');
  34580. $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.";
  34581. $core.addMethod(
  34582. $core.method({
  34583. selector: "alias",
  34584. protocol: 'accessing',
  34585. fn: function (){
  34586. var self=this;
  34587. return $core.withContext(function($ctx1) {
  34588. var $1;
  34589. $1=$recv(self._name())._asVariableName();
  34590. return $1;
  34591. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  34592. },
  34593. args: [],
  34594. source: "alias\x0a\x09^ self name asVariableName",
  34595. referencedClasses: [],
  34596. messageSends: ["asVariableName", "name"]
  34597. }),
  34598. $globals.ScopeVar);
  34599. $core.addMethod(
  34600. $core.method({
  34601. selector: "isArgVar",
  34602. protocol: 'testing',
  34603. fn: function (){
  34604. var self=this;
  34605. return false;
  34606. },
  34607. args: [],
  34608. source: "isArgVar\x0a\x09^ false",
  34609. referencedClasses: [],
  34610. messageSends: []
  34611. }),
  34612. $globals.ScopeVar);
  34613. $core.addMethod(
  34614. $core.method({
  34615. selector: "isClassRefVar",
  34616. protocol: 'testing',
  34617. fn: function (){
  34618. var self=this;
  34619. return false;
  34620. },
  34621. args: [],
  34622. source: "isClassRefVar\x0a\x09^ false",
  34623. referencedClasses: [],
  34624. messageSends: []
  34625. }),
  34626. $globals.ScopeVar);
  34627. $core.addMethod(
  34628. $core.method({
  34629. selector: "isImmutable",
  34630. protocol: 'testing',
  34631. fn: function (){
  34632. var self=this;
  34633. return false;
  34634. },
  34635. args: [],
  34636. source: "isImmutable\x0a\x09^ false",
  34637. referencedClasses: [],
  34638. messageSends: []
  34639. }),
  34640. $globals.ScopeVar);
  34641. $core.addMethod(
  34642. $core.method({
  34643. selector: "isInstanceVar",
  34644. protocol: 'testing',
  34645. fn: function (){
  34646. var self=this;
  34647. return false;
  34648. },
  34649. args: [],
  34650. source: "isInstanceVar\x0a\x09^ false",
  34651. referencedClasses: [],
  34652. messageSends: []
  34653. }),
  34654. $globals.ScopeVar);
  34655. $core.addMethod(
  34656. $core.method({
  34657. selector: "isPseudoVar",
  34658. protocol: 'testing',
  34659. fn: function (){
  34660. var self=this;
  34661. return false;
  34662. },
  34663. args: [],
  34664. source: "isPseudoVar\x0a\x09^ false",
  34665. referencedClasses: [],
  34666. messageSends: []
  34667. }),
  34668. $globals.ScopeVar);
  34669. $core.addMethod(
  34670. $core.method({
  34671. selector: "isTempVar",
  34672. protocol: 'testing',
  34673. fn: function (){
  34674. var self=this;
  34675. return false;
  34676. },
  34677. args: [],
  34678. source: "isTempVar\x0a\x09^ false",
  34679. referencedClasses: [],
  34680. messageSends: []
  34681. }),
  34682. $globals.ScopeVar);
  34683. $core.addMethod(
  34684. $core.method({
  34685. selector: "isUnknownVar",
  34686. protocol: 'testing',
  34687. fn: function (){
  34688. var self=this;
  34689. return false;
  34690. },
  34691. args: [],
  34692. source: "isUnknownVar\x0a\x09^ false",
  34693. referencedClasses: [],
  34694. messageSends: []
  34695. }),
  34696. $globals.ScopeVar);
  34697. $core.addMethod(
  34698. $core.method({
  34699. selector: "name",
  34700. protocol: 'accessing',
  34701. fn: function (){
  34702. var self=this;
  34703. var $1;
  34704. $1=self["@name"];
  34705. return $1;
  34706. },
  34707. args: [],
  34708. source: "name\x0a\x09^ name",
  34709. referencedClasses: [],
  34710. messageSends: []
  34711. }),
  34712. $globals.ScopeVar);
  34713. $core.addMethod(
  34714. $core.method({
  34715. selector: "name:",
  34716. protocol: 'accessing',
  34717. fn: function (aString){
  34718. var self=this;
  34719. self["@name"]=aString;
  34720. return self;
  34721. },
  34722. args: ["aString"],
  34723. source: "name: aString\x0a\x09name := aString",
  34724. referencedClasses: [],
  34725. messageSends: []
  34726. }),
  34727. $globals.ScopeVar);
  34728. $core.addMethod(
  34729. $core.method({
  34730. selector: "scope",
  34731. protocol: 'accessing',
  34732. fn: function (){
  34733. var self=this;
  34734. var $1;
  34735. $1=self["@scope"];
  34736. return $1;
  34737. },
  34738. args: [],
  34739. source: "scope\x0a\x09^ scope",
  34740. referencedClasses: [],
  34741. messageSends: []
  34742. }),
  34743. $globals.ScopeVar);
  34744. $core.addMethod(
  34745. $core.method({
  34746. selector: "scope:",
  34747. protocol: 'accessing',
  34748. fn: function (aScope){
  34749. var self=this;
  34750. self["@scope"]=aScope;
  34751. return self;
  34752. },
  34753. args: ["aScope"],
  34754. source: "scope: aScope\x0a\x09scope := aScope",
  34755. referencedClasses: [],
  34756. messageSends: []
  34757. }),
  34758. $globals.ScopeVar);
  34759. $core.addMethod(
  34760. $core.method({
  34761. selector: "validateAssignment",
  34762. protocol: 'testing',
  34763. fn: function (){
  34764. var self=this;
  34765. function $InvalidAssignmentError(){return $globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  34766. return $core.withContext(function($ctx1) {
  34767. var $1,$2,$3;
  34768. $1=$recv(self._isArgVar())._or_((function(){
  34769. return $core.withContext(function($ctx2) {
  34770. return self._isPseudoVar();
  34771. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34772. }));
  34773. if($core.assert($1)){
  34774. $2=$recv($InvalidAssignmentError())._new();
  34775. $recv($2)._variableName_(self._name());
  34776. $3=$recv($2)._signal();
  34777. $3;
  34778. };
  34779. return self;
  34780. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  34781. },
  34782. args: [],
  34783. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  34784. referencedClasses: ["InvalidAssignmentError"],
  34785. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  34786. }),
  34787. $globals.ScopeVar);
  34788. $core.addMethod(
  34789. $core.method({
  34790. selector: "on:",
  34791. protocol: 'instance creation',
  34792. fn: function (aString){
  34793. var self=this;
  34794. return $core.withContext(function($ctx1) {
  34795. var $2,$3,$1;
  34796. $2=self._new();
  34797. $recv($2)._name_(aString);
  34798. $3=$recv($2)._yourself();
  34799. $1=$3;
  34800. return $1;
  34801. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.klass)});
  34802. },
  34803. args: ["aString"],
  34804. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  34805. referencedClasses: [],
  34806. messageSends: ["name:", "new", "yourself"]
  34807. }),
  34808. $globals.ScopeVar.klass);
  34809. $core.addClass('AliasVar', $globals.ScopeVar, ['node'], 'Compiler-Semantic');
  34810. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  34811. $core.addMethod(
  34812. $core.method({
  34813. selector: "node",
  34814. protocol: 'accessing',
  34815. fn: function (){
  34816. var self=this;
  34817. var $1;
  34818. $1=self["@node"];
  34819. return $1;
  34820. },
  34821. args: [],
  34822. source: "node\x0a\x09^ node",
  34823. referencedClasses: [],
  34824. messageSends: []
  34825. }),
  34826. $globals.AliasVar);
  34827. $core.addMethod(
  34828. $core.method({
  34829. selector: "node:",
  34830. protocol: 'accessing',
  34831. fn: function (aNode){
  34832. var self=this;
  34833. self["@node"]=aNode;
  34834. return self;
  34835. },
  34836. args: ["aNode"],
  34837. source: "node: aNode\x0a\x09node := aNode",
  34838. referencedClasses: [],
  34839. messageSends: []
  34840. }),
  34841. $globals.AliasVar);
  34842. $core.addClass('ArgVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34843. $globals.ArgVar.comment="I am an argument of a method or block.";
  34844. $core.addMethod(
  34845. $core.method({
  34846. selector: "isArgVar",
  34847. protocol: 'testing',
  34848. fn: function (){
  34849. var self=this;
  34850. return true;
  34851. },
  34852. args: [],
  34853. source: "isArgVar\x0a\x09^ true",
  34854. referencedClasses: [],
  34855. messageSends: []
  34856. }),
  34857. $globals.ArgVar);
  34858. $core.addMethod(
  34859. $core.method({
  34860. selector: "isImmutable",
  34861. protocol: 'testing',
  34862. fn: function (){
  34863. var self=this;
  34864. return true;
  34865. },
  34866. args: [],
  34867. source: "isImmutable\x0a\x09^ true",
  34868. referencedClasses: [],
  34869. messageSends: []
  34870. }),
  34871. $globals.ArgVar);
  34872. $core.addClass('ClassRefVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34873. $globals.ClassRefVar.comment="I am an class reference variable";
  34874. $core.addMethod(
  34875. $core.method({
  34876. selector: "alias",
  34877. protocol: 'accessing',
  34878. fn: function (){
  34879. var self=this;
  34880. return $core.withContext(function($ctx1) {
  34881. var $1;
  34882. $1=$recv("$".__comma(self._name())).__comma("()");
  34883. $ctx1.sendIdx[","]=1;
  34884. return $1;
  34885. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  34886. },
  34887. args: [],
  34888. 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, '()'",
  34889. referencedClasses: [],
  34890. messageSends: [",", "name"]
  34891. }),
  34892. $globals.ClassRefVar);
  34893. $core.addMethod(
  34894. $core.method({
  34895. selector: "isClassRefVar",
  34896. protocol: 'testing',
  34897. fn: function (){
  34898. var self=this;
  34899. return true;
  34900. },
  34901. args: [],
  34902. source: "isClassRefVar\x0a\x09^ true",
  34903. referencedClasses: [],
  34904. messageSends: []
  34905. }),
  34906. $globals.ClassRefVar);
  34907. $core.addMethod(
  34908. $core.method({
  34909. selector: "isImmutable",
  34910. protocol: 'testing',
  34911. fn: function (){
  34912. var self=this;
  34913. return true;
  34914. },
  34915. args: [],
  34916. source: "isImmutable\x0a\x09^ true",
  34917. referencedClasses: [],
  34918. messageSends: []
  34919. }),
  34920. $globals.ClassRefVar);
  34921. $core.addClass('InstanceVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34922. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  34923. $core.addMethod(
  34924. $core.method({
  34925. selector: "alias",
  34926. protocol: 'testing',
  34927. fn: function (){
  34928. var self=this;
  34929. return $core.withContext(function($ctx1) {
  34930. var $1;
  34931. $1=$recv("self[\x22@".__comma(self._name())).__comma("\x22]");
  34932. $ctx1.sendIdx[","]=1;
  34933. return $1;
  34934. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  34935. },
  34936. args: [],
  34937. source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
  34938. referencedClasses: [],
  34939. messageSends: [",", "name"]
  34940. }),
  34941. $globals.InstanceVar);
  34942. $core.addMethod(
  34943. $core.method({
  34944. selector: "isInstanceVar",
  34945. protocol: 'testing',
  34946. fn: function (){
  34947. var self=this;
  34948. return true;
  34949. },
  34950. args: [],
  34951. source: "isInstanceVar\x0a\x09^ true",
  34952. referencedClasses: [],
  34953. messageSends: []
  34954. }),
  34955. $globals.InstanceVar);
  34956. $core.addClass('PseudoVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34957. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  34958. $core.addMethod(
  34959. $core.method({
  34960. selector: "alias",
  34961. protocol: 'accessing',
  34962. fn: function (){
  34963. var self=this;
  34964. return $core.withContext(function($ctx1) {
  34965. var $1;
  34966. $1=self._name();
  34967. return $1;
  34968. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  34969. },
  34970. args: [],
  34971. source: "alias\x0a\x09^ self name",
  34972. referencedClasses: [],
  34973. messageSends: ["name"]
  34974. }),
  34975. $globals.PseudoVar);
  34976. $core.addMethod(
  34977. $core.method({
  34978. selector: "isImmutable",
  34979. protocol: 'testing',
  34980. fn: function (){
  34981. var self=this;
  34982. return true;
  34983. },
  34984. args: [],
  34985. source: "isImmutable\x0a\x09^ true",
  34986. referencedClasses: [],
  34987. messageSends: []
  34988. }),
  34989. $globals.PseudoVar);
  34990. $core.addMethod(
  34991. $core.method({
  34992. selector: "isPseudoVar",
  34993. protocol: 'testing',
  34994. fn: function (){
  34995. var self=this;
  34996. return true;
  34997. },
  34998. args: [],
  34999. source: "isPseudoVar\x0a\x09^ true",
  35000. referencedClasses: [],
  35001. messageSends: []
  35002. }),
  35003. $globals.PseudoVar);
  35004. $core.addClass('TempVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35005. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  35006. $core.addMethod(
  35007. $core.method({
  35008. selector: "isTempVar",
  35009. protocol: 'testing',
  35010. fn: function (){
  35011. var self=this;
  35012. return true;
  35013. },
  35014. args: [],
  35015. source: "isTempVar\x0a\x09^ true",
  35016. referencedClasses: [],
  35017. messageSends: []
  35018. }),
  35019. $globals.TempVar);
  35020. $core.addClass('UnknownVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35021. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  35022. $core.addMethod(
  35023. $core.method({
  35024. selector: "isUnknownVar",
  35025. protocol: 'testing',
  35026. fn: function (){
  35027. var self=this;
  35028. return true;
  35029. },
  35030. args: [],
  35031. source: "isUnknownVar\x0a\x09^ true",
  35032. referencedClasses: [],
  35033. messageSends: []
  35034. }),
  35035. $globals.UnknownVar);
  35036. $core.addClass('SemanticAnalyzer', $globals.NodeVisitor, ['currentScope', 'blockIndex', 'thePackage', 'theClass', 'classReferences', 'messageSends', 'superSends'], 'Compiler-Semantic');
  35037. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  35038. $core.addMethod(
  35039. $core.method({
  35040. selector: "classReferences",
  35041. protocol: 'accessing',
  35042. fn: function (){
  35043. var self=this;
  35044. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  35045. return $core.withContext(function($ctx1) {
  35046. var $2,$1,$receiver;
  35047. $2=self["@classReferences"];
  35048. if(($receiver = $2) == null || $receiver.isNil){
  35049. self["@classReferences"]=$recv($Set())._new();
  35050. $1=self["@classReferences"];
  35051. } else {
  35052. $1=$2;
  35053. };
  35054. return $1;
  35055. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  35056. },
  35057. args: [],
  35058. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  35059. referencedClasses: ["Set"],
  35060. messageSends: ["ifNil:", "new"]
  35061. }),
  35062. $globals.SemanticAnalyzer);
  35063. $core.addMethod(
  35064. $core.method({
  35065. selector: "errorShadowingVariable:",
  35066. protocol: 'error handling',
  35067. fn: function (aString){
  35068. var self=this;
  35069. function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  35070. return $core.withContext(function($ctx1) {
  35071. var $1,$2;
  35072. $1=$recv($ShadowingVariableError())._new();
  35073. $recv($1)._variableName_(aString);
  35074. $2=$recv($1)._signal();
  35075. return self;
  35076. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  35077. },
  35078. args: ["aString"],
  35079. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  35080. referencedClasses: ["ShadowingVariableError"],
  35081. messageSends: ["variableName:", "new", "signal"]
  35082. }),
  35083. $globals.SemanticAnalyzer);
  35084. $core.addMethod(
  35085. $core.method({
  35086. selector: "errorUnknownVariable:",
  35087. protocol: 'error handling',
  35088. fn: function (aNode){
  35089. var self=this;
  35090. var identifier;
  35091. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  35092. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  35093. return $core.withContext(function($ctx1) {
  35094. var $1,$2,$3,$4,$5;
  35095. identifier=$recv(aNode)._value();
  35096. $ctx1.sendIdx["value"]=1;
  35097. $1=$recv($recv($recv($recv($Smalltalk())._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  35098. return $core.withContext(function($ctx2) {
  35099. return self._isVariableUndefined_inPackage_(identifier,self._thePackage());
  35100. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35101. }));
  35102. if($core.assert($1)){
  35103. $2=$recv($UnknownVariableError())._new();
  35104. $3=$2;
  35105. $4=$recv(aNode)._value();
  35106. $ctx1.sendIdx["value"]=2;
  35107. $recv($3)._variableName_($4);
  35108. $5=$recv($2)._signal();
  35109. $5;
  35110. } else {
  35111. $recv($recv($recv(self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  35112. };
  35113. return self;
  35114. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  35115. },
  35116. args: ["aNode"],
  35117. 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 ]",
  35118. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  35119. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  35120. }),
  35121. $globals.SemanticAnalyzer);
  35122. $core.addMethod(
  35123. $core.method({
  35124. selector: "isVariableUndefined:inPackage:",
  35125. protocol: 'testing',
  35126. fn: function (aString,aPackage){
  35127. var self=this;
  35128. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  35129. return $core.withContext(function($ctx1) {
  35130. var $1,$3,$4,$2,$receiver;
  35131. if(($receiver = aPackage) == null || $receiver.isNil){
  35132. aPackage;
  35133. } else {
  35134. var packageKnownVars;
  35135. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  35136. packageKnownVars;
  35137. $1=$recv(packageKnownVars)._includes_(aString);
  35138. if($core.assert($1)){
  35139. return false;
  35140. };
  35141. };
  35142. $3=$recv($Compiler())._new();
  35143. $4=$recv("typeof ".__comma(aString)).__comma(" == \x22undefined\x22");
  35144. $ctx1.sendIdx[","]=1;
  35145. $2=$recv($3)._eval_($4);
  35146. return $2;
  35147. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  35148. },
  35149. args: ["aString", "aPackage"],
  35150. 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'",
  35151. referencedClasses: ["Compiler"],
  35152. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", "new", ","]
  35153. }),
  35154. $globals.SemanticAnalyzer);
  35155. $core.addMethod(
  35156. $core.method({
  35157. selector: "messageSends",
  35158. protocol: 'accessing',
  35159. fn: function (){
  35160. var self=this;
  35161. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  35162. return $core.withContext(function($ctx1) {
  35163. var $2,$1,$receiver;
  35164. $2=self["@messageSends"];
  35165. if(($receiver = $2) == null || $receiver.isNil){
  35166. self["@messageSends"]=$recv($Dictionary())._new();
  35167. $1=self["@messageSends"];
  35168. } else {
  35169. $1=$2;
  35170. };
  35171. return $1;
  35172. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  35173. },
  35174. args: [],
  35175. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  35176. referencedClasses: ["Dictionary"],
  35177. messageSends: ["ifNil:", "new"]
  35178. }),
  35179. $globals.SemanticAnalyzer);
  35180. $core.addMethod(
  35181. $core.method({
  35182. selector: "newBlockScope",
  35183. protocol: 'factory',
  35184. fn: function (){
  35185. var self=this;
  35186. function $LexicalScope(){return $globals.LexicalScope||(typeof LexicalScope=="undefined"?nil:LexicalScope)}
  35187. return $core.withContext(function($ctx1) {
  35188. var $1;
  35189. $1=self._newScopeOfClass_($LexicalScope());
  35190. return $1;
  35191. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  35192. },
  35193. args: [],
  35194. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  35195. referencedClasses: ["LexicalScope"],
  35196. messageSends: ["newScopeOfClass:"]
  35197. }),
  35198. $globals.SemanticAnalyzer);
  35199. $core.addMethod(
  35200. $core.method({
  35201. selector: "newMethodScope",
  35202. protocol: 'factory',
  35203. fn: function (){
  35204. var self=this;
  35205. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  35206. return $core.withContext(function($ctx1) {
  35207. var $1;
  35208. $1=self._newScopeOfClass_($MethodLexicalScope());
  35209. return $1;
  35210. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  35211. },
  35212. args: [],
  35213. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  35214. referencedClasses: ["MethodLexicalScope"],
  35215. messageSends: ["newScopeOfClass:"]
  35216. }),
  35217. $globals.SemanticAnalyzer);
  35218. $core.addMethod(
  35219. $core.method({
  35220. selector: "newScopeOfClass:",
  35221. protocol: 'factory',
  35222. fn: function (aLexicalScopeClass){
  35223. var self=this;
  35224. return $core.withContext(function($ctx1) {
  35225. var $2,$3,$1;
  35226. $2=$recv(aLexicalScopeClass)._new();
  35227. $recv($2)._outerScope_(self["@currentScope"]);
  35228. $3=$recv($2)._yourself();
  35229. $1=$3;
  35230. return $1;
  35231. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  35232. },
  35233. args: ["aLexicalScopeClass"],
  35234. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  35235. referencedClasses: [],
  35236. messageSends: ["outerScope:", "new", "yourself"]
  35237. }),
  35238. $globals.SemanticAnalyzer);
  35239. $core.addMethod(
  35240. $core.method({
  35241. selector: "nextBlockIndex",
  35242. protocol: 'private',
  35243. fn: function (){
  35244. var self=this;
  35245. return $core.withContext(function($ctx1) {
  35246. var $1,$2,$receiver;
  35247. $1=self["@blockIndex"];
  35248. if(($receiver = $1) == null || $receiver.isNil){
  35249. self["@blockIndex"]=(0);
  35250. self["@blockIndex"];
  35251. } else {
  35252. $1;
  35253. };
  35254. self["@blockIndex"]=$recv(self["@blockIndex"]).__plus((1));
  35255. $2=self["@blockIndex"];
  35256. return $2;
  35257. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  35258. },
  35259. args: [],
  35260. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  35261. referencedClasses: [],
  35262. messageSends: ["ifNil:", "+"]
  35263. }),
  35264. $globals.SemanticAnalyzer);
  35265. $core.addMethod(
  35266. $core.method({
  35267. selector: "popScope",
  35268. protocol: 'scope',
  35269. fn: function (){
  35270. var self=this;
  35271. return $core.withContext(function($ctx1) {
  35272. var $1,$receiver;
  35273. $1=self["@currentScope"];
  35274. if(($receiver = $1) == null || $receiver.isNil){
  35275. $1;
  35276. } else {
  35277. self["@currentScope"]=$recv(self["@currentScope"])._outerScope();
  35278. self["@currentScope"];
  35279. };
  35280. return self;
  35281. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  35282. },
  35283. args: [],
  35284. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  35285. referencedClasses: [],
  35286. messageSends: ["ifNotNil:", "outerScope"]
  35287. }),
  35288. $globals.SemanticAnalyzer);
  35289. $core.addMethod(
  35290. $core.method({
  35291. selector: "pushScope:",
  35292. protocol: 'scope',
  35293. fn: function (aScope){
  35294. var self=this;
  35295. return $core.withContext(function($ctx1) {
  35296. $recv(aScope)._outerScope_(self["@currentScope"]);
  35297. self["@currentScope"]=aScope;
  35298. return self;
  35299. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  35300. },
  35301. args: ["aScope"],
  35302. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  35303. referencedClasses: [],
  35304. messageSends: ["outerScope:"]
  35305. }),
  35306. $globals.SemanticAnalyzer);
  35307. $core.addMethod(
  35308. $core.method({
  35309. selector: "superSends",
  35310. protocol: 'accessing',
  35311. fn: function (){
  35312. var self=this;
  35313. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  35314. return $core.withContext(function($ctx1) {
  35315. var $2,$1,$receiver;
  35316. $2=self["@superSends"];
  35317. if(($receiver = $2) == null || $receiver.isNil){
  35318. self["@superSends"]=$recv($Dictionary())._new();
  35319. $1=self["@superSends"];
  35320. } else {
  35321. $1=$2;
  35322. };
  35323. return $1;
  35324. }, function($ctx1) {$ctx1.fill(self,"superSends",{},$globals.SemanticAnalyzer)});
  35325. },
  35326. args: [],
  35327. source: "superSends\x0a\x09^ superSends ifNil: [ superSends := Dictionary new ]",
  35328. referencedClasses: ["Dictionary"],
  35329. messageSends: ["ifNil:", "new"]
  35330. }),
  35331. $globals.SemanticAnalyzer);
  35332. $core.addMethod(
  35333. $core.method({
  35334. selector: "theClass",
  35335. protocol: 'accessing',
  35336. fn: function (){
  35337. var self=this;
  35338. var $1;
  35339. $1=self["@theClass"];
  35340. return $1;
  35341. },
  35342. args: [],
  35343. source: "theClass\x0a\x09^ theClass",
  35344. referencedClasses: [],
  35345. messageSends: []
  35346. }),
  35347. $globals.SemanticAnalyzer);
  35348. $core.addMethod(
  35349. $core.method({
  35350. selector: "theClass:",
  35351. protocol: 'accessing',
  35352. fn: function (aClass){
  35353. var self=this;
  35354. self["@theClass"]=aClass;
  35355. return self;
  35356. },
  35357. args: ["aClass"],
  35358. source: "theClass: aClass\x0a\x09theClass := aClass",
  35359. referencedClasses: [],
  35360. messageSends: []
  35361. }),
  35362. $globals.SemanticAnalyzer);
  35363. $core.addMethod(
  35364. $core.method({
  35365. selector: "thePackage",
  35366. protocol: 'accessing',
  35367. fn: function (){
  35368. var self=this;
  35369. var $1;
  35370. $1=self["@thePackage"];
  35371. return $1;
  35372. },
  35373. args: [],
  35374. source: "thePackage\x0a\x09^ thePackage",
  35375. referencedClasses: [],
  35376. messageSends: []
  35377. }),
  35378. $globals.SemanticAnalyzer);
  35379. $core.addMethod(
  35380. $core.method({
  35381. selector: "thePackage:",
  35382. protocol: 'accessing',
  35383. fn: function (aPackage){
  35384. var self=this;
  35385. self["@thePackage"]=aPackage;
  35386. return self;
  35387. },
  35388. args: ["aPackage"],
  35389. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  35390. referencedClasses: [],
  35391. messageSends: []
  35392. }),
  35393. $globals.SemanticAnalyzer);
  35394. $core.addMethod(
  35395. $core.method({
  35396. selector: "validateVariableScope:",
  35397. protocol: 'scope',
  35398. fn: function (aString){
  35399. var self=this;
  35400. return $core.withContext(function($ctx1) {
  35401. var $1,$receiver;
  35402. $1=$recv(self["@currentScope"])._lookupVariable_(aString);
  35403. if(($receiver = $1) == null || $receiver.isNil){
  35404. $1;
  35405. } else {
  35406. self._errorShadowingVariable_(aString);
  35407. };
  35408. return self;
  35409. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  35410. },
  35411. args: ["aString"],
  35412. 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 ]",
  35413. referencedClasses: [],
  35414. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  35415. }),
  35416. $globals.SemanticAnalyzer);
  35417. $core.addMethod(
  35418. $core.method({
  35419. selector: "visitAssignmentNode:",
  35420. protocol: 'visiting',
  35421. fn: function (aNode){
  35422. var self=this;
  35423. return $core.withContext(function($ctx1) {
  35424. (
  35425. $ctx1.supercall = true,
  35426. $globals.SemanticAnalyzer.superclass.fn.prototype._visitAssignmentNode_.apply($recv(self), [aNode]));
  35427. $ctx1.supercall = false;
  35428. $recv($recv(aNode)._left())._beAssigned();
  35429. return self;
  35430. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35431. },
  35432. args: ["aNode"],
  35433. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  35434. referencedClasses: [],
  35435. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  35436. }),
  35437. $globals.SemanticAnalyzer);
  35438. $core.addMethod(
  35439. $core.method({
  35440. selector: "visitBlockNode:",
  35441. protocol: 'visiting',
  35442. fn: function (aNode){
  35443. var self=this;
  35444. return $core.withContext(function($ctx1) {
  35445. self._pushScope_(self._newBlockScope());
  35446. $recv(aNode)._scope_(self["@currentScope"]);
  35447. $recv(self["@currentScope"])._node_(aNode);
  35448. $recv(self["@currentScope"])._blockIndex_(self._nextBlockIndex());
  35449. $recv($recv(aNode)._parameters())._do_((function(each){
  35450. return $core.withContext(function($ctx2) {
  35451. self._validateVariableScope_(each);
  35452. return $recv(self["@currentScope"])._addArg_(each);
  35453. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35454. }));
  35455. (
  35456. $ctx1.supercall = true,
  35457. $globals.SemanticAnalyzer.superclass.fn.prototype._visitBlockNode_.apply($recv(self), [aNode]));
  35458. $ctx1.supercall = false;
  35459. self._popScope();
  35460. return self;
  35461. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35462. },
  35463. args: ["aNode"],
  35464. 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",
  35465. referencedClasses: [],
  35466. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  35467. }),
  35468. $globals.SemanticAnalyzer);
  35469. $core.addMethod(
  35470. $core.method({
  35471. selector: "visitCascadeNode:",
  35472. protocol: 'visiting',
  35473. fn: function (aNode){
  35474. var self=this;
  35475. return $core.withContext(function($ctx1) {
  35476. var $3,$2,$1;
  35477. (
  35478. $ctx1.supercall = true,
  35479. $globals.SemanticAnalyzer.superclass.fn.prototype._visitCascadeNode_.apply($recv(self), [aNode]));
  35480. $ctx1.supercall = false;
  35481. $3=$recv(aNode)._nodes();
  35482. $ctx1.sendIdx["nodes"]=1;
  35483. $2=$recv($3)._first();
  35484. $1=$recv($2)._superSend();
  35485. if($core.assert($1)){
  35486. $recv($recv(aNode)._nodes())._do_((function(each){
  35487. return $core.withContext(function($ctx2) {
  35488. return $recv(each)._superSend_(true);
  35489. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35490. }));
  35491. };
  35492. return self;
  35493. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35494. },
  35495. args: ["aNode"],
  35496. source: "visitCascadeNode: aNode\x0a\x09super visitCascadeNode: aNode.\x0a\x09aNode nodes first superSend ifTrue: [\x0a\x09\x09aNode nodes do: [ :each | each superSend: true ] ]",
  35497. referencedClasses: [],
  35498. messageSends: ["visitCascadeNode:", "ifTrue:", "superSend", "first", "nodes", "do:", "superSend:"]
  35499. }),
  35500. $globals.SemanticAnalyzer);
  35501. $core.addMethod(
  35502. $core.method({
  35503. selector: "visitMethodNode:",
  35504. protocol: 'visiting',
  35505. fn: function (aNode){
  35506. var self=this;
  35507. return $core.withContext(function($ctx1) {
  35508. var $1;
  35509. self._pushScope_(self._newMethodScope());
  35510. $recv(aNode)._scope_(self["@currentScope"]);
  35511. $recv(self["@currentScope"])._node_(aNode);
  35512. $recv($recv(self._theClass())._allInstanceVariableNames())._do_((function(each){
  35513. return $core.withContext(function($ctx2) {
  35514. return $recv(self["@currentScope"])._addIVar_(each);
  35515. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35516. }));
  35517. $ctx1.sendIdx["do:"]=1;
  35518. $recv($recv(aNode)._arguments())._do_((function(each){
  35519. return $core.withContext(function($ctx2) {
  35520. self._validateVariableScope_(each);
  35521. return $recv(self["@currentScope"])._addArg_(each);
  35522. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35523. }));
  35524. (
  35525. $ctx1.supercall = true,
  35526. $globals.SemanticAnalyzer.superclass.fn.prototype._visitMethodNode_.apply($recv(self), [aNode]));
  35527. $ctx1.supercall = false;
  35528. $recv(aNode)._classReferences_(self._classReferences());
  35529. $recv(aNode)._sendIndexes_(self._messageSends());
  35530. $1=$recv(aNode)._superSends_($recv(self._superSends())._keys());
  35531. self._popScope();
  35532. return self;
  35533. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35534. },
  35535. args: ["aNode"],
  35536. source: "visitMethodNode: aNode\x0a\x09self pushScope: self newMethodScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x0a\x09self theClass allInstanceVariableNames do: [ :each |\x0a\x09\x09currentScope addIVar: each ].\x0a\x09aNode arguments do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitMethodNode: aNode.\x0a\x0a\x09aNode\x0a\x09\x09classReferences: self classReferences;\x0a\x09\x09sendIndexes: self messageSends;\x0a\x09\x09superSends: self superSends keys.\x0a\x09self popScope",
  35537. referencedClasses: [],
  35538. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "superSends:", "keys", "superSends", "popScope"]
  35539. }),
  35540. $globals.SemanticAnalyzer);
  35541. $core.addMethod(
  35542. $core.method({
  35543. selector: "visitReturnNode:",
  35544. protocol: 'visiting',
  35545. fn: function (aNode){
  35546. var self=this;
  35547. return $core.withContext(function($ctx1) {
  35548. var $1;
  35549. $recv(aNode)._scope_(self["@currentScope"]);
  35550. $1=$recv(self["@currentScope"])._isMethodScope();
  35551. if($core.assert($1)){
  35552. $recv(self["@currentScope"])._localReturn_(true);
  35553. } else {
  35554. $recv($recv(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  35555. };
  35556. (
  35557. $ctx1.supercall = true,
  35558. $globals.SemanticAnalyzer.superclass.fn.prototype._visitReturnNode_.apply($recv(self), [aNode]));
  35559. $ctx1.supercall = false;
  35560. return self;
  35561. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35562. },
  35563. args: ["aNode"],
  35564. 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",
  35565. referencedClasses: [],
  35566. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  35567. }),
  35568. $globals.SemanticAnalyzer);
  35569. $core.addMethod(
  35570. $core.method({
  35571. selector: "visitSendNode:",
  35572. protocol: 'visiting',
  35573. fn: function (aNode){
  35574. var self=this;
  35575. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  35576. function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  35577. return $core.withContext(function($ctx1) {
  35578. var $3,$2,$1,$4,$5,$6,$8,$9,$7,$11,$12,$10,$13,$14,$15,$17,$18,$16,$receiver;
  35579. $3=$recv(aNode)._receiver();
  35580. $ctx1.sendIdx["receiver"]=1;
  35581. $2=$recv($3)._value();
  35582. $1=$recv($2).__eq("super");
  35583. if($core.assert($1)){
  35584. $recv(aNode)._superSend_(true);
  35585. $4=$recv(aNode)._receiver();
  35586. $ctx1.sendIdx["receiver"]=2;
  35587. $recv($4)._value_("self");
  35588. $5=self._superSends();
  35589. $ctx1.sendIdx["superSends"]=1;
  35590. $6=$recv(aNode)._selector();
  35591. $ctx1.sendIdx["selector"]=1;
  35592. $recv($5)._at_ifAbsentPut_($6,(function(){
  35593. return $core.withContext(function($ctx2) {
  35594. return $recv($Set())._new();
  35595. $ctx2.sendIdx["new"]=1;
  35596. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  35597. }));
  35598. $ctx1.sendIdx["at:ifAbsentPut:"]=1;
  35599. $8=self._superSends();
  35600. $9=$recv(aNode)._selector();
  35601. $ctx1.sendIdx["selector"]=2;
  35602. $7=$recv($8)._at_($9);
  35603. $ctx1.sendIdx["at:"]=1;
  35604. $recv($7)._add_(aNode);
  35605. $ctx1.sendIdx["add:"]=1;
  35606. } else {
  35607. $11=$recv($IRSendInliner())._inlinedSelectors();
  35608. $12=$recv(aNode)._selector();
  35609. $ctx1.sendIdx["selector"]=3;
  35610. $10=$recv($11)._includes_($12);
  35611. if($core.assert($10)){
  35612. $recv(aNode)._shouldBeInlined_(true);
  35613. $13=$recv(aNode)._receiver();
  35614. if(($receiver = $13) == null || $receiver.isNil){
  35615. $13;
  35616. } else {
  35617. var receiver;
  35618. receiver=$receiver;
  35619. $recv(receiver)._shouldBeAliased_(true);
  35620. };
  35621. };
  35622. };
  35623. $14=self._messageSends();
  35624. $ctx1.sendIdx["messageSends"]=1;
  35625. $15=$recv(aNode)._selector();
  35626. $ctx1.sendIdx["selector"]=4;
  35627. $recv($14)._at_ifAbsentPut_($15,(function(){
  35628. return $core.withContext(function($ctx2) {
  35629. return $recv($Set())._new();
  35630. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  35631. }));
  35632. $17=self._messageSends();
  35633. $ctx1.sendIdx["messageSends"]=2;
  35634. $18=$recv(aNode)._selector();
  35635. $ctx1.sendIdx["selector"]=5;
  35636. $16=$recv($17)._at_($18);
  35637. $ctx1.sendIdx["at:"]=2;
  35638. $recv($16)._add_(aNode);
  35639. $recv(aNode)._index_($recv($recv(self._messageSends())._at_($recv(aNode)._selector()))._size());
  35640. (
  35641. $ctx1.supercall = true,
  35642. $globals.SemanticAnalyzer.superclass.fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  35643. $ctx1.supercall = false;
  35644. return self;
  35645. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35646. },
  35647. args: ["aNode"],
  35648. source: "visitSendNode: aNode\x0a\x0a\x09aNode receiver value = 'super'\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09aNode superSend: true.\x0a\x09\x09\x09aNode receiver value: 'self'.\x0a\x09\x09\x09self superSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09\x09\x09(self superSends at: aNode selector) add: aNode ]\x0a\x09\x09\x0a\x09\x09ifFalse: [ (IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeInlined: true.\x0a\x09\x09\x09aNode receiver ifNotNil: [ :receiver |\x0a\x09\x09\x09\x09receiver shouldBeAliased: true ] ] ].\x0a\x0a\x09self messageSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09(self messageSends at: aNode selector) add: aNode.\x0a\x0a\x09aNode index: (self messageSends at: aNode selector) size.\x0a\x0a\x09super visitSendNode: aNode",
  35649. referencedClasses: ["Set", "IRSendInliner"],
  35650. messageSends: ["ifTrue:ifFalse:", "=", "value", "receiver", "superSend:", "value:", "at:ifAbsentPut:", "superSends", "selector", "new", "add:", "at:", "ifTrue:", "includes:", "inlinedSelectors", "shouldBeInlined:", "ifNotNil:", "shouldBeAliased:", "messageSends", "index:", "size", "visitSendNode:"]
  35651. }),
  35652. $globals.SemanticAnalyzer);
  35653. $core.addMethod(
  35654. $core.method({
  35655. selector: "visitSequenceNode:",
  35656. protocol: 'visiting',
  35657. fn: function (aNode){
  35658. var self=this;
  35659. return $core.withContext(function($ctx1) {
  35660. $recv($recv(aNode)._temps())._do_((function(each){
  35661. return $core.withContext(function($ctx2) {
  35662. self._validateVariableScope_(each);
  35663. return $recv(self["@currentScope"])._addTemp_(each);
  35664. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35665. }));
  35666. (
  35667. $ctx1.supercall = true,
  35668. $globals.SemanticAnalyzer.superclass.fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  35669. $ctx1.supercall = false;
  35670. return self;
  35671. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35672. },
  35673. args: ["aNode"],
  35674. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  35675. referencedClasses: [],
  35676. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  35677. }),
  35678. $globals.SemanticAnalyzer);
  35679. $core.addMethod(
  35680. $core.method({
  35681. selector: "visitVariableNode:",
  35682. protocol: 'visiting',
  35683. fn: function (aNode){
  35684. var self=this;
  35685. var binding;
  35686. function $ClassRefVar(){return $globals.ClassRefVar||(typeof ClassRefVar=="undefined"?nil:ClassRefVar)}
  35687. function $UnknownVar(){return $globals.UnknownVar||(typeof UnknownVar=="undefined"?nil:UnknownVar)}
  35688. return $core.withContext(function($ctx1) {
  35689. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$10,$11,$receiver;
  35690. binding=$recv(self["@currentScope"])._lookupVariable_(aNode);
  35691. $1=binding;
  35692. if(($receiver = $1) == null || $receiver.isNil){
  35693. $3=$recv(aNode)._value();
  35694. $ctx1.sendIdx["value"]=1;
  35695. $2=$recv($3)._isCapitalized();
  35696. if($core.assert($2)){
  35697. $4=$recv($ClassRefVar())._new();
  35698. $ctx1.sendIdx["new"]=1;
  35699. $5=$4;
  35700. $6=$recv(aNode)._value();
  35701. $ctx1.sendIdx["value"]=2;
  35702. $recv($5)._name_($6);
  35703. $ctx1.sendIdx["name:"]=1;
  35704. $7=$recv($4)._yourself();
  35705. $ctx1.sendIdx["yourself"]=1;
  35706. binding=$7;
  35707. binding;
  35708. $8=self._classReferences();
  35709. $9=$recv(aNode)._value();
  35710. $ctx1.sendIdx["value"]=3;
  35711. $recv($8)._add_($9);
  35712. } else {
  35713. self._errorUnknownVariable_(aNode);
  35714. $10=$recv($UnknownVar())._new();
  35715. $recv($10)._name_($recv(aNode)._value());
  35716. $11=$recv($10)._yourself();
  35717. binding=$11;
  35718. binding;
  35719. };
  35720. } else {
  35721. $1;
  35722. };
  35723. $recv(aNode)._binding_(binding);
  35724. return self;
  35725. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  35726. },
  35727. args: ["aNode"],
  35728. 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.",
  35729. referencedClasses: ["ClassRefVar", "UnknownVar"],
  35730. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  35731. }),
  35732. $globals.SemanticAnalyzer);
  35733. $core.addMethod(
  35734. $core.method({
  35735. selector: "on:",
  35736. protocol: 'instance creation',
  35737. fn: function (aClass){
  35738. var self=this;
  35739. return $core.withContext(function($ctx1) {
  35740. var $2,$3,$1;
  35741. $2=self._new();
  35742. $recv($2)._theClass_(aClass);
  35743. $3=$recv($2)._yourself();
  35744. $1=$3;
  35745. return $1;
  35746. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.klass)});
  35747. },
  35748. args: ["aClass"],
  35749. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  35750. referencedClasses: [],
  35751. messageSends: ["theClass:", "new", "yourself"]
  35752. }),
  35753. $globals.SemanticAnalyzer.klass);
  35754. $core.addClass('SemanticError', $globals.CompilerError, [], 'Compiler-Semantic');
  35755. $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";
  35756. $core.addClass('InvalidAssignmentError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
  35757. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  35758. $core.addMethod(
  35759. $core.method({
  35760. selector: "messageText",
  35761. protocol: 'accessing',
  35762. fn: function (){
  35763. var self=this;
  35764. return $core.withContext(function($ctx1) {
  35765. var $1;
  35766. $1=" Invalid assignment to variable: ".__comma(self._variableName());
  35767. return $1;
  35768. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  35769. },
  35770. args: [],
  35771. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  35772. referencedClasses: [],
  35773. messageSends: [",", "variableName"]
  35774. }),
  35775. $globals.InvalidAssignmentError);
  35776. $core.addMethod(
  35777. $core.method({
  35778. selector: "variableName",
  35779. protocol: 'accessing',
  35780. fn: function (){
  35781. var self=this;
  35782. var $1;
  35783. $1=self["@variableName"];
  35784. return $1;
  35785. },
  35786. args: [],
  35787. source: "variableName\x0a\x09^ variableName",
  35788. referencedClasses: [],
  35789. messageSends: []
  35790. }),
  35791. $globals.InvalidAssignmentError);
  35792. $core.addMethod(
  35793. $core.method({
  35794. selector: "variableName:",
  35795. protocol: 'accessing',
  35796. fn: function (aString){
  35797. var self=this;
  35798. self["@variableName"]=aString;
  35799. return self;
  35800. },
  35801. args: ["aString"],
  35802. source: "variableName: aString\x0a\x09variableName := aString",
  35803. referencedClasses: [],
  35804. messageSends: []
  35805. }),
  35806. $globals.InvalidAssignmentError);
  35807. $core.addClass('ShadowingVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
  35808. $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.";
  35809. $core.addMethod(
  35810. $core.method({
  35811. selector: "messageText",
  35812. protocol: 'accessing',
  35813. fn: function (){
  35814. var self=this;
  35815. return $core.withContext(function($ctx1) {
  35816. var $1;
  35817. $1=$recv("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
  35818. $ctx1.sendIdx[","]=1;
  35819. return $1;
  35820. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  35821. },
  35822. args: [],
  35823. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  35824. referencedClasses: [],
  35825. messageSends: [",", "variableName"]
  35826. }),
  35827. $globals.ShadowingVariableError);
  35828. $core.addMethod(
  35829. $core.method({
  35830. selector: "variableName",
  35831. protocol: 'accessing',
  35832. fn: function (){
  35833. var self=this;
  35834. var $1;
  35835. $1=self["@variableName"];
  35836. return $1;
  35837. },
  35838. args: [],
  35839. source: "variableName\x0a\x09^ variableName",
  35840. referencedClasses: [],
  35841. messageSends: []
  35842. }),
  35843. $globals.ShadowingVariableError);
  35844. $core.addMethod(
  35845. $core.method({
  35846. selector: "variableName:",
  35847. protocol: 'accessing',
  35848. fn: function (aString){
  35849. var self=this;
  35850. self["@variableName"]=aString;
  35851. return self;
  35852. },
  35853. args: ["aString"],
  35854. source: "variableName: aString\x0a\x09variableName := aString",
  35855. referencedClasses: [],
  35856. messageSends: []
  35857. }),
  35858. $globals.ShadowingVariableError);
  35859. $core.addClass('UnknownVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
  35860. $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.";
  35861. $core.addMethod(
  35862. $core.method({
  35863. selector: "messageText",
  35864. protocol: 'accessing',
  35865. fn: function (){
  35866. var self=this;
  35867. return $core.withContext(function($ctx1) {
  35868. var $1;
  35869. $1=$recv("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
  35870. $ctx1.sendIdx[","]=1;
  35871. return $1;
  35872. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  35873. },
  35874. args: [],
  35875. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  35876. referencedClasses: [],
  35877. messageSends: [",", "variableName"]
  35878. }),
  35879. $globals.UnknownVariableError);
  35880. $core.addMethod(
  35881. $core.method({
  35882. selector: "variableName",
  35883. protocol: 'accessing',
  35884. fn: function (){
  35885. var self=this;
  35886. var $1;
  35887. $1=self["@variableName"];
  35888. return $1;
  35889. },
  35890. args: [],
  35891. source: "variableName\x0a\x09^ variableName",
  35892. referencedClasses: [],
  35893. messageSends: []
  35894. }),
  35895. $globals.UnknownVariableError);
  35896. $core.addMethod(
  35897. $core.method({
  35898. selector: "variableName:",
  35899. protocol: 'accessing',
  35900. fn: function (aString){
  35901. var self=this;
  35902. self["@variableName"]=aString;
  35903. return self;
  35904. },
  35905. args: ["aString"],
  35906. source: "variableName: aString\x0a\x09variableName := aString",
  35907. referencedClasses: [],
  35908. messageSends: []
  35909. }),
  35910. $globals.UnknownVariableError);
  35911. });
  35912. define("amber_core/Compiler-IR", ["amber/boot", "amber_core/Compiler-AST", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){"use strict";
  35913. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  35914. $core.addPackage('Compiler-IR');
  35915. $core.packages["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
  35916. $core.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  35917. $core.addClass('IRASTTranslator', $globals.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  35918. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  35919. $core.addMethod(
  35920. $core.method({
  35921. selector: "alias:",
  35922. protocol: 'visiting',
  35923. fn: function (aNode){
  35924. var self=this;
  35925. var variable;
  35926. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  35927. function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  35928. function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  35929. return $core.withContext(function($ctx1) {
  35930. var $1,$2,$3,$4,$6,$5,$7,$8,$10,$11,$9,$12;
  35931. $1=$recv(aNode)._isImmutable();
  35932. if($core.assert($1)){
  35933. $2=self._visit_(aNode);
  35934. $ctx1.sendIdx["visit:"]=1;
  35935. return $2;
  35936. };
  35937. $3=$recv($IRVariable())._new();
  35938. $ctx1.sendIdx["new"]=1;
  35939. $4=$3;
  35940. $6=$recv($AliasVar())._new();
  35941. $ctx1.sendIdx["new"]=2;
  35942. $5=$recv($6)._name_("$".__comma(self._nextAlias()));
  35943. $recv($4)._variable_($5);
  35944. $7=$recv($3)._yourself();
  35945. $ctx1.sendIdx["yourself"]=1;
  35946. variable=$7;
  35947. $8=self._sequence();
  35948. $10=$recv($IRAssignment())._new();
  35949. $recv($10)._add_(variable);
  35950. $ctx1.sendIdx["add:"]=2;
  35951. $recv($10)._add_(self._visit_(aNode));
  35952. $ctx1.sendIdx["add:"]=3;
  35953. $11=$recv($10)._yourself();
  35954. $9=$11;
  35955. $recv($8)._add_($9);
  35956. $ctx1.sendIdx["add:"]=1;
  35957. $recv($recv(self._method())._internalVariables())._add_(variable);
  35958. $12=variable;
  35959. return $12;
  35960. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  35961. },
  35962. args: ["aNode"],
  35963. 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",
  35964. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  35965. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"]
  35966. }),
  35967. $globals.IRASTTranslator);
  35968. $core.addMethod(
  35969. $core.method({
  35970. selector: "aliasTemporally:",
  35971. protocol: 'visiting',
  35972. fn: function (aCollection){
  35973. var self=this;
  35974. var threshold,result;
  35975. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  35976. return $core.withContext(function($ctx1) {
  35977. var $1,$2,$4,$3,$5;
  35978. threshold=(0);
  35979. $recv(aCollection)._withIndexDo_((function(each,i){
  35980. return $core.withContext(function($ctx2) {
  35981. $1=$recv(each)._subtreeNeedsAliasing();
  35982. if($core.assert($1)){
  35983. threshold=i;
  35984. return threshold;
  35985. };
  35986. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  35987. }));
  35988. $ctx1.sendIdx["withIndexDo:"]=1;
  35989. result=$recv($OrderedCollection())._new();
  35990. $recv(aCollection)._withIndexDo_((function(each,i){
  35991. return $core.withContext(function($ctx2) {
  35992. $2=result;
  35993. $4=$recv(i).__lt_eq(threshold);
  35994. if($core.assert($4)){
  35995. $3=self._alias_(each);
  35996. } else {
  35997. $3=self._visit_(each);
  35998. };
  35999. return $recv($2)._add_($3);
  36000. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  36001. }));
  36002. $5=result;
  36003. return $5;
  36004. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  36005. },
  36006. args: ["aCollection"],
  36007. 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",
  36008. referencedClasses: ["OrderedCollection"],
  36009. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  36010. }),
  36011. $globals.IRASTTranslator);
  36012. $core.addMethod(
  36013. $core.method({
  36014. selector: "method",
  36015. protocol: 'accessing',
  36016. fn: function (){
  36017. var self=this;
  36018. var $1;
  36019. $1=self["@method"];
  36020. return $1;
  36021. },
  36022. args: [],
  36023. source: "method\x0a\x09^ method",
  36024. referencedClasses: [],
  36025. messageSends: []
  36026. }),
  36027. $globals.IRASTTranslator);
  36028. $core.addMethod(
  36029. $core.method({
  36030. selector: "method:",
  36031. protocol: 'accessing',
  36032. fn: function (anIRMethod){
  36033. var self=this;
  36034. self["@method"]=anIRMethod;
  36035. return self;
  36036. },
  36037. args: ["anIRMethod"],
  36038. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  36039. referencedClasses: [],
  36040. messageSends: []
  36041. }),
  36042. $globals.IRASTTranslator);
  36043. $core.addMethod(
  36044. $core.method({
  36045. selector: "nextAlias",
  36046. protocol: 'accessing',
  36047. fn: function (){
  36048. var self=this;
  36049. return $core.withContext(function($ctx1) {
  36050. var $1,$2,$receiver;
  36051. $1=self["@nextAlias"];
  36052. if(($receiver = $1) == null || $receiver.isNil){
  36053. self["@nextAlias"]=(0);
  36054. self["@nextAlias"];
  36055. } else {
  36056. $1;
  36057. };
  36058. self["@nextAlias"]=$recv(self["@nextAlias"]).__plus((1));
  36059. $2=$recv(self["@nextAlias"])._asString();
  36060. return $2;
  36061. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  36062. },
  36063. args: [],
  36064. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  36065. referencedClasses: [],
  36066. messageSends: ["ifNil:", "+", "asString"]
  36067. }),
  36068. $globals.IRASTTranslator);
  36069. $core.addMethod(
  36070. $core.method({
  36071. selector: "sequence",
  36072. protocol: 'accessing',
  36073. fn: function (){
  36074. var self=this;
  36075. var $1;
  36076. $1=self["@sequence"];
  36077. return $1;
  36078. },
  36079. args: [],
  36080. source: "sequence\x0a\x09^ sequence",
  36081. referencedClasses: [],
  36082. messageSends: []
  36083. }),
  36084. $globals.IRASTTranslator);
  36085. $core.addMethod(
  36086. $core.method({
  36087. selector: "sequence:",
  36088. protocol: 'accessing',
  36089. fn: function (anIRSequence){
  36090. var self=this;
  36091. self["@sequence"]=anIRSequence;
  36092. return self;
  36093. },
  36094. args: ["anIRSequence"],
  36095. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  36096. referencedClasses: [],
  36097. messageSends: []
  36098. }),
  36099. $globals.IRASTTranslator);
  36100. $core.addMethod(
  36101. $core.method({
  36102. selector: "source",
  36103. protocol: 'accessing',
  36104. fn: function (){
  36105. var self=this;
  36106. var $1;
  36107. $1=self["@source"];
  36108. return $1;
  36109. },
  36110. args: [],
  36111. source: "source\x0a\x09^ source",
  36112. referencedClasses: [],
  36113. messageSends: []
  36114. }),
  36115. $globals.IRASTTranslator);
  36116. $core.addMethod(
  36117. $core.method({
  36118. selector: "source:",
  36119. protocol: 'accessing',
  36120. fn: function (aString){
  36121. var self=this;
  36122. self["@source"]=aString;
  36123. return self;
  36124. },
  36125. args: ["aString"],
  36126. source: "source: aString\x0a\x09source := aString",
  36127. referencedClasses: [],
  36128. messageSends: []
  36129. }),
  36130. $globals.IRASTTranslator);
  36131. $core.addMethod(
  36132. $core.method({
  36133. selector: "theClass",
  36134. protocol: 'accessing',
  36135. fn: function (){
  36136. var self=this;
  36137. var $1;
  36138. $1=self["@theClass"];
  36139. return $1;
  36140. },
  36141. args: [],
  36142. source: "theClass\x0a\x09^ theClass",
  36143. referencedClasses: [],
  36144. messageSends: []
  36145. }),
  36146. $globals.IRASTTranslator);
  36147. $core.addMethod(
  36148. $core.method({
  36149. selector: "theClass:",
  36150. protocol: 'accessing',
  36151. fn: function (aClass){
  36152. var self=this;
  36153. self["@theClass"]=aClass;
  36154. return self;
  36155. },
  36156. args: ["aClass"],
  36157. source: "theClass: aClass\x0a\x09theClass := aClass",
  36158. referencedClasses: [],
  36159. messageSends: []
  36160. }),
  36161. $globals.IRASTTranslator);
  36162. $core.addMethod(
  36163. $core.method({
  36164. selector: "visitAssignmentNode:",
  36165. protocol: 'visiting',
  36166. fn: function (aNode){
  36167. var self=this;
  36168. var left,right,assignment;
  36169. function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  36170. return $core.withContext(function($ctx1) {
  36171. var $1,$3,$4,$2,$5;
  36172. right=self._visit_($recv(aNode)._right());
  36173. $ctx1.sendIdx["visit:"]=1;
  36174. left=self._visit_($recv(aNode)._left());
  36175. $1=self._sequence();
  36176. $3=$recv($IRAssignment())._new();
  36177. $recv($3)._add_(left);
  36178. $ctx1.sendIdx["add:"]=2;
  36179. $recv($3)._add_(right);
  36180. $4=$recv($3)._yourself();
  36181. $2=$4;
  36182. $recv($1)._add_($2);
  36183. $ctx1.sendIdx["add:"]=1;
  36184. $5=left;
  36185. return $5;
  36186. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  36187. },
  36188. args: ["aNode"],
  36189. 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",
  36190. referencedClasses: ["IRAssignment"],
  36191. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"]
  36192. }),
  36193. $globals.IRASTTranslator);
  36194. $core.addMethod(
  36195. $core.method({
  36196. selector: "visitBlockNode:",
  36197. protocol: 'visiting',
  36198. fn: function (aNode){
  36199. var self=this;
  36200. var closure;
  36201. function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  36202. function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  36203. return $core.withContext(function($ctx1) {
  36204. var $1,$2,$3,$4,$6,$5,$7,$8,$9;
  36205. $1=$recv($IRClosure())._new();
  36206. $ctx1.sendIdx["new"]=1;
  36207. $recv($1)._arguments_($recv(aNode)._parameters());
  36208. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  36209. $2=$1;
  36210. $3=$recv(aNode)._scope();
  36211. $ctx1.sendIdx["scope"]=1;
  36212. $recv($2)._scope_($3);
  36213. $ctx1.sendIdx["scope:"]=1;
  36214. $4=$recv($1)._yourself();
  36215. $ctx1.sendIdx["yourself"]=1;
  36216. closure=$4;
  36217. $6=$recv(aNode)._scope();
  36218. $ctx1.sendIdx["scope"]=2;
  36219. $5=$recv($6)._temps();
  36220. $recv($5)._do_((function(each){
  36221. return $core.withContext(function($ctx2) {
  36222. $7=$recv($IRTempDeclaration())._new();
  36223. $recv($7)._name_($recv(each)._name());
  36224. $recv($7)._scope_($recv(aNode)._scope());
  36225. $8=$recv($7)._yourself();
  36226. return $recv(closure)._add_($8);
  36227. $ctx2.sendIdx["add:"]=1;
  36228. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36229. }));
  36230. $ctx1.sendIdx["do:"]=1;
  36231. $recv($recv(aNode)._nodes())._do_((function(each){
  36232. return $core.withContext(function($ctx2) {
  36233. return $recv(closure)._add_(self._visit_(each));
  36234. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  36235. }));
  36236. $9=closure;
  36237. return $9;
  36238. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  36239. },
  36240. args: ["aNode"],
  36241. 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",
  36242. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  36243. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"]
  36244. }),
  36245. $globals.IRASTTranslator);
  36246. $core.addMethod(
  36247. $core.method({
  36248. selector: "visitBlockSequenceNode:",
  36249. protocol: 'visiting',
  36250. fn: function (aNode){
  36251. var self=this;
  36252. function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  36253. function $IRBlockReturn(){return $globals.IRBlockReturn||(typeof IRBlockReturn=="undefined"?nil:IRBlockReturn)}
  36254. return $core.withContext(function($ctx1) {
  36255. var $2,$3,$5,$4,$6,$7,$10,$9,$8,$11,$13,$14,$17,$16,$15,$18,$12,$1;
  36256. $2=$recv($IRBlockSequence())._new();
  36257. $ctx1.sendIdx["new"]=1;
  36258. $1=self._withSequence_do_($2,(function(){
  36259. return $core.withContext(function($ctx2) {
  36260. $3=$recv(aNode)._nodes();
  36261. $ctx2.sendIdx["nodes"]=1;
  36262. return $recv($3)._ifNotEmpty_((function(){
  36263. return $core.withContext(function($ctx3) {
  36264. $5=$recv(aNode)._nodes();
  36265. $ctx3.sendIdx["nodes"]=2;
  36266. $4=$recv($5)._allButLast();
  36267. $recv($4)._do_((function(each){
  36268. return $core.withContext(function($ctx4) {
  36269. $6=self._sequence();
  36270. $ctx4.sendIdx["sequence"]=1;
  36271. $7=self._visitOrAlias_(each);
  36272. $ctx4.sendIdx["visitOrAlias:"]=1;
  36273. return $recv($6)._add_($7);
  36274. $ctx4.sendIdx["add:"]=1;
  36275. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  36276. }));
  36277. $10=$recv(aNode)._nodes();
  36278. $ctx3.sendIdx["nodes"]=3;
  36279. $9=$recv($10)._last();
  36280. $ctx3.sendIdx["last"]=1;
  36281. $8=$recv($9)._isReturnNode();
  36282. if($core.assert($8)){
  36283. return $recv(self._sequence())._add_(self._visitOrAlias_($recv($recv(aNode)._nodes())._last()));
  36284. } else {
  36285. $11=self._sequence();
  36286. $ctx3.sendIdx["sequence"]=2;
  36287. $13=$recv($IRBlockReturn())._new();
  36288. $14=$13;
  36289. $17=$recv(aNode)._nodes();
  36290. $ctx3.sendIdx["nodes"]=4;
  36291. $16=$recv($17)._last();
  36292. $ctx3.sendIdx["last"]=2;
  36293. $15=self._visitOrAlias_($16);
  36294. $ctx3.sendIdx["visitOrAlias:"]=2;
  36295. $recv($14)._add_($15);
  36296. $ctx3.sendIdx["add:"]=3;
  36297. $18=$recv($13)._yourself();
  36298. $12=$18;
  36299. return $recv($11)._add_($12);
  36300. $ctx3.sendIdx["add:"]=2;
  36301. };
  36302. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  36303. }));
  36304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36305. }));
  36306. return $1;
  36307. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36308. },
  36309. args: ["aNode"],
  36310. 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) ] ]]",
  36311. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  36312. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "nodes", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"]
  36313. }),
  36314. $globals.IRASTTranslator);
  36315. $core.addMethod(
  36316. $core.method({
  36317. selector: "visitCascadeNode:",
  36318. protocol: 'visiting',
  36319. fn: function (aNode){
  36320. var self=this;
  36321. var alias,receiver;
  36322. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  36323. return $core.withContext(function($ctx1) {
  36324. var $2,$1,$3,$5,$4,$6;
  36325. $2=$recv(aNode)._receiver();
  36326. $ctx1.sendIdx["receiver"]=1;
  36327. $1=$recv($2)._isImmutable();
  36328. if($core.assert($1)){
  36329. receiver=$recv(aNode)._receiver();
  36330. $ctx1.sendIdx["receiver"]=2;
  36331. receiver;
  36332. } else {
  36333. alias=self._alias_($recv(aNode)._receiver());
  36334. $ctx1.sendIdx["alias:"]=1;
  36335. alias;
  36336. receiver=$recv($recv($VariableNode())._new())._binding_($recv(alias)._variable());
  36337. receiver;
  36338. };
  36339. $3=$recv(aNode)._nodes();
  36340. $ctx1.sendIdx["nodes"]=1;
  36341. $recv($3)._do_((function(each){
  36342. return $core.withContext(function($ctx2) {
  36343. return $recv(each)._receiver_(receiver);
  36344. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  36345. }));
  36346. $ctx1.sendIdx["do:"]=1;
  36347. $5=$recv(aNode)._nodes();
  36348. $ctx1.sendIdx["nodes"]=2;
  36349. $4=$recv($5)._allButLast();
  36350. $recv($4)._do_((function(each){
  36351. return $core.withContext(function($ctx2) {
  36352. return $recv(self._sequence())._add_(self._visit_(each));
  36353. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  36354. }));
  36355. $6=self._alias_($recv($recv(aNode)._nodes())._last());
  36356. return $6;
  36357. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,alias:alias,receiver:receiver},$globals.IRASTTranslator)});
  36358. },
  36359. args: ["aNode"],
  36360. source: "visitCascadeNode: aNode\x0a\x09| alias receiver |\x0a\x0a\x09aNode receiver isImmutable \x0a\x09\x09ifTrue: [ receiver := aNode receiver ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09alias := self alias: aNode receiver.\x0a\x09\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09\x09each receiver: receiver ].\x0a\x0a\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self alias: aNode nodes last",
  36361. referencedClasses: ["VariableNode"],
  36362. messageSends: ["ifTrue:ifFalse:", "isImmutable", "receiver", "alias:", "binding:", "new", "variable", "do:", "nodes", "receiver:", "allButLast", "add:", "sequence", "visit:", "last"]
  36363. }),
  36364. $globals.IRASTTranslator);
  36365. $core.addMethod(
  36366. $core.method({
  36367. selector: "visitDynamicArrayNode:",
  36368. protocol: 'visiting',
  36369. fn: function (aNode){
  36370. var self=this;
  36371. var array;
  36372. function $IRDynamicArray(){return $globals.IRDynamicArray||(typeof IRDynamicArray=="undefined"?nil:IRDynamicArray)}
  36373. return $core.withContext(function($ctx1) {
  36374. var $1;
  36375. array=$recv($IRDynamicArray())._new();
  36376. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  36377. return $core.withContext(function($ctx2) {
  36378. return $recv(array)._add_(each);
  36379. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36380. }));
  36381. $1=array;
  36382. return $1;
  36383. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  36384. },
  36385. args: ["aNode"],
  36386. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | array add: each ].\x0a\x09^ array",
  36387. referencedClasses: ["IRDynamicArray"],
  36388. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
  36389. }),
  36390. $globals.IRASTTranslator);
  36391. $core.addMethod(
  36392. $core.method({
  36393. selector: "visitDynamicDictionaryNode:",
  36394. protocol: 'visiting',
  36395. fn: function (aNode){
  36396. var self=this;
  36397. var dictionary;
  36398. function $IRDynamicDictionary(){return $globals.IRDynamicDictionary||(typeof IRDynamicDictionary=="undefined"?nil:IRDynamicDictionary)}
  36399. return $core.withContext(function($ctx1) {
  36400. var $1;
  36401. dictionary=$recv($IRDynamicDictionary())._new();
  36402. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  36403. return $core.withContext(function($ctx2) {
  36404. return $recv(dictionary)._add_(each);
  36405. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36406. }));
  36407. $1=dictionary;
  36408. return $1;
  36409. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  36410. },
  36411. args: ["aNode"],
  36412. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  36413. referencedClasses: ["IRDynamicDictionary"],
  36414. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
  36415. }),
  36416. $globals.IRASTTranslator);
  36417. $core.addMethod(
  36418. $core.method({
  36419. selector: "visitJSStatementNode:",
  36420. protocol: 'visiting',
  36421. fn: function (aNode){
  36422. var self=this;
  36423. function $IRVerbatim(){return $globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
  36424. return $core.withContext(function($ctx1) {
  36425. var $2,$3,$1;
  36426. $2=$recv($IRVerbatim())._new();
  36427. $recv($2)._source_($recv($recv(aNode)._source())._crlfSanitized());
  36428. $3=$recv($2)._yourself();
  36429. $1=$3;
  36430. return $1;
  36431. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36432. },
  36433. args: ["aNode"],
  36434. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  36435. referencedClasses: ["IRVerbatim"],
  36436. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  36437. }),
  36438. $globals.IRASTTranslator);
  36439. $core.addMethod(
  36440. $core.method({
  36441. selector: "visitMethodNode:",
  36442. protocol: 'visiting',
  36443. fn: function (aNode){
  36444. var self=this;
  36445. function $IRMethod(){return $globals.IRMethod||(typeof IRMethod=="undefined"?nil:IRMethod)}
  36446. function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  36447. function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  36448. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  36449. function $IRVerbatim(){return $globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
  36450. return $core.withContext(function($ctx1) {
  36451. var $2,$3,$4,$5,$1,$7,$6,$8,$10,$11,$12,$13,$9,$14,$16,$15,$17,$18,$20,$21,$23,$24,$22,$25,$19,$27,$28,$26,$29;
  36452. $2=$recv($IRMethod())._new();
  36453. $ctx1.sendIdx["new"]=1;
  36454. $recv($2)._source_($recv(self._source())._crlfSanitized());
  36455. $ctx1.sendIdx["source:"]=1;
  36456. $recv($2)._theClass_(self._theClass());
  36457. $recv($2)._arguments_($recv(aNode)._arguments());
  36458. $recv($2)._selector_($recv(aNode)._selector());
  36459. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  36460. $recv($2)._superSends_($recv(aNode)._superSends());
  36461. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  36462. $recv($2)._classReferences_($recv(aNode)._classReferences());
  36463. $3=$2;
  36464. $4=$recv(aNode)._scope();
  36465. $ctx1.sendIdx["scope"]=1;
  36466. $recv($3)._scope_($4);
  36467. $ctx1.sendIdx["scope:"]=1;
  36468. $5=$recv($2)._yourself();
  36469. $ctx1.sendIdx["yourself"]=1;
  36470. $1=$5;
  36471. self._method_($1);
  36472. $7=$recv(aNode)._scope();
  36473. $ctx1.sendIdx["scope"]=2;
  36474. $6=$recv($7)._temps();
  36475. $recv($6)._do_((function(each){
  36476. return $core.withContext(function($ctx2) {
  36477. $8=self._method();
  36478. $ctx2.sendIdx["method"]=1;
  36479. $10=$recv($IRTempDeclaration())._new();
  36480. $ctx2.sendIdx["new"]=2;
  36481. $recv($10)._name_($recv(each)._name());
  36482. $11=$10;
  36483. $12=$recv(aNode)._scope();
  36484. $ctx2.sendIdx["scope"]=3;
  36485. $recv($11)._scope_($12);
  36486. $13=$recv($10)._yourself();
  36487. $ctx2.sendIdx["yourself"]=2;
  36488. $9=$13;
  36489. return $recv($8)._add_($9);
  36490. $ctx2.sendIdx["add:"]=1;
  36491. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36492. }));
  36493. $ctx1.sendIdx["do:"]=1;
  36494. $recv($recv(aNode)._nodes())._do_((function(each){
  36495. return $core.withContext(function($ctx2) {
  36496. $14=self._method();
  36497. $ctx2.sendIdx["method"]=2;
  36498. return $recv($14)._add_(self._visit_(each));
  36499. $ctx2.sendIdx["add:"]=2;
  36500. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  36501. }));
  36502. $16=$recv(aNode)._scope();
  36503. $ctx1.sendIdx["scope"]=4;
  36504. $15=$recv($16)._hasLocalReturn();
  36505. if(!$core.assert($15)){
  36506. $17=self._method();
  36507. $ctx1.sendIdx["method"]=3;
  36508. $18=$17;
  36509. $20=$recv($IRReturn())._new();
  36510. $ctx1.sendIdx["new"]=3;
  36511. $21=$20;
  36512. $23=$recv($IRVariable())._new();
  36513. $ctx1.sendIdx["new"]=4;
  36514. $recv($23)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  36515. $24=$recv($23)._yourself();
  36516. $ctx1.sendIdx["yourself"]=3;
  36517. $22=$24;
  36518. $recv($21)._add_($22);
  36519. $ctx1.sendIdx["add:"]=4;
  36520. $25=$recv($20)._yourself();
  36521. $ctx1.sendIdx["yourself"]=4;
  36522. $19=$25;
  36523. $recv($18)._add_($19);
  36524. $ctx1.sendIdx["add:"]=3;
  36525. $27=$recv($IRVerbatim())._new();
  36526. $recv($27)._source_("");
  36527. $28=$recv($27)._yourself();
  36528. $26=$recv($17)._add_($28);
  36529. $26;
  36530. };
  36531. $29=self._method();
  36532. return $29;
  36533. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36534. },
  36535. args: ["aNode"],
  36536. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09superSends: aNode superSends;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode nodes do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ''; yourself) ].\x0a\x0a\x09^ self method",
  36537. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"],
  36538. messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "sendIndexes:", "sendIndexes", "superSends:", "superSends", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "nodes", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars"]
  36539. }),
  36540. $globals.IRASTTranslator);
  36541. $core.addMethod(
  36542. $core.method({
  36543. selector: "visitOrAlias:",
  36544. protocol: 'visiting',
  36545. fn: function (aNode){
  36546. var self=this;
  36547. return $core.withContext(function($ctx1) {
  36548. var $2,$1;
  36549. $2=$recv(aNode)._shouldBeAliased();
  36550. if($core.assert($2)){
  36551. $1=self._alias_(aNode);
  36552. } else {
  36553. $1=self._visit_(aNode);
  36554. };
  36555. return $1;
  36556. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  36557. },
  36558. args: ["aNode"],
  36559. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  36560. referencedClasses: [],
  36561. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  36562. }),
  36563. $globals.IRASTTranslator);
  36564. $core.addMethod(
  36565. $core.method({
  36566. selector: "visitReturnNode:",
  36567. protocol: 'visiting',
  36568. fn: function (aNode){
  36569. var self=this;
  36570. var return_;
  36571. function $IRNonLocalReturn(){return $globals.IRNonLocalReturn||(typeof IRNonLocalReturn=="undefined"?nil:IRNonLocalReturn)}
  36572. function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  36573. return $core.withContext(function($ctx1) {
  36574. var $1,$2;
  36575. $1=$recv(aNode)._nonLocalReturn();
  36576. if($core.assert($1)){
  36577. return_=$recv($IRNonLocalReturn())._new();
  36578. $ctx1.sendIdx["new"]=1;
  36579. } else {
  36580. return_=$recv($IRReturn())._new();
  36581. };
  36582. $recv(return_)._scope_($recv(aNode)._scope());
  36583. $recv($recv(aNode)._nodes())._do_((function(each){
  36584. return $core.withContext(function($ctx2) {
  36585. return $recv(return_)._add_(self._alias_(each));
  36586. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  36587. }));
  36588. $2=return_;
  36589. return $2;
  36590. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  36591. },
  36592. args: ["aNode"],
  36593. source: "visitReturnNode: aNode\x0a\x09| return |\x0a\x09return := aNode nonLocalReturn\x0a\x09\x09ifTrue: [ IRNonLocalReturn new ]\x0a\x09\x09ifFalse: [ IRReturn new ].\x0a\x09return scope: aNode scope.\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09return add: (self alias: each) ].\x0a\x09^ return",
  36594. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  36595. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "nodes", "add:", "alias:"]
  36596. }),
  36597. $globals.IRASTTranslator);
  36598. $core.addMethod(
  36599. $core.method({
  36600. selector: "visitSendNode:",
  36601. protocol: 'visiting',
  36602. fn: function (aNode){
  36603. var self=this;
  36604. var send,all,receiver,arguments_;
  36605. function $IRSend(){return $globals.IRSend||(typeof IRSend=="undefined"?nil:IRSend)}
  36606. return $core.withContext(function($ctx1) {
  36607. var $1,$2,$3,$4;
  36608. send=$recv($IRSend())._new();
  36609. $1=send;
  36610. $recv($1)._selector_($recv(aNode)._selector());
  36611. $2=$recv($1)._index_($recv(aNode)._index());
  36612. $3=$recv(aNode)._superSend();
  36613. if($core.assert($3)){
  36614. $recv(send)._classSend_($recv(self._theClass())._superclass());
  36615. };
  36616. all=self._aliasTemporally_($recv([$recv(aNode)._receiver()]).__comma($recv(aNode)._arguments()));
  36617. receiver=$recv(all)._first();
  36618. arguments_=$recv(all)._allButFirst();
  36619. $recv(send)._add_(receiver);
  36620. $ctx1.sendIdx["add:"]=1;
  36621. $recv(arguments_)._do_((function(each){
  36622. return $core.withContext(function($ctx2) {
  36623. return $recv(send)._add_(each);
  36624. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  36625. }));
  36626. $4=send;
  36627. return $4;
  36628. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send,all:all,receiver:receiver,arguments_:arguments_},$globals.IRASTTranslator)});
  36629. },
  36630. args: ["aNode"],
  36631. source: "visitSendNode: aNode\x0a\x09| send all receiver arguments |\x0a\x09send := IRSend new.\x0a\x09send\x0a\x09\x09selector: aNode selector;\x0a\x09\x09index: aNode index.\x0a\x09aNode superSend ifTrue: [ send classSend: self theClass superclass ].\x0a\x09\x0a\x09all := self aliasTemporally: { aNode receiver }, aNode arguments.\x0a\x09receiver := all first.\x0a\x09arguments := all allButFirst.\x0a\x0a\x09send add: receiver.\x0a\x09arguments do: [ :each | send add: each ].\x0a\x0a\x09^ send",
  36632. referencedClasses: ["IRSend"],
  36633. messageSends: ["new", "selector:", "selector", "index:", "index", "ifTrue:", "superSend", "classSend:", "superclass", "theClass", "aliasTemporally:", ",", "receiver", "arguments", "first", "allButFirst", "add:", "do:"]
  36634. }),
  36635. $globals.IRASTTranslator);
  36636. $core.addMethod(
  36637. $core.method({
  36638. selector: "visitSequenceNode:",
  36639. protocol: 'visiting',
  36640. fn: function (aNode){
  36641. var self=this;
  36642. function $IRSequence(){return $globals.IRSequence||(typeof IRSequence=="undefined"?nil:IRSequence)}
  36643. return $core.withContext(function($ctx1) {
  36644. var $2,$1;
  36645. $1=self._withSequence_do_($recv($IRSequence())._new(),(function(){
  36646. return $core.withContext(function($ctx2) {
  36647. return $recv($recv(aNode)._nodes())._do_((function(each){
  36648. var instruction;
  36649. return $core.withContext(function($ctx3) {
  36650. instruction=self._visitOrAlias_(each);
  36651. instruction;
  36652. $2=$recv(instruction)._isVariable();
  36653. if(!$core.assert($2)){
  36654. return $recv(self._sequence())._add_(instruction);
  36655. };
  36656. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)});
  36657. }));
  36658. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36659. }));
  36660. return $1;
  36661. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36662. },
  36663. args: ["aNode"],
  36664. 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 ] ]]",
  36665. referencedClasses: ["IRSequence"],
  36666. messageSends: ["withSequence:do:", "new", "do:", "nodes", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"]
  36667. }),
  36668. $globals.IRASTTranslator);
  36669. $core.addMethod(
  36670. $core.method({
  36671. selector: "visitValueNode:",
  36672. protocol: 'visiting',
  36673. fn: function (aNode){
  36674. var self=this;
  36675. function $IRValue(){return $globals.IRValue||(typeof IRValue=="undefined"?nil:IRValue)}
  36676. return $core.withContext(function($ctx1) {
  36677. var $2,$3,$1;
  36678. $2=$recv($IRValue())._new();
  36679. $recv($2)._value_($recv(aNode)._value());
  36680. $3=$recv($2)._yourself();
  36681. $1=$3;
  36682. return $1;
  36683. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36684. },
  36685. args: ["aNode"],
  36686. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  36687. referencedClasses: ["IRValue"],
  36688. messageSends: ["value:", "new", "value", "yourself"]
  36689. }),
  36690. $globals.IRASTTranslator);
  36691. $core.addMethod(
  36692. $core.method({
  36693. selector: "visitVariableNode:",
  36694. protocol: 'visiting',
  36695. fn: function (aNode){
  36696. var self=this;
  36697. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  36698. return $core.withContext(function($ctx1) {
  36699. var $2,$3,$1;
  36700. $2=$recv($IRVariable())._new();
  36701. $recv($2)._variable_($recv(aNode)._binding());
  36702. $3=$recv($2)._yourself();
  36703. $1=$3;
  36704. return $1;
  36705. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36706. },
  36707. args: ["aNode"],
  36708. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  36709. referencedClasses: ["IRVariable"],
  36710. messageSends: ["variable:", "new", "binding", "yourself"]
  36711. }),
  36712. $globals.IRASTTranslator);
  36713. $core.addMethod(
  36714. $core.method({
  36715. selector: "withSequence:do:",
  36716. protocol: 'accessing',
  36717. fn: function (aSequence,aBlock){
  36718. var self=this;
  36719. var outerSequence;
  36720. return $core.withContext(function($ctx1) {
  36721. outerSequence=self._sequence();
  36722. self._sequence_(aSequence);
  36723. $ctx1.sendIdx["sequence:"]=1;
  36724. $recv(aBlock)._value();
  36725. self._sequence_(outerSequence);
  36726. return aSequence;
  36727. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  36728. },
  36729. args: ["aSequence", "aBlock"],
  36730. 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",
  36731. referencedClasses: [],
  36732. messageSends: ["sequence", "sequence:", "value"]
  36733. }),
  36734. $globals.IRASTTranslator);
  36735. $core.addClass('IRInstruction', $globals.Object, ['parent', 'instructions'], 'Compiler-IR');
  36736. $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.";
  36737. $core.addMethod(
  36738. $core.method({
  36739. selector: "accept:",
  36740. protocol: 'visiting',
  36741. fn: function (aVisitor){
  36742. var self=this;
  36743. return $core.withContext(function($ctx1) {
  36744. var $1;
  36745. $1=$recv(aVisitor)._visitIRInstruction_(self);
  36746. return $1;
  36747. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInstruction)});
  36748. },
  36749. args: ["aVisitor"],
  36750. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
  36751. referencedClasses: [],
  36752. messageSends: ["visitIRInstruction:"]
  36753. }),
  36754. $globals.IRInstruction);
  36755. $core.addMethod(
  36756. $core.method({
  36757. selector: "add:",
  36758. protocol: 'building',
  36759. fn: function (anObject){
  36760. var self=this;
  36761. return $core.withContext(function($ctx1) {
  36762. var $1;
  36763. $recv(anObject)._parent_(self);
  36764. $1=$recv(self._instructions())._add_(anObject);
  36765. return $1;
  36766. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  36767. },
  36768. args: ["anObject"],
  36769. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
  36770. referencedClasses: [],
  36771. messageSends: ["parent:", "add:", "instructions"]
  36772. }),
  36773. $globals.IRInstruction);
  36774. $core.addMethod(
  36775. $core.method({
  36776. selector: "canBeAssigned",
  36777. protocol: 'testing',
  36778. fn: function (){
  36779. var self=this;
  36780. return true;
  36781. },
  36782. args: [],
  36783. source: "canBeAssigned\x0a\x09^ true",
  36784. referencedClasses: [],
  36785. messageSends: []
  36786. }),
  36787. $globals.IRInstruction);
  36788. $core.addMethod(
  36789. $core.method({
  36790. selector: "instructions",
  36791. protocol: 'accessing',
  36792. fn: function (){
  36793. var self=this;
  36794. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  36795. return $core.withContext(function($ctx1) {
  36796. var $2,$1,$receiver;
  36797. $2=self["@instructions"];
  36798. if(($receiver = $2) == null || $receiver.isNil){
  36799. self["@instructions"]=$recv($OrderedCollection())._new();
  36800. $1=self["@instructions"];
  36801. } else {
  36802. $1=$2;
  36803. };
  36804. return $1;
  36805. }, function($ctx1) {$ctx1.fill(self,"instructions",{},$globals.IRInstruction)});
  36806. },
  36807. args: [],
  36808. source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
  36809. referencedClasses: ["OrderedCollection"],
  36810. messageSends: ["ifNil:", "new"]
  36811. }),
  36812. $globals.IRInstruction);
  36813. $core.addMethod(
  36814. $core.method({
  36815. selector: "isClosure",
  36816. protocol: 'testing',
  36817. fn: function (){
  36818. var self=this;
  36819. return false;
  36820. },
  36821. args: [],
  36822. source: "isClosure\x0a\x09^ false",
  36823. referencedClasses: [],
  36824. messageSends: []
  36825. }),
  36826. $globals.IRInstruction);
  36827. $core.addMethod(
  36828. $core.method({
  36829. selector: "isInlined",
  36830. protocol: 'testing',
  36831. fn: function (){
  36832. var self=this;
  36833. return false;
  36834. },
  36835. args: [],
  36836. source: "isInlined\x0a\x09^ false",
  36837. referencedClasses: [],
  36838. messageSends: []
  36839. }),
  36840. $globals.IRInstruction);
  36841. $core.addMethod(
  36842. $core.method({
  36843. selector: "isLocalReturn",
  36844. protocol: 'testing',
  36845. fn: function (){
  36846. var self=this;
  36847. return false;
  36848. },
  36849. args: [],
  36850. source: "isLocalReturn\x0a\x09^ false",
  36851. referencedClasses: [],
  36852. messageSends: []
  36853. }),
  36854. $globals.IRInstruction);
  36855. $core.addMethod(
  36856. $core.method({
  36857. selector: "isMethod",
  36858. protocol: 'testing',
  36859. fn: function (){
  36860. var self=this;
  36861. return false;
  36862. },
  36863. args: [],
  36864. source: "isMethod\x0a\x09^ false",
  36865. referencedClasses: [],
  36866. messageSends: []
  36867. }),
  36868. $globals.IRInstruction);
  36869. $core.addMethod(
  36870. $core.method({
  36871. selector: "isReturn",
  36872. protocol: 'testing',
  36873. fn: function (){
  36874. var self=this;
  36875. return false;
  36876. },
  36877. args: [],
  36878. source: "isReturn\x0a\x09^ false",
  36879. referencedClasses: [],
  36880. messageSends: []
  36881. }),
  36882. $globals.IRInstruction);
  36883. $core.addMethod(
  36884. $core.method({
  36885. selector: "isSend",
  36886. protocol: 'testing',
  36887. fn: function (){
  36888. var self=this;
  36889. return false;
  36890. },
  36891. args: [],
  36892. source: "isSend\x0a\x09^ false",
  36893. referencedClasses: [],
  36894. messageSends: []
  36895. }),
  36896. $globals.IRInstruction);
  36897. $core.addMethod(
  36898. $core.method({
  36899. selector: "isSequence",
  36900. protocol: 'testing',
  36901. fn: function (){
  36902. var self=this;
  36903. return false;
  36904. },
  36905. args: [],
  36906. source: "isSequence\x0a\x09^ false",
  36907. referencedClasses: [],
  36908. messageSends: []
  36909. }),
  36910. $globals.IRInstruction);
  36911. $core.addMethod(
  36912. $core.method({
  36913. selector: "isTempDeclaration",
  36914. protocol: 'testing',
  36915. fn: function (){
  36916. var self=this;
  36917. return false;
  36918. },
  36919. args: [],
  36920. source: "isTempDeclaration\x0a\x09^ false",
  36921. referencedClasses: [],
  36922. messageSends: []
  36923. }),
  36924. $globals.IRInstruction);
  36925. $core.addMethod(
  36926. $core.method({
  36927. selector: "isVariable",
  36928. protocol: 'testing',
  36929. fn: function (){
  36930. var self=this;
  36931. return false;
  36932. },
  36933. args: [],
  36934. source: "isVariable\x0a\x09^ false",
  36935. referencedClasses: [],
  36936. messageSends: []
  36937. }),
  36938. $globals.IRInstruction);
  36939. $core.addMethod(
  36940. $core.method({
  36941. selector: "method",
  36942. protocol: 'accessing',
  36943. fn: function (){
  36944. var self=this;
  36945. return $core.withContext(function($ctx1) {
  36946. var $1;
  36947. $1=$recv(self._parent())._method();
  36948. return $1;
  36949. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  36950. },
  36951. args: [],
  36952. source: "method\x0a\x09^ self parent method",
  36953. referencedClasses: [],
  36954. messageSends: ["method", "parent"]
  36955. }),
  36956. $globals.IRInstruction);
  36957. $core.addMethod(
  36958. $core.method({
  36959. selector: "needsBoxingAsReceiver",
  36960. protocol: 'testing',
  36961. fn: function (){
  36962. var self=this;
  36963. return true;
  36964. },
  36965. args: [],
  36966. source: "needsBoxingAsReceiver\x0a\x09^ true",
  36967. referencedClasses: [],
  36968. messageSends: []
  36969. }),
  36970. $globals.IRInstruction);
  36971. $core.addMethod(
  36972. $core.method({
  36973. selector: "parent",
  36974. protocol: 'accessing',
  36975. fn: function (){
  36976. var self=this;
  36977. var $1;
  36978. $1=self["@parent"];
  36979. return $1;
  36980. },
  36981. args: [],
  36982. source: "parent\x0a\x09^ parent",
  36983. referencedClasses: [],
  36984. messageSends: []
  36985. }),
  36986. $globals.IRInstruction);
  36987. $core.addMethod(
  36988. $core.method({
  36989. selector: "parent:",
  36990. protocol: 'accessing',
  36991. fn: function (anIRInstruction){
  36992. var self=this;
  36993. self["@parent"]=anIRInstruction;
  36994. return self;
  36995. },
  36996. args: ["anIRInstruction"],
  36997. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  36998. referencedClasses: [],
  36999. messageSends: []
  37000. }),
  37001. $globals.IRInstruction);
  37002. $core.addMethod(
  37003. $core.method({
  37004. selector: "remove",
  37005. protocol: 'building',
  37006. fn: function (){
  37007. var self=this;
  37008. return $core.withContext(function($ctx1) {
  37009. $recv(self._parent())._remove_(self);
  37010. return self;
  37011. }, function($ctx1) {$ctx1.fill(self,"remove",{},$globals.IRInstruction)});
  37012. },
  37013. args: [],
  37014. source: "remove\x0a\x09self parent remove: self",
  37015. referencedClasses: [],
  37016. messageSends: ["remove:", "parent"]
  37017. }),
  37018. $globals.IRInstruction);
  37019. $core.addMethod(
  37020. $core.method({
  37021. selector: "remove:",
  37022. protocol: 'building',
  37023. fn: function (anIRInstruction){
  37024. var self=this;
  37025. return $core.withContext(function($ctx1) {
  37026. $recv(self._instructions())._remove_(anIRInstruction);
  37027. return self;
  37028. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  37029. },
  37030. args: ["anIRInstruction"],
  37031. source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
  37032. referencedClasses: [],
  37033. messageSends: ["remove:", "instructions"]
  37034. }),
  37035. $globals.IRInstruction);
  37036. $core.addMethod(
  37037. $core.method({
  37038. selector: "replace:with:",
  37039. protocol: 'building',
  37040. fn: function (anIRInstruction,anotherIRInstruction){
  37041. var self=this;
  37042. return $core.withContext(function($ctx1) {
  37043. var $1;
  37044. $recv(anotherIRInstruction)._parent_(self);
  37045. $1=self._instructions();
  37046. $ctx1.sendIdx["instructions"]=1;
  37047. $recv($1)._at_put_($recv(self._instructions())._indexOf_(anIRInstruction),anotherIRInstruction);
  37048. return self;
  37049. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  37050. },
  37051. args: ["anIRInstruction", "anotherIRInstruction"],
  37052. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions\x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  37053. referencedClasses: [],
  37054. messageSends: ["parent:", "at:put:", "instructions", "indexOf:"]
  37055. }),
  37056. $globals.IRInstruction);
  37057. $core.addMethod(
  37058. $core.method({
  37059. selector: "replaceWith:",
  37060. protocol: 'building',
  37061. fn: function (anIRInstruction){
  37062. var self=this;
  37063. return $core.withContext(function($ctx1) {
  37064. $recv(self._parent())._replace_with_(self,anIRInstruction);
  37065. return self;
  37066. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  37067. },
  37068. args: ["anIRInstruction"],
  37069. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  37070. referencedClasses: [],
  37071. messageSends: ["replace:with:", "parent"]
  37072. }),
  37073. $globals.IRInstruction);
  37074. $core.addMethod(
  37075. $core.method({
  37076. selector: "scope",
  37077. protocol: 'accessing',
  37078. fn: function (){
  37079. var self=this;
  37080. return $core.withContext(function($ctx1) {
  37081. var $2,$1,$receiver;
  37082. $2=self._parent();
  37083. if(($receiver = $2) == null || $receiver.isNil){
  37084. $1=$2;
  37085. } else {
  37086. var node;
  37087. node=$receiver;
  37088. $1=$recv(node)._scope();
  37089. };
  37090. return $1;
  37091. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  37092. },
  37093. args: [],
  37094. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  37095. referencedClasses: [],
  37096. messageSends: ["ifNotNil:", "parent", "scope"]
  37097. }),
  37098. $globals.IRInstruction);
  37099. $core.addMethod(
  37100. $core.method({
  37101. selector: "on:",
  37102. protocol: 'instance creation',
  37103. fn: function (aBuilder){
  37104. var self=this;
  37105. return $core.withContext(function($ctx1) {
  37106. var $2,$3,$1;
  37107. $2=self._new();
  37108. $recv($2)._builder_(aBuilder);
  37109. $3=$recv($2)._yourself();
  37110. $1=$3;
  37111. return $1;
  37112. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.klass)});
  37113. },
  37114. args: ["aBuilder"],
  37115. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  37116. referencedClasses: [],
  37117. messageSends: ["builder:", "new", "yourself"]
  37118. }),
  37119. $globals.IRInstruction.klass);
  37120. $core.addClass('IRAssignment', $globals.IRInstruction, [], 'Compiler-IR');
  37121. $core.addMethod(
  37122. $core.method({
  37123. selector: "accept:",
  37124. protocol: 'visiting',
  37125. fn: function (aVisitor){
  37126. var self=this;
  37127. return $core.withContext(function($ctx1) {
  37128. var $1;
  37129. $1=$recv(aVisitor)._visitIRAssignment_(self);
  37130. return $1;
  37131. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRAssignment)});
  37132. },
  37133. args: ["aVisitor"],
  37134. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  37135. referencedClasses: [],
  37136. messageSends: ["visitIRAssignment:"]
  37137. }),
  37138. $globals.IRAssignment);
  37139. $core.addClass('IRDynamicArray', $globals.IRInstruction, [], 'Compiler-IR');
  37140. $core.addMethod(
  37141. $core.method({
  37142. selector: "accept:",
  37143. protocol: 'visiting',
  37144. fn: function (aVisitor){
  37145. var self=this;
  37146. return $core.withContext(function($ctx1) {
  37147. var $1;
  37148. $1=$recv(aVisitor)._visitIRDynamicArray_(self);
  37149. return $1;
  37150. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  37151. },
  37152. args: ["aVisitor"],
  37153. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  37154. referencedClasses: [],
  37155. messageSends: ["visitIRDynamicArray:"]
  37156. }),
  37157. $globals.IRDynamicArray);
  37158. $core.addClass('IRDynamicDictionary', $globals.IRInstruction, [], 'Compiler-IR');
  37159. $core.addMethod(
  37160. $core.method({
  37161. selector: "accept:",
  37162. protocol: 'visiting',
  37163. fn: function (aVisitor){
  37164. var self=this;
  37165. return $core.withContext(function($ctx1) {
  37166. var $1;
  37167. $1=$recv(aVisitor)._visitIRDynamicDictionary_(self);
  37168. return $1;
  37169. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  37170. },
  37171. args: ["aVisitor"],
  37172. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  37173. referencedClasses: [],
  37174. messageSends: ["visitIRDynamicDictionary:"]
  37175. }),
  37176. $globals.IRDynamicDictionary);
  37177. $core.addClass('IRScopedInstruction', $globals.IRInstruction, ['scope'], 'Compiler-IR');
  37178. $core.addMethod(
  37179. $core.method({
  37180. selector: "scope",
  37181. protocol: 'accessing',
  37182. fn: function (){
  37183. var self=this;
  37184. var $1;
  37185. $1=self["@scope"];
  37186. return $1;
  37187. },
  37188. args: [],
  37189. source: "scope\x0a\x09^ scope",
  37190. referencedClasses: [],
  37191. messageSends: []
  37192. }),
  37193. $globals.IRScopedInstruction);
  37194. $core.addMethod(
  37195. $core.method({
  37196. selector: "scope:",
  37197. protocol: 'accessing',
  37198. fn: function (aScope){
  37199. var self=this;
  37200. self["@scope"]=aScope;
  37201. return self;
  37202. },
  37203. args: ["aScope"],
  37204. source: "scope: aScope\x0a\x09scope := aScope",
  37205. referencedClasses: [],
  37206. messageSends: []
  37207. }),
  37208. $globals.IRScopedInstruction);
  37209. $core.addClass('IRClosureInstruction', $globals.IRScopedInstruction, ['arguments', 'requiresSmalltalkContext'], 'Compiler-IR');
  37210. $core.addMethod(
  37211. $core.method({
  37212. selector: "arguments",
  37213. protocol: 'accessing',
  37214. fn: function (){
  37215. var self=this;
  37216. return $core.withContext(function($ctx1) {
  37217. var $2,$1,$receiver;
  37218. $2=self["@arguments"];
  37219. if(($receiver = $2) == null || $receiver.isNil){
  37220. $1=[];
  37221. } else {
  37222. $1=$2;
  37223. };
  37224. return $1;
  37225. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  37226. },
  37227. args: [],
  37228. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  37229. referencedClasses: [],
  37230. messageSends: ["ifNil:"]
  37231. }),
  37232. $globals.IRClosureInstruction);
  37233. $core.addMethod(
  37234. $core.method({
  37235. selector: "arguments:",
  37236. protocol: 'accessing',
  37237. fn: function (aCollection){
  37238. var self=this;
  37239. self["@arguments"]=aCollection;
  37240. return self;
  37241. },
  37242. args: ["aCollection"],
  37243. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  37244. referencedClasses: [],
  37245. messageSends: []
  37246. }),
  37247. $globals.IRClosureInstruction);
  37248. $core.addMethod(
  37249. $core.method({
  37250. selector: "locals",
  37251. protocol: 'accessing',
  37252. fn: function (){
  37253. var self=this;
  37254. return $core.withContext(function($ctx1) {
  37255. var $2,$3,$1;
  37256. $2=$recv(self._arguments())._copy();
  37257. $recv($2)._addAll_($recv(self._tempDeclarations())._collect_((function(each){
  37258. return $core.withContext(function($ctx2) {
  37259. return $recv(each)._name();
  37260. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37261. })));
  37262. $3=$recv($2)._yourself();
  37263. $1=$3;
  37264. return $1;
  37265. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  37266. },
  37267. args: [],
  37268. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  37269. referencedClasses: [],
  37270. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  37271. }),
  37272. $globals.IRClosureInstruction);
  37273. $core.addMethod(
  37274. $core.method({
  37275. selector: "requiresSmalltalkContext",
  37276. protocol: 'accessing',
  37277. fn: function (){
  37278. var self=this;
  37279. return $core.withContext(function($ctx1) {
  37280. var $2,$1,$receiver;
  37281. $2=self["@requiresSmalltalkContext"];
  37282. if(($receiver = $2) == null || $receiver.isNil){
  37283. $1=false;
  37284. } else {
  37285. $1=$2;
  37286. };
  37287. return $1;
  37288. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  37289. },
  37290. args: [],
  37291. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  37292. referencedClasses: [],
  37293. messageSends: ["ifNil:"]
  37294. }),
  37295. $globals.IRClosureInstruction);
  37296. $core.addMethod(
  37297. $core.method({
  37298. selector: "requiresSmalltalkContext:",
  37299. protocol: 'accessing',
  37300. fn: function (anObject){
  37301. var self=this;
  37302. self["@requiresSmalltalkContext"]=anObject;
  37303. return self;
  37304. },
  37305. args: ["anObject"],
  37306. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  37307. referencedClasses: [],
  37308. messageSends: []
  37309. }),
  37310. $globals.IRClosureInstruction);
  37311. $core.addMethod(
  37312. $core.method({
  37313. selector: "scope:",
  37314. protocol: 'accessing',
  37315. fn: function (aScope){
  37316. var self=this;
  37317. return $core.withContext(function($ctx1) {
  37318. (
  37319. $ctx1.supercall = true,
  37320. $globals.IRClosureInstruction.superclass.fn.prototype._scope_.apply($recv(self), [aScope]));
  37321. $ctx1.supercall = false;
  37322. $recv(aScope)._instruction_(self);
  37323. return self;
  37324. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  37325. },
  37326. args: ["aScope"],
  37327. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  37328. referencedClasses: [],
  37329. messageSends: ["scope:", "instruction:"]
  37330. }),
  37331. $globals.IRClosureInstruction);
  37332. $core.addMethod(
  37333. $core.method({
  37334. selector: "tempDeclarations",
  37335. protocol: 'accessing',
  37336. fn: function (){
  37337. var self=this;
  37338. return $core.withContext(function($ctx1) {
  37339. var $1;
  37340. $1=$recv(self._instructions())._select_((function(each){
  37341. return $core.withContext(function($ctx2) {
  37342. return $recv(each)._isTempDeclaration();
  37343. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37344. }));
  37345. return $1;
  37346. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  37347. },
  37348. args: [],
  37349. source: "tempDeclarations\x0a\x09^ self instructions select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  37350. referencedClasses: [],
  37351. messageSends: ["select:", "instructions", "isTempDeclaration"]
  37352. }),
  37353. $globals.IRClosureInstruction);
  37354. $core.addClass('IRClosure', $globals.IRClosureInstruction, [], 'Compiler-IR');
  37355. $core.addMethod(
  37356. $core.method({
  37357. selector: "accept:",
  37358. protocol: 'visiting',
  37359. fn: function (aVisitor){
  37360. var self=this;
  37361. return $core.withContext(function($ctx1) {
  37362. var $1;
  37363. $1=$recv(aVisitor)._visitIRClosure_(self);
  37364. return $1;
  37365. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRClosure)});
  37366. },
  37367. args: ["aVisitor"],
  37368. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  37369. referencedClasses: [],
  37370. messageSends: ["visitIRClosure:"]
  37371. }),
  37372. $globals.IRClosure);
  37373. $core.addMethod(
  37374. $core.method({
  37375. selector: "isClosure",
  37376. protocol: 'testing',
  37377. fn: function (){
  37378. var self=this;
  37379. return true;
  37380. },
  37381. args: [],
  37382. source: "isClosure\x0a\x09^ true",
  37383. referencedClasses: [],
  37384. messageSends: []
  37385. }),
  37386. $globals.IRClosure);
  37387. $core.addMethod(
  37388. $core.method({
  37389. selector: "sequence",
  37390. protocol: 'accessing',
  37391. fn: function (){
  37392. var self=this;
  37393. return $core.withContext(function($ctx1) {
  37394. var $1;
  37395. $1=$recv(self._instructions())._last();
  37396. return $1;
  37397. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  37398. },
  37399. args: [],
  37400. source: "sequence\x0a\x09^ self instructions last",
  37401. referencedClasses: [],
  37402. messageSends: ["last", "instructions"]
  37403. }),
  37404. $globals.IRClosure);
  37405. $core.addClass('IRMethod', $globals.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'sendIndexes', 'superSends', 'requiresSmalltalkContext', 'internalVariables'], 'Compiler-IR');
  37406. $globals.IRMethod.comment="I am a method instruction";
  37407. $core.addMethod(
  37408. $core.method({
  37409. selector: "accept:",
  37410. protocol: 'visiting',
  37411. fn: function (aVisitor){
  37412. var self=this;
  37413. return $core.withContext(function($ctx1) {
  37414. var $1;
  37415. $1=$recv(aVisitor)._visitIRMethod_(self);
  37416. return $1;
  37417. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRMethod)});
  37418. },
  37419. args: ["aVisitor"],
  37420. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  37421. referencedClasses: [],
  37422. messageSends: ["visitIRMethod:"]
  37423. }),
  37424. $globals.IRMethod);
  37425. $core.addMethod(
  37426. $core.method({
  37427. selector: "classReferences",
  37428. protocol: 'accessing',
  37429. fn: function (){
  37430. var self=this;
  37431. var $1;
  37432. $1=self["@classReferences"];
  37433. return $1;
  37434. },
  37435. args: [],
  37436. source: "classReferences\x0a\x09^ classReferences",
  37437. referencedClasses: [],
  37438. messageSends: []
  37439. }),
  37440. $globals.IRMethod);
  37441. $core.addMethod(
  37442. $core.method({
  37443. selector: "classReferences:",
  37444. protocol: 'accessing',
  37445. fn: function (aCollection){
  37446. var self=this;
  37447. self["@classReferences"]=aCollection;
  37448. return self;
  37449. },
  37450. args: ["aCollection"],
  37451. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  37452. referencedClasses: [],
  37453. messageSends: []
  37454. }),
  37455. $globals.IRMethod);
  37456. $core.addMethod(
  37457. $core.method({
  37458. selector: "internalVariables",
  37459. protocol: 'accessing',
  37460. fn: function (){
  37461. var self=this;
  37462. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  37463. return $core.withContext(function($ctx1) {
  37464. var $2,$1,$receiver;
  37465. $2=self["@internalVariables"];
  37466. if(($receiver = $2) == null || $receiver.isNil){
  37467. self["@internalVariables"]=$recv($Set())._new();
  37468. $1=self["@internalVariables"];
  37469. } else {
  37470. $1=$2;
  37471. };
  37472. return $1;
  37473. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  37474. },
  37475. args: [],
  37476. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  37477. referencedClasses: ["Set"],
  37478. messageSends: ["ifNil:", "new"]
  37479. }),
  37480. $globals.IRMethod);
  37481. $core.addMethod(
  37482. $core.method({
  37483. selector: "isMethod",
  37484. protocol: 'accessing',
  37485. fn: function (){
  37486. var self=this;
  37487. return true;
  37488. },
  37489. args: [],
  37490. source: "isMethod\x0a\x09^ true",
  37491. referencedClasses: [],
  37492. messageSends: []
  37493. }),
  37494. $globals.IRMethod);
  37495. $core.addMethod(
  37496. $core.method({
  37497. selector: "messageSends",
  37498. protocol: 'accessing',
  37499. fn: function (){
  37500. var self=this;
  37501. return $core.withContext(function($ctx1) {
  37502. var $1;
  37503. $1=$recv(self._sendIndexes())._keys();
  37504. return $1;
  37505. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  37506. },
  37507. args: [],
  37508. source: "messageSends\x0a\x09^ self sendIndexes keys",
  37509. referencedClasses: [],
  37510. messageSends: ["keys", "sendIndexes"]
  37511. }),
  37512. $globals.IRMethod);
  37513. $core.addMethod(
  37514. $core.method({
  37515. selector: "method",
  37516. protocol: 'accessing',
  37517. fn: function (){
  37518. var self=this;
  37519. return self;
  37520. },
  37521. args: [],
  37522. source: "method\x0a\x09^ self",
  37523. referencedClasses: [],
  37524. messageSends: []
  37525. }),
  37526. $globals.IRMethod);
  37527. $core.addMethod(
  37528. $core.method({
  37529. selector: "selector",
  37530. protocol: 'accessing',
  37531. fn: function (){
  37532. var self=this;
  37533. var $1;
  37534. $1=self["@selector"];
  37535. return $1;
  37536. },
  37537. args: [],
  37538. source: "selector\x0a\x09^ selector",
  37539. referencedClasses: [],
  37540. messageSends: []
  37541. }),
  37542. $globals.IRMethod);
  37543. $core.addMethod(
  37544. $core.method({
  37545. selector: "selector:",
  37546. protocol: 'accessing',
  37547. fn: function (aString){
  37548. var self=this;
  37549. self["@selector"]=aString;
  37550. return self;
  37551. },
  37552. args: ["aString"],
  37553. source: "selector: aString\x0a\x09selector := aString",
  37554. referencedClasses: [],
  37555. messageSends: []
  37556. }),
  37557. $globals.IRMethod);
  37558. $core.addMethod(
  37559. $core.method({
  37560. selector: "sendIndexes",
  37561. protocol: 'accessing',
  37562. fn: function (){
  37563. var self=this;
  37564. var $1;
  37565. $1=self["@sendIndexes"];
  37566. return $1;
  37567. },
  37568. args: [],
  37569. source: "sendIndexes\x0a\x09^ sendIndexes",
  37570. referencedClasses: [],
  37571. messageSends: []
  37572. }),
  37573. $globals.IRMethod);
  37574. $core.addMethod(
  37575. $core.method({
  37576. selector: "sendIndexes:",
  37577. protocol: 'accessing',
  37578. fn: function (aDictionary){
  37579. var self=this;
  37580. self["@sendIndexes"]=aDictionary;
  37581. return self;
  37582. },
  37583. args: ["aDictionary"],
  37584. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  37585. referencedClasses: [],
  37586. messageSends: []
  37587. }),
  37588. $globals.IRMethod);
  37589. $core.addMethod(
  37590. $core.method({
  37591. selector: "source",
  37592. protocol: 'accessing',
  37593. fn: function (){
  37594. var self=this;
  37595. var $1;
  37596. $1=self["@source"];
  37597. return $1;
  37598. },
  37599. args: [],
  37600. source: "source\x0a\x09^ source",
  37601. referencedClasses: [],
  37602. messageSends: []
  37603. }),
  37604. $globals.IRMethod);
  37605. $core.addMethod(
  37606. $core.method({
  37607. selector: "source:",
  37608. protocol: 'accessing',
  37609. fn: function (aString){
  37610. var self=this;
  37611. self["@source"]=aString;
  37612. return self;
  37613. },
  37614. args: ["aString"],
  37615. source: "source: aString\x0a\x09source := aString",
  37616. referencedClasses: [],
  37617. messageSends: []
  37618. }),
  37619. $globals.IRMethod);
  37620. $core.addMethod(
  37621. $core.method({
  37622. selector: "superSends",
  37623. protocol: 'accessing',
  37624. fn: function (){
  37625. var self=this;
  37626. var $1;
  37627. $1=self["@superSends"];
  37628. return $1;
  37629. },
  37630. args: [],
  37631. source: "superSends\x0a\x09^ superSends",
  37632. referencedClasses: [],
  37633. messageSends: []
  37634. }),
  37635. $globals.IRMethod);
  37636. $core.addMethod(
  37637. $core.method({
  37638. selector: "superSends:",
  37639. protocol: 'accessing',
  37640. fn: function (aCollection){
  37641. var self=this;
  37642. self["@superSends"]=aCollection;
  37643. return self;
  37644. },
  37645. args: ["aCollection"],
  37646. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  37647. referencedClasses: [],
  37648. messageSends: []
  37649. }),
  37650. $globals.IRMethod);
  37651. $core.addMethod(
  37652. $core.method({
  37653. selector: "theClass",
  37654. protocol: 'accessing',
  37655. fn: function (){
  37656. var self=this;
  37657. var $1;
  37658. $1=self["@theClass"];
  37659. return $1;
  37660. },
  37661. args: [],
  37662. source: "theClass\x0a\x09^ theClass",
  37663. referencedClasses: [],
  37664. messageSends: []
  37665. }),
  37666. $globals.IRMethod);
  37667. $core.addMethod(
  37668. $core.method({
  37669. selector: "theClass:",
  37670. protocol: 'accessing',
  37671. fn: function (aClass){
  37672. var self=this;
  37673. self["@theClass"]=aClass;
  37674. return self;
  37675. },
  37676. args: ["aClass"],
  37677. source: "theClass: aClass\x0a\x09theClass := aClass",
  37678. referencedClasses: [],
  37679. messageSends: []
  37680. }),
  37681. $globals.IRMethod);
  37682. $core.addClass('IRReturn', $globals.IRScopedInstruction, [], 'Compiler-IR');
  37683. $globals.IRReturn.comment="I am a local return instruction.";
  37684. $core.addMethod(
  37685. $core.method({
  37686. selector: "accept:",
  37687. protocol: 'visiting',
  37688. fn: function (aVisitor){
  37689. var self=this;
  37690. return $core.withContext(function($ctx1) {
  37691. var $1;
  37692. $1=$recv(aVisitor)._visitIRReturn_(self);
  37693. return $1;
  37694. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRReturn)});
  37695. },
  37696. args: ["aVisitor"],
  37697. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  37698. referencedClasses: [],
  37699. messageSends: ["visitIRReturn:"]
  37700. }),
  37701. $globals.IRReturn);
  37702. $core.addMethod(
  37703. $core.method({
  37704. selector: "canBeAssigned",
  37705. protocol: 'testing',
  37706. fn: function (){
  37707. var self=this;
  37708. return false;
  37709. },
  37710. args: [],
  37711. source: "canBeAssigned\x0a\x09^ false",
  37712. referencedClasses: [],
  37713. messageSends: []
  37714. }),
  37715. $globals.IRReturn);
  37716. $core.addMethod(
  37717. $core.method({
  37718. selector: "isBlockReturn",
  37719. protocol: 'testing',
  37720. fn: function (){
  37721. var self=this;
  37722. return false;
  37723. },
  37724. args: [],
  37725. source: "isBlockReturn\x0a\x09^ false",
  37726. referencedClasses: [],
  37727. messageSends: []
  37728. }),
  37729. $globals.IRReturn);
  37730. $core.addMethod(
  37731. $core.method({
  37732. selector: "isLocalReturn",
  37733. protocol: 'testing',
  37734. fn: function (){
  37735. var self=this;
  37736. return true;
  37737. },
  37738. args: [],
  37739. source: "isLocalReturn\x0a\x09^ true",
  37740. referencedClasses: [],
  37741. messageSends: []
  37742. }),
  37743. $globals.IRReturn);
  37744. $core.addMethod(
  37745. $core.method({
  37746. selector: "isNonLocalReturn",
  37747. protocol: 'testing',
  37748. fn: function (){
  37749. var self=this;
  37750. return $core.withContext(function($ctx1) {
  37751. var $1;
  37752. $1=$recv(self._isLocalReturn())._not();
  37753. return $1;
  37754. }, function($ctx1) {$ctx1.fill(self,"isNonLocalReturn",{},$globals.IRReturn)});
  37755. },
  37756. args: [],
  37757. source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
  37758. referencedClasses: [],
  37759. messageSends: ["not", "isLocalReturn"]
  37760. }),
  37761. $globals.IRReturn);
  37762. $core.addMethod(
  37763. $core.method({
  37764. selector: "isReturn",
  37765. protocol: 'testing',
  37766. fn: function (){
  37767. var self=this;
  37768. return true;
  37769. },
  37770. args: [],
  37771. source: "isReturn\x0a\x09^ true",
  37772. referencedClasses: [],
  37773. messageSends: []
  37774. }),
  37775. $globals.IRReturn);
  37776. $core.addMethod(
  37777. $core.method({
  37778. selector: "scope",
  37779. protocol: 'accessing',
  37780. fn: function (){
  37781. var self=this;
  37782. return $core.withContext(function($ctx1) {
  37783. var $2,$1,$receiver;
  37784. $2=self["@scope"];
  37785. if(($receiver = $2) == null || $receiver.isNil){
  37786. $1=$recv(self._parent())._scope();
  37787. } else {
  37788. $1=$2;
  37789. };
  37790. return $1;
  37791. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  37792. },
  37793. args: [],
  37794. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  37795. referencedClasses: [],
  37796. messageSends: ["ifNil:", "scope", "parent"]
  37797. }),
  37798. $globals.IRReturn);
  37799. $core.addClass('IRBlockReturn', $globals.IRReturn, [], 'Compiler-IR');
  37800. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  37801. $core.addMethod(
  37802. $core.method({
  37803. selector: "accept:",
  37804. protocol: 'visiting',
  37805. fn: function (aVisitor){
  37806. var self=this;
  37807. return $core.withContext(function($ctx1) {
  37808. var $1;
  37809. $1=$recv(aVisitor)._visitIRBlockReturn_(self);
  37810. return $1;
  37811. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  37812. },
  37813. args: ["aVisitor"],
  37814. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  37815. referencedClasses: [],
  37816. messageSends: ["visitIRBlockReturn:"]
  37817. }),
  37818. $globals.IRBlockReturn);
  37819. $core.addMethod(
  37820. $core.method({
  37821. selector: "isBlockReturn",
  37822. protocol: 'testing',
  37823. fn: function (){
  37824. var self=this;
  37825. return true;
  37826. },
  37827. args: [],
  37828. source: "isBlockReturn\x0a\x09^ true",
  37829. referencedClasses: [],
  37830. messageSends: []
  37831. }),
  37832. $globals.IRBlockReturn);
  37833. $core.addClass('IRNonLocalReturn', $globals.IRReturn, [], 'Compiler-IR');
  37834. $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.";
  37835. $core.addMethod(
  37836. $core.method({
  37837. selector: "accept:",
  37838. protocol: 'visiting',
  37839. fn: function (aVisitor){
  37840. var self=this;
  37841. return $core.withContext(function($ctx1) {
  37842. var $1;
  37843. $1=$recv(aVisitor)._visitIRNonLocalReturn_(self);
  37844. return $1;
  37845. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  37846. },
  37847. args: ["aVisitor"],
  37848. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  37849. referencedClasses: [],
  37850. messageSends: ["visitIRNonLocalReturn:"]
  37851. }),
  37852. $globals.IRNonLocalReturn);
  37853. $core.addMethod(
  37854. $core.method({
  37855. selector: "isLocalReturn",
  37856. protocol: 'testing',
  37857. fn: function (){
  37858. var self=this;
  37859. return false;
  37860. },
  37861. args: [],
  37862. source: "isLocalReturn\x0a\x09^ false",
  37863. referencedClasses: [],
  37864. messageSends: []
  37865. }),
  37866. $globals.IRNonLocalReturn);
  37867. $core.addClass('IRTempDeclaration', $globals.IRScopedInstruction, ['name'], 'Compiler-IR');
  37868. $core.addMethod(
  37869. $core.method({
  37870. selector: "accept:",
  37871. protocol: 'visiting',
  37872. fn: function (aVisitor){
  37873. var self=this;
  37874. return $core.withContext(function($ctx1) {
  37875. var $1;
  37876. $1=$recv(aVisitor)._visitIRTempDeclaration_(self);
  37877. return $1;
  37878. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  37879. },
  37880. args: ["aVisitor"],
  37881. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  37882. referencedClasses: [],
  37883. messageSends: ["visitIRTempDeclaration:"]
  37884. }),
  37885. $globals.IRTempDeclaration);
  37886. $core.addMethod(
  37887. $core.method({
  37888. selector: "isTempDeclaration",
  37889. protocol: 'testing',
  37890. fn: function (){
  37891. var self=this;
  37892. return true;
  37893. },
  37894. args: [],
  37895. source: "isTempDeclaration\x0a\x09^ true",
  37896. referencedClasses: [],
  37897. messageSends: []
  37898. }),
  37899. $globals.IRTempDeclaration);
  37900. $core.addMethod(
  37901. $core.method({
  37902. selector: "name",
  37903. protocol: 'accessing',
  37904. fn: function (){
  37905. var self=this;
  37906. var $1;
  37907. $1=self["@name"];
  37908. return $1;
  37909. },
  37910. args: [],
  37911. source: "name\x0a\x09^ name",
  37912. referencedClasses: [],
  37913. messageSends: []
  37914. }),
  37915. $globals.IRTempDeclaration);
  37916. $core.addMethod(
  37917. $core.method({
  37918. selector: "name:",
  37919. protocol: 'accessing',
  37920. fn: function (aString){
  37921. var self=this;
  37922. self["@name"]=aString;
  37923. return self;
  37924. },
  37925. args: ["aString"],
  37926. source: "name: aString\x0a\x09name := aString",
  37927. referencedClasses: [],
  37928. messageSends: []
  37929. }),
  37930. $globals.IRTempDeclaration);
  37931. $core.addClass('IRSend', $globals.IRInstruction, ['selector', 'classSend', 'index'], 'Compiler-IR');
  37932. $globals.IRSend.comment="I am a message send instruction.";
  37933. $core.addMethod(
  37934. $core.method({
  37935. selector: "accept:",
  37936. protocol: 'visiting',
  37937. fn: function (aVisitor){
  37938. var self=this;
  37939. return $core.withContext(function($ctx1) {
  37940. var $1;
  37941. $1=$recv(aVisitor)._visitIRSend_(self);
  37942. return $1;
  37943. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSend)});
  37944. },
  37945. args: ["aVisitor"],
  37946. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  37947. referencedClasses: [],
  37948. messageSends: ["visitIRSend:"]
  37949. }),
  37950. $globals.IRSend);
  37951. $core.addMethod(
  37952. $core.method({
  37953. selector: "classSend",
  37954. protocol: 'accessing',
  37955. fn: function (){
  37956. var self=this;
  37957. var $1;
  37958. $1=self["@classSend"];
  37959. return $1;
  37960. },
  37961. args: [],
  37962. source: "classSend\x0a\x09^ classSend",
  37963. referencedClasses: [],
  37964. messageSends: []
  37965. }),
  37966. $globals.IRSend);
  37967. $core.addMethod(
  37968. $core.method({
  37969. selector: "classSend:",
  37970. protocol: 'accessing',
  37971. fn: function (aClass){
  37972. var self=this;
  37973. self["@classSend"]=aClass;
  37974. return self;
  37975. },
  37976. args: ["aClass"],
  37977. source: "classSend: aClass\x0a\x09classSend := aClass",
  37978. referencedClasses: [],
  37979. messageSends: []
  37980. }),
  37981. $globals.IRSend);
  37982. $core.addMethod(
  37983. $core.method({
  37984. selector: "index",
  37985. protocol: 'accessing',
  37986. fn: function (){
  37987. var self=this;
  37988. var $1;
  37989. $1=self["@index"];
  37990. return $1;
  37991. },
  37992. args: [],
  37993. source: "index\x0a\x09^ index",
  37994. referencedClasses: [],
  37995. messageSends: []
  37996. }),
  37997. $globals.IRSend);
  37998. $core.addMethod(
  37999. $core.method({
  38000. selector: "index:",
  38001. protocol: 'accessing',
  38002. fn: function (anInteger){
  38003. var self=this;
  38004. self["@index"]=anInteger;
  38005. return self;
  38006. },
  38007. args: ["anInteger"],
  38008. source: "index: anInteger\x0a\x09index := anInteger",
  38009. referencedClasses: [],
  38010. messageSends: []
  38011. }),
  38012. $globals.IRSend);
  38013. $core.addMethod(
  38014. $core.method({
  38015. selector: "isSend",
  38016. protocol: 'testing',
  38017. fn: function (){
  38018. var self=this;
  38019. return true;
  38020. },
  38021. args: [],
  38022. source: "isSend\x0a\x09^ true",
  38023. referencedClasses: [],
  38024. messageSends: []
  38025. }),
  38026. $globals.IRSend);
  38027. $core.addMethod(
  38028. $core.method({
  38029. selector: "selector",
  38030. protocol: 'accessing',
  38031. fn: function (){
  38032. var self=this;
  38033. var $1;
  38034. $1=self["@selector"];
  38035. return $1;
  38036. },
  38037. args: [],
  38038. source: "selector\x0a\x09^ selector",
  38039. referencedClasses: [],
  38040. messageSends: []
  38041. }),
  38042. $globals.IRSend);
  38043. $core.addMethod(
  38044. $core.method({
  38045. selector: "selector:",
  38046. protocol: 'accessing',
  38047. fn: function (aString){
  38048. var self=this;
  38049. self["@selector"]=aString;
  38050. return self;
  38051. },
  38052. args: ["aString"],
  38053. source: "selector: aString\x0a\x09selector := aString",
  38054. referencedClasses: [],
  38055. messageSends: []
  38056. }),
  38057. $globals.IRSend);
  38058. $core.addClass('IRSequence', $globals.IRInstruction, [], 'Compiler-IR');
  38059. $core.addMethod(
  38060. $core.method({
  38061. selector: "accept:",
  38062. protocol: 'visiting',
  38063. fn: function (aVisitor){
  38064. var self=this;
  38065. return $core.withContext(function($ctx1) {
  38066. var $1;
  38067. $1=$recv(aVisitor)._visitIRSequence_(self);
  38068. return $1;
  38069. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSequence)});
  38070. },
  38071. args: ["aVisitor"],
  38072. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  38073. referencedClasses: [],
  38074. messageSends: ["visitIRSequence:"]
  38075. }),
  38076. $globals.IRSequence);
  38077. $core.addMethod(
  38078. $core.method({
  38079. selector: "isSequence",
  38080. protocol: 'testing',
  38081. fn: function (){
  38082. var self=this;
  38083. return true;
  38084. },
  38085. args: [],
  38086. source: "isSequence\x0a\x09^ true",
  38087. referencedClasses: [],
  38088. messageSends: []
  38089. }),
  38090. $globals.IRSequence);
  38091. $core.addClass('IRBlockSequence', $globals.IRSequence, [], 'Compiler-IR');
  38092. $core.addMethod(
  38093. $core.method({
  38094. selector: "accept:",
  38095. protocol: 'visiting',
  38096. fn: function (aVisitor){
  38097. var self=this;
  38098. return $core.withContext(function($ctx1) {
  38099. var $1;
  38100. $1=$recv(aVisitor)._visitIRBlockSequence_(self);
  38101. return $1;
  38102. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  38103. },
  38104. args: ["aVisitor"],
  38105. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  38106. referencedClasses: [],
  38107. messageSends: ["visitIRBlockSequence:"]
  38108. }),
  38109. $globals.IRBlockSequence);
  38110. $core.addClass('IRValue', $globals.IRInstruction, ['value'], 'Compiler-IR');
  38111. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  38112. $core.addMethod(
  38113. $core.method({
  38114. selector: "accept:",
  38115. protocol: 'visiting',
  38116. fn: function (aVisitor){
  38117. var self=this;
  38118. return $core.withContext(function($ctx1) {
  38119. var $1;
  38120. $1=$recv(aVisitor)._visitIRValue_(self);
  38121. return $1;
  38122. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRValue)});
  38123. },
  38124. args: ["aVisitor"],
  38125. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  38126. referencedClasses: [],
  38127. messageSends: ["visitIRValue:"]
  38128. }),
  38129. $globals.IRValue);
  38130. $core.addMethod(
  38131. $core.method({
  38132. selector: "needsBoxingAsReceiver",
  38133. protocol: 'testing',
  38134. fn: function (){
  38135. var self=this;
  38136. return false;
  38137. },
  38138. args: [],
  38139. source: "needsBoxingAsReceiver\x0a\x09^ false",
  38140. referencedClasses: [],
  38141. messageSends: []
  38142. }),
  38143. $globals.IRValue);
  38144. $core.addMethod(
  38145. $core.method({
  38146. selector: "value",
  38147. protocol: 'accessing',
  38148. fn: function (){
  38149. var self=this;
  38150. var $1;
  38151. $1=self["@value"];
  38152. return $1;
  38153. },
  38154. args: [],
  38155. source: "value\x0a\x09^ value",
  38156. referencedClasses: [],
  38157. messageSends: []
  38158. }),
  38159. $globals.IRValue);
  38160. $core.addMethod(
  38161. $core.method({
  38162. selector: "value:",
  38163. protocol: 'accessing',
  38164. fn: function (aString){
  38165. var self=this;
  38166. self["@value"]=aString;
  38167. return self;
  38168. },
  38169. args: ["aString"],
  38170. source: "value: aString\x0a\x09value := aString",
  38171. referencedClasses: [],
  38172. messageSends: []
  38173. }),
  38174. $globals.IRValue);
  38175. $core.addClass('IRVariable', $globals.IRInstruction, ['variable'], 'Compiler-IR');
  38176. $globals.IRVariable.comment="I am a variable instruction.";
  38177. $core.addMethod(
  38178. $core.method({
  38179. selector: "accept:",
  38180. protocol: 'visiting',
  38181. fn: function (aVisitor){
  38182. var self=this;
  38183. return $core.withContext(function($ctx1) {
  38184. var $1;
  38185. $1=$recv(aVisitor)._visitIRVariable_(self);
  38186. return $1;
  38187. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVariable)});
  38188. },
  38189. args: ["aVisitor"],
  38190. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  38191. referencedClasses: [],
  38192. messageSends: ["visitIRVariable:"]
  38193. }),
  38194. $globals.IRVariable);
  38195. $core.addMethod(
  38196. $core.method({
  38197. selector: "isVariable",
  38198. protocol: 'testing',
  38199. fn: function (){
  38200. var self=this;
  38201. return true;
  38202. },
  38203. args: [],
  38204. source: "isVariable\x0a\x09^ true",
  38205. referencedClasses: [],
  38206. messageSends: []
  38207. }),
  38208. $globals.IRVariable);
  38209. $core.addMethod(
  38210. $core.method({
  38211. selector: "needsBoxingAsReceiver",
  38212. protocol: 'testing',
  38213. fn: function (){
  38214. var self=this;
  38215. return $core.withContext(function($ctx1) {
  38216. var $1;
  38217. $1=$recv($recv(self._variable())._isPseudoVar())._not();
  38218. return $1;
  38219. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  38220. },
  38221. args: [],
  38222. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  38223. referencedClasses: [],
  38224. messageSends: ["not", "isPseudoVar", "variable"]
  38225. }),
  38226. $globals.IRVariable);
  38227. $core.addMethod(
  38228. $core.method({
  38229. selector: "variable",
  38230. protocol: 'accessing',
  38231. fn: function (){
  38232. var self=this;
  38233. var $1;
  38234. $1=self["@variable"];
  38235. return $1;
  38236. },
  38237. args: [],
  38238. source: "variable\x0a\x09^ variable",
  38239. referencedClasses: [],
  38240. messageSends: []
  38241. }),
  38242. $globals.IRVariable);
  38243. $core.addMethod(
  38244. $core.method({
  38245. selector: "variable:",
  38246. protocol: 'accessing',
  38247. fn: function (aScopeVariable){
  38248. var self=this;
  38249. self["@variable"]=aScopeVariable;
  38250. return self;
  38251. },
  38252. args: ["aScopeVariable"],
  38253. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  38254. referencedClasses: [],
  38255. messageSends: []
  38256. }),
  38257. $globals.IRVariable);
  38258. $core.addClass('IRVerbatim', $globals.IRInstruction, ['source'], 'Compiler-IR');
  38259. $core.addMethod(
  38260. $core.method({
  38261. selector: "accept:",
  38262. protocol: 'visiting',
  38263. fn: function (aVisitor){
  38264. var self=this;
  38265. return $core.withContext(function($ctx1) {
  38266. var $1;
  38267. $1=$recv(aVisitor)._visitIRVerbatim_(self);
  38268. return $1;
  38269. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  38270. },
  38271. args: ["aVisitor"],
  38272. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  38273. referencedClasses: [],
  38274. messageSends: ["visitIRVerbatim:"]
  38275. }),
  38276. $globals.IRVerbatim);
  38277. $core.addMethod(
  38278. $core.method({
  38279. selector: "source",
  38280. protocol: 'accessing',
  38281. fn: function (){
  38282. var self=this;
  38283. var $1;
  38284. $1=self["@source"];
  38285. return $1;
  38286. },
  38287. args: [],
  38288. source: "source\x0a\x09^ source",
  38289. referencedClasses: [],
  38290. messageSends: []
  38291. }),
  38292. $globals.IRVerbatim);
  38293. $core.addMethod(
  38294. $core.method({
  38295. selector: "source:",
  38296. protocol: 'accessing',
  38297. fn: function (aString){
  38298. var self=this;
  38299. self["@source"]=aString;
  38300. return self;
  38301. },
  38302. args: ["aString"],
  38303. source: "source: aString\x0a\x09source := aString",
  38304. referencedClasses: [],
  38305. messageSends: []
  38306. }),
  38307. $globals.IRVerbatim);
  38308. $core.addClass('IRVisitor', $globals.Object, [], 'Compiler-IR');
  38309. $core.addMethod(
  38310. $core.method({
  38311. selector: "visit:",
  38312. protocol: 'visiting',
  38313. fn: function (anIRInstruction){
  38314. var self=this;
  38315. return $core.withContext(function($ctx1) {
  38316. var $1;
  38317. $1=$recv(anIRInstruction)._accept_(self);
  38318. return $1;
  38319. }, function($ctx1) {$ctx1.fill(self,"visit:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)});
  38320. },
  38321. args: ["anIRInstruction"],
  38322. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  38323. referencedClasses: [],
  38324. messageSends: ["accept:"]
  38325. }),
  38326. $globals.IRVisitor);
  38327. $core.addMethod(
  38328. $core.method({
  38329. selector: "visitIRAssignment:",
  38330. protocol: 'visiting',
  38331. fn: function (anIRAssignment){
  38332. var self=this;
  38333. return $core.withContext(function($ctx1) {
  38334. var $1;
  38335. $1=self._visitIRInstruction_(anIRAssignment);
  38336. return $1;
  38337. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  38338. },
  38339. args: ["anIRAssignment"],
  38340. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  38341. referencedClasses: [],
  38342. messageSends: ["visitIRInstruction:"]
  38343. }),
  38344. $globals.IRVisitor);
  38345. $core.addMethod(
  38346. $core.method({
  38347. selector: "visitIRBlockReturn:",
  38348. protocol: 'visiting',
  38349. fn: function (anIRBlockReturn){
  38350. var self=this;
  38351. return $core.withContext(function($ctx1) {
  38352. var $1;
  38353. $1=self._visitIRReturn_(anIRBlockReturn);
  38354. return $1;
  38355. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  38356. },
  38357. args: ["anIRBlockReturn"],
  38358. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  38359. referencedClasses: [],
  38360. messageSends: ["visitIRReturn:"]
  38361. }),
  38362. $globals.IRVisitor);
  38363. $core.addMethod(
  38364. $core.method({
  38365. selector: "visitIRBlockSequence:",
  38366. protocol: 'visiting',
  38367. fn: function (anIRBlockSequence){
  38368. var self=this;
  38369. return $core.withContext(function($ctx1) {
  38370. var $1;
  38371. $1=self._visitIRSequence_(anIRBlockSequence);
  38372. return $1;
  38373. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  38374. },
  38375. args: ["anIRBlockSequence"],
  38376. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  38377. referencedClasses: [],
  38378. messageSends: ["visitIRSequence:"]
  38379. }),
  38380. $globals.IRVisitor);
  38381. $core.addMethod(
  38382. $core.method({
  38383. selector: "visitIRClosure:",
  38384. protocol: 'visiting',
  38385. fn: function (anIRClosure){
  38386. var self=this;
  38387. return $core.withContext(function($ctx1) {
  38388. var $1;
  38389. $1=self._visitIRInstruction_(anIRClosure);
  38390. return $1;
  38391. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  38392. },
  38393. args: ["anIRClosure"],
  38394. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  38395. referencedClasses: [],
  38396. messageSends: ["visitIRInstruction:"]
  38397. }),
  38398. $globals.IRVisitor);
  38399. $core.addMethod(
  38400. $core.method({
  38401. selector: "visitIRDynamicArray:",
  38402. protocol: 'visiting',
  38403. fn: function (anIRDynamicArray){
  38404. var self=this;
  38405. return $core.withContext(function($ctx1) {
  38406. var $1;
  38407. $1=self._visitIRInstruction_(anIRDynamicArray);
  38408. return $1;
  38409. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  38410. },
  38411. args: ["anIRDynamicArray"],
  38412. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
  38413. referencedClasses: [],
  38414. messageSends: ["visitIRInstruction:"]
  38415. }),
  38416. $globals.IRVisitor);
  38417. $core.addMethod(
  38418. $core.method({
  38419. selector: "visitIRDynamicDictionary:",
  38420. protocol: 'visiting',
  38421. fn: function (anIRDynamicDictionary){
  38422. var self=this;
  38423. return $core.withContext(function($ctx1) {
  38424. var $1;
  38425. $1=self._visitIRInstruction_(anIRDynamicDictionary);
  38426. return $1;
  38427. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  38428. },
  38429. args: ["anIRDynamicDictionary"],
  38430. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
  38431. referencedClasses: [],
  38432. messageSends: ["visitIRInstruction:"]
  38433. }),
  38434. $globals.IRVisitor);
  38435. $core.addMethod(
  38436. $core.method({
  38437. selector: "visitIRInlinedClosure:",
  38438. protocol: 'visiting',
  38439. fn: function (anIRInlinedClosure){
  38440. var self=this;
  38441. return $core.withContext(function($ctx1) {
  38442. var $1;
  38443. $1=self._visitIRClosure_(anIRInlinedClosure);
  38444. return $1;
  38445. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  38446. },
  38447. args: ["anIRInlinedClosure"],
  38448. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  38449. referencedClasses: [],
  38450. messageSends: ["visitIRClosure:"]
  38451. }),
  38452. $globals.IRVisitor);
  38453. $core.addMethod(
  38454. $core.method({
  38455. selector: "visitIRInlinedSequence:",
  38456. protocol: 'visiting',
  38457. fn: function (anIRInlinedSequence){
  38458. var self=this;
  38459. return $core.withContext(function($ctx1) {
  38460. var $1;
  38461. $1=self._visitIRSequence_(anIRInlinedSequence);
  38462. return $1;
  38463. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  38464. },
  38465. args: ["anIRInlinedSequence"],
  38466. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  38467. referencedClasses: [],
  38468. messageSends: ["visitIRSequence:"]
  38469. }),
  38470. $globals.IRVisitor);
  38471. $core.addMethod(
  38472. $core.method({
  38473. selector: "visitIRInstruction:",
  38474. protocol: 'visiting',
  38475. fn: function (anIRInstruction){
  38476. var self=this;
  38477. return $core.withContext(function($ctx1) {
  38478. $recv($recv(anIRInstruction)._instructions())._do_((function(each){
  38479. return $core.withContext(function($ctx2) {
  38480. return self._visit_(each);
  38481. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38482. }));
  38483. return anIRInstruction;
  38484. }, function($ctx1) {$ctx1.fill(self,"visitIRInstruction:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)});
  38485. },
  38486. args: ["anIRInstruction"],
  38487. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  38488. referencedClasses: [],
  38489. messageSends: ["do:", "instructions", "visit:"]
  38490. }),
  38491. $globals.IRVisitor);
  38492. $core.addMethod(
  38493. $core.method({
  38494. selector: "visitIRMethod:",
  38495. protocol: 'visiting',
  38496. fn: function (anIRMethod){
  38497. var self=this;
  38498. return $core.withContext(function($ctx1) {
  38499. var $1;
  38500. $1=self._visitIRInstruction_(anIRMethod);
  38501. return $1;
  38502. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  38503. },
  38504. args: ["anIRMethod"],
  38505. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  38506. referencedClasses: [],
  38507. messageSends: ["visitIRInstruction:"]
  38508. }),
  38509. $globals.IRVisitor);
  38510. $core.addMethod(
  38511. $core.method({
  38512. selector: "visitIRNonLocalReturn:",
  38513. protocol: 'visiting',
  38514. fn: function (anIRNonLocalReturn){
  38515. var self=this;
  38516. return $core.withContext(function($ctx1) {
  38517. var $1;
  38518. $1=self._visitIRInstruction_(anIRNonLocalReturn);
  38519. return $1;
  38520. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  38521. },
  38522. args: ["anIRNonLocalReturn"],
  38523. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  38524. referencedClasses: [],
  38525. messageSends: ["visitIRInstruction:"]
  38526. }),
  38527. $globals.IRVisitor);
  38528. $core.addMethod(
  38529. $core.method({
  38530. selector: "visitIRNonLocalReturnHandling:",
  38531. protocol: 'visiting',
  38532. fn: function (anIRNonLocalReturnHandling){
  38533. var self=this;
  38534. return $core.withContext(function($ctx1) {
  38535. var $1;
  38536. $1=self._visitIRInstruction_(anIRNonLocalReturnHandling);
  38537. return $1;
  38538. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  38539. },
  38540. args: ["anIRNonLocalReturnHandling"],
  38541. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  38542. referencedClasses: [],
  38543. messageSends: ["visitIRInstruction:"]
  38544. }),
  38545. $globals.IRVisitor);
  38546. $core.addMethod(
  38547. $core.method({
  38548. selector: "visitIRReturn:",
  38549. protocol: 'visiting',
  38550. fn: function (anIRReturn){
  38551. var self=this;
  38552. return $core.withContext(function($ctx1) {
  38553. var $1;
  38554. $1=self._visitIRInstruction_(anIRReturn);
  38555. return $1;
  38556. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  38557. },
  38558. args: ["anIRReturn"],
  38559. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  38560. referencedClasses: [],
  38561. messageSends: ["visitIRInstruction:"]
  38562. }),
  38563. $globals.IRVisitor);
  38564. $core.addMethod(
  38565. $core.method({
  38566. selector: "visitIRSend:",
  38567. protocol: 'visiting',
  38568. fn: function (anIRSend){
  38569. var self=this;
  38570. return $core.withContext(function($ctx1) {
  38571. var $1;
  38572. $1=self._visitIRInstruction_(anIRSend);
  38573. return $1;
  38574. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  38575. },
  38576. args: ["anIRSend"],
  38577. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  38578. referencedClasses: [],
  38579. messageSends: ["visitIRInstruction:"]
  38580. }),
  38581. $globals.IRVisitor);
  38582. $core.addMethod(
  38583. $core.method({
  38584. selector: "visitIRSequence:",
  38585. protocol: 'visiting',
  38586. fn: function (anIRSequence){
  38587. var self=this;
  38588. return $core.withContext(function($ctx1) {
  38589. var $1;
  38590. $1=self._visitIRInstruction_(anIRSequence);
  38591. return $1;
  38592. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  38593. },
  38594. args: ["anIRSequence"],
  38595. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  38596. referencedClasses: [],
  38597. messageSends: ["visitIRInstruction:"]
  38598. }),
  38599. $globals.IRVisitor);
  38600. $core.addMethod(
  38601. $core.method({
  38602. selector: "visitIRTempDeclaration:",
  38603. protocol: 'visiting',
  38604. fn: function (anIRTempDeclaration){
  38605. var self=this;
  38606. return $core.withContext(function($ctx1) {
  38607. var $1;
  38608. $1=self._visitIRInstruction_(anIRTempDeclaration);
  38609. return $1;
  38610. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  38611. },
  38612. args: ["anIRTempDeclaration"],
  38613. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  38614. referencedClasses: [],
  38615. messageSends: ["visitIRInstruction:"]
  38616. }),
  38617. $globals.IRVisitor);
  38618. $core.addMethod(
  38619. $core.method({
  38620. selector: "visitIRValue:",
  38621. protocol: 'visiting',
  38622. fn: function (anIRValue){
  38623. var self=this;
  38624. return $core.withContext(function($ctx1) {
  38625. var $1;
  38626. $1=self._visitIRInstruction_(anIRValue);
  38627. return $1;
  38628. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  38629. },
  38630. args: ["anIRValue"],
  38631. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  38632. referencedClasses: [],
  38633. messageSends: ["visitIRInstruction:"]
  38634. }),
  38635. $globals.IRVisitor);
  38636. $core.addMethod(
  38637. $core.method({
  38638. selector: "visitIRVariable:",
  38639. protocol: 'visiting',
  38640. fn: function (anIRVariable){
  38641. var self=this;
  38642. return $core.withContext(function($ctx1) {
  38643. var $1;
  38644. $1=self._visitIRInstruction_(anIRVariable);
  38645. return $1;
  38646. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  38647. },
  38648. args: ["anIRVariable"],
  38649. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  38650. referencedClasses: [],
  38651. messageSends: ["visitIRInstruction:"]
  38652. }),
  38653. $globals.IRVisitor);
  38654. $core.addMethod(
  38655. $core.method({
  38656. selector: "visitIRVerbatim:",
  38657. protocol: 'visiting',
  38658. fn: function (anIRVerbatim){
  38659. var self=this;
  38660. return $core.withContext(function($ctx1) {
  38661. var $1;
  38662. $1=self._visitIRInstruction_(anIRVerbatim);
  38663. return $1;
  38664. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  38665. },
  38666. args: ["anIRVerbatim"],
  38667. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  38668. referencedClasses: [],
  38669. messageSends: ["visitIRInstruction:"]
  38670. }),
  38671. $globals.IRVisitor);
  38672. $core.addClass('IRJSTranslator', $globals.IRVisitor, ['stream', 'currentClass'], 'Compiler-IR');
  38673. $core.addMethod(
  38674. $core.method({
  38675. selector: "contents",
  38676. protocol: 'accessing',
  38677. fn: function (){
  38678. var self=this;
  38679. return $core.withContext(function($ctx1) {
  38680. var $1;
  38681. $1=$recv(self._stream())._contents();
  38682. return $1;
  38683. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  38684. },
  38685. args: [],
  38686. source: "contents\x0a\x09^ self stream contents",
  38687. referencedClasses: [],
  38688. messageSends: ["contents", "stream"]
  38689. }),
  38690. $globals.IRJSTranslator);
  38691. $core.addMethod(
  38692. $core.method({
  38693. selector: "currentClass",
  38694. protocol: 'accessing',
  38695. fn: function (){
  38696. var self=this;
  38697. var $1;
  38698. $1=self["@currentClass"];
  38699. return $1;
  38700. },
  38701. args: [],
  38702. source: "currentClass\x0a\x09^ currentClass",
  38703. referencedClasses: [],
  38704. messageSends: []
  38705. }),
  38706. $globals.IRJSTranslator);
  38707. $core.addMethod(
  38708. $core.method({
  38709. selector: "currentClass:",
  38710. protocol: 'accessing',
  38711. fn: function (aClass){
  38712. var self=this;
  38713. self["@currentClass"]=aClass;
  38714. return self;
  38715. },
  38716. args: ["aClass"],
  38717. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  38718. referencedClasses: [],
  38719. messageSends: []
  38720. }),
  38721. $globals.IRJSTranslator);
  38722. $core.addMethod(
  38723. $core.method({
  38724. selector: "initialize",
  38725. protocol: 'initialization',
  38726. fn: function (){
  38727. var self=this;
  38728. function $JSStream(){return $globals.JSStream||(typeof JSStream=="undefined"?nil:JSStream)}
  38729. return $core.withContext(function($ctx1) {
  38730. (
  38731. $ctx1.supercall = true,
  38732. $globals.IRJSTranslator.superclass.fn.prototype._initialize.apply($recv(self), []));
  38733. $ctx1.supercall = false;
  38734. self["@stream"]=$recv($JSStream())._new();
  38735. return self;
  38736. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  38737. },
  38738. args: [],
  38739. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  38740. referencedClasses: ["JSStream"],
  38741. messageSends: ["initialize", "new"]
  38742. }),
  38743. $globals.IRJSTranslator);
  38744. $core.addMethod(
  38745. $core.method({
  38746. selector: "stream",
  38747. protocol: 'accessing',
  38748. fn: function (){
  38749. var self=this;
  38750. var $1;
  38751. $1=self["@stream"];
  38752. return $1;
  38753. },
  38754. args: [],
  38755. source: "stream\x0a\x09^ stream",
  38756. referencedClasses: [],
  38757. messageSends: []
  38758. }),
  38759. $globals.IRJSTranslator);
  38760. $core.addMethod(
  38761. $core.method({
  38762. selector: "stream:",
  38763. protocol: 'accessing',
  38764. fn: function (aStream){
  38765. var self=this;
  38766. self["@stream"]=aStream;
  38767. return self;
  38768. },
  38769. args: ["aStream"],
  38770. source: "stream: aStream\x0a\x09stream := aStream",
  38771. referencedClasses: [],
  38772. messageSends: []
  38773. }),
  38774. $globals.IRJSTranslator);
  38775. $core.addMethod(
  38776. $core.method({
  38777. selector: "visitIRAssignment:",
  38778. protocol: 'visiting',
  38779. fn: function (anIRAssignment){
  38780. var self=this;
  38781. return $core.withContext(function($ctx1) {
  38782. var $2,$1;
  38783. $2=$recv(anIRAssignment)._instructions();
  38784. $ctx1.sendIdx["instructions"]=1;
  38785. $1=$recv($2)._first();
  38786. self._visit_($1);
  38787. $ctx1.sendIdx["visit:"]=1;
  38788. $recv(self._stream())._nextPutAssignment();
  38789. self._visit_($recv($recv(anIRAssignment)._instructions())._last());
  38790. return self;
  38791. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  38792. },
  38793. args: ["anIRAssignment"],
  38794. source: "visitIRAssignment: anIRAssignment\x0a\x09self visit: anIRAssignment instructions first.\x0a\x09self stream nextPutAssignment.\x0a\x09self visit: anIRAssignment instructions last.",
  38795. referencedClasses: [],
  38796. messageSends: ["visit:", "first", "instructions", "nextPutAssignment", "stream", "last"]
  38797. }),
  38798. $globals.IRJSTranslator);
  38799. $core.addMethod(
  38800. $core.method({
  38801. selector: "visitIRClosure:",
  38802. protocol: 'visiting',
  38803. fn: function (anIRClosure){
  38804. var self=this;
  38805. return $core.withContext(function($ctx1) {
  38806. var $1,$2;
  38807. $1=self._stream();
  38808. $ctx1.sendIdx["stream"]=1;
  38809. $recv($1)._nextPutClosureWith_arguments_((function(){
  38810. return $core.withContext(function($ctx2) {
  38811. $2=self._stream();
  38812. $ctx2.sendIdx["stream"]=2;
  38813. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  38814. return $core.withContext(function($ctx3) {
  38815. return $recv($recv(each)._name())._asVariableName();
  38816. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  38817. })));
  38818. return $recv(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  38819. return $core.withContext(function($ctx3) {
  38820. return (
  38821. $ctx3.supercall = true,
  38822. $globals.IRJSTranslator.superclass.fn.prototype._visitIRClosure_.apply($recv(self), [anIRClosure]));
  38823. $ctx3.supercall = false;
  38824. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  38825. }));
  38826. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38827. }),$recv(anIRClosure)._arguments());
  38828. return self;
  38829. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  38830. },
  38831. args: ["anIRClosure"],
  38832. 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",
  38833. referencedClasses: [],
  38834. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  38835. }),
  38836. $globals.IRJSTranslator);
  38837. $core.addMethod(
  38838. $core.method({
  38839. selector: "visitIRDynamicArray:",
  38840. protocol: 'visiting',
  38841. fn: function (anIRDynamicArray){
  38842. var self=this;
  38843. return $core.withContext(function($ctx1) {
  38844. var $1;
  38845. $1=self._stream();
  38846. $ctx1.sendIdx["stream"]=1;
  38847. $recv($1)._nextPutAll_("[");
  38848. $ctx1.sendIdx["nextPutAll:"]=1;
  38849. $recv($recv(anIRDynamicArray)._instructions())._do_separatedBy_((function(each){
  38850. return $core.withContext(function($ctx2) {
  38851. return self._visit_(each);
  38852. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38853. }),(function(){
  38854. return $core.withContext(function($ctx2) {
  38855. return $recv(self._stream())._nextPutAll_(",");
  38856. $ctx2.sendIdx["nextPutAll:"]=2;
  38857. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38858. }));
  38859. $recv(self["@stream"])._nextPutAll_("]");
  38860. return self;
  38861. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  38862. },
  38863. args: ["anIRDynamicArray"],
  38864. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self stream nextPutAll: '['.\x0a\x09anIRDynamicArray instructions\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ']'",
  38865. referencedClasses: [],
  38866. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"]
  38867. }),
  38868. $globals.IRJSTranslator);
  38869. $core.addMethod(
  38870. $core.method({
  38871. selector: "visitIRDynamicDictionary:",
  38872. protocol: 'visiting',
  38873. fn: function (anIRDynamicDictionary){
  38874. var self=this;
  38875. return $core.withContext(function($ctx1) {
  38876. var $1,$2;
  38877. $1=self._stream();
  38878. $ctx1.sendIdx["stream"]=1;
  38879. $recv($1)._nextPutAll_("$globals.HashedCollection._newFromPairs_([");
  38880. $ctx1.sendIdx["nextPutAll:"]=1;
  38881. $recv($recv(anIRDynamicDictionary)._instructions())._do_separatedBy_((function(each){
  38882. return $core.withContext(function($ctx2) {
  38883. return self._visit_(each);
  38884. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38885. }),(function(){
  38886. return $core.withContext(function($ctx2) {
  38887. $2=self._stream();
  38888. $ctx2.sendIdx["stream"]=2;
  38889. return $recv($2)._nextPutAll_(",");
  38890. $ctx2.sendIdx["nextPutAll:"]=2;
  38891. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38892. }));
  38893. $recv(self._stream())._nextPutAll_("])");
  38894. return self;
  38895. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  38896. },
  38897. args: ["anIRDynamicDictionary"],
  38898. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self stream nextPutAll: '$globals.HashedCollection._newFromPairs_(['.\x0a\x09\x09anIRDynamicDictionary instructions\x0a\x09\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: '])'",
  38899. referencedClasses: [],
  38900. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"]
  38901. }),
  38902. $globals.IRJSTranslator);
  38903. $core.addMethod(
  38904. $core.method({
  38905. selector: "visitIRMethod:",
  38906. protocol: 'visiting',
  38907. fn: function (anIRMethod){
  38908. var self=this;
  38909. return $core.withContext(function($ctx1) {
  38910. var $1,$2,$3,$4,$5,$6,$8,$7,$9,$10;
  38911. $1=self._stream();
  38912. $ctx1.sendIdx["stream"]=1;
  38913. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  38914. return $core.withContext(function($ctx2) {
  38915. $2=self._stream();
  38916. $ctx2.sendIdx["stream"]=2;
  38917. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  38918. return $core.withContext(function($ctx3) {
  38919. $3=self._stream();
  38920. $ctx3.sendIdx["stream"]=3;
  38921. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  38922. return $core.withContext(function($ctx4) {
  38923. return $recv($recv(each)._name())._asVariableName();
  38924. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  38925. }));
  38926. $ctx3.sendIdx["collect:"]=1;
  38927. $recv($3)._nextPutVars_($4);
  38928. $ctx3.sendIdx["nextPutVars:"]=1;
  38929. $recv($recv(anIRMethod)._classReferences())._do_((function(each){
  38930. return $core.withContext(function($ctx4) {
  38931. $5=self._stream();
  38932. $ctx4.sendIdx["stream"]=4;
  38933. return $recv($5)._nextPutClassRefFunction_(each);
  38934. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,4)});
  38935. }));
  38936. $6=self._stream();
  38937. $ctx3.sendIdx["stream"]=5;
  38938. return $recv($6)._nextPutContextFor_during_(anIRMethod,(function(){
  38939. return $core.withContext(function($ctx4) {
  38940. $8=$recv(anIRMethod)._internalVariables();
  38941. $ctx4.sendIdx["internalVariables"]=1;
  38942. $7=$recv($8)._notEmpty();
  38943. if($core.assert($7)){
  38944. $9=self._stream();
  38945. $ctx4.sendIdx["stream"]=6;
  38946. $recv($9)._nextPutVars_($recv($recv($recv(anIRMethod)._internalVariables())._asSet())._collect_((function(each){
  38947. return $core.withContext(function($ctx5) {
  38948. return $recv($recv(each)._variable())._alias();
  38949. }, function($ctx5) {$ctx5.fillBlock({each:each},$ctx4,7)});
  38950. })));
  38951. };
  38952. $10=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  38953. if($core.assert($10)){
  38954. return $recv(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  38955. return $core.withContext(function($ctx5) {
  38956. return (
  38957. $ctx5.supercall = true,
  38958. $globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  38959. $ctx5.supercall = false;
  38960. $ctx5.sendIdx["visitIRMethod:"]=1;
  38961. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,9)});
  38962. }));
  38963. } else {
  38964. return (
  38965. $ctx4.supercall = true,
  38966. $globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  38967. $ctx4.supercall = false;
  38968. };
  38969. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  38970. }));
  38971. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  38972. }),$recv(anIRMethod)._arguments());
  38973. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38974. }));
  38975. return self;
  38976. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  38977. },
  38978. args: ["anIRMethod"],
  38979. 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 ]",
  38980. referencedClasses: [],
  38981. 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"]
  38982. }),
  38983. $globals.IRJSTranslator);
  38984. $core.addMethod(
  38985. $core.method({
  38986. selector: "visitIRNonLocalReturn:",
  38987. protocol: 'visiting',
  38988. fn: function (anIRNonLocalReturn){
  38989. var self=this;
  38990. return $core.withContext(function($ctx1) {
  38991. $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
  38992. return $core.withContext(function($ctx2) {
  38993. return (
  38994. $ctx2.supercall = true,
  38995. $globals.IRJSTranslator.superclass.fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  38996. $ctx2.supercall = false;
  38997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38998. }));
  38999. return self;
  39000. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  39001. },
  39002. args: ["anIRNonLocalReturn"],
  39003. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  39004. referencedClasses: [],
  39005. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  39006. }),
  39007. $globals.IRJSTranslator);
  39008. $core.addMethod(
  39009. $core.method({
  39010. selector: "visitIRReturn:",
  39011. protocol: 'visiting',
  39012. fn: function (anIRReturn){
  39013. var self=this;
  39014. return $core.withContext(function($ctx1) {
  39015. $recv(self._stream())._nextPutReturnWith_((function(){
  39016. return $core.withContext(function($ctx2) {
  39017. return (
  39018. $ctx2.supercall = true,
  39019. $globals.IRJSTranslator.superclass.fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  39020. $ctx2.supercall = false;
  39021. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39022. }));
  39023. return self;
  39024. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  39025. },
  39026. args: ["anIRReturn"],
  39027. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  39028. referencedClasses: [],
  39029. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  39030. }),
  39031. $globals.IRJSTranslator);
  39032. $core.addMethod(
  39033. $core.method({
  39034. selector: "visitIRSend:",
  39035. protocol: 'visiting',
  39036. fn: function (anIRSend){
  39037. var self=this;
  39038. var sends;
  39039. return $core.withContext(function($ctx1) {
  39040. var $1,$2,$receiver;
  39041. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  39042. $1=$recv(anIRSend)._classSend();
  39043. if(($receiver = $1) == null || $receiver.isNil){
  39044. self._visitSend_(anIRSend);
  39045. } else {
  39046. self._visitSuperSend_(anIRSend);
  39047. };
  39048. $2=$recv($recv(sends).__gt((1)))._and_((function(){
  39049. return $core.withContext(function($ctx2) {
  39050. return $recv($recv(anIRSend)._index()).__lt(sends);
  39051. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39052. }));
  39053. if($core.assert($2)){
  39054. $recv(self._stream())._nextPutSendIndexFor_(anIRSend);
  39055. };
  39056. return self;
  39057. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends},$globals.IRJSTranslator)});
  39058. },
  39059. args: ["anIRSend"],
  39060. source: "visitIRSend: anIRSend\x0a\x09| sends |\x0a\x09sends := (anIRSend method sendIndexes at: anIRSend selector) size.\x0a\x09\x0a\x09anIRSend classSend\x0a\x09\x09ifNil: [ self visitSend: anIRSend ]\x0a\x09\x09ifNotNil: [ self visitSuperSend: anIRSend ].\x0a\x09\x09\x0a\x09(sends > 1 and: [ anIRSend index < sends ])\x0a\x09\x09ifTrue: [ self stream nextPutSendIndexFor: anIRSend ]",
  39061. referencedClasses: [],
  39062. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifNil:ifNotNil:", "classSend", "visitSend:", "visitSuperSend:", "ifTrue:", "and:", ">", "<", "index", "nextPutSendIndexFor:", "stream"]
  39063. }),
  39064. $globals.IRJSTranslator);
  39065. $core.addMethod(
  39066. $core.method({
  39067. selector: "visitIRSequence:",
  39068. protocol: 'visiting',
  39069. fn: function (anIRSequence){
  39070. var self=this;
  39071. return $core.withContext(function($ctx1) {
  39072. var $1;
  39073. $1=self._stream();
  39074. $ctx1.sendIdx["stream"]=1;
  39075. $recv($1)._nextPutSequenceWith_((function(){
  39076. return $core.withContext(function($ctx2) {
  39077. return $recv($recv(anIRSequence)._instructions())._do_((function(each){
  39078. return $core.withContext(function($ctx3) {
  39079. return $recv(self._stream())._nextPutStatementWith_(self._visit_(each));
  39080. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39081. }));
  39082. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39083. }));
  39084. return self;
  39085. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  39086. },
  39087. args: ["anIRSequence"],
  39088. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ] ]",
  39089. referencedClasses: [],
  39090. messageSends: ["nextPutSequenceWith:", "stream", "do:", "instructions", "nextPutStatementWith:", "visit:"]
  39091. }),
  39092. $globals.IRJSTranslator);
  39093. $core.addMethod(
  39094. $core.method({
  39095. selector: "visitIRTempDeclaration:",
  39096. protocol: 'visiting',
  39097. fn: function (anIRTempDeclaration){
  39098. var self=this;
  39099. return self;
  39100. },
  39101. args: ["anIRTempDeclaration"],
  39102. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  39103. referencedClasses: [],
  39104. messageSends: []
  39105. }),
  39106. $globals.IRJSTranslator);
  39107. $core.addMethod(
  39108. $core.method({
  39109. selector: "visitIRValue:",
  39110. protocol: 'visiting',
  39111. fn: function (anIRValue){
  39112. var self=this;
  39113. return $core.withContext(function($ctx1) {
  39114. $recv(self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavascript());
  39115. return self;
  39116. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  39117. },
  39118. args: ["anIRValue"],
  39119. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  39120. referencedClasses: [],
  39121. messageSends: ["nextPutAll:", "stream", "asJavascript", "value"]
  39122. }),
  39123. $globals.IRJSTranslator);
  39124. $core.addMethod(
  39125. $core.method({
  39126. selector: "visitIRVariable:",
  39127. protocol: 'visiting',
  39128. fn: function (anIRVariable){
  39129. var self=this;
  39130. return $core.withContext(function($ctx1) {
  39131. var $3,$2,$1,$4;
  39132. $3=$recv(anIRVariable)._variable();
  39133. $ctx1.sendIdx["variable"]=1;
  39134. $2=$recv($3)._name();
  39135. $1=$recv($2).__eq("thisContext");
  39136. if($core.assert($1)){
  39137. $4=self._stream();
  39138. $ctx1.sendIdx["stream"]=1;
  39139. $recv($4)._nextPutAll_("$core.getThisContext()");
  39140. $ctx1.sendIdx["nextPutAll:"]=1;
  39141. } else {
  39142. $recv(self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  39143. };
  39144. return self;
  39145. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  39146. },
  39147. args: ["anIRVariable"],
  39148. 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 ]",
  39149. referencedClasses: [],
  39150. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  39151. }),
  39152. $globals.IRJSTranslator);
  39153. $core.addMethod(
  39154. $core.method({
  39155. selector: "visitIRVerbatim:",
  39156. protocol: 'visiting',
  39157. fn: function (anIRVerbatim){
  39158. var self=this;
  39159. return $core.withContext(function($ctx1) {
  39160. var $1;
  39161. $1=self._stream();
  39162. $ctx1.sendIdx["stream"]=1;
  39163. $recv($1)._nextPutStatementWith_((function(){
  39164. return $core.withContext(function($ctx2) {
  39165. return $recv(self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  39166. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39167. }));
  39168. return self;
  39169. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  39170. },
  39171. args: ["anIRVerbatim"],
  39172. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  39173. referencedClasses: [],
  39174. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"]
  39175. }),
  39176. $globals.IRJSTranslator);
  39177. $core.addMethod(
  39178. $core.method({
  39179. selector: "visitReceiver:",
  39180. protocol: 'visiting',
  39181. fn: function (anIRInstruction){
  39182. var self=this;
  39183. return $core.withContext(function($ctx1) {
  39184. var $1,$2,$3;
  39185. $1=$recv(anIRInstruction)._needsBoxingAsReceiver();
  39186. if(!$core.assert($1)){
  39187. $2=self._visit_(anIRInstruction);
  39188. $ctx1.sendIdx["visit:"]=1;
  39189. return $2;
  39190. };
  39191. $3=self._stream();
  39192. $ctx1.sendIdx["stream"]=1;
  39193. $recv($3)._nextPutAll_("$recv(");
  39194. $ctx1.sendIdx["nextPutAll:"]=1;
  39195. self._visit_(anIRInstruction);
  39196. $recv(self._stream())._nextPutAll_(")");
  39197. return self;
  39198. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},$globals.IRJSTranslator)});
  39199. },
  39200. args: ["anIRInstruction"],
  39201. 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: ')'",
  39202. referencedClasses: [],
  39203. messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  39204. }),
  39205. $globals.IRJSTranslator);
  39206. $core.addMethod(
  39207. $core.method({
  39208. selector: "visitSend:",
  39209. protocol: 'visiting',
  39210. fn: function (anIRSend){
  39211. var self=this;
  39212. return $core.withContext(function($ctx1) {
  39213. var $2,$1,$3,$4,$5;
  39214. $2=$recv(anIRSend)._instructions();
  39215. $ctx1.sendIdx["instructions"]=1;
  39216. $1=$recv($2)._first();
  39217. self._visitReceiver_($1);
  39218. $3=self._stream();
  39219. $ctx1.sendIdx["stream"]=1;
  39220. $4=$recv(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName())).__comma("(");
  39221. $ctx1.sendIdx[","]=1;
  39222. $recv($3)._nextPutAll_($4);
  39223. $ctx1.sendIdx["nextPutAll:"]=1;
  39224. $recv($recv($recv(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  39225. return $core.withContext(function($ctx2) {
  39226. return self._visit_(each);
  39227. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39228. }),(function(){
  39229. return $core.withContext(function($ctx2) {
  39230. $5=self._stream();
  39231. $ctx2.sendIdx["stream"]=2;
  39232. return $recv($5)._nextPutAll_(",");
  39233. $ctx2.sendIdx["nextPutAll:"]=2;
  39234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39235. }));
  39236. $recv(self._stream())._nextPutAll_(")");
  39237. return self;
  39238. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  39239. },
  39240. args: ["anIRSend"],
  39241. source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend instructions first.\x0a\x09self stream nextPutAll: '.', anIRSend selector asJavaScriptMethodName, '('.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: ')'",
  39242. referencedClasses: [],
  39243. messageSends: ["visitReceiver:", "first", "instructions", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "do:separatedBy:", "allButFirst", "visit:"]
  39244. }),
  39245. $globals.IRJSTranslator);
  39246. $core.addMethod(
  39247. $core.method({
  39248. selector: "visitSuperSend:",
  39249. protocol: 'visiting',
  39250. fn: function (anIRSend){
  39251. var self=this;
  39252. return $core.withContext(function($ctx1) {
  39253. var $1,$2,$5,$4,$3,$6,$7,$8,$10,$9,$11,$12,$13,$14;
  39254. $1=self._stream();
  39255. $ctx1.sendIdx["stream"]=1;
  39256. $recv($1)._nextPutAll_("(");
  39257. $ctx1.sendIdx["nextPutAll:"]=1;
  39258. $recv($1)._lf();
  39259. $ctx1.sendIdx["lf"]=1;
  39260. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39261. $ctx1.sendIdx["nextPutAll:"]=2;
  39262. $recv($1)._lf();
  39263. $ctx1.sendIdx["lf"]=2;
  39264. $2=$1;
  39265. $5=$recv(anIRSend)._scope();
  39266. $ctx1.sendIdx["scope"]=1;
  39267. $4=$recv($5)._alias();
  39268. $ctx1.sendIdx["alias"]=1;
  39269. $3=$recv($4).__comma(".supercall = true, ");
  39270. $ctx1.sendIdx[","]=1;
  39271. $recv($2)._nextPutAll_($3);
  39272. $ctx1.sendIdx["nextPutAll:"]=3;
  39273. $recv($1)._lf();
  39274. $ctx1.sendIdx["lf"]=3;
  39275. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39276. $ctx1.sendIdx["nextPutAll:"]=4;
  39277. $recv($1)._lf();
  39278. $ctx1.sendIdx["lf"]=4;
  39279. $recv($1)._nextPutAll_($recv(self._currentClass())._asJavascript());
  39280. $ctx1.sendIdx["nextPutAll:"]=5;
  39281. $recv($1)._nextPutAll_(".superclass.fn.prototype.");
  39282. $ctx1.sendIdx["nextPutAll:"]=6;
  39283. $6=$1;
  39284. $7=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  39285. $ctx1.sendIdx[","]=2;
  39286. $recv($6)._nextPutAll_($7);
  39287. $ctx1.sendIdx["nextPutAll:"]=7;
  39288. $8=$recv($1)._nextPutAll_("$recv(");
  39289. $ctx1.sendIdx["nextPutAll:"]=8;
  39290. $10=$recv(anIRSend)._instructions();
  39291. $ctx1.sendIdx["instructions"]=1;
  39292. $9=$recv($10)._first();
  39293. self._visit_($9);
  39294. $ctx1.sendIdx["visit:"]=1;
  39295. $11=self._stream();
  39296. $ctx1.sendIdx["stream"]=2;
  39297. $recv($11)._nextPutAll_("), [");
  39298. $ctx1.sendIdx["nextPutAll:"]=9;
  39299. $recv($recv($recv(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  39300. return $core.withContext(function($ctx2) {
  39301. return self._visit_(each);
  39302. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39303. }),(function(){
  39304. return $core.withContext(function($ctx2) {
  39305. $12=self._stream();
  39306. $ctx2.sendIdx["stream"]=3;
  39307. return $recv($12)._nextPutAll_(",");
  39308. $ctx2.sendIdx["nextPutAll:"]=10;
  39309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39310. }));
  39311. $13=self._stream();
  39312. $recv($13)._nextPutAll_("]));");
  39313. $ctx1.sendIdx["nextPutAll:"]=11;
  39314. $recv($13)._lf();
  39315. $ctx1.sendIdx["lf"]=5;
  39316. $recv($13)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39317. $ctx1.sendIdx["nextPutAll:"]=12;
  39318. $recv($13)._lf();
  39319. $ctx1.sendIdx["lf"]=6;
  39320. $recv($13)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  39321. $ctx1.sendIdx["nextPutAll:"]=13;
  39322. $recv($13)._lf();
  39323. $14=$recv($13)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39324. return self;
  39325. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  39326. },
  39327. args: ["anIRSend"],
  39328. source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: '('; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = true, '; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'; lf;\x0a\x09\x09nextPutAll: self currentClass asJavascript;\x0a\x09\x09nextPutAll: '.superclass.fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptMethodName, '.apply(';\x0a\x09\x09nextPutAll: '$recv('.\x0a\x09self visit: anIRSend instructions first.\x0a\x09self stream nextPutAll: '), ['.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream \x0a\x09\x09nextPutAll: ']));'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = false;'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  39329. referencedClasses: [],
  39330. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavascript", "currentClass", "asJavaScriptMethodName", "selector", "visit:", "first", "instructions", "do:separatedBy:", "allButFirst"]
  39331. }),
  39332. $globals.IRJSTranslator);
  39333. $core.addClass('JSStream', $globals.Object, ['stream'], 'Compiler-IR');
  39334. $core.addMethod(
  39335. $core.method({
  39336. selector: "contents",
  39337. protocol: 'accessing',
  39338. fn: function (){
  39339. var self=this;
  39340. return $core.withContext(function($ctx1) {
  39341. var $1;
  39342. $1=$recv(self["@stream"])._contents();
  39343. return $1;
  39344. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  39345. },
  39346. args: [],
  39347. source: "contents\x0a\x09^ stream contents",
  39348. referencedClasses: [],
  39349. messageSends: ["contents"]
  39350. }),
  39351. $globals.JSStream);
  39352. $core.addMethod(
  39353. $core.method({
  39354. selector: "initialize",
  39355. protocol: 'initialization',
  39356. fn: function (){
  39357. var self=this;
  39358. return $core.withContext(function($ctx1) {
  39359. (
  39360. $ctx1.supercall = true,
  39361. $globals.JSStream.superclass.fn.prototype._initialize.apply($recv(self), []));
  39362. $ctx1.supercall = false;
  39363. self["@stream"]=""._writeStream();
  39364. return self;
  39365. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  39366. },
  39367. args: [],
  39368. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  39369. referencedClasses: [],
  39370. messageSends: ["initialize", "writeStream"]
  39371. }),
  39372. $globals.JSStream);
  39373. $core.addMethod(
  39374. $core.method({
  39375. selector: "lf",
  39376. protocol: 'streaming',
  39377. fn: function (){
  39378. var self=this;
  39379. return $core.withContext(function($ctx1) {
  39380. $recv(self["@stream"])._lf();
  39381. return self;
  39382. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  39383. },
  39384. args: [],
  39385. source: "lf\x0a\x09stream lf",
  39386. referencedClasses: [],
  39387. messageSends: ["lf"]
  39388. }),
  39389. $globals.JSStream);
  39390. $core.addMethod(
  39391. $core.method({
  39392. selector: "nextPut:",
  39393. protocol: 'streaming',
  39394. fn: function (aString){
  39395. var self=this;
  39396. return $core.withContext(function($ctx1) {
  39397. $recv(self["@stream"])._nextPut_(aString);
  39398. return self;
  39399. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  39400. },
  39401. args: ["aString"],
  39402. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  39403. referencedClasses: [],
  39404. messageSends: ["nextPut:"]
  39405. }),
  39406. $globals.JSStream);
  39407. $core.addMethod(
  39408. $core.method({
  39409. selector: "nextPutAll:",
  39410. protocol: 'streaming',
  39411. fn: function (aString){
  39412. var self=this;
  39413. return $core.withContext(function($ctx1) {
  39414. $recv(self["@stream"])._nextPutAll_(aString);
  39415. return self;
  39416. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  39417. },
  39418. args: ["aString"],
  39419. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  39420. referencedClasses: [],
  39421. messageSends: ["nextPutAll:"]
  39422. }),
  39423. $globals.JSStream);
  39424. $core.addMethod(
  39425. $core.method({
  39426. selector: "nextPutAssignment",
  39427. protocol: 'streaming',
  39428. fn: function (){
  39429. var self=this;
  39430. return $core.withContext(function($ctx1) {
  39431. $recv(self["@stream"])._nextPutAll_("=");
  39432. return self;
  39433. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignment",{},$globals.JSStream)});
  39434. },
  39435. args: [],
  39436. source: "nextPutAssignment\x0a\x09stream nextPutAll: '='",
  39437. referencedClasses: [],
  39438. messageSends: ["nextPutAll:"]
  39439. }),
  39440. $globals.JSStream);
  39441. $core.addMethod(
  39442. $core.method({
  39443. selector: "nextPutBlockContextFor:during:",
  39444. protocol: 'streaming',
  39445. fn: function (anIRClosure,aBlock){
  39446. var self=this;
  39447. return $core.withContext(function($ctx1) {
  39448. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18,$24;
  39449. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  39450. if(!$core.assert($1)){
  39451. $2=$recv(aBlock)._value();
  39452. $ctx1.sendIdx["value"]=1;
  39453. return $2;
  39454. };
  39455. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39456. $ctx1.sendIdx["nextPutAll:"]=1;
  39457. self._lf();
  39458. $ctx1.sendIdx["lf"]=1;
  39459. $6=$recv(anIRClosure)._scope();
  39460. $ctx1.sendIdx["scope"]=1;
  39461. $5=$recv($6)._alias();
  39462. $ctx1.sendIdx["alias"]=1;
  39463. $4="return $core.withContext(function(".__comma($5);
  39464. $ctx1.sendIdx[","]=2;
  39465. $3=$recv($4).__comma(") {");
  39466. $ctx1.sendIdx[","]=1;
  39467. self._nextPutAll_($3);
  39468. $ctx1.sendIdx["nextPutAll:"]=2;
  39469. self._lf();
  39470. $ctx1.sendIdx["lf"]=2;
  39471. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39472. $ctx1.sendIdx["nextPutAll:"]=3;
  39473. $7=self._lf();
  39474. $ctx1.sendIdx["lf"]=3;
  39475. $recv(aBlock)._value();
  39476. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39477. $ctx1.sendIdx["nextPutAll:"]=4;
  39478. self._lf();
  39479. $ctx1.sendIdx["lf"]=4;
  39480. $11=$recv(anIRClosure)._scope();
  39481. $ctx1.sendIdx["scope"]=2;
  39482. $10=$recv($11)._alias();
  39483. $ctx1.sendIdx["alias"]=2;
  39484. $9="}, function(".__comma($10);
  39485. $ctx1.sendIdx[","]=4;
  39486. $8=$recv($9).__comma(") {");
  39487. $ctx1.sendIdx[","]=3;
  39488. self._nextPutAll_($8);
  39489. $ctx1.sendIdx["nextPutAll:"]=5;
  39490. $15=$recv(anIRClosure)._scope();
  39491. $ctx1.sendIdx["scope"]=3;
  39492. $14=$recv($15)._alias();
  39493. $ctx1.sendIdx["alias"]=3;
  39494. $13=$recv($14).__comma(".fillBlock({");
  39495. $ctx1.sendIdx[","]=5;
  39496. $12=self._nextPutAll_($13);
  39497. $ctx1.sendIdx["nextPutAll:"]=6;
  39498. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  39499. return $core.withContext(function($ctx2) {
  39500. $16=$recv(each)._asVariableName();
  39501. $ctx2.sendIdx["asVariableName"]=1;
  39502. self._nextPutAll_($16);
  39503. $ctx2.sendIdx["nextPutAll:"]=7;
  39504. self._nextPutAll_(":");
  39505. $ctx2.sendIdx["nextPutAll:"]=8;
  39506. $17=self._nextPutAll_($recv(each)._asVariableName());
  39507. $ctx2.sendIdx["nextPutAll:"]=9;
  39508. return $17;
  39509. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39510. }),(function(){
  39511. return $core.withContext(function($ctx2) {
  39512. return self._nextPutAll_(",");
  39513. $ctx2.sendIdx["nextPutAll:"]=10;
  39514. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39515. }));
  39516. self._nextPutAll_("},");
  39517. $ctx1.sendIdx["nextPutAll:"]=11;
  39518. $23=$recv(anIRClosure)._scope();
  39519. $ctx1.sendIdx["scope"]=4;
  39520. $22=$recv($23)._outerScope();
  39521. $21=$recv($22)._alias();
  39522. $20=$recv($21).__comma(",");
  39523. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  39524. $ctx1.sendIdx[","]=7;
  39525. $18=$recv($19).__comma(")});");
  39526. $ctx1.sendIdx[","]=6;
  39527. self._nextPutAll_($18);
  39528. $ctx1.sendIdx["nextPutAll:"]=12;
  39529. self._lf();
  39530. $24=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39531. return self;
  39532. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  39533. },
  39534. args: ["anIRClosure", "aBlock"],
  39535. 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);'",
  39536. referencedClasses: [],
  39537. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  39538. }),
  39539. $globals.JSStream);
  39540. $core.addMethod(
  39541. $core.method({
  39542. selector: "nextPutClassRefFunction:",
  39543. protocol: 'streaming',
  39544. fn: function (aString){
  39545. var self=this;
  39546. return $core.withContext(function($ctx1) {
  39547. var $1,$2;
  39548. $1=self["@stream"];
  39549. $recv($1)._nextPutAll_("function $");
  39550. $ctx1.sendIdx["nextPutAll:"]=1;
  39551. $recv($1)._nextPutAll_(aString);
  39552. $ctx1.sendIdx["nextPutAll:"]=2;
  39553. $recv($1)._nextPutAll_("(){return $globals.");
  39554. $ctx1.sendIdx["nextPutAll:"]=3;
  39555. $recv($1)._nextPutAll_(aString);
  39556. $ctx1.sendIdx["nextPutAll:"]=4;
  39557. $recv($1)._nextPutAll_("||(typeof ");
  39558. $ctx1.sendIdx["nextPutAll:"]=5;
  39559. $recv($1)._nextPutAll_(aString);
  39560. $ctx1.sendIdx["nextPutAll:"]=6;
  39561. $recv($1)._nextPutAll_("==\x22undefined\x22?nil:");
  39562. $ctx1.sendIdx["nextPutAll:"]=7;
  39563. $recv($1)._nextPutAll_(aString);
  39564. $ctx1.sendIdx["nextPutAll:"]=8;
  39565. $recv($1)._nextPutAll_(")}");
  39566. $2=$recv($1)._lf();
  39567. return self;
  39568. }, function($ctx1) {$ctx1.fill(self,"nextPutClassRefFunction:",{aString:aString},$globals.JSStream)});
  39569. },
  39570. args: ["aString"],
  39571. 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",
  39572. referencedClasses: [],
  39573. messageSends: ["nextPutAll:", "lf"]
  39574. }),
  39575. $globals.JSStream);
  39576. $core.addMethod(
  39577. $core.method({
  39578. selector: "nextPutClosureWith:arguments:",
  39579. protocol: 'streaming',
  39580. fn: function (aBlock,anArray){
  39581. var self=this;
  39582. return $core.withContext(function($ctx1) {
  39583. var $1,$2,$3,$4;
  39584. $recv(self["@stream"])._nextPutAll_("(function(");
  39585. $ctx1.sendIdx["nextPutAll:"]=1;
  39586. $recv(anArray)._do_separatedBy_((function(each){
  39587. return $core.withContext(function($ctx2) {
  39588. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  39589. $ctx2.sendIdx["nextPutAll:"]=2;
  39590. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39591. }),(function(){
  39592. return $core.withContext(function($ctx2) {
  39593. return $recv(self["@stream"])._nextPut_(",");
  39594. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39595. }));
  39596. $1=self["@stream"];
  39597. $recv($1)._nextPutAll_("){");
  39598. $ctx1.sendIdx["nextPutAll:"]=3;
  39599. $2=$recv($1)._lf();
  39600. $ctx1.sendIdx["lf"]=1;
  39601. $recv(aBlock)._value();
  39602. $3=self["@stream"];
  39603. $recv($3)._lf();
  39604. $4=$recv($3)._nextPutAll_("})");
  39605. return self;
  39606. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  39607. },
  39608. args: ["aBlock", "anArray"],
  39609. 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: '})'",
  39610. referencedClasses: [],
  39611. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  39612. }),
  39613. $globals.JSStream);
  39614. $core.addMethod(
  39615. $core.method({
  39616. selector: "nextPutContextFor:during:",
  39617. protocol: 'streaming',
  39618. fn: function (aMethod,aBlock){
  39619. var self=this;
  39620. return $core.withContext(function($ctx1) {
  39621. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18,$19;
  39622. $1=$recv(aMethod)._requiresSmalltalkContext();
  39623. if(!$core.assert($1)){
  39624. $2=$recv(aBlock)._value();
  39625. $ctx1.sendIdx["value"]=1;
  39626. return $2;
  39627. };
  39628. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39629. $ctx1.sendIdx["nextPutAll:"]=1;
  39630. self._lf();
  39631. $ctx1.sendIdx["lf"]=1;
  39632. $6=$recv(aMethod)._scope();
  39633. $ctx1.sendIdx["scope"]=1;
  39634. $5=$recv($6)._alias();
  39635. $ctx1.sendIdx["alias"]=1;
  39636. $4="return $core.withContext(function(".__comma($5);
  39637. $ctx1.sendIdx[","]=2;
  39638. $3=$recv($4).__comma(") {");
  39639. $ctx1.sendIdx[","]=1;
  39640. self._nextPutAll_($3);
  39641. $ctx1.sendIdx["nextPutAll:"]=2;
  39642. self._lf();
  39643. $ctx1.sendIdx["lf"]=2;
  39644. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39645. $ctx1.sendIdx["nextPutAll:"]=3;
  39646. $7=self._lf();
  39647. $ctx1.sendIdx["lf"]=3;
  39648. $recv(aBlock)._value();
  39649. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39650. $ctx1.sendIdx["nextPutAll:"]=4;
  39651. self._lf();
  39652. $ctx1.sendIdx["lf"]=4;
  39653. $12=$recv(aMethod)._scope();
  39654. $ctx1.sendIdx["scope"]=2;
  39655. $11=$recv($12)._alias();
  39656. $ctx1.sendIdx["alias"]=2;
  39657. $10="}, function(".__comma($11);
  39658. $ctx1.sendIdx[","]=5;
  39659. $9=$recv($10).__comma(") {");
  39660. $ctx1.sendIdx[","]=4;
  39661. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  39662. $ctx1.sendIdx[","]=3;
  39663. self._nextPutAll_($8);
  39664. $ctx1.sendIdx["nextPutAll:"]=5;
  39665. $16=$recv($recv(aMethod)._selector())._asJavascript();
  39666. $ctx1.sendIdx["asJavascript"]=1;
  39667. $15=".fill(self,".__comma($16);
  39668. $14=$recv($15).__comma(",{");
  39669. $ctx1.sendIdx[","]=6;
  39670. $13=self._nextPutAll_($14);
  39671. $ctx1.sendIdx["nextPutAll:"]=6;
  39672. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  39673. return $core.withContext(function($ctx2) {
  39674. $17=$recv(each)._asVariableName();
  39675. $ctx2.sendIdx["asVariableName"]=1;
  39676. self._nextPutAll_($17);
  39677. $ctx2.sendIdx["nextPutAll:"]=7;
  39678. self._nextPutAll_(":");
  39679. $ctx2.sendIdx["nextPutAll:"]=8;
  39680. $18=self._nextPutAll_($recv(each)._asVariableName());
  39681. $ctx2.sendIdx["nextPutAll:"]=9;
  39682. return $18;
  39683. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39684. }),(function(){
  39685. return $core.withContext(function($ctx2) {
  39686. return self._nextPutAll_(",");
  39687. $ctx2.sendIdx["nextPutAll:"]=10;
  39688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39689. }));
  39690. self._nextPutAll_("},");
  39691. $ctx1.sendIdx["nextPutAll:"]=11;
  39692. self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavascript());
  39693. $ctx1.sendIdx["nextPutAll:"]=12;
  39694. self._nextPutAll_(")});");
  39695. $ctx1.sendIdx["nextPutAll:"]=13;
  39696. self._lf();
  39697. $19=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39698. return self;
  39699. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  39700. },
  39701. args: ["aMethod", "aBlock"],
  39702. 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);'",
  39703. referencedClasses: [],
  39704. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavascript", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  39705. }),
  39706. $globals.JSStream);
  39707. $core.addMethod(
  39708. $core.method({
  39709. selector: "nextPutFunctionWith:arguments:",
  39710. protocol: 'streaming',
  39711. fn: function (aBlock,anArray){
  39712. var self=this;
  39713. return $core.withContext(function($ctx1) {
  39714. var $1,$2,$3,$4,$5,$6;
  39715. $recv(self["@stream"])._nextPutAll_("fn: function(");
  39716. $ctx1.sendIdx["nextPutAll:"]=1;
  39717. $recv(anArray)._do_separatedBy_((function(each){
  39718. return $core.withContext(function($ctx2) {
  39719. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  39720. $ctx2.sendIdx["nextPutAll:"]=2;
  39721. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39722. }),(function(){
  39723. return $core.withContext(function($ctx2) {
  39724. return $recv(self["@stream"])._nextPut_(",");
  39725. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39726. }));
  39727. $1=self["@stream"];
  39728. $recv($1)._nextPutAll_("){");
  39729. $ctx1.sendIdx["nextPutAll:"]=3;
  39730. $2=$recv($1)._lf();
  39731. $ctx1.sendIdx["lf"]=1;
  39732. $3=self["@stream"];
  39733. $recv($3)._nextPutAll_("var self=this;");
  39734. $ctx1.sendIdx["nextPutAll:"]=4;
  39735. $4=$recv($3)._lf();
  39736. $ctx1.sendIdx["lf"]=2;
  39737. $recv(aBlock)._value();
  39738. $5=self["@stream"];
  39739. $recv($5)._lf();
  39740. $6=$recv($5)._nextPutAll_("}");
  39741. return self;
  39742. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  39743. },
  39744. args: ["aBlock", "anArray"],
  39745. 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: '}'",
  39746. referencedClasses: [],
  39747. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  39748. }),
  39749. $globals.JSStream);
  39750. $core.addMethod(
  39751. $core.method({
  39752. selector: "nextPutIf:with:",
  39753. protocol: 'streaming',
  39754. fn: function (aBlock,anotherBlock){
  39755. var self=this;
  39756. return $core.withContext(function($ctx1) {
  39757. var $1,$2;
  39758. $recv(self["@stream"])._nextPutAll_("if(");
  39759. $ctx1.sendIdx["nextPutAll:"]=1;
  39760. $recv(aBlock)._value();
  39761. $ctx1.sendIdx["value"]=1;
  39762. $1=self["@stream"];
  39763. $recv($1)._nextPutAll_("){");
  39764. $ctx1.sendIdx["nextPutAll:"]=2;
  39765. $2=$recv($1)._lf();
  39766. $recv(anotherBlock)._value();
  39767. $recv(self["@stream"])._nextPutAll_("}");
  39768. return self;
  39769. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:with:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  39770. },
  39771. args: ["aBlock", "anotherBlock"],
  39772. source: "nextPutIf: aBlock with: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  39773. referencedClasses: [],
  39774. messageSends: ["nextPutAll:", "value", "lf"]
  39775. }),
  39776. $globals.JSStream);
  39777. $core.addMethod(
  39778. $core.method({
  39779. selector: "nextPutIfElse:with:with:",
  39780. protocol: 'streaming',
  39781. fn: function (aBlock,ifBlock,elseBlock){
  39782. var self=this;
  39783. return $core.withContext(function($ctx1) {
  39784. var $1,$2,$3,$4;
  39785. $recv(self["@stream"])._nextPutAll_("if(");
  39786. $ctx1.sendIdx["nextPutAll:"]=1;
  39787. $recv(aBlock)._value();
  39788. $ctx1.sendIdx["value"]=1;
  39789. $1=self["@stream"];
  39790. $recv($1)._nextPutAll_("){");
  39791. $ctx1.sendIdx["nextPutAll:"]=2;
  39792. $2=$recv($1)._lf();
  39793. $ctx1.sendIdx["lf"]=1;
  39794. $recv(ifBlock)._value();
  39795. $ctx1.sendIdx["value"]=2;
  39796. $3=self["@stream"];
  39797. $recv($3)._nextPutAll_("} else {");
  39798. $ctx1.sendIdx["nextPutAll:"]=3;
  39799. $4=$recv($3)._lf();
  39800. $recv(elseBlock)._value();
  39801. $recv(self["@stream"])._nextPutAll_("}");
  39802. return self;
  39803. }, function($ctx1) {$ctx1.fill(self,"nextPutIfElse:with:with:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  39804. },
  39805. args: ["aBlock", "ifBlock", "elseBlock"],
  39806. source: "nextPutIfElse: aBlock with: ifBlock with: elseBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09ifBlock value.\x0a\x09stream nextPutAll: '} else {'; lf.\x0a\x09elseBlock value.\x0a\x09stream nextPutAll: '}'",
  39807. referencedClasses: [],
  39808. messageSends: ["nextPutAll:", "value", "lf"]
  39809. }),
  39810. $globals.JSStream);
  39811. $core.addMethod(
  39812. $core.method({
  39813. selector: "nextPutMethodDeclaration:with:",
  39814. protocol: 'streaming',
  39815. fn: function (aMethod,aBlock){
  39816. var self=this;
  39817. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  39818. return $core.withContext(function($ctx1) {
  39819. var $1,$2,$5,$4,$3,$6,$9,$8,$7,$10,$11,$12,$15,$14,$13,$16,$19,$18,$17,$20,$23,$22,$21,$24,$25,$26;
  39820. $1=self["@stream"];
  39821. $recv($1)._nextPutAll_("$core.method({");
  39822. $ctx1.sendIdx["nextPutAll:"]=1;
  39823. $recv($1)._lf();
  39824. $ctx1.sendIdx["lf"]=1;
  39825. $2=$1;
  39826. $5=$recv($recv(aMethod)._selector())._asJavascript();
  39827. $ctx1.sendIdx["asJavascript"]=1;
  39828. $4="selector: ".__comma($5);
  39829. $ctx1.sendIdx[","]=2;
  39830. $3=$recv($4).__comma(",");
  39831. $ctx1.sendIdx[","]=1;
  39832. $recv($2)._nextPutAll_($3);
  39833. $ctx1.sendIdx["nextPutAll:"]=2;
  39834. $recv($1)._lf();
  39835. $ctx1.sendIdx["lf"]=2;
  39836. $6=$1;
  39837. $9=$recv($recv(aMethod)._source())._asJavascript();
  39838. $ctx1.sendIdx["asJavascript"]=2;
  39839. $8="source: ".__comma($9);
  39840. $ctx1.sendIdx[","]=4;
  39841. $7=$recv($8).__comma(",");
  39842. $ctx1.sendIdx[","]=3;
  39843. $recv($6)._nextPutAll_($7);
  39844. $ctx1.sendIdx["nextPutAll:"]=3;
  39845. $10=$recv($1)._lf();
  39846. $ctx1.sendIdx["lf"]=3;
  39847. $recv(aBlock)._value();
  39848. $ctx1.sendIdx["value"]=1;
  39849. $11=self["@stream"];
  39850. $12=$11;
  39851. $15=$recv($String())._lf();
  39852. $ctx1.sendIdx["lf"]=4;
  39853. $14=",".__comma($15);
  39854. $ctx1.sendIdx[","]=6;
  39855. $13=$recv($14).__comma("messageSends: ");
  39856. $ctx1.sendIdx[","]=5;
  39857. $recv($12)._nextPutAll_($13);
  39858. $ctx1.sendIdx["nextPutAll:"]=4;
  39859. $16=$11;
  39860. $19=$recv($recv(aMethod)._messageSends())._asArray();
  39861. $ctx1.sendIdx["asArray"]=1;
  39862. $18=$recv($19)._asJavascript();
  39863. $ctx1.sendIdx["asJavascript"]=3;
  39864. $17=$recv($18).__comma(",");
  39865. $ctx1.sendIdx[","]=7;
  39866. $recv($16)._nextPutAll_($17);
  39867. $ctx1.sendIdx["nextPutAll:"]=5;
  39868. $recv($11)._lf();
  39869. $ctx1.sendIdx["lf"]=5;
  39870. $20=$11;
  39871. $23=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  39872. return $core.withContext(function($ctx2) {
  39873. return $recv(each)._value();
  39874. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39875. })))._asArray())._asJavascript();
  39876. $ctx1.sendIdx["asJavascript"]=4;
  39877. $22="args: ".__comma($23);
  39878. $21=$recv($22).__comma(",");
  39879. $ctx1.sendIdx[","]=8;
  39880. $recv($20)._nextPutAll_($21);
  39881. $ctx1.sendIdx["nextPutAll:"]=6;
  39882. $recv($11)._lf();
  39883. $24=$recv($11)._nextPutAll_("referencedClasses: [");
  39884. $ctx1.sendIdx["nextPutAll:"]=7;
  39885. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  39886. return $core.withContext(function($ctx2) {
  39887. return $recv(self["@stream"])._nextPutAll_($recv(each)._asJavascript());
  39888. $ctx2.sendIdx["nextPutAll:"]=8;
  39889. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39890. }),(function(){
  39891. return $core.withContext(function($ctx2) {
  39892. return $recv(self["@stream"])._nextPutAll_(",");
  39893. $ctx2.sendIdx["nextPutAll:"]=9;
  39894. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39895. }));
  39896. $25=self["@stream"];
  39897. $recv($25)._nextPutAll_("]");
  39898. $ctx1.sendIdx["nextPutAll:"]=10;
  39899. $26=$recv($25)._nextPutAll_("})");
  39900. return self;
  39901. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  39902. },
  39903. args: ["aMethod", "aBlock"],
  39904. 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: '})'",
  39905. referencedClasses: ["String"],
  39906. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  39907. }),
  39908. $globals.JSStream);
  39909. $core.addMethod(
  39910. $core.method({
  39911. selector: "nextPutNonLocalReturnHandlingWith:",
  39912. protocol: 'streaming',
  39913. fn: function (aBlock){
  39914. var self=this;
  39915. return $core.withContext(function($ctx1) {
  39916. var $1,$2,$3,$4;
  39917. $1=self["@stream"];
  39918. $recv($1)._nextPutAll_("var $early={};");
  39919. $ctx1.sendIdx["nextPutAll:"]=1;
  39920. $recv($1)._lf();
  39921. $ctx1.sendIdx["lf"]=1;
  39922. $recv($1)._nextPutAll_("try {");
  39923. $ctx1.sendIdx["nextPutAll:"]=2;
  39924. $2=$recv($1)._lf();
  39925. $ctx1.sendIdx["lf"]=2;
  39926. $recv(aBlock)._value();
  39927. $3=self["@stream"];
  39928. $recv($3)._nextPutAll_("}");
  39929. $ctx1.sendIdx["nextPutAll:"]=3;
  39930. $recv($3)._lf();
  39931. $ctx1.sendIdx["lf"]=3;
  39932. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  39933. $4=$recv($3)._lf();
  39934. return self;
  39935. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  39936. },
  39937. args: ["aBlock"],
  39938. 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",
  39939. referencedClasses: [],
  39940. messageSends: ["nextPutAll:", "lf", "value"]
  39941. }),
  39942. $globals.JSStream);
  39943. $core.addMethod(
  39944. $core.method({
  39945. selector: "nextPutNonLocalReturnWith:",
  39946. protocol: 'streaming',
  39947. fn: function (aBlock){
  39948. var self=this;
  39949. return $core.withContext(function($ctx1) {
  39950. $recv(self["@stream"])._nextPutAll_("throw $early=[");
  39951. $ctx1.sendIdx["nextPutAll:"]=1;
  39952. $recv(aBlock)._value();
  39953. $recv(self["@stream"])._nextPutAll_("]");
  39954. return self;
  39955. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  39956. },
  39957. args: ["aBlock"],
  39958. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  39959. referencedClasses: [],
  39960. messageSends: ["nextPutAll:", "value"]
  39961. }),
  39962. $globals.JSStream);
  39963. $core.addMethod(
  39964. $core.method({
  39965. selector: "nextPutReturn",
  39966. protocol: 'streaming',
  39967. fn: function (){
  39968. var self=this;
  39969. return $core.withContext(function($ctx1) {
  39970. $recv(self["@stream"])._nextPutAll_("return ");
  39971. return self;
  39972. }, function($ctx1) {$ctx1.fill(self,"nextPutReturn",{},$globals.JSStream)});
  39973. },
  39974. args: [],
  39975. source: "nextPutReturn\x0a\x09stream nextPutAll: 'return '",
  39976. referencedClasses: [],
  39977. messageSends: ["nextPutAll:"]
  39978. }),
  39979. $globals.JSStream);
  39980. $core.addMethod(
  39981. $core.method({
  39982. selector: "nextPutReturnWith:",
  39983. protocol: 'streaming',
  39984. fn: function (aBlock){
  39985. var self=this;
  39986. return $core.withContext(function($ctx1) {
  39987. self._nextPutReturn();
  39988. $recv(aBlock)._value();
  39989. return self;
  39990. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  39991. },
  39992. args: ["aBlock"],
  39993. source: "nextPutReturnWith: aBlock\x0a\x09self nextPutReturn.\x0a\x09aBlock value",
  39994. referencedClasses: [],
  39995. messageSends: ["nextPutReturn", "value"]
  39996. }),
  39997. $globals.JSStream);
  39998. $core.addMethod(
  39999. $core.method({
  40000. selector: "nextPutSendIndexFor:",
  40001. protocol: 'streaming',
  40002. fn: function (anIRSend){
  40003. var self=this;
  40004. return $core.withContext(function($ctx1) {
  40005. var $1;
  40006. self._nextPutAll_(";");
  40007. $ctx1.sendIdx["nextPutAll:"]=1;
  40008. self._lf();
  40009. $ctx1.sendIdx["lf"]=1;
  40010. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40011. $ctx1.sendIdx["nextPutAll:"]=2;
  40012. self._lf();
  40013. $ctx1.sendIdx["lf"]=2;
  40014. self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  40015. $ctx1.sendIdx["nextPutAll:"]=3;
  40016. self._nextPutAll_(".sendIdx[");
  40017. $ctx1.sendIdx["nextPutAll:"]=4;
  40018. self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavascript());
  40019. $ctx1.sendIdx["nextPutAll:"]=5;
  40020. self._nextPutAll_("]=");
  40021. $ctx1.sendIdx["nextPutAll:"]=6;
  40022. self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  40023. $ctx1.sendIdx["nextPutAll:"]=7;
  40024. self._nextPutAll_(";");
  40025. $ctx1.sendIdx["nextPutAll:"]=8;
  40026. self._lf();
  40027. $1=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  40028. return self;
  40029. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  40030. },
  40031. args: ["anIRSend"],
  40032. 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)'",
  40033. referencedClasses: [],
  40034. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavascript", "selector", "asString", "index"]
  40035. }),
  40036. $globals.JSStream);
  40037. $core.addMethod(
  40038. $core.method({
  40039. selector: "nextPutSequenceWith:",
  40040. protocol: 'streaming',
  40041. fn: function (aBlock){
  40042. var self=this;
  40043. return $core.withContext(function($ctx1) {
  40044. $recv(aBlock)._value();
  40045. return self;
  40046. }, function($ctx1) {$ctx1.fill(self,"nextPutSequenceWith:",{aBlock:aBlock},$globals.JSStream)});
  40047. },
  40048. args: ["aBlock"],
  40049. 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",
  40050. referencedClasses: [],
  40051. messageSends: ["value"]
  40052. }),
  40053. $globals.JSStream);
  40054. $core.addMethod(
  40055. $core.method({
  40056. selector: "nextPutStatementWith:",
  40057. protocol: 'streaming',
  40058. fn: function (aBlock){
  40059. var self=this;
  40060. return $core.withContext(function($ctx1) {
  40061. var $1,$2;
  40062. $recv(aBlock)._value();
  40063. $1=self["@stream"];
  40064. $recv($1)._nextPutAll_(";");
  40065. $2=$recv($1)._lf();
  40066. return self;
  40067. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  40068. },
  40069. args: ["aBlock"],
  40070. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  40071. referencedClasses: [],
  40072. messageSends: ["value", "nextPutAll:", "lf"]
  40073. }),
  40074. $globals.JSStream);
  40075. $core.addMethod(
  40076. $core.method({
  40077. selector: "nextPutVars:",
  40078. protocol: 'streaming',
  40079. fn: function (aCollection){
  40080. var self=this;
  40081. return $core.withContext(function($ctx1) {
  40082. var $1,$2;
  40083. $recv(aCollection)._ifNotEmpty_((function(){
  40084. return $core.withContext(function($ctx2) {
  40085. $recv(self["@stream"])._nextPutAll_("var ");
  40086. $ctx2.sendIdx["nextPutAll:"]=1;
  40087. $recv(aCollection)._do_separatedBy_((function(each){
  40088. return $core.withContext(function($ctx3) {
  40089. return $recv(self["@stream"])._nextPutAll_(each);
  40090. $ctx3.sendIdx["nextPutAll:"]=2;
  40091. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  40092. }),(function(){
  40093. return $core.withContext(function($ctx3) {
  40094. return $recv(self["@stream"])._nextPutAll_(",");
  40095. $ctx3.sendIdx["nextPutAll:"]=3;
  40096. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  40097. }));
  40098. $1=self["@stream"];
  40099. $recv($1)._nextPutAll_(";");
  40100. $2=$recv($1)._lf();
  40101. return $2;
  40102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40103. }));
  40104. return self;
  40105. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  40106. },
  40107. args: ["aCollection"],
  40108. 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 ]",
  40109. referencedClasses: [],
  40110. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  40111. }),
  40112. $globals.JSStream);
  40113. $core.addMethod(
  40114. $core.method({
  40115. selector: "appendToInstruction:",
  40116. protocol: '*Compiler-IR',
  40117. fn: function (anIRInstruction){
  40118. var self=this;
  40119. return $core.withContext(function($ctx1) {
  40120. $recv(anIRInstruction)._appendBlock_(self);
  40121. return self;
  40122. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  40123. },
  40124. args: ["anIRInstruction"],
  40125. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  40126. referencedClasses: [],
  40127. messageSends: ["appendBlock:"]
  40128. }),
  40129. $globals.BlockClosure);
  40130. });
  40131. 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";
  40132. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  40133. $core.addPackage('Compiler-Inlining');
  40134. $core.packages["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
  40135. $core.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  40136. $core.addClass('IRInlinedAssignment', $globals.IRAssignment, [], 'Compiler-Inlining');
  40137. $globals.IRInlinedAssignment.comment="I represent an inlined assignment instruction.";
  40138. $core.addMethod(
  40139. $core.method({
  40140. selector: "accept:",
  40141. protocol: 'visiting',
  40142. fn: function (aVisitor){
  40143. var self=this;
  40144. return $core.withContext(function($ctx1) {
  40145. var $1;
  40146. $1=$recv(aVisitor)._visitIRInlinedAssignment_(self);
  40147. return $1;
  40148. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedAssignment)});
  40149. },
  40150. args: ["aVisitor"],
  40151. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
  40152. referencedClasses: [],
  40153. messageSends: ["visitIRInlinedAssignment:"]
  40154. }),
  40155. $globals.IRInlinedAssignment);
  40156. $core.addMethod(
  40157. $core.method({
  40158. selector: "isInlined",
  40159. protocol: 'testing',
  40160. fn: function (){
  40161. var self=this;
  40162. return true;
  40163. },
  40164. args: [],
  40165. source: "isInlined\x0a\x09^ true",
  40166. referencedClasses: [],
  40167. messageSends: []
  40168. }),
  40169. $globals.IRInlinedAssignment);
  40170. $core.addClass('IRInlinedClosure', $globals.IRClosure, [], 'Compiler-Inlining');
  40171. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  40172. $core.addMethod(
  40173. $core.method({
  40174. selector: "accept:",
  40175. protocol: 'visiting',
  40176. fn: function (aVisitor){
  40177. var self=this;
  40178. return $core.withContext(function($ctx1) {
  40179. $recv(aVisitor)._visitIRInlinedClosure_(self);
  40180. return self;
  40181. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  40182. },
  40183. args: ["aVisitor"],
  40184. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  40185. referencedClasses: [],
  40186. messageSends: ["visitIRInlinedClosure:"]
  40187. }),
  40188. $globals.IRInlinedClosure);
  40189. $core.addMethod(
  40190. $core.method({
  40191. selector: "isInlined",
  40192. protocol: 'testing',
  40193. fn: function (){
  40194. var self=this;
  40195. return true;
  40196. },
  40197. args: [],
  40198. source: "isInlined\x0a\x09^ true",
  40199. referencedClasses: [],
  40200. messageSends: []
  40201. }),
  40202. $globals.IRInlinedClosure);
  40203. $core.addClass('IRInlinedReturn', $globals.IRReturn, [], 'Compiler-Inlining');
  40204. $globals.IRInlinedReturn.comment="I represent an inlined local return instruction.";
  40205. $core.addMethod(
  40206. $core.method({
  40207. selector: "accept:",
  40208. protocol: 'visiting',
  40209. fn: function (aVisitor){
  40210. var self=this;
  40211. return $core.withContext(function($ctx1) {
  40212. var $1;
  40213. $1=$recv(aVisitor)._visitIRInlinedReturn_(self);
  40214. return $1;
  40215. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedReturn)});
  40216. },
  40217. args: ["aVisitor"],
  40218. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
  40219. referencedClasses: [],
  40220. messageSends: ["visitIRInlinedReturn:"]
  40221. }),
  40222. $globals.IRInlinedReturn);
  40223. $core.addMethod(
  40224. $core.method({
  40225. selector: "isInlined",
  40226. protocol: 'testing',
  40227. fn: function (){
  40228. var self=this;
  40229. return true;
  40230. },
  40231. args: [],
  40232. source: "isInlined\x0a\x09^ true",
  40233. referencedClasses: [],
  40234. messageSends: []
  40235. }),
  40236. $globals.IRInlinedReturn);
  40237. $core.addClass('IRInlinedSend', $globals.IRSend, [], 'Compiler-Inlining');
  40238. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  40239. $core.addMethod(
  40240. $core.method({
  40241. selector: "accept:",
  40242. protocol: 'visiting',
  40243. fn: function (aVisitor){
  40244. var self=this;
  40245. return $core.withContext(function($ctx1) {
  40246. $recv(aVisitor)._visitInlinedSend_(self);
  40247. return self;
  40248. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  40249. },
  40250. args: ["aVisitor"],
  40251. source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  40252. referencedClasses: [],
  40253. messageSends: ["visitInlinedSend:"]
  40254. }),
  40255. $globals.IRInlinedSend);
  40256. $core.addMethod(
  40257. $core.method({
  40258. selector: "internalVariables",
  40259. protocol: 'accessing',
  40260. fn: function (){
  40261. var self=this;
  40262. var $1;
  40263. $1=[];
  40264. return $1;
  40265. },
  40266. args: [],
  40267. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  40268. referencedClasses: [],
  40269. messageSends: []
  40270. }),
  40271. $globals.IRInlinedSend);
  40272. $core.addMethod(
  40273. $core.method({
  40274. selector: "isInlined",
  40275. protocol: 'testing',
  40276. fn: function (){
  40277. var self=this;
  40278. return true;
  40279. },
  40280. args: [],
  40281. source: "isInlined\x0a\x09^ true",
  40282. referencedClasses: [],
  40283. messageSends: []
  40284. }),
  40285. $globals.IRInlinedSend);
  40286. $core.addClass('IRInlinedIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  40287. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  40288. $core.addMethod(
  40289. $core.method({
  40290. selector: "accept:",
  40291. protocol: 'visiting',
  40292. fn: function (aVisitor){
  40293. var self=this;
  40294. return $core.withContext(function($ctx1) {
  40295. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  40296. return self;
  40297. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  40298. },
  40299. args: ["aVisitor"],
  40300. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  40301. referencedClasses: [],
  40302. messageSends: ["visitIRInlinedIfFalse:"]
  40303. }),
  40304. $globals.IRInlinedIfFalse);
  40305. $core.addClass('IRInlinedIfNilIfNotNil', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  40306. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  40307. $core.addMethod(
  40308. $core.method({
  40309. selector: "accept:",
  40310. protocol: 'visiting',
  40311. fn: function (aVisitor){
  40312. var self=this;
  40313. return $core.withContext(function($ctx1) {
  40314. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  40315. return self;
  40316. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  40317. },
  40318. args: ["aVisitor"],
  40319. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  40320. referencedClasses: [],
  40321. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  40322. }),
  40323. $globals.IRInlinedIfNilIfNotNil);
  40324. $core.addMethod(
  40325. $core.method({
  40326. selector: "internalVariables",
  40327. protocol: 'accessing',
  40328. fn: function (){
  40329. var self=this;
  40330. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  40331. return $core.withContext(function($ctx1) {
  40332. var $1;
  40333. $1=$recv($Array())._with_(self._receiverInternalVariable());
  40334. return $1;
  40335. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  40336. },
  40337. args: [],
  40338. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  40339. referencedClasses: ["Array"],
  40340. messageSends: ["with:", "receiverInternalVariable"]
  40341. }),
  40342. $globals.IRInlinedIfNilIfNotNil);
  40343. $core.addMethod(
  40344. $core.method({
  40345. selector: "receiverInternalVariable",
  40346. protocol: 'accessing',
  40347. fn: function (){
  40348. var self=this;
  40349. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  40350. function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  40351. return $core.withContext(function($ctx1) {
  40352. var $2,$3,$1;
  40353. $2=$recv($IRVariable())._new();
  40354. $ctx1.sendIdx["new"]=1;
  40355. $recv($2)._variable_($recv($recv($AliasVar())._new())._name_(self._receiverInternalVariableName()));
  40356. $3=$recv($2)._yourself();
  40357. $1=$3;
  40358. return $1;
  40359. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  40360. },
  40361. args: [],
  40362. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  40363. referencedClasses: ["IRVariable", "AliasVar"],
  40364. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  40365. }),
  40366. $globals.IRInlinedIfNilIfNotNil);
  40367. $core.addMethod(
  40368. $core.method({
  40369. selector: "receiverInternalVariableName",
  40370. protocol: 'accessing',
  40371. fn: function (){
  40372. var self=this;
  40373. return "$receiver";
  40374. },
  40375. args: [],
  40376. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  40377. referencedClasses: [],
  40378. messageSends: []
  40379. }),
  40380. $globals.IRInlinedIfNilIfNotNil);
  40381. $core.addClass('IRInlinedIfTrue', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  40382. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  40383. $core.addMethod(
  40384. $core.method({
  40385. selector: "accept:",
  40386. protocol: 'visiting',
  40387. fn: function (aVisitor){
  40388. var self=this;
  40389. return $core.withContext(function($ctx1) {
  40390. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  40391. return self;
  40392. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  40393. },
  40394. args: ["aVisitor"],
  40395. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  40396. referencedClasses: [],
  40397. messageSends: ["visitIRInlinedIfTrue:"]
  40398. }),
  40399. $globals.IRInlinedIfTrue);
  40400. $core.addClass('IRInlinedIfTrueIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  40401. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  40402. $core.addMethod(
  40403. $core.method({
  40404. selector: "accept:",
  40405. protocol: 'visiting',
  40406. fn: function (aVisitor){
  40407. var self=this;
  40408. return $core.withContext(function($ctx1) {
  40409. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  40410. return self;
  40411. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  40412. },
  40413. args: ["aVisitor"],
  40414. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  40415. referencedClasses: [],
  40416. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  40417. }),
  40418. $globals.IRInlinedIfTrueIfFalse);
  40419. $core.addClass('IRInlinedSequence', $globals.IRBlockSequence, [], 'Compiler-Inlining');
  40420. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  40421. $core.addMethod(
  40422. $core.method({
  40423. selector: "accept:",
  40424. protocol: 'visiting',
  40425. fn: function (aVisitor){
  40426. var self=this;
  40427. return $core.withContext(function($ctx1) {
  40428. $recv(aVisitor)._visitIRInlinedSequence_(self);
  40429. return self;
  40430. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  40431. },
  40432. args: ["aVisitor"],
  40433. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  40434. referencedClasses: [],
  40435. messageSends: ["visitIRInlinedSequence:"]
  40436. }),
  40437. $globals.IRInlinedSequence);
  40438. $core.addMethod(
  40439. $core.method({
  40440. selector: "isInlined",
  40441. protocol: 'testing',
  40442. fn: function (){
  40443. var self=this;
  40444. return true;
  40445. },
  40446. args: [],
  40447. source: "isInlined\x0a\x09^ true",
  40448. referencedClasses: [],
  40449. messageSends: []
  40450. }),
  40451. $globals.IRInlinedSequence);
  40452. $core.addClass('IRInliner', $globals.IRVisitor, [], 'Compiler-Inlining');
  40453. $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`";
  40454. $core.addMethod(
  40455. $core.method({
  40456. selector: "assignmentInliner",
  40457. protocol: 'factory',
  40458. fn: function (){
  40459. var self=this;
  40460. function $IRAssignmentInliner(){return $globals.IRAssignmentInliner||(typeof IRAssignmentInliner=="undefined"?nil:IRAssignmentInliner)}
  40461. return $core.withContext(function($ctx1) {
  40462. var $2,$3,$1;
  40463. $2=$recv($IRAssignmentInliner())._new();
  40464. $recv($2)._translator_(self);
  40465. $3=$recv($2)._yourself();
  40466. $1=$3;
  40467. return $1;
  40468. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  40469. },
  40470. args: [],
  40471. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  40472. referencedClasses: ["IRAssignmentInliner"],
  40473. messageSends: ["translator:", "new", "yourself"]
  40474. }),
  40475. $globals.IRInliner);
  40476. $core.addMethod(
  40477. $core.method({
  40478. selector: "returnInliner",
  40479. protocol: 'factory',
  40480. fn: function (){
  40481. var self=this;
  40482. function $IRReturnInliner(){return $globals.IRReturnInliner||(typeof IRReturnInliner=="undefined"?nil:IRReturnInliner)}
  40483. return $core.withContext(function($ctx1) {
  40484. var $2,$3,$1;
  40485. $2=$recv($IRReturnInliner())._new();
  40486. $recv($2)._translator_(self);
  40487. $3=$recv($2)._yourself();
  40488. $1=$3;
  40489. return $1;
  40490. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  40491. },
  40492. args: [],
  40493. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  40494. referencedClasses: ["IRReturnInliner"],
  40495. messageSends: ["translator:", "new", "yourself"]
  40496. }),
  40497. $globals.IRInliner);
  40498. $core.addMethod(
  40499. $core.method({
  40500. selector: "sendInliner",
  40501. protocol: 'factory',
  40502. fn: function (){
  40503. var self=this;
  40504. function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  40505. return $core.withContext(function($ctx1) {
  40506. var $2,$3,$1;
  40507. $2=$recv($IRSendInliner())._new();
  40508. $recv($2)._translator_(self);
  40509. $3=$recv($2)._yourself();
  40510. $1=$3;
  40511. return $1;
  40512. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  40513. },
  40514. args: [],
  40515. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  40516. referencedClasses: ["IRSendInliner"],
  40517. messageSends: ["translator:", "new", "yourself"]
  40518. }),
  40519. $globals.IRInliner);
  40520. $core.addMethod(
  40521. $core.method({
  40522. selector: "shouldInlineAssignment:",
  40523. protocol: 'testing',
  40524. fn: function (anIRAssignment){
  40525. var self=this;
  40526. return $core.withContext(function($ctx1) {
  40527. var $4,$3,$2,$1;
  40528. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  40529. return $core.withContext(function($ctx2) {
  40530. $4=$recv(anIRAssignment)._instructions();
  40531. $ctx2.sendIdx["instructions"]=1;
  40532. $3=$recv($4)._last();
  40533. $ctx2.sendIdx["last"]=1;
  40534. $2=$recv($3)._isSend();
  40535. return $recv($2)._and_((function(){
  40536. return $core.withContext(function($ctx3) {
  40537. return self._shouldInlineSend_($recv($recv(anIRAssignment)._instructions())._last());
  40538. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  40539. }));
  40540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40541. }));
  40542. $ctx1.sendIdx["and:"]=1;
  40543. return $1;
  40544. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  40545. },
  40546. args: ["anIRAssignment"],
  40547. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment instructions last isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRAssignment instructions last) ]]",
  40548. referencedClasses: [],
  40549. messageSends: ["and:", "not", "isInlined", "isSend", "last", "instructions", "shouldInlineSend:"]
  40550. }),
  40551. $globals.IRInliner);
  40552. $core.addMethod(
  40553. $core.method({
  40554. selector: "shouldInlineReturn:",
  40555. protocol: 'testing',
  40556. fn: function (anIRReturn){
  40557. var self=this;
  40558. return $core.withContext(function($ctx1) {
  40559. var $4,$3,$2,$1;
  40560. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  40561. return $core.withContext(function($ctx2) {
  40562. $4=$recv(anIRReturn)._instructions();
  40563. $ctx2.sendIdx["instructions"]=1;
  40564. $3=$recv($4)._first();
  40565. $ctx2.sendIdx["first"]=1;
  40566. $2=$recv($3)._isSend();
  40567. return $recv($2)._and_((function(){
  40568. return $core.withContext(function($ctx3) {
  40569. return self._shouldInlineSend_($recv($recv(anIRReturn)._instructions())._first());
  40570. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  40571. }));
  40572. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40573. }));
  40574. $ctx1.sendIdx["and:"]=1;
  40575. return $1;
  40576. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  40577. },
  40578. args: ["anIRReturn"],
  40579. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn instructions first isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRReturn instructions first) ]]",
  40580. referencedClasses: [],
  40581. messageSends: ["and:", "not", "isInlined", "isSend", "first", "instructions", "shouldInlineSend:"]
  40582. }),
  40583. $globals.IRInliner);
  40584. $core.addMethod(
  40585. $core.method({
  40586. selector: "shouldInlineSend:",
  40587. protocol: 'testing',
  40588. fn: function (anIRSend){
  40589. var self=this;
  40590. function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  40591. return $core.withContext(function($ctx1) {
  40592. var $1;
  40593. $1=$recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  40594. return $core.withContext(function($ctx2) {
  40595. return $recv($IRSendInliner())._shouldInline_(anIRSend);
  40596. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40597. }));
  40598. return $1;
  40599. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  40600. },
  40601. args: ["anIRSend"],
  40602. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  40603. referencedClasses: ["IRSendInliner"],
  40604. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  40605. }),
  40606. $globals.IRInliner);
  40607. $core.addMethod(
  40608. $core.method({
  40609. selector: "transformNonLocalReturn:",
  40610. protocol: 'visiting',
  40611. fn: function (anIRNonLocalReturn){
  40612. var self=this;
  40613. var localReturn;
  40614. function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  40615. return $core.withContext(function($ctx1) {
  40616. var $2,$1,$4,$3,$5,$6,$7,$8,$9;
  40617. $2=$recv(anIRNonLocalReturn)._scope();
  40618. $ctx1.sendIdx["scope"]=1;
  40619. $1=$recv($2)._canInlineNonLocalReturns();
  40620. if($core.assert($1)){
  40621. $4=$recv(anIRNonLocalReturn)._scope();
  40622. $ctx1.sendIdx["scope"]=2;
  40623. $3=$recv($4)._methodScope();
  40624. $5=$recv(anIRNonLocalReturn)._scope();
  40625. $ctx1.sendIdx["scope"]=3;
  40626. $recv($3)._removeNonLocalReturn_($5);
  40627. $6=$recv($IRReturn())._new();
  40628. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  40629. $7=$recv($6)._yourself();
  40630. localReturn=$7;
  40631. localReturn;
  40632. $recv($recv(anIRNonLocalReturn)._instructions())._do_((function(each){
  40633. return $core.withContext(function($ctx2) {
  40634. return $recv(localReturn)._add_(each);
  40635. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40636. }));
  40637. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  40638. $8=localReturn;
  40639. return $8;
  40640. };
  40641. $9=(
  40642. $ctx1.supercall = true,
  40643. $globals.IRInliner.superclass.fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  40644. $ctx1.supercall = false;
  40645. return $9;
  40646. }, function($ctx1) {$ctx1.fill(self,"transformNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  40647. },
  40648. args: ["anIRNonLocalReturn"],
  40649. 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",
  40650. referencedClasses: ["IRReturn"],
  40651. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "instructions", "add:", "replaceWith:", "visitIRNonLocalReturn:"]
  40652. }),
  40653. $globals.IRInliner);
  40654. $core.addMethod(
  40655. $core.method({
  40656. selector: "visitIRAssignment:",
  40657. protocol: 'visiting',
  40658. fn: function (anIRAssignment){
  40659. var self=this;
  40660. return $core.withContext(function($ctx1) {
  40661. var $2,$1;
  40662. $2=self._shouldInlineAssignment_(anIRAssignment);
  40663. if($core.assert($2)){
  40664. $1=$recv(self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  40665. } else {
  40666. $1=(
  40667. $ctx1.supercall = true,
  40668. $globals.IRInliner.superclass.fn.prototype._visitIRAssignment_.apply($recv(self), [anIRAssignment]));
  40669. $ctx1.supercall = false;
  40670. };
  40671. return $1;
  40672. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  40673. },
  40674. args: ["anIRAssignment"],
  40675. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  40676. referencedClasses: [],
  40677. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  40678. }),
  40679. $globals.IRInliner);
  40680. $core.addMethod(
  40681. $core.method({
  40682. selector: "visitIRNonLocalReturn:",
  40683. protocol: 'visiting',
  40684. fn: function (anIRNonLocalReturn){
  40685. var self=this;
  40686. return $core.withContext(function($ctx1) {
  40687. var $1;
  40688. $1=self._transformNonLocalReturn_(anIRNonLocalReturn);
  40689. return $1;
  40690. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRInliner)});
  40691. },
  40692. args: ["anIRNonLocalReturn"],
  40693. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self transformNonLocalReturn: anIRNonLocalReturn",
  40694. referencedClasses: [],
  40695. messageSends: ["transformNonLocalReturn:"]
  40696. }),
  40697. $globals.IRInliner);
  40698. $core.addMethod(
  40699. $core.method({
  40700. selector: "visitIRReturn:",
  40701. protocol: 'visiting',
  40702. fn: function (anIRReturn){
  40703. var self=this;
  40704. return $core.withContext(function($ctx1) {
  40705. var $2,$1;
  40706. $2=self._shouldInlineReturn_(anIRReturn);
  40707. if($core.assert($2)){
  40708. $1=$recv(self._returnInliner())._inlineReturn_(anIRReturn);
  40709. } else {
  40710. $1=(
  40711. $ctx1.supercall = true,
  40712. $globals.IRInliner.superclass.fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  40713. $ctx1.supercall = false;
  40714. };
  40715. return $1;
  40716. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  40717. },
  40718. args: ["anIRReturn"],
  40719. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  40720. referencedClasses: [],
  40721. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  40722. }),
  40723. $globals.IRInliner);
  40724. $core.addMethod(
  40725. $core.method({
  40726. selector: "visitIRSend:",
  40727. protocol: 'visiting',
  40728. fn: function (anIRSend){
  40729. var self=this;
  40730. return $core.withContext(function($ctx1) {
  40731. var $2,$1;
  40732. $2=self._shouldInlineSend_(anIRSend);
  40733. if($core.assert($2)){
  40734. $1=$recv(self._sendInliner())._inlineSend_(anIRSend);
  40735. } else {
  40736. $1=(
  40737. $ctx1.supercall = true,
  40738. $globals.IRInliner.superclass.fn.prototype._visitIRSend_.apply($recv(self), [anIRSend]));
  40739. $ctx1.supercall = false;
  40740. };
  40741. return $1;
  40742. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  40743. },
  40744. args: ["anIRSend"],
  40745. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  40746. referencedClasses: [],
  40747. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  40748. }),
  40749. $globals.IRInliner);
  40750. $core.addClass('IRInliningJSTranslator', $globals.IRJSTranslator, [], 'Compiler-Inlining');
  40751. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  40752. $core.addMethod(
  40753. $core.method({
  40754. selector: "visitIRInlinedAssignment:",
  40755. protocol: 'visiting',
  40756. fn: function (anIRInlinedAssignment){
  40757. var self=this;
  40758. return $core.withContext(function($ctx1) {
  40759. self._visit_($recv($recv(anIRInlinedAssignment)._instructions())._last());
  40760. return self;
  40761. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},$globals.IRInliningJSTranslator)});
  40762. },
  40763. args: ["anIRInlinedAssignment"],
  40764. source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last",
  40765. referencedClasses: [],
  40766. messageSends: ["visit:", "last", "instructions"]
  40767. }),
  40768. $globals.IRInliningJSTranslator);
  40769. $core.addMethod(
  40770. $core.method({
  40771. selector: "visitIRInlinedClosure:",
  40772. protocol: 'visiting',
  40773. fn: function (anIRInlinedClosure){
  40774. var self=this;
  40775. return $core.withContext(function($ctx1) {
  40776. $recv(self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  40777. return $core.withContext(function($ctx2) {
  40778. return $recv($recv(each)._name())._asVariableName();
  40779. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40780. })));
  40781. $recv($recv(anIRInlinedClosure)._instructions())._do_((function(each){
  40782. return $core.withContext(function($ctx2) {
  40783. return self._visit_(each);
  40784. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40785. }));
  40786. return self;
  40787. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  40788. },
  40789. args: ["anIRInlinedClosure"],
  40790. 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 ]",
  40791. referencedClasses: [],
  40792. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "instructions", "visit:"]
  40793. }),
  40794. $globals.IRInliningJSTranslator);
  40795. $core.addMethod(
  40796. $core.method({
  40797. selector: "visitIRInlinedIfFalse:",
  40798. protocol: 'visiting',
  40799. fn: function (anIRInlinedIfFalse){
  40800. var self=this;
  40801. return $core.withContext(function($ctx1) {
  40802. var $1,$2,$4,$3;
  40803. $1=self._stream();
  40804. $ctx1.sendIdx["stream"]=1;
  40805. $recv($1)._nextPutIf_with_((function(){
  40806. return $core.withContext(function($ctx2) {
  40807. $2=self._stream();
  40808. $ctx2.sendIdx["stream"]=2;
  40809. $recv($2)._nextPutAll_("!$core.assert(");
  40810. $ctx2.sendIdx["nextPutAll:"]=1;
  40811. $4=$recv(anIRInlinedIfFalse)._instructions();
  40812. $ctx2.sendIdx["instructions"]=1;
  40813. $3=$recv($4)._first();
  40814. self._visit_($3);
  40815. $ctx2.sendIdx["visit:"]=1;
  40816. return $recv(self._stream())._nextPutAll_(")");
  40817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40818. }),(function(){
  40819. return $core.withContext(function($ctx2) {
  40820. return self._visit_($recv($recv(anIRInlinedIfFalse)._instructions())._last());
  40821. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40822. }));
  40823. return self;
  40824. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  40825. },
  40826. args: ["anIRInlinedIfFalse"],
  40827. source: "visitIRInlinedIfFalse: anIRInlinedIfFalse\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '!$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfFalse instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfFalse instructions last ]",
  40828. referencedClasses: [],
  40829. messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
  40830. }),
  40831. $globals.IRInliningJSTranslator);
  40832. $core.addMethod(
  40833. $core.method({
  40834. selector: "visitIRInlinedIfNilIfNotNil:",
  40835. protocol: 'visiting',
  40836. fn: function (anIRInlinedIfNilIfNotNil){
  40837. var self=this;
  40838. return $core.withContext(function($ctx1) {
  40839. var $1,$2,$3,$5,$4,$7,$6;
  40840. $1=self._stream();
  40841. $ctx1.sendIdx["stream"]=1;
  40842. $recv($1)._nextPutIfElse_with_with_((function(){
  40843. return $core.withContext(function($ctx2) {
  40844. $2=self._stream();
  40845. $ctx2.sendIdx["stream"]=2;
  40846. $3=$recv("(".__comma($recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName())).__comma(" = ");
  40847. $ctx2.sendIdx[","]=1;
  40848. $recv($2)._nextPutAll_($3);
  40849. $ctx2.sendIdx["nextPutAll:"]=1;
  40850. $5=$recv(anIRInlinedIfNilIfNotNil)._instructions();
  40851. $ctx2.sendIdx["instructions"]=1;
  40852. $4=$recv($5)._first();
  40853. self._visit_($4);
  40854. $ctx2.sendIdx["visit:"]=1;
  40855. return $recv(self._stream())._nextPutAll_(") == null || $receiver.isNil");
  40856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40857. }),(function(){
  40858. return $core.withContext(function($ctx2) {
  40859. $7=$recv(anIRInlinedIfNilIfNotNil)._instructions();
  40860. $ctx2.sendIdx["instructions"]=2;
  40861. $6=$recv($7)._second();
  40862. return self._visit_($6);
  40863. $ctx2.sendIdx["visit:"]=2;
  40864. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40865. }),(function(){
  40866. return $core.withContext(function($ctx2) {
  40867. return self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._instructions())._third());
  40868. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40869. }));
  40870. return self;
  40871. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  40872. },
  40873. args: ["anIRInlinedIfNilIfNotNil"],
  40874. source: "visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil\x0a\x09self stream\x0a\x09\x09nextPutIfElse: [\x0a\x09\x09\x09self stream nextPutAll: '(', anIRInlinedIfNilIfNotNil receiverInternalVariableName, ' = '.\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil instructions first.\x0a\x09\x09\x09self stream nextPutAll: ') == null || $receiver.isNil' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions third ]",
  40875. referencedClasses: [],
  40876. messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", ",", "receiverInternalVariableName", "visit:", "first", "instructions", "second", "third"]
  40877. }),
  40878. $globals.IRInliningJSTranslator);
  40879. $core.addMethod(
  40880. $core.method({
  40881. selector: "visitIRInlinedIfTrue:",
  40882. protocol: 'visiting',
  40883. fn: function (anIRInlinedIfTrue){
  40884. var self=this;
  40885. return $core.withContext(function($ctx1) {
  40886. var $1,$2,$4,$3;
  40887. $1=self._stream();
  40888. $ctx1.sendIdx["stream"]=1;
  40889. $recv($1)._nextPutIf_with_((function(){
  40890. return $core.withContext(function($ctx2) {
  40891. $2=self._stream();
  40892. $ctx2.sendIdx["stream"]=2;
  40893. $recv($2)._nextPutAll_("$core.assert(");
  40894. $ctx2.sendIdx["nextPutAll:"]=1;
  40895. $4=$recv(anIRInlinedIfTrue)._instructions();
  40896. $ctx2.sendIdx["instructions"]=1;
  40897. $3=$recv($4)._first();
  40898. self._visit_($3);
  40899. $ctx2.sendIdx["visit:"]=1;
  40900. return $recv(self._stream())._nextPutAll_(")");
  40901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40902. }),(function(){
  40903. return $core.withContext(function($ctx2) {
  40904. return self._visit_($recv($recv(anIRInlinedIfTrue)._instructions())._last());
  40905. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40906. }));
  40907. return self;
  40908. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  40909. },
  40910. args: ["anIRInlinedIfTrue"],
  40911. source: "visitIRInlinedIfTrue: anIRInlinedIfTrue\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfTrue instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrue instructions last ]",
  40912. referencedClasses: [],
  40913. messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
  40914. }),
  40915. $globals.IRInliningJSTranslator);
  40916. $core.addMethod(
  40917. $core.method({
  40918. selector: "visitIRInlinedIfTrueIfFalse:",
  40919. protocol: 'visiting',
  40920. fn: function (anIRInlinedIfTrueIfFalse){
  40921. var self=this;
  40922. return $core.withContext(function($ctx1) {
  40923. var $1,$2,$4,$3,$6,$5;
  40924. $1=self._stream();
  40925. $ctx1.sendIdx["stream"]=1;
  40926. $recv($1)._nextPutIfElse_with_with_((function(){
  40927. return $core.withContext(function($ctx2) {
  40928. $2=self._stream();
  40929. $ctx2.sendIdx["stream"]=2;
  40930. $recv($2)._nextPutAll_("$core.assert(");
  40931. $ctx2.sendIdx["nextPutAll:"]=1;
  40932. $4=$recv(anIRInlinedIfTrueIfFalse)._instructions();
  40933. $ctx2.sendIdx["instructions"]=1;
  40934. $3=$recv($4)._first();
  40935. self._visit_($3);
  40936. $ctx2.sendIdx["visit:"]=1;
  40937. return $recv(self._stream())._nextPutAll_(")");
  40938. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40939. }),(function(){
  40940. return $core.withContext(function($ctx2) {
  40941. $6=$recv(anIRInlinedIfTrueIfFalse)._instructions();
  40942. $ctx2.sendIdx["instructions"]=2;
  40943. $5=$recv($6)._second();
  40944. return self._visit_($5);
  40945. $ctx2.sendIdx["visit:"]=2;
  40946. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40947. }),(function(){
  40948. return $core.withContext(function($ctx2) {
  40949. return self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._instructions())._third());
  40950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40951. }));
  40952. return self;
  40953. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  40954. },
  40955. args: ["anIRInlinedIfTrueIfFalse"],
  40956. source: "visitIRInlinedIfTrueIfFalse: anIRInlinedIfTrueIfFalse\x0a\x09self stream\x0a\x09\x09nextPutIfElse: [\x0a\x09\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09\x09self visit: anIRInlinedIfTrueIfFalse instructions first.\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrueIfFalse instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrueIfFalse instructions third ]",
  40957. referencedClasses: [],
  40958. messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "second", "third"]
  40959. }),
  40960. $globals.IRInliningJSTranslator);
  40961. $core.addMethod(
  40962. $core.method({
  40963. selector: "visitIRInlinedNonLocalReturn:",
  40964. protocol: 'visiting',
  40965. fn: function (anIRInlinedReturn){
  40966. var self=this;
  40967. return $core.withContext(function($ctx1) {
  40968. var $1;
  40969. $1=self._stream();
  40970. $ctx1.sendIdx["stream"]=1;
  40971. $recv($1)._nextPutStatementWith_((function(){
  40972. return $core.withContext(function($ctx2) {
  40973. return self._visit_($recv($recv(anIRInlinedReturn)._instructions())._last());
  40974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40975. }));
  40976. $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
  40977. }));
  40978. return self;
  40979. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedNonLocalReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)});
  40980. },
  40981. args: ["anIRInlinedReturn"],
  40982. source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]",
  40983. referencedClasses: [],
  40984. messageSends: ["nextPutStatementWith:", "stream", "visit:", "last", "instructions", "nextPutNonLocalReturnWith:"]
  40985. }),
  40986. $globals.IRInliningJSTranslator);
  40987. $core.addMethod(
  40988. $core.method({
  40989. selector: "visitIRInlinedReturn:",
  40990. protocol: 'visiting',
  40991. fn: function (anIRInlinedReturn){
  40992. var self=this;
  40993. return $core.withContext(function($ctx1) {
  40994. self._visit_($recv($recv(anIRInlinedReturn)._instructions())._last());
  40995. return self;
  40996. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)});
  40997. },
  40998. args: ["anIRInlinedReturn"],
  40999. source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last",
  41000. referencedClasses: [],
  41001. messageSends: ["visit:", "last", "instructions"]
  41002. }),
  41003. $globals.IRInliningJSTranslator);
  41004. $core.addMethod(
  41005. $core.method({
  41006. selector: "visitIRInlinedSequence:",
  41007. protocol: 'visiting',
  41008. fn: function (anIRInlinedSequence){
  41009. var self=this;
  41010. return $core.withContext(function($ctx1) {
  41011. $recv($recv(anIRInlinedSequence)._instructions())._do_((function(each){
  41012. return $core.withContext(function($ctx2) {
  41013. return $recv(self._stream())._nextPutStatementWith_((function(){
  41014. return $core.withContext(function($ctx3) {
  41015. return self._visit_(each);
  41016. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41017. }));
  41018. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41019. }));
  41020. return self;
  41021. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRInliningJSTranslator)});
  41022. },
  41023. args: ["anIRInlinedSequence"],
  41024. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
  41025. referencedClasses: [],
  41026. messageSends: ["do:", "instructions", "nextPutStatementWith:", "stream", "visit:"]
  41027. }),
  41028. $globals.IRInliningJSTranslator);
  41029. $core.addClass('IRSendInliner', $globals.Object, ['send', 'translator'], 'Compiler-Inlining');
  41030. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  41031. $core.addMethod(
  41032. $core.method({
  41033. selector: "ifFalse:",
  41034. protocol: 'inlining',
  41035. fn: function (anIRInstruction){
  41036. var self=this;
  41037. function $IRInlinedIfFalse(){return $globals.IRInlinedIfFalse||(typeof IRInlinedIfFalse=="undefined"?nil:IRInlinedIfFalse)}
  41038. return $core.withContext(function($ctx1) {
  41039. var $1;
  41040. $1=self._inlinedSend_with_($recv($IRInlinedIfFalse())._new(),anIRInstruction);
  41041. return $1;
  41042. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41043. },
  41044. args: ["anIRInstruction"],
  41045. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new with: anIRInstruction",
  41046. referencedClasses: ["IRInlinedIfFalse"],
  41047. messageSends: ["inlinedSend:with:", "new"]
  41048. }),
  41049. $globals.IRSendInliner);
  41050. $core.addMethod(
  41051. $core.method({
  41052. selector: "ifFalse:ifTrue:",
  41053. protocol: 'inlining',
  41054. fn: function (anIRInstruction,anotherIRInstruction){
  41055. var self=this;
  41056. return $core.withContext(function($ctx1) {
  41057. var $1;
  41058. $1=self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  41059. return $1;
  41060. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41061. },
  41062. args: ["anIRInstruction", "anotherIRInstruction"],
  41063. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  41064. referencedClasses: [],
  41065. messageSends: ["perform:withArguments:"]
  41066. }),
  41067. $globals.IRSendInliner);
  41068. $core.addMethod(
  41069. $core.method({
  41070. selector: "ifNil:",
  41071. protocol: 'inlining',
  41072. fn: function (anIRInstruction){
  41073. var self=this;
  41074. function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  41075. function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  41076. function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  41077. return $core.withContext(function($ctx1) {
  41078. var $2,$4,$5,$7,$8,$6,$9,$3,$1;
  41079. $2=$recv($IRInlinedIfNilIfNotNil())._new();
  41080. $ctx1.sendIdx["new"]=1;
  41081. $4=$recv($IRClosure())._new();
  41082. $ctx1.sendIdx["new"]=2;
  41083. $recv($4)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  41084. $5=$4;
  41085. $7=$recv($IRBlockSequence())._new();
  41086. $recv($7)._add_($recv($recv(self._send())._instructions())._first());
  41087. $8=$recv($7)._yourself();
  41088. $ctx1.sendIdx["yourself"]=1;
  41089. $6=$8;
  41090. $recv($5)._add_($6);
  41091. $ctx1.sendIdx["add:"]=1;
  41092. $9=$recv($4)._yourself();
  41093. $3=$9;
  41094. $1=self._inlinedSend_with_with_($2,anIRInstruction,$3);
  41095. return $1;
  41096. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41097. },
  41098. args: ["anIRInstruction"],
  41099. source: "ifNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09with: anIRInstruction\x0a\x09\x09with: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)",
  41100. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  41101. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
  41102. }),
  41103. $globals.IRSendInliner);
  41104. $core.addMethod(
  41105. $core.method({
  41106. selector: "ifNil:ifNotNil:",
  41107. protocol: 'inlining',
  41108. fn: function (anIRInstruction,anotherIRInstruction){
  41109. var self=this;
  41110. function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  41111. return $core.withContext(function($ctx1) {
  41112. var $1;
  41113. $1=self._inlinedSend_with_with_($recv($IRInlinedIfNilIfNotNil())._new(),anIRInstruction,anotherIRInstruction);
  41114. return $1;
  41115. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41116. },
  41117. args: ["anIRInstruction", "anotherIRInstruction"],
  41118. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anIRInstruction with: anotherIRInstruction",
  41119. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  41120. messageSends: ["inlinedSend:with:with:", "new"]
  41121. }),
  41122. $globals.IRSendInliner);
  41123. $core.addMethod(
  41124. $core.method({
  41125. selector: "ifNotNil:",
  41126. protocol: 'inlining',
  41127. fn: function (anIRInstruction){
  41128. var self=this;
  41129. function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  41130. function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  41131. function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  41132. return $core.withContext(function($ctx1) {
  41133. var $2,$4,$5,$7,$8,$6,$9,$3,$1;
  41134. $2=$recv($IRInlinedIfNilIfNotNil())._new();
  41135. $ctx1.sendIdx["new"]=1;
  41136. $4=$recv($IRClosure())._new();
  41137. $ctx1.sendIdx["new"]=2;
  41138. $recv($4)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  41139. $5=$4;
  41140. $7=$recv($IRBlockSequence())._new();
  41141. $recv($7)._add_($recv($recv(self._send())._instructions())._first());
  41142. $8=$recv($7)._yourself();
  41143. $ctx1.sendIdx["yourself"]=1;
  41144. $6=$8;
  41145. $recv($5)._add_($6);
  41146. $ctx1.sendIdx["add:"]=1;
  41147. $9=$recv($4)._yourself();
  41148. $3=$9;
  41149. $1=self._inlinedSend_with_with_($2,$3,anIRInstruction);
  41150. return $1;
  41151. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41152. },
  41153. args: ["anIRInstruction"],
  41154. source: "ifNotNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09with: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)\x0a\x09\x09with: anIRInstruction",
  41155. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  41156. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
  41157. }),
  41158. $globals.IRSendInliner);
  41159. $core.addMethod(
  41160. $core.method({
  41161. selector: "ifNotNil:ifNil:",
  41162. protocol: 'inlining',
  41163. fn: function (anIRInstruction,anotherIRInstruction){
  41164. var self=this;
  41165. function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  41166. return $core.withContext(function($ctx1) {
  41167. var $1;
  41168. $1=self._inlinedSend_with_with_($recv($IRInlinedIfNilIfNotNil())._new(),anotherIRInstruction,anIRInstruction);
  41169. return $1;
  41170. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41171. },
  41172. args: ["anIRInstruction", "anotherIRInstruction"],
  41173. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anotherIRInstruction with: anIRInstruction",
  41174. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  41175. messageSends: ["inlinedSend:with:with:", "new"]
  41176. }),
  41177. $globals.IRSendInliner);
  41178. $core.addMethod(
  41179. $core.method({
  41180. selector: "ifTrue:",
  41181. protocol: 'inlining',
  41182. fn: function (anIRInstruction){
  41183. var self=this;
  41184. function $IRInlinedIfTrue(){return $globals.IRInlinedIfTrue||(typeof IRInlinedIfTrue=="undefined"?nil:IRInlinedIfTrue)}
  41185. return $core.withContext(function($ctx1) {
  41186. var $1;
  41187. $1=self._inlinedSend_with_($recv($IRInlinedIfTrue())._new(),anIRInstruction);
  41188. return $1;
  41189. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41190. },
  41191. args: ["anIRInstruction"],
  41192. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new with: anIRInstruction",
  41193. referencedClasses: ["IRInlinedIfTrue"],
  41194. messageSends: ["inlinedSend:with:", "new"]
  41195. }),
  41196. $globals.IRSendInliner);
  41197. $core.addMethod(
  41198. $core.method({
  41199. selector: "ifTrue:ifFalse:",
  41200. protocol: 'inlining',
  41201. fn: function (anIRInstruction,anotherIRInstruction){
  41202. var self=this;
  41203. function $IRInlinedIfTrueIfFalse(){return $globals.IRInlinedIfTrueIfFalse||(typeof IRInlinedIfTrueIfFalse=="undefined"?nil:IRInlinedIfTrueIfFalse)}
  41204. return $core.withContext(function($ctx1) {
  41205. var $1;
  41206. $1=self._inlinedSend_with_with_($recv($IRInlinedIfTrueIfFalse())._new(),anIRInstruction,anotherIRInstruction);
  41207. return $1;
  41208. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41209. },
  41210. args: ["anIRInstruction", "anotherIRInstruction"],
  41211. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new with: anIRInstruction with: anotherIRInstruction",
  41212. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  41213. messageSends: ["inlinedSend:with:with:", "new"]
  41214. }),
  41215. $globals.IRSendInliner);
  41216. $core.addMethod(
  41217. $core.method({
  41218. selector: "inlineClosure:",
  41219. protocol: 'inlining',
  41220. fn: function (anIRClosure){
  41221. var self=this;
  41222. var inlinedClosure,sequence,statements;
  41223. function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  41224. function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  41225. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  41226. function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  41227. return $core.withContext(function($ctx1) {
  41228. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$11,$12,$14,$16,$17,$18,$19,$15,$13,$20,$22,$24,$25,$23,$21,$26,$10,$28,$27,$31,$30,$32,$29,$33,$36,$35,$34,$37;
  41229. inlinedClosure=self._inlinedClosure();
  41230. $1=inlinedClosure;
  41231. $2=$1;
  41232. $3=$recv(anIRClosure)._scope();
  41233. $ctx1.sendIdx["scope"]=1;
  41234. $recv($2)._scope_($3);
  41235. $ctx1.sendIdx["scope:"]=1;
  41236. $4=$recv($1)._parent_($recv(anIRClosure)._parent());
  41237. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  41238. return $core.withContext(function($ctx2) {
  41239. return $recv(inlinedClosure)._add_(each);
  41240. $ctx2.sendIdx["add:"]=1;
  41241. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41242. }));
  41243. $ctx1.sendIdx["do:"]=1;
  41244. sequence=self._inlinedSequence();
  41245. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  41246. return $core.withContext(function($ctx2) {
  41247. $5=inlinedClosure;
  41248. $7=$recv($IRTempDeclaration())._new();
  41249. $ctx2.sendIdx["new"]=1;
  41250. $recv($7)._name_(each);
  41251. $ctx2.sendIdx["name:"]=1;
  41252. $8=$recv($7)._yourself();
  41253. $ctx2.sendIdx["yourself"]=1;
  41254. $6=$8;
  41255. $recv($5)._add_($6);
  41256. $ctx2.sendIdx["add:"]=2;
  41257. $9=sequence;
  41258. $11=$recv($IRAssignment())._new();
  41259. $ctx2.sendIdx["new"]=2;
  41260. $12=$11;
  41261. $14=$recv($IRVariable())._new();
  41262. $ctx2.sendIdx["new"]=3;
  41263. $16=$recv($AliasVar())._new();
  41264. $ctx2.sendIdx["new"]=4;
  41265. $17=$16;
  41266. $18=$recv(inlinedClosure)._scope();
  41267. $ctx2.sendIdx["scope"]=2;
  41268. $recv($17)._scope_($18);
  41269. $ctx2.sendIdx["scope:"]=2;
  41270. $recv($16)._name_(each);
  41271. $ctx2.sendIdx["name:"]=2;
  41272. $19=$recv($16)._yourself();
  41273. $ctx2.sendIdx["yourself"]=2;
  41274. $15=$19;
  41275. $13=$recv($14)._variable_($15);
  41276. $ctx2.sendIdx["variable:"]=1;
  41277. $recv($12)._add_($13);
  41278. $ctx2.sendIdx["add:"]=4;
  41279. $20=$11;
  41280. $22=$recv($IRVariable())._new();
  41281. $ctx2.sendIdx["new"]=5;
  41282. $24=$recv($AliasVar())._new();
  41283. $recv($24)._scope_($recv(inlinedClosure)._scope());
  41284. $recv($24)._name_("$receiver");
  41285. $25=$recv($24)._yourself();
  41286. $ctx2.sendIdx["yourself"]=3;
  41287. $23=$25;
  41288. $21=$recv($22)._variable_($23);
  41289. $recv($20)._add_($21);
  41290. $ctx2.sendIdx["add:"]=5;
  41291. $26=$recv($11)._yourself();
  41292. $10=$26;
  41293. return $recv($9)._add_($10);
  41294. $ctx2.sendIdx["add:"]=3;
  41295. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41296. }));
  41297. $ctx1.sendIdx["do:"]=2;
  41298. $recv(inlinedClosure)._add_(sequence);
  41299. $ctx1.sendIdx["add:"]=6;
  41300. $28=$recv(anIRClosure)._instructions();
  41301. $ctx1.sendIdx["instructions"]=2;
  41302. $27=$recv($28)._last();
  41303. $ctx1.sendIdx["last"]=1;
  41304. statements=$recv($27)._instructions();
  41305. $ctx1.sendIdx["instructions"]=1;
  41306. $recv(statements)._ifNotEmpty_((function(){
  41307. return $core.withContext(function($ctx2) {
  41308. $recv($recv(statements)._allButLast())._do_((function(each){
  41309. return $core.withContext(function($ctx3) {
  41310. return $recv(sequence)._add_(each);
  41311. $ctx3.sendIdx["add:"]=7;
  41312. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  41313. }));
  41314. $31=$recv(statements)._last();
  41315. $ctx2.sendIdx["last"]=2;
  41316. $30=$recv($31)._isReturn();
  41317. $29=$recv($30)._and_((function(){
  41318. return $core.withContext(function($ctx3) {
  41319. $32=$recv(statements)._last();
  41320. $ctx3.sendIdx["last"]=3;
  41321. return $recv($32)._isBlockReturn();
  41322. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  41323. }));
  41324. if($core.assert($29)){
  41325. $33=sequence;
  41326. $36=$recv(statements)._last();
  41327. $ctx2.sendIdx["last"]=4;
  41328. $35=$recv($36)._instructions();
  41329. $34=$recv($35)._first();
  41330. return $recv($33)._add_($34);
  41331. $ctx2.sendIdx["add:"]=8;
  41332. } else {
  41333. return $recv(sequence)._add_($recv(statements)._last());
  41334. };
  41335. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41336. }));
  41337. $37=inlinedClosure;
  41338. return $37;
  41339. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  41340. },
  41341. args: ["anIRClosure"],
  41342. 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",
  41343. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  41344. 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"]
  41345. }),
  41346. $globals.IRSendInliner);
  41347. $core.addMethod(
  41348. $core.method({
  41349. selector: "inlineSend:",
  41350. protocol: 'inlining',
  41351. fn: function (anIRSend){
  41352. var self=this;
  41353. return $core.withContext(function($ctx1) {
  41354. var $3,$2,$1;
  41355. self._send_(anIRSend);
  41356. $3=self._send();
  41357. $ctx1.sendIdx["send"]=1;
  41358. $2=$recv($3)._selector();
  41359. $1=self._perform_withArguments_($2,$recv($recv(self._send())._instructions())._allButFirst());
  41360. return $1;
  41361. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  41362. },
  41363. args: ["anIRSend"],
  41364. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send instructions allButFirst",
  41365. referencedClasses: [],
  41366. messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"]
  41367. }),
  41368. $globals.IRSendInliner);
  41369. $core.addMethod(
  41370. $core.method({
  41371. selector: "inlinedClosure",
  41372. protocol: 'factory',
  41373. fn: function (){
  41374. var self=this;
  41375. function $IRInlinedClosure(){return $globals.IRInlinedClosure||(typeof IRInlinedClosure=="undefined"?nil:IRInlinedClosure)}
  41376. return $core.withContext(function($ctx1) {
  41377. var $1;
  41378. $1=$recv($IRInlinedClosure())._new();
  41379. return $1;
  41380. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  41381. },
  41382. args: [],
  41383. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  41384. referencedClasses: ["IRInlinedClosure"],
  41385. messageSends: ["new"]
  41386. }),
  41387. $globals.IRSendInliner);
  41388. $core.addMethod(
  41389. $core.method({
  41390. selector: "inlinedSend:with:",
  41391. protocol: 'inlining',
  41392. fn: function (inlinedSend,anIRInstruction){
  41393. var self=this;
  41394. var inlinedClosure;
  41395. return $core.withContext(function($ctx1) {
  41396. var $1,$2,$5,$4,$3,$6,$7;
  41397. $1=$recv(anIRInstruction)._isClosure();
  41398. if(!$core.assert($1)){
  41399. self._inliningError_("Message argument should be a block");
  41400. $ctx1.sendIdx["inliningError:"]=1;
  41401. };
  41402. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  41403. if(!$core.assert($2)){
  41404. self._inliningError_("Inlined block should have zero argument");
  41405. };
  41406. inlinedClosure=$recv(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  41407. $5=self._send();
  41408. $ctx1.sendIdx["send"]=1;
  41409. $4=$recv($5)._instructions();
  41410. $3=$recv($4)._first();
  41411. $recv(inlinedSend)._add_($3);
  41412. $ctx1.sendIdx["add:"]=1;
  41413. $6=$recv(inlinedSend)._add_(inlinedClosure);
  41414. $recv(self._send())._replaceWith_(inlinedSend);
  41415. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  41416. $ctx1.sendIdx["internalVariables"]=1;
  41417. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  41418. return inlinedSend;
  41419. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  41420. },
  41421. args: ["inlinedSend", "anIRInstruction"],
  41422. source: "inlinedSend: inlinedSend with: anIRInstruction\x0a\x09| inlinedClosure |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anIRInstruction arguments size = 0 ifFalse: [ self inliningError: 'Inlined block should have zero argument' ].\x0a\x0a\x09inlinedClosure := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x0a\x09^ inlinedSend",
  41423. referencedClasses: [],
  41424. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  41425. }),
  41426. $globals.IRSendInliner);
  41427. $core.addMethod(
  41428. $core.method({
  41429. selector: "inlinedSend:with:with:",
  41430. protocol: 'inlining',
  41431. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  41432. var self=this;
  41433. var inlinedClosure1,inlinedClosure2;
  41434. return $core.withContext(function($ctx1) {
  41435. var $1,$2,$3,$4,$7,$6,$5,$8,$9;
  41436. $1=$recv(anIRInstruction)._isClosure();
  41437. $ctx1.sendIdx["isClosure"]=1;
  41438. if(!$core.assert($1)){
  41439. self._inliningError_("Message argument should be a block");
  41440. $ctx1.sendIdx["inliningError:"]=1;
  41441. };
  41442. $2=$recv(anotherIRInstruction)._isClosure();
  41443. if(!$core.assert($2)){
  41444. self._inliningError_("Message argument should be a block");
  41445. };
  41446. $3=self._translator();
  41447. $ctx1.sendIdx["translator"]=1;
  41448. $4=self._inlineClosure_(anIRInstruction);
  41449. $ctx1.sendIdx["inlineClosure:"]=1;
  41450. inlinedClosure1=$recv($3)._visit_($4);
  41451. $ctx1.sendIdx["visit:"]=1;
  41452. inlinedClosure2=$recv(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
  41453. $7=self._send();
  41454. $ctx1.sendIdx["send"]=1;
  41455. $6=$recv($7)._instructions();
  41456. $5=$recv($6)._first();
  41457. $recv(inlinedSend)._add_($5);
  41458. $ctx1.sendIdx["add:"]=1;
  41459. $recv(inlinedSend)._add_(inlinedClosure1);
  41460. $ctx1.sendIdx["add:"]=2;
  41461. $8=$recv(inlinedSend)._add_(inlinedClosure2);
  41462. $recv(self._send())._replaceWith_(inlinedSend);
  41463. $9=$recv($recv(inlinedSend)._method())._internalVariables();
  41464. $ctx1.sendIdx["internalVariables"]=1;
  41465. $recv($9)._addAll_($recv(inlinedSend)._internalVariables());
  41466. return inlinedSend;
  41467. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  41468. },
  41469. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  41470. source: "inlinedSend: inlinedSend with: anIRInstruction with: anotherIRInstruction\x0a\x09| inlinedClosure1 inlinedClosure2 |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anotherIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x0a\x09inlinedClosure1 := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x09inlinedClosure2 := self translator visit: (self inlineClosure: anotherIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure1;\x0a\x09\x09add: inlinedClosure2.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x09\x09\x0a\x09^ inlinedSend",
  41471. referencedClasses: [],
  41472. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  41473. }),
  41474. $globals.IRSendInliner);
  41475. $core.addMethod(
  41476. $core.method({
  41477. selector: "inlinedSequence",
  41478. protocol: 'factory',
  41479. fn: function (){
  41480. var self=this;
  41481. function $IRInlinedSequence(){return $globals.IRInlinedSequence||(typeof IRInlinedSequence=="undefined"?nil:IRInlinedSequence)}
  41482. return $core.withContext(function($ctx1) {
  41483. var $1;
  41484. $1=$recv($IRInlinedSequence())._new();
  41485. return $1;
  41486. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  41487. },
  41488. args: [],
  41489. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  41490. referencedClasses: ["IRInlinedSequence"],
  41491. messageSends: ["new"]
  41492. }),
  41493. $globals.IRSendInliner);
  41494. $core.addMethod(
  41495. $core.method({
  41496. selector: "inliningError:",
  41497. protocol: 'error handling',
  41498. fn: function (aString){
  41499. var self=this;
  41500. function $InliningError(){return $globals.InliningError||(typeof InliningError=="undefined"?nil:InliningError)}
  41501. return $core.withContext(function($ctx1) {
  41502. $recv($InliningError())._signal_(aString);
  41503. return self;
  41504. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  41505. },
  41506. args: ["aString"],
  41507. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  41508. referencedClasses: ["InliningError"],
  41509. messageSends: ["signal:"]
  41510. }),
  41511. $globals.IRSendInliner);
  41512. $core.addMethod(
  41513. $core.method({
  41514. selector: "send",
  41515. protocol: 'accessing',
  41516. fn: function (){
  41517. var self=this;
  41518. var $1;
  41519. $1=self["@send"];
  41520. return $1;
  41521. },
  41522. args: [],
  41523. source: "send\x0a\x09^ send",
  41524. referencedClasses: [],
  41525. messageSends: []
  41526. }),
  41527. $globals.IRSendInliner);
  41528. $core.addMethod(
  41529. $core.method({
  41530. selector: "send:",
  41531. protocol: 'accessing',
  41532. fn: function (anIRSend){
  41533. var self=this;
  41534. self["@send"]=anIRSend;
  41535. return self;
  41536. },
  41537. args: ["anIRSend"],
  41538. source: "send: anIRSend\x0a\x09send := anIRSend",
  41539. referencedClasses: [],
  41540. messageSends: []
  41541. }),
  41542. $globals.IRSendInliner);
  41543. $core.addMethod(
  41544. $core.method({
  41545. selector: "translator",
  41546. protocol: 'accessing',
  41547. fn: function (){
  41548. var self=this;
  41549. var $1;
  41550. $1=self["@translator"];
  41551. return $1;
  41552. },
  41553. args: [],
  41554. source: "translator\x0a\x09^ translator",
  41555. referencedClasses: [],
  41556. messageSends: []
  41557. }),
  41558. $globals.IRSendInliner);
  41559. $core.addMethod(
  41560. $core.method({
  41561. selector: "translator:",
  41562. protocol: 'accessing',
  41563. fn: function (anASTTranslator){
  41564. var self=this;
  41565. self["@translator"]=anASTTranslator;
  41566. return self;
  41567. },
  41568. args: ["anASTTranslator"],
  41569. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  41570. referencedClasses: [],
  41571. messageSends: []
  41572. }),
  41573. $globals.IRSendInliner);
  41574. $core.addMethod(
  41575. $core.method({
  41576. selector: "inlinedSelectors",
  41577. protocol: 'accessing',
  41578. fn: function (){
  41579. var self=this;
  41580. var $1;
  41581. $1=["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  41582. return $1;
  41583. },
  41584. args: [],
  41585. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  41586. referencedClasses: [],
  41587. messageSends: []
  41588. }),
  41589. $globals.IRSendInliner.klass);
  41590. $core.addMethod(
  41591. $core.method({
  41592. selector: "shouldInline:",
  41593. protocol: 'accessing',
  41594. fn: function (anIRInstruction){
  41595. var self=this;
  41596. return $core.withContext(function($ctx1) {
  41597. var $1,$2;
  41598. $1=$recv(self._inlinedSelectors())._includes_($recv(anIRInstruction)._selector());
  41599. if(!$core.assert($1)){
  41600. return false;
  41601. };
  41602. $2=$recv($recv($recv(anIRInstruction)._instructions())._allButFirst())._allSatisfy_((function(each){
  41603. return $core.withContext(function($ctx2) {
  41604. return $recv(each)._isClosure();
  41605. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41606. }));
  41607. return $2;
  41608. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner.klass)});
  41609. },
  41610. args: ["anIRInstruction"],
  41611. source: "shouldInline: anIRInstruction\x0a\x09(self inlinedSelectors includes: anIRInstruction selector) ifFalse: [ ^ false ].\x0a\x09^ anIRInstruction instructions allButFirst allSatisfy: [ :each | each isClosure]",
  41612. referencedClasses: [],
  41613. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "allButFirst", "instructions", "isClosure"]
  41614. }),
  41615. $globals.IRSendInliner.klass);
  41616. $core.addClass('IRAssignmentInliner', $globals.IRSendInliner, ['assignment'], 'Compiler-Inlining');
  41617. $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};";
  41618. $core.addMethod(
  41619. $core.method({
  41620. selector: "assignment",
  41621. protocol: 'accessing',
  41622. fn: function (){
  41623. var self=this;
  41624. var $1;
  41625. $1=self["@assignment"];
  41626. return $1;
  41627. },
  41628. args: [],
  41629. source: "assignment\x0a\x09^ assignment",
  41630. referencedClasses: [],
  41631. messageSends: []
  41632. }),
  41633. $globals.IRAssignmentInliner);
  41634. $core.addMethod(
  41635. $core.method({
  41636. selector: "assignment:",
  41637. protocol: 'accessing',
  41638. fn: function (aNode){
  41639. var self=this;
  41640. self["@assignment"]=aNode;
  41641. return self;
  41642. },
  41643. args: ["aNode"],
  41644. source: "assignment: aNode\x0a\x09assignment := aNode",
  41645. referencedClasses: [],
  41646. messageSends: []
  41647. }),
  41648. $globals.IRAssignmentInliner);
  41649. $core.addMethod(
  41650. $core.method({
  41651. selector: "inlineAssignment:",
  41652. protocol: 'inlining',
  41653. fn: function (anIRAssignment){
  41654. var self=this;
  41655. var inlinedAssignment;
  41656. function $IRInlinedAssignment(){return $globals.IRInlinedAssignment||(typeof IRInlinedAssignment=="undefined"?nil:IRInlinedAssignment)}
  41657. return $core.withContext(function($ctx1) {
  41658. var $1,$2;
  41659. self._assignment_(anIRAssignment);
  41660. inlinedAssignment=$recv($IRInlinedAssignment())._new();
  41661. $1=$recv(anIRAssignment)._instructions();
  41662. $ctx1.sendIdx["instructions"]=1;
  41663. $recv($1)._do_((function(each){
  41664. return $core.withContext(function($ctx2) {
  41665. return $recv(inlinedAssignment)._add_(each);
  41666. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41667. }));
  41668. $recv(anIRAssignment)._replaceWith_(inlinedAssignment);
  41669. self._inlineSend_($recv($recv(inlinedAssignment)._instructions())._last());
  41670. $2=inlinedAssignment;
  41671. return $2;
  41672. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},$globals.IRAssignmentInliner)});
  41673. },
  41674. args: ["anIRAssignment"],
  41675. 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",
  41676. referencedClasses: ["IRInlinedAssignment"],
  41677. messageSends: ["assignment:", "new", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
  41678. }),
  41679. $globals.IRAssignmentInliner);
  41680. $core.addMethod(
  41681. $core.method({
  41682. selector: "inlineClosure:",
  41683. protocol: 'inlining',
  41684. fn: function (anIRClosure){
  41685. var self=this;
  41686. var inlinedClosure,statements;
  41687. function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  41688. return $core.withContext(function($ctx1) {
  41689. var $2,$1,$4,$3,$5,$7,$8,$6,$9;
  41690. inlinedClosure=(
  41691. $ctx1.supercall = true,
  41692. $globals.IRAssignmentInliner.superclass.fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  41693. $ctx1.supercall = false;
  41694. $2=$recv(inlinedClosure)._instructions();
  41695. $ctx1.sendIdx["instructions"]=2;
  41696. $1=$recv($2)._last();
  41697. $ctx1.sendIdx["last"]=1;
  41698. statements=$recv($1)._instructions();
  41699. $ctx1.sendIdx["instructions"]=1;
  41700. $recv(statements)._ifNotEmpty_((function(){
  41701. return $core.withContext(function($ctx2) {
  41702. $4=$recv(statements)._last();
  41703. $ctx2.sendIdx["last"]=2;
  41704. $3=$recv($4)._canBeAssigned();
  41705. if($core.assert($3)){
  41706. $5=$recv(statements)._last();
  41707. $ctx2.sendIdx["last"]=3;
  41708. $7=$recv($IRAssignment())._new();
  41709. $recv($7)._add_($recv($recv(self._assignment())._instructions())._first());
  41710. $ctx2.sendIdx["add:"]=1;
  41711. $recv($7)._add_($recv($recv(statements)._last())._copy());
  41712. $8=$recv($7)._yourself();
  41713. $6=$8;
  41714. return $recv($5)._replaceWith_($6);
  41715. };
  41716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41717. }));
  41718. $9=inlinedClosure;
  41719. return $9;
  41720. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,statements:statements},$globals.IRAssignmentInliner)});
  41721. },
  41722. args: ["anIRClosure"],
  41723. 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",
  41724. referencedClasses: ["IRAssignment"],
  41725. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "canBeAssigned", "replaceWith:", "add:", "new", "first", "assignment", "copy", "yourself"]
  41726. }),
  41727. $globals.IRAssignmentInliner);
  41728. $core.addClass('IRReturnInliner', $globals.IRSendInliner, [], 'Compiler-Inlining');
  41729. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  41730. $core.addMethod(
  41731. $core.method({
  41732. selector: "inlineClosure:",
  41733. protocol: 'inlining',
  41734. fn: function (anIRClosure){
  41735. var self=this;
  41736. var closure,statements;
  41737. function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  41738. return $core.withContext(function($ctx1) {
  41739. var $1,$3,$2,$4,$5,$6,$7;
  41740. closure=(
  41741. $ctx1.supercall = true,
  41742. $globals.IRReturnInliner.superclass.fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  41743. $ctx1.supercall = false;
  41744. $1=$recv($recv(closure)._instructions())._last();
  41745. $ctx1.sendIdx["last"]=1;
  41746. statements=$recv($1)._instructions();
  41747. $ctx1.sendIdx["instructions"]=1;
  41748. $recv(statements)._ifNotEmpty_((function(){
  41749. return $core.withContext(function($ctx2) {
  41750. $3=$recv(statements)._last();
  41751. $ctx2.sendIdx["last"]=2;
  41752. $2=$recv($3)._isReturn();
  41753. if(!$core.assert($2)){
  41754. $4=$recv(statements)._last();
  41755. $ctx2.sendIdx["last"]=3;
  41756. $5=$recv($IRReturn())._new();
  41757. $recv($5)._add_($recv($recv(statements)._last())._copy());
  41758. $6=$recv($5)._yourself();
  41759. return $recv($4)._replaceWith_($6);
  41760. };
  41761. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41762. }));
  41763. $7=closure;
  41764. return $7;
  41765. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},$globals.IRReturnInliner)});
  41766. },
  41767. args: ["anIRClosure"],
  41768. 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",
  41769. referencedClasses: ["IRReturn"],
  41770. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "isReturn", "replaceWith:", "add:", "new", "copy", "yourself"]
  41771. }),
  41772. $globals.IRReturnInliner);
  41773. $core.addMethod(
  41774. $core.method({
  41775. selector: "inlineReturn:",
  41776. protocol: 'inlining',
  41777. fn: function (anIRReturn){
  41778. var self=this;
  41779. var return_;
  41780. return $core.withContext(function($ctx1) {
  41781. var $1,$2;
  41782. return_=self._inlinedReturn();
  41783. $1=$recv(anIRReturn)._instructions();
  41784. $ctx1.sendIdx["instructions"]=1;
  41785. $recv($1)._do_((function(each){
  41786. return $core.withContext(function($ctx2) {
  41787. return $recv(return_)._add_(each);
  41788. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41789. }));
  41790. $recv(anIRReturn)._replaceWith_(return_);
  41791. self._inlineSend_($recv($recv(return_)._instructions())._last());
  41792. $2=return_;
  41793. return $2;
  41794. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_},$globals.IRReturnInliner)});
  41795. },
  41796. args: ["anIRReturn"],
  41797. 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",
  41798. referencedClasses: [],
  41799. messageSends: ["inlinedReturn", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
  41800. }),
  41801. $globals.IRReturnInliner);
  41802. $core.addMethod(
  41803. $core.method({
  41804. selector: "inlinedReturn",
  41805. protocol: 'factory',
  41806. fn: function (){
  41807. var self=this;
  41808. function $IRInlinedReturn(){return $globals.IRInlinedReturn||(typeof IRInlinedReturn=="undefined"?nil:IRInlinedReturn)}
  41809. return $core.withContext(function($ctx1) {
  41810. var $1;
  41811. $1=$recv($IRInlinedReturn())._new();
  41812. return $1;
  41813. }, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{},$globals.IRReturnInliner)});
  41814. },
  41815. args: [],
  41816. source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
  41817. referencedClasses: ["IRInlinedReturn"],
  41818. messageSends: ["new"]
  41819. }),
  41820. $globals.IRReturnInliner);
  41821. $core.addClass('InliningCodeGenerator', $globals.CodeGenerator, [], 'Compiler-Inlining');
  41822. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  41823. $core.addMethod(
  41824. $core.method({
  41825. selector: "compileNode:",
  41826. protocol: 'compiling',
  41827. fn: function (aNode){
  41828. var self=this;
  41829. var ir,stream;
  41830. return $core.withContext(function($ctx1) {
  41831. var $2,$3,$1;
  41832. $recv(self._semanticAnalyzer())._visit_(aNode);
  41833. $ctx1.sendIdx["visit:"]=1;
  41834. ir=$recv(self._translator())._visit_(aNode);
  41835. $ctx1.sendIdx["visit:"]=2;
  41836. $recv(self._inliner())._visit_(ir);
  41837. $ctx1.sendIdx["visit:"]=3;
  41838. $2=self._irTranslator();
  41839. $recv($2)._currentClass_(self._currentClass());
  41840. $recv($2)._visit_(ir);
  41841. $3=$recv($2)._contents();
  41842. $1=$3;
  41843. return $1;
  41844. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.InliningCodeGenerator)});
  41845. },
  41846. args: ["aNode"],
  41847. 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",
  41848. referencedClasses: [],
  41849. messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "currentClass:", "irTranslator", "currentClass", "contents"]
  41850. }),
  41851. $globals.InliningCodeGenerator);
  41852. $core.addMethod(
  41853. $core.method({
  41854. selector: "inliner",
  41855. protocol: 'compiling',
  41856. fn: function (){
  41857. var self=this;
  41858. function $IRInliner(){return $globals.IRInliner||(typeof IRInliner=="undefined"?nil:IRInliner)}
  41859. return $core.withContext(function($ctx1) {
  41860. var $1;
  41861. $1=$recv($IRInliner())._new();
  41862. return $1;
  41863. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  41864. },
  41865. args: [],
  41866. source: "inliner\x0a\x09^ IRInliner new",
  41867. referencedClasses: ["IRInliner"],
  41868. messageSends: ["new"]
  41869. }),
  41870. $globals.InliningCodeGenerator);
  41871. $core.addMethod(
  41872. $core.method({
  41873. selector: "irTranslator",
  41874. protocol: 'compiling',
  41875. fn: function (){
  41876. var self=this;
  41877. function $IRInliningJSTranslator(){return $globals.IRInliningJSTranslator||(typeof IRInliningJSTranslator=="undefined"?nil:IRInliningJSTranslator)}
  41878. return $core.withContext(function($ctx1) {
  41879. var $1;
  41880. $1=$recv($IRInliningJSTranslator())._new();
  41881. return $1;
  41882. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.InliningCodeGenerator)});
  41883. },
  41884. args: [],
  41885. source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
  41886. referencedClasses: ["IRInliningJSTranslator"],
  41887. messageSends: ["new"]
  41888. }),
  41889. $globals.InliningCodeGenerator);
  41890. $core.addClass('InliningError', $globals.SemanticError, [], 'Compiler-Inlining');
  41891. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  41892. });
  41893. 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";
  41894. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  41895. $core.addPackage('Compiler-Interpreter');
  41896. $core.packages["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  41897. $core.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  41898. $core.addClass('AIBlockClosure', $globals.BlockClosure, ['node', 'outerContext'], 'Compiler-Interpreter');
  41899. $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`).";
  41900. $core.addMethod(
  41901. $core.method({
  41902. selector: "applyTo:arguments:",
  41903. protocol: 'evaluating',
  41904. fn: function (anObject,aCollection){
  41905. var self=this;
  41906. return $core.withContext(function($ctx1) {
  41907. self._interpreterError();
  41908. return self;
  41909. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  41910. },
  41911. args: ["anObject", "aCollection"],
  41912. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  41913. referencedClasses: [],
  41914. messageSends: ["interpreterError"]
  41915. }),
  41916. $globals.AIBlockClosure);
  41917. $core.addMethod(
  41918. $core.method({
  41919. selector: "compiledSource",
  41920. protocol: 'accessing',
  41921. fn: function (){
  41922. var self=this;
  41923. return "[ AST Block closure ]";
  41924. },
  41925. args: [],
  41926. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  41927. referencedClasses: [],
  41928. messageSends: []
  41929. }),
  41930. $globals.AIBlockClosure);
  41931. $core.addMethod(
  41932. $core.method({
  41933. selector: "currySelf",
  41934. protocol: 'converting',
  41935. fn: function (){
  41936. var self=this;
  41937. return $core.withContext(function($ctx1) {
  41938. self._interpreterError();
  41939. return self;
  41940. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  41941. },
  41942. args: [],
  41943. source: "currySelf\x0a\x09self interpreterError",
  41944. referencedClasses: [],
  41945. messageSends: ["interpreterError"]
  41946. }),
  41947. $globals.AIBlockClosure);
  41948. $core.addMethod(
  41949. $core.method({
  41950. selector: "initializeWithContext:node:",
  41951. protocol: 'initialization',
  41952. fn: function (aContext,aNode){
  41953. var self=this;
  41954. self["@node"]=aNode;
  41955. self["@outerContext"]=aContext;
  41956. return self;
  41957. },
  41958. args: ["aContext", "aNode"],
  41959. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  41960. referencedClasses: [],
  41961. messageSends: []
  41962. }),
  41963. $globals.AIBlockClosure);
  41964. $core.addMethod(
  41965. $core.method({
  41966. selector: "interpreterError",
  41967. protocol: 'error handling',
  41968. fn: function (){
  41969. var self=this;
  41970. function $ASTInterpreterError(){return $globals.ASTInterpreterError||(typeof ASTInterpreterError=="undefined"?nil:ASTInterpreterError)}
  41971. return $core.withContext(function($ctx1) {
  41972. $recv($ASTInterpreterError())._signal_("Method cannot be interpreted by the interpreter.");
  41973. return self;
  41974. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  41975. },
  41976. args: [],
  41977. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  41978. referencedClasses: ["ASTInterpreterError"],
  41979. messageSends: ["signal:"]
  41980. }),
  41981. $globals.AIBlockClosure);
  41982. $core.addMethod(
  41983. $core.method({
  41984. selector: "numArgs",
  41985. protocol: 'accessing',
  41986. fn: function (){
  41987. var self=this;
  41988. return $core.withContext(function($ctx1) {
  41989. var $1;
  41990. $1=$recv($recv(self["@node"])._temps())._size();
  41991. return $1;
  41992. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  41993. },
  41994. args: [],
  41995. source: "numArgs\x0a\x09^ node temps size",
  41996. referencedClasses: [],
  41997. messageSends: ["size", "temps"]
  41998. }),
  41999. $globals.AIBlockClosure);
  42000. $core.addMethod(
  42001. $core.method({
  42002. selector: "value",
  42003. protocol: 'evaluating',
  42004. fn: function (){
  42005. var self=this;
  42006. return $core.withContext(function($ctx1) {
  42007. var $1;
  42008. $1=self._valueWithPossibleArguments_([]);
  42009. return $1;
  42010. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  42011. },
  42012. args: [],
  42013. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  42014. referencedClasses: [],
  42015. messageSends: ["valueWithPossibleArguments:"]
  42016. }),
  42017. $globals.AIBlockClosure);
  42018. $core.addMethod(
  42019. $core.method({
  42020. selector: "value:",
  42021. protocol: 'evaluating',
  42022. fn: function (anArgument){
  42023. var self=this;
  42024. return $core.withContext(function($ctx1) {
  42025. var $1;
  42026. $1=self._valueWithPossibleArguments_([anArgument]);
  42027. return $1;
  42028. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  42029. },
  42030. args: ["anArgument"],
  42031. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  42032. referencedClasses: [],
  42033. messageSends: ["valueWithPossibleArguments:"]
  42034. }),
  42035. $globals.AIBlockClosure);
  42036. $core.addMethod(
  42037. $core.method({
  42038. selector: "value:value:",
  42039. protocol: 'evaluating',
  42040. fn: function (firstArgument,secondArgument){
  42041. var self=this;
  42042. return $core.withContext(function($ctx1) {
  42043. var $1;
  42044. $1=self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  42045. return $1;
  42046. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  42047. },
  42048. args: ["firstArgument", "secondArgument"],
  42049. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  42050. referencedClasses: [],
  42051. messageSends: ["valueWithPossibleArguments:"]
  42052. }),
  42053. $globals.AIBlockClosure);
  42054. $core.addMethod(
  42055. $core.method({
  42056. selector: "value:value:value:",
  42057. protocol: 'evaluating',
  42058. fn: function (firstArgument,secondArgument,thirdArgument){
  42059. var self=this;
  42060. return $core.withContext(function($ctx1) {
  42061. var $1;
  42062. $1=self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  42063. return $1;
  42064. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  42065. },
  42066. args: ["firstArgument", "secondArgument", "thirdArgument"],
  42067. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  42068. referencedClasses: [],
  42069. messageSends: ["valueWithPossibleArguments:"]
  42070. }),
  42071. $globals.AIBlockClosure);
  42072. $core.addMethod(
  42073. $core.method({
  42074. selector: "valueWithPossibleArguments:",
  42075. protocol: 'evaluating',
  42076. fn: function (aCollection){
  42077. var self=this;
  42078. var context,sequenceNode;
  42079. return $core.withContext(function($ctx1) {
  42080. var $1,$2,$3,$4,$5,$6;
  42081. context=$recv(self["@outerContext"])._newInnerContext();
  42082. $1=$recv($recv($recv(self["@node"])._nodes())._first())._copy();
  42083. $recv($1)._parent_(nil);
  42084. $2=$recv($1)._yourself();
  42085. sequenceNode=$2;
  42086. $recv($recv(sequenceNode)._temps())._do_((function(each){
  42087. return $core.withContext(function($ctx2) {
  42088. return $recv(context)._defineLocal_(each);
  42089. $ctx2.sendIdx["defineLocal:"]=1;
  42090. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42091. }));
  42092. $recv($recv(self["@node"])._parameters())._withIndexDo_((function(each,index){
  42093. return $core.withContext(function($ctx2) {
  42094. $recv(context)._defineLocal_(each);
  42095. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  42096. return nil;
  42097. })));
  42098. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  42099. }));
  42100. $3=$recv(context)._interpreter();
  42101. $ctx1.sendIdx["interpreter"]=1;
  42102. $recv($3)._node_($recv(sequenceNode)._nextChild());
  42103. $4=$recv($3)._proceed();
  42104. $5=$recv(self["@outerContext"])._interpreter();
  42105. $ctx1.sendIdx["interpreter"]=2;
  42106. $recv($5)._setNonLocalReturnFromContext_(context);
  42107. $6=$recv($recv(context)._interpreter())._pop();
  42108. return $6;
  42109. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  42110. },
  42111. args: ["aCollection"],
  42112. source: "valueWithPossibleArguments: aCollection\x0a\x09| context sequenceNode |\x0a\x09context := outerContext newInnerContext.\x0a\x0a\x09\x22Interpret a copy of the sequence node to avoid creating a new AIBlockClosure\x22\x0a\x09sequenceNode := node nodes first copy\x0a\x09\x09parent: nil;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals in the context\x22\x0a\x09sequenceNode temps do: [ :each |\x0a\x09\x09context defineLocal: each ].\x0a\x09\x09\x0a\x09\x22Populate the arguments into the context locals\x22\x09\x0a\x09node parameters withIndexDo: [ :each :index |\x0a\x09\x09context defineLocal: each.\x0a\x09\x09context localAt: each put: (aCollection at: index ifAbsent: [ nil ]) ].\x0a\x0a\x09\x22Interpret the first node of the BlockSequenceNode\x22\x0a\x09context interpreter\x0a\x09\x09node: sequenceNode nextChild;\x0a\x09\x09proceed.\x0a\x09\x09\x0a\x09outerContext interpreter\x0a\x09\x09setNonLocalReturnFromContext: context.\x0a\x09\x09\x0a\x09^ context interpreter pop",
  42113. referencedClasses: [],
  42114. messageSends: ["newInnerContext", "parent:", "copy", "first", "nodes", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "nextChild", "proceed", "setNonLocalReturnFromContext:", "pop"]
  42115. }),
  42116. $globals.AIBlockClosure);
  42117. $core.addMethod(
  42118. $core.method({
  42119. selector: "forContext:node:",
  42120. protocol: 'instance creation',
  42121. fn: function (aContext,aNode){
  42122. var self=this;
  42123. return $core.withContext(function($ctx1) {
  42124. var $2,$3,$1;
  42125. $2=self._new();
  42126. $recv($2)._initializeWithContext_node_(aContext,aNode);
  42127. $3=$recv($2)._yourself();
  42128. $1=$3;
  42129. return $1;
  42130. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.klass)});
  42131. },
  42132. args: ["aContext", "aNode"],
  42133. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  42134. referencedClasses: [],
  42135. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  42136. }),
  42137. $globals.AIBlockClosure.klass);
  42138. $core.addClass('AIContext', $globals.MethodContext, ['outerContext', 'innerContext', 'pc', 'locals', 'selector', 'index', 'sendIndexes', 'evaluatedSelector', 'ast', 'interpreter', 'supercall'], 'Compiler-Interpreter');
  42139. $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)";
  42140. $core.addMethod(
  42141. $core.method({
  42142. selector: "arguments",
  42143. protocol: 'interpreting',
  42144. fn: function (){
  42145. var self=this;
  42146. return $core.withContext(function($ctx1) {
  42147. var $1;
  42148. $1=$recv($recv(self._ast())._arguments())._collect_((function(each){
  42149. return $core.withContext(function($ctx2) {
  42150. return self._localAt_ifAbsent_(each,(function(){
  42151. return $core.withContext(function($ctx3) {
  42152. return self._error_("Argument not in context");
  42153. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42154. }));
  42155. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42156. }));
  42157. return $1;
  42158. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  42159. },
  42160. args: [],
  42161. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  42162. referencedClasses: [],
  42163. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  42164. }),
  42165. $globals.AIContext);
  42166. $core.addMethod(
  42167. $core.method({
  42168. selector: "ast",
  42169. protocol: 'interpreting',
  42170. fn: function (){
  42171. var self=this;
  42172. return $core.withContext(function($ctx1) {
  42173. var $1,$3,$2,$4,$5,$receiver;
  42174. $1=self._isBlockContext();
  42175. if($core.assert($1)){
  42176. $3=self._outerContext();
  42177. if(($receiver = $3) == null || $receiver.isNil){
  42178. $2=$3;
  42179. } else {
  42180. var context;
  42181. context=$receiver;
  42182. $2=$recv(context)._ast();
  42183. };
  42184. return $2;
  42185. };
  42186. $4=self["@ast"];
  42187. if(($receiver = $4) == null || $receiver.isNil){
  42188. self._initializeAST();
  42189. } else {
  42190. $4;
  42191. };
  42192. $5=self["@ast"];
  42193. return $5;
  42194. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  42195. },
  42196. args: [],
  42197. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  42198. referencedClasses: [],
  42199. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  42200. }),
  42201. $globals.AIContext);
  42202. $core.addMethod(
  42203. $core.method({
  42204. selector: "basicLocalAt:",
  42205. protocol: 'private',
  42206. fn: function (aString){
  42207. var self=this;
  42208. return $core.withContext(function($ctx1) {
  42209. var $1;
  42210. $1=$recv(self._locals())._at_(aString);
  42211. return $1;
  42212. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  42213. },
  42214. args: ["aString"],
  42215. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  42216. referencedClasses: [],
  42217. messageSends: ["at:", "locals"]
  42218. }),
  42219. $globals.AIContext);
  42220. $core.addMethod(
  42221. $core.method({
  42222. selector: "basicLocalAt:put:",
  42223. protocol: 'private',
  42224. fn: function (aString,anObject){
  42225. var self=this;
  42226. return $core.withContext(function($ctx1) {
  42227. $recv(self._locals())._at_put_(aString,anObject);
  42228. return self;
  42229. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  42230. },
  42231. args: ["aString", "anObject"],
  42232. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  42233. referencedClasses: [],
  42234. messageSends: ["at:put:", "locals"]
  42235. }),
  42236. $globals.AIContext);
  42237. $core.addMethod(
  42238. $core.method({
  42239. selector: "basicReceiver",
  42240. protocol: 'interpreting',
  42241. fn: function (){
  42242. var self=this;
  42243. return $core.withContext(function($ctx1) {
  42244. var $1;
  42245. $1=self._localAt_("self");
  42246. return $1;
  42247. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  42248. },
  42249. args: [],
  42250. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  42251. referencedClasses: [],
  42252. messageSends: ["localAt:"]
  42253. }),
  42254. $globals.AIContext);
  42255. $core.addMethod(
  42256. $core.method({
  42257. selector: "defineLocal:",
  42258. protocol: 'accessing',
  42259. fn: function (aString){
  42260. var self=this;
  42261. return $core.withContext(function($ctx1) {
  42262. $recv(self._locals())._at_put_(aString,nil);
  42263. return self;
  42264. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  42265. },
  42266. args: ["aString"],
  42267. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  42268. referencedClasses: [],
  42269. messageSends: ["at:put:", "locals"]
  42270. }),
  42271. $globals.AIContext);
  42272. $core.addMethod(
  42273. $core.method({
  42274. selector: "evaluate:on:",
  42275. protocol: 'evaluating',
  42276. fn: function (aString,anEvaluator){
  42277. var self=this;
  42278. return $core.withContext(function($ctx1) {
  42279. var $1;
  42280. $1=$recv(anEvaluator)._evaluate_context_(aString,self);
  42281. return $1;
  42282. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  42283. },
  42284. args: ["aString", "anEvaluator"],
  42285. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  42286. referencedClasses: [],
  42287. messageSends: ["evaluate:context:"]
  42288. }),
  42289. $globals.AIContext);
  42290. $core.addMethod(
  42291. $core.method({
  42292. selector: "evaluateNode:",
  42293. protocol: 'evaluating',
  42294. fn: function (aNode){
  42295. var self=this;
  42296. function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  42297. return $core.withContext(function($ctx1) {
  42298. var $2,$3,$1;
  42299. $2=$recv($ASTInterpreter())._new();
  42300. $recv($2)._context_(self);
  42301. $recv($2)._node_($recv(aNode)._nextChild());
  42302. $recv($2)._proceed();
  42303. $3=$recv($2)._result();
  42304. $1=$3;
  42305. return $1;
  42306. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  42307. },
  42308. args: ["aNode"],
  42309. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode nextChild;\x0a\x09\x09proceed;\x0a\x09\x09result",
  42310. referencedClasses: ["ASTInterpreter"],
  42311. messageSends: ["context:", "new", "node:", "nextChild", "proceed", "result"]
  42312. }),
  42313. $globals.AIContext);
  42314. $core.addMethod(
  42315. $core.method({
  42316. selector: "evaluatedSelector",
  42317. protocol: 'accessing',
  42318. fn: function (){
  42319. var self=this;
  42320. var $1;
  42321. $1=self["@evaluatedSelector"];
  42322. return $1;
  42323. },
  42324. args: [],
  42325. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  42326. referencedClasses: [],
  42327. messageSends: []
  42328. }),
  42329. $globals.AIContext);
  42330. $core.addMethod(
  42331. $core.method({
  42332. selector: "evaluatedSelector:",
  42333. protocol: 'accessing',
  42334. fn: function (aString){
  42335. var self=this;
  42336. self["@evaluatedSelector"]=aString;
  42337. return self;
  42338. },
  42339. args: ["aString"],
  42340. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  42341. referencedClasses: [],
  42342. messageSends: []
  42343. }),
  42344. $globals.AIContext);
  42345. $core.addMethod(
  42346. $core.method({
  42347. selector: "index",
  42348. protocol: 'accessing',
  42349. fn: function (){
  42350. var self=this;
  42351. return $core.withContext(function($ctx1) {
  42352. var $2,$1,$receiver;
  42353. $2=self["@index"];
  42354. if(($receiver = $2) == null || $receiver.isNil){
  42355. $1=(0);
  42356. } else {
  42357. $1=$2;
  42358. };
  42359. return $1;
  42360. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  42361. },
  42362. args: [],
  42363. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  42364. referencedClasses: [],
  42365. messageSends: ["ifNil:"]
  42366. }),
  42367. $globals.AIContext);
  42368. $core.addMethod(
  42369. $core.method({
  42370. selector: "index:",
  42371. protocol: 'accessing',
  42372. fn: function (anInteger){
  42373. var self=this;
  42374. self["@index"]=anInteger;
  42375. return self;
  42376. },
  42377. args: ["anInteger"],
  42378. source: "index: anInteger\x0a\x09index := anInteger",
  42379. referencedClasses: [],
  42380. messageSends: []
  42381. }),
  42382. $globals.AIContext);
  42383. $core.addMethod(
  42384. $core.method({
  42385. selector: "initializeAST",
  42386. protocol: 'initialization',
  42387. fn: function (){
  42388. var self=this;
  42389. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  42390. return $core.withContext(function($ctx1) {
  42391. var $1;
  42392. $1=self._method();
  42393. $ctx1.sendIdx["method"]=1;
  42394. self["@ast"]=$recv($1)._ast();
  42395. $recv($recv($SemanticAnalyzer())._on_($recv(self._method())._methodClass()))._visit_(self["@ast"]);
  42396. return self;
  42397. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  42398. },
  42399. args: [],
  42400. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  42401. referencedClasses: ["SemanticAnalyzer"],
  42402. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  42403. }),
  42404. $globals.AIContext);
  42405. $core.addMethod(
  42406. $core.method({
  42407. selector: "initializeFromMethodContext:",
  42408. protocol: 'initialization',
  42409. fn: function (aMethodContext){
  42410. var self=this;
  42411. return $core.withContext(function($ctx1) {
  42412. var $1,$2,$3,$4,$receiver;
  42413. self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  42414. self._index_($recv(aMethodContext)._index());
  42415. self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  42416. self._receiver_($recv(aMethodContext)._receiver());
  42417. self._supercall_($recv(aMethodContext)._supercall());
  42418. $1=self._selector_($recv(aMethodContext)._selector());
  42419. $2=$recv(aMethodContext)._outerContext();
  42420. $ctx1.sendIdx["outerContext"]=1;
  42421. if(($receiver = $2) == null || $receiver.isNil){
  42422. $2;
  42423. } else {
  42424. var outer;
  42425. outer=$receiver;
  42426. $3=$recv(outer)._methodContext();
  42427. if(($receiver = $3) == null || $receiver.isNil){
  42428. $3;
  42429. } else {
  42430. self._outerContext_($recv(self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  42431. };
  42432. $4=$recv(aMethodContext)._locals();
  42433. $ctx1.sendIdx["locals"]=1;
  42434. $recv($4)._keysAndValuesDo_((function(key,value){
  42435. return $core.withContext(function($ctx2) {
  42436. return $recv(self._locals())._at_put_(key,value);
  42437. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  42438. }));
  42439. };
  42440. return self;
  42441. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  42442. },
  42443. args: ["aMethodContext"],
  42444. 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 ] ]",
  42445. referencedClasses: [],
  42446. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  42447. }),
  42448. $globals.AIContext);
  42449. $core.addMethod(
  42450. $core.method({
  42451. selector: "initializeInterpreter",
  42452. protocol: 'initialization',
  42453. fn: function (){
  42454. var self=this;
  42455. function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  42456. return $core.withContext(function($ctx1) {
  42457. var $1,$2,$3,$receiver;
  42458. $1=$recv($ASTInterpreter())._new();
  42459. $recv($1)._context_(self);
  42460. $2=$recv($1)._yourself();
  42461. self["@interpreter"]=$2;
  42462. $3=self._innerContext();
  42463. if(($receiver = $3) == null || $receiver.isNil){
  42464. $3;
  42465. } else {
  42466. self._setupInterpreter_(self["@interpreter"]);
  42467. };
  42468. return self;
  42469. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  42470. },
  42471. args: [],
  42472. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  42473. referencedClasses: ["ASTInterpreter"],
  42474. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  42475. }),
  42476. $globals.AIContext);
  42477. $core.addMethod(
  42478. $core.method({
  42479. selector: "initializeLocals",
  42480. protocol: 'initialization',
  42481. fn: function (){
  42482. var self=this;
  42483. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  42484. return $core.withContext(function($ctx1) {
  42485. self["@locals"]=$recv($Dictionary())._new();
  42486. $recv(self["@locals"])._at_put_("thisContext",self);
  42487. return self;
  42488. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  42489. },
  42490. args: [],
  42491. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  42492. referencedClasses: ["Dictionary"],
  42493. messageSends: ["new", "at:put:"]
  42494. }),
  42495. $globals.AIContext);
  42496. $core.addMethod(
  42497. $core.method({
  42498. selector: "innerContext",
  42499. protocol: 'accessing',
  42500. fn: function (){
  42501. var self=this;
  42502. var $1;
  42503. $1=self["@innerContext"];
  42504. return $1;
  42505. },
  42506. args: [],
  42507. source: "innerContext\x0a\x09^ innerContext",
  42508. referencedClasses: [],
  42509. messageSends: []
  42510. }),
  42511. $globals.AIContext);
  42512. $core.addMethod(
  42513. $core.method({
  42514. selector: "innerContext:",
  42515. protocol: 'accessing',
  42516. fn: function (anAIContext){
  42517. var self=this;
  42518. self["@innerContext"]=anAIContext;
  42519. return self;
  42520. },
  42521. args: ["anAIContext"],
  42522. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  42523. referencedClasses: [],
  42524. messageSends: []
  42525. }),
  42526. $globals.AIContext);
  42527. $core.addMethod(
  42528. $core.method({
  42529. selector: "interpreter",
  42530. protocol: 'interpreting',
  42531. fn: function (){
  42532. var self=this;
  42533. return $core.withContext(function($ctx1) {
  42534. var $1,$2,$receiver;
  42535. $1=self["@interpreter"];
  42536. if(($receiver = $1) == null || $receiver.isNil){
  42537. self._initializeInterpreter();
  42538. } else {
  42539. $1;
  42540. };
  42541. $2=self["@interpreter"];
  42542. return $2;
  42543. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  42544. },
  42545. args: [],
  42546. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  42547. referencedClasses: [],
  42548. messageSends: ["ifNil:", "initializeInterpreter"]
  42549. }),
  42550. $globals.AIContext);
  42551. $core.addMethod(
  42552. $core.method({
  42553. selector: "interpreter:",
  42554. protocol: 'interpreting',
  42555. fn: function (anInterpreter){
  42556. var self=this;
  42557. self["@interpreter"]=anInterpreter;
  42558. return self;
  42559. },
  42560. args: ["anInterpreter"],
  42561. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  42562. referencedClasses: [],
  42563. messageSends: []
  42564. }),
  42565. $globals.AIContext);
  42566. $core.addMethod(
  42567. $core.method({
  42568. selector: "isTopContext",
  42569. protocol: 'testing',
  42570. fn: function (){
  42571. var self=this;
  42572. return $core.withContext(function($ctx1) {
  42573. var $1;
  42574. $1=$recv(self._innerContext())._isNil();
  42575. return $1;
  42576. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  42577. },
  42578. args: [],
  42579. source: "isTopContext\x0a\x09^ self innerContext isNil",
  42580. referencedClasses: [],
  42581. messageSends: ["isNil", "innerContext"]
  42582. }),
  42583. $globals.AIContext);
  42584. $core.addMethod(
  42585. $core.method({
  42586. selector: "localAt:",
  42587. protocol: 'accessing',
  42588. fn: function (aString){
  42589. var self=this;
  42590. var context;
  42591. return $core.withContext(function($ctx1) {
  42592. var $1;
  42593. context=self._lookupContextForLocal_(aString);
  42594. $1=$recv(context)._basicLocalAt_(aString);
  42595. return $1;
  42596. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  42597. },
  42598. args: ["aString"],
  42599. 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",
  42600. referencedClasses: [],
  42601. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  42602. }),
  42603. $globals.AIContext);
  42604. $core.addMethod(
  42605. $core.method({
  42606. selector: "localAt:ifAbsent:",
  42607. protocol: 'accessing',
  42608. fn: function (aString,aBlock){
  42609. var self=this;
  42610. var context;
  42611. return $core.withContext(function($ctx1) {
  42612. var $1,$2;
  42613. var $early={};
  42614. try {
  42615. context=self._lookupContextForLocal_ifNone_(aString,(function(){
  42616. return $core.withContext(function($ctx2) {
  42617. $1=$recv(aBlock)._value();
  42618. throw $early=[$1];
  42619. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42620. }));
  42621. $2=$recv(context)._basicLocalAt_(aString);
  42622. return $2;
  42623. }
  42624. catch(e) {if(e===$early)return e[0]; throw e}
  42625. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  42626. },
  42627. args: ["aString", "aBlock"],
  42628. 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",
  42629. referencedClasses: [],
  42630. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  42631. }),
  42632. $globals.AIContext);
  42633. $core.addMethod(
  42634. $core.method({
  42635. selector: "localAt:put:",
  42636. protocol: 'accessing',
  42637. fn: function (aString,anObject){
  42638. var self=this;
  42639. var context;
  42640. return $core.withContext(function($ctx1) {
  42641. context=self._lookupContextForLocal_(aString);
  42642. $recv(context)._basicLocalAt_put_(aString,anObject);
  42643. return self;
  42644. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  42645. },
  42646. args: ["aString", "anObject"],
  42647. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  42648. referencedClasses: [],
  42649. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  42650. }),
  42651. $globals.AIContext);
  42652. $core.addMethod(
  42653. $core.method({
  42654. selector: "locals",
  42655. protocol: 'accessing',
  42656. fn: function (){
  42657. var self=this;
  42658. return $core.withContext(function($ctx1) {
  42659. var $1,$2,$receiver;
  42660. $1=self["@locals"];
  42661. if(($receiver = $1) == null || $receiver.isNil){
  42662. self._initializeLocals();
  42663. } else {
  42664. $1;
  42665. };
  42666. $2=self["@locals"];
  42667. return $2;
  42668. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  42669. },
  42670. args: [],
  42671. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  42672. referencedClasses: [],
  42673. messageSends: ["ifNil:", "initializeLocals"]
  42674. }),
  42675. $globals.AIContext);
  42676. $core.addMethod(
  42677. $core.method({
  42678. selector: "lookupContextForLocal:",
  42679. protocol: 'private',
  42680. fn: function (aString){
  42681. var self=this;
  42682. return $core.withContext(function($ctx1) {
  42683. var $1;
  42684. $1=self._lookupContextForLocal_ifNone_(aString,(function(){
  42685. return $core.withContext(function($ctx2) {
  42686. return self._variableNotFound();
  42687. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42688. }));
  42689. return $1;
  42690. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  42691. },
  42692. args: ["aString"],
  42693. 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 ]",
  42694. referencedClasses: [],
  42695. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  42696. }),
  42697. $globals.AIContext);
  42698. $core.addMethod(
  42699. $core.method({
  42700. selector: "lookupContextForLocal:ifNone:",
  42701. protocol: 'private',
  42702. fn: function (aString,aBlock){
  42703. var self=this;
  42704. return $core.withContext(function($ctx1) {
  42705. var $2,$1;
  42706. $1=$recv(self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  42707. return self;
  42708. }),(function(){
  42709. return $core.withContext(function($ctx2) {
  42710. $2=self._outerContext();
  42711. return $recv($2)._ifNil_ifNotNil_(aBlock,(function(context){
  42712. return $core.withContext(function($ctx3) {
  42713. return $recv(context)._lookupContextForLocal_(aString);
  42714. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  42715. }));
  42716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42717. }));
  42718. return $1;
  42719. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  42720. },
  42721. args: ["aString", "aBlock"],
  42722. 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 ] ]",
  42723. referencedClasses: [],
  42724. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  42725. }),
  42726. $globals.AIContext);
  42727. $core.addMethod(
  42728. $core.method({
  42729. selector: "newInnerContext",
  42730. protocol: 'factory',
  42731. fn: function (){
  42732. var self=this;
  42733. return $core.withContext(function($ctx1) {
  42734. var $2,$3,$1;
  42735. $2=$recv(self._class())._new();
  42736. $recv($2)._outerContext_(self);
  42737. $3=$recv($2)._yourself();
  42738. $1=$3;
  42739. return $1;
  42740. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  42741. },
  42742. args: [],
  42743. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  42744. referencedClasses: [],
  42745. messageSends: ["outerContext:", "new", "class", "yourself"]
  42746. }),
  42747. $globals.AIContext);
  42748. $core.addMethod(
  42749. $core.method({
  42750. selector: "outerContext",
  42751. protocol: 'accessing',
  42752. fn: function (){
  42753. var self=this;
  42754. var $1;
  42755. $1=self["@outerContext"];
  42756. return $1;
  42757. },
  42758. args: [],
  42759. source: "outerContext\x0a\x09^ outerContext",
  42760. referencedClasses: [],
  42761. messageSends: []
  42762. }),
  42763. $globals.AIContext);
  42764. $core.addMethod(
  42765. $core.method({
  42766. selector: "outerContext:",
  42767. protocol: 'accessing',
  42768. fn: function (anAIContext){
  42769. var self=this;
  42770. return $core.withContext(function($ctx1) {
  42771. var $1,$receiver;
  42772. self["@outerContext"]=anAIContext;
  42773. $1=self["@outerContext"];
  42774. if(($receiver = $1) == null || $receiver.isNil){
  42775. $1;
  42776. } else {
  42777. var context;
  42778. context=$receiver;
  42779. $recv(context)._innerContext_(self);
  42780. };
  42781. return self;
  42782. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  42783. },
  42784. args: ["anAIContext"],
  42785. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  42786. referencedClasses: [],
  42787. messageSends: ["ifNotNil:", "innerContext:"]
  42788. }),
  42789. $globals.AIContext);
  42790. $core.addMethod(
  42791. $core.method({
  42792. selector: "receiver:",
  42793. protocol: 'interpreting',
  42794. fn: function (anObject){
  42795. var self=this;
  42796. return $core.withContext(function($ctx1) {
  42797. $recv(self._locals())._at_put_("self",anObject);
  42798. return self;
  42799. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  42800. },
  42801. args: ["anObject"],
  42802. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  42803. referencedClasses: [],
  42804. messageSends: ["at:put:", "locals"]
  42805. }),
  42806. $globals.AIContext);
  42807. $core.addMethod(
  42808. $core.method({
  42809. selector: "selector",
  42810. protocol: 'accessing',
  42811. fn: function (){
  42812. var self=this;
  42813. var $1;
  42814. $1=self["@selector"];
  42815. return $1;
  42816. },
  42817. args: [],
  42818. source: "selector\x0a\x09^ selector",
  42819. referencedClasses: [],
  42820. messageSends: []
  42821. }),
  42822. $globals.AIContext);
  42823. $core.addMethod(
  42824. $core.method({
  42825. selector: "selector:",
  42826. protocol: 'accessing',
  42827. fn: function (aString){
  42828. var self=this;
  42829. self["@selector"]=aString;
  42830. return self;
  42831. },
  42832. args: ["aString"],
  42833. source: "selector: aString\x0a\x09selector := aString",
  42834. referencedClasses: [],
  42835. messageSends: []
  42836. }),
  42837. $globals.AIContext);
  42838. $core.addMethod(
  42839. $core.method({
  42840. selector: "sendIndexAt:",
  42841. protocol: 'accessing',
  42842. fn: function (aString){
  42843. var self=this;
  42844. return $core.withContext(function($ctx1) {
  42845. var $1;
  42846. $1=$recv(self._sendIndexes())._at_ifAbsent_(aString,(function(){
  42847. return (0);
  42848. }));
  42849. return $1;
  42850. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  42851. },
  42852. args: ["aString"],
  42853. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  42854. referencedClasses: [],
  42855. messageSends: ["at:ifAbsent:", "sendIndexes"]
  42856. }),
  42857. $globals.AIContext);
  42858. $core.addMethod(
  42859. $core.method({
  42860. selector: "sendIndexes",
  42861. protocol: 'accessing',
  42862. fn: function (){
  42863. var self=this;
  42864. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  42865. return $core.withContext(function($ctx1) {
  42866. var $2,$1,$receiver;
  42867. $2=self["@sendIndexes"];
  42868. if(($receiver = $2) == null || $receiver.isNil){
  42869. $1=$recv($Dictionary())._new();
  42870. } else {
  42871. $1=$2;
  42872. };
  42873. return $1;
  42874. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  42875. },
  42876. args: [],
  42877. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  42878. referencedClasses: ["Dictionary"],
  42879. messageSends: ["ifNil:", "new"]
  42880. }),
  42881. $globals.AIContext);
  42882. $core.addMethod(
  42883. $core.method({
  42884. selector: "sendIndexes:",
  42885. protocol: 'accessing',
  42886. fn: function (aDictionary){
  42887. var self=this;
  42888. self["@sendIndexes"]=aDictionary;
  42889. return self;
  42890. },
  42891. args: ["aDictionary"],
  42892. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  42893. referencedClasses: [],
  42894. messageSends: []
  42895. }),
  42896. $globals.AIContext);
  42897. $core.addMethod(
  42898. $core.method({
  42899. selector: "setupInterpreter:",
  42900. protocol: 'interpreting',
  42901. fn: function (anInterpreter){
  42902. var self=this;
  42903. var currentNode;
  42904. function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  42905. return $core.withContext(function($ctx1) {
  42906. var $1,$2,$3,$4,$5,$8,$7,$6,$receiver;
  42907. $1=$recv($ASTPCNodeVisitor())._new();
  42908. $recv($1)._selector_(self._evaluatedSelector());
  42909. $recv($1)._context_(self);
  42910. $2=$1;
  42911. $3=self._ast();
  42912. $ctx1.sendIdx["ast"]=1;
  42913. $recv($2)._visit_($3);
  42914. $4=$recv($1)._currentNode();
  42915. currentNode=$4;
  42916. $5=$recv(self._ast())._sequenceNode();
  42917. if(($receiver = $5) == null || $receiver.isNil){
  42918. $5;
  42919. } else {
  42920. var sequence;
  42921. sequence=$receiver;
  42922. $recv($recv(sequence)._temps())._do_((function(each){
  42923. return $core.withContext(function($ctx2) {
  42924. return self._defineLocal_(each);
  42925. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42926. }));
  42927. $ctx1.sendIdx["do:"]=1;
  42928. };
  42929. $recv(anInterpreter)._node_(currentNode);
  42930. $8=self._innerContext();
  42931. $ctx1.sendIdx["innerContext"]=1;
  42932. $7=$recv($8)._arguments();
  42933. $6=$recv($7)._reversed();
  42934. $recv($6)._do_((function(each){
  42935. return $core.withContext(function($ctx2) {
  42936. return $recv(anInterpreter)._push_(each);
  42937. $ctx2.sendIdx["push:"]=1;
  42938. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  42939. }));
  42940. $recv(anInterpreter)._push_($recv(self._innerContext())._receiver());
  42941. return self;
  42942. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  42943. },
  42944. args: ["anInterpreter"],
  42945. 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)",
  42946. referencedClasses: ["ASTPCNodeVisitor"],
  42947. messageSends: ["selector:", "new", "evaluatedSelector", "context:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  42948. }),
  42949. $globals.AIContext);
  42950. $core.addMethod(
  42951. $core.method({
  42952. selector: "supercall",
  42953. protocol: 'interpreting',
  42954. fn: function (){
  42955. var self=this;
  42956. return $core.withContext(function($ctx1) {
  42957. var $2,$1,$receiver;
  42958. $2=self["@supercall"];
  42959. if(($receiver = $2) == null || $receiver.isNil){
  42960. $1=false;
  42961. } else {
  42962. $1=$2;
  42963. };
  42964. return $1;
  42965. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  42966. },
  42967. args: [],
  42968. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  42969. referencedClasses: [],
  42970. messageSends: ["ifNil:"]
  42971. }),
  42972. $globals.AIContext);
  42973. $core.addMethod(
  42974. $core.method({
  42975. selector: "supercall:",
  42976. protocol: 'interpreting',
  42977. fn: function (aBoolean){
  42978. var self=this;
  42979. self["@supercall"]=aBoolean;
  42980. return self;
  42981. },
  42982. args: ["aBoolean"],
  42983. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  42984. referencedClasses: [],
  42985. messageSends: []
  42986. }),
  42987. $globals.AIContext);
  42988. $core.addMethod(
  42989. $core.method({
  42990. selector: "variableNotFound",
  42991. protocol: 'error handling',
  42992. fn: function (){
  42993. var self=this;
  42994. return $core.withContext(function($ctx1) {
  42995. self._error_("Variable missing");
  42996. return self;
  42997. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  42998. },
  42999. args: [],
  43000. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  43001. referencedClasses: [],
  43002. messageSends: ["error:"]
  43003. }),
  43004. $globals.AIContext);
  43005. $core.addMethod(
  43006. $core.method({
  43007. selector: "fromMethodContext:",
  43008. protocol: 'instance creation',
  43009. fn: function (aMethodContext){
  43010. var self=this;
  43011. return $core.withContext(function($ctx1) {
  43012. var $2,$3,$1;
  43013. $2=self._new();
  43014. $recv($2)._initializeFromMethodContext_(aMethodContext);
  43015. $3=$recv($2)._yourself();
  43016. $1=$3;
  43017. return $1;
  43018. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.klass)});
  43019. },
  43020. args: ["aMethodContext"],
  43021. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  43022. referencedClasses: [],
  43023. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  43024. }),
  43025. $globals.AIContext.klass);
  43026. $core.addClass('AISemanticAnalyzer', $globals.SemanticAnalyzer, ['context'], 'Compiler-Interpreter');
  43027. $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.";
  43028. $core.addMethod(
  43029. $core.method({
  43030. selector: "context",
  43031. protocol: 'accessing',
  43032. fn: function (){
  43033. var self=this;
  43034. var $1;
  43035. $1=self["@context"];
  43036. return $1;
  43037. },
  43038. args: [],
  43039. source: "context\x0a\x09^ context",
  43040. referencedClasses: [],
  43041. messageSends: []
  43042. }),
  43043. $globals.AISemanticAnalyzer);
  43044. $core.addMethod(
  43045. $core.method({
  43046. selector: "context:",
  43047. protocol: 'accessing',
  43048. fn: function (anAIContext){
  43049. var self=this;
  43050. self["@context"]=anAIContext;
  43051. return self;
  43052. },
  43053. args: ["anAIContext"],
  43054. source: "context: anAIContext\x0a\x09context := anAIContext",
  43055. referencedClasses: [],
  43056. messageSends: []
  43057. }),
  43058. $globals.AISemanticAnalyzer);
  43059. $core.addMethod(
  43060. $core.method({
  43061. selector: "visitVariableNode:",
  43062. protocol: 'visiting',
  43063. fn: function (aNode){
  43064. var self=this;
  43065. function $ASTContextVar(){return $globals.ASTContextVar||(typeof ASTContextVar=="undefined"?nil:ASTContextVar)}
  43066. return $core.withContext(function($ctx1) {
  43067. var $1;
  43068. var $early={};
  43069. try {
  43070. $recv(self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  43071. return $core.withContext(function($ctx2) {
  43072. $1=(
  43073. $ctx2.supercall = true,
  43074. $globals.AISemanticAnalyzer.superclass.fn.prototype._visitVariableNode_.apply($recv(self), [aNode]));
  43075. $ctx2.supercall = false;
  43076. throw $early=[$1];
  43077. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43078. }));
  43079. $recv(aNode)._binding_($recv($ASTContextVar())._new());
  43080. return self;
  43081. }
  43082. catch(e) {if(e===$early)return e[0]; throw e}
  43083. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  43084. },
  43085. args: ["aNode"],
  43086. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  43087. referencedClasses: ["ASTContextVar"],
  43088. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  43089. }),
  43090. $globals.AISemanticAnalyzer);
  43091. $core.addClass('ASTContextVar', $globals.ScopeVar, ['context'], 'Compiler-Interpreter');
  43092. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  43093. $core.addMethod(
  43094. $core.method({
  43095. selector: "context",
  43096. protocol: 'accessing',
  43097. fn: function (){
  43098. var self=this;
  43099. var $1;
  43100. $1=self["@context"];
  43101. return $1;
  43102. },
  43103. args: [],
  43104. source: "context\x0a\x09^ context",
  43105. referencedClasses: [],
  43106. messageSends: []
  43107. }),
  43108. $globals.ASTContextVar);
  43109. $core.addMethod(
  43110. $core.method({
  43111. selector: "context:",
  43112. protocol: 'accessing',
  43113. fn: function (anObject){
  43114. var self=this;
  43115. self["@context"]=anObject;
  43116. return self;
  43117. },
  43118. args: ["anObject"],
  43119. source: "context: anObject\x0a\x09context := anObject",
  43120. referencedClasses: [],
  43121. messageSends: []
  43122. }),
  43123. $globals.ASTContextVar);
  43124. $core.addClass('ASTDebugger', $globals.Object, ['interpreter', 'context', 'result'], 'Compiler-Interpreter');
  43125. $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.";
  43126. $core.addMethod(
  43127. $core.method({
  43128. selector: "atEnd",
  43129. protocol: 'testing',
  43130. fn: function (){
  43131. var self=this;
  43132. return $core.withContext(function($ctx1) {
  43133. var $1,$2,$receiver;
  43134. $1=self._context();
  43135. $ctx1.sendIdx["context"]=1;
  43136. if(($receiver = $1) == null || $receiver.isNil){
  43137. return true;
  43138. } else {
  43139. $1;
  43140. };
  43141. $2=$recv($recv(self._interpreter())._atEnd())._and_((function(){
  43142. return $core.withContext(function($ctx2) {
  43143. return $recv(self._context())._isTopContext();
  43144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43145. }));
  43146. return $2;
  43147. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  43148. },
  43149. args: [],
  43150. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  43151. referencedClasses: [],
  43152. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  43153. }),
  43154. $globals.ASTDebugger);
  43155. $core.addMethod(
  43156. $core.method({
  43157. selector: "context",
  43158. protocol: 'accessing',
  43159. fn: function (){
  43160. var self=this;
  43161. var $1;
  43162. $1=self["@context"];
  43163. return $1;
  43164. },
  43165. args: [],
  43166. source: "context\x0a\x09^ context",
  43167. referencedClasses: [],
  43168. messageSends: []
  43169. }),
  43170. $globals.ASTDebugger);
  43171. $core.addMethod(
  43172. $core.method({
  43173. selector: "context:",
  43174. protocol: 'accessing',
  43175. fn: function (aContext){
  43176. var self=this;
  43177. self["@context"]=aContext;
  43178. return self;
  43179. },
  43180. args: ["aContext"],
  43181. source: "context: aContext\x0a\x09context := aContext",
  43182. referencedClasses: [],
  43183. messageSends: []
  43184. }),
  43185. $globals.ASTDebugger);
  43186. $core.addMethod(
  43187. $core.method({
  43188. selector: "flushInnerContexts",
  43189. protocol: 'actions',
  43190. fn: function (){
  43191. var self=this;
  43192. return $core.withContext(function($ctx1) {
  43193. var $1,$receiver;
  43194. $1=self._context();
  43195. if(($receiver = $1) == null || $receiver.isNil){
  43196. $1;
  43197. } else {
  43198. var cxt;
  43199. cxt=$receiver;
  43200. $recv(cxt)._innerContext_(nil);
  43201. };
  43202. return self;
  43203. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  43204. },
  43205. args: [],
  43206. 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 ]",
  43207. referencedClasses: [],
  43208. messageSends: ["ifNotNil:", "context", "innerContext:"]
  43209. }),
  43210. $globals.ASTDebugger);
  43211. $core.addMethod(
  43212. $core.method({
  43213. selector: "interpreter",
  43214. protocol: 'accessing',
  43215. fn: function (){
  43216. var self=this;
  43217. return $core.withContext(function($ctx1) {
  43218. var $2,$1,$receiver;
  43219. $2=self._context();
  43220. if(($receiver = $2) == null || $receiver.isNil){
  43221. $1=$2;
  43222. } else {
  43223. var ctx;
  43224. ctx=$receiver;
  43225. $1=$recv(ctx)._interpreter();
  43226. };
  43227. return $1;
  43228. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  43229. },
  43230. args: [],
  43231. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  43232. referencedClasses: [],
  43233. messageSends: ["ifNotNil:", "context", "interpreter"]
  43234. }),
  43235. $globals.ASTDebugger);
  43236. $core.addMethod(
  43237. $core.method({
  43238. selector: "method",
  43239. protocol: 'accessing',
  43240. fn: function (){
  43241. var self=this;
  43242. return $core.withContext(function($ctx1) {
  43243. var $1;
  43244. $1=$recv(self._context())._method();
  43245. return $1;
  43246. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  43247. },
  43248. args: [],
  43249. source: "method\x0a\x09^ self context method",
  43250. referencedClasses: [],
  43251. messageSends: ["method", "context"]
  43252. }),
  43253. $globals.ASTDebugger);
  43254. $core.addMethod(
  43255. $core.method({
  43256. selector: "node",
  43257. protocol: 'accessing',
  43258. fn: function (){
  43259. var self=this;
  43260. return $core.withContext(function($ctx1) {
  43261. var $2,$1,$receiver;
  43262. $2=self._interpreter();
  43263. $ctx1.sendIdx["interpreter"]=1;
  43264. if(($receiver = $2) == null || $receiver.isNil){
  43265. $1=$2;
  43266. } else {
  43267. $1=$recv(self._interpreter())._node();
  43268. };
  43269. return $1;
  43270. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  43271. },
  43272. args: [],
  43273. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  43274. referencedClasses: [],
  43275. messageSends: ["ifNotNil:", "interpreter", "node"]
  43276. }),
  43277. $globals.ASTDebugger);
  43278. $core.addMethod(
  43279. $core.method({
  43280. selector: "onStep",
  43281. protocol: 'private',
  43282. fn: function (){
  43283. var self=this;
  43284. return $core.withContext(function($ctx1) {
  43285. var $1,$3,$2,$4,$6,$5,$receiver;
  43286. $1=self._interpreter();
  43287. $ctx1.sendIdx["interpreter"]=1;
  43288. self["@result"]=$recv($1)._result();
  43289. $3=self._interpreter();
  43290. $ctx1.sendIdx["interpreter"]=2;
  43291. $2=$recv($3)._atEnd();
  43292. $ctx1.sendIdx["atEnd"]=1;
  43293. if($core.assert($2)){
  43294. $4=$recv(self._context())._outerContext();
  43295. if(($receiver = $4) == null || $receiver.isNil){
  43296. $4;
  43297. } else {
  43298. var outerContext;
  43299. outerContext=$receiver;
  43300. self._context_(outerContext);
  43301. };
  43302. $6=self._interpreter();
  43303. $ctx1.sendIdx["interpreter"]=3;
  43304. $5=$recv($6)._atEnd();
  43305. if(!$core.assert($5)){
  43306. $recv(self._interpreter())._skip();
  43307. };
  43308. };
  43309. self._flushInnerContexts();
  43310. return self;
  43311. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  43312. },
  43313. args: [],
  43314. 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",
  43315. referencedClasses: [],
  43316. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  43317. }),
  43318. $globals.ASTDebugger);
  43319. $core.addMethod(
  43320. $core.method({
  43321. selector: "proceed",
  43322. protocol: 'stepping',
  43323. fn: function (){
  43324. var self=this;
  43325. return $core.withContext(function($ctx1) {
  43326. $recv((function(){
  43327. return $core.withContext(function($ctx2) {
  43328. return self._atEnd();
  43329. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43330. }))._whileFalse_((function(){
  43331. return $core.withContext(function($ctx2) {
  43332. return self._stepOver();
  43333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43334. }));
  43335. return self;
  43336. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  43337. },
  43338. args: [],
  43339. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  43340. referencedClasses: [],
  43341. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  43342. }),
  43343. $globals.ASTDebugger);
  43344. $core.addMethod(
  43345. $core.method({
  43346. selector: "restart",
  43347. protocol: 'stepping',
  43348. fn: function (){
  43349. var self=this;
  43350. return $core.withContext(function($ctx1) {
  43351. $recv(self._interpreter())._restart();
  43352. self._flushInnerContexts();
  43353. return self;
  43354. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  43355. },
  43356. args: [],
  43357. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  43358. referencedClasses: [],
  43359. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  43360. }),
  43361. $globals.ASTDebugger);
  43362. $core.addMethod(
  43363. $core.method({
  43364. selector: "result",
  43365. protocol: 'accessing',
  43366. fn: function (){
  43367. var self=this;
  43368. var $1;
  43369. $1=self["@result"];
  43370. return $1;
  43371. },
  43372. args: [],
  43373. source: "result\x0a\x09^ result",
  43374. referencedClasses: [],
  43375. messageSends: []
  43376. }),
  43377. $globals.ASTDebugger);
  43378. $core.addMethod(
  43379. $core.method({
  43380. selector: "stepInto",
  43381. protocol: 'stepping',
  43382. fn: function (){
  43383. var self=this;
  43384. return $core.withContext(function($ctx1) {
  43385. self._shouldBeImplemented();
  43386. return self;
  43387. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  43388. },
  43389. args: [],
  43390. source: "stepInto\x0a\x09self shouldBeImplemented",
  43391. referencedClasses: [],
  43392. messageSends: ["shouldBeImplemented"]
  43393. }),
  43394. $globals.ASTDebugger);
  43395. $core.addMethod(
  43396. $core.method({
  43397. selector: "stepOver",
  43398. protocol: 'stepping',
  43399. fn: function (){
  43400. var self=this;
  43401. return $core.withContext(function($ctx1) {
  43402. var $1,$2;
  43403. $1=$recv(self._context())._isTopContext();
  43404. if($core.assert($1)){
  43405. $recv(self._interpreter())._stepOver();
  43406. } else {
  43407. $2=self._interpreter();
  43408. $ctx1.sendIdx["interpreter"]=1;
  43409. $recv($2)._skip();
  43410. };
  43411. self._onStep();
  43412. return self;
  43413. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  43414. },
  43415. args: [],
  43416. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  43417. referencedClasses: [],
  43418. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  43419. }),
  43420. $globals.ASTDebugger);
  43421. $core.addMethod(
  43422. $core.method({
  43423. selector: "context:",
  43424. protocol: 'instance creation',
  43425. fn: function (aContext){
  43426. var self=this;
  43427. return $core.withContext(function($ctx1) {
  43428. var $2,$3,$1;
  43429. $2=self._new();
  43430. $recv($2)._context_(aContext);
  43431. $3=$recv($2)._yourself();
  43432. $1=$3;
  43433. return $1;
  43434. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.klass)});
  43435. },
  43436. args: ["aContext"],
  43437. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  43438. referencedClasses: [],
  43439. messageSends: ["context:", "new", "yourself"]
  43440. }),
  43441. $globals.ASTDebugger.klass);
  43442. $core.addClass('ASTInterpreter', $globals.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned', 'forceAtEnd'], 'Compiler-Interpreter');
  43443. $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";
  43444. $core.addMethod(
  43445. $core.method({
  43446. selector: "assign:to:",
  43447. protocol: 'private',
  43448. fn: function (aNode,anObject){
  43449. var self=this;
  43450. return $core.withContext(function($ctx1) {
  43451. var $1,$3,$2,$4;
  43452. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  43453. if($core.assert($1)){
  43454. $3=self._context();
  43455. $ctx1.sendIdx["context"]=1;
  43456. $2=$recv($3)._receiver();
  43457. $4=$recv(aNode)._value();
  43458. $ctx1.sendIdx["value"]=1;
  43459. $recv($2)._instVarAt_put_($4,anObject);
  43460. } else {
  43461. $recv(self._context())._localAt_put_($recv(aNode)._value(),anObject);
  43462. };
  43463. return self;
  43464. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  43465. },
  43466. args: ["aNode", "anObject"],
  43467. 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 ]",
  43468. referencedClasses: [],
  43469. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  43470. }),
  43471. $globals.ASTInterpreter);
  43472. $core.addMethod(
  43473. $core.method({
  43474. selector: "atEnd",
  43475. protocol: 'testing',
  43476. fn: function (){
  43477. var self=this;
  43478. return $core.withContext(function($ctx1) {
  43479. var $1,$2;
  43480. $1=self["@forceAtEnd"];
  43481. if($core.assert($1)){
  43482. return true;
  43483. };
  43484. $2=$recv(self._hasReturned())._or_((function(){
  43485. return $core.withContext(function($ctx2) {
  43486. return $recv(self._node())._isNil();
  43487. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43488. }));
  43489. return $2;
  43490. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  43491. },
  43492. args: [],
  43493. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  43494. referencedClasses: [],
  43495. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  43496. }),
  43497. $globals.ASTInterpreter);
  43498. $core.addMethod(
  43499. $core.method({
  43500. selector: "context",
  43501. protocol: 'accessing',
  43502. fn: function (){
  43503. var self=this;
  43504. var $1;
  43505. $1=self["@context"];
  43506. return $1;
  43507. },
  43508. args: [],
  43509. source: "context\x0a\x09^ context",
  43510. referencedClasses: [],
  43511. messageSends: []
  43512. }),
  43513. $globals.ASTInterpreter);
  43514. $core.addMethod(
  43515. $core.method({
  43516. selector: "context:",
  43517. protocol: 'accessing',
  43518. fn: function (aContext){
  43519. var self=this;
  43520. self["@context"]=aContext;
  43521. return self;
  43522. },
  43523. args: ["aContext"],
  43524. source: "context: aContext\x0a\x09context := aContext",
  43525. referencedClasses: [],
  43526. messageSends: []
  43527. }),
  43528. $globals.ASTInterpreter);
  43529. $core.addMethod(
  43530. $core.method({
  43531. selector: "eval:",
  43532. protocol: 'private',
  43533. fn: function (aString){
  43534. var self=this;
  43535. var source,function_;
  43536. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  43537. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  43538. return $core.withContext(function($ctx1) {
  43539. var $3,$2,$1,$4,$5;
  43540. source=$recv($String())._streamContents_((function(str){
  43541. return $core.withContext(function($ctx2) {
  43542. $recv(str)._nextPutAll_("0,(function(");
  43543. $ctx2.sendIdx["nextPutAll:"]=1;
  43544. $3=self._context();
  43545. $ctx2.sendIdx["context"]=1;
  43546. $2=$recv($3)._locals();
  43547. $ctx2.sendIdx["locals"]=1;
  43548. $1=$recv($2)._keys();
  43549. $recv($1)._do_separatedBy_((function(each){
  43550. return $core.withContext(function($ctx3) {
  43551. return $recv(str)._nextPutAll_(each);
  43552. $ctx3.sendIdx["nextPutAll:"]=2;
  43553. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  43554. }),(function(){
  43555. return $core.withContext(function($ctx3) {
  43556. return $recv(str)._nextPutAll_(",");
  43557. $ctx3.sendIdx["nextPutAll:"]=3;
  43558. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  43559. }));
  43560. $recv(str)._nextPutAll_("){ return (function() {");
  43561. $ctx2.sendIdx["nextPutAll:"]=4;
  43562. $recv(str)._nextPutAll_(aString);
  43563. $ctx2.sendIdx["nextPutAll:"]=5;
  43564. $4=$recv(str)._nextPutAll_("})()})");
  43565. return $4;
  43566. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  43567. }));
  43568. function_=$recv($recv($Compiler())._new())._eval_(source);
  43569. $5=$recv(function_)._valueWithPossibleArguments_($recv($recv(self._context())._locals())._values());
  43570. return $5;
  43571. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  43572. },
  43573. args: ["aString"],
  43574. 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",
  43575. referencedClasses: ["String", "Compiler"],
  43576. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"]
  43577. }),
  43578. $globals.ASTInterpreter);
  43579. $core.addMethod(
  43580. $core.method({
  43581. selector: "hasReturned",
  43582. protocol: 'testing',
  43583. fn: function (){
  43584. var self=this;
  43585. return $core.withContext(function($ctx1) {
  43586. var $2,$1,$receiver;
  43587. $2=self["@returned"];
  43588. if(($receiver = $2) == null || $receiver.isNil){
  43589. $1=false;
  43590. } else {
  43591. $1=$2;
  43592. };
  43593. return $1;
  43594. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  43595. },
  43596. args: [],
  43597. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  43598. referencedClasses: [],
  43599. messageSends: ["ifNil:"]
  43600. }),
  43601. $globals.ASTInterpreter);
  43602. $core.addMethod(
  43603. $core.method({
  43604. selector: "initialize",
  43605. protocol: 'initialization',
  43606. fn: function (){
  43607. var self=this;
  43608. return $core.withContext(function($ctx1) {
  43609. (
  43610. $ctx1.supercall = true,
  43611. $globals.ASTInterpreter.superclass.fn.prototype._initialize.apply($recv(self), []));
  43612. $ctx1.supercall = false;
  43613. self["@forceAtEnd"]=false;
  43614. return self;
  43615. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  43616. },
  43617. args: [],
  43618. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  43619. referencedClasses: [],
  43620. messageSends: ["initialize"]
  43621. }),
  43622. $globals.ASTInterpreter);
  43623. $core.addMethod(
  43624. $core.method({
  43625. selector: "interpret",
  43626. protocol: 'interpreting',
  43627. fn: function (){
  43628. var self=this;
  43629. return $core.withContext(function($ctx1) {
  43630. self._visit_(self._node());
  43631. return self;
  43632. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  43633. },
  43634. args: [],
  43635. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  43636. referencedClasses: [],
  43637. messageSends: ["visit:", "node"]
  43638. }),
  43639. $globals.ASTInterpreter);
  43640. $core.addMethod(
  43641. $core.method({
  43642. selector: "interpret:",
  43643. protocol: 'interpreting',
  43644. fn: function (aNode){
  43645. var self=this;
  43646. return $core.withContext(function($ctx1) {
  43647. self._node_(aNode);
  43648. self._interpret();
  43649. return self;
  43650. }, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},$globals.ASTInterpreter)});
  43651. },
  43652. args: ["aNode"],
  43653. source: "interpret: aNode\x0a\x09self node: aNode.\x0a\x09self interpret",
  43654. referencedClasses: [],
  43655. messageSends: ["node:", "interpret"]
  43656. }),
  43657. $globals.ASTInterpreter);
  43658. $core.addMethod(
  43659. $core.method({
  43660. selector: "messageFromSendNode:arguments:",
  43661. protocol: 'private',
  43662. fn: function (aSendNode,aCollection){
  43663. var self=this;
  43664. function $Message(){return $globals.Message||(typeof Message=="undefined"?nil:Message)}
  43665. return $core.withContext(function($ctx1) {
  43666. var $2,$3,$1;
  43667. $2=$recv($Message())._new();
  43668. $recv($2)._selector_($recv(aSendNode)._selector());
  43669. $recv($2)._arguments_(aCollection);
  43670. $3=$recv($2)._yourself();
  43671. $1=$3;
  43672. return $1;
  43673. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  43674. },
  43675. args: ["aSendNode", "aCollection"],
  43676. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  43677. referencedClasses: ["Message"],
  43678. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  43679. }),
  43680. $globals.ASTInterpreter);
  43681. $core.addMethod(
  43682. $core.method({
  43683. selector: "messageNotUnderstood:receiver:",
  43684. protocol: 'private',
  43685. fn: function (aMessage,anObject){
  43686. var self=this;
  43687. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  43688. return $core.withContext(function($ctx1) {
  43689. var $1,$2;
  43690. $1=$recv($MessageNotUnderstood())._new();
  43691. $recv($1)._meesage_(aMessage);
  43692. $recv($1)._receiver_(anObject);
  43693. $2=$recv($1)._signal();
  43694. return self;
  43695. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  43696. },
  43697. args: ["aMessage", "anObject"],
  43698. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09meesage: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  43699. referencedClasses: ["MessageNotUnderstood"],
  43700. messageSends: ["meesage:", "new", "receiver:", "signal"]
  43701. }),
  43702. $globals.ASTInterpreter);
  43703. $core.addMethod(
  43704. $core.method({
  43705. selector: "next",
  43706. protocol: 'interpreting',
  43707. fn: function (){
  43708. var self=this;
  43709. return $core.withContext(function($ctx1) {
  43710. self._node_($recv(self._node())._nextNode());
  43711. return self;
  43712. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ASTInterpreter)});
  43713. },
  43714. args: [],
  43715. source: "next\x0a\x09self node: self node nextNode",
  43716. referencedClasses: [],
  43717. messageSends: ["node:", "nextNode", "node"]
  43718. }),
  43719. $globals.ASTInterpreter);
  43720. $core.addMethod(
  43721. $core.method({
  43722. selector: "node",
  43723. protocol: 'accessing',
  43724. fn: function (){
  43725. var self=this;
  43726. var $1;
  43727. $1=self["@node"];
  43728. return $1;
  43729. },
  43730. args: [],
  43731. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  43732. referencedClasses: [],
  43733. messageSends: []
  43734. }),
  43735. $globals.ASTInterpreter);
  43736. $core.addMethod(
  43737. $core.method({
  43738. selector: "node:",
  43739. protocol: 'accessing',
  43740. fn: function (aNode){
  43741. var self=this;
  43742. self["@node"]=aNode;
  43743. return self;
  43744. },
  43745. args: ["aNode"],
  43746. source: "node: aNode\x0a\x09node := aNode",
  43747. referencedClasses: [],
  43748. messageSends: []
  43749. }),
  43750. $globals.ASTInterpreter);
  43751. $core.addMethod(
  43752. $core.method({
  43753. selector: "peek",
  43754. protocol: 'stack',
  43755. fn: function (){
  43756. var self=this;
  43757. return $core.withContext(function($ctx1) {
  43758. var $1,$2;
  43759. var $early={};
  43760. try {
  43761. $1=self._stack();
  43762. $ctx1.sendIdx["stack"]=1;
  43763. $recv($1)._ifEmpty_((function(){
  43764. throw $early=[nil];
  43765. }));
  43766. $2=$recv(self._stack())._last();
  43767. return $2;
  43768. }
  43769. catch(e) {if(e===$early)return e[0]; throw e}
  43770. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  43771. },
  43772. args: [],
  43773. 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",
  43774. referencedClasses: [],
  43775. messageSends: ["ifEmpty:", "stack", "last"]
  43776. }),
  43777. $globals.ASTInterpreter);
  43778. $core.addMethod(
  43779. $core.method({
  43780. selector: "pop",
  43781. protocol: 'stack',
  43782. fn: function (){
  43783. var self=this;
  43784. var peekedValue;
  43785. return $core.withContext(function($ctx1) {
  43786. var $1;
  43787. peekedValue=self._peek();
  43788. $recv(self._stack())._removeLast();
  43789. $1=peekedValue;
  43790. return $1;
  43791. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  43792. },
  43793. args: [],
  43794. 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",
  43795. referencedClasses: [],
  43796. messageSends: ["peek", "removeLast", "stack"]
  43797. }),
  43798. $globals.ASTInterpreter);
  43799. $core.addMethod(
  43800. $core.method({
  43801. selector: "proceed",
  43802. protocol: 'interpreting',
  43803. fn: function (){
  43804. var self=this;
  43805. return $core.withContext(function($ctx1) {
  43806. $recv((function(){
  43807. return $core.withContext(function($ctx2) {
  43808. return self._atEnd();
  43809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43810. }))._whileFalse_((function(){
  43811. return $core.withContext(function($ctx2) {
  43812. return self._step();
  43813. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43814. }));
  43815. return self;
  43816. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  43817. },
  43818. args: [],
  43819. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  43820. referencedClasses: [],
  43821. messageSends: ["whileFalse:", "atEnd", "step"]
  43822. }),
  43823. $globals.ASTInterpreter);
  43824. $core.addMethod(
  43825. $core.method({
  43826. selector: "push:",
  43827. protocol: 'stack',
  43828. fn: function (anObject){
  43829. var self=this;
  43830. return $core.withContext(function($ctx1) {
  43831. var $1;
  43832. $1=$recv(self._stack())._add_(anObject);
  43833. return $1;
  43834. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  43835. },
  43836. args: ["anObject"],
  43837. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  43838. referencedClasses: [],
  43839. messageSends: ["add:", "stack"]
  43840. }),
  43841. $globals.ASTInterpreter);
  43842. $core.addMethod(
  43843. $core.method({
  43844. selector: "restart",
  43845. protocol: 'interpreting',
  43846. fn: function (){
  43847. var self=this;
  43848. return $core.withContext(function($ctx1) {
  43849. self._node_($recv($recv(self._context())._ast())._nextChild());
  43850. return self;
  43851. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  43852. },
  43853. args: [],
  43854. source: "restart\x0a\x09self node: self context ast nextChild",
  43855. referencedClasses: [],
  43856. messageSends: ["node:", "nextChild", "ast", "context"]
  43857. }),
  43858. $globals.ASTInterpreter);
  43859. $core.addMethod(
  43860. $core.method({
  43861. selector: "result",
  43862. protocol: 'accessing',
  43863. fn: function (){
  43864. var self=this;
  43865. return $core.withContext(function($ctx1) {
  43866. var $2,$1;
  43867. $2=self._hasReturned();
  43868. if($core.assert($2)){
  43869. $1=self._returnValue();
  43870. } else {
  43871. $1=$recv(self._context())._receiver();
  43872. };
  43873. return $1;
  43874. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  43875. },
  43876. args: [],
  43877. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  43878. referencedClasses: [],
  43879. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  43880. }),
  43881. $globals.ASTInterpreter);
  43882. $core.addMethod(
  43883. $core.method({
  43884. selector: "returnValue",
  43885. protocol: 'accessing',
  43886. fn: function (){
  43887. var self=this;
  43888. var $1;
  43889. $1=self["@returnValue"];
  43890. return $1;
  43891. },
  43892. args: [],
  43893. source: "returnValue\x0a\x09^ returnValue",
  43894. referencedClasses: [],
  43895. messageSends: []
  43896. }),
  43897. $globals.ASTInterpreter);
  43898. $core.addMethod(
  43899. $core.method({
  43900. selector: "returnValue:",
  43901. protocol: 'accessing',
  43902. fn: function (anObject){
  43903. var self=this;
  43904. self["@returnValue"]=anObject;
  43905. return self;
  43906. },
  43907. args: ["anObject"],
  43908. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  43909. referencedClasses: [],
  43910. messageSends: []
  43911. }),
  43912. $globals.ASTInterpreter);
  43913. $core.addMethod(
  43914. $core.method({
  43915. selector: "sendMessage:to:superSend:",
  43916. protocol: 'private',
  43917. fn: function (aMessage,anObject,aBoolean){
  43918. var self=this;
  43919. var method;
  43920. return $core.withContext(function($ctx1) {
  43921. var $1,$3,$2,$4,$5,$6,$receiver;
  43922. var $early={};
  43923. try {
  43924. if(!$core.assert(aBoolean)){
  43925. $1=$recv(aMessage)._sendTo_(anObject);
  43926. return $1;
  43927. };
  43928. $3=$recv(anObject)._class();
  43929. $ctx1.sendIdx["class"]=1;
  43930. $2=$recv($3)._superclass();
  43931. $ctx1.sendIdx["superclass"]=1;
  43932. if(($receiver = $2) == null || $receiver.isNil){
  43933. $4=self._messageNotUnderstood_receiver_(aMessage,anObject);
  43934. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  43935. return $4;
  43936. } else {
  43937. $2;
  43938. };
  43939. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  43940. return $core.withContext(function($ctx2) {
  43941. $5=self._messageNotUnderstood_receiver_(aMessage,anObject);
  43942. throw $early=[$5];
  43943. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43944. }));
  43945. $6=$recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  43946. return $6;
  43947. }
  43948. catch(e) {if(e===$early)return e[0]; throw e}
  43949. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  43950. },
  43951. args: ["aMessage", "anObject", "aBoolean"],
  43952. 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",
  43953. referencedClasses: [],
  43954. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  43955. }),
  43956. $globals.ASTInterpreter);
  43957. $core.addMethod(
  43958. $core.method({
  43959. selector: "setNonLocalReturnFromContext:",
  43960. protocol: 'interpreting',
  43961. fn: function (aContext){
  43962. var self=this;
  43963. return $core.withContext(function($ctx1) {
  43964. var $2,$1;
  43965. $2=$recv(aContext)._interpreter();
  43966. $ctx1.sendIdx["interpreter"]=1;
  43967. $1=$recv($2)._hasReturned();
  43968. if($core.assert($1)){
  43969. self["@returned"]=true;
  43970. self["@returned"];
  43971. self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  43972. };
  43973. return self;
  43974. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  43975. },
  43976. args: ["aContext"],
  43977. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  43978. referencedClasses: [],
  43979. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  43980. }),
  43981. $globals.ASTInterpreter);
  43982. $core.addMethod(
  43983. $core.method({
  43984. selector: "skip",
  43985. protocol: 'interpreting',
  43986. fn: function (){
  43987. var self=this;
  43988. return $core.withContext(function($ctx1) {
  43989. self._next();
  43990. return self;
  43991. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  43992. },
  43993. args: [],
  43994. source: "skip\x0a\x09self next",
  43995. referencedClasses: [],
  43996. messageSends: ["next"]
  43997. }),
  43998. $globals.ASTInterpreter);
  43999. $core.addMethod(
  44000. $core.method({
  44001. selector: "stack",
  44002. protocol: 'accessing',
  44003. fn: function (){
  44004. var self=this;
  44005. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  44006. return $core.withContext(function($ctx1) {
  44007. var $2,$1,$receiver;
  44008. $2=self["@stack"];
  44009. if(($receiver = $2) == null || $receiver.isNil){
  44010. self["@stack"]=$recv($OrderedCollection())._new();
  44011. $1=self["@stack"];
  44012. } else {
  44013. $1=$2;
  44014. };
  44015. return $1;
  44016. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  44017. },
  44018. args: [],
  44019. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  44020. referencedClasses: ["OrderedCollection"],
  44021. messageSends: ["ifNil:", "new"]
  44022. }),
  44023. $globals.ASTInterpreter);
  44024. $core.addMethod(
  44025. $core.method({
  44026. selector: "step",
  44027. protocol: 'interpreting',
  44028. fn: function (){
  44029. var self=this;
  44030. return $core.withContext(function($ctx1) {
  44031. var $1;
  44032. self._interpret();
  44033. $1=self._next();
  44034. return self;
  44035. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  44036. },
  44037. args: [],
  44038. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  44039. referencedClasses: [],
  44040. messageSends: ["interpret", "next"]
  44041. }),
  44042. $globals.ASTInterpreter);
  44043. $core.addMethod(
  44044. $core.method({
  44045. selector: "stepOver",
  44046. protocol: 'interpreting',
  44047. fn: function (){
  44048. var self=this;
  44049. return $core.withContext(function($ctx1) {
  44050. var $2,$1;
  44051. self._step();
  44052. $ctx1.sendIdx["step"]=1;
  44053. $recv((function(){
  44054. return $core.withContext(function($ctx2) {
  44055. $2=self._node();
  44056. $ctx2.sendIdx["node"]=1;
  44057. $1=$recv($2)._isNil();
  44058. return $recv($1)._or_((function(){
  44059. return $core.withContext(function($ctx3) {
  44060. return $recv(self._node())._isSteppingNode();
  44061. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44062. }));
  44063. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44064. }))._whileFalse_((function(){
  44065. return $core.withContext(function($ctx2) {
  44066. return self._step();
  44067. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44068. }));
  44069. return self;
  44070. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  44071. },
  44072. args: [],
  44073. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  44074. referencedClasses: [],
  44075. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  44076. }),
  44077. $globals.ASTInterpreter);
  44078. $core.addMethod(
  44079. $core.method({
  44080. selector: "visit:",
  44081. protocol: 'visiting',
  44082. fn: function (aNode){
  44083. var self=this;
  44084. return $core.withContext(function($ctx1) {
  44085. var $1;
  44086. $1=self._hasReturned();
  44087. if(!$core.assert($1)){
  44088. (
  44089. $ctx1.supercall = true,
  44090. $globals.ASTInterpreter.superclass.fn.prototype._visit_.apply($recv(self), [aNode]));
  44091. $ctx1.supercall = false;
  44092. };
  44093. return self;
  44094. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  44095. },
  44096. args: ["aNode"],
  44097. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  44098. referencedClasses: [],
  44099. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  44100. }),
  44101. $globals.ASTInterpreter);
  44102. $core.addMethod(
  44103. $core.method({
  44104. selector: "visitAssignmentNode:",
  44105. protocol: 'visiting',
  44106. fn: function (aNode){
  44107. var self=this;
  44108. var poppedValue;
  44109. return $core.withContext(function($ctx1) {
  44110. poppedValue=self._pop();
  44111. $ctx1.sendIdx["pop"]=1;
  44112. self._pop();
  44113. self._push_(poppedValue);
  44114. self._assign_to_($recv(aNode)._left(),poppedValue);
  44115. return self;
  44116. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  44117. },
  44118. args: ["aNode"],
  44119. 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",
  44120. referencedClasses: [],
  44121. messageSends: ["pop", "push:", "assign:to:", "left"]
  44122. }),
  44123. $globals.ASTInterpreter);
  44124. $core.addMethod(
  44125. $core.method({
  44126. selector: "visitBlockNode:",
  44127. protocol: 'visiting',
  44128. fn: function (aNode){
  44129. var self=this;
  44130. var block;
  44131. function $AIBlockClosure(){return $globals.AIBlockClosure||(typeof AIBlockClosure=="undefined"?nil:AIBlockClosure)}
  44132. return $core.withContext(function($ctx1) {
  44133. block=$recv($AIBlockClosure())._forContext_node_(self._context(),aNode);
  44134. self._push_(block);
  44135. return self;
  44136. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  44137. },
  44138. args: ["aNode"],
  44139. 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",
  44140. referencedClasses: ["AIBlockClosure"],
  44141. messageSends: ["forContext:node:", "context", "push:"]
  44142. }),
  44143. $globals.ASTInterpreter);
  44144. $core.addMethod(
  44145. $core.method({
  44146. selector: "visitBlockSequenceNode:",
  44147. protocol: 'visiting',
  44148. fn: function (aNode){
  44149. var self=this;
  44150. return $core.withContext(function($ctx1) {
  44151. (
  44152. $ctx1.supercall = true,
  44153. $globals.ASTInterpreter.superclass.fn.prototype._visitBlockSequenceNode_.apply($recv(self), [aNode]));
  44154. $ctx1.supercall = false;
  44155. self["@forceAtEnd"]=true;
  44156. return self;
  44157. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44158. },
  44159. args: ["aNode"],
  44160. 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",
  44161. referencedClasses: [],
  44162. messageSends: ["visitBlockSequenceNode:"]
  44163. }),
  44164. $globals.ASTInterpreter);
  44165. $core.addMethod(
  44166. $core.method({
  44167. selector: "visitDynamicArrayNode:",
  44168. protocol: 'visiting',
  44169. fn: function (aNode){
  44170. var self=this;
  44171. var array;
  44172. return $core.withContext(function($ctx1) {
  44173. array=[];
  44174. $recv($recv(aNode)._nodes())._do_((function(each){
  44175. return $core.withContext(function($ctx2) {
  44176. return $recv(array)._addFirst_(self._pop());
  44177. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44178. }));
  44179. self._push_(array);
  44180. return self;
  44181. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  44182. },
  44183. args: ["aNode"],
  44184. 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",
  44185. referencedClasses: [],
  44186. messageSends: ["do:", "nodes", "addFirst:", "pop", "push:"]
  44187. }),
  44188. $globals.ASTInterpreter);
  44189. $core.addMethod(
  44190. $core.method({
  44191. selector: "visitDynamicDictionaryNode:",
  44192. protocol: 'visiting',
  44193. fn: function (aNode){
  44194. var self=this;
  44195. var keyValueList;
  44196. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  44197. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  44198. return $core.withContext(function($ctx1) {
  44199. keyValueList=$recv($OrderedCollection())._new();
  44200. $recv($recv(aNode)._nodes())._do_((function(each){
  44201. return $core.withContext(function($ctx2) {
  44202. return $recv(keyValueList)._add_(self._pop());
  44203. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44204. }));
  44205. self._push_($recv($HashedCollection())._newFromPairs_($recv(keyValueList)._reversed()));
  44206. return self;
  44207. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  44208. },
  44209. args: ["aNode"],
  44210. 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)",
  44211. referencedClasses: ["OrderedCollection", "HashedCollection"],
  44212. messageSends: ["new", "do:", "nodes", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  44213. }),
  44214. $globals.ASTInterpreter);
  44215. $core.addMethod(
  44216. $core.method({
  44217. selector: "visitJSStatementNode:",
  44218. protocol: 'visiting',
  44219. fn: function (aNode){
  44220. var self=this;
  44221. return $core.withContext(function($ctx1) {
  44222. self["@returned"]=true;
  44223. self._returnValue_(self._eval_($recv(aNode)._source()));
  44224. return self;
  44225. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44226. },
  44227. args: ["aNode"],
  44228. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  44229. referencedClasses: [],
  44230. messageSends: ["returnValue:", "eval:", "source"]
  44231. }),
  44232. $globals.ASTInterpreter);
  44233. $core.addMethod(
  44234. $core.method({
  44235. selector: "visitNode:",
  44236. protocol: 'visiting',
  44237. fn: function (aNode){
  44238. var self=this;
  44239. return self;
  44240. },
  44241. args: ["aNode"],
  44242. source: "visitNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  44243. referencedClasses: [],
  44244. messageSends: []
  44245. }),
  44246. $globals.ASTInterpreter);
  44247. $core.addMethod(
  44248. $core.method({
  44249. selector: "visitReturnNode:",
  44250. protocol: 'visiting',
  44251. fn: function (aNode){
  44252. var self=this;
  44253. return $core.withContext(function($ctx1) {
  44254. self["@returned"]=true;
  44255. self._returnValue_(self._pop());
  44256. return self;
  44257. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44258. },
  44259. args: ["aNode"],
  44260. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  44261. referencedClasses: [],
  44262. messageSends: ["returnValue:", "pop"]
  44263. }),
  44264. $globals.ASTInterpreter);
  44265. $core.addMethod(
  44266. $core.method({
  44267. selector: "visitSendNode:",
  44268. protocol: 'visiting',
  44269. fn: function (aNode){
  44270. var self=this;
  44271. var receiver,args,message,result;
  44272. return $core.withContext(function($ctx1) {
  44273. var $1;
  44274. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  44275. return $core.withContext(function($ctx2) {
  44276. return self._pop();
  44277. $ctx2.sendIdx["pop"]=1;
  44278. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44279. }));
  44280. receiver=self._pop();
  44281. message=self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  44282. result=self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  44283. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  44284. return $core.withContext(function($ctx2) {
  44285. return $recv($recv(aNode)._isLastChild())._not();
  44286. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44287. }));
  44288. if($core.assert($1)){
  44289. self._push_(receiver);
  44290. $ctx1.sendIdx["push:"]=1;
  44291. } else {
  44292. self._push_(result);
  44293. };
  44294. return self;
  44295. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  44296. },
  44297. args: ["aNode"],
  44298. source: "visitSendNode: aNode\x0a\x09| receiver args message result |\x0a\x09\x0a\x09args := aNode arguments collect: [ :each | self pop ].\x0a\x09receiver := self pop.\x0a\x09\x0a\x09message := self\x0a\x09\x09messageFromSendNode: aNode\x0a\x09\x09arguments: args reversed.\x0a\x09\x0a\x09result := self sendMessage: message to: receiver superSend: aNode superSend.\x0a\x09\x0a\x09\x22For cascade sends, push the reciever if the send is not the last one\x22\x0a\x09(aNode isCascadeSendNode and: [ aNode isLastChild not ])\x0a\x09\x09ifTrue: [ self push: receiver ]\x0a\x09\x09ifFalse: [ self push: result ]",
  44299. referencedClasses: [],
  44300. messageSends: ["collect:", "arguments", "pop", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifTrue:ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  44301. }),
  44302. $globals.ASTInterpreter);
  44303. $core.addMethod(
  44304. $core.method({
  44305. selector: "visitSequenceNode:",
  44306. protocol: 'visiting',
  44307. fn: function (aNode){
  44308. var self=this;
  44309. return $core.withContext(function($ctx1) {
  44310. $recv($recv(aNode)._temps())._do_((function(each){
  44311. return $core.withContext(function($ctx2) {
  44312. return $recv(self._context())._defineLocal_(each);
  44313. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44314. }));
  44315. return self;
  44316. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44317. },
  44318. args: ["aNode"],
  44319. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self context defineLocal: each ]",
  44320. referencedClasses: [],
  44321. messageSends: ["do:", "temps", "defineLocal:", "context"]
  44322. }),
  44323. $globals.ASTInterpreter);
  44324. $core.addMethod(
  44325. $core.method({
  44326. selector: "visitValueNode:",
  44327. protocol: 'visiting',
  44328. fn: function (aNode){
  44329. var self=this;
  44330. return $core.withContext(function($ctx1) {
  44331. self._push_($recv(aNode)._value());
  44332. return self;
  44333. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44334. },
  44335. args: ["aNode"],
  44336. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  44337. referencedClasses: [],
  44338. messageSends: ["push:", "value"]
  44339. }),
  44340. $globals.ASTInterpreter);
  44341. $core.addMethod(
  44342. $core.method({
  44343. selector: "visitVariableNode:",
  44344. protocol: 'visiting',
  44345. fn: function (aNode){
  44346. var self=this;
  44347. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  44348. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  44349. return $core.withContext(function($ctx1) {
  44350. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  44351. $2=$recv(aNode)._binding();
  44352. $ctx1.sendIdx["binding"]=1;
  44353. $1=$recv($2)._isUnknownVar();
  44354. if($core.assert($1)){
  44355. $5=$recv($Platform())._globals();
  44356. $ctx1.sendIdx["globals"]=1;
  44357. $6=$recv(aNode)._value();
  44358. $ctx1.sendIdx["value"]=1;
  44359. $4=$recv($5)._at_ifAbsent_($6,(function(){
  44360. return $core.withContext(function($ctx2) {
  44361. return self._error_("Unknown variable");
  44362. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44363. }));
  44364. $ctx1.sendIdx["at:ifAbsent:"]=1;
  44365. $3=self._push_($4);
  44366. $ctx1.sendIdx["push:"]=1;
  44367. return $3;
  44368. };
  44369. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  44370. if($core.assert($8)){
  44371. $10=self._context();
  44372. $ctx1.sendIdx["context"]=1;
  44373. $9=$recv($10)._receiver();
  44374. $11=$recv(aNode)._value();
  44375. $ctx1.sendIdx["value"]=2;
  44376. $7=$recv($9)._instVarAt_($11);
  44377. } else {
  44378. $12=self._context();
  44379. $13=$recv(aNode)._value();
  44380. $ctx1.sendIdx["value"]=3;
  44381. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  44382. return $core.withContext(function($ctx2) {
  44383. $15=$recv(aNode)._value();
  44384. $ctx2.sendIdx["value"]=4;
  44385. $14=$recv($15)._isCapitalized();
  44386. if($core.assert($14)){
  44387. $16=$recv($Smalltalk())._globals();
  44388. $ctx2.sendIdx["globals"]=2;
  44389. $17=$recv(aNode)._value();
  44390. $ctx2.sendIdx["value"]=5;
  44391. return $recv($16)._at_ifAbsent_($17,(function(){
  44392. return $core.withContext(function($ctx3) {
  44393. return $recv($recv($Platform())._globals())._at_($recv(aNode)._value());
  44394. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  44395. }));
  44396. };
  44397. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  44398. }));
  44399. };
  44400. self._push_($7);
  44401. return self;
  44402. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44403. },
  44404. args: ["aNode"],
  44405. 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 ] ] ] ])",
  44406. referencedClasses: ["Platform", "Smalltalk"],
  44407. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  44408. }),
  44409. $globals.ASTInterpreter);
  44410. $core.addClass('ASTInterpreterError', $globals.Error, [], 'Compiler-Interpreter');
  44411. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  44412. $core.addClass('ASTPCNodeVisitor', $globals.NodeVisitor, ['context', 'index', 'selector', 'currentNode'], 'Compiler-Interpreter');
  44413. $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`";
  44414. $core.addMethod(
  44415. $core.method({
  44416. selector: "context",
  44417. protocol: 'accessing',
  44418. fn: function (){
  44419. var self=this;
  44420. var $1;
  44421. $1=self["@context"];
  44422. return $1;
  44423. },
  44424. args: [],
  44425. source: "context\x0a\x09^ context",
  44426. referencedClasses: [],
  44427. messageSends: []
  44428. }),
  44429. $globals.ASTPCNodeVisitor);
  44430. $core.addMethod(
  44431. $core.method({
  44432. selector: "context:",
  44433. protocol: 'accessing',
  44434. fn: function (aContext){
  44435. var self=this;
  44436. self["@context"]=aContext;
  44437. return self;
  44438. },
  44439. args: ["aContext"],
  44440. source: "context: aContext\x0a\x09context := aContext",
  44441. referencedClasses: [],
  44442. messageSends: []
  44443. }),
  44444. $globals.ASTPCNodeVisitor);
  44445. $core.addMethod(
  44446. $core.method({
  44447. selector: "currentNode",
  44448. protocol: 'accessing',
  44449. fn: function (){
  44450. var self=this;
  44451. var $1;
  44452. $1=self["@currentNode"];
  44453. return $1;
  44454. },
  44455. args: [],
  44456. source: "currentNode\x0a\x09^ currentNode",
  44457. referencedClasses: [],
  44458. messageSends: []
  44459. }),
  44460. $globals.ASTPCNodeVisitor);
  44461. $core.addMethod(
  44462. $core.method({
  44463. selector: "increaseIndex",
  44464. protocol: 'accessing',
  44465. fn: function (){
  44466. var self=this;
  44467. return $core.withContext(function($ctx1) {
  44468. self["@index"]=$recv(self._index()).__plus((1));
  44469. return self;
  44470. }, function($ctx1) {$ctx1.fill(self,"increaseIndex",{},$globals.ASTPCNodeVisitor)});
  44471. },
  44472. args: [],
  44473. source: "increaseIndex\x0a\x09index := self index + 1",
  44474. referencedClasses: [],
  44475. messageSends: ["+", "index"]
  44476. }),
  44477. $globals.ASTPCNodeVisitor);
  44478. $core.addMethod(
  44479. $core.method({
  44480. selector: "index",
  44481. protocol: 'accessing',
  44482. fn: function (){
  44483. var self=this;
  44484. return $core.withContext(function($ctx1) {
  44485. var $2,$1,$receiver;
  44486. $2=self["@index"];
  44487. if(($receiver = $2) == null || $receiver.isNil){
  44488. self["@index"]=(0);
  44489. $1=self["@index"];
  44490. } else {
  44491. $1=$2;
  44492. };
  44493. return $1;
  44494. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.ASTPCNodeVisitor)});
  44495. },
  44496. args: [],
  44497. source: "index\x0a\x09^ index ifNil: [ index := 0 ]",
  44498. referencedClasses: [],
  44499. messageSends: ["ifNil:"]
  44500. }),
  44501. $globals.ASTPCNodeVisitor);
  44502. $core.addMethod(
  44503. $core.method({
  44504. selector: "selector",
  44505. protocol: 'accessing',
  44506. fn: function (){
  44507. var self=this;
  44508. var $1;
  44509. $1=self["@selector"];
  44510. return $1;
  44511. },
  44512. args: [],
  44513. source: "selector\x0a\x09^ selector",
  44514. referencedClasses: [],
  44515. messageSends: []
  44516. }),
  44517. $globals.ASTPCNodeVisitor);
  44518. $core.addMethod(
  44519. $core.method({
  44520. selector: "selector:",
  44521. protocol: 'accessing',
  44522. fn: function (aString){
  44523. var self=this;
  44524. self["@selector"]=aString;
  44525. return self;
  44526. },
  44527. args: ["aString"],
  44528. source: "selector: aString\x0a\x09selector := aString",
  44529. referencedClasses: [],
  44530. messageSends: []
  44531. }),
  44532. $globals.ASTPCNodeVisitor);
  44533. $core.addMethod(
  44534. $core.method({
  44535. selector: "visitJSStatementNode:",
  44536. protocol: 'visiting',
  44537. fn: function (aNode){
  44538. var self=this;
  44539. self["@currentNode"]=aNode;
  44540. return self;
  44541. },
  44542. args: ["aNode"],
  44543. 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",
  44544. referencedClasses: [],
  44545. messageSends: []
  44546. }),
  44547. $globals.ASTPCNodeVisitor);
  44548. $core.addMethod(
  44549. $core.method({
  44550. selector: "visitSendNode:",
  44551. protocol: 'visiting',
  44552. fn: function (aNode){
  44553. var self=this;
  44554. var sendIndex;
  44555. return $core.withContext(function($ctx1) {
  44556. var $1,$2,$4,$3,$5;
  44557. $1=self._context();
  44558. $2=self._selector();
  44559. $ctx1.sendIdx["selector"]=1;
  44560. sendIndex=$recv($1)._sendIndexAt_($2);
  44561. (
  44562. $ctx1.supercall = true,
  44563. $globals.ASTPCNodeVisitor.superclass.fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  44564. $ctx1.supercall = false;
  44565. $4=self._selector();
  44566. $ctx1.sendIdx["selector"]=2;
  44567. $3=$recv($4).__eq($recv(aNode)._selector());
  44568. $ctx1.sendIdx["="]=1;
  44569. if($core.assert($3)){
  44570. $5=$recv(self._index()).__eq(sendIndex);
  44571. if($core.assert($5)){
  44572. self["@currentNode"]=aNode;
  44573. self["@currentNode"];
  44574. };
  44575. self._increaseIndex();
  44576. };
  44577. return self;
  44578. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sendIndex:sendIndex},$globals.ASTPCNodeVisitor)});
  44579. },
  44580. args: ["aNode"],
  44581. 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 ]",
  44582. referencedClasses: [],
  44583. messageSends: ["sendIndexAt:", "context", "selector", "visitSendNode:", "ifTrue:", "=", "index", "increaseIndex"]
  44584. }),
  44585. $globals.ASTPCNodeVisitor);
  44586. $core.addMethod(
  44587. $core.method({
  44588. selector: "isSteppingNode",
  44589. protocol: '*Compiler-Interpreter',
  44590. fn: function (){
  44591. var self=this;
  44592. return true;
  44593. },
  44594. args: [],
  44595. source: "isSteppingNode\x0a\x09^ true",
  44596. referencedClasses: [],
  44597. messageSends: []
  44598. }),
  44599. $globals.AssignmentNode);
  44600. $core.addMethod(
  44601. $core.method({
  44602. selector: "isSteppingNode",
  44603. protocol: '*Compiler-Interpreter',
  44604. fn: function (){
  44605. var self=this;
  44606. return true;
  44607. },
  44608. args: [],
  44609. source: "isSteppingNode\x0a\x09^ true",
  44610. referencedClasses: [],
  44611. messageSends: []
  44612. }),
  44613. $globals.BlockNode);
  44614. $core.addMethod(
  44615. $core.method({
  44616. selector: "nextChild",
  44617. protocol: '*Compiler-Interpreter',
  44618. fn: function (){
  44619. var self=this;
  44620. return self;
  44621. },
  44622. args: [],
  44623. source: "nextChild\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
  44624. referencedClasses: [],
  44625. messageSends: []
  44626. }),
  44627. $globals.BlockNode);
  44628. $core.addMethod(
  44629. $core.method({
  44630. selector: "nextNode:",
  44631. protocol: '*Compiler-Interpreter',
  44632. fn: function (aNode){
  44633. var self=this;
  44634. return self;
  44635. },
  44636. args: ["aNode"],
  44637. source: "nextNode: aNode\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
  44638. referencedClasses: [],
  44639. messageSends: []
  44640. }),
  44641. $globals.BlockNode);
  44642. $core.addMethod(
  44643. $core.method({
  44644. selector: "isSteppingNode",
  44645. protocol: '*Compiler-Interpreter',
  44646. fn: function (){
  44647. var self=this;
  44648. return true;
  44649. },
  44650. args: [],
  44651. source: "isSteppingNode\x0a\x09^ true",
  44652. referencedClasses: [],
  44653. messageSends: []
  44654. }),
  44655. $globals.DynamicArrayNode);
  44656. $core.addMethod(
  44657. $core.method({
  44658. selector: "isSteppingNode",
  44659. protocol: '*Compiler-Interpreter',
  44660. fn: function (){
  44661. var self=this;
  44662. return true;
  44663. },
  44664. args: [],
  44665. source: "isSteppingNode\x0a\x09^ true",
  44666. referencedClasses: [],
  44667. messageSends: []
  44668. }),
  44669. $globals.DynamicDictionaryNode);
  44670. $core.addMethod(
  44671. $core.method({
  44672. selector: "isSteppingNode",
  44673. protocol: '*Compiler-Interpreter',
  44674. fn: function (){
  44675. var self=this;
  44676. return true;
  44677. },
  44678. args: [],
  44679. source: "isSteppingNode\x0a\x09^ true",
  44680. referencedClasses: [],
  44681. messageSends: []
  44682. }),
  44683. $globals.JSStatementNode);
  44684. $core.addMethod(
  44685. $core.method({
  44686. selector: "isSteppingNode",
  44687. protocol: '*Compiler-Interpreter',
  44688. fn: function (){
  44689. var self=this;
  44690. return false;
  44691. },
  44692. args: [],
  44693. source: "isSteppingNode\x0a\x09^ false",
  44694. referencedClasses: [],
  44695. messageSends: []
  44696. }),
  44697. $globals.Node);
  44698. $core.addMethod(
  44699. $core.method({
  44700. selector: "nextChild",
  44701. protocol: '*Compiler-Interpreter',
  44702. fn: function (){
  44703. var self=this;
  44704. return $core.withContext(function($ctx1) {
  44705. var $3,$2,$1;
  44706. $3=self._nodes();
  44707. $ctx1.sendIdx["nodes"]=1;
  44708. $2=$recv($3)._isEmpty();
  44709. if($core.assert($2)){
  44710. $1=self;
  44711. } else {
  44712. $1=$recv($recv(self._nodes())._first())._nextChild();
  44713. };
  44714. return $1;
  44715. }, function($ctx1) {$ctx1.fill(self,"nextChild",{},$globals.Node)});
  44716. },
  44717. args: [],
  44718. source: "nextChild\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the receiver to answer the next node to be evaluated\x22\x0a\x09\x0a\x09^ self nodes isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self nodes first nextChild ]",
  44719. referencedClasses: [],
  44720. messageSends: ["ifTrue:ifFalse:", "isEmpty", "nodes", "nextChild", "first"]
  44721. }),
  44722. $globals.Node);
  44723. $core.addMethod(
  44724. $core.method({
  44725. selector: "nextNode",
  44726. protocol: '*Compiler-Interpreter',
  44727. fn: function (){
  44728. var self=this;
  44729. return $core.withContext(function($ctx1) {
  44730. var $2,$1,$receiver;
  44731. $2=self._parent();
  44732. if(($receiver = $2) == null || $receiver.isNil){
  44733. $1=$2;
  44734. } else {
  44735. var node;
  44736. node=$receiver;
  44737. $1=$recv(node)._nextNode_(self);
  44738. };
  44739. return $1;
  44740. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},$globals.Node)});
  44741. },
  44742. args: [],
  44743. source: "nextNode\x0a\x09^ self parent ifNotNil: [ :node |\x0a\x09\x09node nextNode: self ]",
  44744. referencedClasses: [],
  44745. messageSends: ["ifNotNil:", "parent", "nextNode:"]
  44746. }),
  44747. $globals.Node);
  44748. $core.addMethod(
  44749. $core.method({
  44750. selector: "nextNode:",
  44751. protocol: '*Compiler-Interpreter',
  44752. fn: function (aNode){
  44753. var self=this;
  44754. var next;
  44755. return $core.withContext(function($ctx1) {
  44756. var $1,$2;
  44757. var $early={};
  44758. try {
  44759. $1=self._nodes();
  44760. $ctx1.sendIdx["nodes"]=1;
  44761. next=$recv($1)._at_ifAbsent_($recv($recv(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){
  44762. throw $early=[self];
  44763. }));
  44764. $2=$recv(next)._nextChild();
  44765. return $2;
  44766. }
  44767. catch(e) {if(e===$early)return e[0]; throw e}
  44768. }, function($ctx1) {$ctx1.fill(self,"nextNode:",{aNode:aNode,next:next},$globals.Node)});
  44769. },
  44770. args: ["aNode"],
  44771. source: "nextNode: aNode\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the next node to answer the next node to be evaluated\x22\x0a\x09\x0a\x09| next |\x0a\x09\x0a\x09next := self nodes \x0a\x09\x09at: (self nodes indexOf: aNode) + 1\x0a\x09\x09ifAbsent: [ ^ self ].\x0a\x09\x0a\x09^ next nextChild",
  44772. referencedClasses: [],
  44773. messageSends: ["at:ifAbsent:", "nodes", "+", "indexOf:", "nextChild"]
  44774. }),
  44775. $globals.Node);
  44776. $core.addMethod(
  44777. $core.method({
  44778. selector: "isSteppingNode",
  44779. protocol: '*Compiler-Interpreter',
  44780. fn: function (){
  44781. var self=this;
  44782. return true;
  44783. },
  44784. args: [],
  44785. source: "isSteppingNode\x0a\x09^ true",
  44786. referencedClasses: [],
  44787. messageSends: []
  44788. }),
  44789. $globals.SendNode);
  44790. });
  44791. define('amber/lang',[
  44792. './helpers', // pre-fetch, dep of ./deploy
  44793. './deploy',
  44794. './parser',
  44795. // --- packages for the Amber reflection begin here ---
  44796. 'amber_core/Platform-ImportExport',
  44797. 'amber_core/Compiler-Core',
  44798. 'amber_core/Compiler-AST',
  44799. 'amber_core/Compiler-Semantic',
  44800. 'amber_core/Compiler-IR',
  44801. 'amber_core/Compiler-Inlining',
  44802. 'amber_core/Compiler-Interpreter'
  44803. // --- packages for the Amber reflection end here ---
  44804. ], function (amber) { return amber; });
  44805. 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";
  44806. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  44807. $core.addPackage('SUnit');
  44808. $core.packages["SUnit"].innerEval = function (expr) { return eval(expr); };
  44809. $core.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  44810. $core.addClass('ResultAnnouncement', $globals.Object, ['result'], 'SUnit');
  44811. $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.";
  44812. $core.addMethod(
  44813. $core.method({
  44814. selector: "result",
  44815. protocol: 'accessing',
  44816. fn: function (){
  44817. var self=this;
  44818. var $1;
  44819. $1=self["@result"];
  44820. return $1;
  44821. },
  44822. args: [],
  44823. source: "result\x0a\x09^ result",
  44824. referencedClasses: [],
  44825. messageSends: []
  44826. }),
  44827. $globals.ResultAnnouncement);
  44828. $core.addMethod(
  44829. $core.method({
  44830. selector: "result:",
  44831. protocol: 'accessing',
  44832. fn: function (aTestResult){
  44833. var self=this;
  44834. self["@result"]=aTestResult;
  44835. return self;
  44836. },
  44837. args: ["aTestResult"],
  44838. source: "result: aTestResult\x0a\x09result := aTestResult",
  44839. referencedClasses: [],
  44840. messageSends: []
  44841. }),
  44842. $globals.ResultAnnouncement);
  44843. $core.addClass('TestCase', $globals.Object, ['testSelector', 'asyncTimeout', 'context'], 'SUnit');
  44844. $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.";
  44845. $core.addMethod(
  44846. $core.method({
  44847. selector: "assert:",
  44848. protocol: 'testing',
  44849. fn: function (aBoolean){
  44850. var self=this;
  44851. return $core.withContext(function($ctx1) {
  44852. self._assert_description_(aBoolean,"Assertion failed");
  44853. return self;
  44854. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  44855. },
  44856. args: ["aBoolean"],
  44857. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  44858. referencedClasses: [],
  44859. messageSends: ["assert:description:"]
  44860. }),
  44861. $globals.TestCase);
  44862. $core.addMethod(
  44863. $core.method({
  44864. selector: "assert:description:",
  44865. protocol: 'testing',
  44866. fn: function (aBoolean,aString){
  44867. var self=this;
  44868. return $core.withContext(function($ctx1) {
  44869. if(!$core.assert(aBoolean)){
  44870. self._signalFailure_(aString);
  44871. };
  44872. return self;
  44873. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  44874. },
  44875. args: ["aBoolean", "aString"],
  44876. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  44877. referencedClasses: [],
  44878. messageSends: ["ifFalse:", "signalFailure:"]
  44879. }),
  44880. $globals.TestCase);
  44881. $core.addMethod(
  44882. $core.method({
  44883. selector: "assert:equals:",
  44884. protocol: 'testing',
  44885. fn: function (actual,expected){
  44886. var self=this;
  44887. return $core.withContext(function($ctx1) {
  44888. var $2,$6,$5,$4,$3,$1;
  44889. $2=$recv(actual).__eq(expected);
  44890. $6=$recv(expected)._printString();
  44891. $ctx1.sendIdx["printString"]=1;
  44892. $5="Expected: ".__comma($6);
  44893. $4=$recv($5).__comma(" but was: ");
  44894. $ctx1.sendIdx[","]=2;
  44895. $3=$recv($4).__comma($recv(actual)._printString());
  44896. $ctx1.sendIdx[","]=1;
  44897. $1=self._assert_description_($2,$3);
  44898. return $1;
  44899. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  44900. },
  44901. args: ["actual", "expected"],
  44902. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  44903. referencedClasses: [],
  44904. messageSends: ["assert:description:", "=", ",", "printString"]
  44905. }),
  44906. $globals.TestCase);
  44907. $core.addMethod(
  44908. $core.method({
  44909. selector: "async:",
  44910. protocol: 'async',
  44911. fn: function (aBlock){
  44912. var self=this;
  44913. var c;
  44914. return $core.withContext(function($ctx1) {
  44915. var $2,$1;
  44916. self._errorIfNotAsync_("#async");
  44917. c=self["@context"];
  44918. $1=(function(){
  44919. return $core.withContext(function($ctx2) {
  44920. $2=self._isAsync();
  44921. if($core.assert($2)){
  44922. return $recv(c)._execute_(aBlock);
  44923. };
  44924. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44925. });
  44926. return $1;
  44927. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  44928. },
  44929. args: ["aBlock"],
  44930. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  44931. referencedClasses: [],
  44932. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  44933. }),
  44934. $globals.TestCase);
  44935. $core.addMethod(
  44936. $core.method({
  44937. selector: "context:",
  44938. protocol: 'accessing',
  44939. fn: function (aRunningTestContext){
  44940. var self=this;
  44941. self["@context"]=aRunningTestContext;
  44942. return self;
  44943. },
  44944. args: ["aRunningTestContext"],
  44945. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  44946. referencedClasses: [],
  44947. messageSends: []
  44948. }),
  44949. $globals.TestCase);
  44950. $core.addMethod(
  44951. $core.method({
  44952. selector: "deny:",
  44953. protocol: 'testing',
  44954. fn: function (aBoolean){
  44955. var self=this;
  44956. return $core.withContext(function($ctx1) {
  44957. self._assert_($recv(aBoolean)._not());
  44958. return self;
  44959. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  44960. },
  44961. args: ["aBoolean"],
  44962. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  44963. referencedClasses: [],
  44964. messageSends: ["assert:", "not"]
  44965. }),
  44966. $globals.TestCase);
  44967. $core.addMethod(
  44968. $core.method({
  44969. selector: "errorIfNotAsync:",
  44970. protocol: 'error handling',
  44971. fn: function (aString){
  44972. var self=this;
  44973. return $core.withContext(function($ctx1) {
  44974. var $1;
  44975. $1=self._isAsync();
  44976. if(!$core.assert($1)){
  44977. self._error_($recv(aString).__comma(" used without prior #timeout:"));
  44978. };
  44979. return self;
  44980. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  44981. },
  44982. args: ["aString"],
  44983. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  44984. referencedClasses: [],
  44985. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  44986. }),
  44987. $globals.TestCase);
  44988. $core.addMethod(
  44989. $core.method({
  44990. selector: "finished",
  44991. protocol: 'async',
  44992. fn: function (){
  44993. var self=this;
  44994. return $core.withContext(function($ctx1) {
  44995. self._errorIfNotAsync_("#finished");
  44996. self["@asyncTimeout"]=nil;
  44997. return self;
  44998. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  44999. },
  45000. args: [],
  45001. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  45002. referencedClasses: [],
  45003. messageSends: ["errorIfNotAsync:"]
  45004. }),
  45005. $globals.TestCase);
  45006. $core.addMethod(
  45007. $core.method({
  45008. selector: "isAsync",
  45009. protocol: 'testing',
  45010. fn: function (){
  45011. var self=this;
  45012. return $core.withContext(function($ctx1) {
  45013. var $1;
  45014. $1=$recv(self["@asyncTimeout"])._notNil();
  45015. return $1;
  45016. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  45017. },
  45018. args: [],
  45019. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  45020. referencedClasses: [],
  45021. messageSends: ["notNil"]
  45022. }),
  45023. $globals.TestCase);
  45024. $core.addMethod(
  45025. $core.method({
  45026. selector: "performTest",
  45027. protocol: 'running',
  45028. fn: function (){
  45029. var self=this;
  45030. return $core.withContext(function($ctx1) {
  45031. self["@asyncTimeout"]=nil;
  45032. self._perform_(self._selector());
  45033. return self;
  45034. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  45035. },
  45036. args: [],
  45037. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  45038. referencedClasses: [],
  45039. messageSends: ["perform:", "selector"]
  45040. }),
  45041. $globals.TestCase);
  45042. $core.addMethod(
  45043. $core.method({
  45044. selector: "runCase",
  45045. protocol: 'running',
  45046. fn: function (){
  45047. var self=this;
  45048. function $TestContext(){return $globals.TestContext||(typeof TestContext=="undefined"?nil:TestContext)}
  45049. return $core.withContext(function($ctx1) {
  45050. $recv($recv($TestContext())._testCase_(self))._start();
  45051. return self;
  45052. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  45053. },
  45054. args: [],
  45055. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  45056. referencedClasses: ["TestContext"],
  45057. messageSends: ["start", "testCase:"]
  45058. }),
  45059. $globals.TestCase);
  45060. $core.addMethod(
  45061. $core.method({
  45062. selector: "selector",
  45063. protocol: 'accessing',
  45064. fn: function (){
  45065. var self=this;
  45066. var $1;
  45067. $1=self["@testSelector"];
  45068. return $1;
  45069. },
  45070. args: [],
  45071. source: "selector\x0a\x09^ testSelector",
  45072. referencedClasses: [],
  45073. messageSends: []
  45074. }),
  45075. $globals.TestCase);
  45076. $core.addMethod(
  45077. $core.method({
  45078. selector: "setTestSelector:",
  45079. protocol: 'accessing',
  45080. fn: function (aSelector){
  45081. var self=this;
  45082. self["@testSelector"]=aSelector;
  45083. return self;
  45084. },
  45085. args: ["aSelector"],
  45086. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  45087. referencedClasses: [],
  45088. messageSends: []
  45089. }),
  45090. $globals.TestCase);
  45091. $core.addMethod(
  45092. $core.method({
  45093. selector: "setUp",
  45094. protocol: 'running',
  45095. fn: function (){
  45096. var self=this;
  45097. return self;
  45098. },
  45099. args: [],
  45100. source: "setUp",
  45101. referencedClasses: [],
  45102. messageSends: []
  45103. }),
  45104. $globals.TestCase);
  45105. $core.addMethod(
  45106. $core.method({
  45107. selector: "should:",
  45108. protocol: 'testing',
  45109. fn: function (aBlock){
  45110. var self=this;
  45111. return $core.withContext(function($ctx1) {
  45112. self._assert_($recv(aBlock)._value());
  45113. return self;
  45114. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  45115. },
  45116. args: ["aBlock"],
  45117. source: "should: aBlock\x0a\x09self assert: aBlock value",
  45118. referencedClasses: [],
  45119. messageSends: ["assert:", "value"]
  45120. }),
  45121. $globals.TestCase);
  45122. $core.addMethod(
  45123. $core.method({
  45124. selector: "should:raise:",
  45125. protocol: 'testing',
  45126. fn: function (aBlock,anExceptionClass){
  45127. var self=this;
  45128. return $core.withContext(function($ctx1) {
  45129. self._assert_($recv((function(){
  45130. return $core.withContext(function($ctx2) {
  45131. $recv(aBlock)._value();
  45132. return false;
  45133. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45134. }))._on_do_(anExceptionClass,(function(ex){
  45135. return true;
  45136. })));
  45137. return self;
  45138. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  45139. },
  45140. args: ["aBlock", "anExceptionClass"],
  45141. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  45142. referencedClasses: [],
  45143. messageSends: ["assert:", "on:do:", "value"]
  45144. }),
  45145. $globals.TestCase);
  45146. $core.addMethod(
  45147. $core.method({
  45148. selector: "shouldnt:raise:",
  45149. protocol: 'testing',
  45150. fn: function (aBlock,anExceptionClass){
  45151. var self=this;
  45152. return $core.withContext(function($ctx1) {
  45153. self._assert_($recv((function(){
  45154. return $core.withContext(function($ctx2) {
  45155. $recv(aBlock)._value();
  45156. return true;
  45157. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45158. }))._on_do_(anExceptionClass,(function(ex){
  45159. return false;
  45160. })));
  45161. return self;
  45162. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  45163. },
  45164. args: ["aBlock", "anExceptionClass"],
  45165. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  45166. referencedClasses: [],
  45167. messageSends: ["assert:", "on:do:", "value"]
  45168. }),
  45169. $globals.TestCase);
  45170. $core.addMethod(
  45171. $core.method({
  45172. selector: "signalFailure:",
  45173. protocol: 'private',
  45174. fn: function (aString){
  45175. var self=this;
  45176. function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  45177. return $core.withContext(function($ctx1) {
  45178. var $1,$2;
  45179. $1=$recv($TestFailure())._new();
  45180. $recv($1)._messageText_(aString);
  45181. $2=$recv($1)._signal();
  45182. return self;
  45183. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  45184. },
  45185. args: ["aString"],
  45186. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  45187. referencedClasses: ["TestFailure"],
  45188. messageSends: ["messageText:", "new", "signal"]
  45189. }),
  45190. $globals.TestCase);
  45191. $core.addMethod(
  45192. $core.method({
  45193. selector: "tearDown",
  45194. protocol: 'running',
  45195. fn: function (){
  45196. var self=this;
  45197. return self;
  45198. },
  45199. args: [],
  45200. source: "tearDown",
  45201. referencedClasses: [],
  45202. messageSends: []
  45203. }),
  45204. $globals.TestCase);
  45205. $core.addMethod(
  45206. $core.method({
  45207. selector: "timeout:",
  45208. protocol: 'async',
  45209. fn: function (aNumber){
  45210. var self=this;
  45211. return $core.withContext(function($ctx1) {
  45212. var $1,$receiver;
  45213. $1=self["@asyncTimeout"];
  45214. if(($receiver = $1) == null || $receiver.isNil){
  45215. $1;
  45216. } else {
  45217. $recv(self["@asyncTimeout"])._clearTimeout();
  45218. };
  45219. self["@asyncTimeout"]=(0);
  45220. self["@asyncTimeout"]=$recv(self._async_((function(){
  45221. return $core.withContext(function($ctx2) {
  45222. return self._assert_description_(false,"SUnit grace time exhausted");
  45223. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45224. })))._valueWithTimeout_(aNumber);
  45225. return self;
  45226. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  45227. },
  45228. args: ["aNumber"],
  45229. 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",
  45230. referencedClasses: [],
  45231. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  45232. }),
  45233. $globals.TestCase);
  45234. $core.addMethod(
  45235. $core.method({
  45236. selector: "allTestSelectors",
  45237. protocol: 'accessing',
  45238. fn: function (){
  45239. var self=this;
  45240. var selectors;
  45241. return $core.withContext(function($ctx1) {
  45242. var $1,$2;
  45243. selectors=self._testSelectors();
  45244. $1=self._shouldInheritSelectors();
  45245. if($core.assert($1)){
  45246. $recv(selectors)._addAll_($recv(self._superclass())._allTestSelectors());
  45247. };
  45248. $2=selectors;
  45249. return $2;
  45250. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.klass)});
  45251. },
  45252. args: [],
  45253. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  45254. referencedClasses: [],
  45255. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  45256. }),
  45257. $globals.TestCase.klass);
  45258. $core.addMethod(
  45259. $core.method({
  45260. selector: "buildSuite",
  45261. protocol: 'accessing',
  45262. fn: function (){
  45263. var self=this;
  45264. return $core.withContext(function($ctx1) {
  45265. var $1;
  45266. $1=$recv(self._allTestSelectors())._collect_((function(each){
  45267. return $core.withContext(function($ctx2) {
  45268. return self._selector_(each);
  45269. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45270. }));
  45271. return $1;
  45272. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.klass)});
  45273. },
  45274. args: [],
  45275. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  45276. referencedClasses: [],
  45277. messageSends: ["collect:", "allTestSelectors", "selector:"]
  45278. }),
  45279. $globals.TestCase.klass);
  45280. $core.addMethod(
  45281. $core.method({
  45282. selector: "classTag",
  45283. protocol: 'accessing',
  45284. fn: function (){
  45285. var self=this;
  45286. return "test";
  45287. },
  45288. args: [],
  45289. 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'",
  45290. referencedClasses: [],
  45291. messageSends: []
  45292. }),
  45293. $globals.TestCase.klass);
  45294. $core.addMethod(
  45295. $core.method({
  45296. selector: "isAbstract",
  45297. protocol: 'testing',
  45298. fn: function (){
  45299. var self=this;
  45300. return $core.withContext(function($ctx1) {
  45301. var $1;
  45302. $1=$recv(self._name()).__eq("TestCase");
  45303. return $1;
  45304. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.klass)});
  45305. },
  45306. args: [],
  45307. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  45308. referencedClasses: [],
  45309. messageSends: ["=", "name"]
  45310. }),
  45311. $globals.TestCase.klass);
  45312. $core.addMethod(
  45313. $core.method({
  45314. selector: "lookupHierarchyRoot",
  45315. protocol: 'accessing',
  45316. fn: function (){
  45317. var self=this;
  45318. function $TestCase(){return $globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)}
  45319. return $TestCase();
  45320. },
  45321. args: [],
  45322. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  45323. referencedClasses: ["TestCase"],
  45324. messageSends: []
  45325. }),
  45326. $globals.TestCase.klass);
  45327. $core.addMethod(
  45328. $core.method({
  45329. selector: "selector:",
  45330. protocol: 'accessing',
  45331. fn: function (aSelector){
  45332. var self=this;
  45333. return $core.withContext(function($ctx1) {
  45334. var $2,$3,$1;
  45335. $2=self._new();
  45336. $recv($2)._setTestSelector_(aSelector);
  45337. $3=$recv($2)._yourself();
  45338. $1=$3;
  45339. return $1;
  45340. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.klass)});
  45341. },
  45342. args: ["aSelector"],
  45343. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  45344. referencedClasses: [],
  45345. messageSends: ["setTestSelector:", "new", "yourself"]
  45346. }),
  45347. $globals.TestCase.klass);
  45348. $core.addMethod(
  45349. $core.method({
  45350. selector: "shouldInheritSelectors",
  45351. protocol: 'testing',
  45352. fn: function (){
  45353. var self=this;
  45354. return $core.withContext(function($ctx1) {
  45355. var $1;
  45356. $1=self.__tild_eq(self._lookupHierarchyRoot());
  45357. return $1;
  45358. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.klass)});
  45359. },
  45360. args: [],
  45361. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  45362. referencedClasses: [],
  45363. messageSends: ["~=", "lookupHierarchyRoot"]
  45364. }),
  45365. $globals.TestCase.klass);
  45366. $core.addMethod(
  45367. $core.method({
  45368. selector: "testSelectors",
  45369. protocol: 'accessing',
  45370. fn: function (){
  45371. var self=this;
  45372. return $core.withContext(function($ctx1) {
  45373. var $1;
  45374. $1=$recv($recv(self._methodDictionary())._keys())._select_((function(each){
  45375. return $core.withContext(function($ctx2) {
  45376. return $recv(each)._match_("^test");
  45377. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45378. }));
  45379. return $1;
  45380. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.klass)});
  45381. },
  45382. args: [],
  45383. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  45384. referencedClasses: [],
  45385. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  45386. }),
  45387. $globals.TestCase.klass);
  45388. $core.addClass('TestContext', $globals.Object, ['testCase'], 'SUnit');
  45389. $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).";
  45390. $core.addMethod(
  45391. $core.method({
  45392. selector: "execute:",
  45393. protocol: 'running',
  45394. fn: function (aBlock){
  45395. var self=this;
  45396. var failed;
  45397. return $core.withContext(function($ctx1) {
  45398. var $1,$2;
  45399. $recv(self["@testCase"])._context_(self);
  45400. $ctx1.sendIdx["context:"]=1;
  45401. $recv((function(){
  45402. return $core.withContext(function($ctx2) {
  45403. failed=true;
  45404. failed;
  45405. $recv(aBlock)._value();
  45406. failed=false;
  45407. return failed;
  45408. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45409. }))._ensure_((function(){
  45410. return $core.withContext(function($ctx2) {
  45411. $recv(self["@testCase"])._context_(nil);
  45412. $1=$recv(failed)._and_((function(){
  45413. return $core.withContext(function($ctx3) {
  45414. return $recv(self["@testCase"])._isAsync();
  45415. $ctx3.sendIdx["isAsync"]=1;
  45416. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  45417. }));
  45418. if($core.assert($1)){
  45419. $recv(self["@testCase"])._finished();
  45420. };
  45421. $2=$recv(self["@testCase"])._isAsync();
  45422. if(!$core.assert($2)){
  45423. return $recv(self["@testCase"])._tearDown();
  45424. };
  45425. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45426. }));
  45427. return self;
  45428. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  45429. },
  45430. args: ["aBlock"],
  45431. 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 ] ]",
  45432. referencedClasses: [],
  45433. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  45434. }),
  45435. $globals.TestContext);
  45436. $core.addMethod(
  45437. $core.method({
  45438. selector: "start",
  45439. protocol: 'running',
  45440. fn: function (){
  45441. var self=this;
  45442. return $core.withContext(function($ctx1) {
  45443. self._execute_((function(){
  45444. return $core.withContext(function($ctx2) {
  45445. $recv(self["@testCase"])._setUp();
  45446. return $recv(self["@testCase"])._performTest();
  45447. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45448. }));
  45449. return self;
  45450. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  45451. },
  45452. args: [],
  45453. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  45454. referencedClasses: [],
  45455. messageSends: ["execute:", "setUp", "performTest"]
  45456. }),
  45457. $globals.TestContext);
  45458. $core.addMethod(
  45459. $core.method({
  45460. selector: "testCase:",
  45461. protocol: 'accessing',
  45462. fn: function (aTestCase){
  45463. var self=this;
  45464. self["@testCase"]=aTestCase;
  45465. return self;
  45466. },
  45467. args: ["aTestCase"],
  45468. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  45469. referencedClasses: [],
  45470. messageSends: []
  45471. }),
  45472. $globals.TestContext);
  45473. $core.addMethod(
  45474. $core.method({
  45475. selector: "testCase:",
  45476. protocol: 'instance creation',
  45477. fn: function (aTestCase){
  45478. var self=this;
  45479. return $core.withContext(function($ctx1) {
  45480. var $2,$3,$1;
  45481. $2=self._new();
  45482. $recv($2)._testCase_(aTestCase);
  45483. $3=$recv($2)._yourself();
  45484. $1=$3;
  45485. return $1;
  45486. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.klass)});
  45487. },
  45488. args: ["aTestCase"],
  45489. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  45490. referencedClasses: [],
  45491. messageSends: ["testCase:", "new", "yourself"]
  45492. }),
  45493. $globals.TestContext.klass);
  45494. $core.addClass('ReportingTestContext', $globals.TestContext, ['finished', 'result'], 'SUnit');
  45495. $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`.";
  45496. $core.addMethod(
  45497. $core.method({
  45498. selector: "execute:",
  45499. protocol: 'running',
  45500. fn: function (aBlock){
  45501. var self=this;
  45502. return $core.withContext(function($ctx1) {
  45503. var $1;
  45504. $recv((function(){
  45505. return $core.withContext(function($ctx2) {
  45506. return self._withErrorReporting_((function(){
  45507. return $core.withContext(function($ctx3) {
  45508. return (
  45509. $ctx3.supercall = true,
  45510. $globals.ReportingTestContext.superclass.fn.prototype._execute_.apply($recv(self), [aBlock]));
  45511. $ctx3.supercall = false;
  45512. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  45513. }));
  45514. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45515. }))._ensure_((function(){
  45516. return $core.withContext(function($ctx2) {
  45517. $1=$recv(self["@testCase"])._isAsync();
  45518. if(!$core.assert($1)){
  45519. $recv(self["@result"])._increaseRuns();
  45520. return $recv(self["@finished"])._value();
  45521. };
  45522. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  45523. }));
  45524. return self;
  45525. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  45526. },
  45527. args: ["aBlock"],
  45528. 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 ] ]",
  45529. referencedClasses: [],
  45530. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  45531. }),
  45532. $globals.ReportingTestContext);
  45533. $core.addMethod(
  45534. $core.method({
  45535. selector: "finished:",
  45536. protocol: 'accessing',
  45537. fn: function (aBlock){
  45538. var self=this;
  45539. self["@finished"]=aBlock;
  45540. return self;
  45541. },
  45542. args: ["aBlock"],
  45543. source: "finished: aBlock\x0a\x09finished := aBlock",
  45544. referencedClasses: [],
  45545. messageSends: []
  45546. }),
  45547. $globals.ReportingTestContext);
  45548. $core.addMethod(
  45549. $core.method({
  45550. selector: "result:",
  45551. protocol: 'accessing',
  45552. fn: function (aTestResult){
  45553. var self=this;
  45554. self["@result"]=aTestResult;
  45555. return self;
  45556. },
  45557. args: ["aTestResult"],
  45558. source: "result: aTestResult\x0a\x09result := aTestResult",
  45559. referencedClasses: [],
  45560. messageSends: []
  45561. }),
  45562. $globals.ReportingTestContext);
  45563. $core.addMethod(
  45564. $core.method({
  45565. selector: "withErrorReporting:",
  45566. protocol: 'private',
  45567. fn: function (aBlock){
  45568. var self=this;
  45569. function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  45570. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  45571. return $core.withContext(function($ctx1) {
  45572. $recv((function(){
  45573. return $core.withContext(function($ctx2) {
  45574. return $recv(aBlock)._on_do_($TestFailure(),(function(ex){
  45575. return $core.withContext(function($ctx3) {
  45576. return $recv(self["@result"])._addFailure_(self["@testCase"]);
  45577. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  45578. }));
  45579. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45580. }))._on_do_($Error(),(function(ex){
  45581. return $core.withContext(function($ctx2) {
  45582. return $recv(self["@result"])._addError_(self["@testCase"]);
  45583. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  45584. }));
  45585. $ctx1.sendIdx["on:do:"]=1;
  45586. return self;
  45587. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  45588. },
  45589. args: ["aBlock"],
  45590. 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 ]",
  45591. referencedClasses: ["TestFailure", "Error"],
  45592. messageSends: ["on:do:", "addFailure:", "addError:"]
  45593. }),
  45594. $globals.ReportingTestContext);
  45595. $core.addMethod(
  45596. $core.method({
  45597. selector: "testCase:result:finished:",
  45598. protocol: 'instance creation',
  45599. fn: function (aTestCase,aTestResult,aBlock){
  45600. var self=this;
  45601. return $core.withContext(function($ctx1) {
  45602. var $2,$3,$1;
  45603. $2=(
  45604. $ctx1.supercall = true,
  45605. $globals.ReportingTestContext.klass.superclass.fn.prototype._testCase_.apply($recv(self), [aTestCase]));
  45606. $ctx1.supercall = false;
  45607. $recv($2)._result_(aTestResult);
  45608. $recv($2)._finished_(aBlock);
  45609. $3=$recv($2)._yourself();
  45610. $1=$3;
  45611. return $1;
  45612. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.klass)});
  45613. },
  45614. args: ["aTestCase", "aTestResult", "aBlock"],
  45615. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  45616. referencedClasses: [],
  45617. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  45618. }),
  45619. $globals.ReportingTestContext.klass);
  45620. $core.addClass('TestFailure', $globals.Error, [], 'SUnit');
  45621. $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.";
  45622. $core.addClass('TestResult', $globals.Object, ['timestamp', 'runs', 'errors', 'failures', 'total'], 'SUnit');
  45623. $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";
  45624. $core.addMethod(
  45625. $core.method({
  45626. selector: "addError:",
  45627. protocol: 'accessing',
  45628. fn: function (anError){
  45629. var self=this;
  45630. return $core.withContext(function($ctx1) {
  45631. $recv(self._errors())._add_(anError);
  45632. return self;
  45633. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  45634. },
  45635. args: ["anError"],
  45636. source: "addError: anError\x0a\x09self errors add: anError",
  45637. referencedClasses: [],
  45638. messageSends: ["add:", "errors"]
  45639. }),
  45640. $globals.TestResult);
  45641. $core.addMethod(
  45642. $core.method({
  45643. selector: "addFailure:",
  45644. protocol: 'accessing',
  45645. fn: function (aFailure){
  45646. var self=this;
  45647. return $core.withContext(function($ctx1) {
  45648. $recv(self._failures())._add_(aFailure);
  45649. return self;
  45650. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  45651. },
  45652. args: ["aFailure"],
  45653. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  45654. referencedClasses: [],
  45655. messageSends: ["add:", "failures"]
  45656. }),
  45657. $globals.TestResult);
  45658. $core.addMethod(
  45659. $core.method({
  45660. selector: "errors",
  45661. protocol: 'accessing',
  45662. fn: function (){
  45663. var self=this;
  45664. var $1;
  45665. $1=self["@errors"];
  45666. return $1;
  45667. },
  45668. args: [],
  45669. source: "errors\x0a\x09^ errors",
  45670. referencedClasses: [],
  45671. messageSends: []
  45672. }),
  45673. $globals.TestResult);
  45674. $core.addMethod(
  45675. $core.method({
  45676. selector: "failures",
  45677. protocol: 'accessing',
  45678. fn: function (){
  45679. var self=this;
  45680. var $1;
  45681. $1=self["@failures"];
  45682. return $1;
  45683. },
  45684. args: [],
  45685. source: "failures\x0a\x09^ failures",
  45686. referencedClasses: [],
  45687. messageSends: []
  45688. }),
  45689. $globals.TestResult);
  45690. $core.addMethod(
  45691. $core.method({
  45692. selector: "increaseRuns",
  45693. protocol: 'accessing',
  45694. fn: function (){
  45695. var self=this;
  45696. return $core.withContext(function($ctx1) {
  45697. self["@runs"]=$recv(self["@runs"]).__plus((1));
  45698. return self;
  45699. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  45700. },
  45701. args: [],
  45702. source: "increaseRuns\x0a\x09runs := runs + 1",
  45703. referencedClasses: [],
  45704. messageSends: ["+"]
  45705. }),
  45706. $globals.TestResult);
  45707. $core.addMethod(
  45708. $core.method({
  45709. selector: "initialize",
  45710. protocol: 'initialization',
  45711. fn: function (){
  45712. var self=this;
  45713. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  45714. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  45715. return $core.withContext(function($ctx1) {
  45716. (
  45717. $ctx1.supercall = true,
  45718. $globals.TestResult.superclass.fn.prototype._initialize.apply($recv(self), []));
  45719. $ctx1.supercall = false;
  45720. self["@timestamp"]=$recv($Date())._now();
  45721. self["@runs"]=(0);
  45722. self["@errors"]=$recv($Array())._new();
  45723. $ctx1.sendIdx["new"]=1;
  45724. self["@failures"]=$recv($Array())._new();
  45725. self["@total"]=(0);
  45726. return self;
  45727. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  45728. },
  45729. args: [],
  45730. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  45731. referencedClasses: ["Date", "Array"],
  45732. messageSends: ["initialize", "now", "new"]
  45733. }),
  45734. $globals.TestResult);
  45735. $core.addMethod(
  45736. $core.method({
  45737. selector: "nextRunDo:",
  45738. protocol: 'running',
  45739. fn: function (aBlock){
  45740. var self=this;
  45741. return $core.withContext(function($ctx1) {
  45742. var $3,$2,$1;
  45743. $3=self._runs();
  45744. $ctx1.sendIdx["runs"]=1;
  45745. $2=$recv($3).__eq_eq(self._total());
  45746. if(!$core.assert($2)){
  45747. $1=$recv(aBlock)._value_($recv(self._runs()).__plus((1)));
  45748. };
  45749. return $1;
  45750. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  45751. },
  45752. args: ["aBlock"],
  45753. 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 ]",
  45754. referencedClasses: [],
  45755. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  45756. }),
  45757. $globals.TestResult);
  45758. $core.addMethod(
  45759. $core.method({
  45760. selector: "runCase:",
  45761. protocol: 'running',
  45762. fn: function (aTestCase){
  45763. var self=this;
  45764. function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  45765. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  45766. return $core.withContext(function($ctx1) {
  45767. $recv((function(){
  45768. return $core.withContext(function($ctx2) {
  45769. return $recv((function(){
  45770. return $core.withContext(function($ctx3) {
  45771. self._increaseRuns();
  45772. return $recv(aTestCase)._runCase();
  45773. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  45774. }))._on_do_($TestFailure(),(function(ex){
  45775. return $core.withContext(function($ctx3) {
  45776. return self._addFailure_(aTestCase);
  45777. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  45778. }));
  45779. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45780. }))._on_do_($Error(),(function(ex){
  45781. return $core.withContext(function($ctx2) {
  45782. return self._addError_(aTestCase);
  45783. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  45784. }));
  45785. $ctx1.sendIdx["on:do:"]=1;
  45786. return self;
  45787. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  45788. },
  45789. args: ["aTestCase"],
  45790. 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 ]",
  45791. referencedClasses: ["TestFailure", "Error"],
  45792. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  45793. }),
  45794. $globals.TestResult);
  45795. $core.addMethod(
  45796. $core.method({
  45797. selector: "runs",
  45798. protocol: 'accessing',
  45799. fn: function (){
  45800. var self=this;
  45801. var $1;
  45802. $1=self["@runs"];
  45803. return $1;
  45804. },
  45805. args: [],
  45806. source: "runs\x0a\x09^ runs",
  45807. referencedClasses: [],
  45808. messageSends: []
  45809. }),
  45810. $globals.TestResult);
  45811. $core.addMethod(
  45812. $core.method({
  45813. selector: "status",
  45814. protocol: 'accessing',
  45815. fn: function (){
  45816. var self=this;
  45817. return $core.withContext(function($ctx1) {
  45818. var $2,$3,$1;
  45819. $2=$recv(self._errors())._isEmpty();
  45820. $ctx1.sendIdx["isEmpty"]=1;
  45821. if($core.assert($2)){
  45822. $3=$recv(self._failures())._isEmpty();
  45823. if($core.assert($3)){
  45824. $1="success";
  45825. } else {
  45826. $1="failure";
  45827. };
  45828. } else {
  45829. $1="error";
  45830. };
  45831. return $1;
  45832. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  45833. },
  45834. args: [],
  45835. 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' ]",
  45836. referencedClasses: [],
  45837. messageSends: ["ifTrue:ifFalse:", "isEmpty", "errors", "failures"]
  45838. }),
  45839. $globals.TestResult);
  45840. $core.addMethod(
  45841. $core.method({
  45842. selector: "timestamp",
  45843. protocol: 'accessing',
  45844. fn: function (){
  45845. var self=this;
  45846. var $1;
  45847. $1=self["@timestamp"];
  45848. return $1;
  45849. },
  45850. args: [],
  45851. source: "timestamp\x0a\x09^ timestamp",
  45852. referencedClasses: [],
  45853. messageSends: []
  45854. }),
  45855. $globals.TestResult);
  45856. $core.addMethod(
  45857. $core.method({
  45858. selector: "total",
  45859. protocol: 'accessing',
  45860. fn: function (){
  45861. var self=this;
  45862. var $1;
  45863. $1=self["@total"];
  45864. return $1;
  45865. },
  45866. args: [],
  45867. source: "total\x0a\x09^ total",
  45868. referencedClasses: [],
  45869. messageSends: []
  45870. }),
  45871. $globals.TestResult);
  45872. $core.addMethod(
  45873. $core.method({
  45874. selector: "total:",
  45875. protocol: 'accessing',
  45876. fn: function (aNumber){
  45877. var self=this;
  45878. self["@total"]=aNumber;
  45879. return self;
  45880. },
  45881. args: ["aNumber"],
  45882. source: "total: aNumber\x0a\x09total := aNumber",
  45883. referencedClasses: [],
  45884. messageSends: []
  45885. }),
  45886. $globals.TestResult);
  45887. $core.addClass('TestSuiteRunner', $globals.Object, ['suite', 'result', 'announcer', 'runNextTest'], 'SUnit');
  45888. $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`.";
  45889. $core.addMethod(
  45890. $core.method({
  45891. selector: "announcer",
  45892. protocol: 'accessing',
  45893. fn: function (){
  45894. var self=this;
  45895. var $1;
  45896. $1=self["@announcer"];
  45897. return $1;
  45898. },
  45899. args: [],
  45900. source: "announcer\x0a\x09^ announcer",
  45901. referencedClasses: [],
  45902. messageSends: []
  45903. }),
  45904. $globals.TestSuiteRunner);
  45905. $core.addMethod(
  45906. $core.method({
  45907. selector: "contextOf:",
  45908. protocol: 'private',
  45909. fn: function (anInteger){
  45910. var self=this;
  45911. function $ReportingTestContext(){return $globals.ReportingTestContext||(typeof ReportingTestContext=="undefined"?nil:ReportingTestContext)}
  45912. return $core.withContext(function($ctx1) {
  45913. var $1;
  45914. $1=$recv($ReportingTestContext())._testCase_result_finished_($recv(self["@suite"])._at_(anInteger),self["@result"],(function(){
  45915. return $core.withContext(function($ctx2) {
  45916. return self._resume();
  45917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45918. }));
  45919. return $1;
  45920. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  45921. },
  45922. args: ["anInteger"],
  45923. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  45924. referencedClasses: ["ReportingTestContext"],
  45925. messageSends: ["testCase:result:finished:", "at:", "resume"]
  45926. }),
  45927. $globals.TestSuiteRunner);
  45928. $core.addMethod(
  45929. $core.method({
  45930. selector: "initialize",
  45931. protocol: 'initialization',
  45932. fn: function (){
  45933. var self=this;
  45934. function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  45935. function $TestResult(){return $globals.TestResult||(typeof TestResult=="undefined"?nil:TestResult)}
  45936. return $core.withContext(function($ctx1) {
  45937. var $1;
  45938. (
  45939. $ctx1.supercall = true,
  45940. $globals.TestSuiteRunner.superclass.fn.prototype._initialize.apply($recv(self), []));
  45941. $ctx1.supercall = false;
  45942. self["@announcer"]=$recv($Announcer())._new();
  45943. $ctx1.sendIdx["new"]=1;
  45944. self["@result"]=$recv($TestResult())._new();
  45945. self["@runNextTest"]=(function(){
  45946. var runs;
  45947. return $core.withContext(function($ctx2) {
  45948. runs=$recv(self["@result"])._runs();
  45949. runs;
  45950. $1=$recv(runs).__lt($recv(self["@result"])._total());
  45951. if($core.assert($1)){
  45952. return $recv(self._contextOf_($recv(runs).__plus((1))))._start();
  45953. };
  45954. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  45955. });
  45956. return self;
  45957. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  45958. },
  45959. args: [],
  45960. 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 ] ].",
  45961. referencedClasses: ["Announcer", "TestResult"],
  45962. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  45963. }),
  45964. $globals.TestSuiteRunner);
  45965. $core.addMethod(
  45966. $core.method({
  45967. selector: "result",
  45968. protocol: 'accessing',
  45969. fn: function (){
  45970. var self=this;
  45971. var $1;
  45972. $1=self["@result"];
  45973. return $1;
  45974. },
  45975. args: [],
  45976. source: "result\x0a\x09^ result",
  45977. referencedClasses: [],
  45978. messageSends: []
  45979. }),
  45980. $globals.TestSuiteRunner);
  45981. $core.addMethod(
  45982. $core.method({
  45983. selector: "resume",
  45984. protocol: 'actions',
  45985. fn: function (){
  45986. var self=this;
  45987. function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  45988. return $core.withContext(function($ctx1) {
  45989. $recv(self["@runNextTest"])._fork();
  45990. $recv(self["@announcer"])._announce_($recv($recv($ResultAnnouncement())._new())._result_(self["@result"]));
  45991. return self;
  45992. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  45993. },
  45994. args: [],
  45995. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  45996. referencedClasses: ["ResultAnnouncement"],
  45997. messageSends: ["fork", "announce:", "result:", "new"]
  45998. }),
  45999. $globals.TestSuiteRunner);
  46000. $core.addMethod(
  46001. $core.method({
  46002. selector: "run",
  46003. protocol: 'actions',
  46004. fn: function (){
  46005. var self=this;
  46006. return $core.withContext(function($ctx1) {
  46007. $recv(self["@result"])._total_($recv(self["@suite"])._size());
  46008. self._resume();
  46009. return self;
  46010. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  46011. },
  46012. args: [],
  46013. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  46014. referencedClasses: [],
  46015. messageSends: ["total:", "size", "resume"]
  46016. }),
  46017. $globals.TestSuiteRunner);
  46018. $core.addMethod(
  46019. $core.method({
  46020. selector: "suite:",
  46021. protocol: 'accessing',
  46022. fn: function (aCollection){
  46023. var self=this;
  46024. self["@suite"]=aCollection;
  46025. return self;
  46026. },
  46027. args: ["aCollection"],
  46028. source: "suite: aCollection\x0a\x09suite := aCollection",
  46029. referencedClasses: [],
  46030. messageSends: []
  46031. }),
  46032. $globals.TestSuiteRunner);
  46033. $core.addMethod(
  46034. $core.method({
  46035. selector: "new",
  46036. protocol: 'instance creation',
  46037. fn: function (){
  46038. var self=this;
  46039. return $core.withContext(function($ctx1) {
  46040. self._shouldNotImplement();
  46041. return self;
  46042. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.klass)});
  46043. },
  46044. args: [],
  46045. source: "new\x0a\x09self shouldNotImplement",
  46046. referencedClasses: [],
  46047. messageSends: ["shouldNotImplement"]
  46048. }),
  46049. $globals.TestSuiteRunner.klass);
  46050. $core.addMethod(
  46051. $core.method({
  46052. selector: "on:",
  46053. protocol: 'instance creation',
  46054. fn: function (aCollection){
  46055. var self=this;
  46056. return $core.withContext(function($ctx1) {
  46057. var $2,$1;
  46058. $2=(
  46059. $ctx1.supercall = true,
  46060. $globals.TestSuiteRunner.klass.superclass.fn.prototype._new.apply($recv(self), []));
  46061. $ctx1.supercall = false;
  46062. $1=$recv($2)._suite_(aCollection);
  46063. return $1;
  46064. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.klass)});
  46065. },
  46066. args: ["aCollection"],
  46067. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  46068. referencedClasses: [],
  46069. messageSends: ["suite:", "new"]
  46070. }),
  46071. $globals.TestSuiteRunner.klass);
  46072. $core.addMethod(
  46073. $core.method({
  46074. selector: "isTestClass",
  46075. protocol: '*SUnit',
  46076. fn: function (){
  46077. var self=this;
  46078. function $TestCase(){return $globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)}
  46079. return $core.withContext(function($ctx1) {
  46080. var $1;
  46081. $1=$recv(self._includesBehavior_($TestCase()))._and_((function(){
  46082. return $core.withContext(function($ctx2) {
  46083. return $recv(self._isAbstract())._not();
  46084. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46085. }));
  46086. return $1;
  46087. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.Behavior)});
  46088. },
  46089. args: [],
  46090. source: "isTestClass\x0a\x09^(self includesBehavior: TestCase) and: [ \x0a\x09\x09\x09self isAbstract not ]",
  46091. referencedClasses: ["TestCase"],
  46092. messageSends: ["and:", "includesBehavior:", "not", "isAbstract"]
  46093. }),
  46094. $globals.Behavior);
  46095. $core.addMethod(
  46096. $core.method({
  46097. selector: "isTestPackage",
  46098. protocol: '*SUnit',
  46099. fn: function (){
  46100. var self=this;
  46101. return $core.withContext(function($ctx1) {
  46102. var $1;
  46103. $1=$recv(self._classes())._anySatisfy_((function(each){
  46104. return $core.withContext(function($ctx2) {
  46105. return $recv(each)._isTestClass();
  46106. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46107. }));
  46108. return $1;
  46109. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  46110. },
  46111. args: [],
  46112. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  46113. referencedClasses: [],
  46114. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  46115. }),
  46116. $globals.Package);
  46117. });
  46118. define("amber_core/Compiler-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  46119. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  46120. $core.addPackage('Compiler-Tests');
  46121. $core.packages["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
  46122. $core.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  46123. $core.addClass('ASTParsingTest', $globals.TestCase, [], 'Compiler-Tests');
  46124. $core.addMethod(
  46125. $core.method({
  46126. selector: "analyze:forClass:",
  46127. protocol: 'convenience',
  46128. fn: function (aNode,aClass){
  46129. var self=this;
  46130. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  46131. return $core.withContext(function($ctx1) {
  46132. $recv($recv($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
  46133. return aNode;
  46134. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTParsingTest)});
  46135. },
  46136. args: ["aNode", "aClass"],
  46137. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  46138. referencedClasses: ["SemanticAnalyzer"],
  46139. messageSends: ["visit:", "on:"]
  46140. }),
  46141. $globals.ASTParsingTest);
  46142. $core.addMethod(
  46143. $core.method({
  46144. selector: "parse:",
  46145. protocol: 'parsing',
  46146. fn: function (aString){
  46147. var self=this;
  46148. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  46149. return $core.withContext(function($ctx1) {
  46150. var $1;
  46151. $1=$recv($Smalltalk())._parse_(aString);
  46152. return $1;
  46153. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTParsingTest)});
  46154. },
  46155. args: ["aString"],
  46156. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  46157. referencedClasses: ["Smalltalk"],
  46158. messageSends: ["parse:"]
  46159. }),
  46160. $globals.ASTParsingTest);
  46161. $core.addMethod(
  46162. $core.method({
  46163. selector: "parse:forClass:",
  46164. protocol: 'parsing',
  46165. fn: function (aString,aClass){
  46166. var self=this;
  46167. return $core.withContext(function($ctx1) {
  46168. var $1;
  46169. $1=self._analyze_forClass_(self._parse_(aString),aClass);
  46170. return $1;
  46171. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  46172. },
  46173. args: ["aString", "aClass"],
  46174. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  46175. referencedClasses: [],
  46176. messageSends: ["analyze:forClass:", "parse:"]
  46177. }),
  46178. $globals.ASTParsingTest);
  46179. $core.addClass('ASTPCNodeVisitorTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
  46180. $core.addMethod(
  46181. $core.method({
  46182. selector: "astPCNodeVisitor",
  46183. protocol: 'factory',
  46184. fn: function (){
  46185. var self=this;
  46186. function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  46187. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  46188. return $core.withContext(function($ctx1) {
  46189. var $2,$3,$4,$5,$1;
  46190. $2=$recv($ASTPCNodeVisitor())._new();
  46191. $ctx1.sendIdx["new"]=1;
  46192. $3=$2;
  46193. $4=$recv($recv($AIContext())._new())._yourself();
  46194. $ctx1.sendIdx["yourself"]=1;
  46195. $recv($3)._context_($4);
  46196. $5=$recv($2)._yourself();
  46197. $1=$5;
  46198. return $1;
  46199. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  46200. },
  46201. args: [],
  46202. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  46203. referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
  46204. messageSends: ["context:", "new", "yourself"]
  46205. }),
  46206. $globals.ASTPCNodeVisitorTest);
  46207. $core.addMethod(
  46208. $core.method({
  46209. selector: "astPCNodeVisitorForSelector:",
  46210. protocol: 'factory',
  46211. fn: function (aString){
  46212. var self=this;
  46213. function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  46214. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  46215. return $core.withContext(function($ctx1) {
  46216. var $2,$3,$4,$5,$1;
  46217. $2=$recv($ASTPCNodeVisitor())._new();
  46218. $ctx1.sendIdx["new"]=1;
  46219. $recv($2)._selector_(aString);
  46220. $3=$2;
  46221. $4=$recv($recv($AIContext())._new())._yourself();
  46222. $ctx1.sendIdx["yourself"]=1;
  46223. $recv($3)._context_($4);
  46224. $5=$recv($2)._yourself();
  46225. $1=$5;
  46226. return $1;
  46227. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  46228. },
  46229. args: ["aString"],
  46230. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  46231. referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
  46232. messageSends: ["selector:", "new", "context:", "yourself"]
  46233. }),
  46234. $globals.ASTPCNodeVisitorTest);
  46235. $core.addMethod(
  46236. $core.method({
  46237. selector: "testJSStatementNode",
  46238. protocol: 'tests',
  46239. fn: function (){
  46240. var self=this;
  46241. var ast,visitor;
  46242. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46243. return $core.withContext(function($ctx1) {
  46244. var $1,$2;
  46245. ast=self._parse_forClass_("foo <consolee.log(1)>",$Object());
  46246. $1=self._astPCNodeVisitor();
  46247. $recv($1)._visit_(ast);
  46248. $2=$recv($1)._currentNode();
  46249. self._assert_($recv($2)._isJSStatementNode());
  46250. return self;
  46251. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  46252. },
  46253. args: [],
  46254. 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",
  46255. referencedClasses: ["Object"],
  46256. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  46257. }),
  46258. $globals.ASTPCNodeVisitorTest);
  46259. $core.addMethod(
  46260. $core.method({
  46261. selector: "testMessageSend",
  46262. protocol: 'tests',
  46263. fn: function (){
  46264. var self=this;
  46265. var ast;
  46266. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46267. return $core.withContext(function($ctx1) {
  46268. var $1,$2;
  46269. ast=self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$Object());
  46270. $1=self._astPCNodeVisitorForSelector_("yourself");
  46271. $recv($1)._visit_(ast);
  46272. $2=$recv($1)._currentNode();
  46273. self._assert_equals_($recv($2)._selector(),"yourself");
  46274. return self;
  46275. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  46276. },
  46277. args: [],
  46278. 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'",
  46279. referencedClasses: ["Object"],
  46280. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  46281. }),
  46282. $globals.ASTPCNodeVisitorTest);
  46283. $core.addMethod(
  46284. $core.method({
  46285. selector: "testMessageSendWithBlocks",
  46286. protocol: 'tests',
  46287. fn: function (){
  46288. var self=this;
  46289. var ast;
  46290. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46291. return $core.withContext(function($ctx1) {
  46292. var $1,$2;
  46293. ast=self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$Object());
  46294. $1=self._astPCNodeVisitorForSelector_("yourself");
  46295. $recv($1)._visit_(ast);
  46296. $2=$recv($1)._currentNode();
  46297. self._assert_equals_($recv($2)._selector(),"yourself");
  46298. return self;
  46299. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  46300. },
  46301. args: [],
  46302. 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'",
  46303. referencedClasses: ["Object"],
  46304. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  46305. }),
  46306. $globals.ASTPCNodeVisitorTest);
  46307. $core.addMethod(
  46308. $core.method({
  46309. selector: "testMessageSendWithInlining",
  46310. protocol: 'tests',
  46311. fn: function (){
  46312. var self=this;
  46313. var ast;
  46314. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46315. return $core.withContext(function($ctx1) {
  46316. var $3,$4,$2,$1,$5,$6;
  46317. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
  46318. $ctx1.sendIdx["parse:forClass:"]=1;
  46319. $3=self._astPCNodeVisitorForSelector_("yourself");
  46320. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  46321. $recv($3)._visit_(ast);
  46322. $ctx1.sendIdx["visit:"]=1;
  46323. $4=$recv($3)._currentNode();
  46324. $ctx1.sendIdx["currentNode"]=1;
  46325. $2=$4;
  46326. $1=$recv($2)._selector();
  46327. $ctx1.sendIdx["selector"]=1;
  46328. self._assert_equals_($1,"yourself");
  46329. $ctx1.sendIdx["assert:equals:"]=1;
  46330. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
  46331. $5=self._astPCNodeVisitorForSelector_("asBoolean");
  46332. $recv($5)._visit_(ast);
  46333. $6=$recv($5)._currentNode();
  46334. self._assert_equals_($recv($6)._selector(),"asBoolean");
  46335. return self;
  46336. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  46337. },
  46338. args: [],
  46339. 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'",
  46340. referencedClasses: ["Object"],
  46341. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  46342. }),
  46343. $globals.ASTPCNodeVisitorTest);
  46344. $core.addMethod(
  46345. $core.method({
  46346. selector: "testNoMessageSend",
  46347. protocol: 'tests',
  46348. fn: function (){
  46349. var self=this;
  46350. var ast;
  46351. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46352. return $core.withContext(function($ctx1) {
  46353. var $1,$2;
  46354. ast=self._parse_forClass_("foo ^ self",$Object());
  46355. $1=self._astPCNodeVisitor();
  46356. $recv($1)._visit_(ast);
  46357. $2=$recv($1)._currentNode();
  46358. self._assert_($recv($2)._isNil());
  46359. return self;
  46360. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  46361. },
  46362. args: [],
  46363. 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",
  46364. referencedClasses: ["Object"],
  46365. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  46366. }),
  46367. $globals.ASTPCNodeVisitorTest);
  46368. $core.addMethod(
  46369. $core.method({
  46370. selector: "testPC",
  46371. protocol: 'tests',
  46372. fn: function (){
  46373. var self=this;
  46374. var ast,visitor;
  46375. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46376. return $core.withContext(function($ctx1) {
  46377. var $1,$2;
  46378. ast=self._parse_forClass_("foo <console.log(1)>",$Object());
  46379. $1=self._astPCNodeVisitor();
  46380. $recv($1)._visit_(ast);
  46381. $2=$recv($1)._currentNode();
  46382. self._assert_($recv($2)._isJSStatementNode());
  46383. return self;
  46384. }, function($ctx1) {$ctx1.fill(self,"testPC",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  46385. },
  46386. args: [],
  46387. 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",
  46388. referencedClasses: ["Object"],
  46389. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  46390. }),
  46391. $globals.ASTPCNodeVisitorTest);
  46392. $core.addClass('ASTPositionTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
  46393. $core.addMethod(
  46394. $core.method({
  46395. selector: "testNodeAtPosition",
  46396. protocol: 'tests',
  46397. fn: function (){
  46398. var self=this;
  46399. var node;
  46400. return $core.withContext(function($ctx1) {
  46401. var $3,$4,$2,$1,$7,$8,$6,$5;
  46402. node=self._parse_("yourself\x0a\x09^ self");
  46403. $ctx1.sendIdx["parse:"]=1;
  46404. $3=node;
  46405. $4=(2).__at((4));
  46406. $ctx1.sendIdx["@"]=1;
  46407. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  46408. return nil;
  46409. }));
  46410. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  46411. $1=$recv($2)._source();
  46412. self._assert_equals_($1,"self");
  46413. $ctx1.sendIdx["assert:equals:"]=1;
  46414. node=self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
  46415. $ctx1.sendIdx["parse:"]=2;
  46416. $7=node;
  46417. $8=(2).__at((7));
  46418. $ctx1.sendIdx["@"]=2;
  46419. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  46420. return nil;
  46421. }));
  46422. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  46423. $5=$recv($6)._selector();
  46424. $ctx1.sendIdx["selector"]=1;
  46425. self._assert_equals_($5,"ifTrue:");
  46426. $ctx1.sendIdx["assert:equals:"]=2;
  46427. node=self._parse_("foo\x0a\x09self foo; bar; baz");
  46428. self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  46429. return nil;
  46430. })))._selector(),"foo");
  46431. return self;
  46432. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  46433. },
  46434. args: [],
  46435. 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'",
  46436. referencedClasses: [],
  46437. messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  46438. }),
  46439. $globals.ASTPositionTest);
  46440. $core.addClass('CodeGeneratorTest', $globals.ASTParsingTest, ['receiver'], 'Compiler-Tests');
  46441. $core.addMethod(
  46442. $core.method({
  46443. selector: "codeGeneratorClass",
  46444. protocol: 'accessing',
  46445. fn: function (){
  46446. var self=this;
  46447. function $CodeGenerator(){return $globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  46448. return $CodeGenerator();
  46449. },
  46450. args: [],
  46451. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  46452. referencedClasses: ["CodeGenerator"],
  46453. messageSends: []
  46454. }),
  46455. $globals.CodeGeneratorTest);
  46456. $core.addMethod(
  46457. $core.method({
  46458. selector: "compiler",
  46459. protocol: 'factory',
  46460. fn: function (){
  46461. var self=this;
  46462. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  46463. return $core.withContext(function($ctx1) {
  46464. var $2,$3,$1;
  46465. $2=$recv($Compiler())._new();
  46466. $recv($2)._codeGeneratorClass_(self._codeGeneratorClass());
  46467. $3=$recv($2)._yourself();
  46468. $1=$3;
  46469. return $1;
  46470. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  46471. },
  46472. args: [],
  46473. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  46474. referencedClasses: ["Compiler"],
  46475. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  46476. }),
  46477. $globals.CodeGeneratorTest);
  46478. $core.addMethod(
  46479. $core.method({
  46480. selector: "setUp",
  46481. protocol: 'initialization',
  46482. fn: function (){
  46483. var self=this;
  46484. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  46485. return $core.withContext(function($ctx1) {
  46486. self["@receiver"]=$recv($DoIt())._new();
  46487. return self;
  46488. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  46489. },
  46490. args: [],
  46491. source: "setUp\x0a\x09receiver := DoIt new",
  46492. referencedClasses: ["DoIt"],
  46493. messageSends: ["new"]
  46494. }),
  46495. $globals.CodeGeneratorTest);
  46496. $core.addMethod(
  46497. $core.method({
  46498. selector: "should:receiver:return:",
  46499. protocol: 'testing',
  46500. fn: function (aString,anObject,aResult){
  46501. var self=this;
  46502. var method,result;
  46503. return $core.withContext(function($ctx1) {
  46504. var $1,$2;
  46505. self["@receiver"]=anObject;
  46506. $1=self._compiler();
  46507. $2=$recv(anObject)._class();
  46508. $ctx1.sendIdx["class"]=1;
  46509. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  46510. result=$recv(self["@receiver"])._perform_($recv(method)._selector());
  46511. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  46512. self._assert_equals_(aResult,result);
  46513. return self;
  46514. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  46515. },
  46516. args: ["aString", "anObject", "aResult"],
  46517. 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",
  46518. referencedClasses: [],
  46519. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  46520. }),
  46521. $globals.CodeGeneratorTest);
  46522. $core.addMethod(
  46523. $core.method({
  46524. selector: "should:return:",
  46525. protocol: 'testing',
  46526. fn: function (aString,anObject){
  46527. var self=this;
  46528. return $core.withContext(function($ctx1) {
  46529. var $1;
  46530. $1=self._should_receiver_return_(aString,self["@receiver"],anObject);
  46531. return $1;
  46532. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  46533. },
  46534. args: ["aString", "anObject"],
  46535. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  46536. referencedClasses: [],
  46537. messageSends: ["should:receiver:return:"]
  46538. }),
  46539. $globals.CodeGeneratorTest);
  46540. $core.addMethod(
  46541. $core.method({
  46542. selector: "tearDown",
  46543. protocol: 'initialization',
  46544. fn: function (){
  46545. var self=this;
  46546. return self;
  46547. },
  46548. args: [],
  46549. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  46550. referencedClasses: [],
  46551. messageSends: []
  46552. }),
  46553. $globals.CodeGeneratorTest);
  46554. $core.addMethod(
  46555. $core.method({
  46556. selector: "testAssignment",
  46557. protocol: 'tests',
  46558. fn: function (){
  46559. var self=this;
  46560. return $core.withContext(function($ctx1) {
  46561. self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  46562. $ctx1.sendIdx["should:return:"]=1;
  46563. self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  46564. $ctx1.sendIdx["should:return:"]=2;
  46565. self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  46566. return self;
  46567. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  46568. },
  46569. args: [],
  46570. 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",
  46571. referencedClasses: [],
  46572. messageSends: ["should:return:"]
  46573. }),
  46574. $globals.CodeGeneratorTest);
  46575. $core.addMethod(
  46576. $core.method({
  46577. selector: "testBackslashSelectors",
  46578. protocol: 'tests',
  46579. fn: function (){
  46580. var self=this;
  46581. return $core.withContext(function($ctx1) {
  46582. self._should_return_("\x5c arg ^ 4",(4));
  46583. $ctx1.sendIdx["should:return:"]=1;
  46584. self._should_return_("\x5c\x5c arg ^ 42",(42));
  46585. return self;
  46586. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  46587. },
  46588. args: [],
  46589. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  46590. referencedClasses: [],
  46591. messageSends: ["should:return:"]
  46592. }),
  46593. $globals.CodeGeneratorTest);
  46594. $core.addMethod(
  46595. $core.method({
  46596. selector: "testBlockReturn",
  46597. protocol: 'tests',
  46598. fn: function (){
  46599. var self=this;
  46600. return $core.withContext(function($ctx1) {
  46601. self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  46602. $ctx1.sendIdx["should:return:"]=1;
  46603. self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  46604. $ctx1.sendIdx["should:return:"]=2;
  46605. self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  46606. return self;
  46607. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  46608. },
  46609. args: [],
  46610. 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).",
  46611. referencedClasses: [],
  46612. messageSends: ["should:return:"]
  46613. }),
  46614. $globals.CodeGeneratorTest);
  46615. $core.addMethod(
  46616. $core.method({
  46617. selector: "testCascades",
  46618. protocol: 'tests',
  46619. fn: function (){
  46620. var self=this;
  46621. return $core.withContext(function($ctx1) {
  46622. self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  46623. return self;
  46624. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  46625. },
  46626. args: [],
  46627. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  46628. referencedClasses: [],
  46629. messageSends: ["should:return:"]
  46630. }),
  46631. $globals.CodeGeneratorTest);
  46632. $core.addMethod(
  46633. $core.method({
  46634. selector: "testCascadesWithInlining",
  46635. protocol: 'tests',
  46636. fn: function (){
  46637. var self=this;
  46638. return $core.withContext(function($ctx1) {
  46639. self._should_return_("foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  46640. $ctx1.sendIdx["should:return:"]=1;
  46641. self._should_return_("foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  46642. return self;
  46643. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  46644. },
  46645. args: [],
  46646. source: "testCascadesWithInlining\x0a\x09\x0a\x09self should: 'foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 2",
  46647. referencedClasses: [],
  46648. messageSends: ["should:return:"]
  46649. }),
  46650. $globals.CodeGeneratorTest);
  46651. $core.addMethod(
  46652. $core.method({
  46653. selector: "testDynamicArrayElementsOrdered",
  46654. protocol: 'tests',
  46655. fn: function (){
  46656. var self=this;
  46657. return $core.withContext(function($ctx1) {
  46658. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  46659. $ctx1.sendIdx["should:return:"]=1;
  46660. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  46661. return self;
  46662. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  46663. },
  46664. args: [],
  46665. 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).",
  46666. referencedClasses: [],
  46667. messageSends: ["should:return:"]
  46668. }),
  46669. $globals.CodeGeneratorTest);
  46670. $core.addMethod(
  46671. $core.method({
  46672. selector: "testDynamicDictionaryElementsOrdered",
  46673. protocol: 'tests',
  46674. fn: function (){
  46675. var self=this;
  46676. return $core.withContext(function($ctx1) {
  46677. 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)]));
  46678. return self;
  46679. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  46680. },
  46681. args: [],
  46682. 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}.",
  46683. referencedClasses: [],
  46684. messageSends: ["should:return:"]
  46685. }),
  46686. $globals.CodeGeneratorTest);
  46687. $core.addMethod(
  46688. $core.method({
  46689. selector: "testDynamicDictionaryWithMoreArrows",
  46690. protocol: 'tests',
  46691. fn: function (){
  46692. var self=this;
  46693. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  46694. return $core.withContext(function($ctx1) {
  46695. var $2,$1;
  46696. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  46697. $ctx1.sendIdx["->"]=1;
  46698. $1=$recv($HashedCollection())._with_($2);
  46699. self._should_return_("foo ^ #{1->2->3}",$1);
  46700. return self;
  46701. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  46702. },
  46703. args: [],
  46704. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  46705. referencedClasses: ["HashedCollection"],
  46706. messageSends: ["should:return:", "with:", "->"]
  46707. }),
  46708. $globals.CodeGeneratorTest);
  46709. $core.addMethod(
  46710. $core.method({
  46711. selector: "testGlobalVar",
  46712. protocol: 'tests',
  46713. fn: function (){
  46714. var self=this;
  46715. function $BlockClosure(){return $globals.BlockClosure||(typeof BlockClosure=="undefined"?nil:BlockClosure)}
  46716. return $core.withContext(function($ctx1) {
  46717. self._should_return_("foo ^ eval class",$BlockClosure());
  46718. $ctx1.sendIdx["should:return:"]=1;
  46719. self._should_return_("foo ^ Math cos: 0",(1));
  46720. $ctx1.sendIdx["should:return:"]=2;
  46721. self._should_return_("foo ^ NonExistingVar",nil);
  46722. return self;
  46723. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  46724. },
  46725. args: [],
  46726. 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",
  46727. referencedClasses: ["BlockClosure"],
  46728. messageSends: ["should:return:"]
  46729. }),
  46730. $globals.CodeGeneratorTest);
  46731. $core.addMethod(
  46732. $core.method({
  46733. selector: "testInnerTemporalDependentElementsOrdered",
  46734. protocol: 'tests',
  46735. fn: function (){
  46736. var self=this;
  46737. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  46738. return $core.withContext(function($ctx1) {
  46739. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  46740. $2="foo".__minus_gt($Array());
  46741. $ctx1.sendIdx["->"]=1;
  46742. $3="bar".__minus_gt((2));
  46743. $ctx1.sendIdx["->"]=2;
  46744. $1=[$2,$3];
  46745. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  46746. $ctx1.sendIdx["should:return:"]=1;
  46747. $5="foo".__minus_gt($Array());
  46748. $ctx1.sendIdx["->"]=3;
  46749. $6="bar".__minus_gt((2));
  46750. $ctx1.sendIdx["->"]=4;
  46751. $4=[$5,$6];
  46752. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  46753. $ctx1.sendIdx["should:return:"]=2;
  46754. $8="foo".__minus_gt((1));
  46755. $ctx1.sendIdx["->"]=5;
  46756. $9="bar".__minus_gt((2));
  46757. $ctx1.sendIdx["->"]=6;
  46758. $7=[$8,$9];
  46759. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  46760. $ctx1.sendIdx["should:return:"]=3;
  46761. $11="foo".__minus_gt((1));
  46762. $ctx1.sendIdx["->"]=7;
  46763. $10=[$11,"bar".__minus_gt((2))];
  46764. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  46765. $ctx1.sendIdx["should:return:"]=4;
  46766. 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)]));
  46767. return self;
  46768. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  46769. },
  46770. args: [],
  46771. 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}.",
  46772. referencedClasses: ["Array"],
  46773. messageSends: ["should:return:", "->"]
  46774. }),
  46775. $globals.CodeGeneratorTest);
  46776. $core.addMethod(
  46777. $core.method({
  46778. selector: "testJSStatement",
  46779. protocol: 'tests',
  46780. fn: function (){
  46781. var self=this;
  46782. return $core.withContext(function($ctx1) {
  46783. self._should_return_("foo <return 2+3>",(5));
  46784. return self;
  46785. }, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},$globals.CodeGeneratorTest)});
  46786. },
  46787. args: [],
  46788. source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
  46789. referencedClasses: [],
  46790. messageSends: ["should:return:"]
  46791. }),
  46792. $globals.CodeGeneratorTest);
  46793. $core.addMethod(
  46794. $core.method({
  46795. selector: "testLexicalScope",
  46796. protocol: 'tests',
  46797. fn: function (){
  46798. var self=this;
  46799. return $core.withContext(function($ctx1) {
  46800. self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  46801. return self;
  46802. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  46803. },
  46804. args: [],
  46805. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  46806. referencedClasses: [],
  46807. messageSends: ["should:return:"]
  46808. }),
  46809. $globals.CodeGeneratorTest);
  46810. $core.addMethod(
  46811. $core.method({
  46812. selector: "testLiterals",
  46813. protocol: 'tests',
  46814. fn: function (){
  46815. var self=this;
  46816. return $core.withContext(function($ctx1) {
  46817. self._should_return_("foo ^ 1",(1));
  46818. $ctx1.sendIdx["should:return:"]=1;
  46819. self._should_return_("foo ^ 'hello'","hello");
  46820. $ctx1.sendIdx["should:return:"]=2;
  46821. self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  46822. $ctx1.sendIdx["should:return:"]=3;
  46823. self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  46824. $ctx1.sendIdx["should:return:"]=4;
  46825. self._should_return_("foo ^ true",true);
  46826. $ctx1.sendIdx["should:return:"]=5;
  46827. self._should_return_("foo ^ false",false);
  46828. $ctx1.sendIdx["should:return:"]=6;
  46829. self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  46830. $ctx1.sendIdx["should:return:"]=7;
  46831. self._should_return_("foo ^ #hello","hello");
  46832. $ctx1.sendIdx["should:return:"]=8;
  46833. self._should_return_("foo ^ $h","h");
  46834. $ctx1.sendIdx["should:return:"]=9;
  46835. self._should_return_("foo ^ -123.456",(-123.456));
  46836. $ctx1.sendIdx["should:return:"]=10;
  46837. self._should_return_("foo ^ -2.5e4",(-25000));
  46838. return self;
  46839. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  46840. },
  46841. args: [],
  46842. 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.",
  46843. referencedClasses: [],
  46844. messageSends: ["should:return:"]
  46845. }),
  46846. $globals.CodeGeneratorTest);
  46847. $core.addMethod(
  46848. $core.method({
  46849. selector: "testLocalReturn",
  46850. protocol: 'tests',
  46851. fn: function (){
  46852. var self=this;
  46853. return $core.withContext(function($ctx1) {
  46854. self._should_return_("foo ^ 1",(1));
  46855. $ctx1.sendIdx["should:return:"]=1;
  46856. self._should_return_("foo ^ 1 + 1",(2));
  46857. $ctx1.sendIdx["should:return:"]=2;
  46858. self._should_return_("foo ",self["@receiver"]);
  46859. $ctx1.sendIdx["should:return:"]=3;
  46860. self._should_return_("foo self asString",self["@receiver"]);
  46861. $ctx1.sendIdx["should:return:"]=4;
  46862. self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  46863. return self;
  46864. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  46865. },
  46866. args: [],
  46867. 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",
  46868. referencedClasses: [],
  46869. messageSends: ["should:return:"]
  46870. }),
  46871. $globals.CodeGeneratorTest);
  46872. $core.addMethod(
  46873. $core.method({
  46874. selector: "testMessageSends",
  46875. protocol: 'tests',
  46876. fn: function (){
  46877. var self=this;
  46878. return $core.withContext(function($ctx1) {
  46879. self._should_return_("foo ^ 1 asString","1");
  46880. $ctx1.sendIdx["should:return:"]=1;
  46881. self._should_return_("foo ^ 1 + 1",(2));
  46882. $ctx1.sendIdx["should:return:"]=2;
  46883. self._should_return_("foo ^ 1 + 2 * 3",(9));
  46884. $ctx1.sendIdx["should:return:"]=3;
  46885. self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  46886. $ctx1.sendIdx["should:return:"]=4;
  46887. self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  46888. return self;
  46889. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  46890. },
  46891. args: [],
  46892. 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)",
  46893. referencedClasses: [],
  46894. messageSends: ["should:return:"]
  46895. }),
  46896. $globals.CodeGeneratorTest);
  46897. $core.addMethod(
  46898. $core.method({
  46899. selector: "testMultipleSequences",
  46900. protocol: 'tests',
  46901. fn: function (){
  46902. var self=this;
  46903. return $core.withContext(function($ctx1) {
  46904. self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  46905. return self;
  46906. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  46907. },
  46908. args: [],
  46909. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  46910. referencedClasses: [],
  46911. messageSends: ["should:return:"]
  46912. }),
  46913. $globals.CodeGeneratorTest);
  46914. $core.addMethod(
  46915. $core.method({
  46916. selector: "testMutableLiterals",
  46917. protocol: 'tests',
  46918. fn: function (){
  46919. var self=this;
  46920. return $core.withContext(function($ctx1) {
  46921. self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  46922. return self;
  46923. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  46924. },
  46925. args: [],
  46926. 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)",
  46927. referencedClasses: [],
  46928. messageSends: ["should:return:"]
  46929. }),
  46930. $globals.CodeGeneratorTest);
  46931. $core.addMethod(
  46932. $core.method({
  46933. selector: "testNestedIfTrue",
  46934. protocol: 'tests',
  46935. fn: function (){
  46936. var self=this;
  46937. return $core.withContext(function($ctx1) {
  46938. self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  46939. $ctx1.sendIdx["should:return:"]=1;
  46940. self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  46941. $ctx1.sendIdx["should:return:"]=2;
  46942. self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  46943. $ctx1.sendIdx["should:return:"]=3;
  46944. self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]);
  46945. return self;
  46946. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  46947. },
  46948. args: [],
  46949. 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.",
  46950. referencedClasses: [],
  46951. messageSends: ["should:return:"]
  46952. }),
  46953. $globals.CodeGeneratorTest);
  46954. $core.addMethod(
  46955. $core.method({
  46956. selector: "testNestedSends",
  46957. protocol: 'tests',
  46958. fn: function (){
  46959. var self=this;
  46960. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  46961. return $core.withContext(function($ctx1) {
  46962. self._should_return_("foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString",$recv($recv($Point())._x_y_((2).__at((3)),(4)))._asString());
  46963. return self;
  46964. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  46965. },
  46966. args: [],
  46967. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  46968. referencedClasses: ["Point"],
  46969. messageSends: ["should:return:", "asString", "x:y:", "@"]
  46970. }),
  46971. $globals.CodeGeneratorTest);
  46972. $core.addMethod(
  46973. $core.method({
  46974. selector: "testNonLocalReturn",
  46975. protocol: 'tests',
  46976. fn: function (){
  46977. var self=this;
  46978. return $core.withContext(function($ctx1) {
  46979. self._should_return_("foo [ ^ 1 ] value",(1));
  46980. $ctx1.sendIdx["should:return:"]=1;
  46981. self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  46982. $ctx1.sendIdx["should:return:"]=2;
  46983. self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  46984. $ctx1.sendIdx["should:return:"]=3;
  46985. self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  46986. return self;
  46987. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  46988. },
  46989. args: [],
  46990. 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",
  46991. referencedClasses: [],
  46992. messageSends: ["should:return:"]
  46993. }),
  46994. $globals.CodeGeneratorTest);
  46995. $core.addMethod(
  46996. $core.method({
  46997. selector: "testPascalCaseGlobal",
  46998. protocol: 'tests',
  46999. fn: function (){
  47000. var self=this;
  47001. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47002. return $core.withContext(function($ctx1) {
  47003. self._should_return_("foo ^Object",$recv($recv($Smalltalk())._globals())._at_("Object"));
  47004. $ctx1.sendIdx["should:return:"]=1;
  47005. self._should_return_("foo ^NonExistent",nil);
  47006. return self;
  47007. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  47008. },
  47009. args: [],
  47010. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  47011. referencedClasses: ["Smalltalk"],
  47012. messageSends: ["should:return:", "at:", "globals"]
  47013. }),
  47014. $globals.CodeGeneratorTest);
  47015. $core.addMethod(
  47016. $core.method({
  47017. selector: "testSendReceiverAndArgumentsOrdered",
  47018. protocol: 'tests',
  47019. fn: function (){
  47020. var self=this;
  47021. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  47022. return $core.withContext(function($ctx1) {
  47023. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  47024. $ctx1.sendIdx["should:return:"]=1;
  47025. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$Array(),(2)]);
  47026. return self;
  47027. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  47028. },
  47029. args: [],
  47030. 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}.",
  47031. referencedClasses: ["Array"],
  47032. messageSends: ["should:return:"]
  47033. }),
  47034. $globals.CodeGeneratorTest);
  47035. $core.addMethod(
  47036. $core.method({
  47037. selector: "testSuperSend",
  47038. protocol: 'tests',
  47039. fn: function (){
  47040. var self=this;
  47041. return $core.withContext(function($ctx1) {
  47042. self._should_receiver_return_("foo ^ super isBoolean",true,false);
  47043. return self;
  47044. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  47045. },
  47046. args: [],
  47047. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  47048. referencedClasses: [],
  47049. messageSends: ["should:receiver:return:"]
  47050. }),
  47051. $globals.CodeGeneratorTest);
  47052. $core.addMethod(
  47053. $core.method({
  47054. selector: "testTempVariables",
  47055. protocol: 'tests',
  47056. fn: function (){
  47057. var self=this;
  47058. return $core.withContext(function($ctx1) {
  47059. self._should_return_("foo | a | ^ a",nil);
  47060. $ctx1.sendIdx["should:return:"]=1;
  47061. self._should_return_("foo | AVariable | ^ AVariable",nil);
  47062. $ctx1.sendIdx["should:return:"]=2;
  47063. self._should_return_("foo | a b c | ^ c",nil);
  47064. $ctx1.sendIdx["should:return:"]=3;
  47065. self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  47066. $ctx1.sendIdx["should:return:"]=4;
  47067. self._should_return_("foo | a | a:= 1. ^ a",(1));
  47068. $ctx1.sendIdx["should:return:"]=5;
  47069. self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  47070. return self;
  47071. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  47072. },
  47073. args: [],
  47074. 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.",
  47075. referencedClasses: [],
  47076. messageSends: ["should:return:"]
  47077. }),
  47078. $globals.CodeGeneratorTest);
  47079. $core.addMethod(
  47080. $core.method({
  47081. selector: "testThisContext",
  47082. protocol: 'tests',
  47083. fn: function (){
  47084. var self=this;
  47085. return $core.withContext(function($ctx1) {
  47086. self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  47087. return self;
  47088. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  47089. },
  47090. args: [],
  47091. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  47092. referencedClasses: [],
  47093. messageSends: ["should:return:"]
  47094. }),
  47095. $globals.CodeGeneratorTest);
  47096. $core.addMethod(
  47097. $core.method({
  47098. selector: "testifFalse",
  47099. protocol: 'tests',
  47100. fn: function (){
  47101. var self=this;
  47102. return $core.withContext(function($ctx1) {
  47103. self._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
  47104. $ctx1.sendIdx["should:return:"]=1;
  47105. self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  47106. $ctx1.sendIdx["should:return:"]=2;
  47107. self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  47108. $ctx1.sendIdx["should:return:"]=3;
  47109. self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  47110. return self;
  47111. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  47112. },
  47113. args: [],
  47114. 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.",
  47115. referencedClasses: [],
  47116. messageSends: ["should:return:"]
  47117. }),
  47118. $globals.CodeGeneratorTest);
  47119. $core.addMethod(
  47120. $core.method({
  47121. selector: "testifFalseIfTrue",
  47122. protocol: 'tests',
  47123. fn: function (){
  47124. var self=this;
  47125. return $core.withContext(function($ctx1) {
  47126. self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  47127. $ctx1.sendIdx["should:return:"]=1;
  47128. self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  47129. $ctx1.sendIdx["should:return:"]=2;
  47130. self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  47131. $ctx1.sendIdx["should:return:"]=3;
  47132. self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  47133. return self;
  47134. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  47135. },
  47136. args: [],
  47137. 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.",
  47138. referencedClasses: [],
  47139. messageSends: ["should:return:"]
  47140. }),
  47141. $globals.CodeGeneratorTest);
  47142. $core.addMethod(
  47143. $core.method({
  47144. selector: "testifNil",
  47145. protocol: 'tests',
  47146. fn: function (){
  47147. var self=this;
  47148. return $core.withContext(function($ctx1) {
  47149. self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  47150. $ctx1.sendIdx["should:return:"]=1;
  47151. self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  47152. $ctx1.sendIdx["should:return:"]=2;
  47153. self._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]);
  47154. $ctx1.sendIdx["should:return:"]=3;
  47155. self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  47156. return self;
  47157. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  47158. },
  47159. args: [],
  47160. 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.",
  47161. referencedClasses: [],
  47162. messageSends: ["should:return:"]
  47163. }),
  47164. $globals.CodeGeneratorTest);
  47165. $core.addMethod(
  47166. $core.method({
  47167. selector: "testifNilIfNotNil",
  47168. protocol: 'tests',
  47169. fn: function (){
  47170. var self=this;
  47171. return $core.withContext(function($ctx1) {
  47172. self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  47173. $ctx1.sendIdx["should:return:"]=1;
  47174. self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  47175. $ctx1.sendIdx["should:return:"]=2;
  47176. self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  47177. $ctx1.sendIdx["should:return:"]=3;
  47178. self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  47179. return self;
  47180. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  47181. },
  47182. args: [],
  47183. 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.",
  47184. referencedClasses: [],
  47185. messageSends: ["should:return:"]
  47186. }),
  47187. $globals.CodeGeneratorTest);
  47188. $core.addMethod(
  47189. $core.method({
  47190. selector: "testifNotNil",
  47191. protocol: 'tests',
  47192. fn: function (){
  47193. var self=this;
  47194. return $core.withContext(function($ctx1) {
  47195. self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  47196. $ctx1.sendIdx["should:return:"]=1;
  47197. self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  47198. $ctx1.sendIdx["should:return:"]=2;
  47199. self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  47200. $ctx1.sendIdx["should:return:"]=3;
  47201. self._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]);
  47202. return self;
  47203. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  47204. },
  47205. args: [],
  47206. 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.",
  47207. referencedClasses: [],
  47208. messageSends: ["should:return:"]
  47209. }),
  47210. $globals.CodeGeneratorTest);
  47211. $core.addMethod(
  47212. $core.method({
  47213. selector: "testifNotNilWithArgument",
  47214. protocol: 'tests',
  47215. fn: function (){
  47216. var self=this;
  47217. return $core.withContext(function($ctx1) {
  47218. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  47219. $ctx1.sendIdx["should:return:"]=1;
  47220. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  47221. $ctx1.sendIdx["should:return:"]=2;
  47222. self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  47223. $ctx1.sendIdx["should:return:"]=3;
  47224. self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  47225. $ctx1.sendIdx["should:return:"]=4;
  47226. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  47227. $ctx1.sendIdx["should:return:"]=5;
  47228. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  47229. return self;
  47230. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  47231. },
  47232. args: [],
  47233. 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",
  47234. referencedClasses: [],
  47235. messageSends: ["should:return:"]
  47236. }),
  47237. $globals.CodeGeneratorTest);
  47238. $core.addMethod(
  47239. $core.method({
  47240. selector: "testifTrue",
  47241. protocol: 'tests',
  47242. fn: function (){
  47243. var self=this;
  47244. return $core.withContext(function($ctx1) {
  47245. self._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
  47246. $ctx1.sendIdx["should:return:"]=1;
  47247. self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  47248. $ctx1.sendIdx["should:return:"]=2;
  47249. self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  47250. $ctx1.sendIdx["should:return:"]=3;
  47251. self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  47252. return self;
  47253. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  47254. },
  47255. args: [],
  47256. 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.",
  47257. referencedClasses: [],
  47258. messageSends: ["should:return:"]
  47259. }),
  47260. $globals.CodeGeneratorTest);
  47261. $core.addMethod(
  47262. $core.method({
  47263. selector: "testifTrueIfFalse",
  47264. protocol: 'tests',
  47265. fn: function (){
  47266. var self=this;
  47267. return $core.withContext(function($ctx1) {
  47268. self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  47269. $ctx1.sendIdx["should:return:"]=1;
  47270. self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  47271. $ctx1.sendIdx["should:return:"]=2;
  47272. self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  47273. $ctx1.sendIdx["should:return:"]=3;
  47274. self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  47275. return self;
  47276. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  47277. },
  47278. args: [],
  47279. 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.",
  47280. referencedClasses: [],
  47281. messageSends: ["should:return:"]
  47282. }),
  47283. $globals.CodeGeneratorTest);
  47284. $core.addClass('ASTInterpreterTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
  47285. $core.addMethod(
  47286. $core.method({
  47287. selector: "analyze:forClass:",
  47288. protocol: 'parsing',
  47289. fn: function (aNode,aClass){
  47290. var self=this;
  47291. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  47292. return $core.withContext(function($ctx1) {
  47293. $recv($recv($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
  47294. return aNode;
  47295. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTInterpreterTest)});
  47296. },
  47297. args: ["aNode", "aClass"],
  47298. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  47299. referencedClasses: ["SemanticAnalyzer"],
  47300. messageSends: ["visit:", "on:"]
  47301. }),
  47302. $globals.ASTInterpreterTest);
  47303. $core.addMethod(
  47304. $core.method({
  47305. selector: "interpret:receiver:withArguments:",
  47306. protocol: 'private',
  47307. fn: function (aString,anObject,aDictionary){
  47308. var self=this;
  47309. var ctx,ast,interpreter;
  47310. function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  47311. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  47312. return $core.withContext(function($ctx1) {
  47313. var $1,$2,$3,$5,$6,$4,$receiver;
  47314. interpreter=$recv($ASTInterpreter())._new();
  47315. $ctx1.sendIdx["new"]=1;
  47316. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  47317. $1=$recv($AIContext())._new();
  47318. $recv($1)._receiver_(anObject);
  47319. $recv($1)._interpreter_(interpreter);
  47320. $2=$recv($1)._yourself();
  47321. ctx=$2;
  47322. $3=$recv(ast)._sequenceNode();
  47323. if(($receiver = $3) == null || $receiver.isNil){
  47324. $3;
  47325. } else {
  47326. var sequence;
  47327. sequence=$receiver;
  47328. $recv($recv(sequence)._temps())._do_((function(each){
  47329. return $core.withContext(function($ctx2) {
  47330. return $recv(ctx)._defineLocal_(each);
  47331. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  47332. }));
  47333. };
  47334. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  47335. return $core.withContext(function($ctx2) {
  47336. return $recv(ctx)._localAt_put_(key,value);
  47337. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  47338. }));
  47339. $5=interpreter;
  47340. $recv($5)._context_(ctx);
  47341. $recv($5)._interpret_($recv(ast)._nextChild());
  47342. $recv($5)._proceed();
  47343. $6=$recv($5)._result();
  47344. $4=$6;
  47345. return $4;
  47346. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  47347. },
  47348. args: ["aString", "anObject", "aDictionary"],
  47349. source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx ast interpreter |\x0a\x09\x0a\x09interpreter := ASTInterpreter new.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: interpreter;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09\x0a\x09^ interpreter\x0a\x09\x09context: ctx;\x0a\x09\x09interpret: ast nextChild;\x0a\x09\x09proceed;\x0a\x09\x09result",
  47350. referencedClasses: ["ASTInterpreter", "AIContext"],
  47351. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpret:", "nextChild", "proceed", "result"]
  47352. }),
  47353. $globals.ASTInterpreterTest);
  47354. $core.addMethod(
  47355. $core.method({
  47356. selector: "parse:",
  47357. protocol: 'parsing',
  47358. fn: function (aString){
  47359. var self=this;
  47360. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47361. return $core.withContext(function($ctx1) {
  47362. var $1;
  47363. $1=$recv($Smalltalk())._parse_(aString);
  47364. return $1;
  47365. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTInterpreterTest)});
  47366. },
  47367. args: ["aString"],
  47368. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  47369. referencedClasses: ["Smalltalk"],
  47370. messageSends: ["parse:"]
  47371. }),
  47372. $globals.ASTInterpreterTest);
  47373. $core.addMethod(
  47374. $core.method({
  47375. selector: "parse:forClass:",
  47376. protocol: 'parsing',
  47377. fn: function (aString,aClass){
  47378. var self=this;
  47379. return $core.withContext(function($ctx1) {
  47380. var $1;
  47381. $1=self._analyze_forClass_(self._parse_(aString),aClass);
  47382. return $1;
  47383. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTInterpreterTest)});
  47384. },
  47385. args: ["aString", "aClass"],
  47386. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  47387. referencedClasses: [],
  47388. messageSends: ["analyze:forClass:", "parse:"]
  47389. }),
  47390. $globals.ASTInterpreterTest);
  47391. $core.addMethod(
  47392. $core.method({
  47393. selector: "should:receiver:return:",
  47394. protocol: 'testing',
  47395. fn: function (aString,anObject,aResult){
  47396. var self=this;
  47397. return $core.withContext(function($ctx1) {
  47398. var $1;
  47399. self["@receiver"]=anObject;
  47400. $1=self._assert_equals_(self._interpret_receiver_withArguments_(aString,self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  47401. return $1;
  47402. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  47403. },
  47404. args: ["aString", "anObject", "aResult"],
  47405. 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",
  47406. referencedClasses: [],
  47407. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  47408. }),
  47409. $globals.ASTInterpreterTest);
  47410. $core.addMethod(
  47411. $core.method({
  47412. selector: "should:return:",
  47413. protocol: 'testing',
  47414. fn: function (aString,anObject){
  47415. var self=this;
  47416. return $core.withContext(function($ctx1) {
  47417. var $1;
  47418. $1=self._should_receiver_return_(aString,self["@receiver"],anObject);
  47419. return $1;
  47420. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.ASTInterpreterTest)});
  47421. },
  47422. args: ["aString", "anObject"],
  47423. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString\x0a\x09\x09receiver: receiver\x0a\x09\x09return: anObject",
  47424. referencedClasses: [],
  47425. messageSends: ["should:receiver:return:"]
  47426. }),
  47427. $globals.ASTInterpreterTest);
  47428. $core.addClass('ASTDebuggerTest', $globals.ASTInterpreterTest, [], 'Compiler-Tests');
  47429. $core.addMethod(
  47430. $core.method({
  47431. selector: "interpret:receiver:withArguments:",
  47432. protocol: 'private',
  47433. fn: function (aString,anObject,aDictionary){
  47434. var self=this;
  47435. var ctx,ast,debugger_;
  47436. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  47437. function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  47438. function $ASTDebugger(){return $globals.ASTDebugger||(typeof ASTDebugger=="undefined"?nil:ASTDebugger)}
  47439. return $core.withContext(function($ctx1) {
  47440. var $1,$2,$3,$4,$6,$7,$5,$receiver;
  47441. $1=$recv($AIContext())._new();
  47442. $ctx1.sendIdx["new"]=1;
  47443. $recv($1)._receiver_(anObject);
  47444. $recv($1)._interpreter_($recv($ASTInterpreter())._new());
  47445. $2=$recv($1)._yourself();
  47446. ctx=$2;
  47447. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  47448. $3=$recv(ast)._sequenceNode();
  47449. if(($receiver = $3) == null || $receiver.isNil){
  47450. $3;
  47451. } else {
  47452. var sequence;
  47453. sequence=$receiver;
  47454. $recv($recv(sequence)._temps())._do_((function(each){
  47455. return $core.withContext(function($ctx2) {
  47456. return $recv(ctx)._defineLocal_(each);
  47457. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  47458. }));
  47459. };
  47460. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  47461. return $core.withContext(function($ctx2) {
  47462. return $recv(ctx)._localAt_put_(key,value);
  47463. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  47464. }));
  47465. $4=$recv(ctx)._interpreter();
  47466. $ctx1.sendIdx["interpreter"]=1;
  47467. $recv($4)._context_(ctx);
  47468. $ctx1.sendIdx["context:"]=1;
  47469. $recv($recv(ctx)._interpreter())._node_($recv(ast)._nextChild());
  47470. debugger_=$recv($ASTDebugger())._context_(ctx);
  47471. $6=debugger_;
  47472. $recv($6)._proceed();
  47473. $7=$recv($6)._result();
  47474. $5=$7;
  47475. return $5;
  47476. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  47477. },
  47478. args: ["aString", "anObject", "aDictionary"],
  47479. source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09| ctx ast debugger |\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: ASTInterpreter new;\x0a\x09\x09yourself.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09ctx interpreter context: ctx.\x0a\x09\x0a\x09ctx interpreter node: ast nextChild.\x0a\x09\x0a\x09debugger := ASTDebugger context: ctx.\x0a\x09\x0a\x09^ debugger \x0a\x09\x09proceed; \x0a\x09\x09result",
  47480. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  47481. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "nextChild", "proceed", "result"]
  47482. }),
  47483. $globals.ASTDebuggerTest);
  47484. $core.addClass('InliningCodeGeneratorTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
  47485. $core.addMethod(
  47486. $core.method({
  47487. selector: "codeGeneratorClass",
  47488. protocol: 'accessing',
  47489. fn: function (){
  47490. var self=this;
  47491. function $InliningCodeGenerator(){return $globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  47492. return $InliningCodeGenerator();
  47493. },
  47494. args: [],
  47495. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  47496. referencedClasses: ["InliningCodeGenerator"],
  47497. messageSends: []
  47498. }),
  47499. $globals.InliningCodeGeneratorTest);
  47500. $core.addClass('ScopeVarTest', $globals.TestCase, [], 'Compiler-Tests');
  47501. $core.addMethod(
  47502. $core.method({
  47503. selector: "testClassRefVar",
  47504. protocol: 'tests',
  47505. fn: function (){
  47506. var self=this;
  47507. var node;
  47508. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47509. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  47510. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47511. return $core.withContext(function($ctx1) {
  47512. var $1,$2,$3,$4;
  47513. $1=$recv($VariableNode())._new();
  47514. $ctx1.sendIdx["new"]=1;
  47515. $recv($1)._value_("Object");
  47516. $2=$recv($1)._yourself();
  47517. node=$2;
  47518. $3=$recv($SemanticAnalyzer())._new();
  47519. $ctx1.sendIdx["new"]=2;
  47520. $recv($3)._pushScope_($recv($MethodLexicalScope())._new());
  47521. $4=$recv($3)._visit_(node);
  47522. self._assert_($recv($recv(node)._binding())._isClassRefVar());
  47523. return self;
  47524. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  47525. },
  47526. args: [],
  47527. 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",
  47528. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  47529. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  47530. }),
  47531. $globals.ScopeVarTest);
  47532. $core.addMethod(
  47533. $core.method({
  47534. selector: "testInstanceVar",
  47535. protocol: 'tests',
  47536. fn: function (){
  47537. var self=this;
  47538. var node,scope;
  47539. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47540. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47541. return $core.withContext(function($ctx1) {
  47542. var $1,$2;
  47543. $1=$recv($VariableNode())._new();
  47544. $ctx1.sendIdx["new"]=1;
  47545. $recv($1)._value_("bzzz");
  47546. $2=$recv($1)._yourself();
  47547. node=$2;
  47548. scope=$recv($MethodLexicalScope())._new();
  47549. $recv(scope)._addIVar_("bzzz");
  47550. self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  47551. return self;
  47552. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  47553. },
  47554. args: [],
  47555. 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",
  47556. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  47557. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  47558. }),
  47559. $globals.ScopeVarTest);
  47560. $core.addMethod(
  47561. $core.method({
  47562. selector: "testPseudoVar",
  47563. protocol: 'tests',
  47564. fn: function (){
  47565. var self=this;
  47566. var node,pseudoVars;
  47567. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47568. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47569. return $core.withContext(function($ctx1) {
  47570. var $1,$2;
  47571. pseudoVars=["self", "super", "true", "false", "nil"];
  47572. $recv(pseudoVars)._do_((function(each){
  47573. return $core.withContext(function($ctx2) {
  47574. $1=$recv($VariableNode())._new();
  47575. $ctx2.sendIdx["new"]=1;
  47576. $recv($1)._value_(each);
  47577. $2=$recv($1)._yourself();
  47578. node=$2;
  47579. node;
  47580. return self._assert_($recv($recv($recv($MethodLexicalScope())._new())._bindingFor_(node))._isPseudoVar());
  47581. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47582. }));
  47583. return self;
  47584. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  47585. },
  47586. args: [],
  47587. 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]",
  47588. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  47589. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  47590. }),
  47591. $globals.ScopeVarTest);
  47592. $core.addMethod(
  47593. $core.method({
  47594. selector: "testTempVar",
  47595. protocol: 'tests',
  47596. fn: function (){
  47597. var self=this;
  47598. var node,scope;
  47599. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47600. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47601. return $core.withContext(function($ctx1) {
  47602. var $1,$2;
  47603. $1=$recv($VariableNode())._new();
  47604. $ctx1.sendIdx["new"]=1;
  47605. $recv($1)._value_("bzzz");
  47606. $2=$recv($1)._yourself();
  47607. node=$2;
  47608. scope=$recv($MethodLexicalScope())._new();
  47609. $recv(scope)._addTemp_("bzzz");
  47610. self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  47611. return self;
  47612. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  47613. },
  47614. args: [],
  47615. 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",
  47616. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  47617. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  47618. }),
  47619. $globals.ScopeVarTest);
  47620. $core.addMethod(
  47621. $core.method({
  47622. selector: "testUnknownVar",
  47623. protocol: 'tests',
  47624. fn: function (){
  47625. var self=this;
  47626. var node;
  47627. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47628. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47629. return $core.withContext(function($ctx1) {
  47630. var $1,$2;
  47631. $1=$recv($VariableNode())._new();
  47632. $ctx1.sendIdx["new"]=1;
  47633. $recv($1)._value_("bzzz");
  47634. $2=$recv($1)._yourself();
  47635. node=$2;
  47636. self._assert_($recv($recv($recv($MethodLexicalScope())._new())._bindingFor_(node))._isNil());
  47637. return self;
  47638. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  47639. },
  47640. args: [],
  47641. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  47642. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  47643. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  47644. }),
  47645. $globals.ScopeVarTest);
  47646. $core.addClass('SemanticAnalyzerTest', $globals.TestCase, ['analyzer'], 'Compiler-Tests');
  47647. $core.addMethod(
  47648. $core.method({
  47649. selector: "setUp",
  47650. protocol: 'running',
  47651. fn: function (){
  47652. var self=this;
  47653. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  47654. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  47655. return $core.withContext(function($ctx1) {
  47656. self["@analyzer"]=$recv($SemanticAnalyzer())._on_($Object());
  47657. return self;
  47658. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  47659. },
  47660. args: [],
  47661. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  47662. referencedClasses: ["SemanticAnalyzer", "Object"],
  47663. messageSends: ["on:"]
  47664. }),
  47665. $globals.SemanticAnalyzerTest);
  47666. $core.addMethod(
  47667. $core.method({
  47668. selector: "testAssignment",
  47669. protocol: 'tests',
  47670. fn: function (){
  47671. var self=this;
  47672. var src,ast;
  47673. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47674. function $InvalidAssignmentError(){return $globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  47675. return $core.withContext(function($ctx1) {
  47676. src="foo self := 1";
  47677. ast=$recv($Smalltalk())._parse_(src);
  47678. self._should_raise_((function(){
  47679. return $core.withContext(function($ctx2) {
  47680. return $recv(self["@analyzer"])._visit_(ast);
  47681. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47682. }),$InvalidAssignmentError());
  47683. return self;
  47684. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47685. },
  47686. args: [],
  47687. 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",
  47688. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  47689. messageSends: ["parse:", "should:raise:", "visit:"]
  47690. }),
  47691. $globals.SemanticAnalyzerTest);
  47692. $core.addMethod(
  47693. $core.method({
  47694. selector: "testNonLocalReturn",
  47695. protocol: 'tests',
  47696. fn: function (){
  47697. var self=this;
  47698. var src,ast;
  47699. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47700. return $core.withContext(function($ctx1) {
  47701. src="foo | a | a + 1. ^ a";
  47702. ast=$recv($Smalltalk())._parse_(src);
  47703. $recv(self["@analyzer"])._visit_(ast);
  47704. self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  47705. return self;
  47706. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47707. },
  47708. args: [],
  47709. 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",
  47710. referencedClasses: ["Smalltalk"],
  47711. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  47712. }),
  47713. $globals.SemanticAnalyzerTest);
  47714. $core.addMethod(
  47715. $core.method({
  47716. selector: "testNonLocalReturn2",
  47717. protocol: 'tests',
  47718. fn: function (){
  47719. var self=this;
  47720. var src,ast;
  47721. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47722. return $core.withContext(function($ctx1) {
  47723. src="foo | a | a + 1. [ [ ^ a] ]";
  47724. ast=$recv($Smalltalk())._parse_(src);
  47725. $recv(self["@analyzer"])._visit_(ast);
  47726. self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  47727. return self;
  47728. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47729. },
  47730. args: [],
  47731. 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",
  47732. referencedClasses: ["Smalltalk"],
  47733. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  47734. }),
  47735. $globals.SemanticAnalyzerTest);
  47736. $core.addMethod(
  47737. $core.method({
  47738. selector: "testScope",
  47739. protocol: 'tests',
  47740. fn: function (){
  47741. var self=this;
  47742. var src,ast;
  47743. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47744. return $core.withContext(function($ctx1) {
  47745. var $4,$3,$2,$1;
  47746. src="foo | a | a + 1. [ | b | b := a ]";
  47747. ast=$recv($Smalltalk())._parse_(src);
  47748. $recv(self["@analyzer"])._visit_(ast);
  47749. $4=$recv($recv($recv(ast)._nodes())._first())._nodes();
  47750. $ctx1.sendIdx["nodes"]=1;
  47751. $3=$recv($4)._last();
  47752. $2=$recv($3)._scope();
  47753. $ctx1.sendIdx["scope"]=1;
  47754. $1=$recv($2).__eq_eq($recv(ast)._scope());
  47755. self._deny_($1);
  47756. return self;
  47757. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47758. },
  47759. args: [],
  47760. 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.",
  47761. referencedClasses: ["Smalltalk"],
  47762. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "nodes", "first"]
  47763. }),
  47764. $globals.SemanticAnalyzerTest);
  47765. $core.addMethod(
  47766. $core.method({
  47767. selector: "testScope2",
  47768. protocol: 'tests',
  47769. fn: function (){
  47770. var self=this;
  47771. var src,ast;
  47772. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47773. return $core.withContext(function($ctx1) {
  47774. var $8,$7,$6,$5,$4,$3,$2,$1;
  47775. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  47776. ast=$recv($Smalltalk())._parse_(src);
  47777. $recv(self["@analyzer"])._visit_(ast);
  47778. $8=$recv($recv($recv(ast)._nodes())._first())._nodes();
  47779. $ctx1.sendIdx["nodes"]=3;
  47780. $7=$recv($8)._last();
  47781. $6=$recv($7)._nodes();
  47782. $ctx1.sendIdx["nodes"]=2;
  47783. $5=$recv($6)._first();
  47784. $ctx1.sendIdx["first"]=2;
  47785. $4=$recv($5)._nodes();
  47786. $ctx1.sendIdx["nodes"]=1;
  47787. $3=$recv($4)._first();
  47788. $ctx1.sendIdx["first"]=1;
  47789. $2=$recv($3)._scope();
  47790. $ctx1.sendIdx["scope"]=1;
  47791. $1=$recv($2).__eq_eq($recv(ast)._scope());
  47792. self._deny_($1);
  47793. return self;
  47794. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47795. },
  47796. args: [],
  47797. 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.",
  47798. referencedClasses: ["Smalltalk"],
  47799. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "nodes", "last"]
  47800. }),
  47801. $globals.SemanticAnalyzerTest);
  47802. $core.addMethod(
  47803. $core.method({
  47804. selector: "testScopeLevel",
  47805. protocol: 'tests',
  47806. fn: function (){
  47807. var self=this;
  47808. var src,ast;
  47809. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47810. return $core.withContext(function($ctx1) {
  47811. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  47812. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  47813. ast=$recv($Smalltalk())._parse_(src);
  47814. $recv(self["@analyzer"])._visit_(ast);
  47815. $2=$recv(ast)._scope();
  47816. $ctx1.sendIdx["scope"]=1;
  47817. $1=$recv($2)._scopeLevel();
  47818. $ctx1.sendIdx["scopeLevel"]=1;
  47819. self._assert_equals_($1,(1));
  47820. $ctx1.sendIdx["assert:equals:"]=1;
  47821. $10=$recv($recv($recv(ast)._nodes())._first())._nodes();
  47822. $ctx1.sendIdx["nodes"]=3;
  47823. $9=$recv($10)._last();
  47824. $8=$recv($9)._nodes();
  47825. $ctx1.sendIdx["nodes"]=2;
  47826. $7=$recv($8)._first();
  47827. $ctx1.sendIdx["first"]=2;
  47828. $6=$recv($7)._nodes();
  47829. $ctx1.sendIdx["nodes"]=1;
  47830. $5=$recv($6)._first();
  47831. $ctx1.sendIdx["first"]=1;
  47832. $4=$recv($5)._scope();
  47833. $3=$recv($4)._scopeLevel();
  47834. self._assert_equals_($3,(3));
  47835. return self;
  47836. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47837. },
  47838. args: [],
  47839. 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",
  47840. referencedClasses: ["Smalltalk"],
  47841. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "nodes", "last"]
  47842. }),
  47843. $globals.SemanticAnalyzerTest);
  47844. $core.addMethod(
  47845. $core.method({
  47846. selector: "testUnknownVariables",
  47847. protocol: 'tests',
  47848. fn: function (){
  47849. var self=this;
  47850. var src,ast;
  47851. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47852. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  47853. return $core.withContext(function($ctx1) {
  47854. src="foo | a | b + a";
  47855. ast=$recv($Smalltalk())._parse_(src);
  47856. self._should_raise_((function(){
  47857. return $core.withContext(function($ctx2) {
  47858. return $recv(self["@analyzer"])._visit_(ast);
  47859. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47860. }),$UnknownVariableError());
  47861. return self;
  47862. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47863. },
  47864. args: [],
  47865. 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",
  47866. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  47867. messageSends: ["parse:", "should:raise:", "visit:"]
  47868. }),
  47869. $globals.SemanticAnalyzerTest);
  47870. $core.addMethod(
  47871. $core.method({
  47872. selector: "testUnknownVariablesWithScope",
  47873. protocol: 'tests',
  47874. fn: function (){
  47875. var self=this;
  47876. var src,ast;
  47877. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47878. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  47879. return $core.withContext(function($ctx1) {
  47880. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  47881. ast=$recv($Smalltalk())._parse_(src);
  47882. self._should_raise_((function(){
  47883. return $core.withContext(function($ctx2) {
  47884. return $recv(self["@analyzer"])._visit_(ast);
  47885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47886. }),$UnknownVariableError());
  47887. return self;
  47888. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47889. },
  47890. args: [],
  47891. 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",
  47892. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  47893. messageSends: ["parse:", "should:raise:", "visit:"]
  47894. }),
  47895. $globals.SemanticAnalyzerTest);
  47896. $core.addMethod(
  47897. $core.method({
  47898. selector: "testVariableShadowing",
  47899. protocol: 'tests',
  47900. fn: function (){
  47901. var self=this;
  47902. var src,ast;
  47903. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47904. return $core.withContext(function($ctx1) {
  47905. src="foo | a | a + 1";
  47906. ast=$recv($Smalltalk())._parse_(src);
  47907. $recv(self["@analyzer"])._visit_(ast);
  47908. return self;
  47909. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47910. },
  47911. args: [],
  47912. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  47913. referencedClasses: ["Smalltalk"],
  47914. messageSends: ["parse:", "visit:"]
  47915. }),
  47916. $globals.SemanticAnalyzerTest);
  47917. $core.addMethod(
  47918. $core.method({
  47919. selector: "testVariableShadowing2",
  47920. protocol: 'tests',
  47921. fn: function (){
  47922. var self=this;
  47923. var src,ast;
  47924. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47925. function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  47926. return $core.withContext(function($ctx1) {
  47927. src="foo | a | a + 1. [ | a | a := 2 ]";
  47928. ast=$recv($Smalltalk())._parse_(src);
  47929. self._should_raise_((function(){
  47930. return $core.withContext(function($ctx2) {
  47931. return $recv(self["@analyzer"])._visit_(ast);
  47932. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47933. }),$ShadowingVariableError());
  47934. return self;
  47935. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47936. },
  47937. args: [],
  47938. 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",
  47939. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  47940. messageSends: ["parse:", "should:raise:", "visit:"]
  47941. }),
  47942. $globals.SemanticAnalyzerTest);
  47943. $core.addMethod(
  47944. $core.method({
  47945. selector: "testVariableShadowing3",
  47946. protocol: 'tests',
  47947. fn: function (){
  47948. var self=this;
  47949. var src,ast;
  47950. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47951. return $core.withContext(function($ctx1) {
  47952. src="foo | a | a + 1. [ | b | b := 2 ]";
  47953. ast=$recv($Smalltalk())._parse_(src);
  47954. $recv(self["@analyzer"])._visit_(ast);
  47955. return self;
  47956. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47957. },
  47958. args: [],
  47959. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  47960. referencedClasses: ["Smalltalk"],
  47961. messageSends: ["parse:", "visit:"]
  47962. }),
  47963. $globals.SemanticAnalyzerTest);
  47964. $core.addMethod(
  47965. $core.method({
  47966. selector: "testVariableShadowing4",
  47967. protocol: 'tests',
  47968. fn: function (){
  47969. var self=this;
  47970. var src,ast;
  47971. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47972. return $core.withContext(function($ctx1) {
  47973. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  47974. ast=$recv($Smalltalk())._parse_(src);
  47975. $recv(self["@analyzer"])._visit_(ast);
  47976. return self;
  47977. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47978. },
  47979. args: [],
  47980. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  47981. referencedClasses: ["Smalltalk"],
  47982. messageSends: ["parse:", "visit:"]
  47983. }),
  47984. $globals.SemanticAnalyzerTest);
  47985. $core.addMethod(
  47986. $core.method({
  47987. selector: "testVariableShadowing5",
  47988. protocol: 'tests',
  47989. fn: function (){
  47990. var self=this;
  47991. var src,ast;
  47992. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47993. function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  47994. return $core.withContext(function($ctx1) {
  47995. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  47996. ast=$recv($Smalltalk())._parse_(src);
  47997. self._should_raise_((function(){
  47998. return $core.withContext(function($ctx2) {
  47999. return $recv(self["@analyzer"])._visit_(ast);
  48000. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48001. }),$ShadowingVariableError());
  48002. return self;
  48003. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48004. },
  48005. args: [],
  48006. 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",
  48007. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  48008. messageSends: ["parse:", "should:raise:", "visit:"]
  48009. }),
  48010. $globals.SemanticAnalyzerTest);
  48011. $core.addMethod(
  48012. $core.method({
  48013. selector: "testVariablesLookup",
  48014. protocol: 'tests',
  48015. fn: function (){
  48016. var self=this;
  48017. var src,ast;
  48018. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  48019. return $core.withContext(function($ctx1) {
  48020. 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;
  48021. src="foo | a | a + 1. [ | b | b := a ]";
  48022. ast=$recv($Smalltalk())._parse_(src);
  48023. $recv(self["@analyzer"])._visit_(ast);
  48024. $7=$recv(ast)._nodes();
  48025. $ctx1.sendIdx["nodes"]=2;
  48026. $6=$recv($7)._first();
  48027. $ctx1.sendIdx["first"]=2;
  48028. $5=$recv($6)._nodes();
  48029. $ctx1.sendIdx["nodes"]=1;
  48030. $4=$recv($5)._first();
  48031. $ctx1.sendIdx["first"]=1;
  48032. $3=$recv($4)._receiver();
  48033. $ctx1.sendIdx["receiver"]=1;
  48034. $2=$recv($3)._binding();
  48035. $ctx1.sendIdx["binding"]=1;
  48036. $1=$recv($2)._isTempVar();
  48037. $ctx1.sendIdx["isTempVar"]=1;
  48038. self._assert_($1);
  48039. $ctx1.sendIdx["assert:"]=1;
  48040. $15=$recv(ast)._nodes();
  48041. $ctx1.sendIdx["nodes"]=4;
  48042. $14=$recv($15)._first();
  48043. $ctx1.sendIdx["first"]=4;
  48044. $13=$recv($14)._nodes();
  48045. $ctx1.sendIdx["nodes"]=3;
  48046. $12=$recv($13)._first();
  48047. $ctx1.sendIdx["first"]=3;
  48048. $11=$recv($12)._receiver();
  48049. $10=$recv($11)._binding();
  48050. $ctx1.sendIdx["binding"]=2;
  48051. $9=$recv($10)._scope();
  48052. $ctx1.sendIdx["scope"]=1;
  48053. $16=$recv(ast)._scope();
  48054. $ctx1.sendIdx["scope"]=2;
  48055. $8=$recv($9).__eq_eq($16);
  48056. $ctx1.sendIdx["=="]=1;
  48057. self._assert_($8);
  48058. $ctx1.sendIdx["assert:"]=2;
  48059. $27=$recv(ast)._nodes();
  48060. $ctx1.sendIdx["nodes"]=8;
  48061. $26=$recv($27)._first();
  48062. $ctx1.sendIdx["first"]=7;
  48063. $25=$recv($26)._nodes();
  48064. $ctx1.sendIdx["nodes"]=7;
  48065. $24=$recv($25)._last();
  48066. $ctx1.sendIdx["last"]=1;
  48067. $23=$recv($24)._nodes();
  48068. $ctx1.sendIdx["nodes"]=6;
  48069. $22=$recv($23)._first();
  48070. $ctx1.sendIdx["first"]=6;
  48071. $21=$recv($22)._nodes();
  48072. $ctx1.sendIdx["nodes"]=5;
  48073. $20=$recv($21)._first();
  48074. $ctx1.sendIdx["first"]=5;
  48075. $19=$recv($20)._left();
  48076. $ctx1.sendIdx["left"]=1;
  48077. $18=$recv($19)._binding();
  48078. $ctx1.sendIdx["binding"]=3;
  48079. $17=$recv($18)._isTempVar();
  48080. self._assert_($17);
  48081. $ctx1.sendIdx["assert:"]=3;
  48082. $39=$recv(ast)._nodes();
  48083. $ctx1.sendIdx["nodes"]=12;
  48084. $38=$recv($39)._first();
  48085. $ctx1.sendIdx["first"]=10;
  48086. $37=$recv($38)._nodes();
  48087. $ctx1.sendIdx["nodes"]=11;
  48088. $36=$recv($37)._last();
  48089. $ctx1.sendIdx["last"]=2;
  48090. $35=$recv($36)._nodes();
  48091. $ctx1.sendIdx["nodes"]=10;
  48092. $34=$recv($35)._first();
  48093. $ctx1.sendIdx["first"]=9;
  48094. $33=$recv($34)._nodes();
  48095. $ctx1.sendIdx["nodes"]=9;
  48096. $32=$recv($33)._first();
  48097. $ctx1.sendIdx["first"]=8;
  48098. $31=$recv($32)._left();
  48099. $30=$recv($31)._binding();
  48100. $29=$recv($30)._scope();
  48101. $ctx1.sendIdx["scope"]=3;
  48102. $42=$recv($recv($recv(ast)._nodes())._first())._nodes();
  48103. $ctx1.sendIdx["nodes"]=13;
  48104. $41=$recv($42)._last();
  48105. $40=$recv($41)._scope();
  48106. $28=$recv($29).__eq_eq($40);
  48107. self._assert_($28);
  48108. return self;
  48109. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48110. },
  48111. args: [],
  48112. 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.",
  48113. referencedClasses: ["Smalltalk"],
  48114. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "nodes", "==", "scope", "left", "last"]
  48115. }),
  48116. $globals.SemanticAnalyzerTest);
  48117. $core.addClass('AISemanticAnalyzerTest', $globals.SemanticAnalyzerTest, [], 'Compiler-Tests');
  48118. $core.addMethod(
  48119. $core.method({
  48120. selector: "setUp",
  48121. protocol: 'running',
  48122. fn: function (){
  48123. var self=this;
  48124. function $AISemanticAnalyzer(){return $globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)}
  48125. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  48126. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  48127. return $core.withContext(function($ctx1) {
  48128. var $1,$2,$4,$5,$3,$6;
  48129. $1=$recv($AISemanticAnalyzer())._on_($Object());
  48130. $2=$1;
  48131. $4=$recv($AIContext())._new();
  48132. $recv($4)._defineLocal_("local");
  48133. $recv($4)._localAt_put_("local",(3));
  48134. $5=$recv($4)._yourself();
  48135. $ctx1.sendIdx["yourself"]=1;
  48136. $3=$5;
  48137. $recv($2)._context_($3);
  48138. $6=$recv($1)._yourself();
  48139. self["@analyzer"]=$6;
  48140. return self;
  48141. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  48142. },
  48143. args: [],
  48144. 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",
  48145. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  48146. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  48147. }),
  48148. $globals.AISemanticAnalyzerTest);
  48149. $core.addMethod(
  48150. $core.method({
  48151. selector: "testContextVariables",
  48152. protocol: 'tests',
  48153. fn: function (){
  48154. var self=this;
  48155. var src,ast;
  48156. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  48157. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  48158. return $core.withContext(function($ctx1) {
  48159. src="foo | a | local + a";
  48160. ast=$recv($Smalltalk())._parse_(src);
  48161. self._shouldnt_raise_((function(){
  48162. return $core.withContext(function($ctx2) {
  48163. return $recv(self["@analyzer"])._visit_(ast);
  48164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48165. }),$UnknownVariableError());
  48166. return self;
  48167. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  48168. },
  48169. args: [],
  48170. 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",
  48171. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  48172. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  48173. }),
  48174. $globals.AISemanticAnalyzerTest);
  48175. });
  48176. define("amber_core/Kernel-Tests", ["amber/boot", "amber_core/SUnit", "amber_core/Kernel-Objects"], function($boot){"use strict";
  48177. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  48178. $core.addPackage('Kernel-Tests');
  48179. $core.packages["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
  48180. $core.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  48181. $core.addClass('AnnouncementSubscriptionTest', $globals.TestCase, [], 'Kernel-Tests');
  48182. $core.addMethod(
  48183. $core.method({
  48184. selector: "testAddExtensionMethod",
  48185. protocol: 'tests',
  48186. fn: function (){
  48187. var self=this;
  48188. var method,dirty;
  48189. return $core.withContext(function($ctx1) {
  48190. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  48191. $2=self._class();
  48192. $ctx1.sendIdx["class"]=1;
  48193. $1=$recv($2)._package();
  48194. $ctx1.sendIdx["package"]=1;
  48195. dirty=$recv($1)._isDirty();
  48196. $ctx1.sendIdx["isDirty"]=1;
  48197. $4=self._class();
  48198. $ctx1.sendIdx["class"]=2;
  48199. $3=$recv($4)._package();
  48200. $ctx1.sendIdx["package"]=2;
  48201. $recv($3)._beClean();
  48202. $5=self._class();
  48203. $ctx1.sendIdx["class"]=3;
  48204. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  48205. $8=self._class();
  48206. $ctx1.sendIdx["class"]=4;
  48207. $7=$recv($8)._package();
  48208. $ctx1.sendIdx["package"]=3;
  48209. $6=$recv($7)._isDirty();
  48210. self._deny_($6);
  48211. $9=self._class();
  48212. $ctx1.sendIdx["class"]=5;
  48213. $recv($9)._removeCompiledMethod_(method);
  48214. $10=dirty;
  48215. if($core.assert($10)){
  48216. $recv($recv(self._class())._package())._beDirty();
  48217. };
  48218. return self;
  48219. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  48220. },
  48221. args: [],
  48222. 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 ]",
  48223. referencedClasses: [],
  48224. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  48225. }),
  48226. $globals.AnnouncementSubscriptionTest);
  48227. $core.addMethod(
  48228. $core.method({
  48229. selector: "testHandlesAnnouncement",
  48230. protocol: 'tests',
  48231. fn: function (){
  48232. var self=this;
  48233. var subscription,announcementClass1,announcementClass2,classBuilder;
  48234. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  48235. function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  48236. function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  48237. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  48238. return $core.withContext(function($ctx1) {
  48239. var $1,$2;
  48240. classBuilder=$recv($ClassBuilder())._new();
  48241. $ctx1.sendIdx["new"]=1;
  48242. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  48243. subscription=$recv($recv($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  48244. $1=$recv(subscription)._handlesAnnouncement_($SystemAnnouncement());
  48245. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  48246. self._assert_equals_($1,true);
  48247. $ctx1.sendIdx["assert:equals:"]=1;
  48248. $2=$recv(subscription)._handlesAnnouncement_(announcementClass1);
  48249. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  48250. self._assert_equals_($2,true);
  48251. $ctx1.sendIdx["assert:equals:"]=2;
  48252. self._assert_equals_($recv(subscription)._handlesAnnouncement_($Object()),false);
  48253. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  48254. return self;
  48255. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  48256. },
  48257. args: [],
  48258. 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.",
  48259. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  48260. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  48261. }),
  48262. $globals.AnnouncementSubscriptionTest);
  48263. $core.addClass('AnnouncerTest', $globals.TestCase, [], 'Kernel-Tests');
  48264. $core.addMethod(
  48265. $core.method({
  48266. selector: "testOnDo",
  48267. protocol: 'tests',
  48268. fn: function (){
  48269. var self=this;
  48270. var counter,announcer;
  48271. function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48272. function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  48273. return $core.withContext(function($ctx1) {
  48274. var $1,$2;
  48275. counter=(0);
  48276. announcer=$recv($Announcer())._new();
  48277. $ctx1.sendIdx["new"]=1;
  48278. $recv(announcer)._on_do_($SystemAnnouncement(),(function(){
  48279. return $core.withContext(function($ctx2) {
  48280. counter=$recv(counter).__plus((1));
  48281. return counter;
  48282. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48283. }));
  48284. $1=announcer;
  48285. $2=$recv($SystemAnnouncement())._new();
  48286. $ctx1.sendIdx["new"]=2;
  48287. $recv($1)._announce_($2);
  48288. $ctx1.sendIdx["announce:"]=1;
  48289. self._assert_equals_(counter,(1));
  48290. $ctx1.sendIdx["assert:equals:"]=1;
  48291. $recv(announcer)._announce_($recv($SystemAnnouncement())._new());
  48292. self._assert_equals_(counter,(2));
  48293. return self;
  48294. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  48295. },
  48296. args: [],
  48297. 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.",
  48298. referencedClasses: ["Announcer", "SystemAnnouncement"],
  48299. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  48300. }),
  48301. $globals.AnnouncerTest);
  48302. $core.addMethod(
  48303. $core.method({
  48304. selector: "testOnDoFor",
  48305. protocol: 'tests',
  48306. fn: function (){
  48307. var self=this;
  48308. var counter,announcer;
  48309. function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48310. function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  48311. return $core.withContext(function($ctx1) {
  48312. var $1,$2,$3,$4;
  48313. counter=(0);
  48314. announcer=$recv($Announcer())._new();
  48315. $ctx1.sendIdx["new"]=1;
  48316. $recv(announcer)._on_do_for_($SystemAnnouncement(),(function(){
  48317. return $core.withContext(function($ctx2) {
  48318. counter=$recv(counter).__plus((1));
  48319. return counter;
  48320. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48321. }),self);
  48322. $1=announcer;
  48323. $2=$recv($SystemAnnouncement())._new();
  48324. $ctx1.sendIdx["new"]=2;
  48325. $recv($1)._announce_($2);
  48326. $ctx1.sendIdx["announce:"]=1;
  48327. self._assert_equals_(counter,(1));
  48328. $ctx1.sendIdx["assert:equals:"]=1;
  48329. $3=announcer;
  48330. $4=$recv($SystemAnnouncement())._new();
  48331. $ctx1.sendIdx["new"]=3;
  48332. $recv($3)._announce_($4);
  48333. $ctx1.sendIdx["announce:"]=2;
  48334. self._assert_equals_(counter,(2));
  48335. $ctx1.sendIdx["assert:equals:"]=2;
  48336. $recv(announcer)._unsubscribe_(self);
  48337. $recv(announcer)._announce_($recv($SystemAnnouncement())._new());
  48338. self._assert_equals_(counter,(2));
  48339. return self;
  48340. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  48341. },
  48342. args: [],
  48343. 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.",
  48344. referencedClasses: ["Announcer", "SystemAnnouncement"],
  48345. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  48346. }),
  48347. $globals.AnnouncerTest);
  48348. $core.addMethod(
  48349. $core.method({
  48350. selector: "testOnDoOnce",
  48351. protocol: 'tests',
  48352. fn: function (){
  48353. var self=this;
  48354. var counter,announcer;
  48355. function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48356. function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  48357. return $core.withContext(function($ctx1) {
  48358. var $1,$2;
  48359. counter=(0);
  48360. announcer=$recv($Announcer())._new();
  48361. $ctx1.sendIdx["new"]=1;
  48362. $recv(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  48363. return $core.withContext(function($ctx2) {
  48364. counter=$recv(counter).__plus((1));
  48365. return counter;
  48366. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48367. }));
  48368. $1=announcer;
  48369. $2=$recv($SystemAnnouncement())._new();
  48370. $ctx1.sendIdx["new"]=2;
  48371. $recv($1)._announce_($2);
  48372. $ctx1.sendIdx["announce:"]=1;
  48373. self._assert_equals_(counter,(1));
  48374. $ctx1.sendIdx["assert:equals:"]=1;
  48375. $recv(announcer)._announce_($recv($SystemAnnouncement())._new());
  48376. self._assert_equals_(counter,(1));
  48377. return self;
  48378. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  48379. },
  48380. args: [],
  48381. 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.",
  48382. referencedClasses: ["Announcer", "SystemAnnouncement"],
  48383. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  48384. }),
  48385. $globals.AnnouncerTest);
  48386. $core.addClass('BlockClosureTest', $globals.TestCase, [], 'Kernel-Tests');
  48387. $core.addMethod(
  48388. $core.method({
  48389. selector: "localReturnOnDoCatch",
  48390. protocol: 'fixture',
  48391. fn: function (){
  48392. var self=this;
  48393. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48394. return $core.withContext(function($ctx1) {
  48395. var $early={};
  48396. try {
  48397. $recv((function(){
  48398. throw $early=[(2)];
  48399. }))._on_do_($Error(),(function(){
  48400. }));
  48401. return (3);
  48402. }
  48403. catch(e) {if(e===$early)return e[0]; throw e}
  48404. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  48405. },
  48406. args: [],
  48407. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  48408. referencedClasses: ["Error"],
  48409. messageSends: ["on:do:"]
  48410. }),
  48411. $globals.BlockClosureTest);
  48412. $core.addMethod(
  48413. $core.method({
  48414. selector: "localReturnOnDoMiss",
  48415. protocol: 'fixture',
  48416. fn: function (){
  48417. var self=this;
  48418. function $Class(){return $globals.Class||(typeof Class=="undefined"?nil:Class)}
  48419. return $core.withContext(function($ctx1) {
  48420. var $early={};
  48421. try {
  48422. $recv((function(){
  48423. throw $early=[(2)];
  48424. }))._on_do_($Class(),(function(){
  48425. }));
  48426. return (3);
  48427. }
  48428. catch(e) {if(e===$early)return e[0]; throw e}
  48429. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  48430. },
  48431. args: [],
  48432. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  48433. referencedClasses: ["Class"],
  48434. messageSends: ["on:do:"]
  48435. }),
  48436. $globals.BlockClosureTest);
  48437. $core.addMethod(
  48438. $core.method({
  48439. selector: "testCanClearInterval",
  48440. protocol: 'tests',
  48441. fn: function (){
  48442. var self=this;
  48443. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48444. return $core.withContext(function($ctx1) {
  48445. self._shouldnt_raise_((function(){
  48446. return $core.withContext(function($ctx2) {
  48447. return $recv($recv((function(){
  48448. return $core.withContext(function($ctx3) {
  48449. return $recv($recv($Error())._new())._signal();
  48450. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48451. }))._valueWithInterval_((0)))._clearInterval();
  48452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48453. }),$Error());
  48454. return self;
  48455. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  48456. },
  48457. args: [],
  48458. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  48459. referencedClasses: ["Error"],
  48460. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  48461. }),
  48462. $globals.BlockClosureTest);
  48463. $core.addMethod(
  48464. $core.method({
  48465. selector: "testCanClearTimeout",
  48466. protocol: 'tests',
  48467. fn: function (){
  48468. var self=this;
  48469. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48470. return $core.withContext(function($ctx1) {
  48471. self._shouldnt_raise_((function(){
  48472. return $core.withContext(function($ctx2) {
  48473. return $recv($recv((function(){
  48474. return $core.withContext(function($ctx3) {
  48475. return $recv($recv($Error())._new())._signal();
  48476. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48477. }))._valueWithTimeout_((0)))._clearTimeout();
  48478. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48479. }),$Error());
  48480. return self;
  48481. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  48482. },
  48483. args: [],
  48484. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  48485. referencedClasses: ["Error"],
  48486. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  48487. }),
  48488. $globals.BlockClosureTest);
  48489. $core.addMethod(
  48490. $core.method({
  48491. selector: "testCompiledSource",
  48492. protocol: 'tests',
  48493. fn: function (){
  48494. var self=this;
  48495. return $core.withContext(function($ctx1) {
  48496. self._assert_($recv($recv((function(){
  48497. return $core.withContext(function($ctx2) {
  48498. return (1).__plus((1));
  48499. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48500. }))._compiledSource())._includesSubString_("function"));
  48501. return self;
  48502. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  48503. },
  48504. args: [],
  48505. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  48506. referencedClasses: [],
  48507. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  48508. }),
  48509. $globals.BlockClosureTest);
  48510. $core.addMethod(
  48511. $core.method({
  48512. selector: "testCurrySelf",
  48513. protocol: 'tests',
  48514. fn: function (){
  48515. var self=this;
  48516. var curriedMethod,array;
  48517. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  48518. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  48519. return $core.withContext(function($ctx1) {
  48520. curriedMethod=$recv($recv((function(selfarg,x){
  48521. return $core.withContext(function($ctx2) {
  48522. return $recv(selfarg)._at_(x);
  48523. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  48524. }))._currySelf())._asCompiledMethod_("foo:");
  48525. array=[(3), (1), (4)];
  48526. $recv($recv($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  48527. $recv((function(){
  48528. return $core.withContext(function($ctx2) {
  48529. return self._assert_equals_($recv(array)._foo_((2)),(1));
  48530. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48531. }))._ensure_((function(){
  48532. return $core.withContext(function($ctx2) {
  48533. return $recv($Array())._removeCompiledMethod_(curriedMethod);
  48534. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48535. }));
  48536. return self;
  48537. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  48538. },
  48539. args: [],
  48540. 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 ]",
  48541. referencedClasses: ["ClassBuilder", "Array"],
  48542. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  48543. }),
  48544. $globals.BlockClosureTest);
  48545. $core.addMethod(
  48546. $core.method({
  48547. selector: "testEnsure",
  48548. protocol: 'tests',
  48549. fn: function (){
  48550. var self=this;
  48551. return $core.withContext(function($ctx1) {
  48552. self._assert_equals_($recv((function(){
  48553. return (3);
  48554. }))._ensure_((function(){
  48555. return (4);
  48556. })),(3));
  48557. return self;
  48558. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  48559. },
  48560. args: [],
  48561. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  48562. referencedClasses: [],
  48563. messageSends: ["assert:equals:", "ensure:"]
  48564. }),
  48565. $globals.BlockClosureTest);
  48566. $core.addMethod(
  48567. $core.method({
  48568. selector: "testEnsureRaises",
  48569. protocol: 'tests',
  48570. fn: function (){
  48571. var self=this;
  48572. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48573. return $core.withContext(function($ctx1) {
  48574. self._should_raise_((function(){
  48575. return $core.withContext(function($ctx2) {
  48576. return $recv((function(){
  48577. return $core.withContext(function($ctx3) {
  48578. return $recv($recv($Error())._new())._signal();
  48579. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48580. }))._ensure_((function(){
  48581. return true;
  48582. }));
  48583. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48584. }),$Error());
  48585. return self;
  48586. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  48587. },
  48588. args: [],
  48589. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  48590. referencedClasses: ["Error"],
  48591. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  48592. }),
  48593. $globals.BlockClosureTest);
  48594. $core.addMethod(
  48595. $core.method({
  48596. selector: "testExceptionSemantics",
  48597. protocol: 'tests',
  48598. fn: function (){
  48599. var self=this;
  48600. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48601. return $core.withContext(function($ctx1) {
  48602. self._timeout_((100));
  48603. $recv(self._async_((function(){
  48604. return $core.withContext(function($ctx2) {
  48605. return $recv((function(){
  48606. return $core.withContext(function($ctx3) {
  48607. self._assert_(true);
  48608. $recv($Error())._signal();
  48609. self._deny_(true);
  48610. return self._finished();
  48611. $ctx3.sendIdx["finished"]=1;
  48612. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48613. }))._on_do_($Error(),(function(ex){
  48614. return $core.withContext(function($ctx3) {
  48615. return self._finished();
  48616. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  48617. }));
  48618. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48619. })))._valueWithTimeout_((0));
  48620. return self;
  48621. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  48622. },
  48623. args: [],
  48624. 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",
  48625. referencedClasses: ["Error"],
  48626. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  48627. }),
  48628. $globals.BlockClosureTest);
  48629. $core.addMethod(
  48630. $core.method({
  48631. selector: "testLocalReturnOnDoCatch",
  48632. protocol: 'tests',
  48633. fn: function (){
  48634. var self=this;
  48635. return $core.withContext(function($ctx1) {
  48636. self._assert_equals_(self._localReturnOnDoCatch(),(2));
  48637. return self;
  48638. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  48639. },
  48640. args: [],
  48641. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  48642. referencedClasses: [],
  48643. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  48644. }),
  48645. $globals.BlockClosureTest);
  48646. $core.addMethod(
  48647. $core.method({
  48648. selector: "testLocalReturnOnDoMiss",
  48649. protocol: 'tests',
  48650. fn: function (){
  48651. var self=this;
  48652. return $core.withContext(function($ctx1) {
  48653. self._assert_equals_(self._localReturnOnDoMiss(),(2));
  48654. return self;
  48655. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  48656. },
  48657. args: [],
  48658. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  48659. referencedClasses: [],
  48660. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  48661. }),
  48662. $globals.BlockClosureTest);
  48663. $core.addMethod(
  48664. $core.method({
  48665. selector: "testNewWithValues",
  48666. protocol: 'tests',
  48667. fn: function (){
  48668. var self=this;
  48669. return $core.withContext(function($ctx1) {
  48670. function TestConstructor(arg1, arg2, arg3) {}
  48671. TestConstructor.prototype.name = 'theTestPrototype';
  48672. var wrappedConstructor = $recv(TestConstructor);
  48673. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  48674. self._assert_(result instanceof TestConstructor);
  48675. self._assert_equals_(result.name, 'theTestPrototype');
  48676. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  48677. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, $globals.Error);;
  48678. return self;
  48679. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  48680. },
  48681. args: [],
  48682. 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>",
  48683. referencedClasses: [],
  48684. messageSends: []
  48685. }),
  48686. $globals.BlockClosureTest);
  48687. $core.addMethod(
  48688. $core.method({
  48689. selector: "testNumArgs",
  48690. protocol: 'tests',
  48691. fn: function (){
  48692. var self=this;
  48693. return $core.withContext(function($ctx1) {
  48694. var $1;
  48695. $1=$recv((function(){
  48696. }))._numArgs();
  48697. $ctx1.sendIdx["numArgs"]=1;
  48698. self._assert_equals_($1,(0));
  48699. $ctx1.sendIdx["assert:equals:"]=1;
  48700. self._assert_equals_($recv((function(a,b){
  48701. }))._numArgs(),(2));
  48702. return self;
  48703. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  48704. },
  48705. args: [],
  48706. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  48707. referencedClasses: [],
  48708. messageSends: ["assert:equals:", "numArgs"]
  48709. }),
  48710. $globals.BlockClosureTest);
  48711. $core.addMethod(
  48712. $core.method({
  48713. selector: "testOnDo",
  48714. protocol: 'tests',
  48715. fn: function (){
  48716. var self=this;
  48717. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48718. return $core.withContext(function($ctx1) {
  48719. self._assert_($recv((function(){
  48720. return $core.withContext(function($ctx2) {
  48721. return $recv($recv($Error())._new())._signal();
  48722. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48723. }))._on_do_($Error(),(function(ex){
  48724. return true;
  48725. })));
  48726. return self;
  48727. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  48728. },
  48729. args: [],
  48730. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  48731. referencedClasses: ["Error"],
  48732. messageSends: ["assert:", "on:do:", "signal", "new"]
  48733. }),
  48734. $globals.BlockClosureTest);
  48735. $core.addMethod(
  48736. $core.method({
  48737. selector: "testValue",
  48738. protocol: 'tests',
  48739. fn: function (){
  48740. var self=this;
  48741. return $core.withContext(function($ctx1) {
  48742. var $1;
  48743. $1=$recv((function(){
  48744. return $core.withContext(function($ctx2) {
  48745. return (1).__plus((1));
  48746. $ctx2.sendIdx["+"]=1;
  48747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48748. }))._value();
  48749. $ctx1.sendIdx["value"]=1;
  48750. self._assert_equals_($1,(2));
  48751. $ctx1.sendIdx["assert:equals:"]=1;
  48752. self._assert_equals_($recv((function(x){
  48753. return $core.withContext(function($ctx2) {
  48754. return $recv(x).__plus((1));
  48755. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  48756. }))._value_((2)),(3));
  48757. $ctx1.sendIdx["assert:equals:"]=2;
  48758. self._assert_equals_($recv((function(x,y){
  48759. return $core.withContext(function($ctx2) {
  48760. return $recv(x).__star(y);
  48761. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  48762. }))._value_value_((2),(4)),(8));
  48763. $ctx1.sendIdx["assert:equals:"]=3;
  48764. self._assert_equals_($recv((function(a,b,c){
  48765. return (1);
  48766. }))._value(),(1));
  48767. return self;
  48768. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  48769. },
  48770. args: [],
  48771. 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",
  48772. referencedClasses: [],
  48773. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  48774. }),
  48775. $globals.BlockClosureTest);
  48776. $core.addMethod(
  48777. $core.method({
  48778. selector: "testValueWithPossibleArguments",
  48779. protocol: 'tests',
  48780. fn: function (){
  48781. var self=this;
  48782. return $core.withContext(function($ctx1) {
  48783. var $1,$2;
  48784. $1=$recv((function(){
  48785. return (1);
  48786. }))._valueWithPossibleArguments_([(3), (4)]);
  48787. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  48788. self._assert_equals_($1,(1));
  48789. $ctx1.sendIdx["assert:equals:"]=1;
  48790. $2=$recv((function(a){
  48791. return $core.withContext(function($ctx2) {
  48792. return $recv(a).__plus((4));
  48793. $ctx2.sendIdx["+"]=1;
  48794. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  48795. }))._valueWithPossibleArguments_([(3), (4)]);
  48796. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  48797. self._assert_equals_($2,(7));
  48798. $ctx1.sendIdx["assert:equals:"]=2;
  48799. self._assert_equals_($recv((function(a,b){
  48800. return $core.withContext(function($ctx2) {
  48801. return $recv(a).__plus(b);
  48802. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  48803. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  48804. return self;
  48805. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  48806. },
  48807. args: [],
  48808. 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.",
  48809. referencedClasses: [],
  48810. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  48811. }),
  48812. $globals.BlockClosureTest);
  48813. $core.addMethod(
  48814. $core.method({
  48815. selector: "testWhileFalse",
  48816. protocol: 'tests',
  48817. fn: function (){
  48818. var self=this;
  48819. var i;
  48820. return $core.withContext(function($ctx1) {
  48821. i=(0);
  48822. $recv((function(){
  48823. return $core.withContext(function($ctx2) {
  48824. return $recv(i).__gt((5));
  48825. $ctx2.sendIdx[">"]=1;
  48826. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48827. }))._whileFalse_((function(){
  48828. return $core.withContext(function($ctx2) {
  48829. i=$recv(i).__plus((1));
  48830. $ctx2.sendIdx["+"]=1;
  48831. return i;
  48832. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48833. }));
  48834. self._assert_equals_(i,(6));
  48835. $ctx1.sendIdx["assert:equals:"]=1;
  48836. i=(0);
  48837. $recv((function(){
  48838. return $core.withContext(function($ctx2) {
  48839. i=$recv(i).__plus((1));
  48840. i;
  48841. return $recv(i).__gt((5));
  48842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48843. }))._whileFalse();
  48844. self._assert_equals_(i,(6));
  48845. return self;
  48846. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  48847. },
  48848. args: [],
  48849. 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",
  48850. referencedClasses: [],
  48851. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  48852. }),
  48853. $globals.BlockClosureTest);
  48854. $core.addMethod(
  48855. $core.method({
  48856. selector: "testWhileTrue",
  48857. protocol: 'tests',
  48858. fn: function (){
  48859. var self=this;
  48860. var i;
  48861. return $core.withContext(function($ctx1) {
  48862. i=(0);
  48863. $recv((function(){
  48864. return $core.withContext(function($ctx2) {
  48865. return $recv(i).__lt((5));
  48866. $ctx2.sendIdx["<"]=1;
  48867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48868. }))._whileTrue_((function(){
  48869. return $core.withContext(function($ctx2) {
  48870. i=$recv(i).__plus((1));
  48871. $ctx2.sendIdx["+"]=1;
  48872. return i;
  48873. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48874. }));
  48875. self._assert_equals_(i,(5));
  48876. $ctx1.sendIdx["assert:equals:"]=1;
  48877. i=(0);
  48878. $recv((function(){
  48879. return $core.withContext(function($ctx2) {
  48880. i=$recv(i).__plus((1));
  48881. i;
  48882. return $recv(i).__lt((5));
  48883. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48884. }))._whileTrue();
  48885. self._assert_equals_(i,(5));
  48886. return self;
  48887. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  48888. },
  48889. args: [],
  48890. 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",
  48891. referencedClasses: [],
  48892. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  48893. }),
  48894. $globals.BlockClosureTest);
  48895. $core.addClass('BooleanTest', $globals.TestCase, [], 'Kernel-Tests');
  48896. $core.addMethod(
  48897. $core.method({
  48898. selector: "testEquality",
  48899. protocol: 'tests',
  48900. fn: function (){
  48901. var self=this;
  48902. return $core.withContext(function($ctx1) {
  48903. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  48904. $1=(0).__eq(false);
  48905. $ctx1.sendIdx["="]=1;
  48906. self._deny_($1);
  48907. $ctx1.sendIdx["deny:"]=1;
  48908. $2=false.__eq((0));
  48909. $ctx1.sendIdx["="]=2;
  48910. self._deny_($2);
  48911. $ctx1.sendIdx["deny:"]=2;
  48912. $3="".__eq(false);
  48913. $ctx1.sendIdx["="]=3;
  48914. self._deny_($3);
  48915. $ctx1.sendIdx["deny:"]=3;
  48916. $4=false.__eq("");
  48917. $ctx1.sendIdx["="]=4;
  48918. self._deny_($4);
  48919. $ctx1.sendIdx["deny:"]=4;
  48920. $5=true.__eq(true);
  48921. $ctx1.sendIdx["="]=5;
  48922. self._assert_($5);
  48923. $ctx1.sendIdx["assert:"]=1;
  48924. $6=false.__eq(true);
  48925. $ctx1.sendIdx["="]=6;
  48926. self._deny_($6);
  48927. $ctx1.sendIdx["deny:"]=5;
  48928. $7=true.__eq(false);
  48929. $ctx1.sendIdx["="]=7;
  48930. self._deny_($7);
  48931. $8=false.__eq(false);
  48932. $ctx1.sendIdx["="]=8;
  48933. self._assert_($8);
  48934. $ctx1.sendIdx["assert:"]=2;
  48935. $10=true._yourself();
  48936. $ctx1.sendIdx["yourself"]=1;
  48937. $9=$recv($10).__eq(true);
  48938. $ctx1.sendIdx["="]=9;
  48939. self._assert_($9);
  48940. $ctx1.sendIdx["assert:"]=3;
  48941. $12=true._yourself();
  48942. $ctx1.sendIdx["yourself"]=2;
  48943. $11=$recv($12).__eq(true._yourself());
  48944. self._assert_($11);
  48945. return self;
  48946. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  48947. },
  48948. args: [],
  48949. 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)",
  48950. referencedClasses: [],
  48951. messageSends: ["deny:", "=", "assert:", "yourself"]
  48952. }),
  48953. $globals.BooleanTest);
  48954. $core.addMethod(
  48955. $core.method({
  48956. selector: "testIdentity",
  48957. protocol: 'tests',
  48958. fn: function (){
  48959. var self=this;
  48960. return $core.withContext(function($ctx1) {
  48961. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  48962. $1=(0).__eq_eq(false);
  48963. $ctx1.sendIdx["=="]=1;
  48964. self._deny_($1);
  48965. $ctx1.sendIdx["deny:"]=1;
  48966. $2=false.__eq_eq((0));
  48967. $ctx1.sendIdx["=="]=2;
  48968. self._deny_($2);
  48969. $ctx1.sendIdx["deny:"]=2;
  48970. $3="".__eq_eq(false);
  48971. $ctx1.sendIdx["=="]=3;
  48972. self._deny_($3);
  48973. $ctx1.sendIdx["deny:"]=3;
  48974. $4=false.__eq_eq("");
  48975. $ctx1.sendIdx["=="]=4;
  48976. self._deny_($4);
  48977. $ctx1.sendIdx["deny:"]=4;
  48978. $5=true.__eq_eq(true);
  48979. $ctx1.sendIdx["=="]=5;
  48980. self._assert_($5);
  48981. $ctx1.sendIdx["assert:"]=1;
  48982. $6=false.__eq_eq(true);
  48983. $ctx1.sendIdx["=="]=6;
  48984. self._deny_($6);
  48985. $ctx1.sendIdx["deny:"]=5;
  48986. $7=true.__eq_eq(false);
  48987. $ctx1.sendIdx["=="]=7;
  48988. self._deny_($7);
  48989. $8=false.__eq_eq(false);
  48990. $ctx1.sendIdx["=="]=8;
  48991. self._assert_($8);
  48992. $ctx1.sendIdx["assert:"]=2;
  48993. $10=true._yourself();
  48994. $ctx1.sendIdx["yourself"]=1;
  48995. $9=$recv($10).__eq_eq(true);
  48996. $ctx1.sendIdx["=="]=9;
  48997. self._assert_($9);
  48998. $ctx1.sendIdx["assert:"]=3;
  48999. $12=true._yourself();
  49000. $ctx1.sendIdx["yourself"]=2;
  49001. $11=$recv($12).__eq_eq(true._yourself());
  49002. self._assert_($11);
  49003. return self;
  49004. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  49005. },
  49006. args: [],
  49007. 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",
  49008. referencedClasses: [],
  49009. messageSends: ["deny:", "==", "assert:", "yourself"]
  49010. }),
  49011. $globals.BooleanTest);
  49012. $core.addMethod(
  49013. $core.method({
  49014. selector: "testIfTrueIfFalse",
  49015. protocol: 'tests',
  49016. fn: function (){
  49017. var self=this;
  49018. return $core.withContext(function($ctx1) {
  49019. var $1,$2,$3,$4,$5,$6,$7,$8;
  49020. if($core.assert(true)){
  49021. $1="alternative block";
  49022. };
  49023. self._assert_equals_($1,"alternative block");
  49024. $ctx1.sendIdx["assert:equals:"]=1;
  49025. if(!$core.assert(true)){
  49026. $2="alternative block";
  49027. };
  49028. self._assert_equals_($2,nil);
  49029. $ctx1.sendIdx["assert:equals:"]=2;
  49030. if($core.assert(false)){
  49031. $3="alternative block";
  49032. };
  49033. self._assert_equals_($3,nil);
  49034. $ctx1.sendIdx["assert:equals:"]=3;
  49035. if(!$core.assert(false)){
  49036. $4="alternative block";
  49037. };
  49038. self._assert_equals_($4,"alternative block");
  49039. $ctx1.sendIdx["assert:equals:"]=4;
  49040. if($core.assert(false)){
  49041. $5="alternative block";
  49042. } else {
  49043. $5="alternative block2";
  49044. };
  49045. self._assert_equals_($5,"alternative block2");
  49046. $ctx1.sendIdx["assert:equals:"]=5;
  49047. if($core.assert(false)){
  49048. $6="alternative block2";
  49049. } else {
  49050. $6="alternative block";
  49051. };
  49052. self._assert_equals_($6,"alternative block");
  49053. $ctx1.sendIdx["assert:equals:"]=6;
  49054. if($core.assert(true)){
  49055. $7="alternative block";
  49056. } else {
  49057. $7="alternative block2";
  49058. };
  49059. self._assert_equals_($7,"alternative block");
  49060. $ctx1.sendIdx["assert:equals:"]=7;
  49061. if($core.assert(true)){
  49062. $8="alternative block2";
  49063. } else {
  49064. $8="alternative block";
  49065. };
  49066. self._assert_equals_($8,"alternative block2");
  49067. return self;
  49068. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  49069. },
  49070. args: [],
  49071. 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'.",
  49072. referencedClasses: [],
  49073. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  49074. }),
  49075. $globals.BooleanTest);
  49076. $core.addMethod(
  49077. $core.method({
  49078. selector: "testIfTrueIfFalseWithBoxing",
  49079. protocol: 'tests',
  49080. fn: function (){
  49081. var self=this;
  49082. return $core.withContext(function($ctx1) {
  49083. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  49084. $2=true._yourself();
  49085. $ctx1.sendIdx["yourself"]=1;
  49086. if($core.assert($2)){
  49087. $1="alternative block";
  49088. };
  49089. self._assert_equals_($1,"alternative block");
  49090. $ctx1.sendIdx["assert:equals:"]=1;
  49091. $4=true._yourself();
  49092. $ctx1.sendIdx["yourself"]=2;
  49093. if(!$core.assert($4)){
  49094. $3="alternative block";
  49095. };
  49096. self._assert_equals_($3,nil);
  49097. $ctx1.sendIdx["assert:equals:"]=2;
  49098. $6=false._yourself();
  49099. $ctx1.sendIdx["yourself"]=3;
  49100. if($core.assert($6)){
  49101. $5="alternative block";
  49102. };
  49103. self._assert_equals_($5,nil);
  49104. $ctx1.sendIdx["assert:equals:"]=3;
  49105. $8=false._yourself();
  49106. $ctx1.sendIdx["yourself"]=4;
  49107. if(!$core.assert($8)){
  49108. $7="alternative block";
  49109. };
  49110. self._assert_equals_($7,"alternative block");
  49111. $ctx1.sendIdx["assert:equals:"]=4;
  49112. $10=false._yourself();
  49113. $ctx1.sendIdx["yourself"]=5;
  49114. if($core.assert($10)){
  49115. $9="alternative block";
  49116. } else {
  49117. $9="alternative block2";
  49118. };
  49119. self._assert_equals_($9,"alternative block2");
  49120. $ctx1.sendIdx["assert:equals:"]=5;
  49121. $12=false._yourself();
  49122. $ctx1.sendIdx["yourself"]=6;
  49123. if($core.assert($12)){
  49124. $11="alternative block2";
  49125. } else {
  49126. $11="alternative block";
  49127. };
  49128. self._assert_equals_($11,"alternative block");
  49129. $ctx1.sendIdx["assert:equals:"]=6;
  49130. $14=true._yourself();
  49131. $ctx1.sendIdx["yourself"]=7;
  49132. if($core.assert($14)){
  49133. $13="alternative block";
  49134. } else {
  49135. $13="alternative block2";
  49136. };
  49137. self._assert_equals_($13,"alternative block");
  49138. $ctx1.sendIdx["assert:equals:"]=7;
  49139. $16=true._yourself();
  49140. if($core.assert($16)){
  49141. $15="alternative block2";
  49142. } else {
  49143. $15="alternative block";
  49144. };
  49145. self._assert_equals_($15,"alternative block2");
  49146. return self;
  49147. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  49148. },
  49149. args: [],
  49150. 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'.",
  49151. referencedClasses: [],
  49152. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  49153. }),
  49154. $globals.BooleanTest);
  49155. $core.addMethod(
  49156. $core.method({
  49157. selector: "testLogic",
  49158. protocol: 'tests',
  49159. fn: function (){
  49160. var self=this;
  49161. return $core.withContext(function($ctx1) {
  49162. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$17,$18,$16,$15,$20,$19,$22,$21,$25,$24,$23;
  49163. $1=true.__and(true);
  49164. $ctx1.sendIdx["&"]=1;
  49165. self._assert_($1);
  49166. $ctx1.sendIdx["assert:"]=1;
  49167. $2=true.__and(false);
  49168. $ctx1.sendIdx["&"]=2;
  49169. self._deny_($2);
  49170. $ctx1.sendIdx["deny:"]=1;
  49171. $3=false.__and(true);
  49172. $ctx1.sendIdx["&"]=3;
  49173. self._deny_($3);
  49174. $ctx1.sendIdx["deny:"]=2;
  49175. $5=false.__and(false);
  49176. $ctx1.sendIdx["&"]=4;
  49177. $4=self._deny_($5);
  49178. $ctx1.sendIdx["deny:"]=3;
  49179. $6=true.__or(true);
  49180. $ctx1.sendIdx["|"]=1;
  49181. self._assert_($6);
  49182. $ctx1.sendIdx["assert:"]=2;
  49183. $7=true.__or(false);
  49184. $ctx1.sendIdx["|"]=2;
  49185. self._assert_($7);
  49186. $ctx1.sendIdx["assert:"]=3;
  49187. $8=false.__or(true);
  49188. $ctx1.sendIdx["|"]=3;
  49189. self._assert_($8);
  49190. $ctx1.sendIdx["assert:"]=4;
  49191. $10=false.__or(false);
  49192. $ctx1.sendIdx["|"]=4;
  49193. $9=self._deny_($10);
  49194. $ctx1.sendIdx["deny:"]=4;
  49195. $12=(1).__gt((0));
  49196. $ctx1.sendIdx[">"]=1;
  49197. $11=true.__and($12);
  49198. $ctx1.sendIdx["&"]=5;
  49199. self._assert_($11);
  49200. $ctx1.sendIdx["assert:"]=5;
  49201. $14=(1).__gt((0));
  49202. $ctx1.sendIdx[">"]=2;
  49203. $13=$recv($14).__and(false);
  49204. $ctx1.sendIdx["&"]=6;
  49205. self._deny_($13);
  49206. $ctx1.sendIdx["deny:"]=5;
  49207. $17=(1).__gt((0));
  49208. $ctx1.sendIdx[">"]=3;
  49209. $18=(1).__gt((2));
  49210. $ctx1.sendIdx[">"]=4;
  49211. $16=$recv($17).__and($18);
  49212. $15=self._deny_($16);
  49213. $20=(1).__gt((0));
  49214. $ctx1.sendIdx[">"]=5;
  49215. $19=false.__or($20);
  49216. $ctx1.sendIdx["|"]=5;
  49217. self._assert_($19);
  49218. $ctx1.sendIdx["assert:"]=6;
  49219. $22=(1).__gt((0));
  49220. $ctx1.sendIdx[">"]=6;
  49221. $21=$recv($22).__or(false);
  49222. $ctx1.sendIdx["|"]=6;
  49223. self._assert_($21);
  49224. $ctx1.sendIdx["assert:"]=7;
  49225. $25=(1).__gt((0));
  49226. $ctx1.sendIdx[">"]=7;
  49227. $24=$recv($25).__or((1).__gt((2)));
  49228. $23=self._assert_($24);
  49229. return self;
  49230. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  49231. },
  49232. args: [],
  49233. 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))",
  49234. referencedClasses: [],
  49235. messageSends: ["assert:", "&", "deny:", "|", ">"]
  49236. }),
  49237. $globals.BooleanTest);
  49238. $core.addMethod(
  49239. $core.method({
  49240. selector: "testLogicKeywords",
  49241. protocol: 'tests',
  49242. fn: function (){
  49243. var self=this;
  49244. return $core.withContext(function($ctx1) {
  49245. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  49246. $1=true._and_((function(){
  49247. return true;
  49248. }));
  49249. $ctx1.sendIdx["and:"]=1;
  49250. self._assert_($1);
  49251. $ctx1.sendIdx["assert:"]=1;
  49252. $2=true._and_((function(){
  49253. return false;
  49254. }));
  49255. $ctx1.sendIdx["and:"]=2;
  49256. self._deny_($2);
  49257. $ctx1.sendIdx["deny:"]=1;
  49258. $3=false._and_((function(){
  49259. return true;
  49260. }));
  49261. $ctx1.sendIdx["and:"]=3;
  49262. self._deny_($3);
  49263. $ctx1.sendIdx["deny:"]=2;
  49264. $5=false._and_((function(){
  49265. return false;
  49266. }));
  49267. $ctx1.sendIdx["and:"]=4;
  49268. $4=self._deny_($5);
  49269. $ctx1.sendIdx["deny:"]=3;
  49270. $6=true._or_((function(){
  49271. return true;
  49272. }));
  49273. $ctx1.sendIdx["or:"]=1;
  49274. self._assert_($6);
  49275. $ctx1.sendIdx["assert:"]=2;
  49276. $7=true._or_((function(){
  49277. return false;
  49278. }));
  49279. $ctx1.sendIdx["or:"]=2;
  49280. self._assert_($7);
  49281. $ctx1.sendIdx["assert:"]=3;
  49282. $8=false._or_((function(){
  49283. return true;
  49284. }));
  49285. $ctx1.sendIdx["or:"]=3;
  49286. self._assert_($8);
  49287. $ctx1.sendIdx["assert:"]=4;
  49288. $10=false._or_((function(){
  49289. return false;
  49290. }));
  49291. $ctx1.sendIdx["or:"]=4;
  49292. $9=self._deny_($10);
  49293. $ctx1.sendIdx["deny:"]=4;
  49294. $11=true._and_((function(){
  49295. return $core.withContext(function($ctx2) {
  49296. return (1).__gt((0));
  49297. $ctx2.sendIdx[">"]=1;
  49298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  49299. }));
  49300. $ctx1.sendIdx["and:"]=5;
  49301. self._assert_($11);
  49302. $ctx1.sendIdx["assert:"]=5;
  49303. $13=(1).__gt((0));
  49304. $ctx1.sendIdx[">"]=2;
  49305. $12=$recv($13)._and_((function(){
  49306. return false;
  49307. }));
  49308. $ctx1.sendIdx["and:"]=6;
  49309. self._deny_($12);
  49310. $ctx1.sendIdx["deny:"]=5;
  49311. $16=(1).__gt((0));
  49312. $ctx1.sendIdx[">"]=3;
  49313. $15=$recv($16)._and_((function(){
  49314. return $core.withContext(function($ctx2) {
  49315. return (1).__gt((2));
  49316. $ctx2.sendIdx[">"]=4;
  49317. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  49318. }));
  49319. $14=self._deny_($15);
  49320. $17=false._or_((function(){
  49321. return $core.withContext(function($ctx2) {
  49322. return (1).__gt((0));
  49323. $ctx2.sendIdx[">"]=5;
  49324. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  49325. }));
  49326. $ctx1.sendIdx["or:"]=5;
  49327. self._assert_($17);
  49328. $ctx1.sendIdx["assert:"]=6;
  49329. $19=(1).__gt((0));
  49330. $ctx1.sendIdx[">"]=6;
  49331. $18=$recv($19)._or_((function(){
  49332. return false;
  49333. }));
  49334. $ctx1.sendIdx["or:"]=6;
  49335. self._assert_($18);
  49336. $ctx1.sendIdx["assert:"]=7;
  49337. $22=(1).__gt((0));
  49338. $ctx1.sendIdx[">"]=7;
  49339. $21=$recv($22)._or_((function(){
  49340. return $core.withContext(function($ctx2) {
  49341. return (1).__gt((2));
  49342. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  49343. }));
  49344. $20=self._assert_($21);
  49345. return self;
  49346. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  49347. },
  49348. args: [],
  49349. 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 ])",
  49350. referencedClasses: [],
  49351. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  49352. }),
  49353. $globals.BooleanTest);
  49354. $core.addMethod(
  49355. $core.method({
  49356. selector: "testNonBooleanError",
  49357. protocol: 'tests',
  49358. fn: function (){
  49359. var self=this;
  49360. function $NonBooleanReceiver(){return $globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  49361. return $core.withContext(function($ctx1) {
  49362. self._should_raise_((function(){
  49363. return $core.withContext(function($ctx2) {
  49364. if($core.assert("")){
  49365. } else {
  49366. };
  49367. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49368. }),$NonBooleanReceiver());
  49369. return self;
  49370. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  49371. },
  49372. args: [],
  49373. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  49374. referencedClasses: ["NonBooleanReceiver"],
  49375. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  49376. }),
  49377. $globals.BooleanTest);
  49378. $core.addClass('ClassBuilderTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  49379. $core.addMethod(
  49380. $core.method({
  49381. selector: "setUp",
  49382. protocol: 'running',
  49383. fn: function (){
  49384. var self=this;
  49385. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  49386. return $core.withContext(function($ctx1) {
  49387. self["@builder"]=$recv($ClassBuilder())._new();
  49388. return self;
  49389. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  49390. },
  49391. args: [],
  49392. source: "setUp\x0a\x09builder := ClassBuilder new",
  49393. referencedClasses: ["ClassBuilder"],
  49394. messageSends: ["new"]
  49395. }),
  49396. $globals.ClassBuilderTest);
  49397. $core.addMethod(
  49398. $core.method({
  49399. selector: "tearDown",
  49400. protocol: 'running',
  49401. fn: function (){
  49402. var self=this;
  49403. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49404. return $core.withContext(function($ctx1) {
  49405. var $1,$receiver;
  49406. $1=self["@theClass"];
  49407. if(($receiver = $1) == null || $receiver.isNil){
  49408. $1;
  49409. } else {
  49410. $recv($Smalltalk())._removeClass_(self["@theClass"]);
  49411. self["@theClass"]=nil;
  49412. self["@theClass"];
  49413. };
  49414. return self;
  49415. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  49416. },
  49417. args: [],
  49418. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  49419. referencedClasses: ["Smalltalk"],
  49420. messageSends: ["ifNotNil:", "removeClass:"]
  49421. }),
  49422. $globals.ClassBuilderTest);
  49423. $core.addMethod(
  49424. $core.method({
  49425. selector: "testClassCopy",
  49426. protocol: 'tests',
  49427. fn: function (){
  49428. var self=this;
  49429. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49430. return $core.withContext(function($ctx1) {
  49431. var $2,$1,$4,$3,$6,$5,$8,$7;
  49432. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  49433. $2=$recv(self["@theClass"])._superclass();
  49434. $ctx1.sendIdx["superclass"]=1;
  49435. $1=$recv($2).__eq_eq($recv($ObjectMock())._superclass());
  49436. $ctx1.sendIdx["=="]=1;
  49437. self._assert_($1);
  49438. $ctx1.sendIdx["assert:"]=1;
  49439. $4=$recv(self["@theClass"])._instanceVariableNames();
  49440. $ctx1.sendIdx["instanceVariableNames"]=1;
  49441. $3=$recv($4).__eq_eq($recv($ObjectMock())._instanceVariableNames());
  49442. $ctx1.sendIdx["=="]=2;
  49443. self._assert_($3);
  49444. $ctx1.sendIdx["assert:"]=2;
  49445. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  49446. $ctx1.sendIdx["assert:equals:"]=1;
  49447. $6=$recv(self["@theClass"])._package();
  49448. $ctx1.sendIdx["package"]=1;
  49449. $5=$recv($6).__eq_eq($recv($ObjectMock())._package());
  49450. self._assert_($5);
  49451. $8=$recv(self["@theClass"])._methodDictionary();
  49452. $ctx1.sendIdx["methodDictionary"]=1;
  49453. $7=$recv($8)._keys();
  49454. $ctx1.sendIdx["keys"]=1;
  49455. self._assert_equals_($7,$recv($recv($ObjectMock())._methodDictionary())._keys());
  49456. return self;
  49457. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  49458. },
  49459. args: [],
  49460. 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",
  49461. referencedClasses: ["ObjectMock"],
  49462. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"]
  49463. }),
  49464. $globals.ClassBuilderTest);
  49465. $core.addMethod(
  49466. $core.method({
  49467. selector: "testClassMigration",
  49468. protocol: 'tests',
  49469. fn: function (){
  49470. var self=this;
  49471. var instance,oldClass;
  49472. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49473. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49474. function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  49475. return $core.withContext(function($ctx1) {
  49476. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  49477. oldClass=$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  49478. $2=$recv($Smalltalk())._globals();
  49479. $ctx1.sendIdx["globals"]=1;
  49480. $1=$recv($2)._at_("ObjectMock2");
  49481. $ctx1.sendIdx["at:"]=1;
  49482. instance=$recv($1)._new();
  49483. $4=$recv($Smalltalk())._globals();
  49484. $ctx1.sendIdx["globals"]=2;
  49485. $3=$recv($4)._at_("ObjectMock2");
  49486. $ctx1.sendIdx["at:"]=2;
  49487. $recv($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  49488. $5=$recv(oldClass).__eq_eq($ObjectMock2());
  49489. $ctx1.sendIdx["=="]=1;
  49490. self._deny_($5);
  49491. $ctx1.sendIdx["deny:"]=1;
  49492. $6=$recv($recv($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  49493. $ctx1.sendIdx["=="]=2;
  49494. self._assert_($6);
  49495. $ctx1.sendIdx["assert:"]=1;
  49496. self._assert_($recv($recv($ObjectMock2())._instanceVariableNames())._isEmpty());
  49497. $ctx1.sendIdx["assert:"]=2;
  49498. $7=$recv($ObjectMock2())._selectors();
  49499. $ctx1.sendIdx["selectors"]=1;
  49500. self._assert_equals_($7,$recv(oldClass)._selectors());
  49501. $ctx1.sendIdx["assert:equals:"]=1;
  49502. $8=$recv($ObjectMock2())._comment();
  49503. $ctx1.sendIdx["comment"]=1;
  49504. self._assert_equals_($8,$recv(oldClass)._comment());
  49505. $ctx1.sendIdx["assert:equals:"]=2;
  49506. $9=$recv($recv($ObjectMock2())._package())._name();
  49507. $ctx1.sendIdx["name"]=1;
  49508. self._assert_equals_($9,"Kernel-Tests");
  49509. $11=$recv(instance)._class();
  49510. $ctx1.sendIdx["class"]=1;
  49511. $10=$recv($11).__eq_eq($ObjectMock2());
  49512. self._deny_($10);
  49513. self._assert_($recv($recv($recv($Smalltalk())._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  49514. $recv($Smalltalk())._removeClass_($ObjectMock2());
  49515. return self;
  49516. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  49517. },
  49518. args: [],
  49519. 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",
  49520. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  49521. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"]
  49522. }),
  49523. $globals.ClassBuilderTest);
  49524. $core.addMethod(
  49525. $core.method({
  49526. selector: "testClassMigrationWithClassInstanceVariables",
  49527. protocol: 'tests',
  49528. fn: function (){
  49529. var self=this;
  49530. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49531. function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  49532. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49533. return $core.withContext(function($ctx1) {
  49534. var $1;
  49535. $recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  49536. $1=$recv($ObjectMock2())._class();
  49537. $ctx1.sendIdx["class"]=1;
  49538. $recv($1)._instanceVariableNames_("foo bar");
  49539. $recv($ObjectMock())._subclass_instanceVariableNames_package_($recv($recv($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  49540. self._assert_equals_($recv($recv($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  49541. $recv($Smalltalk())._removeClass_($ObjectMock2());
  49542. return self;
  49543. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  49544. },
  49545. args: [],
  49546. 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",
  49547. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  49548. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  49549. }),
  49550. $globals.ClassBuilderTest);
  49551. $core.addMethod(
  49552. $core.method({
  49553. selector: "testClassMigrationWithSubclasses",
  49554. protocol: 'tests',
  49555. fn: function (){
  49556. var self=this;
  49557. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49558. function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  49559. function $ObjectMock3(){return $globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  49560. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49561. function $ObjectMock4(){return $globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  49562. return $core.withContext(function($ctx1) {
  49563. var $2,$1,$4,$3;
  49564. $recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  49565. $recv($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  49566. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  49567. $recv($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  49568. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  49569. $recv($ObjectMock())._subclass_instanceVariableNames_package_($recv($recv($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  49570. $2=$recv($ObjectMock())._subclasses();
  49571. $ctx1.sendIdx["subclasses"]=1;
  49572. $1=$recv($2)._includes_($ObjectMock2());
  49573. $ctx1.sendIdx["includes:"]=1;
  49574. self._assert_($1);
  49575. $ctx1.sendIdx["assert:"]=1;
  49576. $4=$recv($ObjectMock2())._subclasses();
  49577. $ctx1.sendIdx["subclasses"]=2;
  49578. $3=$recv($4)._includes_($ObjectMock3());
  49579. $ctx1.sendIdx["includes:"]=2;
  49580. self._assert_($3);
  49581. $ctx1.sendIdx["assert:"]=2;
  49582. self._assert_($recv($recv($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  49583. $recv($recv($ObjectMock())._allSubclasses())._do_((function(each){
  49584. return $core.withContext(function($ctx2) {
  49585. return $recv($Smalltalk())._removeClass_(each);
  49586. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49587. }));
  49588. return self;
  49589. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  49590. },
  49591. args: [],
  49592. 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 ]",
  49593. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  49594. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"]
  49595. }),
  49596. $globals.ClassBuilderTest);
  49597. $core.addMethod(
  49598. $core.method({
  49599. selector: "testInstanceVariableNames",
  49600. protocol: 'tests',
  49601. fn: function (){
  49602. var self=this;
  49603. return $core.withContext(function($ctx1) {
  49604. self._assert_equals_($recv(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  49605. return self;
  49606. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  49607. },
  49608. args: [],
  49609. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  49610. referencedClasses: [],
  49611. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  49612. }),
  49613. $globals.ClassBuilderTest);
  49614. $core.addClass('ClassTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  49615. $core.addMethod(
  49616. $core.method({
  49617. selector: "jsConstructor",
  49618. protocol: 'running',
  49619. fn: function (){
  49620. var self=this;
  49621. return $core.withContext(function($ctx1) {
  49622. function Foo(){}
  49623. Foo.prototype.valueOf = function () {return 4;};
  49624. return Foo;
  49625. ;
  49626. return self;
  49627. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  49628. },
  49629. args: [],
  49630. source: "jsConstructor\x0a\x09<\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09>",
  49631. referencedClasses: [],
  49632. messageSends: []
  49633. }),
  49634. $globals.ClassTest);
  49635. $core.addMethod(
  49636. $core.method({
  49637. selector: "setUp",
  49638. protocol: 'running',
  49639. fn: function (){
  49640. var self=this;
  49641. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  49642. return $core.withContext(function($ctx1) {
  49643. self["@builder"]=$recv($ClassBuilder())._new();
  49644. return self;
  49645. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  49646. },
  49647. args: [],
  49648. source: "setUp\x0a\x09builder := ClassBuilder new",
  49649. referencedClasses: ["ClassBuilder"],
  49650. messageSends: ["new"]
  49651. }),
  49652. $globals.ClassTest);
  49653. $core.addMethod(
  49654. $core.method({
  49655. selector: "tearDown",
  49656. protocol: 'running',
  49657. fn: function (){
  49658. var self=this;
  49659. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49660. return $core.withContext(function($ctx1) {
  49661. var $1,$receiver;
  49662. $1=self["@theClass"];
  49663. if(($receiver = $1) == null || $receiver.isNil){
  49664. $1;
  49665. } else {
  49666. $recv($Smalltalk())._removeClass_(self["@theClass"]);
  49667. self["@theClass"]=nil;
  49668. self["@theClass"];
  49669. };
  49670. return self;
  49671. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  49672. },
  49673. args: [],
  49674. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  49675. referencedClasses: ["Smalltalk"],
  49676. messageSends: ["ifNotNil:", "removeClass:"]
  49677. }),
  49678. $globals.ClassTest);
  49679. $core.addMethod(
  49680. $core.method({
  49681. selector: "testSetJavaScriptConstructor",
  49682. protocol: 'tests',
  49683. fn: function (){
  49684. var self=this;
  49685. var instance;
  49686. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49687. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  49688. return $core.withContext(function($ctx1) {
  49689. var $2,$1,$4,$3,$6,$5,$8,$7;
  49690. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  49691. $recv(self["@theClass"])._javascriptConstructor_(self._jsConstructor());
  49692. $2=$recv(self["@theClass"])._superclass();
  49693. $ctx1.sendIdx["superclass"]=1;
  49694. $1=$recv($2).__eq_eq($recv($ObjectMock())._superclass());
  49695. $ctx1.sendIdx["=="]=1;
  49696. self._assert_($1);
  49697. $ctx1.sendIdx["assert:"]=1;
  49698. $4=$recv(self["@theClass"])._instanceVariableNames();
  49699. $ctx1.sendIdx["instanceVariableNames"]=1;
  49700. $3=$recv($4).__eq_eq($recv($ObjectMock())._instanceVariableNames());
  49701. $ctx1.sendIdx["=="]=2;
  49702. self._assert_($3);
  49703. $ctx1.sendIdx["assert:"]=2;
  49704. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  49705. $ctx1.sendIdx["assert:equals:"]=1;
  49706. $6=$recv(self["@theClass"])._package();
  49707. $ctx1.sendIdx["package"]=1;
  49708. $5=$recv($6).__eq_eq($recv($ObjectMock())._package());
  49709. $ctx1.sendIdx["=="]=3;
  49710. self._assert_($5);
  49711. $ctx1.sendIdx["assert:"]=3;
  49712. $8=$recv(self["@theClass"])._methodDictionary();
  49713. $ctx1.sendIdx["methodDictionary"]=1;
  49714. $7=$recv($8)._keys();
  49715. $ctx1.sendIdx["keys"]=1;
  49716. self._assert_equals_($7,$recv($recv($ObjectMock())._methodDictionary())._keys());
  49717. $ctx1.sendIdx["assert:equals:"]=2;
  49718. instance=$recv(self["@theClass"])._new();
  49719. self._assert_($recv($recv(instance)._class()).__eq_eq(self["@theClass"]));
  49720. self._assert_equals_($recv(instance)._value(),(4));
  49721. $ctx1.sendIdx["assert:equals:"]=3;
  49722. self._shouldnt_raise_((function(){
  49723. return $core.withContext(function($ctx2) {
  49724. return $recv(instance)._foo_((9));
  49725. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49726. }),$Error());
  49727. self._assert_equals_($recv(instance)._foo(),(9));
  49728. return self;
  49729. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  49730. },
  49731. args: [],
  49732. 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",
  49733. referencedClasses: ["ObjectMock", "Error"],
  49734. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  49735. }),
  49736. $globals.ClassTest);
  49737. $core.addClass('CollectionTest', $globals.TestCase, [], 'Kernel-Tests');
  49738. $core.addMethod(
  49739. $core.method({
  49740. selector: "assertSameContents:as:",
  49741. protocol: 'convenience',
  49742. fn: function (aCollection,anotherCollection){
  49743. var self=this;
  49744. return $core.withContext(function($ctx1) {
  49745. var $2,$1,$4,$3;
  49746. $2=$recv(aCollection)._size();
  49747. $ctx1.sendIdx["size"]=1;
  49748. $1=$recv($2).__eq($recv(anotherCollection)._size());
  49749. $ctx1.sendIdx["="]=1;
  49750. self._assert_($1);
  49751. $ctx1.sendIdx["assert:"]=1;
  49752. $recv(aCollection)._do_((function(each){
  49753. return $core.withContext(function($ctx2) {
  49754. $4=$recv(aCollection)._occurrencesOf_(each);
  49755. $ctx2.sendIdx["occurrencesOf:"]=1;
  49756. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  49757. return self._assert_($3);
  49758. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49759. }));
  49760. return self;
  49761. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  49762. },
  49763. args: ["aCollection", "anotherCollection"],
  49764. 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)) ]",
  49765. referencedClasses: [],
  49766. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  49767. }),
  49768. $globals.CollectionTest);
  49769. $core.addMethod(
  49770. $core.method({
  49771. selector: "collection",
  49772. protocol: 'fixture',
  49773. fn: function (){
  49774. var self=this;
  49775. return $core.withContext(function($ctx1) {
  49776. self._subclassResponsibility();
  49777. return self;
  49778. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  49779. },
  49780. args: [],
  49781. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  49782. referencedClasses: [],
  49783. messageSends: ["subclassResponsibility"]
  49784. }),
  49785. $globals.CollectionTest);
  49786. $core.addMethod(
  49787. $core.method({
  49788. selector: "collectionClass",
  49789. protocol: 'fixture',
  49790. fn: function (){
  49791. var self=this;
  49792. return $core.withContext(function($ctx1) {
  49793. var $1;
  49794. $1=$recv(self._class())._collectionClass();
  49795. return $1;
  49796. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  49797. },
  49798. args: [],
  49799. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  49800. referencedClasses: [],
  49801. messageSends: ["collectionClass", "class"]
  49802. }),
  49803. $globals.CollectionTest);
  49804. $core.addMethod(
  49805. $core.method({
  49806. selector: "collectionOfPrintStrings",
  49807. protocol: 'fixture',
  49808. fn: function (){
  49809. var self=this;
  49810. return $core.withContext(function($ctx1) {
  49811. self._subclassResponsibility();
  49812. return self;
  49813. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  49814. },
  49815. args: [],
  49816. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  49817. referencedClasses: [],
  49818. messageSends: ["subclassResponsibility"]
  49819. }),
  49820. $globals.CollectionTest);
  49821. $core.addMethod(
  49822. $core.method({
  49823. selector: "collectionSize",
  49824. protocol: 'fixture',
  49825. fn: function (){
  49826. var self=this;
  49827. return $core.withContext(function($ctx1) {
  49828. self._subclassResponsibility();
  49829. return self;
  49830. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  49831. },
  49832. args: [],
  49833. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  49834. referencedClasses: [],
  49835. messageSends: ["subclassResponsibility"]
  49836. }),
  49837. $globals.CollectionTest);
  49838. $core.addMethod(
  49839. $core.method({
  49840. selector: "collectionWithDuplicates",
  49841. protocol: 'fixture',
  49842. fn: function (){
  49843. var self=this;
  49844. return $core.withContext(function($ctx1) {
  49845. self._subclassResponsibility();
  49846. return self;
  49847. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  49848. },
  49849. args: [],
  49850. 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",
  49851. referencedClasses: [],
  49852. messageSends: ["subclassResponsibility"]
  49853. }),
  49854. $globals.CollectionTest);
  49855. $core.addMethod(
  49856. $core.method({
  49857. selector: "collectionWithNewValue",
  49858. protocol: 'fixture',
  49859. fn: function (){
  49860. var self=this;
  49861. return $core.withContext(function($ctx1) {
  49862. self._subclassResponsibility();
  49863. return self;
  49864. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  49865. },
  49866. args: [],
  49867. 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",
  49868. referencedClasses: [],
  49869. messageSends: ["subclassResponsibility"]
  49870. }),
  49871. $globals.CollectionTest);
  49872. $core.addMethod(
  49873. $core.method({
  49874. selector: "isCollectionReadOnly",
  49875. protocol: 'testing',
  49876. fn: function (){
  49877. var self=this;
  49878. return false;
  49879. },
  49880. args: [],
  49881. source: "isCollectionReadOnly\x0a\x09^ false",
  49882. referencedClasses: [],
  49883. messageSends: []
  49884. }),
  49885. $globals.CollectionTest);
  49886. $core.addMethod(
  49887. $core.method({
  49888. selector: "sampleNewValue",
  49889. protocol: 'fixture',
  49890. fn: function (){
  49891. var self=this;
  49892. return "N";
  49893. },
  49894. args: [],
  49895. 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'",
  49896. referencedClasses: [],
  49897. messageSends: []
  49898. }),
  49899. $globals.CollectionTest);
  49900. $core.addMethod(
  49901. $core.method({
  49902. selector: "sampleNewValueAsCollection",
  49903. protocol: 'fixture',
  49904. fn: function (){
  49905. var self=this;
  49906. return $core.withContext(function($ctx1) {
  49907. var $1;
  49908. $1=$recv(self._collectionClass())._with_(self._sampleNewValue());
  49909. return $1;
  49910. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  49911. },
  49912. args: [],
  49913. 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",
  49914. referencedClasses: [],
  49915. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  49916. }),
  49917. $globals.CollectionTest);
  49918. $core.addMethod(
  49919. $core.method({
  49920. selector: "testAddAll",
  49921. protocol: 'tests',
  49922. fn: function (){
  49923. var self=this;
  49924. return $core.withContext(function($ctx1) {
  49925. var $2,$3,$5,$4,$6,$1,$7,$10,$9,$11,$12,$13,$8,$14,$17,$16,$18,$20,$19,$21,$15,$23,$24,$25,$26,$22,$27,$28,$29;
  49926. $2=self._collection();
  49927. $ctx1.sendIdx["collection"]=1;
  49928. $3=$2;
  49929. $5=self._collectionClass();
  49930. $ctx1.sendIdx["collectionClass"]=1;
  49931. $4=$recv($5)._new();
  49932. $ctx1.sendIdx["new"]=1;
  49933. $recv($3)._addAll_($4);
  49934. $ctx1.sendIdx["addAll:"]=1;
  49935. $6=$recv($2)._yourself();
  49936. $ctx1.sendIdx["yourself"]=1;
  49937. $1=$6;
  49938. $7=self._collection();
  49939. $ctx1.sendIdx["collection"]=2;
  49940. self._assert_equals_($1,$7);
  49941. $ctx1.sendIdx["assert:equals:"]=1;
  49942. $10=self._collectionClass();
  49943. $ctx1.sendIdx["collectionClass"]=2;
  49944. $9=$recv($10)._new();
  49945. $ctx1.sendIdx["new"]=2;
  49946. $11=$9;
  49947. $12=self._collection();
  49948. $ctx1.sendIdx["collection"]=3;
  49949. $recv($11)._addAll_($12);
  49950. $ctx1.sendIdx["addAll:"]=2;
  49951. $13=$recv($9)._yourself();
  49952. $ctx1.sendIdx["yourself"]=2;
  49953. $8=$13;
  49954. $14=self._collection();
  49955. $ctx1.sendIdx["collection"]=4;
  49956. self._assert_equals_($8,$14);
  49957. $ctx1.sendIdx["assert:equals:"]=2;
  49958. $17=self._collectionClass();
  49959. $ctx1.sendIdx["collectionClass"]=3;
  49960. $16=$recv($17)._new();
  49961. $ctx1.sendIdx["new"]=3;
  49962. $18=$16;
  49963. $20=self._collectionClass();
  49964. $ctx1.sendIdx["collectionClass"]=4;
  49965. $19=$recv($20)._new();
  49966. $ctx1.sendIdx["new"]=4;
  49967. $recv($18)._addAll_($19);
  49968. $ctx1.sendIdx["addAll:"]=3;
  49969. $21=$recv($16)._yourself();
  49970. $ctx1.sendIdx["yourself"]=3;
  49971. $15=$21;
  49972. self._assert_equals_($15,$recv(self._collectionClass())._new());
  49973. $ctx1.sendIdx["assert:equals:"]=3;
  49974. $23=self._collection();
  49975. $ctx1.sendIdx["collection"]=5;
  49976. $24=$23;
  49977. $25=self._sampleNewValueAsCollection();
  49978. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  49979. $recv($24)._addAll_($25);
  49980. $ctx1.sendIdx["addAll:"]=4;
  49981. $26=$recv($23)._yourself();
  49982. $ctx1.sendIdx["yourself"]=4;
  49983. $22=$26;
  49984. $27=self._collectionWithNewValue();
  49985. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49986. self._assert_equals_($22,$27);
  49987. $28=self._sampleNewValueAsCollection();
  49988. $recv($28)._addAll_(self._collection());
  49989. $29=$recv($28)._yourself();
  49990. self._assertSameContents_as_($29,self._collectionWithNewValue());
  49991. return self;
  49992. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  49993. },
  49994. args: [],
  49995. 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",
  49996. referencedClasses: [],
  49997. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  49998. }),
  49999. $globals.CollectionTest);
  50000. $core.addMethod(
  50001. $core.method({
  50002. selector: "testAllSatisfy",
  50003. protocol: 'tests',
  50004. fn: function (){
  50005. var self=this;
  50006. var collection,anyOne;
  50007. return $core.withContext(function($ctx1) {
  50008. var $1;
  50009. collection=self._collection();
  50010. anyOne=$recv(collection)._anyOne();
  50011. $1=$recv(collection)._allSatisfy_((function(each){
  50012. return $core.withContext(function($ctx2) {
  50013. return $recv(collection)._includes_(each);
  50014. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50015. }));
  50016. $ctx1.sendIdx["allSatisfy:"]=1;
  50017. self._assert_($1);
  50018. self._deny_($recv(collection)._allSatisfy_((function(each){
  50019. return $core.withContext(function($ctx2) {
  50020. return $recv(each).__tild_eq(anyOne);
  50021. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50022. })));
  50023. return self;
  50024. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  50025. },
  50026. args: [],
  50027. 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 ])",
  50028. referencedClasses: [],
  50029. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  50030. }),
  50031. $globals.CollectionTest);
  50032. $core.addMethod(
  50033. $core.method({
  50034. selector: "testAnyOne",
  50035. protocol: 'tests',
  50036. fn: function (){
  50037. var self=this;
  50038. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  50039. return $core.withContext(function($ctx1) {
  50040. var $2,$1;
  50041. self._should_raise_((function(){
  50042. return $core.withContext(function($ctx2) {
  50043. return $recv($recv(self._collectionClass())._new())._anyOne();
  50044. $ctx2.sendIdx["anyOne"]=1;
  50045. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50046. }),$Error());
  50047. $2=self._collection();
  50048. $ctx1.sendIdx["collection"]=1;
  50049. $1=$recv($2)._includes_($recv(self._collection())._anyOne());
  50050. self._assert_($1);
  50051. return self;
  50052. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  50053. },
  50054. args: [],
  50055. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  50056. referencedClasses: ["Error"],
  50057. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  50058. }),
  50059. $globals.CollectionTest);
  50060. $core.addMethod(
  50061. $core.method({
  50062. selector: "testAnySatisfy",
  50063. protocol: 'tests',
  50064. fn: function (){
  50065. var self=this;
  50066. var anyOne;
  50067. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  50068. return $core.withContext(function($ctx1) {
  50069. var $1,$3,$2;
  50070. $1=self._collection();
  50071. $ctx1.sendIdx["collection"]=1;
  50072. anyOne=$recv($1)._anyOne();
  50073. $3=self._collection();
  50074. $ctx1.sendIdx["collection"]=2;
  50075. $2=$recv($3)._anySatisfy_((function(each){
  50076. return $core.withContext(function($ctx2) {
  50077. return $recv(each).__eq(anyOne);
  50078. $ctx2.sendIdx["="]=1;
  50079. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50080. }));
  50081. $ctx1.sendIdx["anySatisfy:"]=1;
  50082. self._assert_($2);
  50083. self._deny_($recv(self._collection())._anySatisfy_((function(each){
  50084. return $core.withContext(function($ctx2) {
  50085. return $recv(each).__eq($recv($Object())._new());
  50086. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50087. })));
  50088. return self;
  50089. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  50090. },
  50091. args: [],
  50092. 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 ])",
  50093. referencedClasses: ["Object"],
  50094. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  50095. }),
  50096. $globals.CollectionTest);
  50097. $core.addMethod(
  50098. $core.method({
  50099. selector: "testAsArray",
  50100. protocol: 'tests',
  50101. fn: function (){
  50102. var self=this;
  50103. return $core.withContext(function($ctx1) {
  50104. var $1;
  50105. $1=self._collection();
  50106. $ctx1.sendIdx["collection"]=1;
  50107. self._assertSameContents_as_($1,$recv(self._collection())._asArray());
  50108. return self;
  50109. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  50110. },
  50111. args: [],
  50112. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  50113. referencedClasses: [],
  50114. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  50115. }),
  50116. $globals.CollectionTest);
  50117. $core.addMethod(
  50118. $core.method({
  50119. selector: "testAsOrderedCollection",
  50120. protocol: 'tests',
  50121. fn: function (){
  50122. var self=this;
  50123. return $core.withContext(function($ctx1) {
  50124. var $1;
  50125. $1=self._collection();
  50126. $ctx1.sendIdx["collection"]=1;
  50127. self._assertSameContents_as_($1,$recv(self._collection())._asOrderedCollection());
  50128. return self;
  50129. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  50130. },
  50131. args: [],
  50132. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  50133. referencedClasses: [],
  50134. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  50135. }),
  50136. $globals.CollectionTest);
  50137. $core.addMethod(
  50138. $core.method({
  50139. selector: "testAsSet",
  50140. protocol: 'tests',
  50141. fn: function (){
  50142. var self=this;
  50143. var c,set;
  50144. return $core.withContext(function($ctx1) {
  50145. c=self._collectionWithDuplicates();
  50146. set=$recv(c)._asSet();
  50147. self._assert_equals_($recv(set)._size(),(5));
  50148. $recv(c)._do_((function(each){
  50149. return $core.withContext(function($ctx2) {
  50150. return self._assert_($recv(set)._includes_(each));
  50151. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50152. }));
  50153. return self;
  50154. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  50155. },
  50156. args: [],
  50157. source: "testAsSet\x0a\x09| c set |\x0a\x09c := self collectionWithDuplicates.\x0a\x09set := c asSet.\x0a\x09self assert: set size equals: 5.\x0a\x09c do: [ :each |\x0a\x09\x09self assert: (set includes: each) ]",
  50158. referencedClasses: [],
  50159. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  50160. }),
  50161. $globals.CollectionTest);
  50162. $core.addMethod(
  50163. $core.method({
  50164. selector: "testCollect",
  50165. protocol: 'tests',
  50166. fn: function (){
  50167. var self=this;
  50168. return $core.withContext(function($ctx1) {
  50169. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  50170. $2=self._collection();
  50171. $ctx1.sendIdx["collection"]=1;
  50172. $1=$recv($2)._collect_((function(each){
  50173. return each;
  50174. }));
  50175. $ctx1.sendIdx["collect:"]=1;
  50176. $3=self._collection();
  50177. $ctx1.sendIdx["collection"]=2;
  50178. self._assert_equals_($1,$3);
  50179. $ctx1.sendIdx["assert:equals:"]=1;
  50180. $5=self._collectionWithNewValue();
  50181. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50182. $4=$recv($5)._collect_((function(each){
  50183. return each;
  50184. }));
  50185. $ctx1.sendIdx["collect:"]=2;
  50186. self._assert_equals_($4,self._collectionWithNewValue());
  50187. $ctx1.sendIdx["assert:equals:"]=2;
  50188. $8=self._collectionClass();
  50189. $ctx1.sendIdx["collectionClass"]=1;
  50190. $7=$recv($8)._new();
  50191. $ctx1.sendIdx["new"]=1;
  50192. $6=$recv($7)._collect_((function(each){
  50193. return $core.withContext(function($ctx2) {
  50194. return $recv(each)._printString();
  50195. $ctx2.sendIdx["printString"]=1;
  50196. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  50197. }));
  50198. $ctx1.sendIdx["collect:"]=3;
  50199. self._assert_equals_($6,$recv(self._collectionClass())._new());
  50200. $ctx1.sendIdx["assert:equals:"]=3;
  50201. $11=self._collection();
  50202. $ctx1.sendIdx["collection"]=3;
  50203. $10=$recv($11)._collect_((function(){
  50204. return $core.withContext(function($ctx2) {
  50205. return self._sampleNewValue();
  50206. $ctx2.sendIdx["sampleNewValue"]=1;
  50207. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  50208. }));
  50209. $ctx1.sendIdx["collect:"]=4;
  50210. $9=$recv($10)._detect_((function(){
  50211. return true;
  50212. }));
  50213. self._assert_equals_($9,self._sampleNewValue());
  50214. $ctx1.sendIdx["assert:equals:"]=4;
  50215. self._assert_equals_($recv(self._collection())._collect_((function(each){
  50216. return $core.withContext(function($ctx2) {
  50217. return $recv(each)._printString();
  50218. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  50219. })),self._collectionOfPrintStrings());
  50220. return self;
  50221. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  50222. },
  50223. args: [],
  50224. 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",
  50225. referencedClasses: [],
  50226. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  50227. }),
  50228. $globals.CollectionTest);
  50229. $core.addMethod(
  50230. $core.method({
  50231. selector: "testComma",
  50232. protocol: 'tests',
  50233. fn: function (){
  50234. var self=this;
  50235. return $core.withContext(function($ctx1) {
  50236. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  50237. $2=self._collection();
  50238. $ctx1.sendIdx["collection"]=1;
  50239. $4=self._collectionClass();
  50240. $ctx1.sendIdx["collectionClass"]=1;
  50241. $3=$recv($4)._new();
  50242. $ctx1.sendIdx["new"]=1;
  50243. $1=$recv($2).__comma($3);
  50244. $ctx1.sendIdx[","]=1;
  50245. $5=self._collection();
  50246. $ctx1.sendIdx["collection"]=2;
  50247. self._assert_equals_($1,$5);
  50248. $ctx1.sendIdx["assert:equals:"]=1;
  50249. $8=self._collectionClass();
  50250. $ctx1.sendIdx["collectionClass"]=2;
  50251. $7=$recv($8)._new();
  50252. $ctx1.sendIdx["new"]=2;
  50253. $9=self._collection();
  50254. $ctx1.sendIdx["collection"]=3;
  50255. $6=$recv($7).__comma($9);
  50256. $ctx1.sendIdx[","]=2;
  50257. $10=self._collection();
  50258. $ctx1.sendIdx["collection"]=4;
  50259. self._assert_equals_($6,$10);
  50260. $ctx1.sendIdx["assert:equals:"]=2;
  50261. $13=self._collectionClass();
  50262. $ctx1.sendIdx["collectionClass"]=3;
  50263. $12=$recv($13)._new();
  50264. $ctx1.sendIdx["new"]=3;
  50265. $15=self._collectionClass();
  50266. $ctx1.sendIdx["collectionClass"]=4;
  50267. $14=$recv($15)._new();
  50268. $ctx1.sendIdx["new"]=4;
  50269. $11=$recv($12).__comma($14);
  50270. $ctx1.sendIdx[","]=3;
  50271. self._assert_equals_($11,$recv(self._collectionClass())._new());
  50272. $ctx1.sendIdx["assert:equals:"]=3;
  50273. $17=self._collection();
  50274. $ctx1.sendIdx["collection"]=5;
  50275. $18=self._sampleNewValueAsCollection();
  50276. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  50277. $16=$recv($17).__comma($18);
  50278. $ctx1.sendIdx[","]=4;
  50279. $19=self._collectionWithNewValue();
  50280. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50281. self._assert_equals_($16,$19);
  50282. self._assertSameContents_as_($recv(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  50283. return self;
  50284. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  50285. },
  50286. args: [],
  50287. 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",
  50288. referencedClasses: [],
  50289. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  50290. }),
  50291. $globals.CollectionTest);
  50292. $core.addMethod(
  50293. $core.method({
  50294. selector: "testCopy",
  50295. protocol: 'tests',
  50296. fn: function (){
  50297. var self=this;
  50298. return $core.withContext(function($ctx1) {
  50299. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  50300. $3=self._collectionClass();
  50301. $ctx1.sendIdx["collectionClass"]=1;
  50302. $2=$recv($3)._new();
  50303. $ctx1.sendIdx["new"]=1;
  50304. $1=$recv($2)._copy();
  50305. $ctx1.sendIdx["copy"]=1;
  50306. $5=self._collectionClass();
  50307. $ctx1.sendIdx["collectionClass"]=2;
  50308. $4=$recv($5)._new();
  50309. $ctx1.sendIdx["new"]=2;
  50310. self._assert_equals_($1,$4);
  50311. $ctx1.sendIdx["assert:equals:"]=1;
  50312. $7=self._collection();
  50313. $ctx1.sendIdx["collection"]=1;
  50314. $6=$recv($7)._copy();
  50315. $ctx1.sendIdx["copy"]=2;
  50316. $8=self._collection();
  50317. $ctx1.sendIdx["collection"]=2;
  50318. self._assert_equals_($6,$8);
  50319. $ctx1.sendIdx["assert:equals:"]=2;
  50320. $10=self._collectionWithNewValue();
  50321. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50322. $9=$recv($10)._copy();
  50323. $ctx1.sendIdx["copy"]=3;
  50324. $11=self._collectionWithNewValue();
  50325. $ctx1.sendIdx["collectionWithNewValue"]=2;
  50326. self._assert_equals_($9,$11);
  50327. $15=self._collectionClass();
  50328. $ctx1.sendIdx["collectionClass"]=3;
  50329. $14=$recv($15)._new();
  50330. $ctx1.sendIdx["new"]=3;
  50331. $13=$recv($14)._copy();
  50332. $ctx1.sendIdx["copy"]=4;
  50333. $16=self._collection();
  50334. $ctx1.sendIdx["collection"]=3;
  50335. $12=$recv($13).__eq($16);
  50336. $ctx1.sendIdx["="]=1;
  50337. self._deny_($12);
  50338. $ctx1.sendIdx["deny:"]=1;
  50339. $19=self._collection();
  50340. $ctx1.sendIdx["collection"]=4;
  50341. $18=$recv($19)._copy();
  50342. $ctx1.sendIdx["copy"]=5;
  50343. $17=$recv($18).__eq($recv(self._collectionClass())._new());
  50344. $ctx1.sendIdx["="]=2;
  50345. self._deny_($17);
  50346. $ctx1.sendIdx["deny:"]=2;
  50347. self._deny_($recv($recv(self._collection())._copy()).__eq(self._collectionWithNewValue()));
  50348. return self;
  50349. }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
  50350. },
  50351. args: [],
  50352. 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",
  50353. referencedClasses: [],
  50354. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  50355. }),
  50356. $globals.CollectionTest);
  50357. $core.addMethod(
  50358. $core.method({
  50359. selector: "testCopySeparates",
  50360. protocol: 'tests',
  50361. fn: function (){
  50362. var self=this;
  50363. var original,copy;
  50364. return $core.withContext(function($ctx1) {
  50365. original=self._collection();
  50366. $ctx1.sendIdx["collection"]=1;
  50367. copy=$recv(original)._copy();
  50368. $recv(copy)._addAll_(self._sampleNewValueAsCollection());
  50369. self._assert_($recv(original).__eq(self._collection()));
  50370. return self;
  50371. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
  50372. },
  50373. args: [],
  50374. 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",
  50375. referencedClasses: [],
  50376. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  50377. }),
  50378. $globals.CollectionTest);
  50379. $core.addMethod(
  50380. $core.method({
  50381. selector: "testDetect",
  50382. protocol: 'tests',
  50383. fn: function (){
  50384. var self=this;
  50385. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  50386. return $core.withContext(function($ctx1) {
  50387. var $1,$2,$3,$4,$6,$5,$7;
  50388. self._shouldnt_raise_((function(){
  50389. return $core.withContext(function($ctx2) {
  50390. $1=self._collection();
  50391. $ctx2.sendIdx["collection"]=1;
  50392. return $recv($1)._detect_((function(){
  50393. return true;
  50394. }));
  50395. $ctx2.sendIdx["detect:"]=1;
  50396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50397. }),$Error());
  50398. self._should_raise_((function(){
  50399. return $core.withContext(function($ctx2) {
  50400. $2=self._collection();
  50401. $ctx2.sendIdx["collection"]=2;
  50402. return $recv($2)._detect_((function(){
  50403. return false;
  50404. }));
  50405. $ctx2.sendIdx["detect:"]=2;
  50406. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50407. }),$Error());
  50408. $ctx1.sendIdx["should:raise:"]=1;
  50409. $3=$recv(self._sampleNewValueAsCollection())._detect_((function(){
  50410. return true;
  50411. }));
  50412. $ctx1.sendIdx["detect:"]=3;
  50413. $4=self._sampleNewValue();
  50414. $ctx1.sendIdx["sampleNewValue"]=1;
  50415. self._assert_equals_($3,$4);
  50416. $ctx1.sendIdx["assert:equals:"]=1;
  50417. $5=$recv(self._collectionWithNewValue())._detect_((function(each){
  50418. return $core.withContext(function($ctx2) {
  50419. $6=self._sampleNewValue();
  50420. $ctx2.sendIdx["sampleNewValue"]=2;
  50421. return $recv(each).__eq($6);
  50422. $ctx2.sendIdx["="]=1;
  50423. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  50424. }));
  50425. $ctx1.sendIdx["detect:"]=4;
  50426. $7=self._sampleNewValue();
  50427. $ctx1.sendIdx["sampleNewValue"]=3;
  50428. self._assert_equals_($5,$7);
  50429. self._should_raise_((function(){
  50430. return $core.withContext(function($ctx2) {
  50431. return $recv(self._collection())._detect_((function(each){
  50432. return $core.withContext(function($ctx3) {
  50433. return $recv(each).__eq(self._sampleNewValue());
  50434. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  50435. }));
  50436. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  50437. }),$Error());
  50438. return self;
  50439. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  50440. },
  50441. args: [],
  50442. 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",
  50443. referencedClasses: ["Error"],
  50444. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  50445. }),
  50446. $globals.CollectionTest);
  50447. $core.addMethod(
  50448. $core.method({
  50449. selector: "testDetectIfNone",
  50450. protocol: 'tests',
  50451. fn: function (){
  50452. var self=this;
  50453. var sentinel;
  50454. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  50455. return $core.withContext(function($ctx1) {
  50456. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  50457. sentinel=$recv($Object())._new();
  50458. $3=self._collection();
  50459. $ctx1.sendIdx["collection"]=1;
  50460. $2=$recv($3)._detect_ifNone_((function(){
  50461. return true;
  50462. }),(function(){
  50463. return sentinel;
  50464. }));
  50465. $ctx1.sendIdx["detect:ifNone:"]=1;
  50466. $1=$recv($2).__tild_eq(sentinel);
  50467. self._assert_($1);
  50468. $5=self._collection();
  50469. $ctx1.sendIdx["collection"]=2;
  50470. $4=$recv($5)._detect_ifNone_((function(){
  50471. return false;
  50472. }),(function(){
  50473. return sentinel;
  50474. }));
  50475. $ctx1.sendIdx["detect:ifNone:"]=2;
  50476. self._assert_equals_($4,sentinel);
  50477. $ctx1.sendIdx["assert:equals:"]=1;
  50478. $6=$recv(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  50479. return true;
  50480. }),(function(){
  50481. return sentinel;
  50482. }));
  50483. $ctx1.sendIdx["detect:ifNone:"]=3;
  50484. $7=self._sampleNewValue();
  50485. $ctx1.sendIdx["sampleNewValue"]=1;
  50486. self._assert_equals_($6,$7);
  50487. $ctx1.sendIdx["assert:equals:"]=2;
  50488. $8=$recv(self._collectionWithNewValue())._detect_ifNone_((function(each){
  50489. return $core.withContext(function($ctx2) {
  50490. $9=self._sampleNewValue();
  50491. $ctx2.sendIdx["sampleNewValue"]=2;
  50492. return $recv(each).__eq($9);
  50493. $ctx2.sendIdx["="]=1;
  50494. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  50495. }),(function(){
  50496. return sentinel;
  50497. }));
  50498. $ctx1.sendIdx["detect:ifNone:"]=4;
  50499. $10=self._sampleNewValue();
  50500. $ctx1.sendIdx["sampleNewValue"]=3;
  50501. self._assert_equals_($8,$10);
  50502. $ctx1.sendIdx["assert:equals:"]=3;
  50503. self._assert_equals_($recv(self._collection())._detect_ifNone_((function(each){
  50504. return $core.withContext(function($ctx2) {
  50505. return $recv(each).__eq(self._sampleNewValue());
  50506. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  50507. }),(function(){
  50508. return sentinel;
  50509. })),sentinel);
  50510. return self;
  50511. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  50512. },
  50513. args: [],
  50514. 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",
  50515. referencedClasses: ["Object"],
  50516. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  50517. }),
  50518. $globals.CollectionTest);
  50519. $core.addMethod(
  50520. $core.method({
  50521. selector: "testDo",
  50522. protocol: 'tests',
  50523. fn: function (){
  50524. var self=this;
  50525. var newCollection;
  50526. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  50527. return $core.withContext(function($ctx1) {
  50528. var $1,$2;
  50529. newCollection=$recv($OrderedCollection())._new();
  50530. $ctx1.sendIdx["new"]=1;
  50531. $1=self._collection();
  50532. $ctx1.sendIdx["collection"]=1;
  50533. $recv($1)._do_((function(each){
  50534. return $core.withContext(function($ctx2) {
  50535. return $recv(newCollection)._add_(each);
  50536. $ctx2.sendIdx["add:"]=1;
  50537. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50538. }));
  50539. $ctx1.sendIdx["do:"]=1;
  50540. self._assertSameContents_as_(self._collection(),newCollection);
  50541. $ctx1.sendIdx["assertSameContents:as:"]=1;
  50542. newCollection=$recv($OrderedCollection())._new();
  50543. $2=self._collectionWithDuplicates();
  50544. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  50545. $recv($2)._do_((function(each){
  50546. return $core.withContext(function($ctx2) {
  50547. return $recv(newCollection)._add_(each);
  50548. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50549. }));
  50550. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  50551. return self;
  50552. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  50553. },
  50554. args: [],
  50555. 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",
  50556. referencedClasses: ["OrderedCollection"],
  50557. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  50558. }),
  50559. $globals.CollectionTest);
  50560. $core.addMethod(
  50561. $core.method({
  50562. selector: "testEquality",
  50563. protocol: 'tests',
  50564. fn: function (){
  50565. var self=this;
  50566. return $core.withContext(function($ctx1) {
  50567. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  50568. $2=self._collectionClass();
  50569. $ctx1.sendIdx["collectionClass"]=1;
  50570. $1=$recv($2)._new();
  50571. $ctx1.sendIdx["new"]=1;
  50572. $4=self._collectionClass();
  50573. $ctx1.sendIdx["collectionClass"]=2;
  50574. $3=$recv($4)._new();
  50575. $ctx1.sendIdx["new"]=2;
  50576. self._assert_equals_($1,$3);
  50577. $ctx1.sendIdx["assert:equals:"]=1;
  50578. $5=self._collection();
  50579. $ctx1.sendIdx["collection"]=1;
  50580. $6=self._collection();
  50581. $ctx1.sendIdx["collection"]=2;
  50582. self._assert_equals_($5,$6);
  50583. $ctx1.sendIdx["assert:equals:"]=2;
  50584. $7=self._collectionWithNewValue();
  50585. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50586. $8=self._collectionWithNewValue();
  50587. $ctx1.sendIdx["collectionWithNewValue"]=2;
  50588. self._assert_equals_($7,$8);
  50589. $11=self._collectionClass();
  50590. $ctx1.sendIdx["collectionClass"]=3;
  50591. $10=$recv($11)._new();
  50592. $ctx1.sendIdx["new"]=3;
  50593. $12=self._collection();
  50594. $ctx1.sendIdx["collection"]=3;
  50595. $9=$recv($10).__eq($12);
  50596. $ctx1.sendIdx["="]=1;
  50597. self._deny_($9);
  50598. $ctx1.sendIdx["deny:"]=1;
  50599. $14=self._collection();
  50600. $ctx1.sendIdx["collection"]=4;
  50601. $13=$recv($14).__eq($recv(self._collectionClass())._new());
  50602. $ctx1.sendIdx["="]=2;
  50603. self._deny_($13);
  50604. $ctx1.sendIdx["deny:"]=2;
  50605. self._deny_($recv(self._collection()).__eq(self._collectionWithNewValue()));
  50606. return self;
  50607. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
  50608. },
  50609. args: [],
  50610. 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",
  50611. referencedClasses: [],
  50612. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  50613. }),
  50614. $globals.CollectionTest);
  50615. $core.addMethod(
  50616. $core.method({
  50617. selector: "testIfEmptyFamily",
  50618. protocol: 'tests',
  50619. fn: function (){
  50620. var self=this;
  50621. return $core.withContext(function($ctx1) {
  50622. 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;
  50623. $3=self._collectionClass();
  50624. $ctx1.sendIdx["collectionClass"]=1;
  50625. $2=$recv($3)._new();
  50626. $ctx1.sendIdx["new"]=1;
  50627. $1=$recv($2)._ifEmpty_((function(){
  50628. return (42);
  50629. }));
  50630. $ctx1.sendIdx["ifEmpty:"]=1;
  50631. self._assert_equals_($1,(42));
  50632. $ctx1.sendIdx["assert:equals:"]=1;
  50633. $5=self._collection();
  50634. $ctx1.sendIdx["collection"]=1;
  50635. $4=$recv($5)._ifEmpty_((function(){
  50636. return (42);
  50637. }));
  50638. $6=self._collection();
  50639. $ctx1.sendIdx["collection"]=2;
  50640. self._assert_equals_($4,$6);
  50641. $ctx1.sendIdx["assert:equals:"]=2;
  50642. $9=self._collectionClass();
  50643. $ctx1.sendIdx["collectionClass"]=2;
  50644. $8=$recv($9)._new();
  50645. $ctx1.sendIdx["new"]=2;
  50646. $7=$recv($8)._ifNotEmpty_((function(){
  50647. return (42);
  50648. }));
  50649. $ctx1.sendIdx["ifNotEmpty:"]=1;
  50650. $11=self._collectionClass();
  50651. $ctx1.sendIdx["collectionClass"]=3;
  50652. $10=$recv($11)._new();
  50653. $ctx1.sendIdx["new"]=3;
  50654. self._assert_equals_($7,$10);
  50655. $ctx1.sendIdx["assert:equals:"]=3;
  50656. $13=self._collection();
  50657. $ctx1.sendIdx["collection"]=3;
  50658. $12=$recv($13)._ifNotEmpty_((function(){
  50659. return (42);
  50660. }));
  50661. $ctx1.sendIdx["ifNotEmpty:"]=2;
  50662. self._assert_equals_($12,(42));
  50663. $ctx1.sendIdx["assert:equals:"]=4;
  50664. $15=self._collection();
  50665. $ctx1.sendIdx["collection"]=4;
  50666. $14=$recv($15)._ifNotEmpty_((function(col){
  50667. return col;
  50668. }));
  50669. $16=self._collection();
  50670. $ctx1.sendIdx["collection"]=5;
  50671. self._assert_equals_($14,$16);
  50672. $ctx1.sendIdx["assert:equals:"]=5;
  50673. $19=self._collectionClass();
  50674. $ctx1.sendIdx["collectionClass"]=4;
  50675. $18=$recv($19)._new();
  50676. $ctx1.sendIdx["new"]=4;
  50677. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  50678. return (42);
  50679. }),(function(){
  50680. return (999);
  50681. }));
  50682. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  50683. self._assert_equals_($17,(42));
  50684. $ctx1.sendIdx["assert:equals:"]=6;
  50685. $21=self._collection();
  50686. $ctx1.sendIdx["collection"]=6;
  50687. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  50688. return (42);
  50689. }),(function(){
  50690. return (999);
  50691. }));
  50692. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  50693. self._assert_equals_($20,(999));
  50694. $ctx1.sendIdx["assert:equals:"]=7;
  50695. $23=self._collection();
  50696. $ctx1.sendIdx["collection"]=7;
  50697. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  50698. return (42);
  50699. }),(function(col){
  50700. return col;
  50701. }));
  50702. $24=self._collection();
  50703. $ctx1.sendIdx["collection"]=8;
  50704. self._assert_equals_($22,$24);
  50705. $ctx1.sendIdx["assert:equals:"]=8;
  50706. $25=$recv($recv(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  50707. return (42);
  50708. }),(function(){
  50709. return (999);
  50710. }));
  50711. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  50712. self._assert_equals_($25,(999));
  50713. $ctx1.sendIdx["assert:equals:"]=9;
  50714. $27=self._collection();
  50715. $ctx1.sendIdx["collection"]=9;
  50716. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  50717. return (42);
  50718. }),(function(){
  50719. return (999);
  50720. }));
  50721. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  50722. self._assert_equals_($26,(42));
  50723. $ctx1.sendIdx["assert:equals:"]=10;
  50724. $29=self._collection();
  50725. $ctx1.sendIdx["collection"]=10;
  50726. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  50727. return col;
  50728. }),(function(){
  50729. return (999);
  50730. }));
  50731. self._assert_equals_($28,self._collection());
  50732. return self;
  50733. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  50734. },
  50735. args: [],
  50736. 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.",
  50737. referencedClasses: [],
  50738. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  50739. }),
  50740. $globals.CollectionTest);
  50741. $core.addMethod(
  50742. $core.method({
  50743. selector: "testIsEmpty",
  50744. protocol: 'tests',
  50745. fn: function (){
  50746. var self=this;
  50747. return $core.withContext(function($ctx1) {
  50748. var $1;
  50749. $1=$recv($recv(self._collectionClass())._new())._isEmpty();
  50750. $ctx1.sendIdx["isEmpty"]=1;
  50751. self._assert_($1);
  50752. self._deny_($recv(self._collection())._isEmpty());
  50753. return self;
  50754. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  50755. },
  50756. args: [],
  50757. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  50758. referencedClasses: [],
  50759. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  50760. }),
  50761. $globals.CollectionTest);
  50762. $core.addMethod(
  50763. $core.method({
  50764. selector: "testNoneSatisfy",
  50765. protocol: 'tests',
  50766. fn: function (){
  50767. var self=this;
  50768. var anyOne;
  50769. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  50770. return $core.withContext(function($ctx1) {
  50771. var $1,$3,$2;
  50772. $1=self._collection();
  50773. $ctx1.sendIdx["collection"]=1;
  50774. anyOne=$recv($1)._anyOne();
  50775. $3=self._collection();
  50776. $ctx1.sendIdx["collection"]=2;
  50777. $2=$recv($3)._noneSatisfy_((function(each){
  50778. return $core.withContext(function($ctx2) {
  50779. return $recv(each).__eq(anyOne);
  50780. $ctx2.sendIdx["="]=1;
  50781. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50782. }));
  50783. $ctx1.sendIdx["noneSatisfy:"]=1;
  50784. self._deny_($2);
  50785. self._assert_($recv(self._collection())._noneSatisfy_((function(each){
  50786. return $core.withContext(function($ctx2) {
  50787. return $recv(each).__eq($recv($Object())._new());
  50788. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50789. })));
  50790. return self;
  50791. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  50792. },
  50793. args: [],
  50794. 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 ])",
  50795. referencedClasses: ["Object"],
  50796. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  50797. }),
  50798. $globals.CollectionTest);
  50799. $core.addMethod(
  50800. $core.method({
  50801. selector: "testRemoveAll",
  50802. protocol: 'tests',
  50803. fn: function (){
  50804. var self=this;
  50805. return $core.withContext(function($ctx1) {
  50806. var $1,$2;
  50807. $1=self._collection();
  50808. $recv($1)._removeAll();
  50809. $2=$recv($1)._yourself();
  50810. self._assert_equals_($2,$recv(self._collectionClass())._new());
  50811. return self;
  50812. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  50813. },
  50814. args: [],
  50815. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  50816. referencedClasses: [],
  50817. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  50818. }),
  50819. $globals.CollectionTest);
  50820. $core.addMethod(
  50821. $core.method({
  50822. selector: "testSelect",
  50823. protocol: 'tests',
  50824. fn: function (){
  50825. var self=this;
  50826. return $core.withContext(function($ctx1) {
  50827. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  50828. $2=self._collection();
  50829. $ctx1.sendIdx["collection"]=1;
  50830. $1=$recv($2)._select_((function(){
  50831. return false;
  50832. }));
  50833. $ctx1.sendIdx["select:"]=1;
  50834. $4=self._collectionClass();
  50835. $ctx1.sendIdx["collectionClass"]=1;
  50836. $3=$recv($4)._new();
  50837. $ctx1.sendIdx["new"]=1;
  50838. self._assert_equals_($1,$3);
  50839. $ctx1.sendIdx["assert:equals:"]=1;
  50840. $6=self._collection();
  50841. $ctx1.sendIdx["collection"]=2;
  50842. $5=$recv($6)._select_((function(){
  50843. return true;
  50844. }));
  50845. $ctx1.sendIdx["select:"]=2;
  50846. $7=self._collection();
  50847. $ctx1.sendIdx["collection"]=3;
  50848. self._assert_equals_($5,$7);
  50849. $ctx1.sendIdx["assert:equals:"]=2;
  50850. $9=self._collectionWithNewValue();
  50851. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50852. $8=$recv($9)._select_((function(each){
  50853. return $core.withContext(function($ctx2) {
  50854. $10=self._sampleNewValue();
  50855. $ctx2.sendIdx["sampleNewValue"]=1;
  50856. return $recv(each).__eq($10);
  50857. $ctx2.sendIdx["="]=1;
  50858. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  50859. }));
  50860. $ctx1.sendIdx["select:"]=3;
  50861. self._assert_equals_($8,self._sampleNewValueAsCollection());
  50862. $ctx1.sendIdx["assert:equals:"]=3;
  50863. $12=self._collectionWithNewValue();
  50864. $ctx1.sendIdx["collectionWithNewValue"]=2;
  50865. $11=$recv($12)._select_((function(each){
  50866. return $core.withContext(function($ctx2) {
  50867. $13=self._sampleNewValue();
  50868. $ctx2.sendIdx["sampleNewValue"]=2;
  50869. return $recv(each).__tild_eq($13);
  50870. $ctx2.sendIdx["~="]=1;
  50871. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  50872. }));
  50873. $ctx1.sendIdx["select:"]=4;
  50874. $14=self._collection();
  50875. $ctx1.sendIdx["collection"]=4;
  50876. self._assert_equals_($11,$14);
  50877. $ctx1.sendIdx["assert:equals:"]=4;
  50878. $16=self._collection();
  50879. $ctx1.sendIdx["collection"]=5;
  50880. $15=$recv($16)._select_((function(each){
  50881. return $core.withContext(function($ctx2) {
  50882. $17=self._sampleNewValue();
  50883. $ctx2.sendIdx["sampleNewValue"]=3;
  50884. return $recv(each).__eq($17);
  50885. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  50886. }));
  50887. $ctx1.sendIdx["select:"]=5;
  50888. self._assert_equals_($15,$recv(self._collectionClass())._new());
  50889. $ctx1.sendIdx["assert:equals:"]=5;
  50890. self._assert_equals_($recv(self._collectionWithNewValue())._select_((function(each){
  50891. return $core.withContext(function($ctx2) {
  50892. return $recv(each).__tild_eq(self._sampleNewValue());
  50893. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  50894. })),self._collection());
  50895. return self;
  50896. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  50897. },
  50898. args: [],
  50899. 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",
  50900. referencedClasses: [],
  50901. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  50902. }),
  50903. $globals.CollectionTest);
  50904. $core.addMethod(
  50905. $core.method({
  50906. selector: "testSize",
  50907. protocol: 'tests',
  50908. fn: function (){
  50909. var self=this;
  50910. return $core.withContext(function($ctx1) {
  50911. var $1,$2;
  50912. $1=$recv($recv(self._collectionClass())._new())._size();
  50913. $ctx1.sendIdx["size"]=1;
  50914. self._assert_equals_($1,(0));
  50915. $ctx1.sendIdx["assert:equals:"]=1;
  50916. $2=$recv(self._sampleNewValueAsCollection())._size();
  50917. $ctx1.sendIdx["size"]=2;
  50918. self._assert_equals_($2,(1));
  50919. $ctx1.sendIdx["assert:equals:"]=2;
  50920. self._assert_equals_($recv(self._collection())._size(),self._collectionSize());
  50921. return self;
  50922. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  50923. },
  50924. args: [],
  50925. 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",
  50926. referencedClasses: [],
  50927. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  50928. }),
  50929. $globals.CollectionTest);
  50930. $core.addMethod(
  50931. $core.method({
  50932. selector: "collectionClass",
  50933. protocol: 'fixture',
  50934. fn: function (){
  50935. var self=this;
  50936. return nil;
  50937. },
  50938. args: [],
  50939. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  50940. referencedClasses: [],
  50941. messageSends: []
  50942. }),
  50943. $globals.CollectionTest.klass);
  50944. $core.addMethod(
  50945. $core.method({
  50946. selector: "isAbstract",
  50947. protocol: 'testing',
  50948. fn: function (){
  50949. var self=this;
  50950. return $core.withContext(function($ctx1) {
  50951. var $1;
  50952. $1=$recv(self._collectionClass())._isNil();
  50953. return $1;
  50954. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.klass)});
  50955. },
  50956. args: [],
  50957. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  50958. referencedClasses: [],
  50959. messageSends: ["isNil", "collectionClass"]
  50960. }),
  50961. $globals.CollectionTest.klass);
  50962. $core.addClass('IndexableCollectionTest', $globals.CollectionTest, [], 'Kernel-Tests');
  50963. $core.addMethod(
  50964. $core.method({
  50965. selector: "collectionWithNewValue",
  50966. protocol: 'fixture',
  50967. fn: function (){
  50968. var self=this;
  50969. return $core.withContext(function($ctx1) {
  50970. self._subclassResponsibility();
  50971. return self;
  50972. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  50973. },
  50974. args: [],
  50975. 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",
  50976. referencedClasses: [],
  50977. messageSends: ["subclassResponsibility"]
  50978. }),
  50979. $globals.IndexableCollectionTest);
  50980. $core.addMethod(
  50981. $core.method({
  50982. selector: "sampleNewIndex",
  50983. protocol: 'fixture',
  50984. fn: function (){
  50985. var self=this;
  50986. return $core.withContext(function($ctx1) {
  50987. self._subclassResponsibility();
  50988. return self;
  50989. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  50990. },
  50991. args: [],
  50992. 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",
  50993. referencedClasses: [],
  50994. messageSends: ["subclassResponsibility"]
  50995. }),
  50996. $globals.IndexableCollectionTest);
  50997. $core.addMethod(
  50998. $core.method({
  50999. selector: "sampleNonIndexesDo:",
  51000. protocol: 'fixture',
  51001. fn: function (aBlock){
  51002. var self=this;
  51003. return $core.withContext(function($ctx1) {
  51004. self._subclassResponsibility();
  51005. return self;
  51006. }, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  51007. },
  51008. args: ["aBlock"],
  51009. 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",
  51010. referencedClasses: [],
  51011. messageSends: ["subclassResponsibility"]
  51012. }),
  51013. $globals.IndexableCollectionTest);
  51014. $core.addMethod(
  51015. $core.method({
  51016. selector: "samplesDo:",
  51017. protocol: 'fixture',
  51018. fn: function (aBlock){
  51019. var self=this;
  51020. return $core.withContext(function($ctx1) {
  51021. self._subclassResponsibility();
  51022. return self;
  51023. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  51024. },
  51025. args: ["aBlock"],
  51026. 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",
  51027. referencedClasses: [],
  51028. messageSends: ["subclassResponsibility"]
  51029. }),
  51030. $globals.IndexableCollectionTest);
  51031. $core.addMethod(
  51032. $core.method({
  51033. selector: "testAt",
  51034. protocol: 'tests',
  51035. fn: function (){
  51036. var self=this;
  51037. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  51038. return $core.withContext(function($ctx1) {
  51039. var $1;
  51040. self._nonIndexesDo_((function(each){
  51041. return $core.withContext(function($ctx2) {
  51042. return self._should_raise_((function(){
  51043. return $core.withContext(function($ctx3) {
  51044. $1=self._collection();
  51045. $ctx3.sendIdx["collection"]=1;
  51046. return $recv($1)._at_(each);
  51047. $ctx3.sendIdx["at:"]=1;
  51048. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51049. }),$Error());
  51050. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51051. }));
  51052. self._samplesDo_((function(index,value){
  51053. return $core.withContext(function($ctx2) {
  51054. return self._assert_equals_($recv(self._collection())._at_(index),value);
  51055. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  51056. }));
  51057. return self;
  51058. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  51059. },
  51060. args: [],
  51061. 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 ]",
  51062. referencedClasses: ["Error"],
  51063. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  51064. }),
  51065. $globals.IndexableCollectionTest);
  51066. $core.addMethod(
  51067. $core.method({
  51068. selector: "testAtIfAbsent",
  51069. protocol: 'tests',
  51070. fn: function (){
  51071. var self=this;
  51072. return $core.withContext(function($ctx1) {
  51073. var $2,$1,$3;
  51074. self._nonIndexesDo_((function(each){
  51075. return $core.withContext(function($ctx2) {
  51076. $2=self._collection();
  51077. $ctx2.sendIdx["collection"]=1;
  51078. $1=$recv($2)._at_ifAbsent_(each,(function(){
  51079. return $core.withContext(function($ctx3) {
  51080. return self._sampleNewValue();
  51081. $ctx3.sendIdx["sampleNewValue"]=1;
  51082. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51083. }));
  51084. $ctx2.sendIdx["at:ifAbsent:"]=1;
  51085. $3=self._sampleNewValue();
  51086. $ctx2.sendIdx["sampleNewValue"]=2;
  51087. return self._assert_equals_($1,$3);
  51088. $ctx2.sendIdx["assert:equals:"]=1;
  51089. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51090. }));
  51091. self._samplesDo_((function(index,value){
  51092. return $core.withContext(function($ctx2) {
  51093. return self._assert_equals_($recv(self._collection())._at_ifAbsent_(index,(function(){
  51094. return $core.withContext(function($ctx3) {
  51095. return self._sampleNewValue();
  51096. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  51097. })),value);
  51098. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  51099. }));
  51100. return self;
  51101. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  51102. },
  51103. args: [],
  51104. 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 ].",
  51105. referencedClasses: [],
  51106. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  51107. }),
  51108. $globals.IndexableCollectionTest);
  51109. $core.addMethod(
  51110. $core.method({
  51111. selector: "testAtIfAbsentPut",
  51112. protocol: 'tests',
  51113. fn: function (){
  51114. var self=this;
  51115. var newCollection;
  51116. return $core.withContext(function($ctx1) {
  51117. var $1;
  51118. newCollection=self._collection();
  51119. $ctx1.sendIdx["collection"]=1;
  51120. self._samplesDo_((function(index,value){
  51121. return $core.withContext(function($ctx2) {
  51122. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  51123. return $core.withContext(function($ctx3) {
  51124. return self._sampleNewValue();
  51125. $ctx3.sendIdx["sampleNewValue"]=1;
  51126. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51127. }));
  51128. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  51129. return self._assert_equals_($1,value);
  51130. $ctx2.sendIdx["assert:equals:"]=1;
  51131. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  51132. }));
  51133. self._assert_equals_(newCollection,self._collection());
  51134. $ctx1.sendIdx["assert:equals:"]=2;
  51135. self._assert_equals_($recv(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  51136. return $core.withContext(function($ctx2) {
  51137. return self._sampleNewValue();
  51138. $ctx2.sendIdx["sampleNewValue"]=2;
  51139. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51140. })),self._sampleNewValue());
  51141. $ctx1.sendIdx["assert:equals:"]=3;
  51142. self._assert_equals_(newCollection,self._collectionWithNewValue());
  51143. return self;
  51144. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  51145. },
  51146. args: [],
  51147. 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",
  51148. referencedClasses: [],
  51149. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  51150. }),
  51151. $globals.IndexableCollectionTest);
  51152. $core.addMethod(
  51153. $core.method({
  51154. selector: "testAtIfPresent",
  51155. protocol: 'tests',
  51156. fn: function (){
  51157. var self=this;
  51158. var visited,sentinel;
  51159. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  51160. return $core.withContext(function($ctx1) {
  51161. var $2,$1,$4,$3;
  51162. sentinel=$recv($Object())._new();
  51163. self._nonIndexesDo_((function(each){
  51164. return $core.withContext(function($ctx2) {
  51165. visited=nil;
  51166. visited;
  51167. $2=self._collection();
  51168. $ctx2.sendIdx["collection"]=1;
  51169. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  51170. visited=value1;
  51171. visited;
  51172. return sentinel;
  51173. }));
  51174. $ctx2.sendIdx["at:ifPresent:"]=1;
  51175. self._assert_equals_($1,nil);
  51176. $ctx2.sendIdx["assert:equals:"]=1;
  51177. return self._assert_($recv(visited)._isNil());
  51178. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51179. }));
  51180. self._samplesDo_((function(index,value){
  51181. return $core.withContext(function($ctx2) {
  51182. visited=nil;
  51183. visited;
  51184. $4=self._collection();
  51185. $ctx2.sendIdx["collection"]=2;
  51186. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  51187. visited=value2;
  51188. visited;
  51189. return sentinel;
  51190. }));
  51191. self._assert_equals_($3,sentinel);
  51192. $ctx2.sendIdx["assert:equals:"]=2;
  51193. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  51194. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  51195. }));
  51196. return self;
  51197. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  51198. },
  51199. args: [],
  51200. 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) ]",
  51201. referencedClasses: ["Object"],
  51202. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  51203. }),
  51204. $globals.IndexableCollectionTest);
  51205. $core.addMethod(
  51206. $core.method({
  51207. selector: "testAtIfPresentIfAbsent",
  51208. protocol: 'tests',
  51209. fn: function (){
  51210. var self=this;
  51211. var visited,sentinel;
  51212. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  51213. return $core.withContext(function($ctx1) {
  51214. var $2,$1,$3,$5,$4;
  51215. sentinel=$recv($Object())._new();
  51216. self._nonIndexesDo_((function(each){
  51217. return $core.withContext(function($ctx2) {
  51218. visited=nil;
  51219. visited;
  51220. $2=self._collection();
  51221. $ctx2.sendIdx["collection"]=1;
  51222. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  51223. visited=value1;
  51224. visited;
  51225. return sentinel;
  51226. }),(function(){
  51227. return $core.withContext(function($ctx3) {
  51228. return self._sampleNewValue();
  51229. $ctx3.sendIdx["sampleNewValue"]=1;
  51230. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  51231. }));
  51232. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  51233. $3=self._sampleNewValue();
  51234. $ctx2.sendIdx["sampleNewValue"]=2;
  51235. self._assert_equals_($1,$3);
  51236. $ctx2.sendIdx["assert:equals:"]=1;
  51237. return self._assert_($recv(visited)._isNil());
  51238. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51239. }));
  51240. self._samplesDo_((function(index,value){
  51241. return $core.withContext(function($ctx2) {
  51242. visited=nil;
  51243. visited;
  51244. $5=self._collection();
  51245. $ctx2.sendIdx["collection"]=2;
  51246. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  51247. visited=value2;
  51248. visited;
  51249. return sentinel;
  51250. }),(function(){
  51251. return $core.withContext(function($ctx3) {
  51252. return self._sampleNewValue();
  51253. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  51254. }));
  51255. self._assert_equals_($4,sentinel);
  51256. $ctx2.sendIdx["assert:equals:"]=2;
  51257. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  51258. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  51259. }));
  51260. return self;
  51261. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  51262. },
  51263. args: [],
  51264. 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) ]",
  51265. referencedClasses: ["Object"],
  51266. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  51267. }),
  51268. $globals.IndexableCollectionTest);
  51269. $core.addMethod(
  51270. $core.method({
  51271. selector: "testAtPut",
  51272. protocol: 'tests',
  51273. fn: function (){
  51274. var self=this;
  51275. var newCollection;
  51276. return $core.withContext(function($ctx1) {
  51277. newCollection=self._collection();
  51278. $ctx1.sendIdx["collection"]=1;
  51279. self._samplesDo_((function(index,value){
  51280. return $core.withContext(function($ctx2) {
  51281. return $recv(newCollection)._at_put_(index,value);
  51282. $ctx2.sendIdx["at:put:"]=1;
  51283. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  51284. }));
  51285. self._assert_equals_(newCollection,self._collection());
  51286. $ctx1.sendIdx["assert:equals:"]=1;
  51287. $recv(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  51288. self._assert_equals_(newCollection,self._collectionWithNewValue());
  51289. return self;
  51290. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  51291. },
  51292. args: [],
  51293. 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",
  51294. referencedClasses: [],
  51295. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  51296. }),
  51297. $globals.IndexableCollectionTest);
  51298. $core.addMethod(
  51299. $core.method({
  51300. selector: "testIndexOf",
  51301. protocol: 'tests',
  51302. fn: function (){
  51303. var self=this;
  51304. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  51305. return $core.withContext(function($ctx1) {
  51306. var $1;
  51307. self._should_raise_((function(){
  51308. return $core.withContext(function($ctx2) {
  51309. $1=self._collection();
  51310. $ctx2.sendIdx["collection"]=1;
  51311. return $recv($1)._indexOf_(self._sampleNewValue());
  51312. $ctx2.sendIdx["indexOf:"]=1;
  51313. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51314. }),$Error());
  51315. self._samplesDo_((function(index,value){
  51316. return $core.withContext(function($ctx2) {
  51317. return self._assert_equals_($recv(self._collection())._indexOf_(value),index);
  51318. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  51319. }));
  51320. return self;
  51321. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  51322. },
  51323. args: [],
  51324. 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 ]",
  51325. referencedClasses: ["Error"],
  51326. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  51327. }),
  51328. $globals.IndexableCollectionTest);
  51329. $core.addMethod(
  51330. $core.method({
  51331. selector: "testIndexOfWithNull",
  51332. protocol: 'tests',
  51333. fn: function (){
  51334. var self=this;
  51335. var jsNull;
  51336. function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  51337. return $core.withContext(function($ctx1) {
  51338. var $1,$2;
  51339. jsNull=$recv($JSON())._parse_("null");
  51340. self._samplesDo_((function(index,value){
  51341. return $core.withContext(function($ctx2) {
  51342. $1=self._collection();
  51343. $recv($1)._at_put_(index,jsNull);
  51344. $2=$recv($1)._indexOf_(jsNull);
  51345. return self._assert_equals_($2,index);
  51346. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  51347. }));
  51348. return self;
  51349. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  51350. },
  51351. args: [],
  51352. 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 ]",
  51353. referencedClasses: ["JSON"],
  51354. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  51355. }),
  51356. $globals.IndexableCollectionTest);
  51357. $core.addMethod(
  51358. $core.method({
  51359. selector: "testWithIndexDo",
  51360. protocol: 'tests',
  51361. fn: function (){
  51362. var self=this;
  51363. var collection;
  51364. return $core.withContext(function($ctx1) {
  51365. collection=self._collection();
  51366. $ctx1.sendIdx["collection"]=1;
  51367. $recv(self._collection())._withIndexDo_((function(each,index){
  51368. return $core.withContext(function($ctx2) {
  51369. return self._assert_equals_($recv(collection)._at_(index),each);
  51370. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  51371. }));
  51372. return self;
  51373. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  51374. },
  51375. args: [],
  51376. 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 ]",
  51377. referencedClasses: [],
  51378. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  51379. }),
  51380. $globals.IndexableCollectionTest);
  51381. $core.addClass('AssociativeCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
  51382. $core.addMethod(
  51383. $core.method({
  51384. selector: "collectionKeys",
  51385. protocol: 'fixture',
  51386. fn: function (){
  51387. var self=this;
  51388. return $core.withContext(function($ctx1) {
  51389. self._subclassResponsibility();
  51390. return self;
  51391. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  51392. },
  51393. args: [],
  51394. source: "collectionKeys\x0a\x09self subclassResponsibility",
  51395. referencedClasses: [],
  51396. messageSends: ["subclassResponsibility"]
  51397. }),
  51398. $globals.AssociativeCollectionTest);
  51399. $core.addMethod(
  51400. $core.method({
  51401. selector: "collectionValues",
  51402. protocol: 'fixture',
  51403. fn: function (){
  51404. var self=this;
  51405. return $core.withContext(function($ctx1) {
  51406. self._subclassResponsibility();
  51407. return self;
  51408. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  51409. },
  51410. args: [],
  51411. source: "collectionValues\x0a\x09self subclassResponsibility",
  51412. referencedClasses: [],
  51413. messageSends: ["subclassResponsibility"]
  51414. }),
  51415. $globals.AssociativeCollectionTest);
  51416. $core.addMethod(
  51417. $core.method({
  51418. selector: "nonIndexesDo:",
  51419. protocol: 'fixture',
  51420. fn: function (aBlock){
  51421. var self=this;
  51422. return $core.withContext(function($ctx1) {
  51423. $recv(aBlock)._value_((5));
  51424. $ctx1.sendIdx["value:"]=1;
  51425. $recv(aBlock)._value_("z");
  51426. return self;
  51427. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  51428. },
  51429. args: ["aBlock"],
  51430. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  51431. referencedClasses: [],
  51432. messageSends: ["value:"]
  51433. }),
  51434. $globals.AssociativeCollectionTest);
  51435. $core.addMethod(
  51436. $core.method({
  51437. selector: "sampleNewIndex",
  51438. protocol: 'fixture',
  51439. fn: function (){
  51440. var self=this;
  51441. return "new";
  51442. },
  51443. args: [],
  51444. source: "sampleNewIndex\x0a\x09^ 'new'",
  51445. referencedClasses: [],
  51446. messageSends: []
  51447. }),
  51448. $globals.AssociativeCollectionTest);
  51449. $core.addMethod(
  51450. $core.method({
  51451. selector: "samplesDo:",
  51452. protocol: 'fixture',
  51453. fn: function (aBlock){
  51454. var self=this;
  51455. return $core.withContext(function($ctx1) {
  51456. $recv(aBlock)._value_value_("a",(2));
  51457. return self;
  51458. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  51459. },
  51460. args: ["aBlock"],
  51461. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  51462. referencedClasses: [],
  51463. messageSends: ["value:value:"]
  51464. }),
  51465. $globals.AssociativeCollectionTest);
  51466. $core.addMethod(
  51467. $core.method({
  51468. selector: "testAddAll",
  51469. protocol: 'tests',
  51470. fn: function (){
  51471. var self=this;
  51472. return $core.withContext(function($ctx1) {
  51473. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  51474. (
  51475. $ctx1.supercall = true,
  51476. $globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply($recv(self), []));
  51477. $ctx1.supercall = false;
  51478. $2=self._collection();
  51479. $ctx1.sendIdx["collection"]=1;
  51480. $3=$2;
  51481. $4=self._collection();
  51482. $ctx1.sendIdx["collection"]=2;
  51483. $recv($3)._addAll_($4);
  51484. $ctx1.sendIdx["addAll:"]=1;
  51485. $5=$recv($2)._yourself();
  51486. $ctx1.sendIdx["yourself"]=1;
  51487. $1=$5;
  51488. $6=self._collection();
  51489. $ctx1.sendIdx["collection"]=3;
  51490. self._assert_equals_($1,$6);
  51491. $ctx1.sendIdx["assert:equals:"]=1;
  51492. $8=self._collection();
  51493. $ctx1.sendIdx["collection"]=4;
  51494. $9=$8;
  51495. $10=self._collectionWithNewValue();
  51496. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51497. $recv($9)._addAll_($10);
  51498. $ctx1.sendIdx["addAll:"]=2;
  51499. $11=$recv($8)._yourself();
  51500. $ctx1.sendIdx["yourself"]=2;
  51501. $7=$11;
  51502. $12=self._collectionWithNewValue();
  51503. $ctx1.sendIdx["collectionWithNewValue"]=2;
  51504. self._assert_equals_($7,$12);
  51505. $ctx1.sendIdx["assert:equals:"]=2;
  51506. $14=self._collectionWithNewValue();
  51507. $ctx1.sendIdx["collectionWithNewValue"]=3;
  51508. $recv($14)._addAll_(self._collection());
  51509. $15=$recv($14)._yourself();
  51510. $13=$15;
  51511. self._assert_equals_($13,self._collectionWithNewValue());
  51512. return self;
  51513. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  51514. },
  51515. args: [],
  51516. 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",
  51517. referencedClasses: [],
  51518. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  51519. }),
  51520. $globals.AssociativeCollectionTest);
  51521. $core.addMethod(
  51522. $core.method({
  51523. selector: "testAsDictionary",
  51524. protocol: 'tests',
  51525. fn: function (){
  51526. var self=this;
  51527. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51528. return $core.withContext(function($ctx1) {
  51529. self._assert_($recv($recv($recv(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  51530. return self;
  51531. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  51532. },
  51533. args: [],
  51534. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  51535. referencedClasses: ["Dictionary"],
  51536. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  51537. }),
  51538. $globals.AssociativeCollectionTest);
  51539. $core.addMethod(
  51540. $core.method({
  51541. selector: "testAsHashedCollection",
  51542. protocol: 'tests',
  51543. fn: function (){
  51544. var self=this;
  51545. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  51546. return $core.withContext(function($ctx1) {
  51547. self._assert_($recv($recv($recv(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  51548. return self;
  51549. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  51550. },
  51551. args: [],
  51552. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  51553. referencedClasses: ["HashedCollection"],
  51554. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  51555. }),
  51556. $globals.AssociativeCollectionTest);
  51557. $core.addMethod(
  51558. $core.method({
  51559. selector: "testComma",
  51560. protocol: 'tests',
  51561. fn: function (){
  51562. var self=this;
  51563. return $core.withContext(function($ctx1) {
  51564. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  51565. (
  51566. $ctx1.supercall = true,
  51567. $globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply($recv(self), []));
  51568. $ctx1.supercall = false;
  51569. $2=self._collection();
  51570. $ctx1.sendIdx["collection"]=1;
  51571. $3=self._collection();
  51572. $ctx1.sendIdx["collection"]=2;
  51573. $1=$recv($2).__comma($3);
  51574. $ctx1.sendIdx[","]=1;
  51575. $4=self._collection();
  51576. $ctx1.sendIdx["collection"]=3;
  51577. self._assert_equals_($1,$4);
  51578. $ctx1.sendIdx["assert:equals:"]=1;
  51579. $6=self._collection();
  51580. $ctx1.sendIdx["collection"]=4;
  51581. $7=self._collectionWithNewValue();
  51582. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51583. $5=$recv($6).__comma($7);
  51584. $ctx1.sendIdx[","]=2;
  51585. $8=self._collectionWithNewValue();
  51586. $ctx1.sendIdx["collectionWithNewValue"]=2;
  51587. self._assert_equals_($5,$8);
  51588. $ctx1.sendIdx["assert:equals:"]=2;
  51589. $10=self._collectionWithNewValue();
  51590. $ctx1.sendIdx["collectionWithNewValue"]=3;
  51591. $9=$recv($10).__comma(self._collection());
  51592. self._assert_equals_($9,self._collectionWithNewValue());
  51593. return self;
  51594. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  51595. },
  51596. args: [],
  51597. 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",
  51598. referencedClasses: [],
  51599. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  51600. }),
  51601. $globals.AssociativeCollectionTest);
  51602. $core.addMethod(
  51603. $core.method({
  51604. selector: "testFrom",
  51605. protocol: 'tests',
  51606. fn: function (){
  51607. var self=this;
  51608. var associations;
  51609. return $core.withContext(function($ctx1) {
  51610. var $1;
  51611. $1="a".__minus_gt((1));
  51612. $ctx1.sendIdx["->"]=1;
  51613. associations=[$1,"b".__minus_gt((2))];
  51614. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  51615. return self;
  51616. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  51617. },
  51618. args: [],
  51619. 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 }.",
  51620. referencedClasses: [],
  51621. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  51622. }),
  51623. $globals.AssociativeCollectionTest);
  51624. $core.addMethod(
  51625. $core.method({
  51626. selector: "testKeys",
  51627. protocol: 'tests',
  51628. fn: function (){
  51629. var self=this;
  51630. return $core.withContext(function($ctx1) {
  51631. var $2,$1,$3,$4;
  51632. $2=$recv($recv(self._collectionClass())._new())._keys();
  51633. $ctx1.sendIdx["keys"]=1;
  51634. $1=$recv($2)._isEmpty();
  51635. self._assert_($1);
  51636. $3=$recv(self._collection())._keys();
  51637. $ctx1.sendIdx["keys"]=2;
  51638. $4=self._collectionKeys();
  51639. $ctx1.sendIdx["collectionKeys"]=1;
  51640. self._assertSameContents_as_($3,$4);
  51641. $ctx1.sendIdx["assertSameContents:as:"]=1;
  51642. self._assertSameContents_as_($recv(self._collectionWithNewValue())._keys(),$recv(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  51643. return self;
  51644. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  51645. },
  51646. args: [],
  51647. 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 }",
  51648. referencedClasses: [],
  51649. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  51650. }),
  51651. $globals.AssociativeCollectionTest);
  51652. $core.addMethod(
  51653. $core.method({
  51654. selector: "testNewFromPairs",
  51655. protocol: 'tests',
  51656. fn: function (){
  51657. var self=this;
  51658. var flattenedAssociations;
  51659. return $core.withContext(function($ctx1) {
  51660. flattenedAssociations=["a",(1),"b",(2)];
  51661. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  51662. return self;
  51663. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  51664. },
  51665. args: [],
  51666. 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 }.",
  51667. referencedClasses: [],
  51668. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  51669. }),
  51670. $globals.AssociativeCollectionTest);
  51671. $core.addMethod(
  51672. $core.method({
  51673. selector: "testPrintString",
  51674. protocol: 'tests',
  51675. fn: function (){
  51676. var self=this;
  51677. return $core.withContext(function($ctx1) {
  51678. var $3,$2,$4,$1,$5;
  51679. $3=self._collectionClass();
  51680. $ctx1.sendIdx["collectionClass"]=1;
  51681. $2=$recv($3)._new();
  51682. $recv($2)._at_put_("firstname","James");
  51683. $ctx1.sendIdx["at:put:"]=1;
  51684. $recv($2)._at_put_("lastname","Bond");
  51685. $4=$recv($2)._printString();
  51686. $1=$4;
  51687. $5=$recv("a ".__comma($recv(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  51688. $ctx1.sendIdx[","]=1;
  51689. self._assert_equals_($1,$5);
  51690. return self;
  51691. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  51692. },
  51693. args: [],
  51694. 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'')'",
  51695. referencedClasses: [],
  51696. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  51697. }),
  51698. $globals.AssociativeCollectionTest);
  51699. $core.addMethod(
  51700. $core.method({
  51701. selector: "testRemoveKey",
  51702. protocol: 'tests',
  51703. fn: function (){
  51704. var self=this;
  51705. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  51706. return $core.withContext(function($ctx1) {
  51707. var $1,$2,$3,$5,$6,$4,$7,$8;
  51708. self._nonIndexesDo_((function(each){
  51709. var collection;
  51710. return $core.withContext(function($ctx2) {
  51711. collection=self._collection();
  51712. $ctx2.sendIdx["collection"]=1;
  51713. collection;
  51714. self._should_raise_((function(){
  51715. return $core.withContext(function($ctx3) {
  51716. return $recv(collection)._removeKey_(each);
  51717. $ctx3.sendIdx["removeKey:"]=1;
  51718. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51719. }),$Error());
  51720. $1=collection;
  51721. $2=self._collection();
  51722. $ctx2.sendIdx["collection"]=2;
  51723. return self._assert_equals_($1,$2);
  51724. $ctx2.sendIdx["assert:equals:"]=1;
  51725. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  51726. }));
  51727. self._samplesDo_((function(index,value){
  51728. var collection;
  51729. return $core.withContext(function($ctx2) {
  51730. collection=self._collection();
  51731. $ctx2.sendIdx["collection"]=3;
  51732. collection;
  51733. $3=$recv(collection)._removeKey_(index);
  51734. $ctx2.sendIdx["removeKey:"]=2;
  51735. self._assert_equals_($3,value);
  51736. $ctx2.sendIdx["assert:equals:"]=2;
  51737. $5=collection;
  51738. $6=self._collection();
  51739. $ctx2.sendIdx["collection"]=4;
  51740. $4=$recv($5).__eq($6);
  51741. return self._deny_($4);
  51742. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  51743. }));
  51744. $7=self._collectionWithNewValue();
  51745. $recv($7)._removeKey_(self._sampleNewIndex());
  51746. $8=$recv($7)._yourself();
  51747. self._assert_equals_($8,self._collection());
  51748. return self;
  51749. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  51750. },
  51751. args: [],
  51752. 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",
  51753. referencedClasses: ["Error"],
  51754. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  51755. }),
  51756. $globals.AssociativeCollectionTest);
  51757. $core.addMethod(
  51758. $core.method({
  51759. selector: "testRemoveKeyIfAbsent",
  51760. protocol: 'tests',
  51761. fn: function (){
  51762. var self=this;
  51763. return $core.withContext(function($ctx1) {
  51764. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  51765. self._nonIndexesDo_((function(each){
  51766. var collection;
  51767. return $core.withContext(function($ctx2) {
  51768. collection=self._collection();
  51769. $ctx2.sendIdx["collection"]=1;
  51770. collection;
  51771. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  51772. return $core.withContext(function($ctx3) {
  51773. return self._sampleNewValue();
  51774. $ctx3.sendIdx["sampleNewValue"]=1;
  51775. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51776. }));
  51777. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  51778. $2=self._sampleNewValue();
  51779. $ctx2.sendIdx["sampleNewValue"]=2;
  51780. self._assert_equals_($1,$2);
  51781. $ctx2.sendIdx["assert:equals:"]=1;
  51782. $3=collection;
  51783. $4=self._collection();
  51784. $ctx2.sendIdx["collection"]=2;
  51785. return self._assert_equals_($3,$4);
  51786. $ctx2.sendIdx["assert:equals:"]=2;
  51787. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  51788. }));
  51789. self._samplesDo_((function(index,value){
  51790. var collection;
  51791. return $core.withContext(function($ctx2) {
  51792. collection=self._collection();
  51793. $ctx2.sendIdx["collection"]=3;
  51794. collection;
  51795. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  51796. return $core.withContext(function($ctx3) {
  51797. return self._sampleNewValue();
  51798. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  51799. }));
  51800. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  51801. self._assert_equals_($5,value);
  51802. $ctx2.sendIdx["assert:equals:"]=3;
  51803. $7=collection;
  51804. $8=self._collection();
  51805. $ctx2.sendIdx["collection"]=4;
  51806. $6=$recv($7).__eq($8);
  51807. return self._deny_($6);
  51808. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  51809. }));
  51810. $9=self._collectionWithNewValue();
  51811. $recv($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  51812. return $core.withContext(function($ctx2) {
  51813. return self._assert_(false);
  51814. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  51815. }));
  51816. $10=$recv($9)._yourself();
  51817. self._assert_equals_($10,self._collection());
  51818. return self;
  51819. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  51820. },
  51821. args: [],
  51822. 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",
  51823. referencedClasses: [],
  51824. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  51825. }),
  51826. $globals.AssociativeCollectionTest);
  51827. $core.addMethod(
  51828. $core.method({
  51829. selector: "testValues",
  51830. protocol: 'tests',
  51831. fn: function (){
  51832. var self=this;
  51833. return $core.withContext(function($ctx1) {
  51834. var $2,$1,$3,$4;
  51835. $2=$recv($recv(self._collectionClass())._new())._values();
  51836. $ctx1.sendIdx["values"]=1;
  51837. $1=$recv($2)._isEmpty();
  51838. self._assert_($1);
  51839. $3=$recv(self._collection())._values();
  51840. $ctx1.sendIdx["values"]=2;
  51841. $4=self._collectionValues();
  51842. $ctx1.sendIdx["collectionValues"]=1;
  51843. self._assertSameContents_as_($3,$4);
  51844. $ctx1.sendIdx["assertSameContents:as:"]=1;
  51845. self._assertSameContents_as_($recv(self._collectionWithNewValue())._values(),$recv(self._collectionValues()).__comma([self._sampleNewValue()]));
  51846. return self;
  51847. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  51848. },
  51849. args: [],
  51850. 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 }",
  51851. referencedClasses: [],
  51852. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  51853. }),
  51854. $globals.AssociativeCollectionTest);
  51855. $core.addClass('DictionaryTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  51856. $core.addMethod(
  51857. $core.method({
  51858. selector: "collection",
  51859. protocol: 'fixture',
  51860. fn: function (){
  51861. var self=this;
  51862. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51863. return $core.withContext(function($ctx1) {
  51864. var $2,$3,$1;
  51865. $2=$recv($Dictionary())._new();
  51866. $recv($2)._at_put_((1),(1));
  51867. $ctx1.sendIdx["at:put:"]=1;
  51868. $recv($2)._at_put_("a",(2));
  51869. $ctx1.sendIdx["at:put:"]=2;
  51870. $recv($2)._at_put_(true,(3));
  51871. $ctx1.sendIdx["at:put:"]=3;
  51872. $recv($2)._at_put_((1).__at((3)),(-4));
  51873. $3=$recv($2)._yourself();
  51874. $1=$3;
  51875. return $1;
  51876. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  51877. },
  51878. args: [],
  51879. source: "collection\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 1@3 put: -4;\x0a\x09\x09yourself",
  51880. referencedClasses: ["Dictionary"],
  51881. messageSends: ["at:put:", "new", "@", "yourself"]
  51882. }),
  51883. $globals.DictionaryTest);
  51884. $core.addMethod(
  51885. $core.method({
  51886. selector: "collectionKeys",
  51887. protocol: 'fixture',
  51888. fn: function (){
  51889. var self=this;
  51890. return $core.withContext(function($ctx1) {
  51891. var $1;
  51892. $1=[(1),"a",true,(1).__at((3))];
  51893. return $1;
  51894. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  51895. },
  51896. args: [],
  51897. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  51898. referencedClasses: [],
  51899. messageSends: ["@"]
  51900. }),
  51901. $globals.DictionaryTest);
  51902. $core.addMethod(
  51903. $core.method({
  51904. selector: "collectionOfPrintStrings",
  51905. protocol: 'fixture',
  51906. fn: function (){
  51907. var self=this;
  51908. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51909. return $core.withContext(function($ctx1) {
  51910. var $2,$3,$1;
  51911. $2=$recv($Dictionary())._new();
  51912. $recv($2)._at_put_((1),"1");
  51913. $ctx1.sendIdx["at:put:"]=1;
  51914. $recv($2)._at_put_("a","2");
  51915. $ctx1.sendIdx["at:put:"]=2;
  51916. $recv($2)._at_put_(true,"3");
  51917. $ctx1.sendIdx["at:put:"]=3;
  51918. $recv($2)._at_put_((1).__at((3)),"-4");
  51919. $3=$recv($2)._yourself();
  51920. $1=$3;
  51921. return $1;
  51922. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  51923. },
  51924. args: [],
  51925. source: "collectionOfPrintStrings\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: '1';\x0a\x09\x09at: 'a' put: '2';\x0a\x09\x09at: true put: '3';\x0a\x09\x09at: 1@3 put: '-4';\x0a\x09\x09yourself",
  51926. referencedClasses: ["Dictionary"],
  51927. messageSends: ["at:put:", "new", "@", "yourself"]
  51928. }),
  51929. $globals.DictionaryTest);
  51930. $core.addMethod(
  51931. $core.method({
  51932. selector: "collectionSize",
  51933. protocol: 'fixture',
  51934. fn: function (){
  51935. var self=this;
  51936. return (4);
  51937. },
  51938. args: [],
  51939. source: "collectionSize\x0a\x09^ 4",
  51940. referencedClasses: [],
  51941. messageSends: []
  51942. }),
  51943. $globals.DictionaryTest);
  51944. $core.addMethod(
  51945. $core.method({
  51946. selector: "collectionValues",
  51947. protocol: 'fixture',
  51948. fn: function (){
  51949. var self=this;
  51950. var $1;
  51951. $1=[(1),(2),(3),(-4)];
  51952. return $1;
  51953. },
  51954. args: [],
  51955. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  51956. referencedClasses: [],
  51957. messageSends: []
  51958. }),
  51959. $globals.DictionaryTest);
  51960. $core.addMethod(
  51961. $core.method({
  51962. selector: "collectionWithDuplicates",
  51963. protocol: 'fixture',
  51964. fn: function (){
  51965. var self=this;
  51966. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51967. return $core.withContext(function($ctx1) {
  51968. var $2,$3,$1;
  51969. $2=$recv($Dictionary())._new();
  51970. $recv($2)._at_put_((1),(1));
  51971. $ctx1.sendIdx["at:put:"]=1;
  51972. $recv($2)._at_put_("a",(2));
  51973. $ctx1.sendIdx["at:put:"]=2;
  51974. $recv($2)._at_put_(true,(3));
  51975. $ctx1.sendIdx["at:put:"]=3;
  51976. $recv($2)._at_put_((4),(-4));
  51977. $ctx1.sendIdx["at:put:"]=4;
  51978. $recv($2)._at_put_("b",(1));
  51979. $ctx1.sendIdx["at:put:"]=5;
  51980. $recv($2)._at_put_((3),(3));
  51981. $ctx1.sendIdx["at:put:"]=6;
  51982. $recv($2)._at_put_(false,(12));
  51983. $3=$recv($2)._yourself();
  51984. $1=$3;
  51985. return $1;
  51986. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  51987. },
  51988. args: [],
  51989. source: "collectionWithDuplicates\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 4 put: -4;\x0a\x09\x09at: 'b' put: 1;\x0a\x09\x09at: 3 put: 3;\x0a\x09\x09at: false put: 12;\x0a\x09\x09yourself",
  51990. referencedClasses: ["Dictionary"],
  51991. messageSends: ["at:put:", "new", "yourself"]
  51992. }),
  51993. $globals.DictionaryTest);
  51994. $core.addMethod(
  51995. $core.method({
  51996. selector: "collectionWithNewValue",
  51997. protocol: 'fixture',
  51998. fn: function (){
  51999. var self=this;
  52000. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  52001. return $core.withContext(function($ctx1) {
  52002. var $2,$3,$1;
  52003. $2=$recv($Dictionary())._new();
  52004. $recv($2)._at_put_((1),(1));
  52005. $ctx1.sendIdx["at:put:"]=1;
  52006. $recv($2)._at_put_("a",(2));
  52007. $ctx1.sendIdx["at:put:"]=2;
  52008. $recv($2)._at_put_(true,(3));
  52009. $ctx1.sendIdx["at:put:"]=3;
  52010. $recv($2)._at_put_((1).__at((3)),(-4));
  52011. $ctx1.sendIdx["at:put:"]=4;
  52012. $recv($2)._at_put_("new","N");
  52013. $3=$recv($2)._yourself();
  52014. $1=$3;
  52015. return $1;
  52016. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  52017. },
  52018. args: [],
  52019. source: "collectionWithNewValue\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 1@3 put: -4;\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  52020. referencedClasses: ["Dictionary"],
  52021. messageSends: ["at:put:", "new", "@", "yourself"]
  52022. }),
  52023. $globals.DictionaryTest);
  52024. $core.addMethod(
  52025. $core.method({
  52026. selector: "sampleNewValueAsCollection",
  52027. protocol: 'fixture',
  52028. fn: function (){
  52029. var self=this;
  52030. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  52031. return $core.withContext(function($ctx1) {
  52032. var $2,$3,$1;
  52033. $2=$recv($Dictionary())._new();
  52034. $recv($2)._at_put_("new","N");
  52035. $3=$recv($2)._yourself();
  52036. $1=$3;
  52037. return $1;
  52038. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  52039. },
  52040. args: [],
  52041. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  52042. referencedClasses: ["Dictionary"],
  52043. messageSends: ["at:put:", "new", "yourself"]
  52044. }),
  52045. $globals.DictionaryTest);
  52046. $core.addMethod(
  52047. $core.method({
  52048. selector: "samplesDo:",
  52049. protocol: 'fixture',
  52050. fn: function (aBlock){
  52051. var self=this;
  52052. return $core.withContext(function($ctx1) {
  52053. (
  52054. $ctx1.supercall = true,
  52055. $globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  52056. $ctx1.supercall = false;
  52057. $recv(aBlock)._value_value_(true,(3));
  52058. $ctx1.sendIdx["value:value:"]=1;
  52059. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  52060. return self;
  52061. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  52062. },
  52063. args: ["aBlock"],
  52064. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  52065. referencedClasses: [],
  52066. messageSends: ["samplesDo:", "value:value:", "@"]
  52067. }),
  52068. $globals.DictionaryTest);
  52069. $core.addMethod(
  52070. $core.method({
  52071. selector: "testAccessing",
  52072. protocol: 'tests',
  52073. fn: function (){
  52074. var self=this;
  52075. var d;
  52076. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  52077. return $core.withContext(function($ctx1) {
  52078. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  52079. d=$recv($Dictionary())._new();
  52080. $recv(d)._at_put_("hello","world");
  52081. $ctx1.sendIdx["at:put:"]=1;
  52082. $1=$recv(d)._at_("hello");
  52083. $ctx1.sendIdx["at:"]=1;
  52084. self._assert_equals_($1,"world");
  52085. $ctx1.sendIdx["assert:equals:"]=1;
  52086. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  52087. return nil;
  52088. }));
  52089. $ctx1.sendIdx["at:ifAbsent:"]=1;
  52090. self._assert_equals_($2,"world");
  52091. $ctx1.sendIdx["assert:equals:"]=2;
  52092. self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  52093. return nil;
  52094. }))).__eq("world"));
  52095. $ctx1.sendIdx["deny:"]=1;
  52096. $3=$recv(d)._includesKey_("hello");
  52097. $ctx1.sendIdx["includesKey:"]=1;
  52098. self._assert_($3);
  52099. $ctx1.sendIdx["assert:"]=1;
  52100. $4=$recv(d)._includesKey_("foo");
  52101. $ctx1.sendIdx["includesKey:"]=2;
  52102. self._deny_($4);
  52103. $ctx1.sendIdx["deny:"]=2;
  52104. $recv(d)._at_put_((1),(2));
  52105. $ctx1.sendIdx["at:put:"]=2;
  52106. $5=$recv(d)._at_((1));
  52107. $ctx1.sendIdx["at:"]=2;
  52108. self._assert_equals_($5,(2));
  52109. $ctx1.sendIdx["assert:equals:"]=3;
  52110. $6=d;
  52111. $7=(1).__at((3));
  52112. $ctx1.sendIdx["@"]=1;
  52113. $recv($6)._at_put_($7,(3));
  52114. $9=d;
  52115. $10=(1).__at((3));
  52116. $ctx1.sendIdx["@"]=2;
  52117. $8=$recv($9)._at_($10);
  52118. self._assert_equals_($8,(3));
  52119. $12=d;
  52120. $13=(1).__at((3));
  52121. $ctx1.sendIdx["@"]=3;
  52122. $11=$recv($12)._includesKey_($13);
  52123. $ctx1.sendIdx["includesKey:"]=3;
  52124. self._assert_($11);
  52125. self._deny_($recv(d)._includesKey_((3).__at((1))));
  52126. return self;
  52127. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  52128. },
  52129. args: [],
  52130. 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)",
  52131. referencedClasses: ["Dictionary"],
  52132. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  52133. }),
  52134. $globals.DictionaryTest);
  52135. $core.addMethod(
  52136. $core.method({
  52137. selector: "testDynamicDictionaries",
  52138. protocol: 'tests',
  52139. fn: function (){
  52140. var self=this;
  52141. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  52142. return $core.withContext(function($ctx1) {
  52143. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($Dictionary())._with_("hello".__minus_gt((1))));
  52144. return self;
  52145. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  52146. },
  52147. args: [],
  52148. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  52149. referencedClasses: ["Dictionary"],
  52150. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  52151. }),
  52152. $globals.DictionaryTest);
  52153. $core.addMethod(
  52154. $core.method({
  52155. selector: "collectionClass",
  52156. protocol: 'fixture',
  52157. fn: function (){
  52158. var self=this;
  52159. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  52160. return $Dictionary();
  52161. },
  52162. args: [],
  52163. source: "collectionClass\x0a\x09^ Dictionary",
  52164. referencedClasses: ["Dictionary"],
  52165. messageSends: []
  52166. }),
  52167. $globals.DictionaryTest.klass);
  52168. $core.addClass('HashedCollectionTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  52169. $core.addMethod(
  52170. $core.method({
  52171. selector: "collection",
  52172. protocol: 'fixture',
  52173. fn: function (){
  52174. var self=this;
  52175. var $1;
  52176. $1=$globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  52177. return $1;
  52178. },
  52179. args: [],
  52180. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  52181. referencedClasses: [],
  52182. messageSends: []
  52183. }),
  52184. $globals.HashedCollectionTest);
  52185. $core.addMethod(
  52186. $core.method({
  52187. selector: "collectionKeys",
  52188. protocol: 'fixture',
  52189. fn: function (){
  52190. var self=this;
  52191. var $1;
  52192. $1=["b","a","c","d"];
  52193. return $1;
  52194. },
  52195. args: [],
  52196. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  52197. referencedClasses: [],
  52198. messageSends: []
  52199. }),
  52200. $globals.HashedCollectionTest);
  52201. $core.addMethod(
  52202. $core.method({
  52203. selector: "collectionOfPrintStrings",
  52204. protocol: 'fixture',
  52205. fn: function (){
  52206. var self=this;
  52207. var $1;
  52208. $1=$globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  52209. return $1;
  52210. },
  52211. args: [],
  52212. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  52213. referencedClasses: [],
  52214. messageSends: []
  52215. }),
  52216. $globals.HashedCollectionTest);
  52217. $core.addMethod(
  52218. $core.method({
  52219. selector: "collectionSize",
  52220. protocol: 'fixture',
  52221. fn: function (){
  52222. var self=this;
  52223. return (4);
  52224. },
  52225. args: [],
  52226. source: "collectionSize\x0a\x09^ 4",
  52227. referencedClasses: [],
  52228. messageSends: []
  52229. }),
  52230. $globals.HashedCollectionTest);
  52231. $core.addMethod(
  52232. $core.method({
  52233. selector: "collectionValues",
  52234. protocol: 'fixture',
  52235. fn: function (){
  52236. var self=this;
  52237. var $1;
  52238. $1=[(1),(2),(3),(-4)];
  52239. return $1;
  52240. },
  52241. args: [],
  52242. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  52243. referencedClasses: [],
  52244. messageSends: []
  52245. }),
  52246. $globals.HashedCollectionTest);
  52247. $core.addMethod(
  52248. $core.method({
  52249. selector: "collectionWithDuplicates",
  52250. protocol: 'fixture',
  52251. fn: function (){
  52252. var self=this;
  52253. var $1;
  52254. $1=$globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10)]);
  52255. return $1;
  52256. },
  52257. args: [],
  52258. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  52259. referencedClasses: [],
  52260. messageSends: []
  52261. }),
  52262. $globals.HashedCollectionTest);
  52263. $core.addMethod(
  52264. $core.method({
  52265. selector: "collectionWithNewValue",
  52266. protocol: 'fixture',
  52267. fn: function (){
  52268. var self=this;
  52269. var $1;
  52270. $1=$globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  52271. return $1;
  52272. },
  52273. args: [],
  52274. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  52275. referencedClasses: [],
  52276. messageSends: []
  52277. }),
  52278. $globals.HashedCollectionTest);
  52279. $core.addMethod(
  52280. $core.method({
  52281. selector: "sampleNewValueAsCollection",
  52282. protocol: 'fixture',
  52283. fn: function (){
  52284. var self=this;
  52285. var $1;
  52286. $1=$globals.HashedCollection._newFromPairs_(["new","N"]);
  52287. return $1;
  52288. },
  52289. args: [],
  52290. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  52291. referencedClasses: [],
  52292. messageSends: []
  52293. }),
  52294. $globals.HashedCollectionTest);
  52295. $core.addMethod(
  52296. $core.method({
  52297. selector: "testDynamicDictionaries",
  52298. protocol: 'tests',
  52299. fn: function (){
  52300. var self=this;
  52301. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  52302. return $core.withContext(function($ctx1) {
  52303. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($HashedCollection())._with_("hello".__minus_gt((1))));
  52304. return self;
  52305. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  52306. },
  52307. args: [],
  52308. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  52309. referencedClasses: ["HashedCollection"],
  52310. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  52311. }),
  52312. $globals.HashedCollectionTest);
  52313. $core.addMethod(
  52314. $core.method({
  52315. selector: "collectionClass",
  52316. protocol: 'fixture',
  52317. fn: function (){
  52318. var self=this;
  52319. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  52320. return $HashedCollection();
  52321. },
  52322. args: [],
  52323. source: "collectionClass\x0a\x09^ HashedCollection",
  52324. referencedClasses: ["HashedCollection"],
  52325. messageSends: []
  52326. }),
  52327. $globals.HashedCollectionTest.klass);
  52328. $core.addClass('SequenceableCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
  52329. $core.addMethod(
  52330. $core.method({
  52331. selector: "collectionFirst",
  52332. protocol: 'fixture',
  52333. fn: function (){
  52334. var self=this;
  52335. return $core.withContext(function($ctx1) {
  52336. self._subclassResponsibility();
  52337. return self;
  52338. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  52339. },
  52340. args: [],
  52341. source: "collectionFirst\x0a\x09self subclassResponsibility",
  52342. referencedClasses: [],
  52343. messageSends: ["subclassResponsibility"]
  52344. }),
  52345. $globals.SequenceableCollectionTest);
  52346. $core.addMethod(
  52347. $core.method({
  52348. selector: "collectionFirstTwo",
  52349. protocol: 'fixture',
  52350. fn: function (){
  52351. var self=this;
  52352. return $core.withContext(function($ctx1) {
  52353. self._subclassResponsibility();
  52354. return self;
  52355. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  52356. },
  52357. args: [],
  52358. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  52359. referencedClasses: [],
  52360. messageSends: ["subclassResponsibility"]
  52361. }),
  52362. $globals.SequenceableCollectionTest);
  52363. $core.addMethod(
  52364. $core.method({
  52365. selector: "collectionLast",
  52366. protocol: 'fixture',
  52367. fn: function (){
  52368. var self=this;
  52369. return $core.withContext(function($ctx1) {
  52370. self._subclassResponsibility();
  52371. return self;
  52372. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  52373. },
  52374. args: [],
  52375. source: "collectionLast\x0a\x09self subclassResponsibility",
  52376. referencedClasses: [],
  52377. messageSends: ["subclassResponsibility"]
  52378. }),
  52379. $globals.SequenceableCollectionTest);
  52380. $core.addMethod(
  52381. $core.method({
  52382. selector: "collectionLastTwo",
  52383. protocol: 'fixture',
  52384. fn: function (){
  52385. var self=this;
  52386. return $core.withContext(function($ctx1) {
  52387. self._subclassResponsibility();
  52388. return self;
  52389. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  52390. },
  52391. args: [],
  52392. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  52393. referencedClasses: [],
  52394. messageSends: ["subclassResponsibility"]
  52395. }),
  52396. $globals.SequenceableCollectionTest);
  52397. $core.addMethod(
  52398. $core.method({
  52399. selector: "nonIndexesDo:",
  52400. protocol: 'fixture',
  52401. fn: function (aBlock){
  52402. var self=this;
  52403. return $core.withContext(function($ctx1) {
  52404. $recv(aBlock)._value_((0));
  52405. $ctx1.sendIdx["value:"]=1;
  52406. $recv(aBlock)._value_($recv(self._collectionSize()).__plus((1)));
  52407. $ctx1.sendIdx["value:"]=2;
  52408. $recv(aBlock)._value_("z");
  52409. return self;
  52410. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  52411. },
  52412. args: ["aBlock"],
  52413. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  52414. referencedClasses: [],
  52415. messageSends: ["value:", "+", "collectionSize"]
  52416. }),
  52417. $globals.SequenceableCollectionTest);
  52418. $core.addMethod(
  52419. $core.method({
  52420. selector: "samplesDo:",
  52421. protocol: 'fixture',
  52422. fn: function (aBlock){
  52423. var self=this;
  52424. return $core.withContext(function($ctx1) {
  52425. $recv(aBlock)._value_value_((1),self._collectionFirst());
  52426. $ctx1.sendIdx["value:value:"]=1;
  52427. $recv(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  52428. return self;
  52429. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  52430. },
  52431. args: ["aBlock"],
  52432. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  52433. referencedClasses: [],
  52434. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  52435. }),
  52436. $globals.SequenceableCollectionTest);
  52437. $core.addMethod(
  52438. $core.method({
  52439. selector: "testBeginsWith",
  52440. protocol: 'tests',
  52441. fn: function (){
  52442. var self=this;
  52443. return $core.withContext(function($ctx1) {
  52444. var $2,$1,$4,$5,$3,$7,$6;
  52445. $2=self._collection();
  52446. $ctx1.sendIdx["collection"]=1;
  52447. $1=$recv($2)._beginsWith_($recv(self._collectionClass())._new());
  52448. $ctx1.sendIdx["beginsWith:"]=1;
  52449. self._assert_($1);
  52450. $ctx1.sendIdx["assert:"]=1;
  52451. $4=self._collection();
  52452. $ctx1.sendIdx["collection"]=2;
  52453. $5=self._collection();
  52454. $ctx1.sendIdx["collection"]=3;
  52455. $3=$recv($4)._beginsWith_($5);
  52456. $ctx1.sendIdx["beginsWith:"]=2;
  52457. self._assert_($3);
  52458. $ctx1.sendIdx["assert:"]=2;
  52459. $7=self._collection();
  52460. $ctx1.sendIdx["collection"]=4;
  52461. $6=$recv($7)._beginsWith_(self._collectionFirstTwo());
  52462. $ctx1.sendIdx["beginsWith:"]=3;
  52463. self._assert_($6);
  52464. self._deny_($recv(self._collection())._beginsWith_(self._collectionLastTwo()));
  52465. return self;
  52466. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  52467. },
  52468. args: [],
  52469. 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)",
  52470. referencedClasses: [],
  52471. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  52472. }),
  52473. $globals.SequenceableCollectionTest);
  52474. $core.addMethod(
  52475. $core.method({
  52476. selector: "testEndsWith",
  52477. protocol: 'tests',
  52478. fn: function (){
  52479. var self=this;
  52480. return $core.withContext(function($ctx1) {
  52481. var $2,$1,$4,$5,$3,$7,$6;
  52482. $2=self._collection();
  52483. $ctx1.sendIdx["collection"]=1;
  52484. $1=$recv($2)._endsWith_($recv(self._collectionClass())._new());
  52485. $ctx1.sendIdx["endsWith:"]=1;
  52486. self._assert_($1);
  52487. $ctx1.sendIdx["assert:"]=1;
  52488. $4=self._collection();
  52489. $ctx1.sendIdx["collection"]=2;
  52490. $5=self._collection();
  52491. $ctx1.sendIdx["collection"]=3;
  52492. $3=$recv($4)._endsWith_($5);
  52493. $ctx1.sendIdx["endsWith:"]=2;
  52494. self._assert_($3);
  52495. $ctx1.sendIdx["assert:"]=2;
  52496. $7=self._collection();
  52497. $ctx1.sendIdx["collection"]=4;
  52498. $6=$recv($7)._endsWith_(self._collectionLastTwo());
  52499. $ctx1.sendIdx["endsWith:"]=3;
  52500. self._assert_($6);
  52501. self._deny_($recv(self._collection())._endsWith_(self._collectionFirstTwo()));
  52502. return self;
  52503. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  52504. },
  52505. args: [],
  52506. 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)",
  52507. referencedClasses: [],
  52508. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  52509. }),
  52510. $globals.SequenceableCollectionTest);
  52511. $core.addMethod(
  52512. $core.method({
  52513. selector: "testFirst",
  52514. protocol: 'tests',
  52515. fn: function (){
  52516. var self=this;
  52517. return $core.withContext(function($ctx1) {
  52518. self._assert_equals_($recv(self._collection())._first(),self._collectionFirst());
  52519. return self;
  52520. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  52521. },
  52522. args: [],
  52523. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  52524. referencedClasses: [],
  52525. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  52526. }),
  52527. $globals.SequenceableCollectionTest);
  52528. $core.addMethod(
  52529. $core.method({
  52530. selector: "testFirstN",
  52531. protocol: 'tests',
  52532. fn: function (){
  52533. var self=this;
  52534. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  52535. return $core.withContext(function($ctx1) {
  52536. var $2,$1,$4,$3,$6,$5,$7;
  52537. $2=self._collection();
  52538. $ctx1.sendIdx["collection"]=1;
  52539. $1=$recv($2)._first_((2));
  52540. $ctx1.sendIdx["first:"]=1;
  52541. self._assert_equals_($1,self._collectionFirstTwo());
  52542. $ctx1.sendIdx["assert:equals:"]=1;
  52543. $4=self._collection();
  52544. $ctx1.sendIdx["collection"]=2;
  52545. $3=$recv($4)._first_((0));
  52546. $ctx1.sendIdx["first:"]=2;
  52547. self._assert_equals_($3,$recv(self._collectionClass())._new());
  52548. $ctx1.sendIdx["assert:equals:"]=2;
  52549. $6=self._collection();
  52550. $ctx1.sendIdx["collection"]=3;
  52551. $5=$recv($6)._first_(self._collectionSize());
  52552. $ctx1.sendIdx["first:"]=3;
  52553. $7=self._collection();
  52554. $ctx1.sendIdx["collection"]=4;
  52555. self._assert_equals_($5,$7);
  52556. self._should_raise_((function(){
  52557. return $core.withContext(function($ctx2) {
  52558. return $recv(self._collection())._first_((33));
  52559. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52560. }),$Error());
  52561. return self;
  52562. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  52563. },
  52564. args: [],
  52565. 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",
  52566. referencedClasses: ["Error"],
  52567. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  52568. }),
  52569. $globals.SequenceableCollectionTest);
  52570. $core.addMethod(
  52571. $core.method({
  52572. selector: "testFourth",
  52573. protocol: 'tests',
  52574. fn: function (){
  52575. var self=this;
  52576. return $core.withContext(function($ctx1) {
  52577. var $2,$1;
  52578. $2=self._collection();
  52579. $ctx1.sendIdx["collection"]=1;
  52580. $1=$recv($2)._fourth();
  52581. self._assert_equals_($1,$recv(self._collection())._at_((4)));
  52582. return self;
  52583. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  52584. },
  52585. args: [],
  52586. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  52587. referencedClasses: [],
  52588. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  52589. }),
  52590. $globals.SequenceableCollectionTest);
  52591. $core.addMethod(
  52592. $core.method({
  52593. selector: "testIndexOfStartingAt",
  52594. protocol: 'tests',
  52595. fn: function (){
  52596. var self=this;
  52597. var jsNull;
  52598. function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  52599. return $core.withContext(function($ctx1) {
  52600. var $2,$1,$4,$3;
  52601. jsNull=$recv($JSON())._parse_("null");
  52602. self._samplesDo_((function(index,value){
  52603. return $core.withContext(function($ctx2) {
  52604. $2=self._collection();
  52605. $ctx2.sendIdx["collection"]=1;
  52606. $1=$recv($2)._indexOf_startingAt_(value,(1));
  52607. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  52608. self._assert_equals_($1,index);
  52609. $ctx2.sendIdx["assert:equals:"]=1;
  52610. $4=self._collection();
  52611. $ctx2.sendIdx["collection"]=2;
  52612. $3=$recv($4)._indexOf_startingAt_(value,index);
  52613. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  52614. self._assert_equals_($3,index);
  52615. $ctx2.sendIdx["assert:equals:"]=2;
  52616. return self._assert_equals_($recv(self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  52617. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  52618. }));
  52619. return self;
  52620. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  52621. },
  52622. args: [],
  52623. 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 ]",
  52624. referencedClasses: ["JSON"],
  52625. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  52626. }),
  52627. $globals.SequenceableCollectionTest);
  52628. $core.addMethod(
  52629. $core.method({
  52630. selector: "testIndexOfStartingAtWithNull",
  52631. protocol: 'tests',
  52632. fn: function (){
  52633. var self=this;
  52634. var jsNull;
  52635. function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  52636. return $core.withContext(function($ctx1) {
  52637. var $1,$2;
  52638. jsNull=$recv($JSON())._parse_("null");
  52639. self._samplesDo_((function(index,value){
  52640. var collection;
  52641. return $core.withContext(function($ctx2) {
  52642. collection=self._collection();
  52643. collection;
  52644. $recv(collection)._at_put_(index,jsNull);
  52645. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  52646. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  52647. self._assert_equals_($1,index);
  52648. $ctx2.sendIdx["assert:equals:"]=1;
  52649. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  52650. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  52651. self._assert_equals_($2,index);
  52652. $ctx2.sendIdx["assert:equals:"]=2;
  52653. return self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  52654. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  52655. }));
  52656. return self;
  52657. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  52658. },
  52659. args: [],
  52660. 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 ]",
  52661. referencedClasses: ["JSON"],
  52662. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  52663. }),
  52664. $globals.SequenceableCollectionTest);
  52665. $core.addMethod(
  52666. $core.method({
  52667. selector: "testLast",
  52668. protocol: 'tests',
  52669. fn: function (){
  52670. var self=this;
  52671. return $core.withContext(function($ctx1) {
  52672. self._assert_equals_($recv(self._collection())._last(),self._collectionLast());
  52673. return self;
  52674. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  52675. },
  52676. args: [],
  52677. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  52678. referencedClasses: [],
  52679. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  52680. }),
  52681. $globals.SequenceableCollectionTest);
  52682. $core.addMethod(
  52683. $core.method({
  52684. selector: "testLastN",
  52685. protocol: 'tests',
  52686. fn: function (){
  52687. var self=this;
  52688. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  52689. return $core.withContext(function($ctx1) {
  52690. var $2,$1,$4,$3,$6,$5,$7;
  52691. $2=self._collection();
  52692. $ctx1.sendIdx["collection"]=1;
  52693. $1=$recv($2)._last_((2));
  52694. $ctx1.sendIdx["last:"]=1;
  52695. self._assert_equals_($1,self._collectionLastTwo());
  52696. $ctx1.sendIdx["assert:equals:"]=1;
  52697. $4=self._collection();
  52698. $ctx1.sendIdx["collection"]=2;
  52699. $3=$recv($4)._last_((0));
  52700. $ctx1.sendIdx["last:"]=2;
  52701. self._assert_equals_($3,$recv(self._collectionClass())._new());
  52702. $ctx1.sendIdx["assert:equals:"]=2;
  52703. $6=self._collection();
  52704. $ctx1.sendIdx["collection"]=3;
  52705. $5=$recv($6)._last_(self._collectionSize());
  52706. $ctx1.sendIdx["last:"]=3;
  52707. $7=self._collection();
  52708. $ctx1.sendIdx["collection"]=4;
  52709. self._assert_equals_($5,$7);
  52710. self._should_raise_((function(){
  52711. return $core.withContext(function($ctx2) {
  52712. return $recv(self._collection())._last_((33));
  52713. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52714. }),$Error());
  52715. return self;
  52716. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  52717. },
  52718. args: [],
  52719. 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",
  52720. referencedClasses: ["Error"],
  52721. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  52722. }),
  52723. $globals.SequenceableCollectionTest);
  52724. $core.addMethod(
  52725. $core.method({
  52726. selector: "testSecond",
  52727. protocol: 'tests',
  52728. fn: function (){
  52729. var self=this;
  52730. return $core.withContext(function($ctx1) {
  52731. var $2,$1;
  52732. $2=self._collection();
  52733. $ctx1.sendIdx["collection"]=1;
  52734. $1=$recv($2)._second();
  52735. self._assert_equals_($1,$recv(self._collection())._at_((2)));
  52736. return self;
  52737. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  52738. },
  52739. args: [],
  52740. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  52741. referencedClasses: [],
  52742. messageSends: ["assert:equals:", "second", "collection", "at:"]
  52743. }),
  52744. $globals.SequenceableCollectionTest);
  52745. $core.addMethod(
  52746. $core.method({
  52747. selector: "testThird",
  52748. protocol: 'tests',
  52749. fn: function (){
  52750. var self=this;
  52751. return $core.withContext(function($ctx1) {
  52752. var $2,$1;
  52753. $2=self._collection();
  52754. $ctx1.sendIdx["collection"]=1;
  52755. $1=$recv($2)._third();
  52756. self._assert_equals_($1,$recv(self._collection())._at_((3)));
  52757. return self;
  52758. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  52759. },
  52760. args: [],
  52761. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  52762. referencedClasses: [],
  52763. messageSends: ["assert:equals:", "third", "collection", "at:"]
  52764. }),
  52765. $globals.SequenceableCollectionTest);
  52766. $core.addClass('ArrayTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  52767. $core.addMethod(
  52768. $core.method({
  52769. selector: "collection",
  52770. protocol: 'fixture',
  52771. fn: function (){
  52772. var self=this;
  52773. var $1;
  52774. $1=[(1), (2), (3), (-4)];
  52775. return $1;
  52776. },
  52777. args: [],
  52778. source: "collection\x0a\x09^ #(1 2 3 -4)",
  52779. referencedClasses: [],
  52780. messageSends: []
  52781. }),
  52782. $globals.ArrayTest);
  52783. $core.addMethod(
  52784. $core.method({
  52785. selector: "collectionFirst",
  52786. protocol: 'fixture',
  52787. fn: function (){
  52788. var self=this;
  52789. return (1);
  52790. },
  52791. args: [],
  52792. source: "collectionFirst\x0a\x09^ 1",
  52793. referencedClasses: [],
  52794. messageSends: []
  52795. }),
  52796. $globals.ArrayTest);
  52797. $core.addMethod(
  52798. $core.method({
  52799. selector: "collectionFirstTwo",
  52800. protocol: 'fixture',
  52801. fn: function (){
  52802. var self=this;
  52803. var $1;
  52804. $1=[(1), (2)];
  52805. return $1;
  52806. },
  52807. args: [],
  52808. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  52809. referencedClasses: [],
  52810. messageSends: []
  52811. }),
  52812. $globals.ArrayTest);
  52813. $core.addMethod(
  52814. $core.method({
  52815. selector: "collectionLast",
  52816. protocol: 'fixture',
  52817. fn: function (){
  52818. var self=this;
  52819. return (-4);
  52820. },
  52821. args: [],
  52822. source: "collectionLast\x0a\x09^ -4",
  52823. referencedClasses: [],
  52824. messageSends: []
  52825. }),
  52826. $globals.ArrayTest);
  52827. $core.addMethod(
  52828. $core.method({
  52829. selector: "collectionLastTwo",
  52830. protocol: 'fixture',
  52831. fn: function (){
  52832. var self=this;
  52833. var $1;
  52834. $1=[(3), (-4)];
  52835. return $1;
  52836. },
  52837. args: [],
  52838. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  52839. referencedClasses: [],
  52840. messageSends: []
  52841. }),
  52842. $globals.ArrayTest);
  52843. $core.addMethod(
  52844. $core.method({
  52845. selector: "collectionOfPrintStrings",
  52846. protocol: 'fixture',
  52847. fn: function (){
  52848. var self=this;
  52849. var $1;
  52850. $1=["1", "2", "3", "-4"];
  52851. return $1;
  52852. },
  52853. args: [],
  52854. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  52855. referencedClasses: [],
  52856. messageSends: []
  52857. }),
  52858. $globals.ArrayTest);
  52859. $core.addMethod(
  52860. $core.method({
  52861. selector: "collectionSize",
  52862. protocol: 'fixture',
  52863. fn: function (){
  52864. var self=this;
  52865. return (4);
  52866. },
  52867. args: [],
  52868. source: "collectionSize\x0a\x09^ 4",
  52869. referencedClasses: [],
  52870. messageSends: []
  52871. }),
  52872. $globals.ArrayTest);
  52873. $core.addMethod(
  52874. $core.method({
  52875. selector: "collectionWithDuplicates",
  52876. protocol: 'fixture',
  52877. fn: function (){
  52878. var self=this;
  52879. var $1;
  52880. $1=["a", "b", "c", (1), (2), (1), "a"];
  52881. return $1;
  52882. },
  52883. args: [],
  52884. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  52885. referencedClasses: [],
  52886. messageSends: []
  52887. }),
  52888. $globals.ArrayTest);
  52889. $core.addMethod(
  52890. $core.method({
  52891. selector: "collectionWithNewValue",
  52892. protocol: 'fixture',
  52893. fn: function (){
  52894. var self=this;
  52895. var $1;
  52896. $1=[(1), (2), (3), (-4), "N"];
  52897. return $1;
  52898. },
  52899. args: [],
  52900. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  52901. referencedClasses: [],
  52902. messageSends: []
  52903. }),
  52904. $globals.ArrayTest);
  52905. $core.addMethod(
  52906. $core.method({
  52907. selector: "sampleNewIndex",
  52908. protocol: 'fixture',
  52909. fn: function (){
  52910. var self=this;
  52911. return (5);
  52912. },
  52913. args: [],
  52914. source: "sampleNewIndex\x0a\x09^ 5",
  52915. referencedClasses: [],
  52916. messageSends: []
  52917. }),
  52918. $globals.ArrayTest);
  52919. $core.addMethod(
  52920. $core.method({
  52921. selector: "samplesDo:",
  52922. protocol: 'fixture',
  52923. fn: function (aBlock){
  52924. var self=this;
  52925. return $core.withContext(function($ctx1) {
  52926. (
  52927. $ctx1.supercall = true,
  52928. $globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  52929. $ctx1.supercall = false;
  52930. $recv(aBlock)._value_value_((3),(3));
  52931. return self;
  52932. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  52933. },
  52934. args: ["aBlock"],
  52935. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  52936. referencedClasses: [],
  52937. messageSends: ["samplesDo:", "value:value:"]
  52938. }),
  52939. $globals.ArrayTest);
  52940. $core.addMethod(
  52941. $core.method({
  52942. selector: "testAdd",
  52943. protocol: 'tests',
  52944. fn: function (){
  52945. var self=this;
  52946. var array;
  52947. return $core.withContext(function($ctx1) {
  52948. array=self._collection();
  52949. $recv(array)._add_((6));
  52950. self._assert_equals_($recv(array)._last(),(6));
  52951. return self;
  52952. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  52953. },
  52954. args: [],
  52955. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  52956. referencedClasses: [],
  52957. messageSends: ["collection", "add:", "assert:equals:", "last"]
  52958. }),
  52959. $globals.ArrayTest);
  52960. $core.addMethod(
  52961. $core.method({
  52962. selector: "testAddFirst",
  52963. protocol: 'tests',
  52964. fn: function (){
  52965. var self=this;
  52966. return $core.withContext(function($ctx1) {
  52967. var $1,$2;
  52968. $1=self._collection();
  52969. $recv($1)._addFirst_((0));
  52970. $2=$recv($1)._yourself();
  52971. self._assert_equals_($recv($2)._first(),(0));
  52972. return self;
  52973. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  52974. },
  52975. args: [],
  52976. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  52977. referencedClasses: [],
  52978. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  52979. }),
  52980. $globals.ArrayTest);
  52981. $core.addMethod(
  52982. $core.method({
  52983. selector: "testPrintString",
  52984. protocol: 'tests',
  52985. fn: function (){
  52986. var self=this;
  52987. var array;
  52988. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  52989. return $core.withContext(function($ctx1) {
  52990. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  52991. array=$recv($Array())._new();
  52992. $1=$recv(array)._printString();
  52993. $ctx1.sendIdx["printString"]=1;
  52994. self._assert_equals_($1,"an Array ()");
  52995. $ctx1.sendIdx["assert:equals:"]=1;
  52996. $2=array;
  52997. $recv($2)._add_((1));
  52998. $ctx1.sendIdx["add:"]=1;
  52999. $3=$recv($2)._add_((3));
  53000. $ctx1.sendIdx["add:"]=2;
  53001. $4=$recv(array)._printString();
  53002. $ctx1.sendIdx["printString"]=2;
  53003. self._assert_equals_($4,"an Array (1 3)");
  53004. $ctx1.sendIdx["assert:equals:"]=2;
  53005. $recv(array)._add_("foo");
  53006. $5=$recv(array)._printString();
  53007. $ctx1.sendIdx["printString"]=3;
  53008. self._assert_equals_($5,"an Array (1 3 'foo')");
  53009. $ctx1.sendIdx["assert:equals:"]=3;
  53010. $6=array;
  53011. $recv($6)._remove_((1));
  53012. $ctx1.sendIdx["remove:"]=1;
  53013. $7=$recv($6)._remove_((3));
  53014. $8=$recv(array)._printString();
  53015. $ctx1.sendIdx["printString"]=4;
  53016. self._assert_equals_($8,"an Array ('foo')");
  53017. $ctx1.sendIdx["assert:equals:"]=4;
  53018. $recv(array)._addLast_((3));
  53019. $ctx1.sendIdx["addLast:"]=1;
  53020. $9=$recv(array)._printString();
  53021. $ctx1.sendIdx["printString"]=5;
  53022. self._assert_equals_($9,"an Array ('foo' 3)");
  53023. $ctx1.sendIdx["assert:equals:"]=5;
  53024. $recv(array)._addLast_((3));
  53025. self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  53026. return self;
  53027. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  53028. },
  53029. args: [],
  53030. 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)'.",
  53031. referencedClasses: ["Array"],
  53032. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  53033. }),
  53034. $globals.ArrayTest);
  53035. $core.addMethod(
  53036. $core.method({
  53037. selector: "testRemove",
  53038. protocol: 'tests',
  53039. fn: function (){
  53040. var self=this;
  53041. var array;
  53042. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53043. return $core.withContext(function($ctx1) {
  53044. array=[(1), (2), (3), (4), (5)];
  53045. $recv(array)._remove_((3));
  53046. $ctx1.sendIdx["remove:"]=1;
  53047. self._assert_equals_(array,[(1), (2), (4), (5)]);
  53048. self._should_raise_((function(){
  53049. return $core.withContext(function($ctx2) {
  53050. return $recv(array)._remove_((3));
  53051. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53052. }),$Error());
  53053. return self;
  53054. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  53055. },
  53056. args: [],
  53057. 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",
  53058. referencedClasses: ["Error"],
  53059. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  53060. }),
  53061. $globals.ArrayTest);
  53062. $core.addMethod(
  53063. $core.method({
  53064. selector: "testRemoveFromTo",
  53065. protocol: 'tests',
  53066. fn: function (){
  53067. var self=this;
  53068. return $core.withContext(function($ctx1) {
  53069. var $1,$2;
  53070. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  53071. $ctx1.sendIdx["removeFrom:to:"]=1;
  53072. self._assert_equals_($1,[(4)]);
  53073. $ctx1.sendIdx["assert:equals:"]=1;
  53074. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  53075. $ctx1.sendIdx["removeFrom:to:"]=2;
  53076. self._assert_equals_($2,[(1), (4)]);
  53077. $ctx1.sendIdx["assert:equals:"]=2;
  53078. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  53079. return self;
  53080. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  53081. },
  53082. args: [],
  53083. 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)",
  53084. referencedClasses: [],
  53085. messageSends: ["assert:equals:", "removeFrom:to:"]
  53086. }),
  53087. $globals.ArrayTest);
  53088. $core.addMethod(
  53089. $core.method({
  53090. selector: "testRemoveIndex",
  53091. protocol: 'tests',
  53092. fn: function (){
  53093. var self=this;
  53094. return $core.withContext(function($ctx1) {
  53095. var $1,$2;
  53096. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  53097. $ctx1.sendIdx["removeIndex:"]=1;
  53098. self._assert_equals_($1,[(1), (3), (4)]);
  53099. $ctx1.sendIdx["assert:equals:"]=1;
  53100. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  53101. $ctx1.sendIdx["removeIndex:"]=2;
  53102. self._assert_equals_($2,[(2), (3), (4)]);
  53103. $ctx1.sendIdx["assert:equals:"]=2;
  53104. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  53105. return self;
  53106. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  53107. },
  53108. args: [],
  53109. 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: #()",
  53110. referencedClasses: [],
  53111. messageSends: ["assert:equals:", "removeIndex:"]
  53112. }),
  53113. $globals.ArrayTest);
  53114. $core.addMethod(
  53115. $core.method({
  53116. selector: "testRemoveLast",
  53117. protocol: 'tests',
  53118. fn: function (){
  53119. var self=this;
  53120. var array;
  53121. return $core.withContext(function($ctx1) {
  53122. array=[(1), (2)];
  53123. $recv(array)._removeLast();
  53124. self._assert_equals_($recv(array)._last(),(1));
  53125. return self;
  53126. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  53127. },
  53128. args: [],
  53129. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  53130. referencedClasses: [],
  53131. messageSends: ["removeLast", "assert:equals:", "last"]
  53132. }),
  53133. $globals.ArrayTest);
  53134. $core.addMethod(
  53135. $core.method({
  53136. selector: "testReversed",
  53137. protocol: 'tests',
  53138. fn: function (){
  53139. var self=this;
  53140. var array;
  53141. return $core.withContext(function($ctx1) {
  53142. array=[(5), (4), (3), (2), (1)];
  53143. self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  53144. return self;
  53145. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  53146. },
  53147. args: [],
  53148. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  53149. referencedClasses: [],
  53150. messageSends: ["assert:equals:", "reversed"]
  53151. }),
  53152. $globals.ArrayTest);
  53153. $core.addMethod(
  53154. $core.method({
  53155. selector: "testSort",
  53156. protocol: 'tests',
  53157. fn: function (){
  53158. var self=this;
  53159. var array;
  53160. return $core.withContext(function($ctx1) {
  53161. array=[(10), (1), (5)];
  53162. $recv(array)._sort();
  53163. self._assert_equals_(array,[(1), (5), (10)]);
  53164. return self;
  53165. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  53166. },
  53167. args: [],
  53168. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  53169. referencedClasses: [],
  53170. messageSends: ["sort", "assert:equals:"]
  53171. }),
  53172. $globals.ArrayTest);
  53173. $core.addMethod(
  53174. $core.method({
  53175. selector: "collectionClass",
  53176. protocol: 'fixture',
  53177. fn: function (){
  53178. var self=this;
  53179. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  53180. return $Array();
  53181. },
  53182. args: [],
  53183. source: "collectionClass\x0a\x09^ Array",
  53184. referencedClasses: ["Array"],
  53185. messageSends: []
  53186. }),
  53187. $globals.ArrayTest.klass);
  53188. $core.addClass('StringTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  53189. $core.addMethod(
  53190. $core.method({
  53191. selector: "collection",
  53192. protocol: 'fixture',
  53193. fn: function (){
  53194. var self=this;
  53195. return "helLo";
  53196. },
  53197. args: [],
  53198. source: "collection\x0a\x09^ 'helLo'",
  53199. referencedClasses: [],
  53200. messageSends: []
  53201. }),
  53202. $globals.StringTest);
  53203. $core.addMethod(
  53204. $core.method({
  53205. selector: "collectionFirst",
  53206. protocol: 'fixture',
  53207. fn: function (){
  53208. var self=this;
  53209. return "h";
  53210. },
  53211. args: [],
  53212. source: "collectionFirst\x0a\x09^ 'h'",
  53213. referencedClasses: [],
  53214. messageSends: []
  53215. }),
  53216. $globals.StringTest);
  53217. $core.addMethod(
  53218. $core.method({
  53219. selector: "collectionFirstTwo",
  53220. protocol: 'fixture',
  53221. fn: function (){
  53222. var self=this;
  53223. return "he";
  53224. },
  53225. args: [],
  53226. source: "collectionFirstTwo\x0a\x09^ 'he'",
  53227. referencedClasses: [],
  53228. messageSends: []
  53229. }),
  53230. $globals.StringTest);
  53231. $core.addMethod(
  53232. $core.method({
  53233. selector: "collectionLast",
  53234. protocol: 'fixture',
  53235. fn: function (){
  53236. var self=this;
  53237. return "o";
  53238. },
  53239. args: [],
  53240. source: "collectionLast\x0a\x09^ 'o'",
  53241. referencedClasses: [],
  53242. messageSends: []
  53243. }),
  53244. $globals.StringTest);
  53245. $core.addMethod(
  53246. $core.method({
  53247. selector: "collectionLastTwo",
  53248. protocol: 'fixture',
  53249. fn: function (){
  53250. var self=this;
  53251. return "Lo";
  53252. },
  53253. args: [],
  53254. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  53255. referencedClasses: [],
  53256. messageSends: []
  53257. }),
  53258. $globals.StringTest);
  53259. $core.addMethod(
  53260. $core.method({
  53261. selector: "collectionOfPrintStrings",
  53262. protocol: 'fixture',
  53263. fn: function (){
  53264. var self=this;
  53265. return "'h''e''l''L''o'";
  53266. },
  53267. args: [],
  53268. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  53269. referencedClasses: [],
  53270. messageSends: []
  53271. }),
  53272. $globals.StringTest);
  53273. $core.addMethod(
  53274. $core.method({
  53275. selector: "collectionSize",
  53276. protocol: 'fixture',
  53277. fn: function (){
  53278. var self=this;
  53279. return (5);
  53280. },
  53281. args: [],
  53282. source: "collectionSize\x0a\x09^ 5",
  53283. referencedClasses: [],
  53284. messageSends: []
  53285. }),
  53286. $globals.StringTest);
  53287. $core.addMethod(
  53288. $core.method({
  53289. selector: "collectionWithDuplicates",
  53290. protocol: 'fixture',
  53291. fn: function (){
  53292. var self=this;
  53293. return "abbaerte";
  53294. },
  53295. args: [],
  53296. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  53297. referencedClasses: [],
  53298. messageSends: []
  53299. }),
  53300. $globals.StringTest);
  53301. $core.addMethod(
  53302. $core.method({
  53303. selector: "collectionWithNewValue",
  53304. protocol: 'fixture',
  53305. fn: function (){
  53306. var self=this;
  53307. return "helLoN";
  53308. },
  53309. args: [],
  53310. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  53311. referencedClasses: [],
  53312. messageSends: []
  53313. }),
  53314. $globals.StringTest);
  53315. $core.addMethod(
  53316. $core.method({
  53317. selector: "sampleNewValueAsCollection",
  53318. protocol: 'fixture',
  53319. fn: function (){
  53320. var self=this;
  53321. return "N";
  53322. },
  53323. args: [],
  53324. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  53325. referencedClasses: [],
  53326. messageSends: []
  53327. }),
  53328. $globals.StringTest);
  53329. $core.addMethod(
  53330. $core.method({
  53331. selector: "samplesDo:",
  53332. protocol: 'fixture',
  53333. fn: function (aBlock){
  53334. var self=this;
  53335. return $core.withContext(function($ctx1) {
  53336. (
  53337. $ctx1.supercall = true,
  53338. $globals.StringTest.superclass.fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  53339. $ctx1.supercall = false;
  53340. $recv(aBlock)._value_value_((3),"l");
  53341. return self;
  53342. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  53343. },
  53344. args: ["aBlock"],
  53345. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  53346. referencedClasses: [],
  53347. messageSends: ["samplesDo:", "value:value:"]
  53348. }),
  53349. $globals.StringTest);
  53350. $core.addMethod(
  53351. $core.method({
  53352. selector: "testAddAll",
  53353. protocol: 'tests',
  53354. fn: function (){
  53355. var self=this;
  53356. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53357. return $core.withContext(function($ctx1) {
  53358. var $1;
  53359. self._should_raise_((function(){
  53360. return $core.withContext(function($ctx2) {
  53361. $1=self._collection();
  53362. $ctx2.sendIdx["collection"]=1;
  53363. return $recv($1)._addAll_(self._collection());
  53364. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53365. }),$Error());
  53366. return self;
  53367. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  53368. },
  53369. args: [],
  53370. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  53371. referencedClasses: ["Error"],
  53372. messageSends: ["should:raise:", "addAll:", "collection"]
  53373. }),
  53374. $globals.StringTest);
  53375. $core.addMethod(
  53376. $core.method({
  53377. selector: "testAddRemove",
  53378. protocol: 'tests',
  53379. fn: function (){
  53380. var self=this;
  53381. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53382. return $core.withContext(function($ctx1) {
  53383. self._should_raise_((function(){
  53384. return $core.withContext(function($ctx2) {
  53385. return "hello"._add_("a");
  53386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53387. }),$Error());
  53388. $ctx1.sendIdx["should:raise:"]=1;
  53389. self._should_raise_((function(){
  53390. return $core.withContext(function($ctx2) {
  53391. return "hello"._remove_("h");
  53392. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53393. }),$Error());
  53394. return self;
  53395. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  53396. },
  53397. args: [],
  53398. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  53399. referencedClasses: ["Error"],
  53400. messageSends: ["should:raise:", "add:", "remove:"]
  53401. }),
  53402. $globals.StringTest);
  53403. $core.addMethod(
  53404. $core.method({
  53405. selector: "testAsArray",
  53406. protocol: 'tests',
  53407. fn: function (){
  53408. var self=this;
  53409. return $core.withContext(function($ctx1) {
  53410. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  53411. return self;
  53412. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  53413. },
  53414. args: [],
  53415. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  53416. referencedClasses: [],
  53417. messageSends: ["assert:equals:", "asArray"]
  53418. }),
  53419. $globals.StringTest);
  53420. $core.addMethod(
  53421. $core.method({
  53422. selector: "testAsLowerCase",
  53423. protocol: 'tests',
  53424. fn: function (){
  53425. var self=this;
  53426. return $core.withContext(function($ctx1) {
  53427. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  53428. return self;
  53429. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  53430. },
  53431. args: [],
  53432. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  53433. referencedClasses: [],
  53434. messageSends: ["assert:equals:", "asLowercase"]
  53435. }),
  53436. $globals.StringTest);
  53437. $core.addMethod(
  53438. $core.method({
  53439. selector: "testAsNumber",
  53440. protocol: 'tests',
  53441. fn: function (){
  53442. var self=this;
  53443. return $core.withContext(function($ctx1) {
  53444. var $1,$2;
  53445. $1="3"._asNumber();
  53446. $ctx1.sendIdx["asNumber"]=1;
  53447. self._assert_equals_($1,(3));
  53448. $ctx1.sendIdx["assert:equals:"]=1;
  53449. $2="-3"._asNumber();
  53450. $ctx1.sendIdx["asNumber"]=2;
  53451. self._assert_equals_($2,(-3));
  53452. $ctx1.sendIdx["assert:equals:"]=2;
  53453. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  53454. return self;
  53455. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  53456. },
  53457. args: [],
  53458. 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.",
  53459. referencedClasses: [],
  53460. messageSends: ["assert:equals:", "asNumber"]
  53461. }),
  53462. $globals.StringTest);
  53463. $core.addMethod(
  53464. $core.method({
  53465. selector: "testAsUpperCase",
  53466. protocol: 'tests',
  53467. fn: function (){
  53468. var self=this;
  53469. return $core.withContext(function($ctx1) {
  53470. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  53471. return self;
  53472. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  53473. },
  53474. args: [],
  53475. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  53476. referencedClasses: [],
  53477. messageSends: ["assert:equals:", "asUppercase"]
  53478. }),
  53479. $globals.StringTest);
  53480. $core.addMethod(
  53481. $core.method({
  53482. selector: "testAsciiValue",
  53483. protocol: 'tests',
  53484. fn: function (){
  53485. var self=this;
  53486. var characterA,characterU;
  53487. return $core.withContext(function($ctx1) {
  53488. var $1;
  53489. characterA="A";
  53490. characterU="U";
  53491. $1=$recv(characterA)._asciiValue();
  53492. $ctx1.sendIdx["asciiValue"]=1;
  53493. self._assert_equals_($1,(65));
  53494. $ctx1.sendIdx["assert:equals:"]=1;
  53495. self._assert_equals_($recv(characterU)._asciiValue(),(85));
  53496. return self;
  53497. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  53498. },
  53499. args: [],
  53500. 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",
  53501. referencedClasses: [],
  53502. messageSends: ["assert:equals:", "asciiValue"]
  53503. }),
  53504. $globals.StringTest);
  53505. $core.addMethod(
  53506. $core.method({
  53507. selector: "testAtIfAbsentPut",
  53508. protocol: 'tests',
  53509. fn: function (){
  53510. var self=this;
  53511. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53512. return $core.withContext(function($ctx1) {
  53513. self._should_raise_((function(){
  53514. return $core.withContext(function($ctx2) {
  53515. return "hello"._at_ifAbsentPut_((6),(function(){
  53516. return "a";
  53517. }));
  53518. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53519. }),$Error());
  53520. return self;
  53521. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  53522. },
  53523. args: [],
  53524. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  53525. referencedClasses: ["Error"],
  53526. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  53527. }),
  53528. $globals.StringTest);
  53529. $core.addMethod(
  53530. $core.method({
  53531. selector: "testAtPut",
  53532. protocol: 'tests',
  53533. fn: function (){
  53534. var self=this;
  53535. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53536. return $core.withContext(function($ctx1) {
  53537. self._should_raise_((function(){
  53538. return $core.withContext(function($ctx2) {
  53539. return "hello"._at_put_((1),"a");
  53540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53541. }),$Error());
  53542. return self;
  53543. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  53544. },
  53545. args: [],
  53546. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  53547. referencedClasses: ["Error"],
  53548. messageSends: ["should:raise:", "at:put:"]
  53549. }),
  53550. $globals.StringTest);
  53551. $core.addMethod(
  53552. $core.method({
  53553. selector: "testCapitalized",
  53554. protocol: 'tests',
  53555. fn: function (){
  53556. var self=this;
  53557. return $core.withContext(function($ctx1) {
  53558. var $1,$2,$3;
  53559. $1="test"._capitalized();
  53560. $ctx1.sendIdx["capitalized"]=1;
  53561. self._assert_equals_($1,"Test");
  53562. $ctx1.sendIdx["assert:equals:"]=1;
  53563. $2="Test"._capitalized();
  53564. $ctx1.sendIdx["capitalized"]=2;
  53565. self._assert_equals_($2,"Test");
  53566. $ctx1.sendIdx["assert:equals:"]=2;
  53567. self._assert_equals_(""._capitalized(),"");
  53568. $ctx1.sendIdx["assert:equals:"]=3;
  53569. $3="Test"._isCapitalized();
  53570. $ctx1.sendIdx["isCapitalized"]=1;
  53571. self._assert_equals_($3,true);
  53572. $ctx1.sendIdx["assert:equals:"]=4;
  53573. self._assert_equals_("test"._isCapitalized(),false);
  53574. return self;
  53575. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  53576. },
  53577. args: [],
  53578. 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.",
  53579. referencedClasses: [],
  53580. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  53581. }),
  53582. $globals.StringTest);
  53583. $core.addMethod(
  53584. $core.method({
  53585. selector: "testCharCodeAt",
  53586. protocol: 'tests',
  53587. fn: function (){
  53588. var self=this;
  53589. return $core.withContext(function($ctx1) {
  53590. var $1,$2,$3,$4,$5;
  53591. $1="jackie"._charCodeAt_((1));
  53592. $ctx1.sendIdx["charCodeAt:"]=1;
  53593. self._assert_equals_($1,(106));
  53594. $ctx1.sendIdx["assert:equals:"]=1;
  53595. $2="jackie"._charCodeAt_((2));
  53596. $ctx1.sendIdx["charCodeAt:"]=2;
  53597. self._assert_equals_($2,(97));
  53598. $ctx1.sendIdx["assert:equals:"]=2;
  53599. $3="jackie"._charCodeAt_((3));
  53600. $ctx1.sendIdx["charCodeAt:"]=3;
  53601. self._assert_equals_($3,(99));
  53602. $ctx1.sendIdx["assert:equals:"]=3;
  53603. $4="jackie"._charCodeAt_((4));
  53604. $ctx1.sendIdx["charCodeAt:"]=4;
  53605. self._assert_equals_($4,(107));
  53606. $ctx1.sendIdx["assert:equals:"]=4;
  53607. $5="jackie"._charCodeAt_((5));
  53608. $ctx1.sendIdx["charCodeAt:"]=5;
  53609. self._assert_equals_($5,(105));
  53610. $ctx1.sendIdx["assert:equals:"]=5;
  53611. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  53612. return self;
  53613. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  53614. },
  53615. args: [],
  53616. 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",
  53617. referencedClasses: [],
  53618. messageSends: ["assert:equals:", "charCodeAt:"]
  53619. }),
  53620. $globals.StringTest);
  53621. $core.addMethod(
  53622. $core.method({
  53623. selector: "testCopyFromTo",
  53624. protocol: 'tests',
  53625. fn: function (){
  53626. var self=this;
  53627. return $core.withContext(function($ctx1) {
  53628. var $1;
  53629. $1="jackie"._copyFrom_to_((1),(3));
  53630. $ctx1.sendIdx["copyFrom:to:"]=1;
  53631. self._assert_equals_($1,"jac");
  53632. $ctx1.sendIdx["assert:equals:"]=1;
  53633. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  53634. return self;
  53635. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  53636. },
  53637. args: [],
  53638. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  53639. referencedClasses: [],
  53640. messageSends: ["assert:equals:", "copyFrom:to:"]
  53641. }),
  53642. $globals.StringTest);
  53643. $core.addMethod(
  53644. $core.method({
  53645. selector: "testCopySeparates",
  53646. protocol: 'tests',
  53647. fn: function (){
  53648. var self=this;
  53649. return $core.withContext(function($ctx1) {
  53650. var $3,$2,$1;
  53651. $3=self._collection();
  53652. $ctx1.sendIdx["collection"]=1;
  53653. $2=$recv($3)._copy();
  53654. $1=$recv($2).__eq_eq(self._collection());
  53655. self._assert_($1);
  53656. return self;
  53657. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
  53658. },
  53659. args: [],
  53660. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  53661. referencedClasses: [],
  53662. messageSends: ["assert:", "==", "copy", "collection"]
  53663. }),
  53664. $globals.StringTest);
  53665. $core.addMethod(
  53666. $core.method({
  53667. selector: "testCopyWithoutAll",
  53668. protocol: 'tests',
  53669. fn: function (){
  53670. var self=this;
  53671. return $core.withContext(function($ctx1) {
  53672. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  53673. return self;
  53674. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  53675. },
  53676. args: [],
  53677. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  53678. referencedClasses: [],
  53679. messageSends: ["assert:equals:", "copyWithoutAll:"]
  53680. }),
  53681. $globals.StringTest);
  53682. $core.addMethod(
  53683. $core.method({
  53684. selector: "testEquality",
  53685. protocol: 'tests',
  53686. fn: function (){
  53687. var self=this;
  53688. return $core.withContext(function($ctx1) {
  53689. var $1,$2,$3;
  53690. self._assert_equals_("hello","hello");
  53691. $ctx1.sendIdx["assert:equals:"]=1;
  53692. $1="hello".__eq("world");
  53693. $ctx1.sendIdx["="]=1;
  53694. self._deny_($1);
  53695. $ctx1.sendIdx["deny:"]=1;
  53696. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  53697. })));
  53698. $ctx1.sendIdx["="]=2;
  53699. self._deny_($2);
  53700. $ctx1.sendIdx["deny:"]=2;
  53701. $3="hello"._yourself();
  53702. $ctx1.sendIdx["yourself"]=1;
  53703. self._assert_equals_("hello",$3);
  53704. $ctx1.sendIdx["assert:equals:"]=2;
  53705. self._assert_equals_("hello"._yourself(),"hello");
  53706. self._deny_("".__eq((0)));
  53707. return self;
  53708. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  53709. },
  53710. args: [],
  53711. 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",
  53712. referencedClasses: [],
  53713. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  53714. }),
  53715. $globals.StringTest);
  53716. $core.addMethod(
  53717. $core.method({
  53718. selector: "testIdentity",
  53719. protocol: 'tests',
  53720. fn: function (){
  53721. var self=this;
  53722. return $core.withContext(function($ctx1) {
  53723. var $1,$2,$4,$3,$5;
  53724. $1="hello".__eq_eq("hello");
  53725. $ctx1.sendIdx["=="]=1;
  53726. self._assert_($1);
  53727. $ctx1.sendIdx["assert:"]=1;
  53728. $2="hello".__eq_eq("world");
  53729. $ctx1.sendIdx["=="]=2;
  53730. self._deny_($2);
  53731. $ctx1.sendIdx["deny:"]=1;
  53732. $4="hello"._yourself();
  53733. $ctx1.sendIdx["yourself"]=1;
  53734. $3="hello".__eq_eq($4);
  53735. $ctx1.sendIdx["=="]=3;
  53736. self._assert_($3);
  53737. $ctx1.sendIdx["assert:"]=2;
  53738. $5=$recv("hello"._yourself()).__eq_eq("hello");
  53739. $ctx1.sendIdx["=="]=4;
  53740. self._assert_($5);
  53741. self._deny_("".__eq_eq((0)));
  53742. return self;
  53743. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  53744. },
  53745. args: [],
  53746. 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",
  53747. referencedClasses: [],
  53748. messageSends: ["assert:", "==", "deny:", "yourself"]
  53749. }),
  53750. $globals.StringTest);
  53751. $core.addMethod(
  53752. $core.method({
  53753. selector: "testIncludesSubString",
  53754. protocol: 'tests',
  53755. fn: function (){
  53756. var self=this;
  53757. return $core.withContext(function($ctx1) {
  53758. var $1;
  53759. $1="amber"._includesSubString_("ber");
  53760. $ctx1.sendIdx["includesSubString:"]=1;
  53761. self._assert_($1);
  53762. self._deny_("amber"._includesSubString_("zork"));
  53763. return self;
  53764. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  53765. },
  53766. args: [],
  53767. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  53768. referencedClasses: [],
  53769. messageSends: ["assert:", "includesSubString:", "deny:"]
  53770. }),
  53771. $globals.StringTest);
  53772. $core.addMethod(
  53773. $core.method({
  53774. selector: "testIndexOfStartingAtWithNull",
  53775. protocol: 'tests',
  53776. fn: function (){
  53777. var self=this;
  53778. return self;
  53779. },
  53780. args: [],
  53781. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  53782. referencedClasses: [],
  53783. messageSends: []
  53784. }),
  53785. $globals.StringTest);
  53786. $core.addMethod(
  53787. $core.method({
  53788. selector: "testIndexOfWithNull",
  53789. protocol: 'tests',
  53790. fn: function (){
  53791. var self=this;
  53792. return self;
  53793. },
  53794. args: [],
  53795. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  53796. referencedClasses: [],
  53797. messageSends: []
  53798. }),
  53799. $globals.StringTest);
  53800. $core.addMethod(
  53801. $core.method({
  53802. selector: "testIsVowel",
  53803. protocol: 'tests',
  53804. fn: function (){
  53805. var self=this;
  53806. var vowel,consonant;
  53807. return $core.withContext(function($ctx1) {
  53808. var $1;
  53809. vowel="u";
  53810. consonant="z";
  53811. $1=$recv(vowel)._isVowel();
  53812. $ctx1.sendIdx["isVowel"]=1;
  53813. self._assert_equals_($1,true);
  53814. $ctx1.sendIdx["assert:equals:"]=1;
  53815. self._assert_equals_($recv(consonant)._isVowel(),false);
  53816. return self;
  53817. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  53818. },
  53819. args: [],
  53820. 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",
  53821. referencedClasses: [],
  53822. messageSends: ["assert:equals:", "isVowel"]
  53823. }),
  53824. $globals.StringTest);
  53825. $core.addMethod(
  53826. $core.method({
  53827. selector: "testJoin",
  53828. protocol: 'tests',
  53829. fn: function (){
  53830. var self=this;
  53831. return $core.withContext(function($ctx1) {
  53832. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  53833. return self;
  53834. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  53835. },
  53836. args: [],
  53837. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  53838. referencedClasses: [],
  53839. messageSends: ["assert:equals:", "join:"]
  53840. }),
  53841. $globals.StringTest);
  53842. $core.addMethod(
  53843. $core.method({
  53844. selector: "testRemoveAll",
  53845. protocol: 'tests',
  53846. fn: function (){
  53847. var self=this;
  53848. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53849. return $core.withContext(function($ctx1) {
  53850. self._should_raise_((function(){
  53851. return $core.withContext(function($ctx2) {
  53852. return $recv(self._collection())._removeAll();
  53853. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53854. }),$Error());
  53855. return self;
  53856. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  53857. },
  53858. args: [],
  53859. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  53860. referencedClasses: ["Error"],
  53861. messageSends: ["should:raise:", "removeAll", "collection"]
  53862. }),
  53863. $globals.StringTest);
  53864. $core.addMethod(
  53865. $core.method({
  53866. selector: "testReversed",
  53867. protocol: 'tests',
  53868. fn: function (){
  53869. var self=this;
  53870. return $core.withContext(function($ctx1) {
  53871. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  53872. return self;
  53873. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  53874. },
  53875. args: [],
  53876. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  53877. referencedClasses: [],
  53878. messageSends: ["assert:equals:", "reversed"]
  53879. }),
  53880. $globals.StringTest);
  53881. $core.addMethod(
  53882. $core.method({
  53883. selector: "testStreamContents",
  53884. protocol: 'tests',
  53885. fn: function (){
  53886. var self=this;
  53887. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  53888. return $core.withContext(function($ctx1) {
  53889. var $1;
  53890. self._assert_equals_($recv($String())._streamContents_((function(aStream){
  53891. return $core.withContext(function($ctx2) {
  53892. $recv(aStream)._nextPutAll_("hello");
  53893. $ctx2.sendIdx["nextPutAll:"]=1;
  53894. $recv(aStream)._space();
  53895. $1=$recv(aStream)._nextPutAll_("world");
  53896. return $1;
  53897. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  53898. })),"hello world");
  53899. return self;
  53900. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  53901. },
  53902. args: [],
  53903. 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'",
  53904. referencedClasses: ["String"],
  53905. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  53906. }),
  53907. $globals.StringTest);
  53908. $core.addMethod(
  53909. $core.method({
  53910. selector: "testSubStrings",
  53911. protocol: 'tests',
  53912. fn: function (){
  53913. var self=this;
  53914. return $core.withContext(function($ctx1) {
  53915. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  53916. return self;
  53917. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  53918. },
  53919. args: [],
  53920. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  53921. referencedClasses: [],
  53922. messageSends: ["assert:equals:", "subStrings:"]
  53923. }),
  53924. $globals.StringTest);
  53925. $core.addMethod(
  53926. $core.method({
  53927. selector: "testTrim",
  53928. protocol: 'tests',
  53929. fn: function (){
  53930. var self=this;
  53931. return $core.withContext(function($ctx1) {
  53932. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  53933. $ctx1.sendIdx["assert:equals:"]=1;
  53934. self._assert_equals_("jackie "._trimRight(),"jackie");
  53935. return self;
  53936. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  53937. },
  53938. args: [],
  53939. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  53940. referencedClasses: [],
  53941. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  53942. }),
  53943. $globals.StringTest);
  53944. $core.addMethod(
  53945. $core.method({
  53946. selector: "testValue",
  53947. protocol: 'tests',
  53948. fn: function (){
  53949. var self=this;
  53950. return $core.withContext(function($ctx1) {
  53951. self._assert_equals_("asString"._value_((1)),"1");
  53952. $ctx1.sendIdx["assert:equals:"]=1;
  53953. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  53954. return self;
  53955. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  53956. },
  53957. args: [],
  53958. 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')",
  53959. referencedClasses: [],
  53960. messageSends: ["assert:equals:", "value:", "collect:"]
  53961. }),
  53962. $globals.StringTest);
  53963. $core.addMethod(
  53964. $core.method({
  53965. selector: "collectionClass",
  53966. protocol: 'fixture',
  53967. fn: function (){
  53968. var self=this;
  53969. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  53970. return $String();
  53971. },
  53972. args: [],
  53973. source: "collectionClass\x0a\x09^ String",
  53974. referencedClasses: ["String"],
  53975. messageSends: []
  53976. }),
  53977. $globals.StringTest.klass);
  53978. $core.addClass('SetTest', $globals.CollectionTest, [], 'Kernel-Tests');
  53979. $core.addMethod(
  53980. $core.method({
  53981. selector: "collection",
  53982. protocol: 'fixture',
  53983. fn: function (){
  53984. var self=this;
  53985. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  53986. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  53987. return $core.withContext(function($ctx1) {
  53988. var $2,$3,$1;
  53989. $2=$recv($Set())._new();
  53990. $recv($2)._add_($Smalltalk());
  53991. $ctx1.sendIdx["add:"]=1;
  53992. $recv($2)._add_(nil);
  53993. $ctx1.sendIdx["add:"]=2;
  53994. $recv($2)._add_((3).__at((3)));
  53995. $ctx1.sendIdx["add:"]=3;
  53996. $recv($2)._add_(false);
  53997. $3=$recv($2)._yourself();
  53998. $1=$3;
  53999. return $1;
  54000. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  54001. },
  54002. args: [],
  54003. source: "collection\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  54004. referencedClasses: ["Set", "Smalltalk"],
  54005. messageSends: ["add:", "new", "@", "yourself"]
  54006. }),
  54007. $globals.SetTest);
  54008. $core.addMethod(
  54009. $core.method({
  54010. selector: "collectionOfPrintStrings",
  54011. protocol: 'fixture',
  54012. fn: function (){
  54013. var self=this;
  54014. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54015. return $core.withContext(function($ctx1) {
  54016. var $2,$3,$1;
  54017. $2=$recv($Set())._new();
  54018. $recv($2)._add_("a SmalltalkImage");
  54019. $ctx1.sendIdx["add:"]=1;
  54020. $recv($2)._add_("nil");
  54021. $ctx1.sendIdx["add:"]=2;
  54022. $recv($2)._add_("3@3");
  54023. $ctx1.sendIdx["add:"]=3;
  54024. $recv($2)._add_("false");
  54025. $3=$recv($2)._yourself();
  54026. $1=$3;
  54027. return $1;
  54028. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  54029. },
  54030. args: [],
  54031. source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: 'a SmalltalkImage';\x0a\x09\x09add: 'nil';\x0a\x09\x09add: '3@3';\x0a\x09\x09add: 'false';\x0a\x09\x09yourself",
  54032. referencedClasses: ["Set"],
  54033. messageSends: ["add:", "new", "yourself"]
  54034. }),
  54035. $globals.SetTest);
  54036. $core.addMethod(
  54037. $core.method({
  54038. selector: "collectionSize",
  54039. protocol: 'fixture',
  54040. fn: function (){
  54041. var self=this;
  54042. return (4);
  54043. },
  54044. args: [],
  54045. source: "collectionSize\x0a\x09^ 4",
  54046. referencedClasses: [],
  54047. messageSends: []
  54048. }),
  54049. $globals.SetTest);
  54050. $core.addMethod(
  54051. $core.method({
  54052. selector: "collectionWithDuplicates",
  54053. protocol: 'fixture',
  54054. fn: function (){
  54055. var self=this;
  54056. return $core.withContext(function($ctx1) {
  54057. var $2,$3,$1;
  54058. $2=self._collection();
  54059. $recv($2)._add_((0));
  54060. $3=$recv($2)._yourself();
  54061. $1=$3;
  54062. return $1;
  54063. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  54064. },
  54065. args: [],
  54066. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  54067. referencedClasses: [],
  54068. messageSends: ["add:", "collection", "yourself"]
  54069. }),
  54070. $globals.SetTest);
  54071. $core.addMethod(
  54072. $core.method({
  54073. selector: "collectionWithNewValue",
  54074. protocol: 'fixture',
  54075. fn: function (){
  54076. var self=this;
  54077. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54078. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  54079. return $core.withContext(function($ctx1) {
  54080. var $2,$3,$1;
  54081. $2=$recv($Set())._new();
  54082. $recv($2)._add_($Smalltalk());
  54083. $ctx1.sendIdx["add:"]=1;
  54084. $recv($2)._add_(nil);
  54085. $ctx1.sendIdx["add:"]=2;
  54086. $recv($2)._add_((3).__at((3)));
  54087. $ctx1.sendIdx["add:"]=3;
  54088. $recv($2)._add_("N");
  54089. $ctx1.sendIdx["add:"]=4;
  54090. $recv($2)._add_(false);
  54091. $3=$recv($2)._yourself();
  54092. $1=$3;
  54093. return $1;
  54094. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  54095. },
  54096. args: [],
  54097. source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  54098. referencedClasses: ["Set", "Smalltalk"],
  54099. messageSends: ["add:", "new", "@", "yourself"]
  54100. }),
  54101. $globals.SetTest);
  54102. $core.addMethod(
  54103. $core.method({
  54104. selector: "testAddAll",
  54105. protocol: 'tests',
  54106. fn: function (){
  54107. var self=this;
  54108. return $core.withContext(function($ctx1) {
  54109. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  54110. (
  54111. $ctx1.supercall = true,
  54112. $globals.SetTest.superclass.fn.prototype._testAddAll.apply($recv(self), []));
  54113. $ctx1.supercall = false;
  54114. $2=self._collection();
  54115. $ctx1.sendIdx["collection"]=1;
  54116. $3=$2;
  54117. $4=self._collection();
  54118. $ctx1.sendIdx["collection"]=2;
  54119. $recv($3)._addAll_($4);
  54120. $ctx1.sendIdx["addAll:"]=1;
  54121. $5=$recv($2)._yourself();
  54122. $ctx1.sendIdx["yourself"]=1;
  54123. $1=$5;
  54124. $6=self._collection();
  54125. $ctx1.sendIdx["collection"]=3;
  54126. self._assert_equals_($1,$6);
  54127. $ctx1.sendIdx["assert:equals:"]=1;
  54128. $8=self._collection();
  54129. $ctx1.sendIdx["collection"]=4;
  54130. $9=$8;
  54131. $10=self._collectionWithNewValue();
  54132. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54133. $recv($9)._addAll_($10);
  54134. $ctx1.sendIdx["addAll:"]=2;
  54135. $11=$recv($8)._yourself();
  54136. $ctx1.sendIdx["yourself"]=2;
  54137. $7=$11;
  54138. $12=self._collectionWithNewValue();
  54139. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54140. self._assert_equals_($7,$12);
  54141. $ctx1.sendIdx["assert:equals:"]=2;
  54142. $14=self._collectionWithNewValue();
  54143. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54144. $recv($14)._addAll_(self._collection());
  54145. $15=$recv($14)._yourself();
  54146. $13=$15;
  54147. self._assert_equals_($13,self._collectionWithNewValue());
  54148. return self;
  54149. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  54150. },
  54151. args: [],
  54152. 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",
  54153. referencedClasses: [],
  54154. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  54155. }),
  54156. $globals.SetTest);
  54157. $core.addMethod(
  54158. $core.method({
  54159. selector: "testAddRemove",
  54160. protocol: 'tests',
  54161. fn: function (){
  54162. var self=this;
  54163. var set;
  54164. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54165. return $core.withContext(function($ctx1) {
  54166. var $1,$2;
  54167. set=$recv($Set())._new();
  54168. self._assert_($recv(set)._isEmpty());
  54169. $ctx1.sendIdx["assert:"]=1;
  54170. $recv(set)._add_((3));
  54171. $ctx1.sendIdx["add:"]=1;
  54172. $1=$recv(set)._includes_((3));
  54173. $ctx1.sendIdx["includes:"]=1;
  54174. self._assert_($1);
  54175. $ctx1.sendIdx["assert:"]=2;
  54176. $recv(set)._add_((5));
  54177. $2=$recv(set)._includes_((5));
  54178. $ctx1.sendIdx["includes:"]=2;
  54179. self._assert_($2);
  54180. $recv(set)._remove_((3));
  54181. self._deny_($recv(set)._includes_((3)));
  54182. return self;
  54183. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  54184. },
  54185. args: [],
  54186. 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)",
  54187. referencedClasses: ["Set"],
  54188. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  54189. }),
  54190. $globals.SetTest);
  54191. $core.addMethod(
  54192. $core.method({
  54193. selector: "testAt",
  54194. protocol: 'tests',
  54195. fn: function (){
  54196. var self=this;
  54197. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54198. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54199. return $core.withContext(function($ctx1) {
  54200. self._should_raise_((function(){
  54201. return $core.withContext(function($ctx2) {
  54202. return $recv($recv($Set())._new())._at_put_((1),(2));
  54203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54204. }),$Error());
  54205. return self;
  54206. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  54207. },
  54208. args: [],
  54209. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  54210. referencedClasses: ["Set", "Error"],
  54211. messageSends: ["should:raise:", "at:put:", "new"]
  54212. }),
  54213. $globals.SetTest);
  54214. $core.addMethod(
  54215. $core.method({
  54216. selector: "testCollect",
  54217. protocol: 'tests',
  54218. fn: function (){
  54219. var self=this;
  54220. return $core.withContext(function($ctx1) {
  54221. var $2,$1;
  54222. (
  54223. $ctx1.supercall = true,
  54224. $globals.SetTest.superclass.fn.prototype._testCollect.apply($recv(self), []));
  54225. $ctx1.supercall = false;
  54226. $2=[(5), (6), (8)]._asSet();
  54227. $ctx1.sendIdx["asSet"]=1;
  54228. $1=$recv($2)._collect_((function(x){
  54229. return $core.withContext(function($ctx2) {
  54230. return $recv(x).__backslash_backslash((3));
  54231. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54232. }));
  54233. self._assert_equals_($1,[(0), (2)]._asSet());
  54234. return self;
  54235. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  54236. },
  54237. args: [],
  54238. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  54239. referencedClasses: [],
  54240. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  54241. }),
  54242. $globals.SetTest);
  54243. $core.addMethod(
  54244. $core.method({
  54245. selector: "testComma",
  54246. protocol: 'tests',
  54247. fn: function (){
  54248. var self=this;
  54249. return $core.withContext(function($ctx1) {
  54250. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  54251. (
  54252. $ctx1.supercall = true,
  54253. $globals.SetTest.superclass.fn.prototype._testComma.apply($recv(self), []));
  54254. $ctx1.supercall = false;
  54255. $2=self._collection();
  54256. $ctx1.sendIdx["collection"]=1;
  54257. $3=self._collection();
  54258. $ctx1.sendIdx["collection"]=2;
  54259. $1=$recv($2).__comma($3);
  54260. $ctx1.sendIdx[","]=1;
  54261. $4=self._collection();
  54262. $ctx1.sendIdx["collection"]=3;
  54263. self._assert_equals_($1,$4);
  54264. $ctx1.sendIdx["assert:equals:"]=1;
  54265. $6=self._collection();
  54266. $ctx1.sendIdx["collection"]=4;
  54267. $7=self._collectionWithNewValue();
  54268. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54269. $5=$recv($6).__comma($7);
  54270. $ctx1.sendIdx[","]=2;
  54271. $8=self._collectionWithNewValue();
  54272. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54273. self._assert_equals_($5,$8);
  54274. $ctx1.sendIdx["assert:equals:"]=2;
  54275. $10=self._collectionWithNewValue();
  54276. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54277. $9=$recv($10).__comma(self._collection());
  54278. self._assert_equals_($9,self._collectionWithNewValue());
  54279. return self;
  54280. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  54281. },
  54282. args: [],
  54283. 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",
  54284. referencedClasses: [],
  54285. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  54286. }),
  54287. $globals.SetTest);
  54288. $core.addMethod(
  54289. $core.method({
  54290. selector: "testComparing",
  54291. protocol: 'tests',
  54292. fn: function (){
  54293. var self=this;
  54294. return $core.withContext(function($ctx1) {
  54295. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  54296. $1=[(0), (2)]._asSet();
  54297. $ctx1.sendIdx["asSet"]=1;
  54298. $2=[(0), (2)]._asSet();
  54299. $ctx1.sendIdx["asSet"]=2;
  54300. self._assert_equals_($1,$2);
  54301. $ctx1.sendIdx["assert:equals:"]=1;
  54302. $3=[(2), (0)]._asSet();
  54303. $ctx1.sendIdx["asSet"]=3;
  54304. $4=[(0), (2)]._asSet();
  54305. $ctx1.sendIdx["asSet"]=4;
  54306. self._assert_equals_($3,$4);
  54307. $6=[(0), (2), (3)]._asSet();
  54308. $ctx1.sendIdx["asSet"]=5;
  54309. $7=[(0), (2)]._asSet();
  54310. $ctx1.sendIdx["asSet"]=6;
  54311. $5=$recv($6).__eq($7);
  54312. $ctx1.sendIdx["="]=1;
  54313. self._deny_($5);
  54314. $ctx1.sendIdx["deny:"]=1;
  54315. $9=[(1), (2)]._asSet();
  54316. $ctx1.sendIdx["asSet"]=7;
  54317. $8=$recv($9).__eq([(0), (2)]._asSet());
  54318. self._deny_($8);
  54319. return self;
  54320. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  54321. },
  54322. args: [],
  54323. 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",
  54324. referencedClasses: [],
  54325. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  54326. }),
  54327. $globals.SetTest);
  54328. $core.addMethod(
  54329. $core.method({
  54330. selector: "testPrintString",
  54331. protocol: 'tests',
  54332. fn: function (){
  54333. var self=this;
  54334. var set;
  54335. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54336. return $core.withContext(function($ctx1) {
  54337. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  54338. set=$recv($Set())._new();
  54339. $1=$recv(set)._printString();
  54340. $ctx1.sendIdx["printString"]=1;
  54341. self._assert_equals_($1,"a Set ()");
  54342. $ctx1.sendIdx["assert:equals:"]=1;
  54343. $2=set;
  54344. $recv($2)._add_((1));
  54345. $ctx1.sendIdx["add:"]=1;
  54346. $3=$recv($2)._add_((3));
  54347. $ctx1.sendIdx["add:"]=2;
  54348. $4=$recv(set)._printString();
  54349. $ctx1.sendIdx["printString"]=2;
  54350. self._assert_equals_($4,"a Set (1 3)");
  54351. $ctx1.sendIdx["assert:equals:"]=2;
  54352. $recv(set)._add_("foo");
  54353. $ctx1.sendIdx["add:"]=3;
  54354. $5=$recv(set)._printString();
  54355. $ctx1.sendIdx["printString"]=3;
  54356. self._assert_equals_($5,"a Set (1 3 'foo')");
  54357. $ctx1.sendIdx["assert:equals:"]=3;
  54358. $6=set;
  54359. $recv($6)._remove_((1));
  54360. $ctx1.sendIdx["remove:"]=1;
  54361. $7=$recv($6)._remove_((3));
  54362. $8=$recv(set)._printString();
  54363. $ctx1.sendIdx["printString"]=4;
  54364. self._assert_equals_($8,"a Set ('foo')");
  54365. $ctx1.sendIdx["assert:equals:"]=4;
  54366. $recv(set)._add_((3));
  54367. $ctx1.sendIdx["add:"]=4;
  54368. $9=$recv(set)._printString();
  54369. $ctx1.sendIdx["printString"]=5;
  54370. self._assert_equals_($9,"a Set (3 'foo')");
  54371. $ctx1.sendIdx["assert:equals:"]=5;
  54372. $recv(set)._add_((3));
  54373. self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  54374. return self;
  54375. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  54376. },
  54377. args: [],
  54378. 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'')'",
  54379. referencedClasses: ["Set"],
  54380. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  54381. }),
  54382. $globals.SetTest);
  54383. $core.addMethod(
  54384. $core.method({
  54385. selector: "testUnboxedObjects",
  54386. protocol: 'tests',
  54387. fn: function (){
  54388. var self=this;
  54389. return $core.withContext(function($ctx1) {
  54390. var $4,$3,$2,$1;
  54391. $4="foo"._yourself();
  54392. $ctx1.sendIdx["yourself"]=1;
  54393. $3=[$4,"foo"._yourself()];
  54394. $2=$recv($3)._asSet();
  54395. $1=$recv($2)._asArray();
  54396. self._assert_equals_($1,["foo"]);
  54397. return self;
  54398. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  54399. },
  54400. args: [],
  54401. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  54402. referencedClasses: [],
  54403. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  54404. }),
  54405. $globals.SetTest);
  54406. $core.addMethod(
  54407. $core.method({
  54408. selector: "testUnicity",
  54409. protocol: 'tests',
  54410. fn: function (){
  54411. var self=this;
  54412. var set;
  54413. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54414. return $core.withContext(function($ctx1) {
  54415. var $1;
  54416. set=$recv($Set())._new();
  54417. $recv(set)._add_((21));
  54418. $ctx1.sendIdx["add:"]=1;
  54419. $recv(set)._add_("hello");
  54420. $ctx1.sendIdx["add:"]=2;
  54421. $recv(set)._add_((21));
  54422. $ctx1.sendIdx["add:"]=3;
  54423. $1=$recv(set)._size();
  54424. $ctx1.sendIdx["size"]=1;
  54425. self._assert_equals_($1,(2));
  54426. $ctx1.sendIdx["assert:equals:"]=1;
  54427. $recv(set)._add_("hello");
  54428. self._assert_equals_($recv(set)._size(),(2));
  54429. $ctx1.sendIdx["assert:equals:"]=2;
  54430. self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  54431. return self;
  54432. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  54433. },
  54434. args: [],
  54435. 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')",
  54436. referencedClasses: ["Set"],
  54437. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  54438. }),
  54439. $globals.SetTest);
  54440. $core.addMethod(
  54441. $core.method({
  54442. selector: "collectionClass",
  54443. protocol: 'fixture',
  54444. fn: function (){
  54445. var self=this;
  54446. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54447. return $Set();
  54448. },
  54449. args: [],
  54450. source: "collectionClass\x0a\x09^ Set",
  54451. referencedClasses: ["Set"],
  54452. messageSends: []
  54453. }),
  54454. $globals.SetTest.klass);
  54455. $core.addClass('ConsoleTranscriptTest', $globals.TestCase, [], 'Kernel-Tests');
  54456. $core.addMethod(
  54457. $core.method({
  54458. selector: "testShow",
  54459. protocol: 'tests',
  54460. fn: function (){
  54461. var self=this;
  54462. var originalTranscript;
  54463. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  54464. function $ConsoleTranscript(){return $globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  54465. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54466. return $core.withContext(function($ctx1) {
  54467. originalTranscript=$recv($Transcript())._current();
  54468. $recv($Transcript())._register_($recv($ConsoleTranscript())._new());
  54469. $ctx1.sendIdx["register:"]=1;
  54470. self._shouldnt_raise_((function(){
  54471. return $core.withContext(function($ctx2) {
  54472. return $recv($Transcript())._show_("Hello console!");
  54473. $ctx2.sendIdx["show:"]=1;
  54474. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54475. }),$Error());
  54476. $ctx1.sendIdx["shouldnt:raise:"]=1;
  54477. self._shouldnt_raise_((function(){
  54478. return $core.withContext(function($ctx2) {
  54479. return $recv($Transcript())._show_(console);
  54480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54481. }),$Error());
  54482. $recv($Transcript())._register_(originalTranscript);
  54483. return self;
  54484. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  54485. },
  54486. args: [],
  54487. 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.",
  54488. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  54489. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  54490. }),
  54491. $globals.ConsoleTranscriptTest);
  54492. $core.addClass('DateTest', $globals.TestCase, [], 'Kernel-Tests');
  54493. $core.addMethod(
  54494. $core.method({
  54495. selector: "testEquality",
  54496. protocol: 'tests',
  54497. fn: function (){
  54498. var self=this;
  54499. var now;
  54500. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  54501. return $core.withContext(function($ctx1) {
  54502. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  54503. now=$recv($Date())._new();
  54504. $1=$recv(now).__eq(now);
  54505. $ctx1.sendIdx["="]=1;
  54506. self._assert_($1);
  54507. $ctx1.sendIdx["assert:"]=1;
  54508. $3=now;
  54509. $4=$recv($Date())._fromMilliseconds_((0));
  54510. $ctx1.sendIdx["fromMilliseconds:"]=1;
  54511. $2=$recv($3).__eq($4);
  54512. $ctx1.sendIdx["="]=2;
  54513. self._deny_($2);
  54514. $6=$recv($Date())._fromMilliseconds_((12345678));
  54515. $ctx1.sendIdx["fromMilliseconds:"]=2;
  54516. $7=$recv($Date())._fromMilliseconds_((12345678));
  54517. $ctx1.sendIdx["fromMilliseconds:"]=3;
  54518. $5=$recv($6).__eq($7);
  54519. $ctx1.sendIdx["="]=3;
  54520. self._assert_($5);
  54521. $ctx1.sendIdx["assert:"]=2;
  54522. $9=now;
  54523. $11=$recv(now)._asMilliseconds();
  54524. $ctx1.sendIdx["asMilliseconds"]=1;
  54525. $10=$recv($Date())._fromMilliseconds_($11);
  54526. $ctx1.sendIdx["fromMilliseconds:"]=4;
  54527. $8=$recv($9).__eq($10);
  54528. $ctx1.sendIdx["="]=4;
  54529. self._assert_($8);
  54530. $ctx1.sendIdx["assert:"]=3;
  54531. self._assert_($recv($recv($Date())._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  54532. return self;
  54533. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  54534. },
  54535. args: [],
  54536. 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",
  54537. referencedClasses: ["Date"],
  54538. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  54539. }),
  54540. $globals.DateTest);
  54541. $core.addMethod(
  54542. $core.method({
  54543. selector: "testIdentity",
  54544. protocol: 'tests',
  54545. fn: function (){
  54546. var self=this;
  54547. var now;
  54548. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  54549. return $core.withContext(function($ctx1) {
  54550. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  54551. now=$recv($Date())._new();
  54552. $1=$recv(now).__eq_eq(now);
  54553. $ctx1.sendIdx["=="]=1;
  54554. self._assert_($1);
  54555. $3=now;
  54556. $4=$recv($Date())._fromMilliseconds_((0));
  54557. $ctx1.sendIdx["fromMilliseconds:"]=1;
  54558. $2=$recv($3).__eq_eq($4);
  54559. $ctx1.sendIdx["=="]=2;
  54560. self._deny_($2);
  54561. $ctx1.sendIdx["deny:"]=1;
  54562. $6=$recv($Date())._fromMilliseconds_((12345678));
  54563. $ctx1.sendIdx["fromMilliseconds:"]=2;
  54564. $7=$recv($Date())._fromMilliseconds_((12345678));
  54565. $ctx1.sendIdx["fromMilliseconds:"]=3;
  54566. $5=$recv($6).__eq_eq($7);
  54567. $ctx1.sendIdx["=="]=3;
  54568. self._deny_($5);
  54569. $ctx1.sendIdx["deny:"]=2;
  54570. $9=now;
  54571. $11=$recv(now)._asMilliseconds();
  54572. $ctx1.sendIdx["asMilliseconds"]=1;
  54573. $10=$recv($Date())._fromMilliseconds_($11);
  54574. $ctx1.sendIdx["fromMilliseconds:"]=4;
  54575. $8=$recv($9).__eq_eq($10);
  54576. $ctx1.sendIdx["=="]=4;
  54577. self._deny_($8);
  54578. $ctx1.sendIdx["deny:"]=3;
  54579. self._deny_($recv($recv($Date())._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  54580. return self;
  54581. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  54582. },
  54583. args: [],
  54584. 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",
  54585. referencedClasses: ["Date"],
  54586. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  54587. }),
  54588. $globals.DateTest);
  54589. $core.addClass('JSObjectProxyTest', $globals.TestCase, [], 'Kernel-Tests');
  54590. $core.addMethod(
  54591. $core.method({
  54592. selector: "jsNull",
  54593. protocol: 'accessing',
  54594. fn: function (){
  54595. var self=this;
  54596. return $core.withContext(function($ctx1) {
  54597. return null;
  54598. return self;
  54599. }, function($ctx1) {$ctx1.fill(self,"jsNull",{},$globals.JSObjectProxyTest)});
  54600. },
  54601. args: [],
  54602. source: "jsNull\x0a\x09<return null>",
  54603. referencedClasses: [],
  54604. messageSends: []
  54605. }),
  54606. $globals.JSObjectProxyTest);
  54607. $core.addMethod(
  54608. $core.method({
  54609. selector: "jsObject",
  54610. protocol: 'accessing',
  54611. fn: function (){
  54612. var self=this;
  54613. return $core.withContext(function($ctx1) {
  54614. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  54615. return self;
  54616. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  54617. },
  54618. args: [],
  54619. source: "jsObject\x0a\x09<return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  54620. referencedClasses: [],
  54621. messageSends: []
  54622. }),
  54623. $globals.JSObjectProxyTest);
  54624. $core.addMethod(
  54625. $core.method({
  54626. selector: "jsUndefined",
  54627. protocol: 'accessing',
  54628. fn: function (){
  54629. var self=this;
  54630. return $core.withContext(function($ctx1) {
  54631. return;
  54632. return self;
  54633. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  54634. },
  54635. args: [],
  54636. source: "jsUndefined\x0a\x09<return>",
  54637. referencedClasses: [],
  54638. messageSends: []
  54639. }),
  54640. $globals.JSObjectProxyTest);
  54641. $core.addMethod(
  54642. $core.method({
  54643. selector: "testAtIfAbsent",
  54644. protocol: 'tests',
  54645. fn: function (){
  54646. var self=this;
  54647. var testObject;
  54648. return $core.withContext(function($ctx1) {
  54649. var $1,$2,$3;
  54650. testObject=self._jsObject();
  54651. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  54652. return "Property does not exist";
  54653. }));
  54654. $ctx1.sendIdx["at:ifAbsent:"]=1;
  54655. self._assert_equals_($1,"Property does not exist");
  54656. $ctx1.sendIdx["assert:equals:"]=1;
  54657. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  54658. return "Property does not exist";
  54659. }));
  54660. $ctx1.sendIdx["at:ifAbsent:"]=2;
  54661. self._assert_equals_($2,nil);
  54662. $ctx1.sendIdx["assert:equals:"]=2;
  54663. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  54664. return "Property does not exist";
  54665. }));
  54666. $ctx1.sendIdx["at:ifAbsent:"]=3;
  54667. self._assert_equals_($3,(1));
  54668. $ctx1.sendIdx["assert:equals:"]=3;
  54669. self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  54670. return "Property does not exist";
  54671. })),nil);
  54672. return self;
  54673. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  54674. },
  54675. args: [],
  54676. 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.",
  54677. referencedClasses: [],
  54678. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  54679. }),
  54680. $globals.JSObjectProxyTest);
  54681. $core.addMethod(
  54682. $core.method({
  54683. selector: "testAtIfPresent",
  54684. protocol: 'tests',
  54685. fn: function (){
  54686. var self=this;
  54687. var testObject;
  54688. return $core.withContext(function($ctx1) {
  54689. var $2,$1,$4,$3,$6,$5;
  54690. testObject=self._jsObject();
  54691. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  54692. return $core.withContext(function($ctx2) {
  54693. $2=$recv(x)._asString();
  54694. $ctx2.sendIdx["asString"]=1;
  54695. return "hello ".__comma($2);
  54696. $ctx2.sendIdx[","]=1;
  54697. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54698. }));
  54699. $ctx1.sendIdx["at:ifPresent:"]=1;
  54700. self._assert_equals_($1,nil);
  54701. $ctx1.sendIdx["assert:equals:"]=1;
  54702. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  54703. return $core.withContext(function($ctx2) {
  54704. $4=$recv(x)._asString();
  54705. $ctx2.sendIdx["asString"]=2;
  54706. return "hello ".__comma($4);
  54707. $ctx2.sendIdx[","]=2;
  54708. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  54709. }));
  54710. $ctx1.sendIdx["at:ifPresent:"]=2;
  54711. self._assert_equals_($3,"hello nil");
  54712. $ctx1.sendIdx["assert:equals:"]=2;
  54713. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  54714. return $core.withContext(function($ctx2) {
  54715. $6=$recv(x)._asString();
  54716. $ctx2.sendIdx["asString"]=3;
  54717. return "hello ".__comma($6);
  54718. $ctx2.sendIdx[","]=3;
  54719. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  54720. }));
  54721. $ctx1.sendIdx["at:ifPresent:"]=3;
  54722. self._assert_equals_($5,"hello 1");
  54723. $ctx1.sendIdx["assert:equals:"]=3;
  54724. self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  54725. return $core.withContext(function($ctx2) {
  54726. return "hello ".__comma($recv(x)._asString());
  54727. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  54728. })),"hello nil");
  54729. return self;
  54730. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  54731. },
  54732. args: [],
  54733. 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'.",
  54734. referencedClasses: [],
  54735. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  54736. }),
  54737. $globals.JSObjectProxyTest);
  54738. $core.addMethod(
  54739. $core.method({
  54740. selector: "testAtIfPresentIfAbsent",
  54741. protocol: 'tests',
  54742. fn: function (){
  54743. var self=this;
  54744. var testObject;
  54745. return $core.withContext(function($ctx1) {
  54746. var $2,$1,$4,$3,$6,$5;
  54747. testObject=self._jsObject();
  54748. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  54749. return $core.withContext(function($ctx2) {
  54750. $2=$recv(x)._asString();
  54751. $ctx2.sendIdx["asString"]=1;
  54752. return "hello ".__comma($2);
  54753. $ctx2.sendIdx[","]=1;
  54754. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54755. }),(function(){
  54756. return "not present";
  54757. }));
  54758. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  54759. self._assert_equals_($1,"not present");
  54760. $ctx1.sendIdx["assert:equals:"]=1;
  54761. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  54762. return $core.withContext(function($ctx2) {
  54763. $4=$recv(x)._asString();
  54764. $ctx2.sendIdx["asString"]=2;
  54765. return "hello ".__comma($4);
  54766. $ctx2.sendIdx[","]=2;
  54767. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  54768. }),(function(){
  54769. return "not present";
  54770. }));
  54771. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  54772. self._assert_equals_($3,"hello nil");
  54773. $ctx1.sendIdx["assert:equals:"]=2;
  54774. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  54775. return $core.withContext(function($ctx2) {
  54776. $6=$recv(x)._asString();
  54777. $ctx2.sendIdx["asString"]=3;
  54778. return "hello ".__comma($6);
  54779. $ctx2.sendIdx[","]=3;
  54780. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  54781. }),(function(){
  54782. return "not present";
  54783. }));
  54784. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  54785. self._assert_equals_($5,"hello 1");
  54786. $ctx1.sendIdx["assert:equals:"]=3;
  54787. self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  54788. return $core.withContext(function($ctx2) {
  54789. return "hello ".__comma($recv(x)._asString());
  54790. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  54791. }),(function(){
  54792. return "not present";
  54793. })),"hello nil");
  54794. return self;
  54795. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  54796. },
  54797. args: [],
  54798. 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'.",
  54799. referencedClasses: [],
  54800. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  54801. }),
  54802. $globals.JSObjectProxyTest);
  54803. $core.addMethod(
  54804. $core.method({
  54805. selector: "testAtPut",
  54806. protocol: 'tests',
  54807. fn: function (){
  54808. var self=this;
  54809. var testObject;
  54810. return $core.withContext(function($ctx1) {
  54811. var $2,$1;
  54812. testObject=self._jsObject();
  54813. $2=$recv(testObject)._at_("abc");
  54814. $ctx1.sendIdx["at:"]=1;
  54815. $1=$recv($2).__tild_eq("xyz");
  54816. self._assert_($1);
  54817. self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  54818. $ctx1.sendIdx["assert:equals:"]=1;
  54819. self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  54820. return self;
  54821. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  54822. },
  54823. args: [],
  54824. 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'",
  54825. referencedClasses: [],
  54826. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  54827. }),
  54828. $globals.JSObjectProxyTest);
  54829. $core.addMethod(
  54830. $core.method({
  54831. selector: "testComparison",
  54832. protocol: 'tests',
  54833. fn: function (){
  54834. var self=this;
  54835. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  54836. return $core.withContext(function($ctx1) {
  54837. var $1,$2;
  54838. self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  54839. $1=$recv(console).__eq(console);
  54840. $ctx1.sendIdx["="]=1;
  54841. self._assert_($1);
  54842. $2=$recv(console).__eq($recv($Object())._new());
  54843. $ctx1.sendIdx["="]=2;
  54844. self._deny_($2);
  54845. $ctx1.sendIdx["deny:"]=1;
  54846. self._deny_($recv(console).__eq(self._jsObject()));
  54847. return self;
  54848. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  54849. },
  54850. args: [],
  54851. 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",
  54852. referencedClasses: ["Object"],
  54853. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  54854. }),
  54855. $globals.JSObjectProxyTest);
  54856. $core.addMethod(
  54857. $core.method({
  54858. selector: "testDNU",
  54859. protocol: 'tests',
  54860. fn: function (){
  54861. var self=this;
  54862. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  54863. return $core.withContext(function($ctx1) {
  54864. self._should_raise_((function(){
  54865. return $core.withContext(function($ctx2) {
  54866. return $recv(self._jsObject())._foo();
  54867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54868. }),$MessageNotUnderstood());
  54869. return self;
  54870. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  54871. },
  54872. args: [],
  54873. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  54874. referencedClasses: ["MessageNotUnderstood"],
  54875. messageSends: ["should:raise:", "foo", "jsObject"]
  54876. }),
  54877. $globals.JSObjectProxyTest);
  54878. $core.addMethod(
  54879. $core.method({
  54880. selector: "testDNURegression1057",
  54881. protocol: 'tests',
  54882. fn: function (){
  54883. var self=this;
  54884. var jsObject;
  54885. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54886. return $core.withContext(function($ctx1) {
  54887. var $1;
  54888. jsObject=[];
  54889. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  54890. $ctx1.sendIdx["basicAt:put:"]=1;
  54891. $recv(jsObject)._basicAt_put_("foo",(3));
  54892. self._shouldnt_raise_((function(){
  54893. return $core.withContext(function($ctx2) {
  54894. return $recv(jsObject)._foo();
  54895. $ctx2.sendIdx["foo"]=1;
  54896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54897. }),$Error());
  54898. $ctx1.sendIdx["shouldnt:raise:"]=1;
  54899. $1=$recv(jsObject)._foo();
  54900. $ctx1.sendIdx["foo"]=2;
  54901. self._assert_equals_($1,(3));
  54902. $ctx1.sendIdx["assert:equals:"]=1;
  54903. self._shouldnt_raise_((function(){
  54904. return $core.withContext(function($ctx2) {
  54905. return $recv(jsObject)._foo_((4));
  54906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54907. }),$Error());
  54908. self._assert_equals_($recv(jsObject)._foo(),(4));
  54909. return self;
  54910. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1057",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  54911. },
  54912. args: [],
  54913. 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",
  54914. referencedClasses: ["Error"],
  54915. messageSends: ["basicAt:put:", "shouldnt:raise:", "foo", "assert:equals:", "foo:"]
  54916. }),
  54917. $globals.JSObjectProxyTest);
  54918. $core.addMethod(
  54919. $core.method({
  54920. selector: "testDNURegression1059",
  54921. protocol: 'tests',
  54922. fn: function (){
  54923. var self=this;
  54924. var jsObject;
  54925. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54926. return $core.withContext(function($ctx1) {
  54927. jsObject=[];
  54928. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  54929. $ctx1.sendIdx["basicAt:put:"]=1;
  54930. $recv(jsObject)._basicAt_put_("x",(3));
  54931. $ctx1.sendIdx["basicAt:put:"]=2;
  54932. $recv(jsObject)._basicAt_put_("x:",(function(){
  54933. return $core.withContext(function($ctx2) {
  54934. return self._error();
  54935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54936. }));
  54937. self._shouldnt_raise_((function(){
  54938. return $core.withContext(function($ctx2) {
  54939. return $recv(jsObject)._x_((4));
  54940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54941. }),$Error());
  54942. self._assert_equals_($recv(jsObject)._x(),(4));
  54943. return self;
  54944. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1059",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  54945. },
  54946. args: [],
  54947. 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",
  54948. referencedClasses: ["Error"],
  54949. messageSends: ["basicAt:put:", "error", "shouldnt:raise:", "x:", "assert:equals:", "x"]
  54950. }),
  54951. $globals.JSObjectProxyTest);
  54952. $core.addMethod(
  54953. $core.method({
  54954. selector: "testDNURegression1062",
  54955. protocol: 'tests',
  54956. fn: function (){
  54957. var self=this;
  54958. var jsObject,stored;
  54959. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54960. return $core.withContext(function($ctx1) {
  54961. jsObject=[];
  54962. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  54963. $ctx1.sendIdx["basicAt:put:"]=1;
  54964. $recv(jsObject)._basicAt_put_("x",(function(v){
  54965. stored=v;
  54966. return stored;
  54967. }));
  54968. self._shouldnt_raise_((function(){
  54969. return $core.withContext(function($ctx2) {
  54970. return $recv(jsObject)._x_((4));
  54971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54972. }),$Error());
  54973. self._assert_equals_(stored,(4));
  54974. return self;
  54975. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1062",{jsObject:jsObject,stored:stored},$globals.JSObjectProxyTest)});
  54976. },
  54977. args: [],
  54978. 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",
  54979. referencedClasses: ["Error"],
  54980. messageSends: ["basicAt:put:", "shouldnt:raise:", "x:", "assert:equals:"]
  54981. }),
  54982. $globals.JSObjectProxyTest);
  54983. $core.addMethod(
  54984. $core.method({
  54985. selector: "testDNUWithAllowJavaScriptCalls",
  54986. protocol: 'tests',
  54987. fn: function (){
  54988. var self=this;
  54989. var jsObject;
  54990. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  54991. return $core.withContext(function($ctx1) {
  54992. jsObject=[];
  54993. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  54994. self._should_raise_((function(){
  54995. return $core.withContext(function($ctx2) {
  54996. return $recv(jsObject)._foo();
  54997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54998. }),$MessageNotUnderstood());
  54999. return self;
  55000. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  55001. },
  55002. args: [],
  55003. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  55004. referencedClasses: ["MessageNotUnderstood"],
  55005. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  55006. }),
  55007. $globals.JSObjectProxyTest);
  55008. $core.addMethod(
  55009. $core.method({
  55010. selector: "testMessageSend",
  55011. protocol: 'tests',
  55012. fn: function (){
  55013. var self=this;
  55014. return $core.withContext(function($ctx1) {
  55015. var $2,$1,$4,$3;
  55016. $2=self._jsObject();
  55017. $ctx1.sendIdx["jsObject"]=1;
  55018. $1=$recv($2)._a();
  55019. self._assert_equals_($1,(1));
  55020. $ctx1.sendIdx["assert:equals:"]=1;
  55021. $4=self._jsObject();
  55022. $ctx1.sendIdx["jsObject"]=2;
  55023. $3=$recv($4)._b();
  55024. self._assert_equals_($3,(2));
  55025. $ctx1.sendIdx["assert:equals:"]=2;
  55026. self._assert_equals_($recv(self._jsObject())._c_((3)),(3));
  55027. return self;
  55028. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  55029. },
  55030. args: [],
  55031. 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",
  55032. referencedClasses: [],
  55033. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  55034. }),
  55035. $globals.JSObjectProxyTest);
  55036. $core.addMethod(
  55037. $core.method({
  55038. selector: "testMethodWithArguments",
  55039. protocol: 'tests',
  55040. fn: function (){
  55041. var self=this;
  55042. return $core.withContext(function($ctx1) {
  55043. self._assert_equals_($recv(self._jsObject())._c_((1)),(1));
  55044. return self;
  55045. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  55046. },
  55047. args: [],
  55048. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  55049. referencedClasses: [],
  55050. messageSends: ["assert:equals:", "c:", "jsObject"]
  55051. }),
  55052. $globals.JSObjectProxyTest);
  55053. $core.addMethod(
  55054. $core.method({
  55055. selector: "testPrinting",
  55056. protocol: 'tests',
  55057. fn: function (){
  55058. var self=this;
  55059. return $core.withContext(function($ctx1) {
  55060. self._assert_equals_($recv(self._jsObject())._printString(),"[object Object]");
  55061. return self;
  55062. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  55063. },
  55064. args: [],
  55065. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  55066. referencedClasses: [],
  55067. messageSends: ["assert:equals:", "printString", "jsObject"]
  55068. }),
  55069. $globals.JSObjectProxyTest);
  55070. $core.addMethod(
  55071. $core.method({
  55072. selector: "testPropertyThatReturnsEmptyString",
  55073. protocol: 'tests',
  55074. fn: function (){
  55075. var self=this;
  55076. var object;
  55077. return $core.withContext(function($ctx1) {
  55078. var $1;
  55079. object=self._jsObject();
  55080. $1=$recv(object)._d();
  55081. $ctx1.sendIdx["d"]=1;
  55082. self._assert_equals_($1,"");
  55083. $ctx1.sendIdx["assert:equals:"]=1;
  55084. $recv(object)._d_("hello");
  55085. self._assert_equals_($recv(object)._d(),"hello");
  55086. return self;
  55087. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  55088. },
  55089. args: [],
  55090. 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'",
  55091. referencedClasses: [],
  55092. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  55093. }),
  55094. $globals.JSObjectProxyTest);
  55095. $core.addMethod(
  55096. $core.method({
  55097. selector: "testPropertyThatReturnsUndefined",
  55098. protocol: 'tests',
  55099. fn: function (){
  55100. var self=this;
  55101. var object;
  55102. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  55103. return $core.withContext(function($ctx1) {
  55104. object=self._jsObject();
  55105. self._shouldnt_raise_((function(){
  55106. return $core.withContext(function($ctx2) {
  55107. return $recv(object)._e();
  55108. $ctx2.sendIdx["e"]=1;
  55109. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55110. }),$MessageNotUnderstood());
  55111. self._assert_($recv($recv(object)._e())._isNil());
  55112. return self;
  55113. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  55114. },
  55115. args: [],
  55116. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  55117. referencedClasses: ["MessageNotUnderstood"],
  55118. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  55119. }),
  55120. $globals.JSObjectProxyTest);
  55121. $core.addMethod(
  55122. $core.method({
  55123. selector: "testSetPropertyWithFalsyValue",
  55124. protocol: 'tests',
  55125. fn: function (){
  55126. var self=this;
  55127. var jsObject;
  55128. return $core.withContext(function($ctx1) {
  55129. var $1,$2,$3,$4,$5;
  55130. jsObject=self._jsObject();
  55131. $1=$recv(jsObject)._a();
  55132. $ctx1.sendIdx["a"]=1;
  55133. self._assert_equals_($1,(1));
  55134. $ctx1.sendIdx["assert:equals:"]=1;
  55135. $recv(jsObject)._a_(self._jsNull());
  55136. $ctx1.sendIdx["a:"]=1;
  55137. $2=$recv(jsObject)._a();
  55138. $ctx1.sendIdx["a"]=2;
  55139. self._assert_equals_($2,nil);
  55140. $ctx1.sendIdx["assert:equals:"]=2;
  55141. $recv(jsObject)._a_((0));
  55142. $ctx1.sendIdx["a:"]=2;
  55143. $3=$recv(jsObject)._a();
  55144. $ctx1.sendIdx["a"]=3;
  55145. self._assert_equals_($3,(0));
  55146. $ctx1.sendIdx["assert:equals:"]=3;
  55147. $recv(jsObject)._a_(self._jsUndefined());
  55148. $ctx1.sendIdx["a:"]=3;
  55149. $4=$recv(jsObject)._a();
  55150. $ctx1.sendIdx["a"]=4;
  55151. self._assert_equals_($4,nil);
  55152. $ctx1.sendIdx["assert:equals:"]=4;
  55153. $recv(jsObject)._a_("");
  55154. $ctx1.sendIdx["a:"]=4;
  55155. $5=$recv(jsObject)._a();
  55156. $ctx1.sendIdx["a"]=5;
  55157. self._assert_equals_($5,"");
  55158. $ctx1.sendIdx["assert:equals:"]=5;
  55159. $recv(jsObject)._a_(false);
  55160. self._assert_equals_($recv(jsObject)._a(),false);
  55161. return self;
  55162. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  55163. },
  55164. args: [],
  55165. 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",
  55166. referencedClasses: [],
  55167. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"]
  55168. }),
  55169. $globals.JSObjectProxyTest);
  55170. $core.addMethod(
  55171. $core.method({
  55172. selector: "testValue",
  55173. protocol: 'tests',
  55174. fn: function (){
  55175. var self=this;
  55176. var testObject;
  55177. return $core.withContext(function($ctx1) {
  55178. testObject=self._jsObject();
  55179. $recv(testObject)._at_put_("value","aValue");
  55180. self._assert_equals_($recv(testObject)._value(),"aValue");
  55181. return self;
  55182. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  55183. },
  55184. args: [],
  55185. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  55186. referencedClasses: [],
  55187. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  55188. }),
  55189. $globals.JSObjectProxyTest);
  55190. $core.addMethod(
  55191. $core.method({
  55192. selector: "testYourself",
  55193. protocol: 'tests',
  55194. fn: function (){
  55195. var self=this;
  55196. var object;
  55197. return $core.withContext(function($ctx1) {
  55198. var $1,$2;
  55199. $1=self._jsObject();
  55200. $recv($1)._d_("test");
  55201. $2=$recv($1)._yourself();
  55202. object=$2;
  55203. self._assert_equals_($recv(object)._d(),"test");
  55204. return self;
  55205. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  55206. },
  55207. args: [],
  55208. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  55209. referencedClasses: [],
  55210. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  55211. }),
  55212. $globals.JSObjectProxyTest);
  55213. $core.addClass('JavaScriptExceptionTest', $globals.TestCase, [], 'Kernel-Tests');
  55214. $core.addMethod(
  55215. $core.method({
  55216. selector: "testCatchingException",
  55217. protocol: 'tests',
  55218. fn: function (){
  55219. var self=this;
  55220. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  55221. return $core.withContext(function($ctx1) {
  55222. $recv((function(){
  55223. return $core.withContext(function($ctx2) {
  55224. return self._throwException();
  55225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55226. }))._on_do_($Error(),(function(error){
  55227. return $core.withContext(function($ctx2) {
  55228. return self._assert_($recv($recv(error)._exception()).__eq("test"));
  55229. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  55230. }));
  55231. return self;
  55232. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  55233. },
  55234. args: [],
  55235. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  55236. referencedClasses: ["Error"],
  55237. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  55238. }),
  55239. $globals.JavaScriptExceptionTest);
  55240. $core.addMethod(
  55241. $core.method({
  55242. selector: "testRaisingException",
  55243. protocol: 'tests',
  55244. fn: function (){
  55245. var self=this;
  55246. function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  55247. return $core.withContext(function($ctx1) {
  55248. self._should_raise_((function(){
  55249. return $core.withContext(function($ctx2) {
  55250. return self._throwException();
  55251. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55252. }),$JavaScriptException());
  55253. return self;
  55254. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  55255. },
  55256. args: [],
  55257. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  55258. referencedClasses: ["JavaScriptException"],
  55259. messageSends: ["should:raise:", "throwException"]
  55260. }),
  55261. $globals.JavaScriptExceptionTest);
  55262. $core.addMethod(
  55263. $core.method({
  55264. selector: "throwException",
  55265. protocol: 'helpers',
  55266. fn: function (){
  55267. var self=this;
  55268. return $core.withContext(function($ctx1) {
  55269. throw 'test';
  55270. return self;
  55271. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  55272. },
  55273. args: [],
  55274. source: "throwException\x0a\x09<throw 'test'>",
  55275. referencedClasses: [],
  55276. messageSends: []
  55277. }),
  55278. $globals.JavaScriptExceptionTest);
  55279. $core.addClass('MessageSendTest', $globals.TestCase, [], 'Kernel-Tests');
  55280. $core.addMethod(
  55281. $core.method({
  55282. selector: "testValue",
  55283. protocol: 'tests',
  55284. fn: function (){
  55285. var self=this;
  55286. var messageSend;
  55287. function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  55288. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  55289. return $core.withContext(function($ctx1) {
  55290. var $1,$2;
  55291. $1=$recv($MessageSend())._new();
  55292. $ctx1.sendIdx["new"]=1;
  55293. $recv($1)._receiver_($recv($Object())._new());
  55294. $recv($1)._selector_("asString");
  55295. $2=$recv($1)._yourself();
  55296. messageSend=$2;
  55297. self._assert_equals_($recv(messageSend)._value(),"an Object");
  55298. return self;
  55299. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  55300. },
  55301. args: [],
  55302. 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'",
  55303. referencedClasses: ["MessageSend", "Object"],
  55304. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  55305. }),
  55306. $globals.MessageSendTest);
  55307. $core.addMethod(
  55308. $core.method({
  55309. selector: "testValueWithArguments",
  55310. protocol: 'tests',
  55311. fn: function (){
  55312. var self=this;
  55313. var messageSend;
  55314. function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  55315. return $core.withContext(function($ctx1) {
  55316. var $1,$2;
  55317. $1=$recv($MessageSend())._new();
  55318. $recv($1)._receiver_((2));
  55319. $recv($1)._selector_("+");
  55320. $2=$recv($1)._yourself();
  55321. messageSend=$2;
  55322. self._assert_equals_($recv(messageSend)._value_((3)),(5));
  55323. $ctx1.sendIdx["assert:equals:"]=1;
  55324. self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  55325. return self;
  55326. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  55327. },
  55328. args: [],
  55329. 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",
  55330. referencedClasses: ["MessageSend"],
  55331. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  55332. }),
  55333. $globals.MessageSendTest);
  55334. $core.addClass('MethodInheritanceTest', $globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  55335. $core.addMethod(
  55336. $core.method({
  55337. selector: "codeGeneratorClass",
  55338. protocol: 'accessing',
  55339. fn: function (){
  55340. var self=this;
  55341. function $CodeGenerator(){return $globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  55342. return $CodeGenerator();
  55343. },
  55344. args: [],
  55345. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  55346. referencedClasses: ["CodeGenerator"],
  55347. messageSends: []
  55348. }),
  55349. $globals.MethodInheritanceTest);
  55350. $core.addMethod(
  55351. $core.method({
  55352. selector: "compiler",
  55353. protocol: 'factory',
  55354. fn: function (){
  55355. var self=this;
  55356. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  55357. return $core.withContext(function($ctx1) {
  55358. var $2,$3,$1;
  55359. $2=$recv($Compiler())._new();
  55360. $recv($2)._codeGeneratorClass_(self._codeGeneratorClass());
  55361. $3=$recv($2)._yourself();
  55362. $1=$3;
  55363. return $1;
  55364. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  55365. },
  55366. args: [],
  55367. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  55368. referencedClasses: ["Compiler"],
  55369. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  55370. }),
  55371. $globals.MethodInheritanceTest);
  55372. $core.addMethod(
  55373. $core.method({
  55374. selector: "deinstallBottom",
  55375. protocol: 'testing',
  55376. fn: function (){
  55377. var self=this;
  55378. return $core.withContext(function($ctx1) {
  55379. $recv(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  55380. return self;
  55381. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  55382. },
  55383. args: [],
  55384. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  55385. referencedClasses: [],
  55386. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  55387. }),
  55388. $globals.MethodInheritanceTest);
  55389. $core.addMethod(
  55390. $core.method({
  55391. selector: "deinstallMiddle",
  55392. protocol: 'testing',
  55393. fn: function (){
  55394. var self=this;
  55395. return $core.withContext(function($ctx1) {
  55396. $recv(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  55397. return self;
  55398. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  55399. },
  55400. args: [],
  55401. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  55402. referencedClasses: [],
  55403. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  55404. }),
  55405. $globals.MethodInheritanceTest);
  55406. $core.addMethod(
  55407. $core.method({
  55408. selector: "deinstallTop",
  55409. protocol: 'testing',
  55410. fn: function (){
  55411. var self=this;
  55412. return $core.withContext(function($ctx1) {
  55413. $recv(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  55414. return self;
  55415. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  55416. },
  55417. args: [],
  55418. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  55419. referencedClasses: [],
  55420. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  55421. }),
  55422. $globals.MethodInheritanceTest);
  55423. $core.addMethod(
  55424. $core.method({
  55425. selector: "installBottom:",
  55426. protocol: 'testing',
  55427. fn: function (aString){
  55428. var self=this;
  55429. return $core.withContext(function($ctx1) {
  55430. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  55431. return self;
  55432. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  55433. },
  55434. args: ["aString"],
  55435. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  55436. referencedClasses: [],
  55437. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  55438. }),
  55439. $globals.MethodInheritanceTest);
  55440. $core.addMethod(
  55441. $core.method({
  55442. selector: "installMiddle:",
  55443. protocol: 'testing',
  55444. fn: function (aString){
  55445. var self=this;
  55446. return $core.withContext(function($ctx1) {
  55447. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  55448. return self;
  55449. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  55450. },
  55451. args: ["aString"],
  55452. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  55453. referencedClasses: [],
  55454. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  55455. }),
  55456. $globals.MethodInheritanceTest);
  55457. $core.addMethod(
  55458. $core.method({
  55459. selector: "installTop:",
  55460. protocol: 'testing',
  55461. fn: function (aString){
  55462. var self=this;
  55463. return $core.withContext(function($ctx1) {
  55464. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  55465. return self;
  55466. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  55467. },
  55468. args: ["aString"],
  55469. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  55470. referencedClasses: [],
  55471. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  55472. }),
  55473. $globals.MethodInheritanceTest);
  55474. $core.addMethod(
  55475. $core.method({
  55476. selector: "setUp",
  55477. protocol: 'initialization',
  55478. fn: function (){
  55479. var self=this;
  55480. return $core.withContext(function($ctx1) {
  55481. self["@receiverTop"]=$recv(self._targetClassTop())._new();
  55482. $ctx1.sendIdx["new"]=1;
  55483. self["@receiverMiddle"]=$recv(self._targetClassMiddle())._new();
  55484. $ctx1.sendIdx["new"]=2;
  55485. self["@receiverBottom"]=$recv(self._targetClassBottom())._new();
  55486. self["@method"]=nil;
  55487. self["@performBlock"]=(function(){
  55488. return $core.withContext(function($ctx2) {
  55489. return self._error_("performBlock not initialized");
  55490. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55491. });
  55492. return self;
  55493. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  55494. },
  55495. args: [],
  55496. 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' ]",
  55497. referencedClasses: [],
  55498. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  55499. }),
  55500. $globals.MethodInheritanceTest);
  55501. $core.addMethod(
  55502. $core.method({
  55503. selector: "shouldMNU",
  55504. protocol: 'testing',
  55505. fn: function (){
  55506. var self=this;
  55507. return $core.withContext(function($ctx1) {
  55508. self._shouldMNUTop();
  55509. self._shouldMNUMiddle();
  55510. self._shouldMNUBottom();
  55511. return self;
  55512. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  55513. },
  55514. args: [],
  55515. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  55516. referencedClasses: [],
  55517. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  55518. }),
  55519. $globals.MethodInheritanceTest);
  55520. $core.addMethod(
  55521. $core.method({
  55522. selector: "shouldMNUBottom",
  55523. protocol: 'testing',
  55524. fn: function (){
  55525. var self=this;
  55526. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  55527. return $core.withContext(function($ctx1) {
  55528. self._should_raise_((function(){
  55529. return $core.withContext(function($ctx2) {
  55530. return $recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  55531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55532. }),$MessageNotUnderstood());
  55533. return self;
  55534. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  55535. },
  55536. args: [],
  55537. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  55538. referencedClasses: ["MessageNotUnderstood"],
  55539. messageSends: ["should:raise:", "value:"]
  55540. }),
  55541. $globals.MethodInheritanceTest);
  55542. $core.addMethod(
  55543. $core.method({
  55544. selector: "shouldMNUMiddle",
  55545. protocol: 'testing',
  55546. fn: function (){
  55547. var self=this;
  55548. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  55549. return $core.withContext(function($ctx1) {
  55550. self._should_raise_((function(){
  55551. return $core.withContext(function($ctx2) {
  55552. return $recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  55553. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55554. }),$MessageNotUnderstood());
  55555. return self;
  55556. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  55557. },
  55558. args: [],
  55559. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  55560. referencedClasses: ["MessageNotUnderstood"],
  55561. messageSends: ["should:raise:", "value:"]
  55562. }),
  55563. $globals.MethodInheritanceTest);
  55564. $core.addMethod(
  55565. $core.method({
  55566. selector: "shouldMNUTop",
  55567. protocol: 'testing',
  55568. fn: function (){
  55569. var self=this;
  55570. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  55571. return $core.withContext(function($ctx1) {
  55572. self._should_raise_((function(){
  55573. return $core.withContext(function($ctx2) {
  55574. return $recv(self["@performBlock"])._value_(self["@receiverTop"]);
  55575. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55576. }),$MessageNotUnderstood());
  55577. return self;
  55578. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  55579. },
  55580. args: [],
  55581. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  55582. referencedClasses: ["MessageNotUnderstood"],
  55583. messageSends: ["should:raise:", "value:"]
  55584. }),
  55585. $globals.MethodInheritanceTest);
  55586. $core.addMethod(
  55587. $core.method({
  55588. selector: "shouldReturn:",
  55589. protocol: 'testing',
  55590. fn: function (anObject){
  55591. var self=this;
  55592. var result;
  55593. return $core.withContext(function($ctx1) {
  55594. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  55595. $ctx1.sendIdx["value:"]=1;
  55596. self._assert_equals_(["top",anObject],["top",result]);
  55597. $ctx1.sendIdx["assert:equals:"]=1;
  55598. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  55599. $ctx1.sendIdx["value:"]=2;
  55600. self._assert_equals_(["middle",anObject],["middle",result]);
  55601. $ctx1.sendIdx["assert:equals:"]=2;
  55602. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  55603. self._assert_equals_(["bottom",anObject],["bottom",result]);
  55604. return self;
  55605. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  55606. },
  55607. args: ["anObject"],
  55608. 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 }",
  55609. referencedClasses: [],
  55610. messageSends: ["value:", "assert:equals:"]
  55611. }),
  55612. $globals.MethodInheritanceTest);
  55613. $core.addMethod(
  55614. $core.method({
  55615. selector: "shouldReturn:and:and:",
  55616. protocol: 'testing',
  55617. fn: function (anObject,anObject2,anObject3){
  55618. var self=this;
  55619. var result;
  55620. return $core.withContext(function($ctx1) {
  55621. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  55622. $ctx1.sendIdx["value:"]=1;
  55623. self._assert_equals_(["top",anObject],["top",result]);
  55624. $ctx1.sendIdx["assert:equals:"]=1;
  55625. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  55626. $ctx1.sendIdx["value:"]=2;
  55627. self._assert_equals_(["middle",anObject2],["middle",result]);
  55628. $ctx1.sendIdx["assert:equals:"]=2;
  55629. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  55630. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  55631. return self;
  55632. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  55633. },
  55634. args: ["anObject", "anObject2", "anObject3"],
  55635. 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 }",
  55636. referencedClasses: [],
  55637. messageSends: ["value:", "assert:equals:"]
  55638. }),
  55639. $globals.MethodInheritanceTest);
  55640. $core.addMethod(
  55641. $core.method({
  55642. selector: "targetClassBottom",
  55643. protocol: 'accessing',
  55644. fn: function (){
  55645. var self=this;
  55646. function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  55647. return $JavaScriptException();
  55648. },
  55649. args: [],
  55650. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  55651. referencedClasses: ["JavaScriptException"],
  55652. messageSends: []
  55653. }),
  55654. $globals.MethodInheritanceTest);
  55655. $core.addMethod(
  55656. $core.method({
  55657. selector: "targetClassMiddle",
  55658. protocol: 'accessing',
  55659. fn: function (){
  55660. var self=this;
  55661. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  55662. return $Error();
  55663. },
  55664. args: [],
  55665. source: "targetClassMiddle\x0a\x09^ Error",
  55666. referencedClasses: ["Error"],
  55667. messageSends: []
  55668. }),
  55669. $globals.MethodInheritanceTest);
  55670. $core.addMethod(
  55671. $core.method({
  55672. selector: "targetClassTop",
  55673. protocol: 'accessing',
  55674. fn: function (){
  55675. var self=this;
  55676. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  55677. return $Object();
  55678. },
  55679. args: [],
  55680. source: "targetClassTop\x0a\x09^ Object",
  55681. referencedClasses: ["Object"],
  55682. messageSends: []
  55683. }),
  55684. $globals.MethodInheritanceTest);
  55685. $core.addMethod(
  55686. $core.method({
  55687. selector: "tearDown",
  55688. protocol: 'initialization',
  55689. fn: function (){
  55690. var self=this;
  55691. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  55692. return $core.withContext(function($ctx1) {
  55693. $recv((function(){
  55694. return $core.withContext(function($ctx2) {
  55695. return self._deinstallTop();
  55696. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55697. }))._on_do_($Error(),(function(){
  55698. }));
  55699. $ctx1.sendIdx["on:do:"]=1;
  55700. $recv((function(){
  55701. return $core.withContext(function($ctx2) {
  55702. return self._deinstallMiddle();
  55703. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  55704. }))._on_do_($Error(),(function(){
  55705. }));
  55706. $ctx1.sendIdx["on:do:"]=2;
  55707. $recv((function(){
  55708. return $core.withContext(function($ctx2) {
  55709. return self._deinstallBottom();
  55710. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  55711. }))._on_do_($Error(),(function(){
  55712. }));
  55713. return self;
  55714. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  55715. },
  55716. args: [],
  55717. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  55718. referencedClasses: ["Error"],
  55719. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  55720. }),
  55721. $globals.MethodInheritanceTest);
  55722. $core.addMethod(
  55723. $core.method({
  55724. selector: "testMNU11",
  55725. protocol: 'tests',
  55726. fn: function (){
  55727. var self=this;
  55728. return $core.withContext(function($ctx1) {
  55729. self["@performBlock"]=(function(x){
  55730. return $core.withContext(function($ctx2) {
  55731. return $recv(x)._foo();
  55732. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  55733. });
  55734. self._shouldMNU();
  55735. $ctx1.sendIdx["shouldMNU"]=1;
  55736. self._installTop_("foo ^ false");
  55737. $ctx1.sendIdx["installTop:"]=1;
  55738. self._installTop_("foo ^ true");
  55739. self._deinstallTop();
  55740. self._shouldMNU();
  55741. return self;
  55742. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  55743. },
  55744. args: [],
  55745. 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",
  55746. referencedClasses: [],
  55747. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  55748. }),
  55749. $globals.MethodInheritanceTest);
  55750. $core.addMethod(
  55751. $core.method({
  55752. selector: "testMNU22",
  55753. protocol: 'tests',
  55754. fn: function (){
  55755. var self=this;
  55756. return $core.withContext(function($ctx1) {
  55757. self["@performBlock"]=(function(x){
  55758. return $core.withContext(function($ctx2) {
  55759. return $recv(x)._foo();
  55760. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  55761. });
  55762. self._shouldMNU();
  55763. $ctx1.sendIdx["shouldMNU"]=1;
  55764. self._installMiddle_("foo ^ false");
  55765. $ctx1.sendIdx["installMiddle:"]=1;
  55766. self._installMiddle_("foo ^ true");
  55767. self._deinstallMiddle();
  55768. self._shouldMNU();
  55769. return self;
  55770. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  55771. },
  55772. args: [],
  55773. 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",
  55774. referencedClasses: [],
  55775. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  55776. }),
  55777. $globals.MethodInheritanceTest);
  55778. $core.addMethod(
  55779. $core.method({
  55780. selector: "testReturns1",
  55781. protocol: 'tests',
  55782. fn: function (){
  55783. var self=this;
  55784. return $core.withContext(function($ctx1) {
  55785. self["@performBlock"]=(function(x){
  55786. return $core.withContext(function($ctx2) {
  55787. return $recv(x)._foo();
  55788. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  55789. });
  55790. self._installTop_("foo ^ false");
  55791. $ctx1.sendIdx["installTop:"]=1;
  55792. self._shouldReturn_(false);
  55793. $ctx1.sendIdx["shouldReturn:"]=1;
  55794. self._installTop_("foo ^ true");
  55795. self._shouldReturn_(true);
  55796. return self;
  55797. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  55798. },
  55799. args: [],
  55800. 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",
  55801. referencedClasses: [],
  55802. messageSends: ["foo", "installTop:", "shouldReturn:"]
  55803. }),
  55804. $globals.MethodInheritanceTest);
  55805. $core.addClass('NumberTest', $globals.TestCase, [], 'Kernel-Tests');
  55806. $core.addMethod(
  55807. $core.method({
  55808. selector: "testAbs",
  55809. protocol: 'tests',
  55810. fn: function (){
  55811. var self=this;
  55812. return $core.withContext(function($ctx1) {
  55813. var $1;
  55814. $1=(4)._abs();
  55815. $ctx1.sendIdx["abs"]=1;
  55816. self._assert_equals_($1,(4));
  55817. $ctx1.sendIdx["assert:equals:"]=1;
  55818. self._assert_equals_((-4)._abs(),(4));
  55819. return self;
  55820. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  55821. },
  55822. args: [],
  55823. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  55824. referencedClasses: [],
  55825. messageSends: ["assert:equals:", "abs"]
  55826. }),
  55827. $globals.NumberTest);
  55828. $core.addMethod(
  55829. $core.method({
  55830. selector: "testArithmetic",
  55831. protocol: 'tests',
  55832. fn: function (){
  55833. var self=this;
  55834. return $core.withContext(function($ctx1) {
  55835. var $1,$2,$3,$5,$4;
  55836. $1=(1.5).__plus((1));
  55837. $ctx1.sendIdx["+"]=1;
  55838. self._assert_equals_($1,(2.5));
  55839. $ctx1.sendIdx["assert:equals:"]=1;
  55840. $2=(2).__minus((1));
  55841. $ctx1.sendIdx["-"]=1;
  55842. self._assert_equals_($2,(1));
  55843. $ctx1.sendIdx["assert:equals:"]=2;
  55844. self._assert_equals_((-2).__minus((1)),(-3));
  55845. $ctx1.sendIdx["assert:equals:"]=3;
  55846. self._assert_equals_((12).__slash((2)),(6));
  55847. $ctx1.sendIdx["assert:equals:"]=4;
  55848. $3=(3).__star((4));
  55849. $ctx1.sendIdx["*"]=1;
  55850. self._assert_equals_($3,(12));
  55851. $ctx1.sendIdx["assert:equals:"]=5;
  55852. self._assert_equals_((7).__slash_slash((2)),(3));
  55853. $ctx1.sendIdx["assert:equals:"]=6;
  55854. self._assert_equals_((7).__backslash_backslash((2)),(1));
  55855. $ctx1.sendIdx["assert:equals:"]=7;
  55856. $5=(1).__plus((2));
  55857. $ctx1.sendIdx["+"]=2;
  55858. $4=$recv($5).__star((3));
  55859. $ctx1.sendIdx["*"]=2;
  55860. self._assert_equals_($4,(9));
  55861. $ctx1.sendIdx["assert:equals:"]=8;
  55862. self._assert_equals_((1).__plus((2).__star((3))),(7));
  55863. return self;
  55864. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  55865. },
  55866. args: [],
  55867. 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",
  55868. referencedClasses: [],
  55869. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  55870. }),
  55871. $globals.NumberTest);
  55872. $core.addMethod(
  55873. $core.method({
  55874. selector: "testAsNumber",
  55875. protocol: 'tests',
  55876. fn: function (){
  55877. var self=this;
  55878. return $core.withContext(function($ctx1) {
  55879. self._assert_equals_((3)._asNumber(),(3));
  55880. return self;
  55881. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  55882. },
  55883. args: [],
  55884. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  55885. referencedClasses: [],
  55886. messageSends: ["assert:equals:", "asNumber"]
  55887. }),
  55888. $globals.NumberTest);
  55889. $core.addMethod(
  55890. $core.method({
  55891. selector: "testCeiling",
  55892. protocol: 'tests',
  55893. fn: function (){
  55894. var self=this;
  55895. return $core.withContext(function($ctx1) {
  55896. var $1,$2;
  55897. $1=(1.2)._ceiling();
  55898. $ctx1.sendIdx["ceiling"]=1;
  55899. self._assert_equals_($1,(2));
  55900. $ctx1.sendIdx["assert:equals:"]=1;
  55901. $2=(-1.2)._ceiling();
  55902. $ctx1.sendIdx["ceiling"]=2;
  55903. self._assert_equals_($2,(-1));
  55904. $ctx1.sendIdx["assert:equals:"]=2;
  55905. self._assert_equals_((1)._ceiling(),(1));
  55906. return self;
  55907. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  55908. },
  55909. args: [],
  55910. 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.",
  55911. referencedClasses: [],
  55912. messageSends: ["assert:equals:", "ceiling"]
  55913. }),
  55914. $globals.NumberTest);
  55915. $core.addMethod(
  55916. $core.method({
  55917. selector: "testComparison",
  55918. protocol: 'tests',
  55919. fn: function (){
  55920. var self=this;
  55921. return $core.withContext(function($ctx1) {
  55922. var $1,$2,$3,$4;
  55923. $1=(3).__gt((2));
  55924. $ctx1.sendIdx[">"]=1;
  55925. self._assert_($1);
  55926. $ctx1.sendIdx["assert:"]=1;
  55927. $2=(2).__lt((3));
  55928. $ctx1.sendIdx["<"]=1;
  55929. self._assert_($2);
  55930. $ctx1.sendIdx["assert:"]=2;
  55931. self._deny_((3).__lt((2)));
  55932. $ctx1.sendIdx["deny:"]=1;
  55933. self._deny_((2).__gt((3)));
  55934. $3=(3).__gt_eq((3));
  55935. $ctx1.sendIdx[">="]=1;
  55936. self._assert_($3);
  55937. $ctx1.sendIdx["assert:"]=3;
  55938. self._assert_((3.1).__gt_eq((3)));
  55939. $ctx1.sendIdx["assert:"]=4;
  55940. $4=(3).__lt_eq((3));
  55941. $ctx1.sendIdx["<="]=1;
  55942. self._assert_($4);
  55943. $ctx1.sendIdx["assert:"]=5;
  55944. self._assert_((3).__lt_eq((3.1)));
  55945. return self;
  55946. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  55947. },
  55948. args: [],
  55949. 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",
  55950. referencedClasses: [],
  55951. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  55952. }),
  55953. $globals.NumberTest);
  55954. $core.addMethod(
  55955. $core.method({
  55956. selector: "testCopying",
  55957. protocol: 'tests',
  55958. fn: function (){
  55959. var self=this;
  55960. return $core.withContext(function($ctx1) {
  55961. var $1;
  55962. $1=$recv((1)._copy()).__eq_eq((1));
  55963. $ctx1.sendIdx["=="]=1;
  55964. self._assert_($1);
  55965. $ctx1.sendIdx["assert:"]=1;
  55966. self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  55967. return self;
  55968. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  55969. },
  55970. args: [],
  55971. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  55972. referencedClasses: [],
  55973. messageSends: ["assert:", "==", "copy", "deepCopy"]
  55974. }),
  55975. $globals.NumberTest);
  55976. $core.addMethod(
  55977. $core.method({
  55978. selector: "testEquality",
  55979. protocol: 'tests',
  55980. fn: function (){
  55981. var self=this;
  55982. return $core.withContext(function($ctx1) {
  55983. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  55984. $1=(1).__eq((1));
  55985. $ctx1.sendIdx["="]=1;
  55986. self._assert_($1);
  55987. $ctx1.sendIdx["assert:"]=1;
  55988. $2=(0).__eq((0));
  55989. $ctx1.sendIdx["="]=2;
  55990. self._assert_($2);
  55991. $ctx1.sendIdx["assert:"]=2;
  55992. $3=(1).__eq((0));
  55993. $ctx1.sendIdx["="]=3;
  55994. self._deny_($3);
  55995. $ctx1.sendIdx["deny:"]=1;
  55996. $5=(1)._yourself();
  55997. $ctx1.sendIdx["yourself"]=1;
  55998. $4=$recv($5).__eq((1));
  55999. $ctx1.sendIdx["="]=4;
  56000. self._assert_($4);
  56001. $ctx1.sendIdx["assert:"]=3;
  56002. $7=(1)._yourself();
  56003. $ctx1.sendIdx["yourself"]=2;
  56004. $6=(1).__eq($7);
  56005. $ctx1.sendIdx["="]=5;
  56006. self._assert_($6);
  56007. $ctx1.sendIdx["assert:"]=4;
  56008. $9=(1)._yourself();
  56009. $ctx1.sendIdx["yourself"]=3;
  56010. $8=$recv($9).__eq((1)._yourself());
  56011. $ctx1.sendIdx["="]=6;
  56012. self._assert_($8);
  56013. $10=(0).__eq(false);
  56014. $ctx1.sendIdx["="]=7;
  56015. self._deny_($10);
  56016. $ctx1.sendIdx["deny:"]=2;
  56017. $11=false.__eq((0));
  56018. $ctx1.sendIdx["="]=8;
  56019. self._deny_($11);
  56020. $ctx1.sendIdx["deny:"]=3;
  56021. $12="".__eq((0));
  56022. $ctx1.sendIdx["="]=9;
  56023. self._deny_($12);
  56024. $ctx1.sendIdx["deny:"]=4;
  56025. self._deny_((0).__eq(""));
  56026. return self;
  56027. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  56028. },
  56029. args: [],
  56030. 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 = ''",
  56031. referencedClasses: [],
  56032. messageSends: ["assert:", "=", "deny:", "yourself"]
  56033. }),
  56034. $globals.NumberTest);
  56035. $core.addMethod(
  56036. $core.method({
  56037. selector: "testFloor",
  56038. protocol: 'tests',
  56039. fn: function (){
  56040. var self=this;
  56041. return $core.withContext(function($ctx1) {
  56042. var $1,$2;
  56043. $1=(1.2)._floor();
  56044. $ctx1.sendIdx["floor"]=1;
  56045. self._assert_equals_($1,(1));
  56046. $ctx1.sendIdx["assert:equals:"]=1;
  56047. $2=(-1.2)._floor();
  56048. $ctx1.sendIdx["floor"]=2;
  56049. self._assert_equals_($2,(-2));
  56050. $ctx1.sendIdx["assert:equals:"]=2;
  56051. self._assert_equals_((1)._floor(),(1));
  56052. return self;
  56053. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  56054. },
  56055. args: [],
  56056. 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.",
  56057. referencedClasses: [],
  56058. messageSends: ["assert:equals:", "floor"]
  56059. }),
  56060. $globals.NumberTest);
  56061. $core.addMethod(
  56062. $core.method({
  56063. selector: "testHexNumbers",
  56064. protocol: 'tests',
  56065. fn: function (){
  56066. var self=this;
  56067. return $core.withContext(function($ctx1) {
  56068. var $1,$2,$3,$4,$5;
  56069. self._assert_equals_((9),(9));
  56070. $ctx1.sendIdx["assert:equals:"]=1;
  56071. $1=(10)._truncated();
  56072. $ctx1.sendIdx["truncated"]=1;
  56073. self._assert_equals_($1,(10));
  56074. $ctx1.sendIdx["assert:equals:"]=2;
  56075. $2=(11)._truncated();
  56076. $ctx1.sendIdx["truncated"]=2;
  56077. self._assert_equals_($2,(11));
  56078. $ctx1.sendIdx["assert:equals:"]=3;
  56079. $3=(12)._truncated();
  56080. $ctx1.sendIdx["truncated"]=3;
  56081. self._assert_equals_($3,(12));
  56082. $ctx1.sendIdx["assert:equals:"]=4;
  56083. $4=(13)._truncated();
  56084. $ctx1.sendIdx["truncated"]=4;
  56085. self._assert_equals_($4,(13));
  56086. $ctx1.sendIdx["assert:equals:"]=5;
  56087. $5=(14)._truncated();
  56088. $ctx1.sendIdx["truncated"]=5;
  56089. self._assert_equals_($5,(14));
  56090. $ctx1.sendIdx["assert:equals:"]=6;
  56091. self._assert_equals_((15)._truncated(),(15));
  56092. return self;
  56093. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  56094. },
  56095. args: [],
  56096. 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",
  56097. referencedClasses: [],
  56098. messageSends: ["assert:equals:", "truncated"]
  56099. }),
  56100. $globals.NumberTest);
  56101. $core.addMethod(
  56102. $core.method({
  56103. selector: "testIdentity",
  56104. protocol: 'tests',
  56105. fn: function (){
  56106. var self=this;
  56107. return $core.withContext(function($ctx1) {
  56108. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  56109. $1=(1).__eq_eq((1));
  56110. $ctx1.sendIdx["=="]=1;
  56111. self._assert_($1);
  56112. $ctx1.sendIdx["assert:"]=1;
  56113. $2=(0).__eq_eq((0));
  56114. $ctx1.sendIdx["=="]=2;
  56115. self._assert_($2);
  56116. $ctx1.sendIdx["assert:"]=2;
  56117. $3=(1).__eq_eq((0));
  56118. $ctx1.sendIdx["=="]=3;
  56119. self._deny_($3);
  56120. $ctx1.sendIdx["deny:"]=1;
  56121. $5=(1)._yourself();
  56122. $ctx1.sendIdx["yourself"]=1;
  56123. $4=$recv($5).__eq_eq((1));
  56124. $ctx1.sendIdx["=="]=4;
  56125. self._assert_($4);
  56126. $ctx1.sendIdx["assert:"]=3;
  56127. $7=(1)._yourself();
  56128. $ctx1.sendIdx["yourself"]=2;
  56129. $6=(1).__eq_eq($7);
  56130. $ctx1.sendIdx["=="]=5;
  56131. self._assert_($6);
  56132. $ctx1.sendIdx["assert:"]=4;
  56133. $9=(1)._yourself();
  56134. $ctx1.sendIdx["yourself"]=3;
  56135. $8=$recv($9).__eq_eq((1)._yourself());
  56136. $ctx1.sendIdx["=="]=6;
  56137. self._assert_($8);
  56138. self._deny_((1).__eq_eq((2)));
  56139. return self;
  56140. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  56141. },
  56142. args: [],
  56143. 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",
  56144. referencedClasses: [],
  56145. messageSends: ["assert:", "==", "deny:", "yourself"]
  56146. }),
  56147. $globals.NumberTest);
  56148. $core.addMethod(
  56149. $core.method({
  56150. selector: "testInvalidHexNumbers",
  56151. protocol: 'tests',
  56152. fn: function (){
  56153. var self=this;
  56154. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  56155. return $core.withContext(function($ctx1) {
  56156. self._should_raise_((function(){
  56157. return $core.withContext(function($ctx2) {
  56158. return (16)._rG();
  56159. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56160. }),$MessageNotUnderstood());
  56161. $ctx1.sendIdx["should:raise:"]=1;
  56162. self._should_raise_((function(){
  56163. return $core.withContext(function($ctx2) {
  56164. return (16)._rg();
  56165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56166. }),$MessageNotUnderstood());
  56167. $ctx1.sendIdx["should:raise:"]=2;
  56168. self._should_raise_((function(){
  56169. return $core.withContext(function($ctx2) {
  56170. return (16)._rH();
  56171. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  56172. }),$MessageNotUnderstood());
  56173. $ctx1.sendIdx["should:raise:"]=3;
  56174. self._should_raise_((function(){
  56175. return $core.withContext(function($ctx2) {
  56176. return (16)._rh();
  56177. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  56178. }),$MessageNotUnderstood());
  56179. $ctx1.sendIdx["should:raise:"]=4;
  56180. self._should_raise_((function(){
  56181. return $core.withContext(function($ctx2) {
  56182. return (16)._rI();
  56183. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  56184. }),$MessageNotUnderstood());
  56185. $ctx1.sendIdx["should:raise:"]=5;
  56186. self._should_raise_((function(){
  56187. return $core.withContext(function($ctx2) {
  56188. return (16)._ri();
  56189. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  56190. }),$MessageNotUnderstood());
  56191. $ctx1.sendIdx["should:raise:"]=6;
  56192. self._should_raise_((function(){
  56193. return $core.withContext(function($ctx2) {
  56194. return (16)._rJ();
  56195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  56196. }),$MessageNotUnderstood());
  56197. $ctx1.sendIdx["should:raise:"]=7;
  56198. self._should_raise_((function(){
  56199. return $core.withContext(function($ctx2) {
  56200. return (16)._rj();
  56201. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  56202. }),$MessageNotUnderstood());
  56203. $ctx1.sendIdx["should:raise:"]=8;
  56204. self._should_raise_((function(){
  56205. return $core.withContext(function($ctx2) {
  56206. return (16)._rK();
  56207. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  56208. }),$MessageNotUnderstood());
  56209. $ctx1.sendIdx["should:raise:"]=9;
  56210. self._should_raise_((function(){
  56211. return $core.withContext(function($ctx2) {
  56212. return (16)._rk();
  56213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  56214. }),$MessageNotUnderstood());
  56215. $ctx1.sendIdx["should:raise:"]=10;
  56216. self._should_raise_((function(){
  56217. return $core.withContext(function($ctx2) {
  56218. return (16)._rL();
  56219. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  56220. }),$MessageNotUnderstood());
  56221. $ctx1.sendIdx["should:raise:"]=11;
  56222. self._should_raise_((function(){
  56223. return $core.withContext(function($ctx2) {
  56224. return (16)._rl();
  56225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  56226. }),$MessageNotUnderstood());
  56227. $ctx1.sendIdx["should:raise:"]=12;
  56228. self._should_raise_((function(){
  56229. return $core.withContext(function($ctx2) {
  56230. return (16)._rM();
  56231. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  56232. }),$MessageNotUnderstood());
  56233. $ctx1.sendIdx["should:raise:"]=13;
  56234. self._should_raise_((function(){
  56235. return $core.withContext(function($ctx2) {
  56236. return (16)._rm();
  56237. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  56238. }),$MessageNotUnderstood());
  56239. $ctx1.sendIdx["should:raise:"]=14;
  56240. self._should_raise_((function(){
  56241. return $core.withContext(function($ctx2) {
  56242. return (16)._rN();
  56243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  56244. }),$MessageNotUnderstood());
  56245. $ctx1.sendIdx["should:raise:"]=15;
  56246. self._should_raise_((function(){
  56247. return $core.withContext(function($ctx2) {
  56248. return (16)._rn();
  56249. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  56250. }),$MessageNotUnderstood());
  56251. $ctx1.sendIdx["should:raise:"]=16;
  56252. self._should_raise_((function(){
  56253. return $core.withContext(function($ctx2) {
  56254. return (16)._rO();
  56255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  56256. }),$MessageNotUnderstood());
  56257. $ctx1.sendIdx["should:raise:"]=17;
  56258. self._should_raise_((function(){
  56259. return $core.withContext(function($ctx2) {
  56260. return (16)._ro();
  56261. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  56262. }),$MessageNotUnderstood());
  56263. $ctx1.sendIdx["should:raise:"]=18;
  56264. self._should_raise_((function(){
  56265. return $core.withContext(function($ctx2) {
  56266. return (16)._rP();
  56267. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  56268. }),$MessageNotUnderstood());
  56269. $ctx1.sendIdx["should:raise:"]=19;
  56270. self._should_raise_((function(){
  56271. return $core.withContext(function($ctx2) {
  56272. return (16)._rp();
  56273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  56274. }),$MessageNotUnderstood());
  56275. $ctx1.sendIdx["should:raise:"]=20;
  56276. self._should_raise_((function(){
  56277. return $core.withContext(function($ctx2) {
  56278. return (16)._rQ();
  56279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  56280. }),$MessageNotUnderstood());
  56281. $ctx1.sendIdx["should:raise:"]=21;
  56282. self._should_raise_((function(){
  56283. return $core.withContext(function($ctx2) {
  56284. return (16)._rq();
  56285. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  56286. }),$MessageNotUnderstood());
  56287. $ctx1.sendIdx["should:raise:"]=22;
  56288. self._should_raise_((function(){
  56289. return $core.withContext(function($ctx2) {
  56290. return (16)._rR();
  56291. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  56292. }),$MessageNotUnderstood());
  56293. $ctx1.sendIdx["should:raise:"]=23;
  56294. self._should_raise_((function(){
  56295. return $core.withContext(function($ctx2) {
  56296. return (16)._rr();
  56297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  56298. }),$MessageNotUnderstood());
  56299. $ctx1.sendIdx["should:raise:"]=24;
  56300. self._should_raise_((function(){
  56301. return $core.withContext(function($ctx2) {
  56302. return (16)._rS();
  56303. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  56304. }),$MessageNotUnderstood());
  56305. $ctx1.sendIdx["should:raise:"]=25;
  56306. self._should_raise_((function(){
  56307. return $core.withContext(function($ctx2) {
  56308. return (16)._rs();
  56309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  56310. }),$MessageNotUnderstood());
  56311. $ctx1.sendIdx["should:raise:"]=26;
  56312. self._should_raise_((function(){
  56313. return $core.withContext(function($ctx2) {
  56314. return (16)._rT();
  56315. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  56316. }),$MessageNotUnderstood());
  56317. $ctx1.sendIdx["should:raise:"]=27;
  56318. self._should_raise_((function(){
  56319. return $core.withContext(function($ctx2) {
  56320. return (16)._rt();
  56321. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  56322. }),$MessageNotUnderstood());
  56323. $ctx1.sendIdx["should:raise:"]=28;
  56324. self._should_raise_((function(){
  56325. return $core.withContext(function($ctx2) {
  56326. return (16)._rU();
  56327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  56328. }),$MessageNotUnderstood());
  56329. $ctx1.sendIdx["should:raise:"]=29;
  56330. self._should_raise_((function(){
  56331. return $core.withContext(function($ctx2) {
  56332. return (16)._ru();
  56333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  56334. }),$MessageNotUnderstood());
  56335. $ctx1.sendIdx["should:raise:"]=30;
  56336. self._should_raise_((function(){
  56337. return $core.withContext(function($ctx2) {
  56338. return (16)._rV();
  56339. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  56340. }),$MessageNotUnderstood());
  56341. $ctx1.sendIdx["should:raise:"]=31;
  56342. self._should_raise_((function(){
  56343. return $core.withContext(function($ctx2) {
  56344. return (16)._rv();
  56345. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  56346. }),$MessageNotUnderstood());
  56347. $ctx1.sendIdx["should:raise:"]=32;
  56348. self._should_raise_((function(){
  56349. return $core.withContext(function($ctx2) {
  56350. return (16)._rW();
  56351. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  56352. }),$MessageNotUnderstood());
  56353. $ctx1.sendIdx["should:raise:"]=33;
  56354. self._should_raise_((function(){
  56355. return $core.withContext(function($ctx2) {
  56356. return (16)._rw();
  56357. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  56358. }),$MessageNotUnderstood());
  56359. $ctx1.sendIdx["should:raise:"]=34;
  56360. self._should_raise_((function(){
  56361. return $core.withContext(function($ctx2) {
  56362. return (16)._rX();
  56363. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  56364. }),$MessageNotUnderstood());
  56365. $ctx1.sendIdx["should:raise:"]=35;
  56366. self._should_raise_((function(){
  56367. return $core.withContext(function($ctx2) {
  56368. return (16)._rx();
  56369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  56370. }),$MessageNotUnderstood());
  56371. $ctx1.sendIdx["should:raise:"]=36;
  56372. self._should_raise_((function(){
  56373. return $core.withContext(function($ctx2) {
  56374. return (16)._rY();
  56375. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  56376. }),$MessageNotUnderstood());
  56377. $ctx1.sendIdx["should:raise:"]=37;
  56378. self._should_raise_((function(){
  56379. return $core.withContext(function($ctx2) {
  56380. return (16)._ry();
  56381. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  56382. }),$MessageNotUnderstood());
  56383. $ctx1.sendIdx["should:raise:"]=38;
  56384. self._should_raise_((function(){
  56385. return $core.withContext(function($ctx2) {
  56386. return (16)._rZ();
  56387. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  56388. }),$MessageNotUnderstood());
  56389. $ctx1.sendIdx["should:raise:"]=39;
  56390. self._should_raise_((function(){
  56391. return $core.withContext(function($ctx2) {
  56392. return (16)._rz();
  56393. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  56394. }),$MessageNotUnderstood());
  56395. $ctx1.sendIdx["should:raise:"]=40;
  56396. self._should_raise_((function(){
  56397. return $core.withContext(function($ctx2) {
  56398. return (11259375)._Z();
  56399. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  56400. }),$MessageNotUnderstood());
  56401. return self;
  56402. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  56403. },
  56404. args: [],
  56405. 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.",
  56406. referencedClasses: ["MessageNotUnderstood"],
  56407. 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"]
  56408. }),
  56409. $globals.NumberTest);
  56410. $core.addMethod(
  56411. $core.method({
  56412. selector: "testLog",
  56413. protocol: 'tests',
  56414. fn: function (){
  56415. var self=this;
  56416. function $Number(){return $globals.Number||(typeof Number=="undefined"?nil:Number)}
  56417. return $core.withContext(function($ctx1) {
  56418. self._assert_equals_((10000)._log(),(4));
  56419. $ctx1.sendIdx["assert:equals:"]=1;
  56420. self._assert_equals_((512)._log_((2)),(9));
  56421. $ctx1.sendIdx["assert:equals:"]=2;
  56422. self._assert_equals_($recv($recv($Number())._e())._ln(),(1));
  56423. return self;
  56424. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  56425. },
  56426. args: [],
  56427. 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.",
  56428. referencedClasses: ["Number"],
  56429. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  56430. }),
  56431. $globals.NumberTest);
  56432. $core.addMethod(
  56433. $core.method({
  56434. selector: "testMinMax",
  56435. protocol: 'tests',
  56436. fn: function (){
  56437. var self=this;
  56438. return $core.withContext(function($ctx1) {
  56439. self._assert_equals_((2)._max_((5)),(5));
  56440. $ctx1.sendIdx["assert:equals:"]=1;
  56441. self._assert_equals_((2)._min_((5)),(2));
  56442. return self;
  56443. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  56444. },
  56445. args: [],
  56446. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  56447. referencedClasses: [],
  56448. messageSends: ["assert:equals:", "max:", "min:"]
  56449. }),
  56450. $globals.NumberTest);
  56451. $core.addMethod(
  56452. $core.method({
  56453. selector: "testNegated",
  56454. protocol: 'tests',
  56455. fn: function (){
  56456. var self=this;
  56457. return $core.withContext(function($ctx1) {
  56458. var $1;
  56459. $1=(3)._negated();
  56460. $ctx1.sendIdx["negated"]=1;
  56461. self._assert_equals_($1,(-3));
  56462. $ctx1.sendIdx["assert:equals:"]=1;
  56463. self._assert_equals_((-3)._negated(),(3));
  56464. return self;
  56465. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  56466. },
  56467. args: [],
  56468. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  56469. referencedClasses: [],
  56470. messageSends: ["assert:equals:", "negated"]
  56471. }),
  56472. $globals.NumberTest);
  56473. $core.addMethod(
  56474. $core.method({
  56475. selector: "testPrintShowingDecimalPlaces",
  56476. protocol: 'tests',
  56477. fn: function (){
  56478. var self=this;
  56479. return $core.withContext(function($ctx1) {
  56480. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  56481. $1=(23)._printShowingDecimalPlaces_((2));
  56482. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  56483. self._assert_equals_($1,"23.00");
  56484. $ctx1.sendIdx["assert:equals:"]=1;
  56485. $2=(23.5698)._printShowingDecimalPlaces_((2));
  56486. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  56487. self._assert_equals_($2,"23.57");
  56488. $ctx1.sendIdx["assert:equals:"]=2;
  56489. $4=(234.567)._negated();
  56490. $ctx1.sendIdx["negated"]=1;
  56491. $3=$recv($4)._printShowingDecimalPlaces_((5));
  56492. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  56493. self._assert_equals_($3,"-234.56700");
  56494. $ctx1.sendIdx["assert:equals:"]=3;
  56495. $5=(23.4567)._printShowingDecimalPlaces_((0));
  56496. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  56497. self._assert_equals_($5,"23");
  56498. $ctx1.sendIdx["assert:equals:"]=4;
  56499. $6=(23.5567)._printShowingDecimalPlaces_((0));
  56500. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  56501. self._assert_equals_($6,"24");
  56502. $ctx1.sendIdx["assert:equals:"]=5;
  56503. $8=(23.4567)._negated();
  56504. $ctx1.sendIdx["negated"]=2;
  56505. $7=$recv($8)._printShowingDecimalPlaces_((0));
  56506. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  56507. self._assert_equals_($7,"-23");
  56508. $ctx1.sendIdx["assert:equals:"]=6;
  56509. $10=(23.5567)._negated();
  56510. $ctx1.sendIdx["negated"]=3;
  56511. $9=$recv($10)._printShowingDecimalPlaces_((0));
  56512. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  56513. self._assert_equals_($9,"-24");
  56514. $ctx1.sendIdx["assert:equals:"]=7;
  56515. $11=(100000000)._printShowingDecimalPlaces_((1));
  56516. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  56517. self._assert_equals_($11,"100000000.0");
  56518. $ctx1.sendIdx["assert:equals:"]=8;
  56519. $12=(0.98)._printShowingDecimalPlaces_((5));
  56520. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  56521. self._assert_equals_($12,"0.98000");
  56522. $ctx1.sendIdx["assert:equals:"]=9;
  56523. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  56524. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  56525. self._assert_equals_($13,"-0.98");
  56526. $ctx1.sendIdx["assert:equals:"]=10;
  56527. $14=(2.567)._printShowingDecimalPlaces_((2));
  56528. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  56529. self._assert_equals_($14,"2.57");
  56530. $ctx1.sendIdx["assert:equals:"]=11;
  56531. $15=(-2.567)._printShowingDecimalPlaces_((2));
  56532. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  56533. self._assert_equals_($15,"-2.57");
  56534. $ctx1.sendIdx["assert:equals:"]=12;
  56535. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  56536. return self;
  56537. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  56538. },
  56539. args: [],
  56540. 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'.",
  56541. referencedClasses: [],
  56542. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  56543. }),
  56544. $globals.NumberTest);
  56545. $core.addMethod(
  56546. $core.method({
  56547. selector: "testRaisedTo",
  56548. protocol: 'tests',
  56549. fn: function (){
  56550. var self=this;
  56551. return $core.withContext(function($ctx1) {
  56552. var $1,$2,$3;
  56553. $1=(2)._raisedTo_((4));
  56554. $ctx1.sendIdx["raisedTo:"]=1;
  56555. self._assert_equals_($1,(16));
  56556. $ctx1.sendIdx["assert:equals:"]=1;
  56557. $2=(2)._raisedTo_((0));
  56558. $ctx1.sendIdx["raisedTo:"]=2;
  56559. self._assert_equals_($2,(1));
  56560. $ctx1.sendIdx["assert:equals:"]=2;
  56561. $3=(2)._raisedTo_((-3));
  56562. $ctx1.sendIdx["raisedTo:"]=3;
  56563. self._assert_equals_($3,(0.125));
  56564. $ctx1.sendIdx["assert:equals:"]=3;
  56565. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  56566. $ctx1.sendIdx["assert:equals:"]=4;
  56567. self._assert_equals_((2).__star_star((4)),(16));
  56568. return self;
  56569. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  56570. },
  56571. args: [],
  56572. 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.",
  56573. referencedClasses: [],
  56574. messageSends: ["assert:equals:", "raisedTo:", "**"]
  56575. }),
  56576. $globals.NumberTest);
  56577. $core.addMethod(
  56578. $core.method({
  56579. selector: "testRounded",
  56580. protocol: 'tests',
  56581. fn: function (){
  56582. var self=this;
  56583. return $core.withContext(function($ctx1) {
  56584. var $1,$2;
  56585. $1=(3)._rounded();
  56586. $ctx1.sendIdx["rounded"]=1;
  56587. self._assert_equals_($1,(3));
  56588. $ctx1.sendIdx["assert:equals:"]=1;
  56589. $2=(3.212)._rounded();
  56590. $ctx1.sendIdx["rounded"]=2;
  56591. self._assert_equals_($2,(3));
  56592. $ctx1.sendIdx["assert:equals:"]=2;
  56593. self._assert_equals_((3.51)._rounded(),(4));
  56594. return self;
  56595. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  56596. },
  56597. args: [],
  56598. 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",
  56599. referencedClasses: [],
  56600. messageSends: ["assert:equals:", "rounded"]
  56601. }),
  56602. $globals.NumberTest);
  56603. $core.addMethod(
  56604. $core.method({
  56605. selector: "testSign",
  56606. protocol: 'tests',
  56607. fn: function (){
  56608. var self=this;
  56609. return $core.withContext(function($ctx1) {
  56610. var $1,$2;
  56611. $1=(5)._sign();
  56612. $ctx1.sendIdx["sign"]=1;
  56613. self._assert_equals_($1,(1));
  56614. $ctx1.sendIdx["assert:equals:"]=1;
  56615. $2=(0)._sign();
  56616. $ctx1.sendIdx["sign"]=2;
  56617. self._assert_equals_($2,(0));
  56618. $ctx1.sendIdx["assert:equals:"]=2;
  56619. self._assert_equals_((-1.4)._sign(),(-1));
  56620. return self;
  56621. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  56622. },
  56623. args: [],
  56624. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  56625. referencedClasses: [],
  56626. messageSends: ["assert:equals:", "sign"]
  56627. }),
  56628. $globals.NumberTest);
  56629. $core.addMethod(
  56630. $core.method({
  56631. selector: "testSqrt",
  56632. protocol: 'tests',
  56633. fn: function (){
  56634. var self=this;
  56635. return $core.withContext(function($ctx1) {
  56636. var $1;
  56637. $1=(4)._sqrt();
  56638. $ctx1.sendIdx["sqrt"]=1;
  56639. self._assert_equals_($1,(2));
  56640. $ctx1.sendIdx["assert:equals:"]=1;
  56641. self._assert_equals_((16)._sqrt(),(4));
  56642. return self;
  56643. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  56644. },
  56645. args: [],
  56646. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  56647. referencedClasses: [],
  56648. messageSends: ["assert:equals:", "sqrt"]
  56649. }),
  56650. $globals.NumberTest);
  56651. $core.addMethod(
  56652. $core.method({
  56653. selector: "testSquared",
  56654. protocol: 'tests',
  56655. fn: function (){
  56656. var self=this;
  56657. return $core.withContext(function($ctx1) {
  56658. self._assert_equals_((4)._squared(),(16));
  56659. return self;
  56660. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  56661. },
  56662. args: [],
  56663. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  56664. referencedClasses: [],
  56665. messageSends: ["assert:equals:", "squared"]
  56666. }),
  56667. $globals.NumberTest);
  56668. $core.addMethod(
  56669. $core.method({
  56670. selector: "testTimesRepeat",
  56671. protocol: 'tests',
  56672. fn: function (){
  56673. var self=this;
  56674. var i;
  56675. return $core.withContext(function($ctx1) {
  56676. i=(0);
  56677. (0)._timesRepeat_((function(){
  56678. return $core.withContext(function($ctx2) {
  56679. i=$recv(i).__plus((1));
  56680. $ctx2.sendIdx["+"]=1;
  56681. return i;
  56682. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56683. }));
  56684. $ctx1.sendIdx["timesRepeat:"]=1;
  56685. self._assert_equals_(i,(0));
  56686. $ctx1.sendIdx["assert:equals:"]=1;
  56687. (5)._timesRepeat_((function(){
  56688. return $core.withContext(function($ctx2) {
  56689. i=$recv(i).__plus((1));
  56690. return i;
  56691. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56692. }));
  56693. self._assert_equals_(i,(5));
  56694. return self;
  56695. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  56696. },
  56697. args: [],
  56698. 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",
  56699. referencedClasses: [],
  56700. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  56701. }),
  56702. $globals.NumberTest);
  56703. $core.addMethod(
  56704. $core.method({
  56705. selector: "testTo",
  56706. protocol: 'tests',
  56707. fn: function (){
  56708. var self=this;
  56709. return $core.withContext(function($ctx1) {
  56710. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  56711. return self;
  56712. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  56713. },
  56714. args: [],
  56715. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  56716. referencedClasses: [],
  56717. messageSends: ["assert:equals:", "to:"]
  56718. }),
  56719. $globals.NumberTest);
  56720. $core.addMethod(
  56721. $core.method({
  56722. selector: "testToBy",
  56723. protocol: 'tests',
  56724. fn: function (){
  56725. var self=this;
  56726. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  56727. return $core.withContext(function($ctx1) {
  56728. var $1;
  56729. $1=(0)._to_by_((6),(2));
  56730. $ctx1.sendIdx["to:by:"]=1;
  56731. self._assert_equals_($1,[(0), (2), (4), (6)]);
  56732. self._should_raise_((function(){
  56733. return $core.withContext(function($ctx2) {
  56734. return (1)._to_by_((4),(0));
  56735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56736. }),$Error());
  56737. return self;
  56738. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  56739. },
  56740. args: [],
  56741. 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",
  56742. referencedClasses: ["Error"],
  56743. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  56744. }),
  56745. $globals.NumberTest);
  56746. $core.addMethod(
  56747. $core.method({
  56748. selector: "testTrigonometry",
  56749. protocol: 'tests',
  56750. fn: function (){
  56751. var self=this;
  56752. return $core.withContext(function($ctx1) {
  56753. self._assert_equals_((0)._cos(),(1));
  56754. $ctx1.sendIdx["assert:equals:"]=1;
  56755. self._assert_equals_((0)._sin(),(0));
  56756. $ctx1.sendIdx["assert:equals:"]=2;
  56757. self._assert_equals_((0)._tan(),(0));
  56758. $ctx1.sendIdx["assert:equals:"]=3;
  56759. self._assert_equals_((1)._arcCos(),(0));
  56760. $ctx1.sendIdx["assert:equals:"]=4;
  56761. self._assert_equals_((0)._arcSin(),(0));
  56762. $ctx1.sendIdx["assert:equals:"]=5;
  56763. self._assert_equals_((0)._arcTan(),(0));
  56764. return self;
  56765. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  56766. },
  56767. args: [],
  56768. 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.",
  56769. referencedClasses: [],
  56770. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"]
  56771. }),
  56772. $globals.NumberTest);
  56773. $core.addMethod(
  56774. $core.method({
  56775. selector: "testTruncated",
  56776. protocol: 'tests',
  56777. fn: function (){
  56778. var self=this;
  56779. return $core.withContext(function($ctx1) {
  56780. var $1,$2;
  56781. $1=(3)._truncated();
  56782. $ctx1.sendIdx["truncated"]=1;
  56783. self._assert_equals_($1,(3));
  56784. $ctx1.sendIdx["assert:equals:"]=1;
  56785. $2=(3.212)._truncated();
  56786. $ctx1.sendIdx["truncated"]=2;
  56787. self._assert_equals_($2,(3));
  56788. $ctx1.sendIdx["assert:equals:"]=2;
  56789. self._assert_equals_((3.51)._truncated(),(3));
  56790. return self;
  56791. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  56792. },
  56793. args: [],
  56794. 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",
  56795. referencedClasses: [],
  56796. messageSends: ["assert:equals:", "truncated"]
  56797. }),
  56798. $globals.NumberTest);
  56799. $core.addClass('ObjectMock', $globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  56800. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  56801. $core.addMethod(
  56802. $core.method({
  56803. selector: "foo",
  56804. protocol: 'not yet classified',
  56805. fn: function (){
  56806. var self=this;
  56807. var $1;
  56808. $1=self["@foo"];
  56809. return $1;
  56810. },
  56811. args: [],
  56812. source: "foo\x0a\x09^ foo",
  56813. referencedClasses: [],
  56814. messageSends: []
  56815. }),
  56816. $globals.ObjectMock);
  56817. $core.addMethod(
  56818. $core.method({
  56819. selector: "foo:",
  56820. protocol: 'not yet classified',
  56821. fn: function (anObject){
  56822. var self=this;
  56823. self["@foo"]=anObject;
  56824. return self;
  56825. },
  56826. args: ["anObject"],
  56827. source: "foo: anObject\x0a\x09foo := anObject",
  56828. referencedClasses: [],
  56829. messageSends: []
  56830. }),
  56831. $globals.ObjectMock);
  56832. $core.addClass('ObjectTest', $globals.TestCase, [], 'Kernel-Tests');
  56833. $core.addMethod(
  56834. $core.method({
  56835. selector: "notDefined",
  56836. protocol: 'tests',
  56837. fn: function (){
  56838. var self=this;
  56839. return $core.withContext(function($ctx1) {
  56840. return void 0;;
  56841. return self;
  56842. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  56843. },
  56844. args: [],
  56845. source: "notDefined\x0a\x09<return void 0;>",
  56846. referencedClasses: [],
  56847. messageSends: []
  56848. }),
  56849. $globals.ObjectTest);
  56850. $core.addMethod(
  56851. $core.method({
  56852. selector: "testBasicAccess",
  56853. protocol: 'tests',
  56854. fn: function (){
  56855. var self=this;
  56856. var o;
  56857. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56858. return $core.withContext(function($ctx1) {
  56859. var $1;
  56860. o=$recv($Object())._new();
  56861. $recv(o)._basicAt_put_("a",(1));
  56862. $1=$recv(o)._basicAt_("a");
  56863. $ctx1.sendIdx["basicAt:"]=1;
  56864. self._assert_equals_($1,(1));
  56865. $ctx1.sendIdx["assert:equals:"]=1;
  56866. self._assert_equals_($recv(o)._basicAt_("b"),nil);
  56867. return self;
  56868. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  56869. },
  56870. args: [],
  56871. 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",
  56872. referencedClasses: ["Object"],
  56873. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  56874. }),
  56875. $globals.ObjectTest);
  56876. $core.addMethod(
  56877. $core.method({
  56878. selector: "testBasicPerform",
  56879. protocol: 'tests',
  56880. fn: function (){
  56881. var self=this;
  56882. var o;
  56883. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56884. return $core.withContext(function($ctx1) {
  56885. o=$recv($Object())._new();
  56886. $recv(o)._basicAt_put_("func",(function(){
  56887. return "hello";
  56888. }));
  56889. $ctx1.sendIdx["basicAt:put:"]=1;
  56890. $recv(o)._basicAt_put_("func2",(function(a){
  56891. return $core.withContext(function($ctx2) {
  56892. return $recv(a).__plus((1));
  56893. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  56894. }));
  56895. self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  56896. $ctx1.sendIdx["assert:equals:"]=1;
  56897. self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  56898. return self;
  56899. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  56900. },
  56901. args: [],
  56902. 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",
  56903. referencedClasses: ["Object"],
  56904. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  56905. }),
  56906. $globals.ObjectTest);
  56907. $core.addMethod(
  56908. $core.method({
  56909. selector: "testDNU",
  56910. protocol: 'tests',
  56911. fn: function (){
  56912. var self=this;
  56913. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56914. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  56915. return $core.withContext(function($ctx1) {
  56916. self._should_raise_((function(){
  56917. return $core.withContext(function($ctx2) {
  56918. return $recv($recv($Object())._new())._foo();
  56919. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56920. }),$MessageNotUnderstood());
  56921. return self;
  56922. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  56923. },
  56924. args: [],
  56925. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  56926. referencedClasses: ["Object", "MessageNotUnderstood"],
  56927. messageSends: ["should:raise:", "foo", "new"]
  56928. }),
  56929. $globals.ObjectTest);
  56930. $core.addMethod(
  56931. $core.method({
  56932. selector: "testEquality",
  56933. protocol: 'tests',
  56934. fn: function (){
  56935. var self=this;
  56936. var o;
  56937. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56938. return $core.withContext(function($ctx1) {
  56939. var $1,$2,$4,$3;
  56940. o=$recv($Object())._new();
  56941. $ctx1.sendIdx["new"]=1;
  56942. $1=$recv(o).__eq($recv($Object())._new());
  56943. $ctx1.sendIdx["="]=1;
  56944. self._deny_($1);
  56945. $2=$recv(o).__eq(o);
  56946. $ctx1.sendIdx["="]=2;
  56947. self._assert_($2);
  56948. $ctx1.sendIdx["assert:"]=1;
  56949. $4=$recv(o)._yourself();
  56950. $ctx1.sendIdx["yourself"]=1;
  56951. $3=$recv($4).__eq(o);
  56952. $ctx1.sendIdx["="]=3;
  56953. self._assert_($3);
  56954. $ctx1.sendIdx["assert:"]=2;
  56955. self._assert_($recv(o).__eq($recv(o)._yourself()));
  56956. return self;
  56957. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  56958. },
  56959. args: [],
  56960. 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)",
  56961. referencedClasses: ["Object"],
  56962. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  56963. }),
  56964. $globals.ObjectTest);
  56965. $core.addMethod(
  56966. $core.method({
  56967. selector: "testHalt",
  56968. protocol: 'tests',
  56969. fn: function (){
  56970. var self=this;
  56971. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56972. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  56973. return $core.withContext(function($ctx1) {
  56974. self._should_raise_((function(){
  56975. return $core.withContext(function($ctx2) {
  56976. return $recv($recv($Object())._new())._halt();
  56977. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56978. }),$Error());
  56979. return self;
  56980. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  56981. },
  56982. args: [],
  56983. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  56984. referencedClasses: ["Object", "Error"],
  56985. messageSends: ["should:raise:", "halt", "new"]
  56986. }),
  56987. $globals.ObjectTest);
  56988. $core.addMethod(
  56989. $core.method({
  56990. selector: "testIdentity",
  56991. protocol: 'tests',
  56992. fn: function (){
  56993. var self=this;
  56994. var o;
  56995. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56996. return $core.withContext(function($ctx1) {
  56997. var $1,$2,$4,$3;
  56998. o=$recv($Object())._new();
  56999. $ctx1.sendIdx["new"]=1;
  57000. $1=$recv(o).__eq_eq($recv($Object())._new());
  57001. $ctx1.sendIdx["=="]=1;
  57002. self._deny_($1);
  57003. $2=$recv(o).__eq_eq(o);
  57004. $ctx1.sendIdx["=="]=2;
  57005. self._assert_($2);
  57006. $ctx1.sendIdx["assert:"]=1;
  57007. $4=$recv(o)._yourself();
  57008. $ctx1.sendIdx["yourself"]=1;
  57009. $3=$recv($4).__eq_eq(o);
  57010. $ctx1.sendIdx["=="]=3;
  57011. self._assert_($3);
  57012. $ctx1.sendIdx["assert:"]=2;
  57013. self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  57014. return self;
  57015. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  57016. },
  57017. args: [],
  57018. 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",
  57019. referencedClasses: ["Object"],
  57020. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  57021. }),
  57022. $globals.ObjectTest);
  57023. $core.addMethod(
  57024. $core.method({
  57025. selector: "testIfNil",
  57026. protocol: 'tests',
  57027. fn: function (){
  57028. var self=this;
  57029. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  57030. return $core.withContext(function($ctx1) {
  57031. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  57032. $2=$recv($Object())._new();
  57033. $ctx1.sendIdx["new"]=1;
  57034. $1=$recv($2)._isNil();
  57035. self._deny_($1);
  57036. $ctx1.sendIdx["deny:"]=1;
  57037. $5=$recv($Object())._new();
  57038. $ctx1.sendIdx["new"]=2;
  57039. if(($receiver = $5) == null || $receiver.isNil){
  57040. $4=true;
  57041. } else {
  57042. $4=$5;
  57043. };
  57044. $3=$recv($4).__eq(true);
  57045. self._deny_($3);
  57046. $7=$recv($Object())._new();
  57047. $ctx1.sendIdx["new"]=3;
  57048. if(($receiver = $7) == null || $receiver.isNil){
  57049. $6=$7;
  57050. } else {
  57051. $6=true;
  57052. };
  57053. self._assert_equals_($6,true);
  57054. $ctx1.sendIdx["assert:equals:"]=1;
  57055. $9=$recv($Object())._new();
  57056. $ctx1.sendIdx["new"]=4;
  57057. if(($receiver = $9) == null || $receiver.isNil){
  57058. $8=false;
  57059. } else {
  57060. $8=true;
  57061. };
  57062. self._assert_equals_($8,true);
  57063. $ctx1.sendIdx["assert:equals:"]=2;
  57064. $11=$recv($Object())._new();
  57065. if(($receiver = $11) == null || $receiver.isNil){
  57066. $10=false;
  57067. } else {
  57068. $10=true;
  57069. };
  57070. self._assert_equals_($10,true);
  57071. return self;
  57072. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  57073. },
  57074. args: [],
  57075. 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",
  57076. referencedClasses: ["Object"],
  57077. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  57078. }),
  57079. $globals.ObjectTest);
  57080. $core.addMethod(
  57081. $core.method({
  57082. selector: "testInstVars",
  57083. protocol: 'tests',
  57084. fn: function (){
  57085. var self=this;
  57086. var o;
  57087. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  57088. return $core.withContext(function($ctx1) {
  57089. var $1,$2;
  57090. o=$recv($ObjectMock())._new();
  57091. $1=$recv(o)._instVarAt_("foo");
  57092. $ctx1.sendIdx["instVarAt:"]=1;
  57093. self._assert_equals_($1,nil);
  57094. $ctx1.sendIdx["assert:equals:"]=1;
  57095. $recv(o)._instVarAt_put_("foo",(1));
  57096. $2=$recv(o)._instVarAt_("foo");
  57097. $ctx1.sendIdx["instVarAt:"]=2;
  57098. self._assert_equals_($2,(1));
  57099. $ctx1.sendIdx["assert:equals:"]=2;
  57100. self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  57101. return self;
  57102. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  57103. },
  57104. args: [],
  57105. 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",
  57106. referencedClasses: ["ObjectMock"],
  57107. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  57108. }),
  57109. $globals.ObjectTest);
  57110. $core.addMethod(
  57111. $core.method({
  57112. selector: "testNilUndefined",
  57113. protocol: 'tests',
  57114. fn: function (){
  57115. var self=this;
  57116. return $core.withContext(function($ctx1) {
  57117. self._assert_equals_(self._notDefined(),nil);
  57118. return self;
  57119. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  57120. },
  57121. args: [],
  57122. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  57123. referencedClasses: [],
  57124. messageSends: ["assert:equals:", "notDefined"]
  57125. }),
  57126. $globals.ObjectTest);
  57127. $core.addMethod(
  57128. $core.method({
  57129. selector: "testYourself",
  57130. protocol: 'tests',
  57131. fn: function (){
  57132. var self=this;
  57133. var o;
  57134. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  57135. return $core.withContext(function($ctx1) {
  57136. o=$recv($ObjectMock())._new();
  57137. self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  57138. return self;
  57139. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  57140. },
  57141. args: [],
  57142. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  57143. referencedClasses: ["ObjectMock"],
  57144. messageSends: ["new", "assert:", "==", "yourself"]
  57145. }),
  57146. $globals.ObjectTest);
  57147. $core.addMethod(
  57148. $core.method({
  57149. selector: "testidentityHash",
  57150. protocol: 'tests',
  57151. fn: function (){
  57152. var self=this;
  57153. var o1,o2;
  57154. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  57155. return $core.withContext(function($ctx1) {
  57156. var $2,$3,$1,$5,$4;
  57157. o1=$recv($Object())._new();
  57158. $ctx1.sendIdx["new"]=1;
  57159. o2=$recv($Object())._new();
  57160. $2=$recv(o1)._identityHash();
  57161. $ctx1.sendIdx["identityHash"]=1;
  57162. $3=$recv(o1)._identityHash();
  57163. $ctx1.sendIdx["identityHash"]=2;
  57164. $1=$recv($2).__eq_eq($3);
  57165. $ctx1.sendIdx["=="]=1;
  57166. self._assert_($1);
  57167. $5=$recv(o1)._identityHash();
  57168. $ctx1.sendIdx["identityHash"]=3;
  57169. $4=$recv($5).__eq_eq($recv(o2)._identityHash());
  57170. self._deny_($4);
  57171. return self;
  57172. }, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},$globals.ObjectTest)});
  57173. },
  57174. args: [],
  57175. 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",
  57176. referencedClasses: ["Object"],
  57177. messageSends: ["new", "assert:", "==", "identityHash", "deny:"]
  57178. }),
  57179. $globals.ObjectTest);
  57180. $core.addClass('PointTest', $globals.TestCase, [], 'Kernel-Tests');
  57181. $core.addMethod(
  57182. $core.method({
  57183. selector: "testAccessing",
  57184. protocol: 'tests',
  57185. fn: function (){
  57186. var self=this;
  57187. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  57188. return $core.withContext(function($ctx1) {
  57189. var $2,$1,$3,$6,$5,$4;
  57190. $2=$recv($Point())._x_y_((3),(4));
  57191. $ctx1.sendIdx["x:y:"]=1;
  57192. $1=$recv($2)._x();
  57193. $ctx1.sendIdx["x"]=1;
  57194. self._assert_equals_($1,(3));
  57195. $ctx1.sendIdx["assert:equals:"]=1;
  57196. $3=$recv($recv($Point())._x_y_((3),(4)))._y();
  57197. $ctx1.sendIdx["y"]=1;
  57198. self._assert_equals_($3,(4));
  57199. $ctx1.sendIdx["assert:equals:"]=2;
  57200. $6=$recv($Point())._new();
  57201. $ctx1.sendIdx["new"]=1;
  57202. $5=$recv($6)._x_((3));
  57203. $4=$recv($5)._x();
  57204. self._assert_equals_($4,(3));
  57205. $ctx1.sendIdx["assert:equals:"]=3;
  57206. self._assert_equals_($recv($recv($recv($Point())._new())._y_((4)))._y(),(4));
  57207. return self;
  57208. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  57209. },
  57210. args: [],
  57211. 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",
  57212. referencedClasses: ["Point"],
  57213. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  57214. }),
  57215. $globals.PointTest);
  57216. $core.addMethod(
  57217. $core.method({
  57218. selector: "testArithmetic",
  57219. protocol: 'tests',
  57220. fn: function (){
  57221. var self=this;
  57222. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  57223. return $core.withContext(function($ctx1) {
  57224. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  57225. $2=(3).__at((4));
  57226. $ctx1.sendIdx["@"]=1;
  57227. $3=(3).__at((4));
  57228. $ctx1.sendIdx["@"]=2;
  57229. $1=$recv($2).__star($3);
  57230. $4=$recv($Point())._x_y_((9),(16));
  57231. $ctx1.sendIdx["x:y:"]=1;
  57232. self._assert_equals_($1,$4);
  57233. $ctx1.sendIdx["assert:equals:"]=1;
  57234. $6=(3).__at((4));
  57235. $ctx1.sendIdx["@"]=3;
  57236. $7=(3).__at((4));
  57237. $ctx1.sendIdx["@"]=4;
  57238. $5=$recv($6).__plus($7);
  57239. $8=$recv($Point())._x_y_((6),(8));
  57240. $ctx1.sendIdx["x:y:"]=2;
  57241. self._assert_equals_($5,$8);
  57242. $ctx1.sendIdx["assert:equals:"]=2;
  57243. $10=(3).__at((4));
  57244. $ctx1.sendIdx["@"]=5;
  57245. $11=(3).__at((4));
  57246. $ctx1.sendIdx["@"]=6;
  57247. $9=$recv($10).__minus($11);
  57248. $12=$recv($Point())._x_y_((0),(0));
  57249. $ctx1.sendIdx["x:y:"]=3;
  57250. self._assert_equals_($9,$12);
  57251. $ctx1.sendIdx["assert:equals:"]=3;
  57252. $14=(6).__at((8));
  57253. $ctx1.sendIdx["@"]=7;
  57254. $13=$recv($14).__slash((3).__at((4)));
  57255. self._assert_equals_($13,$recv($Point())._x_y_((2),(2)));
  57256. return self;
  57257. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  57258. },
  57259. args: [],
  57260. 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)",
  57261. referencedClasses: ["Point"],
  57262. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  57263. }),
  57264. $globals.PointTest);
  57265. $core.addMethod(
  57266. $core.method({
  57267. selector: "testAt",
  57268. protocol: 'tests',
  57269. fn: function (){
  57270. var self=this;
  57271. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  57272. return $core.withContext(function($ctx1) {
  57273. self._assert_equals_((3).__at((4)),$recv($Point())._x_y_((3),(4)));
  57274. return self;
  57275. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  57276. },
  57277. args: [],
  57278. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  57279. referencedClasses: ["Point"],
  57280. messageSends: ["assert:equals:", "@", "x:y:"]
  57281. }),
  57282. $globals.PointTest);
  57283. $core.addMethod(
  57284. $core.method({
  57285. selector: "testComparison",
  57286. protocol: 'tests',
  57287. fn: function (){
  57288. var self=this;
  57289. return $core.withContext(function($ctx1) {
  57290. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  57291. $2=(3).__at((4));
  57292. $ctx1.sendIdx["@"]=1;
  57293. $3=(4).__at((5));
  57294. $ctx1.sendIdx["@"]=2;
  57295. $1=$recv($2).__lt($3);
  57296. $ctx1.sendIdx["<"]=1;
  57297. self._assert_($1);
  57298. $ctx1.sendIdx["assert:"]=1;
  57299. $5=(3).__at((4));
  57300. $ctx1.sendIdx["@"]=3;
  57301. $6=(4).__at((4));
  57302. $ctx1.sendIdx["@"]=4;
  57303. $4=$recv($5).__lt($6);
  57304. self._deny_($4);
  57305. $ctx1.sendIdx["deny:"]=1;
  57306. $8=(4).__at((5));
  57307. $ctx1.sendIdx["@"]=5;
  57308. $9=(4).__at((5));
  57309. $ctx1.sendIdx["@"]=6;
  57310. $7=$recv($8).__lt_eq($9);
  57311. $ctx1.sendIdx["<="]=1;
  57312. self._assert_($7);
  57313. $ctx1.sendIdx["assert:"]=2;
  57314. $11=(4).__at((5));
  57315. $ctx1.sendIdx["@"]=7;
  57316. $12=(3).__at((5));
  57317. $ctx1.sendIdx["@"]=8;
  57318. $10=$recv($11).__lt_eq($12);
  57319. self._deny_($10);
  57320. $ctx1.sendIdx["deny:"]=2;
  57321. $14=(5).__at((6));
  57322. $ctx1.sendIdx["@"]=9;
  57323. $15=(4).__at((5));
  57324. $ctx1.sendIdx["@"]=10;
  57325. $13=$recv($14).__gt($15);
  57326. $ctx1.sendIdx[">"]=1;
  57327. self._assert_($13);
  57328. $ctx1.sendIdx["assert:"]=3;
  57329. $17=(5).__at((6));
  57330. $ctx1.sendIdx["@"]=11;
  57331. $18=(6).__at((6));
  57332. $ctx1.sendIdx["@"]=12;
  57333. $16=$recv($17).__gt($18);
  57334. self._deny_($16);
  57335. $ctx1.sendIdx["deny:"]=3;
  57336. $20=(4).__at((5));
  57337. $ctx1.sendIdx["@"]=13;
  57338. $21=(4).__at((5));
  57339. $ctx1.sendIdx["@"]=14;
  57340. $19=$recv($20).__gt_eq($21);
  57341. $ctx1.sendIdx[">="]=1;
  57342. self._assert_($19);
  57343. $23=(4).__at((5));
  57344. $ctx1.sendIdx["@"]=15;
  57345. $22=$recv($23).__gt_eq((5).__at((5)));
  57346. self._deny_($22);
  57347. return self;
  57348. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  57349. },
  57350. args: [],
  57351. 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)",
  57352. referencedClasses: [],
  57353. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  57354. }),
  57355. $globals.PointTest);
  57356. $core.addMethod(
  57357. $core.method({
  57358. selector: "testEgality",
  57359. protocol: 'tests',
  57360. fn: function (){
  57361. var self=this;
  57362. return $core.withContext(function($ctx1) {
  57363. var $2,$3,$1,$5,$4;
  57364. $2=(3).__at((4));
  57365. $ctx1.sendIdx["@"]=1;
  57366. $3=(3).__at((4));
  57367. $ctx1.sendIdx["@"]=2;
  57368. $1=$recv($2).__eq($3);
  57369. $ctx1.sendIdx["="]=1;
  57370. self._assert_($1);
  57371. $5=(3).__at((5));
  57372. $ctx1.sendIdx["@"]=3;
  57373. $4=$recv($5).__eq((3).__at((6)));
  57374. self._deny_($4);
  57375. return self;
  57376. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  57377. },
  57378. args: [],
  57379. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  57380. referencedClasses: [],
  57381. messageSends: ["assert:", "=", "@", "deny:"]
  57382. }),
  57383. $globals.PointTest);
  57384. $core.addMethod(
  57385. $core.method({
  57386. selector: "testNew",
  57387. protocol: 'tests',
  57388. fn: function (){
  57389. var self=this;
  57390. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  57391. return $core.withContext(function($ctx1) {
  57392. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  57393. $3=$recv($Point())._new();
  57394. $ctx1.sendIdx["new"]=1;
  57395. $2=$recv($3)._x_((3));
  57396. $ctx1.sendIdx["x:"]=1;
  57397. $1=$recv($2)._y();
  57398. $ctx1.sendIdx["y"]=1;
  57399. self._assert_equals_($1,nil);
  57400. $ctx1.sendIdx["assert:equals:"]=1;
  57401. $7=$recv($Point())._new();
  57402. $ctx1.sendIdx["new"]=2;
  57403. $6=$recv($7)._x_((3));
  57404. $5=$recv($6)._x();
  57405. $ctx1.sendIdx["x"]=1;
  57406. $4=$recv($5).__eq((0));
  57407. $ctx1.sendIdx["="]=1;
  57408. self._deny_($4);
  57409. $ctx1.sendIdx["deny:"]=1;
  57410. $10=$recv($Point())._new();
  57411. $ctx1.sendIdx["new"]=3;
  57412. $9=$recv($10)._y_((4));
  57413. $ctx1.sendIdx["y:"]=1;
  57414. $8=$recv($9)._x();
  57415. self._assert_equals_($8,nil);
  57416. self._deny_($recv($recv($recv($recv($Point())._new())._y_((4)))._y()).__eq((0)));
  57417. return self;
  57418. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  57419. },
  57420. args: [],
  57421. 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",
  57422. referencedClasses: ["Point"],
  57423. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  57424. }),
  57425. $globals.PointTest);
  57426. $core.addMethod(
  57427. $core.method({
  57428. selector: "testTranslateBy",
  57429. protocol: 'tests',
  57430. fn: function (){
  57431. var self=this;
  57432. return $core.withContext(function($ctx1) {
  57433. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  57434. $2=(3).__at((3));
  57435. $ctx1.sendIdx["@"]=1;
  57436. $3=(0).__at((1));
  57437. $ctx1.sendIdx["@"]=2;
  57438. $1=$recv($2)._translateBy_($3);
  57439. $ctx1.sendIdx["translateBy:"]=1;
  57440. $4=(3).__at((4));
  57441. $ctx1.sendIdx["@"]=3;
  57442. self._assert_equals_($1,$4);
  57443. $ctx1.sendIdx["assert:equals:"]=1;
  57444. $6=(3).__at((3));
  57445. $ctx1.sendIdx["@"]=4;
  57446. $8=(1)._negated();
  57447. $ctx1.sendIdx["negated"]=1;
  57448. $7=(0).__at($8);
  57449. $ctx1.sendIdx["@"]=5;
  57450. $5=$recv($6)._translateBy_($7);
  57451. $ctx1.sendIdx["translateBy:"]=2;
  57452. $9=(3).__at((2));
  57453. $ctx1.sendIdx["@"]=6;
  57454. self._assert_equals_($5,$9);
  57455. $ctx1.sendIdx["assert:equals:"]=2;
  57456. $11=(3).__at((3));
  57457. $ctx1.sendIdx["@"]=7;
  57458. $12=(2).__at((3));
  57459. $ctx1.sendIdx["@"]=8;
  57460. $10=$recv($11)._translateBy_($12);
  57461. $ctx1.sendIdx["translateBy:"]=3;
  57462. $13=(5).__at((6));
  57463. $ctx1.sendIdx["@"]=9;
  57464. self._assert_equals_($10,$13);
  57465. $ctx1.sendIdx["assert:equals:"]=3;
  57466. $15=(3).__at((3));
  57467. $ctx1.sendIdx["@"]=10;
  57468. $16=$recv((3)._negated()).__at((0));
  57469. $ctx1.sendIdx["@"]=11;
  57470. $14=$recv($15)._translateBy_($16);
  57471. self._assert_equals_($14,(0).__at((3)));
  57472. return self;
  57473. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  57474. },
  57475. args: [],
  57476. 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.",
  57477. referencedClasses: [],
  57478. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  57479. }),
  57480. $globals.PointTest);
  57481. $core.addClass('QueueTest', $globals.TestCase, [], 'Kernel-Tests');
  57482. $core.addMethod(
  57483. $core.method({
  57484. selector: "testNextIfAbsent",
  57485. protocol: 'tests',
  57486. fn: function (){
  57487. var self=this;
  57488. var queue;
  57489. function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  57490. return $core.withContext(function($ctx1) {
  57491. var $2,$1;
  57492. queue=$recv($Queue())._new();
  57493. $recv(queue)._nextPut_("index1");
  57494. $2=$recv(queue)._nextIfAbsent_("empty");
  57495. $ctx1.sendIdx["nextIfAbsent:"]=1;
  57496. $1=$recv($2).__eq("index1");
  57497. $ctx1.sendIdx["="]=1;
  57498. self._assert_($1);
  57499. self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  57500. return self;
  57501. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  57502. },
  57503. args: [],
  57504. 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'",
  57505. referencedClasses: ["Queue"],
  57506. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  57507. }),
  57508. $globals.QueueTest);
  57509. $core.addMethod(
  57510. $core.method({
  57511. selector: "testQueueNext",
  57512. protocol: 'tests',
  57513. fn: function (){
  57514. var self=this;
  57515. var queue;
  57516. function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  57517. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  57518. return $core.withContext(function($ctx1) {
  57519. var $1,$2,$4,$3,$6,$5;
  57520. queue=$recv($Queue())._new();
  57521. $1=queue;
  57522. $recv($1)._nextPut_("index1");
  57523. $ctx1.sendIdx["nextPut:"]=1;
  57524. $2=$recv($1)._nextPut_("index2");
  57525. $4=$recv(queue)._next();
  57526. $ctx1.sendIdx["next"]=1;
  57527. $3=$recv($4).__eq("index1");
  57528. $ctx1.sendIdx["="]=1;
  57529. self._assert_($3);
  57530. $6=$recv(queue)._next();
  57531. $ctx1.sendIdx["next"]=2;
  57532. $5=$recv($6).__eq("index");
  57533. self._deny_($5);
  57534. self._should_raise_((function(){
  57535. return $core.withContext(function($ctx2) {
  57536. return $recv(queue)._next();
  57537. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57538. }),$Error());
  57539. return self;
  57540. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  57541. },
  57542. args: [],
  57543. 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",
  57544. referencedClasses: ["Queue", "Error"],
  57545. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  57546. }),
  57547. $globals.QueueTest);
  57548. $core.addClass('RandomTest', $globals.TestCase, [], 'Kernel-Tests');
  57549. $core.addMethod(
  57550. $core.method({
  57551. selector: "testAtRandomNumber",
  57552. protocol: 'tests',
  57553. fn: function (){
  57554. var self=this;
  57555. var val;
  57556. return $core.withContext(function($ctx1) {
  57557. (100)._timesRepeat_((function(){
  57558. return $core.withContext(function($ctx2) {
  57559. val=(10)._atRandom();
  57560. val;
  57561. self._assert_($recv(val).__gt((0)));
  57562. $ctx2.sendIdx["assert:"]=1;
  57563. return self._assert_($recv(val).__lt((11)));
  57564. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57565. }));
  57566. return self;
  57567. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  57568. },
  57569. args: [],
  57570. 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]",
  57571. referencedClasses: [],
  57572. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  57573. }),
  57574. $globals.RandomTest);
  57575. $core.addMethod(
  57576. $core.method({
  57577. selector: "testAtRandomSequenceableCollection",
  57578. protocol: 'tests',
  57579. fn: function (){
  57580. var self=this;
  57581. var val;
  57582. return $core.withContext(function($ctx1) {
  57583. var $3,$4,$2,$1;
  57584. (100)._timesRepeat_((function(){
  57585. return $core.withContext(function($ctx2) {
  57586. val="abc"._atRandom();
  57587. val;
  57588. $3=$recv(val).__eq("a");
  57589. $ctx2.sendIdx["="]=1;
  57590. $4=$recv(val).__eq("b");
  57591. $ctx2.sendIdx["="]=2;
  57592. $2=$recv($3).__or($4);
  57593. $1=$recv($2).__or($recv(val).__eq("c"));
  57594. $ctx2.sendIdx["|"]=1;
  57595. return self._assert_($1);
  57596. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57597. }));
  57598. return self;
  57599. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  57600. },
  57601. args: [],
  57602. 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].",
  57603. referencedClasses: [],
  57604. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  57605. }),
  57606. $globals.RandomTest);
  57607. $core.addMethod(
  57608. $core.method({
  57609. selector: "textNext",
  57610. protocol: 'tests',
  57611. fn: function (){
  57612. var self=this;
  57613. function $Random(){return $globals.Random||(typeof Random=="undefined"?nil:Random)}
  57614. return $core.withContext(function($ctx1) {
  57615. var $1;
  57616. (10000)._timesRepeat_((function(){
  57617. var current,next;
  57618. return $core.withContext(function($ctx2) {
  57619. next=$recv($recv($Random())._new())._next();
  57620. next;
  57621. self._assert_($recv(next).__gt_eq((0)));
  57622. $ctx2.sendIdx["assert:"]=1;
  57623. self._assert_($recv(next).__lt((1)));
  57624. $1=$recv(current).__eq(next);
  57625. $ctx2.sendIdx["="]=1;
  57626. self._deny_($1);
  57627. return $recv(next).__eq(current);
  57628. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  57629. }));
  57630. return self;
  57631. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  57632. },
  57633. args: [],
  57634. 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 ]",
  57635. referencedClasses: ["Random"],
  57636. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  57637. }),
  57638. $globals.RandomTest);
  57639. $core.addClass('StreamTest', $globals.TestCase, [], 'Kernel-Tests');
  57640. $core.addMethod(
  57641. $core.method({
  57642. selector: "collectionClass",
  57643. protocol: 'accessing',
  57644. fn: function (){
  57645. var self=this;
  57646. return $core.withContext(function($ctx1) {
  57647. var $1;
  57648. $1=$recv(self._class())._collectionClass();
  57649. return $1;
  57650. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  57651. },
  57652. args: [],
  57653. source: "collectionClass\x0a\x09^ self class collectionClass",
  57654. referencedClasses: [],
  57655. messageSends: ["collectionClass", "class"]
  57656. }),
  57657. $globals.StreamTest);
  57658. $core.addMethod(
  57659. $core.method({
  57660. selector: "newCollection",
  57661. protocol: 'accessing',
  57662. fn: function (){
  57663. var self=this;
  57664. return $core.withContext(function($ctx1) {
  57665. var $1;
  57666. $1=$recv(self._collectionClass())._new();
  57667. return $1;
  57668. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  57669. },
  57670. args: [],
  57671. source: "newCollection\x0a\x09^ self collectionClass new",
  57672. referencedClasses: [],
  57673. messageSends: ["new", "collectionClass"]
  57674. }),
  57675. $globals.StreamTest);
  57676. $core.addMethod(
  57677. $core.method({
  57678. selector: "newStream",
  57679. protocol: 'accessing',
  57680. fn: function (){
  57681. var self=this;
  57682. return $core.withContext(function($ctx1) {
  57683. var $1;
  57684. $1=$recv($recv(self._collectionClass())._new())._stream();
  57685. return $1;
  57686. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  57687. },
  57688. args: [],
  57689. source: "newStream\x0a\x09^ self collectionClass new stream",
  57690. referencedClasses: [],
  57691. messageSends: ["stream", "new", "collectionClass"]
  57692. }),
  57693. $globals.StreamTest);
  57694. $core.addMethod(
  57695. $core.method({
  57696. selector: "testAtStartAtEnd",
  57697. protocol: 'tests',
  57698. fn: function (){
  57699. var self=this;
  57700. var stream;
  57701. return $core.withContext(function($ctx1) {
  57702. var $1,$2,$3,$4;
  57703. stream=self._newStream();
  57704. $1=$recv(stream)._atStart();
  57705. $ctx1.sendIdx["atStart"]=1;
  57706. self._assert_($1);
  57707. $ctx1.sendIdx["assert:"]=1;
  57708. $2=$recv(stream)._atEnd();
  57709. $ctx1.sendIdx["atEnd"]=1;
  57710. self._assert_($2);
  57711. $ctx1.sendIdx["assert:"]=2;
  57712. $recv(stream)._nextPutAll_(self._newCollection());
  57713. $3=$recv(stream)._atEnd();
  57714. $ctx1.sendIdx["atEnd"]=2;
  57715. self._assert_($3);
  57716. $4=$recv(stream)._atStart();
  57717. $ctx1.sendIdx["atStart"]=2;
  57718. self._deny_($4);
  57719. $ctx1.sendIdx["deny:"]=1;
  57720. $recv(stream)._position_((1));
  57721. self._deny_($recv(stream)._atEnd());
  57722. $ctx1.sendIdx["deny:"]=2;
  57723. self._deny_($recv(stream)._atStart());
  57724. return self;
  57725. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  57726. },
  57727. args: [],
  57728. 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",
  57729. referencedClasses: [],
  57730. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  57731. }),
  57732. $globals.StreamTest);
  57733. $core.addMethod(
  57734. $core.method({
  57735. selector: "testContents",
  57736. protocol: 'tests',
  57737. fn: function (){
  57738. var self=this;
  57739. var stream;
  57740. return $core.withContext(function($ctx1) {
  57741. var $1,$2;
  57742. stream=self._newStream();
  57743. $1=stream;
  57744. $2=self._newCollection();
  57745. $ctx1.sendIdx["newCollection"]=1;
  57746. $recv($1)._nextPutAll_($2);
  57747. self._assert_equals_($recv(stream)._contents(),self._newCollection());
  57748. return self;
  57749. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  57750. },
  57751. args: [],
  57752. 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",
  57753. referencedClasses: [],
  57754. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  57755. }),
  57756. $globals.StreamTest);
  57757. $core.addMethod(
  57758. $core.method({
  57759. selector: "testIsEmpty",
  57760. protocol: 'tests',
  57761. fn: function (){
  57762. var self=this;
  57763. var stream;
  57764. return $core.withContext(function($ctx1) {
  57765. var $1;
  57766. stream=self._newStream();
  57767. $1=$recv(stream)._isEmpty();
  57768. $ctx1.sendIdx["isEmpty"]=1;
  57769. self._assert_($1);
  57770. $recv(stream)._nextPutAll_(self._newCollection());
  57771. self._deny_($recv(stream)._isEmpty());
  57772. return self;
  57773. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  57774. },
  57775. args: [],
  57776. 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",
  57777. referencedClasses: [],
  57778. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  57779. }),
  57780. $globals.StreamTest);
  57781. $core.addMethod(
  57782. $core.method({
  57783. selector: "testPosition",
  57784. protocol: 'tests',
  57785. fn: function (){
  57786. var self=this;
  57787. var collection,stream;
  57788. return $core.withContext(function($ctx1) {
  57789. var $1,$2,$3;
  57790. collection=self._newCollection();
  57791. stream=self._newStream();
  57792. $recv(stream)._nextPutAll_(collection);
  57793. $1=$recv(stream)._position();
  57794. $ctx1.sendIdx["position"]=1;
  57795. self._assert_equals_($1,$recv(collection)._size());
  57796. $ctx1.sendIdx["assert:equals:"]=1;
  57797. $recv(stream)._position_((0));
  57798. $2=$recv(stream)._position();
  57799. $ctx1.sendIdx["position"]=2;
  57800. self._assert_equals_($2,(0));
  57801. $ctx1.sendIdx["assert:equals:"]=2;
  57802. $recv(stream)._next();
  57803. $ctx1.sendIdx["next"]=1;
  57804. $3=$recv(stream)._position();
  57805. $ctx1.sendIdx["position"]=3;
  57806. self._assert_equals_($3,(1));
  57807. $ctx1.sendIdx["assert:equals:"]=3;
  57808. $recv(stream)._next();
  57809. self._assert_equals_($recv(stream)._position(),(2));
  57810. return self;
  57811. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  57812. },
  57813. args: [],
  57814. 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",
  57815. referencedClasses: [],
  57816. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  57817. }),
  57818. $globals.StreamTest);
  57819. $core.addMethod(
  57820. $core.method({
  57821. selector: "testReading",
  57822. protocol: 'tests',
  57823. fn: function (){
  57824. var self=this;
  57825. var stream,collection;
  57826. return $core.withContext(function($ctx1) {
  57827. var $1,$2,$3;
  57828. collection=self._newCollection();
  57829. stream=self._newStream();
  57830. $1=stream;
  57831. $recv($1)._nextPutAll_(collection);
  57832. $2=$recv($1)._position_((0));
  57833. $recv(collection)._do_((function(each){
  57834. return $core.withContext(function($ctx2) {
  57835. $3=$recv(stream)._next();
  57836. $ctx2.sendIdx["next"]=1;
  57837. return self._assert_equals_($3,each);
  57838. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57839. }));
  57840. self._assert_($recv($recv(stream)._next())._isNil());
  57841. return self;
  57842. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  57843. },
  57844. args: [],
  57845. 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",
  57846. referencedClasses: [],
  57847. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  57848. }),
  57849. $globals.StreamTest);
  57850. $core.addMethod(
  57851. $core.method({
  57852. selector: "testStreamContents",
  57853. protocol: 'tests',
  57854. fn: function (){
  57855. var self=this;
  57856. return self;
  57857. },
  57858. args: [],
  57859. source: "testStreamContents",
  57860. referencedClasses: [],
  57861. messageSends: []
  57862. }),
  57863. $globals.StreamTest);
  57864. $core.addMethod(
  57865. $core.method({
  57866. selector: "testWrite",
  57867. protocol: 'tests',
  57868. fn: function (){
  57869. var self=this;
  57870. var stream,collection;
  57871. return $core.withContext(function($ctx1) {
  57872. collection=self._newCollection();
  57873. stream=self._newStream();
  57874. $recv(collection)._do_((function(each){
  57875. return $core.withContext(function($ctx2) {
  57876. return $recv(stream).__lt_lt(each);
  57877. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57878. }));
  57879. self._assert_equals_($recv(stream)._contents(),collection);
  57880. return self;
  57881. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  57882. },
  57883. args: [],
  57884. 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",
  57885. referencedClasses: [],
  57886. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  57887. }),
  57888. $globals.StreamTest);
  57889. $core.addMethod(
  57890. $core.method({
  57891. selector: "testWriting",
  57892. protocol: 'tests',
  57893. fn: function (){
  57894. var self=this;
  57895. var stream,collection;
  57896. return $core.withContext(function($ctx1) {
  57897. var $1;
  57898. collection=self._newCollection();
  57899. stream=self._newStream();
  57900. $ctx1.sendIdx["newStream"]=1;
  57901. $recv(collection)._do_((function(each){
  57902. return $core.withContext(function($ctx2) {
  57903. return $recv(stream)._nextPut_(each);
  57904. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57905. }));
  57906. $1=$recv(stream)._contents();
  57907. $ctx1.sendIdx["contents"]=1;
  57908. self._assert_equals_($1,collection);
  57909. $ctx1.sendIdx["assert:equals:"]=1;
  57910. stream=self._newStream();
  57911. $recv(stream)._nextPutAll_(collection);
  57912. self._assert_equals_($recv(stream)._contents(),collection);
  57913. return self;
  57914. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  57915. },
  57916. args: [],
  57917. 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",
  57918. referencedClasses: [],
  57919. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  57920. }),
  57921. $globals.StreamTest);
  57922. $core.addMethod(
  57923. $core.method({
  57924. selector: "collectionClass",
  57925. protocol: 'accessing',
  57926. fn: function (){
  57927. var self=this;
  57928. return nil;
  57929. },
  57930. args: [],
  57931. source: "collectionClass\x0a\x09^ nil",
  57932. referencedClasses: [],
  57933. messageSends: []
  57934. }),
  57935. $globals.StreamTest.klass);
  57936. $core.addMethod(
  57937. $core.method({
  57938. selector: "isAbstract",
  57939. protocol: 'testing',
  57940. fn: function (){
  57941. var self=this;
  57942. return $core.withContext(function($ctx1) {
  57943. var $1;
  57944. $1=$recv(self._collectionClass())._isNil();
  57945. return $1;
  57946. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.klass)});
  57947. },
  57948. args: [],
  57949. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  57950. referencedClasses: [],
  57951. messageSends: ["isNil", "collectionClass"]
  57952. }),
  57953. $globals.StreamTest.klass);
  57954. $core.addClass('ArrayStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
  57955. $core.addMethod(
  57956. $core.method({
  57957. selector: "newCollection",
  57958. protocol: 'accessing',
  57959. fn: function (){
  57960. var self=this;
  57961. return $core.withContext(function($ctx1) {
  57962. var $1;
  57963. $1=[true,(1),(3).__at((4)),"foo"];
  57964. return $1;
  57965. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  57966. },
  57967. args: [],
  57968. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  57969. referencedClasses: [],
  57970. messageSends: ["@"]
  57971. }),
  57972. $globals.ArrayStreamTest);
  57973. $core.addMethod(
  57974. $core.method({
  57975. selector: "collectionClass",
  57976. protocol: 'accessing',
  57977. fn: function (){
  57978. var self=this;
  57979. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  57980. return $Array();
  57981. },
  57982. args: [],
  57983. source: "collectionClass\x0a\x09^ Array",
  57984. referencedClasses: ["Array"],
  57985. messageSends: []
  57986. }),
  57987. $globals.ArrayStreamTest.klass);
  57988. $core.addClass('StringStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
  57989. $core.addMethod(
  57990. $core.method({
  57991. selector: "newCollection",
  57992. protocol: 'accessing',
  57993. fn: function (){
  57994. var self=this;
  57995. return "hello world";
  57996. },
  57997. args: [],
  57998. source: "newCollection\x0a\x09^ 'hello world'",
  57999. referencedClasses: [],
  58000. messageSends: []
  58001. }),
  58002. $globals.StringStreamTest);
  58003. $core.addMethod(
  58004. $core.method({
  58005. selector: "collectionClass",
  58006. protocol: 'accessing',
  58007. fn: function (){
  58008. var self=this;
  58009. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  58010. return $String();
  58011. },
  58012. args: [],
  58013. source: "collectionClass\x0a\x09^ String",
  58014. referencedClasses: ["String"],
  58015. messageSends: []
  58016. }),
  58017. $globals.StringStreamTest.klass);
  58018. $core.addClass('UndefinedTest', $globals.TestCase, [], 'Kernel-Tests');
  58019. $core.addMethod(
  58020. $core.method({
  58021. selector: "testCopying",
  58022. protocol: 'tests',
  58023. fn: function (){
  58024. var self=this;
  58025. return $core.withContext(function($ctx1) {
  58026. self._assert_equals_(nil._copy(),nil);
  58027. return self;
  58028. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  58029. },
  58030. args: [],
  58031. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  58032. referencedClasses: [],
  58033. messageSends: ["assert:equals:", "copy"]
  58034. }),
  58035. $globals.UndefinedTest);
  58036. $core.addMethod(
  58037. $core.method({
  58038. selector: "testDeepCopy",
  58039. protocol: 'tests',
  58040. fn: function (){
  58041. var self=this;
  58042. return $core.withContext(function($ctx1) {
  58043. self._assert_($recv(nil._deepCopy()).__eq(nil));
  58044. return self;
  58045. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  58046. },
  58047. args: [],
  58048. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  58049. referencedClasses: [],
  58050. messageSends: ["assert:", "=", "deepCopy"]
  58051. }),
  58052. $globals.UndefinedTest);
  58053. $core.addMethod(
  58054. $core.method({
  58055. selector: "testIfNil",
  58056. protocol: 'tests',
  58057. fn: function (){
  58058. var self=this;
  58059. return $core.withContext(function($ctx1) {
  58060. var $1,$3,$2,$4,$6,$5,$receiver;
  58061. if(($receiver = nil) == null || $receiver.isNil){
  58062. $1=true;
  58063. } else {
  58064. $1=nil;
  58065. };
  58066. self._assert_equals_($1,true);
  58067. $ctx1.sendIdx["assert:equals:"]=1;
  58068. if(($receiver = nil) == null || $receiver.isNil){
  58069. $3=nil;
  58070. } else {
  58071. $3=true;
  58072. };
  58073. $2=$recv($3).__eq(true);
  58074. $ctx1.sendIdx["="]=1;
  58075. self._deny_($2);
  58076. $ctx1.sendIdx["deny:"]=1;
  58077. if(($receiver = nil) == null || $receiver.isNil){
  58078. $4=true;
  58079. } else {
  58080. $4=false;
  58081. };
  58082. self._assert_equals_($4,true);
  58083. if(($receiver = nil) == null || $receiver.isNil){
  58084. $6=false;
  58085. } else {
  58086. $6=true;
  58087. };
  58088. $5=$recv($6).__eq(true);
  58089. self._deny_($5);
  58090. return self;
  58091. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  58092. },
  58093. args: [],
  58094. 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",
  58095. referencedClasses: [],
  58096. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  58097. }),
  58098. $globals.UndefinedTest);
  58099. $core.addMethod(
  58100. $core.method({
  58101. selector: "testIsNil",
  58102. protocol: 'tests',
  58103. fn: function (){
  58104. var self=this;
  58105. return $core.withContext(function($ctx1) {
  58106. self._assert_(nil._isNil());
  58107. self._deny_(nil._notNil());
  58108. return self;
  58109. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  58110. },
  58111. args: [],
  58112. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  58113. referencedClasses: [],
  58114. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  58115. }),
  58116. $globals.UndefinedTest);
  58117. });
  58118. define("amber_core/SUnit-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  58119. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  58120. $core.addPackage('SUnit-Tests');
  58121. $core.packages["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  58122. $core.packages["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  58123. $core.addClass('ExampleSetTest', $globals.TestCase, ['empty', 'full'], 'SUnit-Tests');
  58124. $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.";
  58125. $core.addMethod(
  58126. $core.method({
  58127. selector: "setUp",
  58128. protocol: 'running',
  58129. fn: function (){
  58130. var self=this;
  58131. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  58132. return $core.withContext(function($ctx1) {
  58133. self["@empty"]=$recv($Set())._new();
  58134. self["@full"]=$recv($Set())._with_with_((5),"abc");
  58135. return self;
  58136. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  58137. },
  58138. args: [],
  58139. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  58140. referencedClasses: ["Set"],
  58141. messageSends: ["new", "with:with:"]
  58142. }),
  58143. $globals.ExampleSetTest);
  58144. $core.addMethod(
  58145. $core.method({
  58146. selector: "testAdd",
  58147. protocol: 'tests',
  58148. fn: function (){
  58149. var self=this;
  58150. return $core.withContext(function($ctx1) {
  58151. $recv(self["@empty"])._add_((5));
  58152. self._assert_($recv(self["@empty"])._includes_((5)));
  58153. return self;
  58154. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  58155. },
  58156. args: [],
  58157. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  58158. referencedClasses: [],
  58159. messageSends: ["add:", "assert:", "includes:"]
  58160. }),
  58161. $globals.ExampleSetTest);
  58162. $core.addMethod(
  58163. $core.method({
  58164. selector: "testGrow",
  58165. protocol: 'tests',
  58166. fn: function (){
  58167. var self=this;
  58168. return $core.withContext(function($ctx1) {
  58169. $recv(self["@empty"])._addAll_((1)._to_((100)));
  58170. self._assert_equals_($recv(self["@empty"])._size(),(100));
  58171. return self;
  58172. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  58173. },
  58174. args: [],
  58175. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  58176. referencedClasses: [],
  58177. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  58178. }),
  58179. $globals.ExampleSetTest);
  58180. $core.addMethod(
  58181. $core.method({
  58182. selector: "testIllegal",
  58183. protocol: 'tests',
  58184. fn: function (){
  58185. var self=this;
  58186. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  58187. return $core.withContext(function($ctx1) {
  58188. self._should_raise_((function(){
  58189. return $core.withContext(function($ctx2) {
  58190. return $recv(self["@empty"])._at_((5));
  58191. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58192. }),$Error());
  58193. $ctx1.sendIdx["should:raise:"]=1;
  58194. self._should_raise_((function(){
  58195. return $core.withContext(function($ctx2) {
  58196. return $recv(self["@empty"])._at_put_((5),"abc");
  58197. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58198. }),$Error());
  58199. return self;
  58200. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  58201. },
  58202. args: [],
  58203. 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",
  58204. referencedClasses: ["Error"],
  58205. messageSends: ["should:raise:", "at:", "at:put:"]
  58206. }),
  58207. $globals.ExampleSetTest);
  58208. $core.addMethod(
  58209. $core.method({
  58210. selector: "testIncludes",
  58211. protocol: 'tests',
  58212. fn: function (){
  58213. var self=this;
  58214. return $core.withContext(function($ctx1) {
  58215. var $1;
  58216. $1=$recv(self["@full"])._includes_((5));
  58217. $ctx1.sendIdx["includes:"]=1;
  58218. self._assert_($1);
  58219. $ctx1.sendIdx["assert:"]=1;
  58220. self._assert_($recv(self["@full"])._includes_("abc"));
  58221. return self;
  58222. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  58223. },
  58224. args: [],
  58225. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  58226. referencedClasses: [],
  58227. messageSends: ["assert:", "includes:"]
  58228. }),
  58229. $globals.ExampleSetTest);
  58230. $core.addMethod(
  58231. $core.method({
  58232. selector: "testOccurrences",
  58233. protocol: 'tests',
  58234. fn: function (){
  58235. var self=this;
  58236. return $core.withContext(function($ctx1) {
  58237. var $1,$2;
  58238. $1=$recv(self["@empty"])._occurrencesOf_((0));
  58239. $ctx1.sendIdx["occurrencesOf:"]=1;
  58240. self._assert_equals_($1,(0));
  58241. $ctx1.sendIdx["assert:equals:"]=1;
  58242. $2=$recv(self["@full"])._occurrencesOf_((5));
  58243. $ctx1.sendIdx["occurrencesOf:"]=2;
  58244. self._assert_equals_($2,(1));
  58245. $ctx1.sendIdx["assert:equals:"]=2;
  58246. $recv(self["@full"])._add_((5));
  58247. self._assert_equals_($recv(self["@full"])._occurrencesOf_((5)),(1));
  58248. return self;
  58249. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  58250. },
  58251. args: [],
  58252. 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",
  58253. referencedClasses: [],
  58254. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  58255. }),
  58256. $globals.ExampleSetTest);
  58257. $core.addMethod(
  58258. $core.method({
  58259. selector: "testRemove",
  58260. protocol: 'tests',
  58261. fn: function (){
  58262. var self=this;
  58263. return $core.withContext(function($ctx1) {
  58264. var $1;
  58265. $recv(self["@full"])._remove_((5));
  58266. $1=$recv(self["@full"])._includes_("abc");
  58267. $ctx1.sendIdx["includes:"]=1;
  58268. self._assert_($1);
  58269. self._deny_($recv(self["@full"])._includes_((5)));
  58270. return self;
  58271. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  58272. },
  58273. args: [],
  58274. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  58275. referencedClasses: [],
  58276. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  58277. }),
  58278. $globals.ExampleSetTest);
  58279. $core.addClass('SUnitAsyncTest', $globals.TestCase, ['flag'], 'SUnit-Tests');
  58280. $core.addMethod(
  58281. $core.method({
  58282. selector: "fakeError",
  58283. protocol: 'helpers',
  58284. fn: function (){
  58285. var self=this;
  58286. return $core.withContext(function($ctx1) {
  58287. self["@flag"]="bad";
  58288. self._timeout_((30));
  58289. self["@flag"]=$recv(self._async_((function(){
  58290. return $core.withContext(function($ctx2) {
  58291. self["@flag"]="ok";
  58292. self["@flag"];
  58293. return self._error_("Intentional");
  58294. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58295. })))._valueWithTimeout_((20));
  58296. return self;
  58297. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  58298. },
  58299. args: [],
  58300. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  58301. referencedClasses: [],
  58302. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  58303. }),
  58304. $globals.SUnitAsyncTest);
  58305. $core.addMethod(
  58306. $core.method({
  58307. selector: "fakeErrorFailingInTearDown",
  58308. protocol: 'helpers',
  58309. fn: function (){
  58310. var self=this;
  58311. return $core.withContext(function($ctx1) {
  58312. self["@flag"]="bad";
  58313. self._timeout_((30));
  58314. self["@flag"]=$recv(self._async_((function(){
  58315. return $core.withContext(function($ctx2) {
  58316. return self._error_("Intentional");
  58317. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58318. })))._valueWithTimeout_((20));
  58319. return self;
  58320. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  58321. },
  58322. args: [],
  58323. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  58324. referencedClasses: [],
  58325. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  58326. }),
  58327. $globals.SUnitAsyncTest);
  58328. $core.addMethod(
  58329. $core.method({
  58330. selector: "fakeFailure",
  58331. protocol: 'helpers',
  58332. fn: function (){
  58333. var self=this;
  58334. return $core.withContext(function($ctx1) {
  58335. self["@flag"]="bad";
  58336. self._timeout_((30));
  58337. self["@flag"]=$recv(self._async_((function(){
  58338. return $core.withContext(function($ctx2) {
  58339. self["@flag"]="ok";
  58340. self["@flag"];
  58341. return self._assert_(false);
  58342. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58343. })))._valueWithTimeout_((20));
  58344. return self;
  58345. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  58346. },
  58347. args: [],
  58348. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  58349. referencedClasses: [],
  58350. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  58351. }),
  58352. $globals.SUnitAsyncTest);
  58353. $core.addMethod(
  58354. $core.method({
  58355. selector: "fakeMultipleTimeoutFailing",
  58356. protocol: 'helpers',
  58357. fn: function (){
  58358. var self=this;
  58359. return $core.withContext(function($ctx1) {
  58360. var $1;
  58361. self._timeout_((100));
  58362. $ctx1.sendIdx["timeout:"]=1;
  58363. $1=self._async_((function(){
  58364. return $core.withContext(function($ctx2) {
  58365. self._timeout_((20));
  58366. return $recv(self._async_((function(){
  58367. return $core.withContext(function($ctx3) {
  58368. return self._finished();
  58369. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  58370. })))._valueWithTimeout_((30));
  58371. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58372. }));
  58373. $ctx1.sendIdx["async:"]=1;
  58374. $recv($1)._valueWithTimeout_((20));
  58375. $ctx1.sendIdx["valueWithTimeout:"]=1;
  58376. return self;
  58377. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  58378. },
  58379. args: [],
  58380. 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",
  58381. referencedClasses: [],
  58382. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  58383. }),
  58384. $globals.SUnitAsyncTest);
  58385. $core.addMethod(
  58386. $core.method({
  58387. selector: "fakeMultipleTimeoutPassing",
  58388. protocol: 'helpers',
  58389. fn: function (){
  58390. var self=this;
  58391. return $core.withContext(function($ctx1) {
  58392. var $1;
  58393. self._timeout_((20));
  58394. $ctx1.sendIdx["timeout:"]=1;
  58395. $1=self._async_((function(){
  58396. return $core.withContext(function($ctx2) {
  58397. self._timeout_((40));
  58398. return $recv(self._async_((function(){
  58399. return $core.withContext(function($ctx3) {
  58400. return self._finished();
  58401. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  58402. })))._valueWithTimeout_((20));
  58403. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58404. }));
  58405. $ctx1.sendIdx["async:"]=1;
  58406. $recv($1)._valueWithTimeout_((10));
  58407. $ctx1.sendIdx["valueWithTimeout:"]=1;
  58408. return self;
  58409. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  58410. },
  58411. args: [],
  58412. 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",
  58413. referencedClasses: [],
  58414. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  58415. }),
  58416. $globals.SUnitAsyncTest);
  58417. $core.addMethod(
  58418. $core.method({
  58419. selector: "fakeTimeout",
  58420. protocol: 'helpers',
  58421. fn: function (){
  58422. var self=this;
  58423. return $core.withContext(function($ctx1) {
  58424. self._timeout_((10));
  58425. $recv(self._async_((function(){
  58426. return $core.withContext(function($ctx2) {
  58427. return self._finished();
  58428. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58429. })))._valueWithTimeout_((20));
  58430. return self;
  58431. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  58432. },
  58433. args: [],
  58434. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  58435. referencedClasses: [],
  58436. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  58437. }),
  58438. $globals.SUnitAsyncTest);
  58439. $core.addMethod(
  58440. $core.method({
  58441. selector: "selectorSetOf:",
  58442. protocol: 'private',
  58443. fn: function (aCollection){
  58444. var self=this;
  58445. return $core.withContext(function($ctx1) {
  58446. var $1;
  58447. $1=$recv($recv(aCollection)._collect_((function(each){
  58448. return $core.withContext(function($ctx2) {
  58449. return $recv(each)._selector();
  58450. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58451. })))._asSet();
  58452. return $1;
  58453. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  58454. },
  58455. args: ["aCollection"],
  58456. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  58457. referencedClasses: [],
  58458. messageSends: ["asSet", "collect:", "selector"]
  58459. }),
  58460. $globals.SUnitAsyncTest);
  58461. $core.addMethod(
  58462. $core.method({
  58463. selector: "setUp",
  58464. protocol: 'running',
  58465. fn: function (){
  58466. var self=this;
  58467. self["@flag"]="ok";
  58468. return self;
  58469. },
  58470. args: [],
  58471. source: "setUp\x0a\x09flag := 'ok'",
  58472. referencedClasses: [],
  58473. messageSends: []
  58474. }),
  58475. $globals.SUnitAsyncTest);
  58476. $core.addMethod(
  58477. $core.method({
  58478. selector: "tearDown",
  58479. protocol: 'running',
  58480. fn: function (){
  58481. var self=this;
  58482. return $core.withContext(function($ctx1) {
  58483. self._assert_equals_("ok",self["@flag"]);
  58484. return self;
  58485. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  58486. },
  58487. args: [],
  58488. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  58489. referencedClasses: [],
  58490. messageSends: ["assert:equals:"]
  58491. }),
  58492. $globals.SUnitAsyncTest);
  58493. $core.addMethod(
  58494. $core.method({
  58495. selector: "testAsyncErrorsAndFailures",
  58496. protocol: 'tests',
  58497. fn: function (){
  58498. var self=this;
  58499. var suite,runner,result,assertBlock;
  58500. function $TestSuiteRunner(){return $globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)}
  58501. function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  58502. return $core.withContext(function($ctx1) {
  58503. var $1,$2,$3,$4;
  58504. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  58505. return $core.withContext(function($ctx2) {
  58506. return $recv(self._class())._selector_(each);
  58507. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58508. }));
  58509. runner=$recv($TestSuiteRunner())._on_(suite);
  58510. self._timeout_((200));
  58511. result=$recv(runner)._result();
  58512. $ctx1.sendIdx["result"]=1;
  58513. assertBlock=self._async_((function(){
  58514. return $core.withContext(function($ctx2) {
  58515. $1=self._selectorSetOf_($recv(result)._errors());
  58516. $ctx2.sendIdx["selectorSetOf:"]=1;
  58517. $2=["fakeError"]._asSet();
  58518. $ctx2.sendIdx["asSet"]=1;
  58519. self._assert_equals_($1,$2);
  58520. $ctx2.sendIdx["assert:equals:"]=1;
  58521. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  58522. return self._finished();
  58523. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58524. }));
  58525. $recv($recv(runner)._announcer())._on_do_($ResultAnnouncement(),(function(ann){
  58526. return $core.withContext(function($ctx2) {
  58527. $3=$recv($recv(ann)._result()).__eq_eq(result);
  58528. if($core.assert($3)){
  58529. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  58530. return $recv($4)._ifTrue_(assertBlock);
  58531. };
  58532. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  58533. }));
  58534. $recv(runner)._run();
  58535. return self;
  58536. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  58537. },
  58538. args: [],
  58539. 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",
  58540. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  58541. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  58542. }),
  58543. $globals.SUnitAsyncTest);
  58544. $core.addMethod(
  58545. $core.method({
  58546. selector: "testAsyncNeedsTimeout",
  58547. protocol: 'tests',
  58548. fn: function (){
  58549. var self=this;
  58550. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  58551. return $core.withContext(function($ctx1) {
  58552. self._should_raise_((function(){
  58553. return $core.withContext(function($ctx2) {
  58554. return self._async_((function(){
  58555. }));
  58556. $ctx2.sendIdx["async:"]=1;
  58557. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58558. }),$Error());
  58559. self._timeout_((0));
  58560. self._shouldnt_raise_((function(){
  58561. return $core.withContext(function($ctx2) {
  58562. return self._async_((function(){
  58563. }));
  58564. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58565. }),$Error());
  58566. self._finished();
  58567. return self;
  58568. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  58569. },
  58570. args: [],
  58571. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  58572. referencedClasses: ["Error"],
  58573. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  58574. }),
  58575. $globals.SUnitAsyncTest);
  58576. $core.addMethod(
  58577. $core.method({
  58578. selector: "testFinishedNeedsTimeout",
  58579. protocol: 'tests',
  58580. fn: function (){
  58581. var self=this;
  58582. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  58583. return $core.withContext(function($ctx1) {
  58584. self._should_raise_((function(){
  58585. return $core.withContext(function($ctx2) {
  58586. return self._finished();
  58587. $ctx2.sendIdx["finished"]=1;
  58588. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58589. }),$Error());
  58590. self._timeout_((0));
  58591. self._shouldnt_raise_((function(){
  58592. return $core.withContext(function($ctx2) {
  58593. return self._finished();
  58594. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58595. }),$Error());
  58596. return self;
  58597. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  58598. },
  58599. args: [],
  58600. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  58601. referencedClasses: ["Error"],
  58602. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  58603. }),
  58604. $globals.SUnitAsyncTest);
  58605. $core.addMethod(
  58606. $core.method({
  58607. selector: "testIsAsyncReturnsCorrectValues",
  58608. protocol: 'tests',
  58609. fn: function (){
  58610. var self=this;
  58611. return $core.withContext(function($ctx1) {
  58612. var $1,$2;
  58613. $1=self._isAsync();
  58614. $ctx1.sendIdx["isAsync"]=1;
  58615. self._deny_($1);
  58616. $ctx1.sendIdx["deny:"]=1;
  58617. self._timeout_((0));
  58618. $2=self._isAsync();
  58619. $ctx1.sendIdx["isAsync"]=2;
  58620. self._assert_($2);
  58621. self._finished();
  58622. self._deny_(self._isAsync());
  58623. return self;
  58624. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  58625. },
  58626. args: [],
  58627. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  58628. referencedClasses: [],
  58629. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  58630. }),
  58631. $globals.SUnitAsyncTest);
  58632. $core.addMethod(
  58633. $core.method({
  58634. selector: "testPass",
  58635. protocol: 'tests',
  58636. fn: function (){
  58637. var self=this;
  58638. return $core.withContext(function($ctx1) {
  58639. self["@flag"]="bad";
  58640. self._timeout_((10));
  58641. self["@flag"]=$recv(self._async_((function(){
  58642. return $core.withContext(function($ctx2) {
  58643. self._assert_(true);
  58644. self._finished();
  58645. self["@flag"]="ok";
  58646. return self["@flag"];
  58647. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58648. })))._valueWithTimeout_((5));
  58649. return self;
  58650. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  58651. },
  58652. args: [],
  58653. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  58654. referencedClasses: [],
  58655. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  58656. }),
  58657. $globals.SUnitAsyncTest);
  58658. $core.addMethod(
  58659. $core.method({
  58660. selector: "testTimeouts",
  58661. protocol: 'tests',
  58662. fn: function (){
  58663. var self=this;
  58664. var suite,runner,result,assertBlock;
  58665. function $TestSuiteRunner(){return $globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)}
  58666. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  58667. function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  58668. return $core.withContext(function($ctx1) {
  58669. var $1,$2,$3;
  58670. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  58671. return $core.withContext(function($ctx2) {
  58672. return $recv(self._class())._selector_(each);
  58673. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58674. }));
  58675. runner=$recv($TestSuiteRunner())._on_(suite);
  58676. self._timeout_((200));
  58677. result=$recv(runner)._result();
  58678. $ctx1.sendIdx["result"]=1;
  58679. assertBlock=self._async_((function(){
  58680. return $core.withContext(function($ctx2) {
  58681. $1=self._selectorSetOf_($recv(result)._errors());
  58682. $ctx2.sendIdx["selectorSetOf:"]=1;
  58683. self._assert_equals_($1,$recv($Set())._new());
  58684. $ctx2.sendIdx["assert:equals:"]=1;
  58685. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  58686. return self._finished();
  58687. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58688. }));
  58689. $recv($recv(runner)._announcer())._on_do_($ResultAnnouncement(),(function(ann){
  58690. return $core.withContext(function($ctx2) {
  58691. $2=$recv($recv(ann)._result()).__eq_eq(result);
  58692. if($core.assert($2)){
  58693. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  58694. return $recv($3)._ifTrue_(assertBlock);
  58695. };
  58696. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  58697. }));
  58698. $recv(runner)._run();
  58699. return self;
  58700. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  58701. },
  58702. args: [],
  58703. 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",
  58704. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  58705. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  58706. }),
  58707. $globals.SUnitAsyncTest);
  58708. $core.addMethod(
  58709. $core.method({
  58710. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  58711. protocol: 'tests',
  58712. fn: function (){
  58713. var self=this;
  58714. var x;
  58715. return $core.withContext(function($ctx1) {
  58716. var $1;
  58717. self["@flag"]="bad";
  58718. self._timeout_((10));
  58719. x=(0);
  58720. $1=self._async_((function(){
  58721. return $core.withContext(function($ctx2) {
  58722. self._finished();
  58723. $ctx2.sendIdx["finished"]=1;
  58724. self["@flag"]="ok";
  58725. self["@flag"];
  58726. x=$recv(x).__plus((1));
  58727. $ctx2.sendIdx["+"]=1;
  58728. x;
  58729. return self._assert_equals_(x,(1));
  58730. $ctx2.sendIdx["assert:equals:"]=1;
  58731. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58732. }));
  58733. $ctx1.sendIdx["async:"]=1;
  58734. self["@flag"]=$recv($1)._valueWithTimeout_((0));
  58735. $ctx1.sendIdx["valueWithTimeout:"]=1;
  58736. self["@flag"]=$recv(self._async_((function(){
  58737. return $core.withContext(function($ctx2) {
  58738. self._finished();
  58739. self["@flag"]="ok";
  58740. self["@flag"];
  58741. x=$recv(x).__plus((1));
  58742. x;
  58743. return self._assert_equals_(x,(1));
  58744. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58745. })))._valueWithTimeout_((0));
  58746. return self;
  58747. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  58748. },
  58749. args: [],
  58750. 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.",
  58751. referencedClasses: [],
  58752. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  58753. }),
  58754. $globals.SUnitAsyncTest);
  58755. });
  58756. define('amber/devel',[
  58757. './helpers', // pre-fetch, dep of ./deploy
  58758. './deploy', // pre-fetch, dep of ./lang
  58759. './lang',
  58760. // --- packages of the development only Amber begin here ---
  58761. 'amber_core/SUnit',
  58762. 'amber_core/Compiler-Tests',
  58763. 'amber_core/Kernel-Tests',
  58764. 'amber_core/SUnit-Tests'
  58765. // --- packages of the development only Amber end here ---
  58766. ], function (amber) { return amber; });
  58767. define("amber_cli/AmberCli", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  58768. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  58769. $core.addPackage('AmberCli');
  58770. $core.packages["AmberCli"].innerEval = function (expr) { return eval(expr); };
  58771. $core.packages["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  58772. $core.addClass('AmberCli', $globals.Object, [], 'AmberCli');
  58773. $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.";
  58774. $core.addMethod(
  58775. $core.method({
  58776. selector: "commandLineSwitches",
  58777. protocol: 'commandline',
  58778. fn: function (){
  58779. var self=this;
  58780. var switches;
  58781. return $core.withContext(function($ctx1) {
  58782. var $1;
  58783. switches=$recv($recv(self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  58784. return $core.withContext(function($ctx2) {
  58785. return $recv(each)._selector();
  58786. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58787. }));
  58788. $ctx1.sendIdx["collect:"]=1;
  58789. switches=$recv(switches)._select_((function(each){
  58790. return $core.withContext(function($ctx2) {
  58791. return $recv(each)._match_("^[^:]*:$");
  58792. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  58793. }));
  58794. switches=$recv(switches)._collect_((function(each){
  58795. return $core.withContext(function($ctx2) {
  58796. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  58797. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  58798. }));
  58799. $1=switches;
  58800. return $1;
  58801. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.klass)});
  58802. },
  58803. args: [],
  58804. 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",
  58805. referencedClasses: [],
  58806. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  58807. }),
  58808. $globals.AmberCli.klass);
  58809. $core.addMethod(
  58810. $core.method({
  58811. selector: "config:",
  58812. protocol: 'commands',
  58813. fn: function (args){
  58814. var self=this;
  58815. function $Configurator(){return $globals.Configurator||(typeof Configurator=="undefined"?nil:Configurator)}
  58816. return $core.withContext(function($ctx1) {
  58817. $recv($recv($Configurator())._new())._start();
  58818. return self;
  58819. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.klass)});
  58820. },
  58821. args: ["args"],
  58822. source: "config: args\x0a\x09Configurator new start",
  58823. referencedClasses: ["Configurator"],
  58824. messageSends: ["start", "new"]
  58825. }),
  58826. $globals.AmberCli.klass);
  58827. $core.addMethod(
  58828. $core.method({
  58829. selector: "handleArguments:",
  58830. protocol: 'commandline',
  58831. fn: function (args){
  58832. var self=this;
  58833. var selector;
  58834. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  58835. return $core.withContext(function($ctx1) {
  58836. var $1;
  58837. $1=$recv(args)._first();
  58838. $ctx1.sendIdx["first"]=1;
  58839. selector=self._selectorForCommandLineSwitch_($1);
  58840. $recv(args)._remove_($recv(args)._first());
  58841. self._perform_withArguments_(selector,$recv($Array())._with_(args));
  58842. return self;
  58843. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.klass)});
  58844. },
  58845. args: ["args"],
  58846. 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)",
  58847. referencedClasses: ["Array"],
  58848. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  58849. }),
  58850. $globals.AmberCli.klass);
  58851. $core.addMethod(
  58852. $core.method({
  58853. selector: "help:",
  58854. protocol: 'commands',
  58855. fn: function (args){
  58856. var self=this;
  58857. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  58858. return $core.withContext(function($ctx1) {
  58859. $recv($Transcript())._show_("Available commands");
  58860. $recv(self._commandLineSwitches())._do_((function(each){
  58861. return $core.withContext(function($ctx2) {
  58862. return $recv(console)._log_(each);
  58863. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58864. }));
  58865. return self;
  58866. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.klass)});
  58867. },
  58868. args: ["args"],
  58869. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  58870. referencedClasses: ["Transcript"],
  58871. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  58872. }),
  58873. $globals.AmberCli.klass);
  58874. $core.addMethod(
  58875. $core.method({
  58876. selector: "init:",
  58877. protocol: 'commands',
  58878. fn: function (args){
  58879. var self=this;
  58880. function $Initer(){return $globals.Initer||(typeof Initer=="undefined"?nil:Initer)}
  58881. return $core.withContext(function($ctx1) {
  58882. $recv($recv($Initer())._new())._start();
  58883. return self;
  58884. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.klass)});
  58885. },
  58886. args: ["args"],
  58887. source: "init: args\x0a\x09Initer new start",
  58888. referencedClasses: ["Initer"],
  58889. messageSends: ["start", "new"]
  58890. }),
  58891. $globals.AmberCli.klass);
  58892. $core.addMethod(
  58893. $core.method({
  58894. selector: "main",
  58895. protocol: 'startup',
  58896. fn: function (){
  58897. var self=this;
  58898. var args;
  58899. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  58900. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  58901. return $core.withContext(function($ctx1) {
  58902. var $3,$2,$1,$4,$5;
  58903. $3=$recv("Welcome to Amber version ".__comma($recv($Smalltalk())._version())).__comma(" (NodeJS ");
  58904. $ctx1.sendIdx[","]=3;
  58905. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  58906. $ctx1.sendIdx[","]=2;
  58907. $1=$recv($2).__comma(").");
  58908. $ctx1.sendIdx[","]=1;
  58909. $recv($Transcript())._show_($1);
  58910. args=$recv(process)._argv();
  58911. $recv(args)._removeFrom_to_((1),(2));
  58912. $4=$recv(args)._isEmpty();
  58913. if($core.assert($4)){
  58914. self._help_(nil);
  58915. } else {
  58916. $5=self._handleArguments_(args);
  58917. return $5;
  58918. };
  58919. return self;
  58920. }, function($ctx1) {$ctx1.fill(self,"main",{args:args},$globals.AmberCli.klass)});
  58921. },
  58922. args: [],
  58923. 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]",
  58924. referencedClasses: ["Transcript", "Smalltalk"],
  58925. messageSends: ["show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifTrue:ifFalse:", "isEmpty", "help:", "handleArguments:"]
  58926. }),
  58927. $globals.AmberCli.klass);
  58928. $core.addMethod(
  58929. $core.method({
  58930. selector: "repl:",
  58931. protocol: 'commands',
  58932. fn: function (args){
  58933. var self=this;
  58934. function $Repl(){return $globals.Repl||(typeof Repl=="undefined"?nil:Repl)}
  58935. return $core.withContext(function($ctx1) {
  58936. var $1;
  58937. $1=$recv($recv($Repl())._new())._createInterface();
  58938. return $1;
  58939. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.klass)});
  58940. },
  58941. args: ["args"],
  58942. source: "repl: args\x0a\x09^ Repl new createInterface",
  58943. referencedClasses: ["Repl"],
  58944. messageSends: ["createInterface", "new"]
  58945. }),
  58946. $globals.AmberCli.klass);
  58947. $core.addMethod(
  58948. $core.method({
  58949. selector: "selectorForCommandLineSwitch:",
  58950. protocol: 'commandline',
  58951. fn: function (aSwitch){
  58952. var self=this;
  58953. var command,selector;
  58954. return $core.withContext(function($ctx1) {
  58955. var $1,$2;
  58956. $1=$recv(self._commandLineSwitches())._includes_(aSwitch);
  58957. if($core.assert($1)){
  58958. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  58959. return $core.withContext(function($ctx2) {
  58960. return $recv($recv(each)._second())._asUppercase();
  58961. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  58962. }))).__comma(":");
  58963. selector;
  58964. } else {
  58965. selector="help:";
  58966. selector;
  58967. };
  58968. $2=selector;
  58969. return $2;
  58970. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.klass)});
  58971. },
  58972. args: ["aSwitch"],
  58973. 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",
  58974. referencedClasses: [],
  58975. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  58976. }),
  58977. $globals.AmberCli.klass);
  58978. $core.addMethod(
  58979. $core.method({
  58980. selector: "serve:",
  58981. protocol: 'commands',
  58982. fn: function (args){
  58983. var self=this;
  58984. function $FileServer(){return $globals.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  58985. return $core.withContext(function($ctx1) {
  58986. var $1;
  58987. $1=$recv($recv($FileServer())._createServerWithArguments_(args))._start();
  58988. return $1;
  58989. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.klass)});
  58990. },
  58991. args: ["args"],
  58992. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  58993. referencedClasses: ["FileServer"],
  58994. messageSends: ["start", "createServerWithArguments:"]
  58995. }),
  58996. $globals.AmberCli.klass);
  58997. $core.addMethod(
  58998. $core.method({
  58999. selector: "version:",
  59000. protocol: 'commands',
  59001. fn: function (arguments_){
  59002. var self=this;
  59003. return self;
  59004. },
  59005. args: ["arguments"],
  59006. source: "version: arguments",
  59007. referencedClasses: [],
  59008. messageSends: []
  59009. }),
  59010. $globals.AmberCli.klass);
  59011. $core.addClass('BaseFileManipulator', $globals.Object, ['path', 'fs'], 'AmberCli');
  59012. $core.addMethod(
  59013. $core.method({
  59014. selector: "dirname",
  59015. protocol: 'private',
  59016. fn: function (){
  59017. var self=this;
  59018. return $core.withContext(function($ctx1) {
  59019. return __dirname;
  59020. return self;
  59021. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  59022. },
  59023. args: [],
  59024. source: "dirname\x0a\x09<return __dirname>",
  59025. referencedClasses: [],
  59026. messageSends: []
  59027. }),
  59028. $globals.BaseFileManipulator);
  59029. $core.addMethod(
  59030. $core.method({
  59031. selector: "initialize",
  59032. protocol: 'initialization',
  59033. fn: function (){
  59034. var self=this;
  59035. return $core.withContext(function($ctx1) {
  59036. (
  59037. $ctx1.supercall = true,
  59038. $globals.BaseFileManipulator.superclass.fn.prototype._initialize.apply($recv(self), []));
  59039. $ctx1.supercall = false;
  59040. self["@path"]=$recv(require)._value_("path");
  59041. $ctx1.sendIdx["value:"]=1;
  59042. self["@fs"]=$recv(require)._value_("fs");
  59043. return self;
  59044. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  59045. },
  59046. args: [],
  59047. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  59048. referencedClasses: [],
  59049. messageSends: ["initialize", "value:"]
  59050. }),
  59051. $globals.BaseFileManipulator);
  59052. $core.addMethod(
  59053. $core.method({
  59054. selector: "rootDirname",
  59055. protocol: 'private',
  59056. fn: function (){
  59057. var self=this;
  59058. return $core.withContext(function($ctx1) {
  59059. var $1;
  59060. $1=$recv(self["@path"])._join_with_(self._dirname(),"..");
  59061. return $1;
  59062. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  59063. },
  59064. args: [],
  59065. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  59066. referencedClasses: [],
  59067. messageSends: ["join:with:", "dirname"]
  59068. }),
  59069. $globals.BaseFileManipulator);
  59070. $core.addClass('Configurator', $globals.BaseFileManipulator, [], 'AmberCli');
  59071. $core.addMethod(
  59072. $core.method({
  59073. selector: "initialize",
  59074. protocol: 'initialization',
  59075. fn: function (){
  59076. var self=this;
  59077. return $core.withContext(function($ctx1) {
  59078. (
  59079. $ctx1.supercall = true,
  59080. $globals.Configurator.superclass.fn.prototype._initialize.apply($recv(self), []));
  59081. $ctx1.supercall = false;
  59082. return self;
  59083. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  59084. },
  59085. args: [],
  59086. source: "initialize\x0a\x09super initialize",
  59087. referencedClasses: [],
  59088. messageSends: ["initialize"]
  59089. }),
  59090. $globals.Configurator);
  59091. $core.addMethod(
  59092. $core.method({
  59093. selector: "start",
  59094. protocol: 'action',
  59095. fn: function (){
  59096. var self=this;
  59097. return $core.withContext(function($ctx1) {
  59098. var $receiver;
  59099. self._writeConfigThenDo_((function(err){
  59100. return $core.withContext(function($ctx2) {
  59101. if(($receiver = err) == null || $receiver.isNil){
  59102. return $recv(process)._exit();
  59103. } else {
  59104. return $recv(process)._exit_((111));
  59105. };
  59106. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  59107. }));
  59108. return self;
  59109. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  59110. },
  59111. args: [],
  59112. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  59113. referencedClasses: [],
  59114. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  59115. }),
  59116. $globals.Configurator);
  59117. $core.addMethod(
  59118. $core.method({
  59119. selector: "writeConfigThenDo:",
  59120. protocol: 'action',
  59121. fn: function (aBlock){
  59122. var self=this;
  59123. return $core.withContext(function($ctx1) {
  59124. $recv($recv(require)._value_("amber-dev/lib/config"))._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  59125. return self;
  59126. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  59127. },
  59128. args: ["aBlock"],
  59129. 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",
  59130. referencedClasses: [],
  59131. messageSends: ["writeConfig:toFile:thenDo:", "value:", "cwd"]
  59132. }),
  59133. $globals.Configurator);
  59134. $core.addClass('FileServer', $globals.BaseFileManipulator, ['http', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli');
  59135. $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.";
  59136. $core.addMethod(
  59137. $core.method({
  59138. selector: "base64Decode:",
  59139. protocol: 'private',
  59140. fn: function (aString){
  59141. var self=this;
  59142. return $core.withContext(function($ctx1) {
  59143. return (new Buffer(aString, 'base64').toString());
  59144. return self;
  59145. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  59146. },
  59147. args: ["aString"],
  59148. source: "base64Decode: aString\x0a\x09<return (new Buffer(aString, 'base64').toString())>",
  59149. referencedClasses: [],
  59150. messageSends: []
  59151. }),
  59152. $globals.FileServer);
  59153. $core.addMethod(
  59154. $core.method({
  59155. selector: "basePath",
  59156. protocol: 'accessing',
  59157. fn: function (){
  59158. var self=this;
  59159. return $core.withContext(function($ctx1) {
  59160. var $2,$1,$receiver;
  59161. $2=self["@basePath"];
  59162. if(($receiver = $2) == null || $receiver.isNil){
  59163. $1=$recv(self._class())._defaultBasePath();
  59164. } else {
  59165. $1=$2;
  59166. };
  59167. return $1;
  59168. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  59169. },
  59170. args: [],
  59171. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  59172. referencedClasses: [],
  59173. messageSends: ["ifNil:", "defaultBasePath", "class"]
  59174. }),
  59175. $globals.FileServer);
  59176. $core.addMethod(
  59177. $core.method({
  59178. selector: "basePath:",
  59179. protocol: 'accessing',
  59180. fn: function (aString){
  59181. var self=this;
  59182. return $core.withContext(function($ctx1) {
  59183. self["@basePath"]=aString;
  59184. self._validateBasePath();
  59185. return self;
  59186. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  59187. },
  59188. args: ["aString"],
  59189. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  59190. referencedClasses: [],
  59191. messageSends: ["validateBasePath"]
  59192. }),
  59193. $globals.FileServer);
  59194. $core.addMethod(
  59195. $core.method({
  59196. selector: "checkDirectoryLayout",
  59197. protocol: 'initialization',
  59198. fn: function (){
  59199. var self=this;
  59200. return $core.withContext(function($ctx1) {
  59201. var $1;
  59202. $1=$recv(self["@fs"])._existsSync_(self._withBasePath_("index.html"));
  59203. if(!$core.assert($1)){
  59204. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  59205. $ctx1.sendIdx["warn:"]=1;
  59206. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  59207. $ctx1.sendIdx["warn:"]=2;
  59208. $recv(console)._warn_(" You can also specify a page to be served by default,");
  59209. $ctx1.sendIdx["warn:"]=3;
  59210. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  59211. };
  59212. return self;
  59213. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  59214. },
  59215. args: [],
  59216. 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.'].",
  59217. referencedClasses: [],
  59218. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  59219. }),
  59220. $globals.FileServer);
  59221. $core.addMethod(
  59222. $core.method({
  59223. selector: "fallbackPage",
  59224. protocol: 'accessing',
  59225. fn: function (){
  59226. var self=this;
  59227. var $1;
  59228. $1=self["@fallbackPage"];
  59229. return $1;
  59230. },
  59231. args: [],
  59232. source: "fallbackPage\x0a\x09^ fallbackPage",
  59233. referencedClasses: [],
  59234. messageSends: []
  59235. }),
  59236. $globals.FileServer);
  59237. $core.addMethod(
  59238. $core.method({
  59239. selector: "fallbackPage:",
  59240. protocol: 'accessing',
  59241. fn: function (aString){
  59242. var self=this;
  59243. self["@fallbackPage"]=aString;
  59244. return self;
  59245. },
  59246. args: ["aString"],
  59247. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  59248. referencedClasses: [],
  59249. messageSends: []
  59250. }),
  59251. $globals.FileServer);
  59252. $core.addMethod(
  59253. $core.method({
  59254. selector: "handleGETRequest:respondTo:",
  59255. protocol: 'request handling',
  59256. fn: function (aRequest,aResponse){
  59257. var self=this;
  59258. var uri,filename;
  59259. return $core.withContext(function($ctx1) {
  59260. var $1;
  59261. uri=$recv(self["@url"])._parse_($recv(aRequest)._url());
  59262. filename=$recv(self["@path"])._join_with_(self._basePath(),$recv(uri)._pathname());
  59263. $recv(self["@fs"])._exists_do_(filename,(function(aBoolean){
  59264. return $core.withContext(function($ctx2) {
  59265. if($core.assert(aBoolean)){
  59266. $1=$recv($recv(self["@fs"])._statSync_(filename))._isDirectory();
  59267. if($core.assert($1)){
  59268. return self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  59269. } else {
  59270. return self._respondFileNamed_to_(filename,aResponse);
  59271. };
  59272. } else {
  59273. return self._respondNotFoundTo_(aResponse);
  59274. };
  59275. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  59276. }));
  59277. return self;
  59278. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  59279. },
  59280. args: ["aRequest", "aResponse"],
  59281. 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]]]",
  59282. referencedClasses: [],
  59283. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  59284. }),
  59285. $globals.FileServer);
  59286. $core.addMethod(
  59287. $core.method({
  59288. selector: "handleOPTIONSRequest:respondTo:",
  59289. protocol: 'request handling',
  59290. fn: function (aRequest,aResponse){
  59291. var self=this;
  59292. return $core.withContext(function($ctx1) {
  59293. $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)]));
  59294. $recv(aResponse)._end();
  59295. return self;
  59296. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  59297. },
  59298. args: ["aRequest", "aResponse"],
  59299. 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",
  59300. referencedClasses: [],
  59301. messageSends: ["writeHead:options:", "end"]
  59302. }),
  59303. $globals.FileServer);
  59304. $core.addMethod(
  59305. $core.method({
  59306. selector: "handlePUTRequest:respondTo:",
  59307. protocol: 'request handling',
  59308. fn: function (aRequest,aResponse){
  59309. var self=this;
  59310. var file,stream;
  59311. return $core.withContext(function($ctx1) {
  59312. var $1,$2,$3,$4;
  59313. $1=self._isAuthenticated_(aRequest);
  59314. if(!$core.assert($1)){
  59315. self._respondAuthenticationRequiredTo_(aResponse);
  59316. return nil;
  59317. };
  59318. file=".".__comma($recv(aRequest)._url());
  59319. $ctx1.sendIdx[","]=1;
  59320. stream=$recv(self["@fs"])._createWriteStream_(file);
  59321. $recv(stream)._on_do_("error",(function(error){
  59322. return $core.withContext(function($ctx2) {
  59323. $2=console;
  59324. $3="Error creating WriteStream for file ".__comma(file);
  59325. $ctx2.sendIdx[","]=2;
  59326. $recv($2)._warn_($3);
  59327. $ctx2.sendIdx["warn:"]=1;
  59328. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  59329. $ctx2.sendIdx["warn:"]=2;
  59330. $recv(console)._warn_(" The exact error is: ".__comma(error));
  59331. return self._respondNotCreatedTo_(aResponse);
  59332. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  59333. }));
  59334. $ctx1.sendIdx["on:do:"]=1;
  59335. $recv(stream)._on_do_("close",(function(){
  59336. return $core.withContext(function($ctx2) {
  59337. return self._respondCreatedTo_(aResponse);
  59338. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  59339. }));
  59340. $ctx1.sendIdx["on:do:"]=2;
  59341. $recv(aRequest)._setEncoding_("utf8");
  59342. $recv(aRequest)._on_do_("data",(function(data){
  59343. return $core.withContext(function($ctx2) {
  59344. return $recv(stream)._write_(data);
  59345. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  59346. }));
  59347. $ctx1.sendIdx["on:do:"]=3;
  59348. $recv(aRequest)._on_do_("end",(function(){
  59349. return $core.withContext(function($ctx2) {
  59350. $4=$recv(stream)._writable();
  59351. if($core.assert($4)){
  59352. return $recv(stream)._end();
  59353. };
  59354. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  59355. }));
  59356. return self;
  59357. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  59358. },
  59359. args: ["aRequest", "aResponse"],
  59360. 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]]",
  59361. referencedClasses: [],
  59362. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  59363. }),
  59364. $globals.FileServer);
  59365. $core.addMethod(
  59366. $core.method({
  59367. selector: "handleRequest:respondTo:",
  59368. protocol: 'request handling',
  59369. fn: function (aRequest,aResponse){
  59370. var self=this;
  59371. return $core.withContext(function($ctx1) {
  59372. var $2,$1,$4,$3,$5;
  59373. $2=$recv(aRequest)._method();
  59374. $ctx1.sendIdx["method"]=1;
  59375. $1=$recv($2).__eq("PUT");
  59376. $ctx1.sendIdx["="]=1;
  59377. if($core.assert($1)){
  59378. self._handlePUTRequest_respondTo_(aRequest,aResponse);
  59379. };
  59380. $4=$recv(aRequest)._method();
  59381. $ctx1.sendIdx["method"]=2;
  59382. $3=$recv($4).__eq("GET");
  59383. $ctx1.sendIdx["="]=2;
  59384. if($core.assert($3)){
  59385. self._handleGETRequest_respondTo_(aRequest,aResponse);
  59386. };
  59387. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  59388. if($core.assert($5)){
  59389. self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  59390. };
  59391. return self;
  59392. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  59393. },
  59394. args: ["aRequest", "aResponse"],
  59395. 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]",
  59396. referencedClasses: [],
  59397. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  59398. }),
  59399. $globals.FileServer);
  59400. $core.addMethod(
  59401. $core.method({
  59402. selector: "host",
  59403. protocol: 'accessing',
  59404. fn: function (){
  59405. var self=this;
  59406. var $1;
  59407. $1=self["@host"];
  59408. return $1;
  59409. },
  59410. args: [],
  59411. source: "host\x0a\x09^ host",
  59412. referencedClasses: [],
  59413. messageSends: []
  59414. }),
  59415. $globals.FileServer);
  59416. $core.addMethod(
  59417. $core.method({
  59418. selector: "host:",
  59419. protocol: 'accessing',
  59420. fn: function (hostname){
  59421. var self=this;
  59422. self["@host"]=hostname;
  59423. return self;
  59424. },
  59425. args: ["hostname"],
  59426. source: "host: hostname\x0a\x09host := hostname",
  59427. referencedClasses: [],
  59428. messageSends: []
  59429. }),
  59430. $globals.FileServer);
  59431. $core.addMethod(
  59432. $core.method({
  59433. selector: "initialize",
  59434. protocol: 'initialization',
  59435. fn: function (){
  59436. var self=this;
  59437. return $core.withContext(function($ctx1) {
  59438. var $1;
  59439. (
  59440. $ctx1.supercall = true,
  59441. $globals.FileServer.superclass.fn.prototype._initialize.apply($recv(self), []));
  59442. $ctx1.supercall = false;
  59443. self["@http"]=self._require_("http");
  59444. $ctx1.sendIdx["require:"]=1;
  59445. self["@util"]=self._require_("util");
  59446. $ctx1.sendIdx["require:"]=2;
  59447. self["@url"]=self._require_("url");
  59448. $1=self._class();
  59449. $ctx1.sendIdx["class"]=1;
  59450. self["@host"]=$recv($1)._defaultHost();
  59451. self["@port"]=$recv(self._class())._defaultPort();
  59452. self["@username"]=nil;
  59453. self["@password"]=nil;
  59454. self["@fallbackPage"]=nil;
  59455. return self;
  59456. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  59457. },
  59458. args: [],
  59459. 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.",
  59460. referencedClasses: [],
  59461. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  59462. }),
  59463. $globals.FileServer);
  59464. $core.addMethod(
  59465. $core.method({
  59466. selector: "isAuthenticated:",
  59467. protocol: 'private',
  59468. fn: function (aRequest){
  59469. var self=this;
  59470. var header,token,auth,parts;
  59471. return $core.withContext(function($ctx1) {
  59472. var $2,$1,$3,$4,$5,$6,$9,$10,$8,$7,$receiver;
  59473. $2=$recv(self["@username"])._isNil();
  59474. $ctx1.sendIdx["isNil"]=1;
  59475. $1=$recv($2)._and_((function(){
  59476. return $core.withContext(function($ctx2) {
  59477. return $recv(self["@password"])._isNil();
  59478. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59479. }));
  59480. $ctx1.sendIdx["and:"]=1;
  59481. if($core.assert($1)){
  59482. return true;
  59483. };
  59484. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  59485. $ctx1.sendIdx["at:"]=1;
  59486. if(($receiver = $3) == null || $receiver.isNil){
  59487. header="";
  59488. } else {
  59489. header=$3;
  59490. };
  59491. $4=$recv(header)._isEmpty();
  59492. if($core.assert($4)){
  59493. return false;
  59494. } else {
  59495. $5=$recv(header)._tokenize_(" ");
  59496. $ctx1.sendIdx["tokenize:"]=1;
  59497. if(($receiver = $5) == null || $receiver.isNil){
  59498. token="";
  59499. } else {
  59500. token=$5;
  59501. };
  59502. token;
  59503. $6=$recv(token)._at_((2));
  59504. $ctx1.sendIdx["at:"]=2;
  59505. auth=self._base64Decode_($6);
  59506. auth;
  59507. parts=$recv(auth)._tokenize_(":");
  59508. parts;
  59509. $9=self["@username"];
  59510. $10=$recv(parts)._at_((1));
  59511. $ctx1.sendIdx["at:"]=3;
  59512. $8=$recv($9).__eq($10);
  59513. $ctx1.sendIdx["="]=1;
  59514. $7=$recv($8)._and_((function(){
  59515. return $core.withContext(function($ctx2) {
  59516. return $recv(self["@password"]).__eq($recv(parts)._at_((2)));
  59517. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  59518. }));
  59519. if($core.assert($7)){
  59520. return true;
  59521. } else {
  59522. return false;
  59523. };
  59524. };
  59525. return self;
  59526. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  59527. },
  59528. args: ["aRequest"],
  59529. 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].",
  59530. referencedClasses: [],
  59531. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "isEmpty", "tokenize:", "base64Decode:", "="]
  59532. }),
  59533. $globals.FileServer);
  59534. $core.addMethod(
  59535. $core.method({
  59536. selector: "password:",
  59537. protocol: 'accessing',
  59538. fn: function (aPassword){
  59539. var self=this;
  59540. self["@password"]=aPassword;
  59541. return self;
  59542. },
  59543. args: ["aPassword"],
  59544. source: "password: aPassword\x0a\x09password := aPassword.",
  59545. referencedClasses: [],
  59546. messageSends: []
  59547. }),
  59548. $globals.FileServer);
  59549. $core.addMethod(
  59550. $core.method({
  59551. selector: "port",
  59552. protocol: 'accessing',
  59553. fn: function (){
  59554. var self=this;
  59555. var $1;
  59556. $1=self["@port"];
  59557. return $1;
  59558. },
  59559. args: [],
  59560. source: "port\x0a\x09^ port",
  59561. referencedClasses: [],
  59562. messageSends: []
  59563. }),
  59564. $globals.FileServer);
  59565. $core.addMethod(
  59566. $core.method({
  59567. selector: "port:",
  59568. protocol: 'accessing',
  59569. fn: function (aNumber){
  59570. var self=this;
  59571. self["@port"]=aNumber;
  59572. return self;
  59573. },
  59574. args: ["aNumber"],
  59575. source: "port: aNumber\x0a\x09port := aNumber",
  59576. referencedClasses: [],
  59577. messageSends: []
  59578. }),
  59579. $globals.FileServer);
  59580. $core.addMethod(
  59581. $core.method({
  59582. selector: "require:",
  59583. protocol: 'private',
  59584. fn: function (aModuleString){
  59585. var self=this;
  59586. return $core.withContext(function($ctx1) {
  59587. var $1;
  59588. $1=$recv(require)._value_(aModuleString);
  59589. return $1;
  59590. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  59591. },
  59592. args: ["aModuleString"],
  59593. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  59594. referencedClasses: [],
  59595. messageSends: ["value:"]
  59596. }),
  59597. $globals.FileServer);
  59598. $core.addMethod(
  59599. $core.method({
  59600. selector: "respondAuthenticationRequiredTo:",
  59601. protocol: 'request handling',
  59602. fn: function (aResponse){
  59603. var self=this;
  59604. return $core.withContext(function($ctx1) {
  59605. var $1;
  59606. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  59607. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  59608. $1=$recv(aResponse)._end();
  59609. return self;
  59610. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  59611. },
  59612. args: ["aResponse"],
  59613. 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.",
  59614. referencedClasses: [],
  59615. messageSends: ["writeHead:options:", "write:", "end"]
  59616. }),
  59617. $globals.FileServer);
  59618. $core.addMethod(
  59619. $core.method({
  59620. selector: "respondCreatedTo:",
  59621. protocol: 'request handling',
  59622. fn: function (aResponse){
  59623. var self=this;
  59624. return $core.withContext(function($ctx1) {
  59625. var $1;
  59626. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  59627. $1=$recv(aResponse)._end();
  59628. return self;
  59629. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  59630. },
  59631. args: ["aResponse"],
  59632. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  59633. referencedClasses: [],
  59634. messageSends: ["writeHead:options:", "end"]
  59635. }),
  59636. $globals.FileServer);
  59637. $core.addMethod(
  59638. $core.method({
  59639. selector: "respondDirectoryNamed:from:to:",
  59640. protocol: 'request handling',
  59641. fn: function (aDirname,aUrl,aResponse){
  59642. var self=this;
  59643. return $core.withContext(function($ctx1) {
  59644. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  59645. $2=$recv(aUrl)._pathname();
  59646. $ctx1.sendIdx["pathname"]=1;
  59647. $1=$recv($2)._endsWith_("/");
  59648. if($core.assert($1)){
  59649. $3=$recv(aDirname).__comma("index.html");
  59650. $ctx1.sendIdx[","]=1;
  59651. self._respondFileNamed_to_($3,aResponse);
  59652. } else {
  59653. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  59654. $7=$recv(aUrl)._search();
  59655. if(($receiver = $7) == null || $receiver.isNil){
  59656. $6="";
  59657. } else {
  59658. $6=$7;
  59659. };
  59660. $4=$recv($5).__comma($6);
  59661. $ctx1.sendIdx[","]=2;
  59662. self._respondRedirect_to_($4,aResponse);
  59663. };
  59664. return self;
  59665. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  59666. },
  59667. args: ["aDirname", "aUrl", "aResponse"],
  59668. 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]",
  59669. referencedClasses: [],
  59670. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  59671. }),
  59672. $globals.FileServer);
  59673. $core.addMethod(
  59674. $core.method({
  59675. selector: "respondFileNamed:to:",
  59676. protocol: 'request handling',
  59677. fn: function (aFilename,aResponse){
  59678. var self=this;
  59679. var type,filename;
  59680. return $core.withContext(function($ctx1) {
  59681. var $1,$2,$3,$4,$5;
  59682. filename=aFilename;
  59683. $recv(self["@fs"])._readFile_do_(filename,(function(ex,file){
  59684. return $core.withContext(function($ctx2) {
  59685. $1=$recv(ex)._notNil();
  59686. if($core.assert($1)){
  59687. $2=console;
  59688. $3=$recv(filename).__comma(" does not exist");
  59689. $ctx2.sendIdx[","]=1;
  59690. $recv($2)._log_($3);
  59691. return self._respondNotFoundTo_(aResponse);
  59692. } else {
  59693. type=$recv(self._class())._mimeTypeFor_(filename);
  59694. type;
  59695. $4=$recv(type).__eq("application/javascript");
  59696. if($core.assert($4)){
  59697. type=$recv(type).__comma(";charset=utf-8");
  59698. type;
  59699. };
  59700. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  59701. $recv(aResponse)._write_encoding_(file,"binary");
  59702. $5=$recv(aResponse)._end();
  59703. return $5;
  59704. };
  59705. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  59706. }));
  59707. return self;
  59708. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  59709. },
  59710. args: ["aFilename", "aResponse"],
  59711. 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]]",
  59712. referencedClasses: [],
  59713. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  59714. }),
  59715. $globals.FileServer);
  59716. $core.addMethod(
  59717. $core.method({
  59718. selector: "respondInternalErrorTo:",
  59719. protocol: 'request handling',
  59720. fn: function (aResponse){
  59721. var self=this;
  59722. return $core.withContext(function($ctx1) {
  59723. var $1;
  59724. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  59725. $recv(aResponse)._write_("500 Internal server error");
  59726. $1=$recv(aResponse)._end();
  59727. return self;
  59728. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  59729. },
  59730. args: ["aResponse"],
  59731. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  59732. referencedClasses: [],
  59733. messageSends: ["writeHead:options:", "write:", "end"]
  59734. }),
  59735. $globals.FileServer);
  59736. $core.addMethod(
  59737. $core.method({
  59738. selector: "respondNotCreatedTo:",
  59739. protocol: 'request handling',
  59740. fn: function (aResponse){
  59741. var self=this;
  59742. return $core.withContext(function($ctx1) {
  59743. var $1;
  59744. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  59745. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  59746. $1=$recv(aResponse)._end();
  59747. return self;
  59748. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  59749. },
  59750. args: ["aResponse"],
  59751. 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.",
  59752. referencedClasses: [],
  59753. messageSends: ["writeHead:options:", "write:", "end"]
  59754. }),
  59755. $globals.FileServer);
  59756. $core.addMethod(
  59757. $core.method({
  59758. selector: "respondNotFoundTo:",
  59759. protocol: 'request handling',
  59760. fn: function (aResponse){
  59761. var self=this;
  59762. return $core.withContext(function($ctx1) {
  59763. var $2,$1,$3,$4;
  59764. $2=self._fallbackPage();
  59765. $ctx1.sendIdx["fallbackPage"]=1;
  59766. $1=$recv($2)._isNil();
  59767. if(!$core.assert($1)){
  59768. $3=self._respondFileNamed_to_(self._fallbackPage(),aResponse);
  59769. return $3;
  59770. };
  59771. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  59772. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  59773. $ctx1.sendIdx["write:"]=1;
  59774. $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>");
  59775. $ctx1.sendIdx["write:"]=2;
  59776. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  59777. $ctx1.sendIdx["write:"]=3;
  59778. $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>");
  59779. $ctx1.sendIdx["write:"]=4;
  59780. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  59781. $ctx1.sendIdx["write:"]=5;
  59782. $recv(aResponse)._write_("</ul></p></body></html>");
  59783. $4=$recv(aResponse)._end();
  59784. return self;
  59785. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  59786. },
  59787. args: ["aResponse"],
  59788. 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",
  59789. referencedClasses: [],
  59790. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  59791. }),
  59792. $globals.FileServer);
  59793. $core.addMethod(
  59794. $core.method({
  59795. selector: "respondOKTo:",
  59796. protocol: 'request handling',
  59797. fn: function (aResponse){
  59798. var self=this;
  59799. return $core.withContext(function($ctx1) {
  59800. var $1;
  59801. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  59802. $1=$recv(aResponse)._end();
  59803. return self;
  59804. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  59805. },
  59806. args: ["aResponse"],
  59807. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  59808. referencedClasses: [],
  59809. messageSends: ["writeHead:options:", "end"]
  59810. }),
  59811. $globals.FileServer);
  59812. $core.addMethod(
  59813. $core.method({
  59814. selector: "respondRedirect:to:",
  59815. protocol: 'request handling',
  59816. fn: function (aString,aResponse){
  59817. var self=this;
  59818. return $core.withContext(function($ctx1) {
  59819. var $1;
  59820. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  59821. $1=$recv(aResponse)._end();
  59822. return self;
  59823. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  59824. },
  59825. args: ["aString", "aResponse"],
  59826. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  59827. referencedClasses: [],
  59828. messageSends: ["writeHead:options:", "end"]
  59829. }),
  59830. $globals.FileServer);
  59831. $core.addMethod(
  59832. $core.method({
  59833. selector: "start",
  59834. protocol: 'starting',
  59835. fn: function (){
  59836. var self=this;
  59837. return $core.withContext(function($ctx1) {
  59838. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5,$11;
  59839. self._checkDirectoryLayout();
  59840. $1=$recv(self["@http"])._createServer_((function(request,response){
  59841. return $core.withContext(function($ctx2) {
  59842. return self._handleRequest_respondTo_(request,response);
  59843. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  59844. }));
  59845. $recv($1)._on_do_("error",(function(error){
  59846. return $core.withContext(function($ctx2) {
  59847. $2=console;
  59848. $3="Error starting server: ".__comma(error);
  59849. $ctx2.sendIdx[","]=1;
  59850. return $recv($2)._log_($3);
  59851. $ctx2.sendIdx["log:"]=1;
  59852. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  59853. }));
  59854. $ctx1.sendIdx["on:do:"]=1;
  59855. $recv($1)._on_do_("listening",(function(){
  59856. return $core.withContext(function($ctx2) {
  59857. $4=console;
  59858. $8=self._host();
  59859. $ctx2.sendIdx["host"]=1;
  59860. $7="Starting file server on http://".__comma($8);
  59861. $6=$recv($7).__comma(":");
  59862. $ctx2.sendIdx[","]=3;
  59863. $10=self._port();
  59864. $ctx2.sendIdx["port"]=1;
  59865. $9=$recv($10)._asString();
  59866. $5=$recv($6).__comma($9);
  59867. $ctx2.sendIdx[","]=2;
  59868. return $recv($4)._log_($5);
  59869. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  59870. }));
  59871. $11=$recv($1)._listen_host_(self._port(),self._host());
  59872. return self;
  59873. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  59874. },
  59875. args: [],
  59876. 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.",
  59877. referencedClasses: [],
  59878. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  59879. }),
  59880. $globals.FileServer);
  59881. $core.addMethod(
  59882. $core.method({
  59883. selector: "startOn:",
  59884. protocol: 'starting',
  59885. fn: function (aPort){
  59886. var self=this;
  59887. return $core.withContext(function($ctx1) {
  59888. self._port_(aPort);
  59889. self._start();
  59890. return self;
  59891. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  59892. },
  59893. args: ["aPort"],
  59894. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  59895. referencedClasses: [],
  59896. messageSends: ["port:", "start"]
  59897. }),
  59898. $globals.FileServer);
  59899. $core.addMethod(
  59900. $core.method({
  59901. selector: "username:",
  59902. protocol: 'accessing',
  59903. fn: function (aUsername){
  59904. var self=this;
  59905. self["@username"]=aUsername;
  59906. return self;
  59907. },
  59908. args: ["aUsername"],
  59909. source: "username: aUsername\x0a\x09username := aUsername.",
  59910. referencedClasses: [],
  59911. messageSends: []
  59912. }),
  59913. $globals.FileServer);
  59914. $core.addMethod(
  59915. $core.method({
  59916. selector: "validateBasePath",
  59917. protocol: 'private',
  59918. fn: function (){
  59919. var self=this;
  59920. return $core.withContext(function($ctx1) {
  59921. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  59922. $1=self["@fs"];
  59923. $2=self._basePath();
  59924. $ctx1.sendIdx["basePath"]=1;
  59925. $recv($1)._stat_then_($2,(function(err,stat){
  59926. return $core.withContext(function($ctx2) {
  59927. if(($receiver = err) == null || $receiver.isNil){
  59928. $3=$recv(stat)._isDirectory();
  59929. if(!$core.assert($3)){
  59930. $4=console;
  59931. $7=self._basePath();
  59932. $ctx2.sendIdx["basePath"]=2;
  59933. $6="Warning: --base-path parameter ".__comma($7);
  59934. $ctx2.sendIdx[","]=2;
  59935. $5=$recv($6).__comma(" is not a directory.");
  59936. $ctx2.sendIdx[","]=1;
  59937. return $recv($4)._warn_($5);
  59938. $ctx2.sendIdx["warn:"]=1;
  59939. };
  59940. } else {
  59941. $8=console;
  59942. $9=$recv("Warning: path at --base-path parameter ".__comma(self._basePath())).__comma(" does not exist.");
  59943. $ctx2.sendIdx[","]=3;
  59944. return $recv($8)._warn_($9);
  59945. };
  59946. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  59947. }));
  59948. return self;
  59949. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  59950. },
  59951. args: [],
  59952. 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.' ]].",
  59953. referencedClasses: [],
  59954. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  59955. }),
  59956. $globals.FileServer);
  59957. $core.addMethod(
  59958. $core.method({
  59959. selector: "withBasePath:",
  59960. protocol: 'private',
  59961. fn: function (aBaseRelativePath){
  59962. var self=this;
  59963. return $core.withContext(function($ctx1) {
  59964. var $1;
  59965. $1=$recv(self["@path"])._join_with_(self._basePath(),aBaseRelativePath);
  59966. return $1;
  59967. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  59968. },
  59969. args: ["aBaseRelativePath"],
  59970. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  59971. referencedClasses: [],
  59972. messageSends: ["join:with:", "basePath"]
  59973. }),
  59974. $globals.FileServer);
  59975. $core.addMethod(
  59976. $core.method({
  59977. selector: "writeData:toFileNamed:",
  59978. protocol: 'private',
  59979. fn: function (data,aFilename){
  59980. var self=this;
  59981. return $core.withContext(function($ctx1) {
  59982. $recv(console)._log_(aFilename);
  59983. return self;
  59984. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  59985. },
  59986. args: ["data", "aFilename"],
  59987. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  59988. referencedClasses: [],
  59989. messageSends: ["log:"]
  59990. }),
  59991. $globals.FileServer);
  59992. $globals.FileServer.klass.iVarNames = ['mimeTypes'];
  59993. $core.addMethod(
  59994. $core.method({
  59995. selector: "commandLineSwitches",
  59996. protocol: 'accessing',
  59997. fn: function (){
  59998. var self=this;
  59999. var switches;
  60000. return $core.withContext(function($ctx1) {
  60001. var $1;
  60002. switches=$recv(self._methodsInProtocol_("accessing"))._collect_((function(each){
  60003. return $core.withContext(function($ctx2) {
  60004. return $recv(each)._selector();
  60005. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60006. }));
  60007. $ctx1.sendIdx["collect:"]=1;
  60008. switches=$recv(switches)._select_((function(each){
  60009. return $core.withContext(function($ctx2) {
  60010. return $recv(each)._match_("^[^:]*:$");
  60011. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  60012. }));
  60013. switches=$recv(switches)._collect_((function(each){
  60014. return $core.withContext(function($ctx2) {
  60015. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  60016. $ctx2.sendIdx["replace:with:"]=1;
  60017. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  60018. }));
  60019. $1=switches;
  60020. return $1;
  60021. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.klass)});
  60022. },
  60023. args: [],
  60024. 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",
  60025. referencedClasses: [],
  60026. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  60027. }),
  60028. $globals.FileServer.klass);
  60029. $core.addMethod(
  60030. $core.method({
  60031. selector: "createServerWithArguments:",
  60032. protocol: 'initialization',
  60033. fn: function (options){
  60034. var self=this;
  60035. var server,popFront,front,optionName,optionValue,switches;
  60036. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  60037. return $core.withContext(function($ctx1) {
  60038. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11;
  60039. var $early={};
  60040. try {
  60041. switches=self._commandLineSwitches();
  60042. server=self._new();
  60043. $recv(options)._ifEmpty_((function(){
  60044. $1=server;
  60045. throw $early=[$1];
  60046. }));
  60047. $2=$recv($recv(options)._size())._even();
  60048. if(!$core.assert($2)){
  60049. $recv(console)._log_("Using default parameters.");
  60050. $ctx1.sendIdx["log:"]=1;
  60051. $3=console;
  60052. $4="Wrong commandline options or not enough arguments for: ".__comma(options);
  60053. $ctx1.sendIdx[","]=1;
  60054. $recv($3)._log_($4);
  60055. $ctx1.sendIdx["log:"]=2;
  60056. $5=console;
  60057. $6="Use any of the following ones: ".__comma(switches);
  60058. $ctx1.sendIdx[","]=2;
  60059. $recv($5)._log_($6);
  60060. $ctx1.sendIdx["log:"]=3;
  60061. $7=server;
  60062. return $7;
  60063. };
  60064. popFront=(function(args){
  60065. return $core.withContext(function($ctx2) {
  60066. front=$recv(args)._first();
  60067. front;
  60068. $recv(args)._remove_(front);
  60069. return front;
  60070. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  60071. });
  60072. $recv((function(){
  60073. return $core.withContext(function($ctx2) {
  60074. return $recv(options)._notEmpty();
  60075. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  60076. }))._whileTrue_((function(){
  60077. return $core.withContext(function($ctx2) {
  60078. optionName=$recv(popFront)._value_(options);
  60079. $ctx2.sendIdx["value:"]=1;
  60080. optionName;
  60081. optionValue=$recv(popFront)._value_(options);
  60082. optionValue;
  60083. $8=$recv(switches)._includes_(optionName);
  60084. if($core.assert($8)){
  60085. optionName=self._selectorForCommandLineSwitch_(optionName);
  60086. optionName;
  60087. return $recv(server)._perform_withArguments_(optionName,$recv($Array())._with_(optionValue));
  60088. } else {
  60089. $9=console;
  60090. $10=$recv(optionName).__comma(" is not a valid commandline option");
  60091. $ctx2.sendIdx[","]=3;
  60092. $recv($9)._log_($10);
  60093. $ctx2.sendIdx["log:"]=4;
  60094. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  60095. };
  60096. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  60097. }));
  60098. $11=server;
  60099. return $11;
  60100. }
  60101. catch(e) {if(e===$early)return e[0]; throw e}
  60102. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.klass)});
  60103. },
  60104. args: ["options"],
  60105. 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.",
  60106. referencedClasses: ["Array"],
  60107. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  60108. }),
  60109. $globals.FileServer.klass);
  60110. $core.addMethod(
  60111. $core.method({
  60112. selector: "defaultBasePath",
  60113. protocol: 'accessing',
  60114. fn: function (){
  60115. var self=this;
  60116. return "./";
  60117. },
  60118. args: [],
  60119. source: "defaultBasePath\x0a\x09^ './'",
  60120. referencedClasses: [],
  60121. messageSends: []
  60122. }),
  60123. $globals.FileServer.klass);
  60124. $core.addMethod(
  60125. $core.method({
  60126. selector: "defaultHost",
  60127. protocol: 'accessing',
  60128. fn: function (){
  60129. var self=this;
  60130. return "127.0.0.1";
  60131. },
  60132. args: [],
  60133. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  60134. referencedClasses: [],
  60135. messageSends: []
  60136. }),
  60137. $globals.FileServer.klass);
  60138. $core.addMethod(
  60139. $core.method({
  60140. selector: "defaultMimeTypes",
  60141. protocol: 'accessing',
  60142. fn: function (){
  60143. var self=this;
  60144. var $1;
  60145. $1=$globals.HashedCollection._newFromPairs_(["%","application/x-trash","323","text/h323","abw","application/x-abiword","ai","application/postscript","aif","audio/x-aiff","aifc","audio/x-aiff","aiff","audio/x-aiff","alc","chemical/x-alchemy","art","image/x-jg","asc","text/plain","asf","video/x-ms-asf","asn","chemical/x-ncbi-asn1-spec","aso","chemical/x-ncbi-asn1-binary","asx","video/x-ms-asf","au","audio/basic","avi","video/x-msvideo","b","chemical/x-molconn-Z","bak","application/x-trash","bat","application/x-msdos-program","bcpio","application/x-bcpio","bib","text/x-bibtex","bin","application/octet-stream","bmp","image/x-ms-bmp","book","application/x-maker","bsd","chemical/x-crossfire","c","text/x-csrc","c++","text/x-c++src","c3d","chemical/x-chem3d","cac","chemical/x-cache","cache","chemical/x-cache","cascii","chemical/x-cactvs-binary","cat","application/vnd.ms-pki.seccat","cbin","chemical/x-cactvs-binary","cc","text/x-c++src","cdf","application/x-cdf","cdr","image/x-coreldraw","cdt","image/x-coreldrawtemplate","cdx","chemical/x-cdx","cdy","application/vnd.cinderella","cef","chemical/x-cxf","cer","chemical/x-cerius","chm","chemical/x-chemdraw","chrt","application/x-kchart","cif","chemical/x-cif","class","application/java-vm","cls","text/x-tex","cmdf","chemical/x-cmdf","cml","chemical/x-cml","cod","application/vnd.rim.cod","com","application/x-msdos-program","cpa","chemical/x-compass","cpio","application/x-cpio","cpp","text/x-c++src","cpt","image/x-corelphotopaint","crl","application/x-pkcs7-crl","crt","application/x-x509-ca-cert","csf","chemical/x-cache-csf","csh","text/x-csh","csm","chemical/x-csml","csml","chemical/x-csml","css","text/css","csv","text/comma-separated-values","ctab","chemical/x-cactvs-binary","ctx","chemical/x-ctx","cu","application/cu-seeme","cub","chemical/x-gaussian-cube","cxf","chemical/x-cxf","cxx","text/x-c++src","dat","chemical/x-mopac-input","dcr","application/x-director","deb","application/x-debian-package","dif","video/dv","diff","text/plain","dir","application/x-director","djv","image/vnd.djvu","djvu","image/vnd.djvu","dl","video/dl","dll","application/x-msdos-program","dmg","application/x-apple-diskimage","dms","application/x-dms","doc","application/msword","dot","application/msword","dv","video/dv","dvi","application/x-dvi","dx","chemical/x-jcamp-dx","dxr","application/x-director","emb","chemical/x-embl-dl-nucleotide","embl","chemical/x-embl-dl-nucleotide","ent","chemical/x-pdb","eps","application/postscript","etx","text/x-setext","exe","application/x-msdos-program","ez","application/andrew-inset","fb","application/x-maker","fbdoc","application/x-maker","fch","chemical/x-gaussian-checkpoint","fchk","chemical/x-gaussian-checkpoint","fig","application/x-xfig","flac","application/x-flac","fli","video/fli","fm","application/x-maker","frame","application/x-maker","frm","application/x-maker","gal","chemical/x-gaussian-log","gam","chemical/x-gamess-input","gamin","chemical/x-gamess-input","gau","chemical/x-gaussian-input","gcd","text/x-pcs-gcd","gcf","application/x-graphing-calculator","gcg","chemical/x-gcg8-sequence","gen","chemical/x-genbank","gf","application/x-tex-gf","gif","image/gif","gjc","chemical/x-gaussian-input","gjf","chemical/x-gaussian-input","gl","video/gl","gnumeric","application/x-gnumeric","gpt","chemical/x-mopac-graph","gsf","application/x-font","gsm","audio/x-gsm","gtar","application/x-gtar","h","text/x-chdr","h++","text/x-c++hdr","hdf","application/x-hdf","hh","text/x-c++hdr","hin","chemical/x-hin","hpp","text/x-c++hdr","hqx","application/mac-binhex40","hs","text/x-haskell","hta","application/hta","htc","text/x-component","htm","text/html","html","text/html","hxx","text/x-c++hdr","ica","application/x-ica","ice","x-conference/x-cooltalk","ico","image/x-icon","ics","text/calendar","icz","text/calendar","ief","image/ief","iges","model/iges","igs","model/iges","iii","application/x-iphone","inp","chemical/x-gamess-input","ins","application/x-internet-signup","iso","application/x-iso9660-image","isp","application/x-internet-signup","ist","chemical/x-isostar","istr","chemical/x-isostar","jad","text/vnd.sun.j2me.app-descriptor","jar","application/java-archive","java","text/x-java","jdx","chemical/x-jcamp-dx","jmz","application/x-jmol","jng","image/x-jng","jnlp","application/x-java-jnlp-file","jpe","image/jpeg","jpeg","image/jpeg","jpg","image/jpeg","js","application/javascript","kar","audio/midi","key","application/pgp-keys","kil","application/x-killustrator","kin","chemical/x-kinemage","kpr","application/x-kpresenter","kpt","application/x-kpresenter","ksp","application/x-kspread","kwd","application/x-kword","kwt","application/x-kword","latex","application/x-latex","lha","application/x-lha","lhs","text/x-literate-haskell","lsf","video/x-la-asf","lsx","video/x-la-asf","ltx","text/x-tex","lzh","application/x-lzh","lzx","application/x-lzx","m3u","audio/x-mpegurl","m4a","audio/mpeg","maker","application/x-maker","man","application/x-troff-man","mcif","chemical/x-mmcif","mcm","chemical/x-macmolecule","mdb","application/msaccess","me","application/x-troff-me","mesh","model/mesh","mid","audio/midi","midi","audio/midi","mif","application/x-mif","mm","application/x-freemind","mmd","chemical/x-macromodel-input","mmf","application/vnd.smaf","mml","text/mathml","mmod","chemical/x-macromodel-input","mng","video/x-mng","moc","text/x-moc","mol","chemical/x-mdl-molfile","mol2","chemical/x-mol2","moo","chemical/x-mopac-out","mop","chemical/x-mopac-input","mopcrt","chemical/x-mopac-input","mov","video/quicktime","movie","video/x-sgi-movie","mp2","audio/mpeg","mp3","audio/mpeg","mp4","video/mp4","mpc","chemical/x-mopac-input","mpe","video/mpeg","mpeg","video/mpeg","mpega","audio/mpeg","mpg","video/mpeg","mpga","audio/mpeg","ms","application/x-troff-ms","msh","model/mesh","msi","application/x-msi","mvb","chemical/x-mopac-vib","mxu","video/vnd.mpegurl","nb","application/mathematica","nc","application/x-netcdf","nwc","application/x-nwc","o","application/x-object","oda","application/oda","odb","application/vnd.oasis.opendocument.database","odc","application/vnd.oasis.opendocument.chart","odf","application/vnd.oasis.opendocument.formula","odg","application/vnd.oasis.opendocument.graphics","odi","application/vnd.oasis.opendocument.image","odm","application/vnd.oasis.opendocument.text-master","odp","application/vnd.oasis.opendocument.presentation","ods","application/vnd.oasis.opendocument.spreadsheet","odt","application/vnd.oasis.opendocument.text","ogg","application/ogg","old","application/x-trash","oth","application/vnd.oasis.opendocument.text-web","oza","application/x-oz-application","p","text/x-pascal","p7r","application/x-pkcs7-certreqresp","pac","application/x-ns-proxy-autoconfig","pas","text/x-pascal","pat","image/x-coreldrawpattern","pbm","image/x-portable-bitmap","pcf","application/x-font","pcf.Z","application/x-font","pcx","image/pcx","pdb","chemical/x-pdb","pdf","application/pdf","pfa","application/x-font","pfb","application/x-font","pgm","image/x-portable-graymap","pgn","application/x-chess-pgn","pgp","application/pgp-signature","pk","application/x-tex-pk","pl","text/x-perl","pls","audio/x-scpls","pm","text/x-perl","png","image/png","pnm","image/x-portable-anymap","pot","text/plain","ppm","image/x-portable-pixmap","pps","application/vnd.ms-powerpoint","ppt","application/vnd.ms-powerpoint","prf","application/pics-rules","prt","chemical/x-ncbi-asn1-ascii","ps","application/postscript","psd","image/x-photoshop","psp","text/x-psp","py","text/x-python","pyc","application/x-python-code","pyo","application/x-python-code","qt","video/quicktime","qtl","application/x-quicktimeplayer","ra","audio/x-realaudio","ram","audio/x-pn-realaudio","rar","application/rar","ras","image/x-cmu-raster","rd","chemical/x-mdl-rdfile","rdf","application/rdf+xml","rgb","image/x-rgb","rm","audio/x-pn-realaudio","roff","application/x-troff","ros","chemical/x-rosdal","rpm","application/x-redhat-package-manager","rss","application/rss+xml","rtf","text/rtf","rtx","text/richtext","rxn","chemical/x-mdl-rxnfile","sct","text/scriptlet","sd","chemical/x-mdl-sdfile","sd2","audio/x-sd2","sda","application/vnd.stardivision.draw","sdc","application/vnd.stardivision.calc","sdd","application/vnd.stardivision.impress","sdf","chemical/x-mdl-sdfile","sdp","application/vnd.stardivision.impress","sdw","application/vnd.stardivision.writer","ser","application/java-serialized-object","sgf","application/x-go-sgf","sgl","application/vnd.stardivision.writer-global","sh","text/x-sh","shar","application/x-shar","shtml","text/html","sid","audio/prs.sid","sik","application/x-trash","silo","model/mesh","sis","application/vnd.symbian.install","sit","application/x-stuffit","skd","application/x-koan","skm","application/x-koan","skp","application/x-koan","skt","application/x-koan","smf","application/vnd.stardivision.math","smi","application/smil","smil","application/smil","snd","audio/basic","spc","chemical/x-galactic-spc","spl","application/x-futuresplash","src","application/x-wais-source","stc","application/vnd.sun.xml.calc.template","std","application/vnd.sun.xml.draw.template","sti","application/vnd.sun.xml.impress.template","stl","application/vnd.ms-pki.stl","stw","application/vnd.sun.xml.writer.template","sty","text/x-tex","sv4cpio","application/x-sv4cpio","sv4crc","application/x-sv4crc","svg","image/svg+xml","svgz","image/svg+xml","sw","chemical/x-swissprot","swf","application/x-shockwave-flash","swfl","application/x-shockwave-flash","sxc","application/vnd.sun.xml.calc","sxd","application/vnd.sun.xml.draw","sxg","application/vnd.sun.xml.writer.global","sxi","application/vnd.sun.xml.impress","sxm","application/vnd.sun.xml.math","sxw","application/vnd.sun.xml.writer","t","application/x-troff","tar","application/x-tar","taz","application/x-gtar","tcl","text/x-tcl","tex","text/x-tex","texi","application/x-texinfo","texinfo","application/x-texinfo","text","text/plain","tgf","chemical/x-mdl-tgf","tgz","application/x-gtar","tif","image/tiff","tiff","image/tiff","tk","text/x-tcl","tm","text/texmacs","torrent","application/x-bittorrent","tr","application/x-troff","ts","text/texmacs","tsp","application/dsptype","tsv","text/tab-separated-values","txt","text/plain","udeb","application/x-debian-package","uls","text/iuls","ustar","application/x-ustar","val","chemical/x-ncbi-asn1-binary","vcd","application/x-cdlink","vcf","text/x-vcard","vcs","text/x-vcalendar","vmd","chemical/x-vmd","vms","chemical/x-vamas-iso14976","vor","application/vnd.stardivision.writer","vrm","x-world/x-vrml","vrml","x-world/x-vrml","vsd","application/vnd.visio","wad","application/x-doom","wav","audio/x-wav","wax","audio/x-ms-wax","wbmp","image/vnd.wap.wbmp","wbxml","application/vnd.wap.wbxml","wk","application/x-123","wm","video/x-ms-wm","wma","audio/x-ms-wma","wmd","application/x-ms-wmd","wml","text/vnd.wap.wml","wmlc","application/vnd.wap.wmlc","wmls","text/vnd.wap.wmlscript","wmlsc","application/vnd.wap.wmlscriptc","wmv","video/x-ms-wmv","wmx","video/x-ms-wmx","wmz","application/x-ms-wmz","wp5","application/wordperfect5.1","wpd","application/wordperfect","wrl","x-world/x-vrml","wsc","text/scriptlet","wvx","video/x-ms-wvx","wz","application/x-wingz","xbm","image/x-xbitmap","xcf","application/x-xcf","xht","application/xhtml+xml","xhtml","application/xhtml+xml","xlb","application/vnd.ms-excel","xls","application/vnd.ms-excel","xlt","application/vnd.ms-excel","xml","application/xml","xpi","application/x-xpinstall","xpm","image/x-xpixmap","xsl","application/xml","xtel","chemical/x-xtel","xul","application/vnd.mozilla.xul+xml","xwd","image/x-xwindowdump","xyz","chemical/x-xyz","zip","application/zip","zmt","chemical/x-mopac-input","~","application/x-trash"]);
  60146. return $1;
  60147. },
  60148. args: [],
  60149. 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}",
  60150. referencedClasses: [],
  60151. messageSends: []
  60152. }),
  60153. $globals.FileServer.klass);
  60154. $core.addMethod(
  60155. $core.method({
  60156. selector: "defaultPort",
  60157. protocol: 'accessing',
  60158. fn: function (){
  60159. var self=this;
  60160. return (4000);
  60161. },
  60162. args: [],
  60163. source: "defaultPort\x0a\x09^ 4000",
  60164. referencedClasses: [],
  60165. messageSends: []
  60166. }),
  60167. $globals.FileServer.klass);
  60168. $core.addMethod(
  60169. $core.method({
  60170. selector: "main",
  60171. protocol: 'initialization',
  60172. fn: function (){
  60173. var self=this;
  60174. var fileServer,args;
  60175. function $FileServer(){return $globals.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  60176. return $core.withContext(function($ctx1) {
  60177. var $1,$2;
  60178. var $early={};
  60179. try {
  60180. args=$recv(process)._argv();
  60181. $recv(args)._removeFrom_to_((1),(3));
  60182. $recv(args)._detect_ifNone_((function(each){
  60183. return $core.withContext(function($ctx2) {
  60184. $1=$recv(each).__eq("--help");
  60185. if($core.assert($1)){
  60186. return $recv($FileServer())._printHelp();
  60187. };
  60188. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60189. }),(function(){
  60190. return $core.withContext(function($ctx2) {
  60191. fileServer=$recv($FileServer())._createServerWithArguments_(args);
  60192. fileServer;
  60193. $2=$recv(fileServer)._start();
  60194. throw $early=[$2];
  60195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  60196. }));
  60197. return self;
  60198. }
  60199. catch(e) {if(e===$early)return e[0]; throw e}
  60200. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.klass)});
  60201. },
  60202. args: [],
  60203. 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]",
  60204. referencedClasses: ["FileServer"],
  60205. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  60206. }),
  60207. $globals.FileServer.klass);
  60208. $core.addMethod(
  60209. $core.method({
  60210. selector: "mimeTypeFor:",
  60211. protocol: 'accessing',
  60212. fn: function (aString){
  60213. var self=this;
  60214. return $core.withContext(function($ctx1) {
  60215. var $1;
  60216. $1=$recv(self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  60217. return "text/plain";
  60218. }));
  60219. return $1;
  60220. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.klass)});
  60221. },
  60222. args: ["aString"],
  60223. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  60224. referencedClasses: [],
  60225. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  60226. }),
  60227. $globals.FileServer.klass);
  60228. $core.addMethod(
  60229. $core.method({
  60230. selector: "mimeTypes",
  60231. protocol: 'accessing',
  60232. fn: function (){
  60233. var self=this;
  60234. return $core.withContext(function($ctx1) {
  60235. var $2,$1,$receiver;
  60236. $2=self["@mimeTypes"];
  60237. if(($receiver = $2) == null || $receiver.isNil){
  60238. self["@mimeTypes"]=self._defaultMimeTypes();
  60239. $1=self["@mimeTypes"];
  60240. } else {
  60241. $1=$2;
  60242. };
  60243. return $1;
  60244. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.klass)});
  60245. },
  60246. args: [],
  60247. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  60248. referencedClasses: [],
  60249. messageSends: ["ifNil:", "defaultMimeTypes"]
  60250. }),
  60251. $globals.FileServer.klass);
  60252. $core.addMethod(
  60253. $core.method({
  60254. selector: "printHelp",
  60255. protocol: 'accessing',
  60256. fn: function (){
  60257. var self=this;
  60258. return $core.withContext(function($ctx1) {
  60259. $recv(console)._log_("Available commandline options are:");
  60260. $ctx1.sendIdx["log:"]=1;
  60261. $recv(console)._log_("--help");
  60262. $ctx1.sendIdx["log:"]=2;
  60263. $recv(self._commandLineSwitches())._do_((function(each){
  60264. return $core.withContext(function($ctx2) {
  60265. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  60266. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60267. }));
  60268. return self;
  60269. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.klass)});
  60270. },
  60271. args: [],
  60272. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  60273. referencedClasses: [],
  60274. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  60275. }),
  60276. $globals.FileServer.klass);
  60277. $core.addMethod(
  60278. $core.method({
  60279. selector: "selectorForCommandLineSwitch:",
  60280. protocol: 'accessing',
  60281. fn: function (aSwitch){
  60282. var self=this;
  60283. return $core.withContext(function($ctx1) {
  60284. var $2,$1;
  60285. $2=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  60286. return $core.withContext(function($ctx2) {
  60287. return $recv($recv(each)._second())._asUppercase();
  60288. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60289. }));
  60290. $ctx1.sendIdx["replace:with:"]=1;
  60291. $1=$recv($2).__comma(":");
  60292. return $1;
  60293. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.klass)});
  60294. },
  60295. args: ["aSwitch"],
  60296. 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 ]), ':'",
  60297. referencedClasses: [],
  60298. messageSends: [",", "replace:with:", "asUppercase", "second"]
  60299. }),
  60300. $globals.FileServer.klass);
  60301. $core.addClass('Initer', $globals.BaseFileManipulator, ['childProcess', 'nmPath'], 'AmberCli');
  60302. $core.addMethod(
  60303. $core.method({
  60304. selector: "bowerInstallThenDo:",
  60305. protocol: 'action',
  60306. fn: function (aBlock){
  60307. var self=this;
  60308. var child;
  60309. return $core.withContext(function($ctx1) {
  60310. var $1,$4,$3,$2;
  60311. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("bower","bower"),["install"]);
  60312. $1=child;
  60313. $recv($1)._on_do_("error",aBlock);
  60314. $ctx1.sendIdx["on:do:"]=1;
  60315. $2=$recv($1)._on_do_("close",(function(code){
  60316. return $core.withContext(function($ctx2) {
  60317. $4=$recv(code).__eq((0));
  60318. if($core.assert($4)){
  60319. $3=nil;
  60320. } else {
  60321. $3=code;
  60322. };
  60323. return $recv(aBlock)._value_($3);
  60324. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  60325. }));
  60326. return self;
  60327. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  60328. },
  60329. args: ["aBlock"],
  60330. 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 ]) ]",
  60331. referencedClasses: [],
  60332. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  60333. }),
  60334. $globals.Initer);
  60335. $core.addMethod(
  60336. $core.method({
  60337. selector: "finishMessage",
  60338. protocol: 'action',
  60339. fn: function (){
  60340. var self=this;
  60341. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  60342. return $core.withContext(function($ctx1) {
  60343. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($String())._lf()));
  60344. $recv((function(){
  60345. }))._valueWithTimeout_((600));
  60346. return self;
  60347. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  60348. },
  60349. args: [],
  60350. 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",
  60351. referencedClasses: ["String"],
  60352. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  60353. }),
  60354. $globals.Initer);
  60355. $core.addMethod(
  60356. $core.method({
  60357. selector: "gruntInitThenDo:",
  60358. protocol: 'action',
  60359. fn: function (aBlock){
  60360. var self=this;
  60361. var child,sanitizedTemplatePath;
  60362. return $core.withContext(function($ctx1) {
  60363. var $1,$4,$3,$2;
  60364. sanitizedTemplatePath=$recv($recv($recv(self["@path"])._join_with_(self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  60365. $ctx1.sendIdx["replace:with:"]=1;
  60366. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  60367. $1=child;
  60368. $recv($1)._on_do_("error",aBlock);
  60369. $ctx1.sendIdx["on:do:"]=1;
  60370. $2=$recv($1)._on_do_("close",(function(code){
  60371. return $core.withContext(function($ctx2) {
  60372. $4=$recv(code).__eq((0));
  60373. if($core.assert($4)){
  60374. $3=nil;
  60375. } else {
  60376. $3=code;
  60377. };
  60378. return $recv(aBlock)._value_($3);
  60379. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  60380. }));
  60381. return self;
  60382. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  60383. },
  60384. args: ["aBlock"],
  60385. 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 ]) ]",
  60386. referencedClasses: [],
  60387. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  60388. }),
  60389. $globals.Initer);
  60390. $core.addMethod(
  60391. $core.method({
  60392. selector: "gruntThenDo:",
  60393. protocol: 'action',
  60394. fn: function (aBlock){
  60395. var self=this;
  60396. var child;
  60397. return $core.withContext(function($ctx1) {
  60398. var $1,$4,$3,$2;
  60399. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
  60400. $1=child;
  60401. $recv($1)._on_do_("error",aBlock);
  60402. $ctx1.sendIdx["on:do:"]=1;
  60403. $2=$recv($1)._on_do_("close",(function(code){
  60404. return $core.withContext(function($ctx2) {
  60405. $4=$recv(code).__eq((0));
  60406. if($core.assert($4)){
  60407. $3=nil;
  60408. } else {
  60409. $3=code;
  60410. };
  60411. return $recv(aBlock)._value_($3);
  60412. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  60413. }));
  60414. return self;
  60415. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  60416. },
  60417. args: ["aBlock"],
  60418. 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 ]) ]",
  60419. referencedClasses: [],
  60420. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  60421. }),
  60422. $globals.Initer);
  60423. $core.addMethod(
  60424. $core.method({
  60425. selector: "initialize",
  60426. protocol: 'initialization',
  60427. fn: function (){
  60428. var self=this;
  60429. return $core.withContext(function($ctx1) {
  60430. (
  60431. $ctx1.supercall = true,
  60432. $globals.Initer.superclass.fn.prototype._initialize.apply($recv(self), []));
  60433. $ctx1.supercall = false;
  60434. self["@childProcess"]=$recv(require)._value_("child_process");
  60435. self["@nmPath"]=$recv(self["@path"])._join_with_(self._rootDirname(),"node_modules");
  60436. return self;
  60437. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  60438. },
  60439. args: [],
  60440. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  60441. referencedClasses: [],
  60442. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  60443. }),
  60444. $globals.Initer);
  60445. $core.addMethod(
  60446. $core.method({
  60447. selector: "npmInstallThenDo:",
  60448. protocol: 'action',
  60449. fn: function (aBlock){
  60450. var self=this;
  60451. var child;
  60452. return $core.withContext(function($ctx1) {
  60453. var $1;
  60454. child=$recv(self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  60455. $1=$recv(child)._stdout();
  60456. $ctx1.sendIdx["stdout"]=1;
  60457. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  60458. return self;
  60459. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  60460. },
  60461. args: ["aBlock"],
  60462. 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 }",
  60463. referencedClasses: [],
  60464. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  60465. }),
  60466. $globals.Initer);
  60467. $core.addMethod(
  60468. $core.method({
  60469. selector: "npmScriptForModule:named:",
  60470. protocol: 'npm',
  60471. fn: function (aString,anotherString){
  60472. var self=this;
  60473. var modulePath,packageJson,binSection,scriptPath;
  60474. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  60475. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  60476. return $core.withContext(function($ctx1) {
  60477. var $1,$3,$4,$2,$5,$6;
  60478. $1=self["@path"];
  60479. $3=$recv($JSObjectProxy())._on_(require);
  60480. $4=$recv(aString).__comma("/package.json");
  60481. $ctx1.sendIdx[","]=1;
  60482. $2=$recv($3)._resolve_($4);
  60483. modulePath=$recv($1)._dirname_($2);
  60484. packageJson=$recv($Smalltalk())._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  60485. binSection=$recv(packageJson)._at_("bin");
  60486. $ctx1.sendIdx["at:"]=1;
  60487. $5=$recv(binSection)._isString();
  60488. if($core.assert($5)){
  60489. scriptPath=binSection;
  60490. } else {
  60491. scriptPath=$recv(binSection)._at_(anotherString);
  60492. };
  60493. $6=$recv(self["@path"])._join_with_(modulePath,scriptPath);
  60494. return $6;
  60495. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  60496. },
  60497. args: ["aString", "anotherString"],
  60498. 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",
  60499. referencedClasses: ["JSObjectProxy", "Smalltalk"],
  60500. messageSends: ["dirname:", "resolve:", "on:", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  60501. }),
  60502. $globals.Initer);
  60503. $core.addMethod(
  60504. $core.method({
  60505. selector: "start",
  60506. protocol: 'action',
  60507. fn: function (){
  60508. var self=this;
  60509. return $core.withContext(function($ctx1) {
  60510. var $1,$2,$3,$4,$5,$6,$7,$8,$receiver;
  60511. self._gruntInitThenDo_((function(error){
  60512. return $core.withContext(function($ctx2) {
  60513. if(($receiver = error) == null || $receiver.isNil){
  60514. return self._bowerInstallThenDo_((function(error2){
  60515. return $core.withContext(function($ctx3) {
  60516. if(($receiver = error2) == null || $receiver.isNil){
  60517. return self._npmInstallThenDo_((function(error3){
  60518. return $core.withContext(function($ctx4) {
  60519. if(($receiver = error3) == null || $receiver.isNil){
  60520. return self._gruntThenDo_((function(error4){
  60521. return $core.withContext(function($ctx5) {
  60522. if(($receiver = error4) == null || $receiver.isNil){
  60523. self._finishMessage();
  60524. return $recv(process)._exit();
  60525. } else {
  60526. $7=console;
  60527. $recv($7)._log_("grunt exec error:");
  60528. $ctx5.sendIdx["log:"]=7;
  60529. $8=$recv($7)._log_(error4);
  60530. $8;
  60531. return $recv(process)._exit_((104));
  60532. };
  60533. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  60534. }));
  60535. } else {
  60536. $5=console;
  60537. $recv($5)._log_("npm install exec error:");
  60538. $ctx4.sendIdx["log:"]=5;
  60539. $6=$recv($5)._log_(error3);
  60540. $ctx4.sendIdx["log:"]=6;
  60541. $6;
  60542. return $recv(process)._exit_((103));
  60543. $ctx4.sendIdx["exit:"]=3;
  60544. };
  60545. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  60546. }));
  60547. } else {
  60548. $3=console;
  60549. $recv($3)._log_("bower install exec error:");
  60550. $ctx3.sendIdx["log:"]=3;
  60551. $4=$recv($3)._log_(error2);
  60552. $ctx3.sendIdx["log:"]=4;
  60553. $4;
  60554. return $recv(process)._exit_((102));
  60555. $ctx3.sendIdx["exit:"]=2;
  60556. };
  60557. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  60558. }));
  60559. } else {
  60560. $1=console;
  60561. $recv($1)._log_("grunt-init exec error:");
  60562. $ctx2.sendIdx["log:"]=1;
  60563. $2=$recv($1)._log_(error);
  60564. $ctx2.sendIdx["log:"]=2;
  60565. $2;
  60566. return $recv(process)._exit_((101));
  60567. $ctx2.sendIdx["exit:"]=1;
  60568. };
  60569. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  60570. }));
  60571. return self;
  60572. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  60573. },
  60574. args: [],
  60575. 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 ]]]]]]]]",
  60576. referencedClasses: [],
  60577. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
  60578. }),
  60579. $globals.Initer);
  60580. $core.addClass('Repl', $globals.Object, ['readline', 'interface', 'util', 'session', 'resultCount', 'commands'], 'AmberCli');
  60581. $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.";
  60582. $core.addMethod(
  60583. $core.method({
  60584. selector: "addVariableNamed:to:",
  60585. protocol: 'private',
  60586. fn: function (aString,anObject){
  60587. var self=this;
  60588. var newClass,newObject;
  60589. return $core.withContext(function($ctx1) {
  60590. var $1;
  60591. newClass=self._subclass_withVariable_($recv(anObject)._class(),aString);
  60592. self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  60593. newObject=$recv(newClass)._new();
  60594. self._setPreviousVariablesFor_from_(newObject,anObject);
  60595. $1=newObject;
  60596. return $1;
  60597. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  60598. },
  60599. args: ["aString", "anObject"],
  60600. 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",
  60601. referencedClasses: [],
  60602. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  60603. }),
  60604. $globals.Repl);
  60605. $core.addMethod(
  60606. $core.method({
  60607. selector: "assignNewVariable:do:",
  60608. protocol: 'private',
  60609. fn: function (buffer,aBlock){
  60610. var self=this;
  60611. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  60612. function $ConsoleErrorHandler(){return $globals.ConsoleErrorHandler||(typeof ConsoleErrorHandler=="undefined"?nil:ConsoleErrorHandler)}
  60613. return $core.withContext(function($ctx1) {
  60614. var $3,$4,$2,$1,$receiver;
  60615. $1=self._parseAssignment_do_(buffer,(function(name,expr){
  60616. var varName,value;
  60617. return $core.withContext(function($ctx2) {
  60618. if(($receiver = name) == null || $receiver.isNil){
  60619. varName=self._nextResultName();
  60620. } else {
  60621. varName=name;
  60622. };
  60623. varName;
  60624. self["@session"]=self._addVariableNamed_to_(varName,self["@session"]);
  60625. self["@session"];
  60626. $recv((function(){
  60627. return $core.withContext(function($ctx3) {
  60628. $3=$recv(varName).__comma(" := ");
  60629. if(($receiver = expr) == null || $receiver.isNil){
  60630. $4=buffer;
  60631. } else {
  60632. $4=expr;
  60633. };
  60634. $2=$recv($3).__comma($4);
  60635. $ctx3.sendIdx[","]=1;
  60636. value=self._eval_on_($2,self["@session"]);
  60637. return value;
  60638. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  60639. }))._on_do_($Error(),(function(e){
  60640. return $core.withContext(function($ctx3) {
  60641. $recv($recv($ConsoleErrorHandler())._new())._logError_(e);
  60642. value=nil;
  60643. return value;
  60644. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  60645. }));
  60646. return $recv(aBlock)._value_value_(varName,value);
  60647. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  60648. }));
  60649. return $1;
  60650. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  60651. },
  60652. args: ["buffer", "aBlock"],
  60653. 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]",
  60654. referencedClasses: ["Error", "ConsoleErrorHandler"],
  60655. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  60656. }),
  60657. $globals.Repl);
  60658. $core.addMethod(
  60659. $core.method({
  60660. selector: "clearScreen",
  60661. protocol: 'actions',
  60662. fn: function (){
  60663. var self=this;
  60664. var esc,cls;
  60665. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  60666. return $core.withContext(function($ctx1) {
  60667. var $1;
  60668. esc=$recv($String())._fromCharCode_((27));
  60669. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  60670. $ctx1.sendIdx[","]=2;
  60671. cls=$recv($1).__comma("[0;0f");
  60672. $ctx1.sendIdx[","]=1;
  60673. $recv($recv(process)._stdout())._write_(cls);
  60674. $recv(self["@interface"])._prompt();
  60675. return self;
  60676. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  60677. },
  60678. args: [],
  60679. 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",
  60680. referencedClasses: ["String"],
  60681. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  60682. }),
  60683. $globals.Repl);
  60684. $core.addMethod(
  60685. $core.method({
  60686. selector: "close",
  60687. protocol: 'actions',
  60688. fn: function (){
  60689. var self=this;
  60690. return $core.withContext(function($ctx1) {
  60691. $recv($recv(process)._stdin())._destroy();
  60692. return self;
  60693. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  60694. },
  60695. args: [],
  60696. source: "close\x0a\x09process stdin destroy",
  60697. referencedClasses: [],
  60698. messageSends: ["destroy", "stdin"]
  60699. }),
  60700. $globals.Repl);
  60701. $core.addMethod(
  60702. $core.method({
  60703. selector: "commands",
  60704. protocol: 'accessing',
  60705. fn: function (){
  60706. var self=this;
  60707. var $1;
  60708. $1=self["@commands"];
  60709. return $1;
  60710. },
  60711. args: [],
  60712. source: "commands\x0a\x09^ commands",
  60713. referencedClasses: [],
  60714. messageSends: []
  60715. }),
  60716. $globals.Repl);
  60717. $core.addMethod(
  60718. $core.method({
  60719. selector: "createInterface",
  60720. protocol: 'actions',
  60721. fn: function (){
  60722. var self=this;
  60723. return $core.withContext(function($ctx1) {
  60724. var $1;
  60725. self["@interface"]=$recv(self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  60726. $recv(self["@interface"])._on_do_("line",(function(buffer){
  60727. return $core.withContext(function($ctx2) {
  60728. return self._processLine_(buffer);
  60729. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  60730. }));
  60731. $ctx1.sendIdx["on:do:"]=1;
  60732. $recv(self["@interface"])._on_do_("close",(function(){
  60733. return $core.withContext(function($ctx2) {
  60734. return self._close();
  60735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60736. }));
  60737. self._printWelcome();
  60738. self._setupHotkeys();
  60739. $1=self._setPrompt();
  60740. $recv(self["@interface"])._prompt();
  60741. return self;
  60742. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  60743. },
  60744. args: [],
  60745. 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",
  60746. referencedClasses: [],
  60747. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  60748. }),
  60749. $globals.Repl);
  60750. $core.addMethod(
  60751. $core.method({
  60752. selector: "encapsulateVariable:withValue:in:",
  60753. protocol: 'private',
  60754. fn: function (aString,anObject,aClass){
  60755. var self=this;
  60756. var compiler;
  60757. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  60758. return $core.withContext(function($ctx1) {
  60759. var $1,$4,$3,$2,$5,$6;
  60760. compiler=$recv($Compiler())._new();
  60761. $1=compiler;
  60762. $4=$recv(aString).__comma(": anObject ^ ");
  60763. $ctx1.sendIdx[","]=3;
  60764. $3=$recv($4).__comma(aString);
  60765. $ctx1.sendIdx[","]=2;
  60766. $2=$recv($3).__comma(" := anObject");
  60767. $ctx1.sendIdx[","]=1;
  60768. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  60769. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  60770. $5=compiler;
  60771. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  60772. $ctx1.sendIdx[","]=4;
  60773. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  60774. return self;
  60775. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  60776. },
  60777. args: ["aString", "anObject", "aClass"],
  60778. 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'.",
  60779. referencedClasses: ["Compiler"],
  60780. messageSends: ["new", "install:forClass:protocol:", ","]
  60781. }),
  60782. $globals.Repl);
  60783. $core.addMethod(
  60784. $core.method({
  60785. selector: "eval:",
  60786. protocol: 'actions',
  60787. fn: function (buffer){
  60788. var self=this;
  60789. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  60790. return $core.withContext(function($ctx1) {
  60791. var $1;
  60792. $1=self._eval_on_(buffer,$recv($DoIt())._new());
  60793. return $1;
  60794. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  60795. },
  60796. args: ["buffer"],
  60797. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  60798. referencedClasses: ["DoIt"],
  60799. messageSends: ["eval:on:", "new"]
  60800. }),
  60801. $globals.Repl);
  60802. $core.addMethod(
  60803. $core.method({
  60804. selector: "eval:on:",
  60805. protocol: 'actions',
  60806. fn: function (buffer,anObject){
  60807. var self=this;
  60808. var result;
  60809. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  60810. return $core.withContext(function($ctx1) {
  60811. var $1,$2,$3;
  60812. $1=$recv(buffer)._isEmpty();
  60813. if(!$core.assert($1)){
  60814. $recv((function(){
  60815. return $core.withContext(function($ctx2) {
  60816. result=$recv($recv($Compiler())._new())._evaluateExpression_on_(buffer,anObject);
  60817. return result;
  60818. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60819. }))._tryCatch_((function(e){
  60820. return $core.withContext(function($ctx2) {
  60821. $2=$recv(e)._isSmalltalkError();
  60822. if($core.assert($2)){
  60823. return $recv(e)._resignal();
  60824. } else {
  60825. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  60826. };
  60827. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,3)});
  60828. }));
  60829. };
  60830. $3=result;
  60831. return $3;
  60832. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  60833. },
  60834. args: ["buffer", "anObject"],
  60835. 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",
  60836. referencedClasses: ["Compiler"],
  60837. messageSends: ["ifFalse:", "isEmpty", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"]
  60838. }),
  60839. $globals.Repl);
  60840. $core.addMethod(
  60841. $core.method({
  60842. selector: "executeCommand:",
  60843. protocol: 'private',
  60844. fn: function (aString){
  60845. var self=this;
  60846. return $core.withContext(function($ctx1) {
  60847. var $1;
  60848. var $early={};
  60849. try {
  60850. $recv(self._commands())._keysAndValuesDo_((function(names,cmd){
  60851. return $core.withContext(function($ctx2) {
  60852. $1=$recv(names)._includes_(aString);
  60853. if($core.assert($1)){
  60854. $recv(cmd)._value();
  60855. throw $early=[true];
  60856. };
  60857. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  60858. }));
  60859. return false;
  60860. }
  60861. catch(e) {if(e===$early)return e[0]; throw e}
  60862. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  60863. },
  60864. args: ["aString"],
  60865. 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",
  60866. referencedClasses: [],
  60867. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  60868. }),
  60869. $globals.Repl);
  60870. $core.addMethod(
  60871. $core.method({
  60872. selector: "initialize",
  60873. protocol: 'initialization',
  60874. fn: function (){
  60875. var self=this;
  60876. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  60877. return $core.withContext(function($ctx1) {
  60878. (
  60879. $ctx1.supercall = true,
  60880. $globals.Repl.superclass.fn.prototype._initialize.apply($recv(self), []));
  60881. $ctx1.supercall = false;
  60882. self["@session"]=$recv($DoIt())._new();
  60883. self["@readline"]=$recv(require)._value_("readline");
  60884. $ctx1.sendIdx["value:"]=1;
  60885. self["@util"]=$recv(require)._value_("util");
  60886. self._setupCommands();
  60887. return self;
  60888. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  60889. },
  60890. args: [],
  60891. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  60892. referencedClasses: ["DoIt"],
  60893. messageSends: ["initialize", "new", "value:", "setupCommands"]
  60894. }),
  60895. $globals.Repl);
  60896. $core.addMethod(
  60897. $core.method({
  60898. selector: "instanceVariableNamesFor:",
  60899. protocol: 'private',
  60900. fn: function (aClass){
  60901. var self=this;
  60902. return $core.withContext(function($ctx1) {
  60903. var $2,$3,$1,$receiver;
  60904. $2=$recv(aClass)._superclass();
  60905. $ctx1.sendIdx["superclass"]=1;
  60906. if(($receiver = $2) == null || $receiver.isNil){
  60907. $1=$recv(aClass)._instanceVariableNames();
  60908. } else {
  60909. $3=$recv(aClass)._instanceVariableNames();
  60910. $ctx1.sendIdx["instanceVariableNames"]=1;
  60911. $1=$recv($3)._copyWithAll_(self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  60912. };
  60913. return $1;
  60914. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  60915. },
  60916. args: ["aClass"],
  60917. 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]",
  60918. referencedClasses: [],
  60919. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  60920. }),
  60921. $globals.Repl);
  60922. $core.addMethod(
  60923. $core.method({
  60924. selector: "isIdentifier:",
  60925. protocol: 'private',
  60926. fn: function (aString){
  60927. var self=this;
  60928. return $core.withContext(function($ctx1) {
  60929. var $1;
  60930. $1=$recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  60931. return $1;
  60932. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  60933. },
  60934. args: ["aString"],
  60935. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  60936. referencedClasses: [],
  60937. messageSends: ["match:", "asRegexp"]
  60938. }),
  60939. $globals.Repl);
  60940. $core.addMethod(
  60941. $core.method({
  60942. selector: "isVariableDefined:",
  60943. protocol: 'private',
  60944. fn: function (aString){
  60945. var self=this;
  60946. return $core.withContext(function($ctx1) {
  60947. var $1;
  60948. $1=$recv(self._instanceVariableNamesFor_($recv(self["@session"])._class()))._includes_(aString);
  60949. return $1;
  60950. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  60951. },
  60952. args: ["aString"],
  60953. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  60954. referencedClasses: [],
  60955. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  60956. }),
  60957. $globals.Repl);
  60958. $core.addMethod(
  60959. $core.method({
  60960. selector: "nextResultName",
  60961. protocol: 'private',
  60962. fn: function (){
  60963. var self=this;
  60964. return $core.withContext(function($ctx1) {
  60965. var $1,$2,$receiver;
  60966. $1=self["@resultCount"];
  60967. if(($receiver = $1) == null || $receiver.isNil){
  60968. self["@resultCount"]=(1);
  60969. } else {
  60970. self["@resultCount"]=$recv(self["@resultCount"]).__plus((1));
  60971. };
  60972. $2="res".__comma($recv(self["@resultCount"])._asString());
  60973. return $2;
  60974. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  60975. },
  60976. args: [],
  60977. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  60978. referencedClasses: [],
  60979. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  60980. }),
  60981. $globals.Repl);
  60982. $core.addMethod(
  60983. $core.method({
  60984. selector: "onKeyPress:",
  60985. protocol: 'private',
  60986. fn: function (key){
  60987. var self=this;
  60988. return $core.withContext(function($ctx1) {
  60989. var $1;
  60990. $1=$recv($recv(key)._ctrl())._and_((function(){
  60991. return $core.withContext(function($ctx2) {
  60992. return $recv($recv(key)._name()).__eq("l");
  60993. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60994. }));
  60995. if($core.assert($1)){
  60996. self._clearScreen();
  60997. };
  60998. return self;
  60999. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  61000. },
  61001. args: ["key"],
  61002. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  61003. referencedClasses: [],
  61004. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  61005. }),
  61006. $globals.Repl);
  61007. $core.addMethod(
  61008. $core.method({
  61009. selector: "parseAssignment:do:",
  61010. protocol: 'private',
  61011. fn: function (aString,aBlock){
  61012. var self=this;
  61013. var assignment;
  61014. return $core.withContext(function($ctx1) {
  61015. var $3,$2,$1;
  61016. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  61017. return $core.withContext(function($ctx2) {
  61018. return $recv(s)._trimBoth();
  61019. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  61020. }));
  61021. $2=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  61022. return $core.withContext(function($ctx2) {
  61023. $3=$recv(assignment)._first();
  61024. $ctx2.sendIdx["first"]=1;
  61025. return self._isIdentifier_($3);
  61026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61027. }));
  61028. if($core.assert($2)){
  61029. $1=$recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  61030. $ctx1.sendIdx["value:value:"]=1;
  61031. } else {
  61032. $1=$recv(aBlock)._value_value_(nil,nil);
  61033. };
  61034. return $1;
  61035. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  61036. },
  61037. args: ["aString", "aBlock"],
  61038. 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 ]",
  61039. referencedClasses: [],
  61040. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  61041. }),
  61042. $globals.Repl);
  61043. $core.addMethod(
  61044. $core.method({
  61045. selector: "presentResultNamed:withValue:",
  61046. protocol: 'private',
  61047. fn: function (varName,value){
  61048. var self=this;
  61049. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  61050. return $core.withContext(function($ctx1) {
  61051. var $3,$2,$1,$4;
  61052. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  61053. $ctx1.sendIdx[","]=3;
  61054. $2=$recv($3).__comma(" = ");
  61055. $ctx1.sendIdx[","]=2;
  61056. $1=$recv($2).__comma($recv(value)._asString());
  61057. $ctx1.sendIdx[","]=1;
  61058. $recv($Transcript())._show_($1);
  61059. $4=$recv($Transcript())._cr();
  61060. $recv(self["@interface"])._prompt();
  61061. return self;
  61062. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  61063. },
  61064. args: ["varName", "value"],
  61065. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  61066. referencedClasses: ["Transcript"],
  61067. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  61068. }),
  61069. $globals.Repl);
  61070. $core.addMethod(
  61071. $core.method({
  61072. selector: "printWelcome",
  61073. protocol: 'actions',
  61074. fn: function (){
  61075. var self=this;
  61076. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  61077. return $core.withContext(function($ctx1) {
  61078. var $1;
  61079. $recv($Transcript())._show_("Type :q to exit.");
  61080. $1=$recv($Transcript())._cr();
  61081. return self;
  61082. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  61083. },
  61084. args: [],
  61085. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  61086. referencedClasses: ["Transcript"],
  61087. messageSends: ["show:", "cr"]
  61088. }),
  61089. $globals.Repl);
  61090. $core.addMethod(
  61091. $core.method({
  61092. selector: "processLine:",
  61093. protocol: 'private',
  61094. fn: function (buffer){
  61095. var self=this;
  61096. var show;
  61097. return $core.withContext(function($ctx1) {
  61098. var $1,$2;
  61099. show=(function(varName,value){
  61100. return $core.withContext(function($ctx2) {
  61101. return self._presentResultNamed_withValue_(varName,value);
  61102. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  61103. });
  61104. $1=self._executeCommand_(buffer);
  61105. if(!$core.assert($1)){
  61106. $2=self._isVariableDefined_(buffer);
  61107. if($core.assert($2)){
  61108. $recv(show)._value_value_(buffer,$recv(self["@session"])._perform_(buffer));
  61109. } else {
  61110. self._assignNewVariable_do_(buffer,show);
  61111. };
  61112. };
  61113. return self;
  61114. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  61115. },
  61116. args: ["buffer"],
  61117. 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]]",
  61118. referencedClasses: [],
  61119. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  61120. }),
  61121. $globals.Repl);
  61122. $core.addMethod(
  61123. $core.method({
  61124. selector: "prompt",
  61125. protocol: 'accessing',
  61126. fn: function (){
  61127. var self=this;
  61128. return "amber >> ";
  61129. },
  61130. args: [],
  61131. source: "prompt\x0a\x09^ 'amber >> '",
  61132. referencedClasses: [],
  61133. messageSends: []
  61134. }),
  61135. $globals.Repl);
  61136. $core.addMethod(
  61137. $core.method({
  61138. selector: "setPreviousVariablesFor:from:",
  61139. protocol: 'private',
  61140. fn: function (newObject,oldObject){
  61141. var self=this;
  61142. return $core.withContext(function($ctx1) {
  61143. $recv(self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  61144. return $core.withContext(function($ctx2) {
  61145. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  61146. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61147. }));
  61148. return self;
  61149. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  61150. },
  61151. args: ["newObject", "oldObject"],
  61152. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  61153. referencedClasses: [],
  61154. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  61155. }),
  61156. $globals.Repl);
  61157. $core.addMethod(
  61158. $core.method({
  61159. selector: "setPrompt",
  61160. protocol: 'actions',
  61161. fn: function (){
  61162. var self=this;
  61163. return $core.withContext(function($ctx1) {
  61164. $recv(self["@interface"])._setPrompt_(self._prompt());
  61165. return self;
  61166. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  61167. },
  61168. args: [],
  61169. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  61170. referencedClasses: [],
  61171. messageSends: ["setPrompt:", "prompt"]
  61172. }),
  61173. $globals.Repl);
  61174. $core.addMethod(
  61175. $core.method({
  61176. selector: "setupCommands",
  61177. protocol: 'initialization',
  61178. fn: function (){
  61179. var self=this;
  61180. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  61181. return $core.withContext(function($ctx1) {
  61182. var $2,$1;
  61183. $2=$recv([":q"]).__minus_gt((function(){
  61184. return $core.withContext(function($ctx2) {
  61185. return $recv(process)._exit();
  61186. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61187. }));
  61188. $ctx1.sendIdx["->"]=1;
  61189. $1=[$2,$recv([""]).__minus_gt((function(){
  61190. return $core.withContext(function($ctx2) {
  61191. return $recv(self["@interface"])._prompt();
  61192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61193. }))];
  61194. self["@commands"]=$recv($Dictionary())._from_($1);
  61195. return self;
  61196. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  61197. },
  61198. args: [],
  61199. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  61200. referencedClasses: ["Dictionary"],
  61201. messageSends: ["from:", "->", "exit", "prompt"]
  61202. }),
  61203. $globals.Repl);
  61204. $core.addMethod(
  61205. $core.method({
  61206. selector: "setupHotkeys",
  61207. protocol: 'initialization',
  61208. fn: function (){
  61209. var self=this;
  61210. return $core.withContext(function($ctx1) {
  61211. var $receiver;
  61212. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  61213. return $core.withContext(function($ctx2) {
  61214. if(($receiver = key) == null || $receiver.isNil){
  61215. return key;
  61216. } else {
  61217. return self._onKeyPress_(key);
  61218. };
  61219. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  61220. }));
  61221. return self;
  61222. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  61223. },
  61224. args: [],
  61225. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  61226. referencedClasses: [],
  61227. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  61228. }),
  61229. $globals.Repl);
  61230. $core.addMethod(
  61231. $core.method({
  61232. selector: "subclass:withVariable:",
  61233. protocol: 'private',
  61234. fn: function (aClass,varName){
  61235. var self=this;
  61236. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  61237. return $core.withContext(function($ctx1) {
  61238. var $1;
  61239. $1=$recv($recv($ClassBuilder())._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv(self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  61240. return $1;
  61241. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  61242. },
  61243. args: ["aClass", "varName"],
  61244. 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'",
  61245. referencedClasses: ["ClassBuilder"],
  61246. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  61247. }),
  61248. $globals.Repl);
  61249. $core.addMethod(
  61250. $core.method({
  61251. selector: "subclassNameFor:",
  61252. protocol: 'private',
  61253. fn: function (aClass){
  61254. var self=this;
  61255. return $core.withContext(function($ctx1) {
  61256. var $3,$2,$7,$6,$5,$4,$8,$1,$receiver;
  61257. $3=$recv(aClass)._name();
  61258. $ctx1.sendIdx["name"]=1;
  61259. $2=$recv($3)._matchesOf_("\x5cd+$");
  61260. $ctx1.sendIdx["matchesOf:"]=1;
  61261. if(($receiver = $2) == null || $receiver.isNil){
  61262. $1=$recv($recv(aClass)._name()).__comma("2");
  61263. } else {
  61264. var counter;
  61265. $7=$recv(aClass)._name();
  61266. $ctx1.sendIdx["name"]=2;
  61267. $6=$recv($7)._matchesOf_("\x5cd+$");
  61268. $5=$recv($6)._first();
  61269. $4=$recv($5)._asNumber();
  61270. counter=$recv($4).__plus((1));
  61271. counter;
  61272. $8=$recv(aClass)._name();
  61273. $ctx1.sendIdx["name"]=3;
  61274. $1=$recv($8)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  61275. };
  61276. return $1;
  61277. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  61278. },
  61279. args: ["aClass"],
  61280. 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'].",
  61281. referencedClasses: [],
  61282. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  61283. }),
  61284. $globals.Repl);
  61285. $core.addMethod(
  61286. $core.method({
  61287. selector: "main",
  61288. protocol: 'initialization',
  61289. fn: function (){
  61290. var self=this;
  61291. return $core.withContext(function($ctx1) {
  61292. $recv(self._new())._createInterface();
  61293. return self;
  61294. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.klass)});
  61295. },
  61296. args: [],
  61297. source: "main\x0a\x09self new createInterface",
  61298. referencedClasses: [],
  61299. messageSends: ["createInterface", "new"]
  61300. }),
  61301. $globals.Repl.klass);
  61302. });
  61303. (function () {
  61304. define('app',["amber/devel", "amber_cli/AmberCli"], function (amber) {
  61305. amber.initialize();
  61306. amber.globals.AmberCli._main();
  61307. });
  61308. }());
  61309. require(["app"]);
  61310. });
  61311. define.require('__wrap__');
  61312. }((function amdefine(module, requireFn) {
  61313. 'use strict';
  61314. var defineCache = {},
  61315. loaderCache = {},
  61316. alreadyCalled = false,
  61317. path = require('path'),
  61318. makeRequire, stringRequire;
  61319. /**
  61320. * Trims the . and .. from an array of path segments.
  61321. * It will keep a leading path segment if a .. will become
  61322. * the first path segment, to help with module name lookups,
  61323. * which act like paths, but can be remapped. But the end result,
  61324. * all paths that use this function should look normalized.
  61325. * NOTE: this method MODIFIES the input array.
  61326. * @param {Array} ary the array of path segments.
  61327. */
  61328. function trimDots(ary) {
  61329. var i, part;
  61330. for (i = 0; ary[i]; i+= 1) {
  61331. part = ary[i];
  61332. if (part === '.') {
  61333. ary.splice(i, 1);
  61334. i -= 1;
  61335. } else if (part === '..') {
  61336. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  61337. //End of the line. Keep at least one non-dot
  61338. //path segment at the front so it can be mapped
  61339. //correctly to disk. Otherwise, there is likely
  61340. //no path mapping for a path starting with '..'.
  61341. //This can still fail, but catches the most reasonable
  61342. //uses of ..
  61343. break;
  61344. } else if (i > 0) {
  61345. ary.splice(i - 1, 2);
  61346. i -= 2;
  61347. }
  61348. }
  61349. }
  61350. }
  61351. function normalize(name, baseName) {
  61352. var baseParts;
  61353. //Adjust any relative paths.
  61354. if (name && name.charAt(0) === '.') {
  61355. //If have a base name, try to normalize against it,
  61356. //otherwise, assume it is a top-level require that will
  61357. //be relative to baseUrl in the end.
  61358. if (baseName) {
  61359. baseParts = baseName.split('/');
  61360. baseParts = baseParts.slice(0, baseParts.length - 1);
  61361. baseParts = baseParts.concat(name.split('/'));
  61362. trimDots(baseParts);
  61363. name = baseParts.join('/');
  61364. }
  61365. }
  61366. return name;
  61367. }
  61368. /**
  61369. * Create the normalize() function passed to a loader plugin's
  61370. * normalize method.
  61371. */
  61372. function makeNormalize(relName) {
  61373. return function (name) {
  61374. return normalize(name, relName);
  61375. };
  61376. }
  61377. function makeLoad(id) {
  61378. function load(value) {
  61379. loaderCache[id] = value;
  61380. }
  61381. load.fromText = function (id, text) {
  61382. //This one is difficult because the text can/probably uses
  61383. //define, and any relative paths and requires should be relative
  61384. //to that id was it would be found on disk. But this would require
  61385. //bootstrapping a module/require fairly deeply from node core.
  61386. //Not sure how best to go about that yet.
  61387. throw new Error('amdefine does not implement load.fromText');
  61388. };
  61389. return load;
  61390. }
  61391. makeRequire = function (systemRequire, exports, module, relId) {
  61392. function amdRequire(deps, callback) {
  61393. if (typeof deps === 'string') {
  61394. //Synchronous, single module require('')
  61395. return stringRequire(systemRequire, exports, module, deps, relId);
  61396. } else {
  61397. //Array of dependencies with a callback.
  61398. //Convert the dependencies to modules.
  61399. deps = deps.map(function (depName) {
  61400. return stringRequire(systemRequire, exports, module, depName, relId);
  61401. });
  61402. //Wait for next tick to call back the require call.
  61403. if (callback) {
  61404. process.nextTick(function () {
  61405. callback.apply(null, deps);
  61406. });
  61407. }
  61408. }
  61409. }
  61410. amdRequire.toUrl = function (filePath) {
  61411. if (filePath.indexOf('.') === 0) {
  61412. return normalize(filePath, path.dirname(module.filename));
  61413. } else {
  61414. return filePath;
  61415. }
  61416. };
  61417. return amdRequire;
  61418. };
  61419. //Favor explicit value, passed in if the module wants to support Node 0.4.
  61420. requireFn = requireFn || function req() {
  61421. return module.require.apply(module, arguments);
  61422. };
  61423. function runFactory(id, deps, factory) {
  61424. var r, e, m, result;
  61425. if (id) {
  61426. e = loaderCache[id] = {};
  61427. m = {
  61428. id: id,
  61429. uri: __filename,
  61430. exports: e
  61431. };
  61432. r = makeRequire(requireFn, e, m, id);
  61433. } else {
  61434. //Only support one define call per file
  61435. if (alreadyCalled) {
  61436. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  61437. }
  61438. alreadyCalled = true;
  61439. //Use the real variables from node
  61440. //Use module.exports for exports, since
  61441. //the exports in here is amdefine exports.
  61442. e = module.exports;
  61443. m = module;
  61444. r = makeRequire(requireFn, e, m, module.id);
  61445. }
  61446. //If there are dependencies, they are strings, so need
  61447. //to convert them to dependency values.
  61448. if (deps) {
  61449. deps = deps.map(function (depName) {
  61450. return r(depName);
  61451. });
  61452. }
  61453. //Call the factory with the right dependencies.
  61454. if (typeof factory === 'function') {
  61455. result = factory.apply(m.exports, deps);
  61456. } else {
  61457. result = factory;
  61458. }
  61459. if (result !== undefined) {
  61460. m.exports = result;
  61461. if (id) {
  61462. loaderCache[id] = m.exports;
  61463. }
  61464. }
  61465. }
  61466. stringRequire = function (systemRequire, exports, module, id, relId) {
  61467. //Split the ID by a ! so that
  61468. var index = id.indexOf('!'),
  61469. originalId = id,
  61470. prefix, plugin;
  61471. if (index === -1) {
  61472. id = normalize(id, relId);
  61473. //Straight module lookup. If it is one of the special dependencies,
  61474. //deal with it, otherwise, delegate to node.
  61475. if (id === 'require') {
  61476. return makeRequire(systemRequire, exports, module, relId);
  61477. } else if (id === 'exports') {
  61478. return exports;
  61479. } else if (id === 'module') {
  61480. return module;
  61481. } else if (loaderCache.hasOwnProperty(id)) {
  61482. return loaderCache[id];
  61483. } else if (defineCache[id]) {
  61484. runFactory.apply(null, defineCache[id]);
  61485. return loaderCache[id];
  61486. } else {
  61487. if(systemRequire) {
  61488. return systemRequire(originalId);
  61489. } else {
  61490. throw new Error('No module with ID: ' + id);
  61491. }
  61492. }
  61493. } else {
  61494. //There is a plugin in play.
  61495. prefix = id.substring(0, index);
  61496. id = id.substring(index + 1, id.length);
  61497. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  61498. if (plugin.normalize) {
  61499. id = plugin.normalize(id, makeNormalize(relId));
  61500. } else {
  61501. //Normalize the ID normally.
  61502. id = normalize(id, relId);
  61503. }
  61504. if (loaderCache[id]) {
  61505. return loaderCache[id];
  61506. } else {
  61507. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  61508. return loaderCache[id];
  61509. }
  61510. }
  61511. };
  61512. //Create a define function specific to the module asking for amdefine.
  61513. function define(id, deps, factory) {
  61514. if (Array.isArray(id)) {
  61515. factory = deps;
  61516. deps = id;
  61517. id = undefined;
  61518. } else if (typeof id !== 'string') {
  61519. factory = id;
  61520. id = deps = undefined;
  61521. }
  61522. if (deps && !Array.isArray(deps)) {
  61523. factory = deps;
  61524. deps = undefined;
  61525. }
  61526. if (!deps) {
  61527. deps = ['require', 'exports', 'module'];
  61528. }
  61529. //Set up properties for this module. If an ID, then use
  61530. //internal cache. If no ID, then use the external variables
  61531. //for this node module.
  61532. if (id) {
  61533. //Put the module in deep freeze until there is a
  61534. //require call for it.
  61535. defineCache[id] = [id, deps, factory];
  61536. } else {
  61537. runFactory(id, deps, factory);
  61538. }
  61539. }
  61540. //define.require, which has access to all the values in the
  61541. //cache. Useful for AMD modules that all have IDs in the file,
  61542. //but need to finally export a value to node based on one of those
  61543. //IDs.
  61544. define.require = function (id) {
  61545. if (loaderCache[id]) {
  61546. return loaderCache[id];
  61547. }
  61548. if (defineCache[id]) {
  61549. runFactory.apply(null, defineCache[id]);
  61550. return loaderCache[id];
  61551. }
  61552. };
  61553. define.amd = {};
  61554. return define;
  61555. }(module)), require));