12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968 |
- #!/usr/bin/env node
- (function(define, require){
- define('__wrap__', function (requirejs) {
- requirejs.resolve = require.resolve;
- require = requirejs;
- // This file is used to make additional changes
- // when building an app to run in node.js.
- // Free to edit. You can break tests (cli test runner uses
- // this to build itself - it is a node executable).
- define("amber/Platform", ["amber_core/Platform-Node"], {});
- define("amber/browser-compatibility", {});
- define("jquery", {});
- define("config-node", function(){});
- /* ====================================================================
- |
- | Amber Smalltalk
- | http://amber-lang.net
- |
- ======================================================================
- ======================================================================
- |
- | Copyright (c) 2010-2014
- | Nicolas Petton <petton.nicolas@gmail.com>
- |
- | Copyright (c) 2012-2014
- | The Amber team https://github.com/amber-smalltalk?tab=members
- | Amber contributors https://github.com/amber-smalltalk/amber/graphs/contributors
- |
- | Amber is released under the MIT license
- |
- | Permission is hereby granted, free of charge, to any person obtaining
- | a copy of this software and associated documentation files (the
- | 'Software'), to deal in the Software without restriction, including
- | without limitation the rights to use, copy, modify, merge, publish,
- | distribute, sublicense, and/or sell copies of the Software, and to
- | permit persons to whom the Software is furnished to do so, subject to
- | the following conditions:
- |
- | The above copyright notice and this permission notice shall be
- | included in all copies or substantial portions of the Software.
- |
- | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
- | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- |
- ==================================================================== */
- //jshint eqnull:true
- define("amber/boot", ['require', './browser-compatibility'], function (require) {
- /* Reconfigurable micro composition system, https://github.com/amber-smalltalk/brikz */
- function Brikz(api, apiKey, initKey) {
- var brikz = this, backup = {};
- apiKey = apiKey || 'exports';
- initKey = initKey || '__init__';
- function mixin(src, target, what) {
- for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
- if (src == null) {
- target[keys[i]] = undefined;
- } else {
- var value = src[keys[i]];
- if (typeof value !== "undefined") {
- target[keys[i]] = value;
- }
- }
- }
- return target;
- }
- var d = {value: null, enumerable: false, configurable: true, writable: true};
- Object.defineProperties(this, {ensure: d, rebuild: d});
- var exclude = mixin(this, {});
- this.rebuild = function () {
- Object.keys(backup).forEach(function (key) {
- mixin(null, api, (backup[key] || 0)[apiKey] || {});
- });
- var oapi = mixin(api, {}), order = [], chk = {};
- brikz.ensure = function (key) {
- if (key in exclude) {
- return null;
- }
- var b = brikz[key], bak = backup[key];
- mixin(null, api, api);
- while (typeof b === "function") {
- b = new b(brikz, api, bak);
- }
- if (b && !chk[key]) {
- chk[key] = true;
- order.push(b);
- }
- if (b && !b[apiKey]) {
- b[apiKey] = mixin(api, {});
- }
- brikz[key] = b;
- return b;
- };
- Object.keys(brikz).forEach(function (key) {
- brikz.ensure(key);
- });
- brikz.ensure = null;
- mixin(oapi, mixin(null, api, api));
- order.forEach(function (brik) {
- mixin(brik[apiKey] || {}, api);
- });
- order.forEach(function (brik) {
- if (brik[initKey]) brik[initKey]();
- });
- backup = mixin(brikz, {});
- };
- }
- /* Brikz end */
- function inherits(child, parent) {
- child.prototype = Object.create(parent.prototype, {
- constructor: {
- value: child,
- enumerable: false, configurable: true, writable: true
- }
- });
- return child;
- }
- var globals = {};
- globals.SmalltalkSettings = {};
- var api = {};
- var brikz = new Brikz(api);
- function RootBrik(brikz, st) {
- /* Smalltalk foundational objects */
- /* SmalltalkRoot is the hidden root of the Amber hierarchy.
- All objects including `Object` inherit from SmalltalkRoot */
- function SmalltalkRoot() {
- }
- function SmalltalkProtoObject() {
- }
- inherits(SmalltalkProtoObject, SmalltalkRoot);
- function SmalltalkObject() {
- }
- inherits(SmalltalkObject, SmalltalkProtoObject);
- function SmalltalkNil() {
- }
- inherits(SmalltalkNil, SmalltalkObject);
- this.Object = SmalltalkObject;
- this.nil = new SmalltalkNil();
- // Adds an `isNil` property to the `nil` object. When sending
- // nil objects from one environment to another, doing
- // `anObject == nil` (in JavaScript) does not always answer
- // true as the referenced nil object might come from the other
- // environment.
- Object.defineProperty(this.nil, 'isNil', {
- value: true,
- enumerable: false, configurable: false, writable: false
- });
- // Hidden root class of the system.
- this.rootAsClass = {fn: SmalltalkRoot};
- this.__init__ = function () {
- st.addPackage("Kernel-Objects");
- st.wrapClassName("ProtoObject", "Kernel-Objects", SmalltalkProtoObject, undefined, false);
- st.wrapClassName("Object", "Kernel-Objects", SmalltalkObject, globals.ProtoObject, false);
- st.wrapClassName("UndefinedObject", "Kernel-Objects", SmalltalkNil, globals.Object, false);
- };
- }
- function OrganizeBrik(brikz, st) {
- brikz.ensure("augments");
- var SmalltalkObject = brikz.ensure("root").Object;
- function SmalltalkOrganizer() {
- }
- function SmalltalkPackageOrganizer() {
- this.elements = [];
- }
- function SmalltalkClassOrganizer() {
- this.elements = [];
- }
- inherits(SmalltalkOrganizer, SmalltalkObject);
- inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer);
- inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
- this.__init__ = function () {
- st.addPackage("Kernel-Infrastructure");
- st.wrapClassName("Organizer", "Kernel-Infrastructure", SmalltalkOrganizer, globals.Object, false);
- st.wrapClassName("PackageOrganizer", "Kernel-Infrastructure", SmalltalkPackageOrganizer, globals.Organizer, false);
- st.wrapClassName("ClassOrganizer", "Kernel-Infrastructure", SmalltalkClassOrganizer, globals.Organizer, false);
- };
- this.setupClassOrganization = function (klass) {
- klass.organization = new SmalltalkClassOrganizer();
- klass.organization.theClass = klass;
- };
- this.setupPackageOrganization = function (pkg) {
- pkg.organization = new SmalltalkPackageOrganizer();
- };
- this.addOrganizationElement = function (owner, element) {
- owner.organization.elements.addElement(element);
- };
- this.removeOrganizationElement = function (owner, element) {
- owner.organization.elements.removeElement(element);
- };
- }
- function DNUBrik(brikz, st) {
- brikz.ensure("selectorConversion");
- brikz.ensure("messageSend");
- var manip = brikz.ensure("manipulation");
- var rootAsClass = brikz.ensure("root").rootAsClass;
- /* Method not implemented handlers */
- var methods = [], methodDict = Object.create(null);
- this.selectors = [];
- this.jsSelectors = [];
- this.make = function (stSelector, targetClasses) {
- var method = methodDict[stSelector];
- if (method) return;
- var jsSelector = st.st2js(stSelector);
- this.selectors.push(stSelector);
- this.jsSelectors.push(jsSelector);
- method = {jsSelector: jsSelector, fn: createHandler(stSelector)};
- methodDict[stSelector] = method;
- methods.push(method);
- manip.installMethod(method, rootAsClass);
- targetClasses.forEach(function (target) {
- manip.installMethod(method, target);
- });
- return method;
- };
- /* Dnu handler method */
- function createHandler(stSelector) {
- return function () {
- return brikz.messageSend.messageNotUnderstood(this, stSelector, arguments);
- };
- }
- }
- function ClassInitBrik(brikz, st) {
- var dnu = brikz.ensure("dnu");
- var manip = brikz.ensure("manipulation");
- /* Initialize a class in its class hierarchy. Handle both classes and
- metaclasses. */
- st.init = function (klass) {
- initClass(klass);
- if (klass.klass && !klass.meta) {
- initClass(klass.klass);
- }
- };
- function initClass(klass) {
- if (klass.wrapped) {
- copySuperclass(klass);
- }
- }
- this.initClass = initClass;
- function copySuperclass(klass) {
- var superclass = klass.superclass,
- localMethods = klass.methods,
- localMethodsByJsSelector = {};
- Object.keys(localMethods).forEach(function (each) {
- var localMethod = localMethods[each];
- localMethodsByJsSelector[localMethod.jsSelector] = localMethod;
- });
- var myproto = klass.fn.prototype,
- superproto = superclass.fn.prototype;
- dnu.jsSelectors.forEach(function (selector) {
- if (!localMethodsByJsSelector[selector]) {
- manip.installMethod({
- jsSelector: selector,
- fn: superproto[selector]
- }, klass);
- } else if (!myproto[selector]) {
- manip.installMethod(localMethodsByJsSelector[selector], klass);
- }
- });
- }
- }
- function ManipulationBrik(brikz, st) {
- this.installMethod = function (method, klass) {
- Object.defineProperty(klass.fn.prototype, method.jsSelector, {
- value: method.fn,
- enumerable: false, configurable: true, writable: true
- });
- };
- }
- function PackagesBrik(brikz, st) {
- var org = brikz.ensure("organize");
- var root = brikz.ensure("root");
- var nil = root.nil;
- var SmalltalkObject = root.Object;
- function SmalltalkPackage() {
- }
- inherits(SmalltalkPackage, SmalltalkObject);
- this.__init__ = function () {
- st.addPackage("Kernel-Infrastructure");
- st.wrapClassName("Package", "Kernel-Infrastructure", SmalltalkPackage, globals.Object, false);
- };
- st.packages = {};
- /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
- function pkg(spec) {
- var that = new SmalltalkPackage();
- that.pkgName = spec.pkgName;
- org.setupPackageOrganization(that);
- that.properties = spec.properties || {};
- return that;
- }
- /* Add a package to the smalltalk.packages object, creating a new one if needed.
- If pkgName is null or empty we return nil, which is an allowed package for a class.
- If package already exists we still update the properties of it. */
- st.addPackage = function (pkgName, properties) {
- if (!pkgName) {
- return nil;
- }
- if (!(st.packages[pkgName])) {
- st.packages[pkgName] = pkg({
- pkgName: pkgName,
- properties: properties
- });
- } else {
- if (properties) {
- st.packages[pkgName].properties = properties;
- }
- }
- return st.packages[pkgName];
- };
- }
- function ClassesBrik(brikz, st) {
- var org = brikz.ensure("organize");
- var root = brikz.ensure("root");
- var classInit = brikz.ensure("classInit");
- var nil = root.nil;
- var rootAsClass = root.rootAsClass;
- var SmalltalkObject = root.Object;
- rootAsClass.klass = {fn: SmalltalkClass};
- function SmalltalkBehavior() {
- }
- function SmalltalkClass() {
- }
- function SmalltalkMetaclass() {
- }
- inherits(SmalltalkBehavior, SmalltalkObject);
- inherits(SmalltalkClass, SmalltalkBehavior);
- inherits(SmalltalkMetaclass, SmalltalkBehavior);
- SmalltalkMetaclass.prototype.meta = true;
- this.__init__ = function () {
- st.addPackage("Kernel-Classes");
- st.wrapClassName("Behavior", "Kernel-Classes", SmalltalkBehavior, globals.Object, false);
- st.wrapClassName("Metaclass", "Kernel-Classes", SmalltalkMetaclass, globals.Behavior, false);
- st.wrapClassName("Class", "Kernel-Classes", SmalltalkClass, globals.Behavior, false);
- // Manually bootstrap the metaclass hierarchy
- globals.ProtoObject.klass.superclass = rootAsClass.klass = globals.Class;
- addSubclass(globals.ProtoObject.klass);
- };
- /* Smalltalk classes */
- var classes = [];
- var wrappedClasses = [];
- /* Smalltalk class creation. A class is an instance of an automatically
- created metaclass object. Newly created classes (not their metaclass)
- should be added to the smalltalk object, see smalltalk.addClass().
- Superclass linking is *not* handled here, see smalltalk.init() */
- function klass(spec) {
- spec = spec || {};
- var setSuperClass = spec.superclass;
- if (!spec.superclass) {
- spec.superclass = rootAsClass;
- }
- var meta = metaclass(spec);
- var that = meta.instanceClass;
- that.superclass = setSuperClass;
- that.fn = spec.fn || inherits(function () {
- }, spec.superclass.fn);
- that.subclasses = [];
- setupClass(that, spec);
- that.className = spec.className;
- that.wrapped = spec.wrapped || false;
- meta.className = spec.className + ' class';
- meta.superclass = spec.superclass.klass;
- return that;
- }
- function metaclass(spec) {
- spec = spec || {};
- var that = new SmalltalkMetaclass();
- that.fn = inherits(function () {
- }, spec.superclass.klass.fn);
- that.instanceClass = new that.fn();
- setupClass(that);
- return that;
- }
- SmalltalkBehavior.prototype.toString = function () {
- return 'Smalltalk ' + this.className;
- };
- function wireKlass(klass) {
- Object.defineProperty(klass.fn.prototype, "klass", {
- value: klass,
- enumerable: false, configurable: true, writable: true
- });
- }
- function setupClass(klass, spec) {
- spec = spec || {};
- klass.iVarNames = spec.iVarNames || [];
- klass.pkg = spec.pkg;
- org.setupClassOrganization(klass);
- Object.defineProperty(klass, "methods", {
- value: Object.create(null),
- enumerable: false, configurable: true, writable: true
- });
- wireKlass(klass);
- }
- /* Add a class to the smalltalk object, creating a new one if needed.
- A Package is lazily created if it does not exist with given name. */
- st.addClass = function (className, superclass, iVarNames, pkgName) {
- // While subclassing nil is allowed, it might be an error, so
- // warn about it.
- if (typeof superclass == 'undefined' || superclass == nil) {
- console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
- }
- rawAddClass(pkgName, className, superclass, iVarNames, false, null);
- };
- function rawAddClass(pkgName, className, superclass, iVarNames, wrapped, fn) {
- var pkg = st.packages[pkgName];
- if (!pkg) {
- throw new Error("Missing package " + pkgName);
- }
- if (!superclass || superclass == nil) {
- superclass = null;
- }
- if (globals[className] && globals[className].superclass == superclass) {
- // globals[className].superclass = superclass;
- globals[className].iVarNames = iVarNames || [];
- if (pkg) globals[className].pkg = pkg;
- if (fn) {
- fn.prototype = globals[className].fn.prototype;
- globals[className].fn = fn;
- fn.prototype.constructor = fn;
- }
- } else {
- if (globals[className]) {
- st.removeClass(globals[className]);
- }
- globals[className] = klass({
- className: className,
- superclass: superclass,
- pkg: pkg,
- iVarNames: iVarNames,
- fn: fn,
- wrapped: wrapped
- });
- addSubclass(globals[className]);
- }
- classes.addElement(globals[className]);
- org.addOrganizationElement(pkg, globals[className]);
- }
- st.removeClass = function (klass) {
- org.removeOrganizationElement(klass.pkg, klass);
- classes.removeElement(klass);
- removeSubclass(klass);
- delete globals[klass.className];
- };
- function addSubclass(klass) {
- if (klass.superclass) {
- klass.superclass.subclasses.addElement(klass);
- }
- }
- function removeSubclass(klass) {
- if (klass.superclass) {
- klass.superclass.subclasses.removeElement(klass);
- }
- }
- /* Create a new class wrapping a JavaScript constructor, and add it to the
- global smalltalk object. Package is lazily created if it does not exist with given name. */
- st.wrapClassName = function (className, pkgName, fn, superclass, wrapped) {
- wrapped = wrapped !== false;
- rawAddClass(pkgName, className, superclass, globals[className] && globals[className].iVarNames, wrapped, fn);
- if (wrapped) {
- wrappedClasses.addElement(globals[className]);
- }
- };
- /* Manually set the constructor of an existing Smalltalk klass, making it a wrapped class. */
- st.setClassConstructor = function (klass, constructor) {
- wrappedClasses.addElement(klass);
- klass.wrapped = true;
- klass.fn = constructor;
- // The fn property changed. We need to add back the klass property to the prototype
- wireKlass(klass);
- classInit.initClass(klass);
- };
- /* Create an alias for an existing class */
- st.alias = function (klass, alias) {
- globals[alias] = klass;
- };
- /* Answer all registered Smalltalk classes */
- //TODO: remove the function and make smalltalk.classes an array
- st.classes = function () {
- return classes;
- };
- st.wrappedClasses = function () {
- return wrappedClasses;
- };
- // Still used, but could go away now that subclasses are stored
- // into classes directly.
- st.allSubclasses = function (klass) {
- return klass._allSubclasses();
- };
- }
- function MethodsBrik(brikz, st) {
- var manip = brikz.ensure("manipulation");
- var org = brikz.ensure("organize");
- var stInit = brikz.ensure("stInit");
- var dnu = brikz.ensure("dnu");
- var SmalltalkObject = brikz.ensure("root").Object;
- brikz.ensure("selectorConversion");
- brikz.ensure("classes");
- function SmalltalkMethod() {
- }
- inherits(SmalltalkMethod, SmalltalkObject);
- this.__init__ = function () {
- st.addPackage("Kernel-Methods");
- st.wrapClassName("CompiledMethod", "Kernel-Methods", SmalltalkMethod, globals.Object, false);
- };
- /* Smalltalk method object. To add a method to a class,
- use smalltalk.addMethod() */
- st.method = function (spec) {
- var that = new SmalltalkMethod();
- that.selector = spec.selector;
- that.jsSelector = spec.jsSelector;
- that.args = spec.args || {};
- that.protocol = spec.protocol;
- that.source = spec.source;
- that.messageSends = spec.messageSends || [];
- that.referencedClasses = spec.referencedClasses || [];
- that.fn = spec.fn;
- return that;
- };
- function ensureJsSelector(method) {
- if (!(method.jsSelector)) {
- method.jsSelector = st.st2js(method.selector);
- }
- }
- /* Add/remove a method to/from a class */
- st.addMethod = function (method, klass) {
- ensureJsSelector(method);
- manip.installMethod(method, klass);
- klass.methods[method.selector] = method;
- method.methodClass = klass;
- // During the bootstrap, #addCompiledMethod is not used.
- // Therefore we populate the organizer here too
- org.addOrganizationElement(klass, method.protocol);
- propagateMethodChange(klass, method);
- var usedSelectors = method.messageSends,
- targetClasses = stInit.initialized() ? st.wrappedClasses() : [];
- dnu.make(method.selector, targetClasses);
- for (var i = 0; i < usedSelectors.length; i++) {
- dnu.make(usedSelectors[i], targetClasses);
- }
- };
- function propagateMethodChange(klass, method) {
- // If already initialized (else it will be done later anyway),
- // re-initialize all subclasses to ensure the method change
- // propagation (for wrapped classes, not using the prototype
- // chain).
- if (stInit.initialized()) {
- st.allSubclasses(klass).forEach(function (subclass) {
- initMethodInClass(subclass, method);
- });
- }
- }
- function initMethodInClass(klass, method) {
- if (klass.wrapped && !klass.methods[method.selector]) {
- var jsSelector = method.jsSelector;
- manip.installMethod({
- jsSelector: jsSelector,
- fn: klass.superclass.fn.prototype[jsSelector]
- }, klass);
- }
- }
- st.removeMethod = function (method, klass) {
- if (klass !== method.methodClass) {
- throw new Error(
- "Refusing to remove method " +
- method.methodClass.className + ">>" + method.selector +
- " from different class " +
- klass.className);
- }
- ensureJsSelector(method);
- delete klass.fn.prototype[method.jsSelector];
- delete klass.methods[method.selector];
- initMethodInClass(klass, method);
- propagateMethodChange(klass, method);
- // Do *not* delete protocols from here.
- // This is handled by #removeCompiledMethod
- };
- /* Answer all method selectors based on dnu handlers */
- st.allSelectors = function () {
- return dnu.selectors;
- };
- }
- function AugmentsBrik(brikz, st) {
- /* Array extensions */
- Array.prototype.addElement = function (el) {
- if (typeof el === 'undefined') {
- return;
- }
- if (this.indexOf(el) == -1) {
- this.push(el);
- }
- };
- Array.prototype.removeElement = function (el) {
- var i = this.indexOf(el);
- if (i !== -1) {
- this.splice(i, 1);
- }
- };
- }
- function SmalltalkInitBrik(brikz, st) {
- brikz.ensure("classInit");
- brikz.ensure("classes");
- var initialized = false;
- /* Smalltalk initialization. Called on page load */
- st.initialize = function () {
- if (initialized) {
- return;
- }
- st.classes().forEach(function (klass) {
- st.init(klass);
- });
- runnable();
- st.classes().forEach(function (klass) {
- klass._initialize();
- });
- initialized = true;
- };
- this.initialized = function () {
- return initialized;
- };
- this.__init__ = function () {
- st.addPackage("Kernel-Methods");
- st.wrapClassName("Number", "Kernel-Objects", Number, globals.Object);
- st.wrapClassName("BlockClosure", "Kernel-Methods", Function, globals.Object);
- st.wrapClassName("Boolean", "Kernel-Objects", Boolean, globals.Object);
- st.wrapClassName("Date", "Kernel-Objects", Date, globals.Object);
- st.addPackage("Kernel-Collections");
- st.addClass("Collection", globals.Object, null, "Kernel-Collections");
- st.addClass("IndexableCollection", globals.Collection, null, "Kernel-Collections");
- st.addClass("SequenceableCollection", globals.IndexableCollection, null, "Kernel-Collections");
- st.addClass("CharacterArray", globals.SequenceableCollection, null, "Kernel-Collections");
- st.wrapClassName("String", "Kernel-Collections", String, globals.CharacterArray);
- st.wrapClassName("Array", "Kernel-Collections", Array, globals.SequenceableCollection);
- st.wrapClassName("RegularExpression", "Kernel-Collections", RegExp, globals.Object);
- st.addPackage("Kernel-Exceptions");
- st.wrapClassName("Error", "Kernel-Exceptions", Error, globals.Object);
- /* Alias definitions */
- st.alias(globals.Array, "OrderedCollection");
- st.alias(globals.Date, "Time");
- };
- }
- function PrimitivesBrik(brikz, st) {
- /* Unique ID number generator */
- var oid = 0;
- st.nextId = function () {
- oid += 1;
- return oid;
- };
- /* Converts a JavaScript object to valid Smalltalk Object */
- st.readJSObject = function (js) {
- if (js == null)
- return null;
- var readObject = js.constructor === Object;
- var readArray = js.constructor === Array;
- var object = readObject ? globals.Dictionary._new() : readArray ? [] : js;
- for (var i in js) {
- if (readObject) {
- object._at_put_(i, st.readJSObject(js[i]));
- }
- if (readArray) {
- object[i] = st.readJSObject(js[i]);
- }
- }
- return object;
- };
- /* Boolean assertion */
- st.assert = function (shouldBeBoolean) {
- if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
- else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
- shouldBeBoolean = shouldBeBoolean.valueOf();
- if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
- }
- globals.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
- };
- /* List of all reserved words in JavaScript. They may not be used as variables
- in Smalltalk. */
- // list of reserved JavaScript keywords as of
- // http://es5.github.com/#x7.6.1.1
- // and
- // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
- st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
- 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
- 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
- 'try', 'typeof', 'var', 'void', 'while', 'with',
- // Amber protected words: these should not be compiled as-is when in code
- 'arguments',
- // ES5: future use: http://es5.github.com/#x7.6.1.2
- 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
- // ES5: future use in strict mode
- 'implements', 'interface', 'let', 'package', 'private', 'protected',
- 'public', 'static', 'yield'];
- st.globalJsVariables = ['window', 'document', 'process', 'global'];
- }
- function RuntimeBrik(brikz, st) {
- brikz.ensure("selectorConversion");
- var root = brikz.ensure("root");
- var nil = root.nil;
- var SmalltalkObject = root.Object;
- function SmalltalkMethodContext(home, setup) {
- this.sendIdx = {};
- this.homeContext = home;
- this.setup = setup || function () {
- };
- this.supercall = false;
- }
- inherits(SmalltalkMethodContext, SmalltalkObject);
- this.__init__ = function () {
- st.addPackage("Kernel-Methods");
- st.wrapClassName("MethodContext", "Kernel-Methods", SmalltalkMethodContext, globals.Object, false);
- // Fallbacks
- SmalltalkMethodContext.prototype.locals = {};
- SmalltalkMethodContext.prototype.receiver = null;
- SmalltalkMethodContext.prototype.selector = null;
- SmalltalkMethodContext.prototype.lookupClass = null;
- SmalltalkMethodContext.prototype.fill = function (receiver, selector, locals, lookupClass) {
- this.receiver = receiver;
- this.selector = selector;
- this.locals = locals || {};
- this.lookupClass = lookupClass;
- if (this.homeContext) {
- this.homeContext.evaluatedSelector = selector;
- }
- };
- SmalltalkMethodContext.prototype.fillBlock = function (locals, ctx, index) {
- this.locals = locals || {};
- this.outerContext = ctx;
- this.index = index || 0;
- };
- SmalltalkMethodContext.prototype.init = function () {
- var home = this.homeContext;
- if (home) {
- home.init();
- }
- this.setup(this);
- };
- SmalltalkMethodContext.prototype.method = function () {
- var method;
- var lookup = this.lookupClass || this.receiver.klass;
- while (!method && lookup) {
- method = lookup.methods[st.js2st(this.selector)];
- lookup = lookup.superclass;
- }
- return method;
- };
- };
- /* This is the current call context object. While it is publicly available,
- Use smalltalk.getThisContext() instead which will answer a safe copy of
- the current context */
- var thisContext = null;
- st.withContext = function (worker, setup) {
- if (thisContext) {
- return inContext(worker, setup);
- } else {
- return inContextWithErrorHandling(worker, setup);
- }
- };
- function inContextWithErrorHandling(worker, setup) {
- try {
- return inContext(worker, setup);
- } catch (error) {
- handleError(error);
- thisContext = null;
- // Rethrow the error in any case.
- error.amberHandled = true;
- throw error;
- }
- }
- function inContext(worker, setup) {
- var oldContext = thisContext;
- thisContext = new SmalltalkMethodContext(thisContext, setup);
- var result = worker(thisContext);
- thisContext = oldContext;
- return result;
- }
- /* Wrap a JavaScript exception in a Smalltalk Exception.
- In case of a RangeError, stub the stack after 100 contexts to
- avoid another RangeError later when the stack is manipulated. */
- function wrappedError(error) {
- var errorWrapper = globals.JavaScriptException._on_(error);
- // Add the error to the context, so it is visible in the stack
- try {
- errorWrapper._signal();
- } catch (ex) {
- }
- var context = st.getThisContext();
- if (isRangeError(error)) {
- stubContextStack(context);
- }
- errorWrapper._context_(context);
- return errorWrapper;
- }
- /* Stub the context stack after 100 contexts */
- function stubContextStack(context) {
- var currentContext = context;
- var contexts = 0;
- while (contexts < 100) {
- if (currentContext) {
- currentContext = currentContext.homeContext;
- }
- contexts++;
- }
- if (currentContext) {
- currentContext.homeContext = undefined;
- }
- }
- function isRangeError(error) {
- return error instanceof RangeError;
- }
- /* Handles Smalltalk errors. Triggers the registered ErrorHandler
- (See the Smalltalk class ErrorHandler and its subclasses */
- function handleError(error) {
- if (!error.smalltalkError) {
- error = wrappedError(error);
- }
- globals.ErrorHandler._handleError_(error);
- }
- /* Handle thisContext pseudo variable */
- st.getThisContext = function () {
- if (thisContext) {
- thisContext.init();
- return thisContext;
- } else {
- return nil;
- }
- };
- }
- function MessageSendBrik(brikz, st) {
- brikz.ensure("selectorConversion");
- var nil = brikz.ensure("root").nil;
- /* Handles unhandled errors during message sends */
- // simply send the message and handle #dnu:
- st.send = function (receiver, jsSelector, args, klass) {
- var method;
- if (receiver == null) {
- receiver = nil;
- }
- method = klass ? klass.fn.prototype[jsSelector] : receiver.klass && receiver[jsSelector];
- if (method) {
- return method.apply(receiver, args || []);
- } else {
- return messageNotUnderstood(receiver, st.js2st(jsSelector), args);
- }
- };
- function invokeDnuMethod(receiver, stSelector, args) {
- return receiver._doesNotUnderstand_(
- globals.Message._new()
- ._selector_(stSelector)
- ._arguments_([].slice.call(args))
- );
- }
- /* Handles #dnu: *and* JavaScript method calls.
- if the receiver has no klass, we consider it a JS object (outside of the
- Amber system). Else assume that the receiver understands #doesNotUnderstand: */
- function messageNotUnderstood(receiver, stSelector, args) {
- if (receiver.klass != null && !receiver.allowJavaScriptCalls) {
- return invokeDnuMethod(receiver, stSelector, args);
- }
- /* Call a method of a JS object, or answer a property if it exists.
- Else try wrapping a JSObjectProxy around the receiver. */
- var propertyName = st.st2prop(stSelector);
- if (!(propertyName in receiver)) {
- return invokeDnuMethod(globals.JSObjectProxy._on_(receiver), stSelector, args);
- }
- return accessJavaScript(receiver, propertyName, args);
- }
- /* If the object property is a function, then call it, except if it starts with
- an uppercase character (we probably want to answer the function itself in this
- case and send it #new from Amber).
- Converts keyword-based selectors by using the first
- keyword only, but keeping all message arguments.
- Example:
- "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */
- function accessJavaScript(receiver, propertyName, args) {
- var propertyValue = receiver[propertyName];
- if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
- return propertyValue.apply(receiver, args || []);
- } else if (args.length > 0) {
- receiver[propertyName] = args[0];
- return nil;
- } else {
- return propertyValue;
- }
- }
- st.accessJavaScript = accessJavaScript;
- this.messageNotUnderstood = messageNotUnderstood;
- }
- function SelectorConversionBrik(brikz, st) {
- /* Convert a Smalltalk selector into a JS selector */
- st.st2js = function (string) {
- var selector = '_' + string;
- selector = selector.replace(/:/g, '_');
- selector = selector.replace(/[\&]/g, '_and');
- selector = selector.replace(/[\|]/g, '_or');
- selector = selector.replace(/[+]/g, '_plus');
- selector = selector.replace(/-/g, '_minus');
- selector = selector.replace(/[*]/g, '_star');
- selector = selector.replace(/[\/]/g, '_slash');
- selector = selector.replace(/[\\]/g, '_backslash');
- selector = selector.replace(/[\~]/g, '_tild');
- selector = selector.replace(/>/g, '_gt');
- selector = selector.replace(/</g, '_lt');
- selector = selector.replace(/=/g, '_eq');
- selector = selector.replace(/,/g, '_comma');
- selector = selector.replace(/[@]/g, '_at');
- return selector;
- };
- /* Convert a string to a valid smalltalk selector.
- if you modify the following functions, also change st2js
- accordingly */
- st.js2st = function (selector) {
- if (selector.match(/^__/)) {
- return binaryJsToSt(selector);
- } else {
- return keywordJsToSt(selector);
- }
- };
- function keywordJsToSt(selector) {
- return selector.replace(/^_/, '').replace(/_/g, ':');
- }
- function binaryJsToSt(selector) {
- return selector
- .replace(/^_/, '')
- .replace(/_and/g, '&')
- .replace(/_or/g, '|')
- .replace(/_plus/g, '+')
- .replace(/_minus/g, '-')
- .replace(/_star/g, '*')
- .replace(/_slash/g, '/')
- .replace(/_backslash/g, '\\')
- .replace(/_tild/g, '~')
- .replace(/_gt/g, '>')
- .replace(/_lt/g, '<')
- .replace(/_eq/g, '=')
- .replace(/_comma/g, ',')
- .replace(/_at/g, '@');
- }
- st.st2prop = function (stSelector) {
- var colonPosition = stSelector.indexOf(':');
- return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
- };
- }
- /* Adds AMD and requirejs related methods to the smalltalk object */
- function AMDBrik(brikz, st) {
- this.__init__ = function () {
- st.amdRequire = require;
- st.defaultTransportType = st.defaultTransportType || "amd";
- st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
- };
- }
- /* Defines asReceiver to be present at load time */
- /* (logically it belongs more to PrimitiveBrik) */
- function AsReceiverBrik(brikz, st) {
- var nil = brikz.ensure("root").nil;
- /**
- * This function is used all over the compiled amber code.
- * It takes any value (JavaScript or Smalltalk)
- * and returns a proper Amber Smalltalk receiver.
- *
- * null or undefined -> nil,
- * plain JS object -> wrapped JS object,
- * otherwise unchanged
- */
- this.asReceiver = function (o) {
- if (o == null) return nil;
- if (typeof o === "object" || typeof o === "function") {
- return o.klass != null ? o : globals.JSObjectProxy._on_(o);
- }
- // IMPORTANT: This optimization (return o if typeof !== "object")
- // assumes all primitive types are wrapped by some Smalltalk class
- // so they can be returned as-is, without boxing and looking for .klass.
- // KEEP THE primitives-are-wrapped INVARIANT!
- return o;
- };
- }
- /* Making smalltalk that can load */
- brikz.root = RootBrik;
- brikz.dnu = DNUBrik;
- brikz.organize = OrganizeBrik;
- brikz.selectorConversion = SelectorConversionBrik;
- brikz.classInit = ClassInitBrik;
- brikz.manipulation = ManipulationBrik;
- brikz.packages = PackagesBrik;
- brikz.classes = ClassesBrik;
- brikz.methods = MethodsBrik;
- brikz.stInit = SmalltalkInitBrik;
- brikz.augments = AugmentsBrik;
- brikz.asReceiver = AsReceiverBrik;
- brikz.amd = AMDBrik;
- brikz.rebuild();
- /* Making smalltalk that can run */
- function runnable() {
- brikz.messageSend = MessageSendBrik;
- brikz.runtime = RuntimeBrik;
- brikz.primitives = PrimitivesBrik;
- brikz.rebuild();
- }
- return {api: api, nil: brikz.root.nil, globals: globals, asReceiver: brikz.asReceiver.asReceiver};
- });
- define("amber/helpers", ["amber/boot", "require"], function (boot, require) {
- var globals = boot.globals,
- exports = {},
- api = boot.api,
- nil = boot.nil;
- // API
- exports.popupHelios = function () {
- require(['helios/index'], function (helios) {
- helios.popup();
- }, function (err) {
- window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
- });
- };
- Object.defineProperty(exports, "api", {
- value: api,
- enumerable: true, configurable: true, writable: false
- });
- Object.defineProperty(exports, "globals", {
- value: globals,
- enumerable: true, configurable: true, writable: false
- });
- Object.defineProperty(exports, "nil", {
- value: nil,
- enumerable: true, configurable: true, writable: false
- });
- function mixinToSettings(source) {
- var settings = globals.SmalltalkSettings;
- Object.keys(source).forEach(function (key) {
- settings[key] = source[key];
- });
- }
- function settingsInLocalStorage() {
- //jshint evil:true
- var global = new Function('return this')(),
- storage = 'localStorage' in global && global.localStorage;
- if (storage) {
- var fromStorage;
- try {
- fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
- } catch (ex) {
- // pass
- }
- mixinToSettings(fromStorage || {});
- if (typeof window !== "undefined") {
- requirejs(['jquery'], function ($) {
- $(window).on('beforeunload', function () {
- storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
- });
- });
- }
- }
- }
- exports.initialize = function (options) {
- globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
- settingsInLocalStorage();
- mixinToSettings(options || {});
- return api.initialize();
- };
- // Exports
- return exports;
- });
- define("amber_core/Kernel-Objects", ["amber/boot"], function($boot){"use strict";
- var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
- $core.addPackage('Kernel-Objects');
- $core.packages["Kernel-Objects"].innerEval = function (expr) { return eval(expr); };
- $core.packages["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
- $core.addClass('ProtoObject', null, [], 'Kernel-Objects');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "=",
- protocol: 'comparing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self.__eq_eq(anObject);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
- },
- args: ["anObject"],
- source: "= anObject\x0a\x09^ self == anObject",
- referencedClasses: [],
- messageSends: ["=="]
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "==",
- protocol: 'comparing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
- },
- args: ["anObject"],
- source: "== anObject\x0a<return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "asString",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._printString();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
- },
- args: [],
- source: "asString\x0a\x09^ self printString",
- referencedClasses: [],
- messageSends: ["printString"]
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "class",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.klass;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
- },
- args: [],
- source: "class\x0a\x09<return self.klass>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "doesNotUnderstand:",
- protocol: 'error handling',
- fn: function (aMessage){
- var self=this;
- function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=$recv($MessageNotUnderstood())._new();
- $recv($1)._receiver_(self);
- $recv($1)._message_(aMessage);
- $2=$recv($1)._signal();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
- },
- args: ["aMessage"],
- source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
- referencedClasses: ["MessageNotUnderstood"],
- messageSends: ["receiver:", "new", "message:", "signal"]
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "evaluate:on:",
- protocol: 'evaluating',
- fn: function (aString,anEvaluator){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(anEvaluator)._evaluate_receiver_(aString,self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
- },
- args: ["aString", "anEvaluator"],
- source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
- referencedClasses: [],
- messageSends: ["evaluate:receiver:"]
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "identityHash",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var hash=self.identityHash;
- if (hash) return hash;
- hash=$core.nextId();
- Object.defineProperty(self, 'identityHash', {value:hash});
- return hash;
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
- },
- args: [],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "ifNil:",
- protocol: 'testing',
- fn: function (aBlock){
- var self=this;
- return self;
- },
- args: ["aBlock"],
- source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "ifNil:ifNotNil:",
- protocol: 'testing',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(anotherBlock)._value_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
- },
- args: ["aBlock", "anotherBlock"],
- source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
- referencedClasses: [],
- messageSends: ["value:"]
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "ifNotNil:",
- protocol: 'testing',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aBlock)._value_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
- },
- args: ["aBlock"],
- source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
- referencedClasses: [],
- messageSends: ["value:"]
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "ifNotNil:ifNil:",
- protocol: 'testing',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aBlock)._value_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
- },
- args: ["aBlock", "anotherBlock"],
- source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
- referencedClasses: [],
- messageSends: ["value:"]
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "initialize",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "inspect",
- protocol: 'inspecting',
- fn: function (){
- var self=this;
- function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
- return $core.withContext(function($ctx1) {
- $recv($Inspector())._inspect_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
- },
- args: [],
- source: "inspect\x0a\x09Inspector inspect: self",
- referencedClasses: ["Inspector"],
- messageSends: ["inspect:"]
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "inspectOn:",
- protocol: 'inspecting',
- fn: function (anInspector){
- var self=this;
- return self;
- },
- args: ["anInspector"],
- source: "inspectOn: anInspector",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "instVarAt:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self['@'+aString] ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
- },
- args: ["aString"],
- source: "instVarAt: aString\x0a\x09< return self['@'+aString] >",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "instVarAt:put:",
- protocol: 'accessing',
- fn: function (aString,anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- self['@' + aString] = anObject ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
- },
- args: ["aString", "anObject"],
- source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "isKindOf:",
- protocol: 'testing',
- fn: function (aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=self._isMemberOf_(aClass);
- if($core.assert($2)){
- $1=true;
- } else {
- $1=$recv(self._class())._inheritsFrom_(aClass);
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
- },
- args: ["aClass"],
- source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "isNil",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isNil\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "isSameInstanceAs:",
- protocol: 'comparing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=self._identityHash();
- $ctx1.sendIdx["identityHash"]=1;
- $1=$recv($2).__eq($recv(anObject)._identityHash());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isSameInstanceAs:",{anObject:anObject},$globals.ProtoObject)});
- },
- args: ["anObject"],
- source: "isSameInstanceAs: anObject\x0a\x09^ self identityHash = anObject identityHash",
- referencedClasses: [],
- messageSends: ["=", "identityHash"]
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "notNil",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._isNil())._not();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
- },
- args: [],
- source: "notNil\x0a\x09^ self isNil not",
- referencedClasses: [],
- messageSends: ["not", "isNil"]
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "perform:",
- protocol: 'message handling',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._perform_withArguments_(aString,[]);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
- },
- args: ["aString"],
- source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
- referencedClasses: [],
- messageSends: ["perform:withArguments:"]
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "perform:withArguments:",
- protocol: 'message handling',
- fn: function (aString,aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- return $core.send(self, aString._asJavaScriptMethodName(), aCollection);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
- },
- args: ["aString", "aCollection"],
- source: "perform: aString withArguments: aCollection\x0a\x09<return $core.send(self, aString._asJavaScriptMethodName(), aCollection)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "printOn:",
- protocol: 'printing',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $5,$4,$3,$2,$1;
- $5=self._class();
- $ctx1.sendIdx["class"]=1;
- $4=$recv($5)._name();
- $ctx1.sendIdx["name"]=1;
- $3=$recv($4)._first();
- $2=$recv($3)._isVowel();
- if($core.assert($2)){
- $1="an ";
- } else {
- $1="a ";
- };
- $recv(aStream)._nextPutAll_($1);
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv(aStream)._nextPutAll_($recv(self._class())._name());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
- },
- args: ["aStream"],
- 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",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "printString",
- protocol: 'printing',
- fn: function (){
- var self=this;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($String())._streamContents_((function(str){
- return $core.withContext(function($ctx2) {
- return self._printOn_(str);
- }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
- },
- args: [],
- source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
- referencedClasses: ["String"],
- messageSends: ["streamContents:", "printOn:"]
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "yourself",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "yourself\x0a\x09^ self",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "~=",
- protocol: 'comparing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self.__eq(anObject)).__eq(false);
- $ctx1.sendIdx["="]=1;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
- },
- args: ["anObject"],
- source: "~= anObject\x0a\x09^ (self = anObject) = false",
- referencedClasses: [],
- messageSends: ["="]
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "~~",
- protocol: 'comparing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self.__eq_eq(anObject)).__eq(false);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
- },
- args: ["anObject"],
- source: "~~ anObject\x0a\x09^ (self == anObject) = false",
- referencedClasses: [],
- messageSends: ["=", "=="]
- }),
- $globals.ProtoObject);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "initialize",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ProtoObject.klass);
- $core.addClass('Object', $globals.ProtoObject, [], 'Kernel-Objects');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "->",
- protocol: 'converting',
- fn: function (anObject){
- var self=this;
- function $Association(){return $globals.Association||(typeof Association=="undefined"?nil:Association)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Association())._key_value_(self,anObject);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
- },
- args: ["anObject"],
- source: "-> anObject\x0a\x09^ Association key: self value: anObject",
- referencedClasses: ["Association"],
- messageSends: ["key:value:"]
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "asJSON",
- protocol: 'converting',
- fn: function (){
- var self=this;
- var variables;
- function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
- return $core.withContext(function($ctx1) {
- var $1;
- variables=$recv($HashedCollection())._new();
- $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(variables)._at_put_(each,$recv(self._instVarAt_(each))._asJSON());
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $1=variables;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},$globals.Object)});
- },
- args: [],
- 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",
- referencedClasses: ["HashedCollection"],
- messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJSON", "instVarAt:"]
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "asJSONString",
- protocol: 'converting',
- fn: function (){
- var self=this;
- function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($JSON())._stringify_(self._asJSON());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
- },
- args: [],
- source: "asJSONString\x0a\x09^ JSON stringify: self asJSON",
- referencedClasses: ["JSON"],
- messageSends: ["stringify:", "asJSON"]
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "asJavascript",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._asString();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Object)});
- },
- args: [],
- source: "asJavascript\x0a\x09^ self asString",
- referencedClasses: [],
- messageSends: ["asString"]
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "basicAt:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self[aString];
- return self;
- }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
- },
- args: ["aString"],
- source: "basicAt: aString\x0a\x09<return self[aString]>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "basicAt:put:",
- protocol: 'accessing',
- fn: function (aString,anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self[aString] = anObject;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
- },
- args: ["aString", "anObject"],
- source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "basicDelete:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- delete self[aString]; return aString;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
- },
- args: ["aString"],
- source: "basicDelete: aString\x0a\x09<delete self[aString]; return aString>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "basicPerform:",
- protocol: 'message handling',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._basicPerform_withArguments_(aString,[]);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
- },
- args: ["aString"],
- source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
- referencedClasses: [],
- messageSends: ["basicPerform:withArguments:"]
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "basicPerform:withArguments:",
- protocol: 'message handling',
- fn: function (aString,aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self[aString].apply(self, aCollection);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
- },
- args: ["aString", "aCollection"],
- source: "basicPerform: aString withArguments: aCollection\x0a\x09<return self[aString].apply(self, aCollection);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "browse",
- protocol: 'browsing',
- fn: function (){
- var self=this;
- function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
- return $core.withContext(function($ctx1) {
- $recv($Finder())._findClass_(self._class());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
- },
- args: [],
- source: "browse\x0a\x09Finder findClass: self class",
- referencedClasses: ["Finder"],
- messageSends: ["findClass:", "class"]
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "copy",
- protocol: 'copying',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._shallowCopy())._postCopy();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
- },
- args: [],
- source: "copy\x0a\x09^ self shallowCopy postCopy",
- referencedClasses: [],
- messageSends: ["postCopy", "shallowCopy"]
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "deepCopy",
- protocol: 'copying',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var copy = self.klass._new();
- Object.keys(self).forEach(function (i) {
- if(/^@.+/.test(i)) {
- copy[i] = self[i]._deepCopy();
- }
- });
- return copy;
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
- },
- args: [],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "deprecatedAPI",
- protocol: 'error handling',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$6,$5,$4,$8,$7,$3,$2;
- $1=console;
- $6=$core.getThisContext()._home();
- $ctx1.sendIdx["home"]=1;
- $5=$recv($6)._asString();
- $ctx1.sendIdx["asString"]=1;
- $4=$recv($5).__comma(" is deprecated! (in ");
- $8=$recv($core.getThisContext()._home())._home();
- $ctx1.sendIdx["home"]=2;
- $7=$recv($8)._asString();
- $3=$recv($4).__comma($7);
- $ctx1.sendIdx[","]=2;
- $2=$recv($3).__comma(")");
- $ctx1.sendIdx[","]=1;
- $recv($1)._warn_($2);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
- },
- args: [],
- 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, ')'.",
- referencedClasses: [],
- messageSends: ["warn:", ",", "asString", "home"]
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "deprecatedAPI:",
- protocol: 'error handling',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$6,$5,$4,$8,$7,$3,$2;
- $1=console;
- $6=$core.getThisContext()._home();
- $ctx1.sendIdx["home"]=1;
- $5=$recv($6)._asString();
- $ctx1.sendIdx["asString"]=1;
- $4=$recv($5).__comma(" is deprecated! (in ");
- $8=$recv($core.getThisContext()._home())._home();
- $ctx1.sendIdx["home"]=2;
- $7=$recv($8)._asString();
- $3=$recv($4).__comma($7);
- $ctx1.sendIdx[","]=2;
- $2=$recv($3).__comma(")");
- $ctx1.sendIdx[","]=1;
- $recv($1)._warn_($2);
- $ctx1.sendIdx["warn:"]=1;
- $recv(console)._warn_(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
- },
- args: ["aString"],
- 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",
- referencedClasses: [],
- messageSends: ["warn:", ",", "asString", "home"]
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "error:",
- protocol: 'error handling',
- fn: function (aString){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- $recv($Error())._signal_(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
- },
- args: ["aString"],
- source: "error: aString\x0a\x09Error signal: aString",
- referencedClasses: ["Error"],
- messageSends: ["signal:"]
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "halt",
- protocol: 'error handling',
- fn: function (){
- var self=this;
- function $Halt(){return $globals.Halt||(typeof Halt=="undefined"?nil:Halt)}
- return $core.withContext(function($ctx1) {
- $recv($Halt())._signal();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
- },
- args: [],
- source: "halt\x0a\x09Halt signal",
- referencedClasses: ["Halt"],
- messageSends: ["signal"]
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "in:",
- protocol: 'evaluating',
- fn: function (aValuable){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aValuable)._value_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
- },
- args: ["aValuable"],
- source: "in: aValuable\x0a\x09^ aValuable value: self",
- referencedClasses: [],
- messageSends: ["value:"]
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "isBehavior",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isBehavior\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "isBoolean",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isBoolean\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "isClass",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isClass\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "isCompiledMethod",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isCompiledMethod\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "isImmutable",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isImmutable\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "isMemberOf:",
- protocol: 'testing',
- fn: function (aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._class()).__eq(aClass);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
- },
- args: ["aClass"],
- source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
- referencedClasses: [],
- messageSends: ["=", "class"]
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "isMetaclass",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isMetaclass\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "isNumber",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isNumber\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "isPackage",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isPackage\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "isParseFailure",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isParseFailure\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "isString",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isString\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "isSymbol",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isSymbol\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "postCopy",
- protocol: 'copying',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "postCopy",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "putOn:",
- protocol: 'streaming',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aStream)._nextPut_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
- },
- args: ["aStream"],
- source: "putOn: aStream\x0a\x09aStream nextPut: self",
- referencedClasses: [],
- messageSends: ["nextPut:"]
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "respondsTo:",
- protocol: 'testing',
- fn: function (aSelector){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._class())._canUnderstand_(aSelector);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
- },
- args: ["aSelector"],
- source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
- referencedClasses: [],
- messageSends: ["canUnderstand:", "class"]
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "shallowCopy",
- protocol: 'copying',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var copy = self.klass._new();
- Object.keys(self).forEach(function(i) {
- if(/^@.+/.test(i)) {
- copy[i] = self[i];
- }
- });
- return copy;
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
- },
- args: [],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "shouldNotImplement",
- protocol: 'error handling',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._error_("This method should not be implemented in ".__comma($recv(self._class())._name()));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
- },
- args: [],
- source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
- referencedClasses: [],
- messageSends: ["error:", ",", "name", "class"]
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "size",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._error_("Object not indexable");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
- },
- args: [],
- source: "size\x0a\x09self error: 'Object not indexable'",
- referencedClasses: [],
- messageSends: ["error:"]
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "subclassResponsibility",
- protocol: 'error handling',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._error_("This method is a responsibility of a subclass");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
- },
- args: [],
- source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
- referencedClasses: [],
- messageSends: ["error:"]
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "throw:",
- protocol: 'error handling',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- throw anObject ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},$globals.Object)});
- },
- args: ["anObject"],
- source: "throw: anObject\x0a\x09< throw anObject >",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "value",
- protocol: 'evaluating',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.valueOf();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
- },
- args: [],
- source: "value\x0a\x09<return self.valueOf()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "accessorProtocolWith:",
- protocol: 'helios',
- fn: function (aGenerator){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aGenerator)._accessorProtocolForObject();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
- },
- args: ["aGenerator"],
- source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
- referencedClasses: [],
- messageSends: ["accessorProtocolForObject"]
- }),
- $globals.Object.klass);
- $core.addMethod(
- $core.method({
- selector: "accessorsSourceCodesWith:",
- protocol: 'helios',
- fn: function (aGenerator){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aGenerator)._accessorsForObject();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
- },
- args: ["aGenerator"],
- source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
- referencedClasses: [],
- messageSends: ["accessorsForObject"]
- }),
- $globals.Object.klass);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "initialize\x0a\x09\x22no op\x22",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Object.klass);
- $core.addMethod(
- $core.method({
- selector: "initializeProtocolWith:",
- protocol: 'helios',
- fn: function (aGenerator){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aGenerator)._initializeProtocolForObject();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
- },
- args: ["aGenerator"],
- source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
- referencedClasses: [],
- messageSends: ["initializeProtocolForObject"]
- }),
- $globals.Object.klass);
- $core.addMethod(
- $core.method({
- selector: "initializeSourceCodesWith:",
- protocol: 'helios',
- fn: function (aGenerator){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aGenerator)._initializeForObject();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
- },
- args: ["aGenerator"],
- source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
- referencedClasses: [],
- messageSends: ["initializeForObject"]
- }),
- $globals.Object.klass);
- $core.addClass('Boolean', $globals.Object, [], 'Kernel-Objects');
- $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: [ ... ]";
- $core.addMethod(
- $core.method({
- selector: "&",
- protocol: 'controlling',
- fn: function (aBoolean){
- var self=this;
- return $core.withContext(function($ctx1) {
- if(self == true) {
- return aBoolean;
- } else {
- return false;
- }
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
- },
- args: ["aBoolean"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Boolean);
- $core.addMethod(
- $core.method({
- selector: "==",
- protocol: 'comparing',
- fn: function (aBoolean){
- var self=this;
- return $core.withContext(function($ctx1) {
- return aBoolean != null && self.valueOf() === (typeof aBoolean === "boolean" ? aBoolean : aBoolean.valueOf());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
- },
- args: ["aBoolean"],
- source: "== aBoolean\x0a<return aBoolean != null && self.valueOf() === (typeof aBoolean === \x22boolean\x22 ? aBoolean : aBoolean.valueOf())>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Boolean);
- $core.addMethod(
- $core.method({
- selector: "and:",
- protocol: 'controlling',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=self.__eq(true);
- $1=$recv($2)._ifTrue_ifFalse_(aBlock,(function(){
- return false;
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
- },
- args: ["aBlock"],
- source: "and: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ false ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "="]
- }),
- $globals.Boolean);
- $core.addMethod(
- $core.method({
- selector: "asBit",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- if($core.assert(self)){
- $1=(1);
- } else {
- $1=(0);
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
- },
- args: [],
- source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:"]
- }),
- $globals.Boolean);
- $core.addMethod(
- $core.method({
- selector: "asJSON",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "asJSON\x0a\x09^ self",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Boolean);
- $core.addMethod(
- $core.method({
- selector: "asString",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.toString() ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
- },
- args: [],
- source: "asString\x0a\x09< return self.toString() >",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Boolean);
- $core.addMethod(
- $core.method({
- selector: "deepCopy",
- protocol: 'copying',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "deepCopy\x0a\x09^ self",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Boolean);
- $core.addMethod(
- $core.method({
- selector: "ifFalse:",
- protocol: 'controlling',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._ifTrue_ifFalse_((function(){
- }),aBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
- },
- args: ["aBlock"],
- source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:"]
- }),
- $globals.Boolean);
- $core.addMethod(
- $core.method({
- selector: "ifFalse:ifTrue:",
- protocol: 'controlling',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._ifTrue_ifFalse_(anotherBlock,aBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
- },
- args: ["aBlock", "anotherBlock"],
- source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:"]
- }),
- $globals.Boolean);
- $core.addMethod(
- $core.method({
- selector: "ifTrue:",
- protocol: 'controlling',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._ifTrue_ifFalse_(aBlock,(function(){
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
- },
- args: ["aBlock"],
- source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:"]
- }),
- $globals.Boolean);
- $core.addMethod(
- $core.method({
- selector: "ifTrue:ifFalse:",
- protocol: 'controlling',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- if(self == true) {
- return aBlock._value();
- } else {
- return anotherBlock._value();
- }
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
- },
- args: ["aBlock", "anotherBlock"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Boolean);
- $core.addMethod(
- $core.method({
- selector: "isBoolean",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isBoolean\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Boolean);
- $core.addMethod(
- $core.method({
- selector: "isImmutable",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isImmutable\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Boolean);
- $core.addMethod(
- $core.method({
- selector: "not",
- protocol: 'controlling',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self.__eq(false);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
- },
- args: [],
- source: "not\x0a\x09^ self = false",
- referencedClasses: [],
- messageSends: ["="]
- }),
- $globals.Boolean);
- $core.addMethod(
- $core.method({
- selector: "or:",
- protocol: 'controlling',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=self.__eq(true);
- $1=$recv($2)._ifTrue_ifFalse_((function(){
- return true;
- }),aBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
- },
- args: ["aBlock"],
- source: "or: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: aBlock",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "="]
- }),
- $globals.Boolean);
- $core.addMethod(
- $core.method({
- selector: "printOn:",
- protocol: 'printing',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aStream)._nextPutAll_(self._asString());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
- },
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "asString"]
- }),
- $globals.Boolean);
- $core.addMethod(
- $core.method({
- selector: "shallowCopy",
- protocol: 'copying',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "shallowCopy\x0a\x09^ self",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Boolean);
- $core.addMethod(
- $core.method({
- selector: "|",
- protocol: 'controlling',
- fn: function (aBoolean){
- var self=this;
- return $core.withContext(function($ctx1) {
- if(self == true) {
- return true;
- } else {
- return aBoolean;
- }
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
- },
- args: ["aBoolean"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Boolean);
- $core.addClass('Date', $globals.Object, [], 'Kernel-Objects');
- $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.).";
- $core.addMethod(
- $core.method({
- selector: "+",
- protocol: 'arithmetic',
- fn: function (aDate){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self + aDate;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
- },
- args: ["aDate"],
- source: "+ aDate\x0a\x09<return self + aDate>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "-",
- protocol: 'arithmetic',
- fn: function (aDate){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self - aDate;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
- },
- args: ["aDate"],
- source: "- aDate\x0a\x09<return self - aDate>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "<",
- protocol: 'comparing',
- fn: function (aDate){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self < aDate;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
- },
- args: ["aDate"],
- source: "< aDate\x0a\x09<return self < aDate>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "<=",
- protocol: 'comparing',
- fn: function (aDate){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self <= aDate;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
- },
- args: ["aDate"],
- source: "<= aDate\x0a\x09<return self <= aDate>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "=",
- protocol: 'comparing',
- fn: function (aDate){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $3,$2,$4,$1;
- $3=$recv(aDate)._class();
- $ctx1.sendIdx["class"]=1;
- $2=$recv($3).__eq_eq(self._class());
- $ctx1.sendIdx["=="]=1;
- $1=$recv($2)._and_((function(){
- return $core.withContext(function($ctx2) {
- $4=self._asMilliseconds();
- $ctx2.sendIdx["asMilliseconds"]=1;
- return $recv($4).__eq_eq($recv(aDate)._asMilliseconds());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
- },
- args: ["aDate"],
- source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
- referencedClasses: [],
- messageSends: ["and:", "==", "class", "asMilliseconds"]
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: ">",
- protocol: 'comparing',
- fn: function (aDate){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self > aDate;
- return self;
- }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)});
- },
- args: ["aDate"],
- source: "> aDate\x0a\x09<return self >> aDate>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: ">=",
- protocol: 'comparing',
- fn: function (aDate){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self >= aDate;
- return self;
- }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
- },
- args: ["aDate"],
- source: ">= aDate\x0a\x09<return self >>= aDate>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "asDateString",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.toDateString();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
- },
- args: [],
- source: "asDateString\x0a\x09<return self.toDateString()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "asLocaleString",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.toLocaleString();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
- },
- args: [],
- source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "asMilliseconds",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._time();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
- },
- args: [],
- source: "asMilliseconds\x0a\x09^ self time",
- referencedClasses: [],
- messageSends: ["time"]
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "asNumber",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._asMilliseconds();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
- },
- args: [],
- source: "asNumber\x0a\x09^ self asMilliseconds",
- referencedClasses: [],
- messageSends: ["asMilliseconds"]
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "asString",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.toString();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
- },
- args: [],
- source: "asString\x0a\x09<return self.toString()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "asTimeString",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.toTimeString();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
- },
- args: [],
- source: "asTimeString\x0a\x09<return self.toTimeString()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "day",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._dayOfWeek();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
- },
- args: [],
- source: "day\x0a\x09^ self dayOfWeek",
- referencedClasses: [],
- messageSends: ["dayOfWeek"]
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "day:",
- protocol: 'accessing',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._dayOfWeek_(aNumber);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
- },
- args: ["aNumber"],
- source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
- referencedClasses: [],
- messageSends: ["dayOfWeek:"]
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "dayOfMonth",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.getDate();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
- },
- args: [],
- source: "dayOfMonth\x0a\x09<return self.getDate()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "dayOfMonth:",
- protocol: 'accessing',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- self.setDate(aNumber);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
- },
- args: ["aNumber"],
- source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "dayOfWeek",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.getDay() + 1;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
- },
- args: [],
- source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "dayOfWeek:",
- protocol: 'accessing',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.setDay(aNumber - 1);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
- },
- args: ["aNumber"],
- source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "hours",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.getHours();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
- },
- args: [],
- source: "hours\x0a\x09<return self.getHours()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "hours:",
- protocol: 'accessing',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- self.setHours(aNumber);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
- },
- args: ["aNumber"],
- source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "milliseconds",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.getMilliseconds();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
- },
- args: [],
- source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "milliseconds:",
- protocol: 'accessing',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- self.setMilliseconds(aNumber);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
- },
- args: ["aNumber"],
- source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "minutes",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.getMinutes();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
- },
- args: [],
- source: "minutes\x0a\x09<return self.getMinutes()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "minutes:",
- protocol: 'accessing',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- self.setMinutes(aNumber);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
- },
- args: ["aNumber"],
- source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "month",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.getMonth() + 1;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
- },
- args: [],
- source: "month\x0a\x09<return self.getMonth() + 1>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "month:",
- protocol: 'accessing',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- self.setMonth(aNumber - 1);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
- },
- args: ["aNumber"],
- source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "printOn:",
- protocol: 'printing',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aStream)._nextPutAll_(self._asString());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
- },
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "asString"]
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "seconds",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.getSeconds();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
- },
- args: [],
- source: "seconds\x0a\x09<return self.getSeconds()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "seconds:",
- protocol: 'accessing',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- self.setSeconds(aNumber);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
- },
- args: ["aNumber"],
- source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "time",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.getTime();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
- },
- args: [],
- source: "time\x0a\x09<return self.getTime()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "time:",
- protocol: 'accessing',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- self.setTime(aNumber);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
- },
- args: ["aNumber"],
- source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "year",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.getFullYear();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
- },
- args: [],
- source: "year\x0a\x09<return self.getFullYear()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "year:",
- protocol: 'accessing',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- self.setFullYear(aNumber);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
- },
- args: ["aNumber"],
- source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "classTag",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return "magnitude";
- },
- args: [],
- 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'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date.klass);
- $core.addMethod(
- $core.method({
- selector: "fromMilliseconds:",
- protocol: 'instance creation',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._new_(aNumber);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.klass)});
- },
- args: ["aNumber"],
- source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
- referencedClasses: [],
- messageSends: ["new:"]
- }),
- $globals.Date.klass);
- $core.addMethod(
- $core.method({
- selector: "fromSeconds:",
- protocol: 'instance creation',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._fromMilliseconds_($recv(aNumber).__star((1000)));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.klass)});
- },
- args: ["aNumber"],
- source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
- referencedClasses: [],
- messageSends: ["fromMilliseconds:", "*"]
- }),
- $globals.Date.klass);
- $core.addMethod(
- $core.method({
- selector: "fromString:",
- protocol: 'instance creation',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._new_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.klass)});
- },
- args: ["aString"],
- source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
- referencedClasses: [],
- messageSends: ["new:"]
- }),
- $globals.Date.klass);
- $core.addMethod(
- $core.method({
- selector: "millisecondsToRun:",
- protocol: 'instance creation',
- fn: function (aBlock){
- var self=this;
- var t;
- function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
- return $core.withContext(function($ctx1) {
- var $1;
- t=$recv($Date())._now();
- $ctx1.sendIdx["now"]=1;
- $recv(aBlock)._value();
- $1=$recv($recv($Date())._now()).__minus(t);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.klass)});
- },
- args: ["aBlock"],
- source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
- referencedClasses: ["Date"],
- messageSends: ["now", "value", "-"]
- }),
- $globals.Date.klass);
- $core.addMethod(
- $core.method({
- selector: "new:",
- protocol: 'instance creation',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- return new Date(anObject);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.klass)});
- },
- args: ["anObject"],
- source: "new: anObject\x0a\x09<return new Date(anObject)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Date.klass);
- $core.addMethod(
- $core.method({
- selector: "now",
- protocol: 'instance creation',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._today();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.klass)});
- },
- args: [],
- source: "now\x0a\x09^ self today",
- referencedClasses: [],
- messageSends: ["today"]
- }),
- $globals.Date.klass);
- $core.addMethod(
- $core.method({
- selector: "today",
- protocol: 'instance creation',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._new();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.klass)});
- },
- args: [],
- source: "today\x0a\x09^ self new",
- referencedClasses: [],
- messageSends: ["new"]
- }),
- $globals.Date.klass);
- $core.addClass('Number', $globals.Object, [], 'Kernel-Objects');
- $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 ].";
- $core.addMethod(
- $core.method({
- selector: "&",
- protocol: 'converting',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self & aNumber;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
- },
- args: ["aNumber"],
- source: "& aNumber\x0a\x09<return self & aNumber>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "*",
- protocol: 'arithmetic',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self * aNumber;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
- },
- args: ["aNumber"],
- source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "**",
- protocol: 'mathematical functions',
- fn: function (exponent){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._raisedTo_(exponent);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
- },
- args: ["exponent"],
- source: "** exponent\x0a\x09^ self raisedTo: exponent",
- referencedClasses: [],
- messageSends: ["raisedTo:"]
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "+",
- protocol: 'arithmetic',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self + aNumber;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
- },
- args: ["aNumber"],
- source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "-",
- protocol: 'arithmetic',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self - aNumber;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
- },
- args: ["aNumber"],
- source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "/",
- protocol: 'arithmetic',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self / aNumber;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
- },
- args: ["aNumber"],
- source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "//",
- protocol: 'arithmetic',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self.__slash(aNumber))._floor();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
- },
- args: ["aNumber"],
- source: "// aNumber\x0a\x09^ (self / aNumber) floor",
- referencedClasses: [],
- messageSends: ["floor", "/"]
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "<",
- protocol: 'comparing',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self < aNumber;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
- },
- args: ["aNumber"],
- source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "<=",
- protocol: 'comparing',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self <= aNumber;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
- },
- args: ["aNumber"],
- source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "==",
- protocol: 'comparing',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- return aNumber != null && Number(self) === (typeof aNumber === "number" ? aNumber : aNumber.valueOf());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
- },
- args: ["aNumber"],
- source: "== aNumber\x0a<return aNumber != null && Number(self) === (typeof aNumber === \x22number\x22 ? aNumber : aNumber.valueOf())>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: ">",
- protocol: 'comparing',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self > aNumber;
- return self;
- }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
- },
- args: ["aNumber"],
- source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: ">=",
- protocol: 'comparing',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self >= aNumber;
- return self;
- }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
- },
- args: ["aNumber"],
- source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "@",
- protocol: 'converting',
- fn: function (aNumber){
- var self=this;
- function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Point())._x_y_(self,aNumber);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
- },
- args: ["aNumber"],
- source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
- referencedClasses: ["Point"],
- messageSends: ["x:y:"]
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "\x5c\x5c",
- protocol: 'arithmetic',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self % aNumber;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
- },
- args: ["aNumber"],
- source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "abs",
- protocol: 'arithmetic',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Math.abs(self);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
- },
- args: [],
- source: "abs\x0a\x09<return Math.abs(self);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "arcCos",
- protocol: 'mathematical functions',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Math.acos(self);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
- },
- args: [],
- source: "arcCos\x0a\x09<return Math.acos(self);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "arcSin",
- protocol: 'mathematical functions',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Math.asin(self);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
- },
- args: [],
- source: "arcSin\x0a\x09<return Math.asin(self);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "arcTan",
- protocol: 'mathematical functions',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Math.atan(self);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
- },
- args: [],
- source: "arcTan\x0a\x09<return Math.atan(self);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "asJSON",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "asJSON\x0a\x09^ self",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "asJavascript",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv("(".__comma(self._printString())).__comma(")");
- $ctx1.sendIdx[","]=1;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Number)});
- },
- args: [],
- source: "asJavascript\x0a\x09^ '(', self printString, ')'",
- referencedClasses: [],
- messageSends: [",", "printString"]
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "asNumber",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "asNumber\x0a\x09^ self",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "asPoint",
- protocol: 'converting',
- fn: function (){
- var self=this;
- function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Point())._x_y_(self,self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
- },
- args: [],
- source: "asPoint\x0a\x09^ Point x: self y: self",
- referencedClasses: ["Point"],
- messageSends: ["x:y:"]
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "asString",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return String(self) ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
- },
- args: [],
- source: "asString\x0a\x09< return String(self) >",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "atRandom",
- protocol: 'converting',
- fn: function (){
- var self=this;
- function $Random(){return $globals.Random||(typeof Random=="undefined"?nil:Random)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv($recv($recv($recv($Random())._new())._next()).__star(self))._truncated()).__plus((1));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
- },
- args: [],
- source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
- referencedClasses: ["Random"],
- messageSends: ["+", "truncated", "*", "next", "new"]
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "ceiling",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Math.ceil(self);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
- },
- args: [],
- source: "ceiling\x0a\x09<return Math.ceil(self);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "copy",
- protocol: 'copying',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "copy\x0a\x09^ self",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "cos",
- protocol: 'mathematical functions',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Math.cos(self);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
- },
- args: [],
- source: "cos\x0a\x09<return Math.cos(self);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "deepCopy",
- protocol: 'copying',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._copy();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
- },
- args: [],
- source: "deepCopy\x0a\x09^ self copy",
- referencedClasses: [],
- messageSends: ["copy"]
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "even",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=(0).__eq(self.__backslash_backslash((2)));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
- },
- args: [],
- source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
- referencedClasses: [],
- messageSends: ["=", "\x5c\x5c"]
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "floor",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Math.floor(self);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
- },
- args: [],
- source: "floor\x0a\x09<return Math.floor(self);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "isImmutable",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isImmutable\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "isNumber",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isNumber\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "isZero",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self.__eq((0));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
- },
- args: [],
- source: "isZero\x0a\x09^ self = 0",
- referencedClasses: [],
- messageSends: ["="]
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "ln",
- protocol: 'mathematical functions',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Math.log(self);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
- },
- args: [],
- source: "ln\x0a\x09<return Math.log(self);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "log",
- protocol: 'mathematical functions',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Math.log(self) / Math.LN10;;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
- },
- args: [],
- source: "log\x0a\x09<return Math.log(self) / Math.LN10;>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "log:",
- protocol: 'mathematical functions',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Math.log(self) / Math.log(aNumber);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
- },
- args: ["aNumber"],
- source: "log: aNumber\x0a\x09<return Math.log(self) / Math.log(aNumber);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "max:",
- protocol: 'arithmetic',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Math.max(self, aNumber);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
- },
- args: ["aNumber"],
- source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "min:",
- protocol: 'arithmetic',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Math.min(self, aNumber);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
- },
- args: ["aNumber"],
- source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "negated",
- protocol: 'arithmetic',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=(0).__minus(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
- },
- args: [],
- source: "negated\x0a\x09^ 0 - self",
- referencedClasses: [],
- messageSends: ["-"]
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "negative",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self.__lt((0));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
- },
- args: [],
- source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
- referencedClasses: [],
- messageSends: ["<"]
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "odd",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._even())._not();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
- },
- args: [],
- source: "odd\x0a\x09^ self even not",
- referencedClasses: [],
- messageSends: ["not", "even"]
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "positive",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self.__gt_eq((0));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
- },
- args: [],
- source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
- referencedClasses: [],
- messageSends: [">="]
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "printOn:",
- protocol: 'printing',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aStream)._nextPutAll_(self._asString());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
- },
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "asString"]
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "printShowingDecimalPlaces:",
- protocol: 'printing',
- fn: function (placesDesired){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.toFixed(placesDesired);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
- },
- args: ["placesDesired"],
- source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "raisedTo:",
- protocol: 'mathematical functions',
- fn: function (exponent){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Math.pow(self, exponent);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
- },
- args: ["exponent"],
- source: "raisedTo: exponent\x0a\x09<return Math.pow(self, exponent);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "rounded",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Math.round(self);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
- },
- args: [],
- source: "rounded\x0a\x09<return Math.round(self);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "sign",
- protocol: 'mathematical functions',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=self._isZero();
- if($core.assert($1)){
- return (0);
- };
- $2=self._positive();
- if($core.assert($2)){
- return (1);
- } else {
- return (-1);
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
- },
- args: [],
- source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
- referencedClasses: [],
- messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "sin",
- protocol: 'mathematical functions',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Math.sin(self);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
- },
- args: [],
- source: "sin\x0a\x09<return Math.sin(self);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "sqrt",
- protocol: 'mathematical functions',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Math.sqrt(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
- },
- args: [],
- source: "sqrt\x0a\x09<return Math.sqrt(self)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "squared",
- protocol: 'mathematical functions',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self.__star(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
- },
- args: [],
- source: "squared\x0a\x09^ self * self",
- referencedClasses: [],
- messageSends: ["*"]
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "tan",
- protocol: 'mathematical functions',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Math.tan(self);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
- },
- args: [],
- source: "tan\x0a\x09<return Math.tan(self);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "timesRepeat:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- var count;
- return $core.withContext(function($ctx1) {
- count=(1);
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return $recv(count).__gt(self);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._whileFalse_((function(){
- return $core.withContext(function($ctx2) {
- $recv(aBlock)._value();
- count=$recv(count).__plus((1));
- return count;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
- },
- args: ["aBlock"],
- source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
- referencedClasses: [],
- messageSends: ["whileFalse:", ">", "value", "+"]
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "to:",
- protocol: 'converting',
- fn: function (aNumber){
- var self=this;
- var array,first,last,count;
- function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
- return $core.withContext(function($ctx1) {
- var $1;
- first=self._truncated();
- $ctx1.sendIdx["truncated"]=1;
- last=$recv($recv(aNumber)._truncated()).__plus((1));
- $ctx1.sendIdx["+"]=1;
- count=(1);
- array=$recv($Array())._new();
- $recv($recv(last).__minus(first))._timesRepeat_((function(){
- return $core.withContext(function($ctx2) {
- $recv(array)._at_put_(count,first);
- count=$recv(count).__plus((1));
- $ctx2.sendIdx["+"]=2;
- count;
- first=$recv(first).__plus((1));
- return first;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $1=array;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
- },
- args: ["aNumber"],
- 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",
- referencedClasses: ["Array"],
- messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "to:by:",
- protocol: 'converting',
- fn: function (stop,step){
- var self=this;
- var array,value,pos;
- function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3;
- value=self;
- array=$recv($Array())._new();
- pos=(1);
- $1=$recv(step).__eq((0));
- if($core.assert($1)){
- self._error_("step must be non-zero");
- };
- $2=$recv(step).__lt((0));
- if($core.assert($2)){
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return $recv(value).__gt_eq(stop);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }))._whileTrue_((function(){
- return $core.withContext(function($ctx2) {
- $recv(array)._at_put_(pos,value);
- $ctx2.sendIdx["at:put:"]=1;
- pos=$recv(pos).__plus((1));
- $ctx2.sendIdx["+"]=1;
- pos;
- value=$recv(value).__plus(step);
- $ctx2.sendIdx["+"]=2;
- return value;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
- }));
- $ctx1.sendIdx["whileTrue:"]=1;
- } else {
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return $recv(value).__lt_eq(stop);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
- }))._whileTrue_((function(){
- return $core.withContext(function($ctx2) {
- $recv(array)._at_put_(pos,value);
- pos=$recv(pos).__plus((1));
- $ctx2.sendIdx["+"]=3;
- pos;
- value=$recv(value).__plus(step);
- return value;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
- }));
- };
- $3=array;
- return $3;
- }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
- },
- args: ["stop", "step"],
- 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",
- referencedClasses: ["Array"],
- messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "to:by:do:",
- protocol: 'enumerating',
- fn: function (stop,step,aBlock){
- var self=this;
- var value;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- value=self;
- $1=$recv(step).__eq((0));
- if($core.assert($1)){
- self._error_("step must be non-zero");
- };
- $2=$recv(step).__lt((0));
- if($core.assert($2)){
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return $recv(value).__gt_eq(stop);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }))._whileTrue_((function(){
- return $core.withContext(function($ctx2) {
- $recv(aBlock)._value_(value);
- $ctx2.sendIdx["value:"]=1;
- value=$recv(value).__plus(step);
- $ctx2.sendIdx["+"]=1;
- return value;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
- }));
- $ctx1.sendIdx["whileTrue:"]=1;
- } else {
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return $recv(value).__lt_eq(stop);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
- }))._whileTrue_((function(){
- return $core.withContext(function($ctx2) {
- $recv(aBlock)._value_(value);
- value=$recv(value).__plus(step);
- return value;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
- }));
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
- },
- args: ["stop", "step", "aBlock"],
- 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 ]]",
- referencedClasses: [],
- messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "to:do:",
- protocol: 'enumerating',
- fn: function (stop,aBlock){
- var self=this;
- var nextValue;
- return $core.withContext(function($ctx1) {
- nextValue=self;
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return $recv(nextValue).__lt_eq(stop);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._whileTrue_((function(){
- return $core.withContext(function($ctx2) {
- $recv(aBlock)._value_(nextValue);
- nextValue=$recv(nextValue).__plus((1));
- return nextValue;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
- },
- args: ["stop", "aBlock"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["whileTrue:", "<=", "value:", "+"]
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "truncated",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- if(self >= 0) {
- return Math.floor(self);
- } else {
- return Math.floor(self * (-1)) * (-1);
- };
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
- },
- args: [],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "|",
- protocol: 'converting',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self | aNumber;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
- },
- args: ["aNumber"],
- source: "| aNumber\x0a\x09<return self | aNumber>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number);
- $core.addMethod(
- $core.method({
- selector: "classTag",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return "magnitude";
- },
- args: [],
- 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'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number.klass);
- $core.addMethod(
- $core.method({
- selector: "e",
- protocol: 'instance creation',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Math.E;;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.klass)});
- },
- args: [],
- source: "e\x0a\x09<return Math.E;>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number.klass);
- $core.addMethod(
- $core.method({
- selector: "pi",
- protocol: 'instance creation',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Math.PI;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.klass)});
- },
- args: [],
- source: "pi\x0a\x09<return Math.PI>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Number.klass);
- $core.addClass('Point', $globals.Object, ['x', 'y'], 'Kernel-Objects');
- $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";
- $core.addMethod(
- $core.method({
- selector: "*",
- protocol: 'arithmetic',
- fn: function (aPoint){
- var self=this;
- function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
- return $core.withContext(function($ctx1) {
- var $3,$5,$4,$2,$7,$6,$1;
- $3=self._x();
- $ctx1.sendIdx["x"]=1;
- $5=$recv(aPoint)._asPoint();
- $ctx1.sendIdx["asPoint"]=1;
- $4=$recv($5)._x();
- $2=$recv($3).__star($4);
- $ctx1.sendIdx["*"]=1;
- $7=self._y();
- $ctx1.sendIdx["y"]=1;
- $6=$recv($7).__star($recv($recv(aPoint)._asPoint())._y());
- $1=$recv($Point())._x_y_($2,$6);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
- },
- args: ["aPoint"],
- source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
- referencedClasses: ["Point"],
- messageSends: ["x:y:", "*", "x", "asPoint", "y"]
- }),
- $globals.Point);
- $core.addMethod(
- $core.method({
- selector: "+",
- protocol: 'arithmetic',
- fn: function (aPoint){
- var self=this;
- function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
- return $core.withContext(function($ctx1) {
- var $3,$5,$4,$2,$7,$6,$1;
- $3=self._x();
- $ctx1.sendIdx["x"]=1;
- $5=$recv(aPoint)._asPoint();
- $ctx1.sendIdx["asPoint"]=1;
- $4=$recv($5)._x();
- $2=$recv($3).__plus($4);
- $ctx1.sendIdx["+"]=1;
- $7=self._y();
- $ctx1.sendIdx["y"]=1;
- $6=$recv($7).__plus($recv($recv(aPoint)._asPoint())._y());
- $1=$recv($Point())._x_y_($2,$6);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
- },
- args: ["aPoint"],
- source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
- referencedClasses: ["Point"],
- messageSends: ["x:y:", "+", "x", "asPoint", "y"]
- }),
- $globals.Point);
- $core.addMethod(
- $core.method({
- selector: "-",
- protocol: 'arithmetic',
- fn: function (aPoint){
- var self=this;
- function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
- return $core.withContext(function($ctx1) {
- var $3,$5,$4,$2,$7,$6,$1;
- $3=self._x();
- $ctx1.sendIdx["x"]=1;
- $5=$recv(aPoint)._asPoint();
- $ctx1.sendIdx["asPoint"]=1;
- $4=$recv($5)._x();
- $2=$recv($3).__minus($4);
- $ctx1.sendIdx["-"]=1;
- $7=self._y();
- $ctx1.sendIdx["y"]=1;
- $6=$recv($7).__minus($recv($recv(aPoint)._asPoint())._y());
- $1=$recv($Point())._x_y_($2,$6);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
- },
- args: ["aPoint"],
- source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
- referencedClasses: ["Point"],
- messageSends: ["x:y:", "-", "x", "asPoint", "y"]
- }),
- $globals.Point);
- $core.addMethod(
- $core.method({
- selector: "/",
- protocol: 'arithmetic',
- fn: function (aPoint){
- var self=this;
- function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
- return $core.withContext(function($ctx1) {
- var $3,$5,$4,$2,$7,$6,$1;
- $3=self._x();
- $ctx1.sendIdx["x"]=1;
- $5=$recv(aPoint)._asPoint();
- $ctx1.sendIdx["asPoint"]=1;
- $4=$recv($5)._x();
- $2=$recv($3).__slash($4);
- $ctx1.sendIdx["/"]=1;
- $7=self._y();
- $ctx1.sendIdx["y"]=1;
- $6=$recv($7).__slash($recv($recv(aPoint)._asPoint())._y());
- $1=$recv($Point())._x_y_($2,$6);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
- },
- args: ["aPoint"],
- source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
- referencedClasses: ["Point"],
- messageSends: ["x:y:", "/", "x", "asPoint", "y"]
- }),
- $globals.Point);
- $core.addMethod(
- $core.method({
- selector: "<",
- protocol: 'comparing',
- fn: function (aPoint){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $3,$2,$4,$1;
- $3=self._x();
- $ctx1.sendIdx["x"]=1;
- $2=$recv($3).__lt($recv(aPoint)._x());
- $ctx1.sendIdx["<"]=1;
- $1=$recv($2)._and_((function(){
- return $core.withContext(function($ctx2) {
- $4=self._y();
- $ctx2.sendIdx["y"]=1;
- return $recv($4).__lt($recv(aPoint)._y());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
- },
- args: ["aPoint"],
- source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
- referencedClasses: [],
- messageSends: ["and:", "<", "x", "y"]
- }),
- $globals.Point);
- $core.addMethod(
- $core.method({
- selector: "<=",
- protocol: 'comparing',
- fn: function (aPoint){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $3,$2,$4,$1;
- $3=self._x();
- $ctx1.sendIdx["x"]=1;
- $2=$recv($3).__lt_eq($recv(aPoint)._x());
- $ctx1.sendIdx["<="]=1;
- $1=$recv($2)._and_((function(){
- return $core.withContext(function($ctx2) {
- $4=self._y();
- $ctx2.sendIdx["y"]=1;
- return $recv($4).__lt_eq($recv(aPoint)._y());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
- },
- args: ["aPoint"],
- source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
- referencedClasses: [],
- messageSends: ["and:", "<=", "x", "y"]
- }),
- $globals.Point);
- $core.addMethod(
- $core.method({
- selector: "=",
- protocol: 'comparing',
- fn: function (aPoint){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $3,$2,$5,$4,$7,$6,$1;
- $3=$recv(aPoint)._class();
- $ctx1.sendIdx["class"]=1;
- $2=$recv($3).__eq(self._class());
- $ctx1.sendIdx["="]=1;
- $1=$recv($2)._and_((function(){
- return $core.withContext(function($ctx2) {
- $5=$recv(aPoint)._x();
- $ctx2.sendIdx["x"]=1;
- $4=$recv($5).__eq(self._x());
- $ctx2.sendIdx["="]=2;
- $7=$recv(aPoint)._y();
- $ctx2.sendIdx["y"]=1;
- $6=$recv($7).__eq(self._y());
- return $recv($4).__and($6);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
- },
- args: ["aPoint"],
- source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
- referencedClasses: [],
- messageSends: ["and:", "=", "class", "&", "x", "y"]
- }),
- $globals.Point);
- $core.addMethod(
- $core.method({
- selector: ">",
- protocol: 'comparing',
- fn: function (aPoint){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $3,$2,$4,$1;
- $3=self._x();
- $ctx1.sendIdx["x"]=1;
- $2=$recv($3).__gt($recv(aPoint)._x());
- $ctx1.sendIdx[">"]=1;
- $1=$recv($2)._and_((function(){
- return $core.withContext(function($ctx2) {
- $4=self._y();
- $ctx2.sendIdx["y"]=1;
- return $recv($4).__gt($recv(aPoint)._y());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
- },
- args: ["aPoint"],
- source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
- referencedClasses: [],
- messageSends: ["and:", ">", "x", "y"]
- }),
- $globals.Point);
- $core.addMethod(
- $core.method({
- selector: ">=",
- protocol: 'comparing',
- fn: function (aPoint){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $3,$2,$4,$1;
- $3=self._x();
- $ctx1.sendIdx["x"]=1;
- $2=$recv($3).__gt_eq($recv(aPoint)._x());
- $ctx1.sendIdx[">="]=1;
- $1=$recv($2)._and_((function(){
- return $core.withContext(function($ctx2) {
- $4=self._y();
- $ctx2.sendIdx["y"]=1;
- return $recv($4).__gt_eq($recv(aPoint)._y());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
- },
- args: ["aPoint"],
- source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
- referencedClasses: [],
- messageSends: ["and:", ">=", "x", "y"]
- }),
- $globals.Point);
- $core.addMethod(
- $core.method({
- selector: "asPoint",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "asPoint\x0a\x09^ self",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Point);
- $core.addMethod(
- $core.method({
- selector: "dist:",
- protocol: 'transforming',
- fn: function (aPoint){
- var self=this;
- var dx,dy;
- return $core.withContext(function($ctx1) {
- var $3,$2,$1;
- dx=$recv($recv(aPoint)._x()).__minus(self["@x"]);
- $ctx1.sendIdx["-"]=1;
- dy=$recv($recv(aPoint)._y()).__minus(self["@y"]);
- $3=$recv(dx).__star(dx);
- $ctx1.sendIdx["*"]=1;
- $2=$recv($3).__plus($recv(dy).__star(dy));
- $1=$recv($2)._sqrt();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
- },
- args: ["aPoint"],
- 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",
- referencedClasses: [],
- messageSends: ["-", "x", "y", "sqrt", "+", "*"]
- }),
- $globals.Point);
- $core.addMethod(
- $core.method({
- selector: "printOn:",
- protocol: 'printing',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $recv(self["@x"])._printOn_(aStream);
- $ctx1.sendIdx["printOn:"]=1;
- $recv(aStream)._nextPutAll_("@");
- $1=$recv($recv(self["@y"])._notNil())._and_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self["@y"])._negative();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- if($core.assert($1)){
- $recv(aStream)._space();
- };
- $recv(self["@y"])._printOn_(aStream);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
- },
- args: ["aStream"],
- 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",
- referencedClasses: [],
- messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
- }),
- $globals.Point);
- $core.addMethod(
- $core.method({
- selector: "translateBy:",
- protocol: 'transforming',
- fn: function (delta){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=$recv($recv(delta)._x()).__plus(self["@x"]);
- $ctx1.sendIdx["+"]=1;
- $1=$recv($2).__at($recv($recv(delta)._y()).__plus(self["@y"]));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
- },
- args: ["delta"],
- source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
- referencedClasses: [],
- messageSends: ["@", "+", "x", "y"]
- }),
- $globals.Point);
- $core.addMethod(
- $core.method({
- selector: "x",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@x"];
- return $1;
- },
- args: [],
- source: "x\x0a\x09^ x",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Point);
- $core.addMethod(
- $core.method({
- selector: "x:",
- protocol: 'accessing',
- fn: function (aNumber){
- var self=this;
- self["@x"]=aNumber;
- return self;
- },
- args: ["aNumber"],
- source: "x: aNumber\x0a\x09x := aNumber",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Point);
- $core.addMethod(
- $core.method({
- selector: "y",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@y"];
- return $1;
- },
- args: [],
- source: "y\x0a\x09^ y",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Point);
- $core.addMethod(
- $core.method({
- selector: "y:",
- protocol: 'accessing',
- fn: function (aNumber){
- var self=this;
- self["@y"]=aNumber;
- return self;
- },
- args: ["aNumber"],
- source: "y: aNumber\x0a\x09y := aNumber",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Point);
- $core.addMethod(
- $core.method({
- selector: "classTag",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return "magnitude";
- },
- args: [],
- 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'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Point.klass);
- $core.addMethod(
- $core.method({
- selector: "x:y:",
- protocol: 'instance creation',
- fn: function (aNumber,anotherNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- $recv($2)._x_(aNumber);
- $recv($2)._y_(anotherNumber);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.klass)});
- },
- args: ["aNumber", "anotherNumber"],
- source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["x:", "new", "y:", "yourself"]
- }),
- $globals.Point.klass);
- $core.addClass('Random', $globals.Object, [], 'Kernel-Objects');
- $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'`.";
- $core.addMethod(
- $core.method({
- selector: "next",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Math.random();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
- },
- args: [],
- source: "next\x0a\x09<return Math.random()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Random);
- $core.addMethod(
- $core.method({
- selector: "next:",
- protocol: 'accessing',
- fn: function (anInteger){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv((1)._to_(anInteger))._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return self._next();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
- },
- args: ["anInteger"],
- source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
- referencedClasses: [],
- messageSends: ["collect:", "to:", "next"]
- }),
- $globals.Random);
- $core.addClass('UndefinedObject', $globals.Object, [], 'Kernel-Objects');
- $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`.";
- $core.addMethod(
- $core.method({
- selector: "asJSON",
- protocol: 'converting',
- fn: function (){
- var self=this;
- var $1;
- $1=null;
- return $1;
- },
- args: [],
- source: "asJSON\x0a\x09^ null",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.UndefinedObject);
- $core.addMethod(
- $core.method({
- selector: "deepCopy",
- protocol: 'copying',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "deepCopy\x0a\x09^ self",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.UndefinedObject);
- $core.addMethod(
- $core.method({
- selector: "ifNil:",
- protocol: 'testing',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._ifNil_ifNotNil_(aBlock,(function(){
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
- },
- args: ["aBlock"],
- source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
- referencedClasses: [],
- messageSends: ["ifNil:ifNotNil:"]
- }),
- $globals.UndefinedObject);
- $core.addMethod(
- $core.method({
- selector: "ifNil:ifNotNil:",
- protocol: 'testing',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aBlock)._value();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
- },
- args: ["aBlock", "anotherBlock"],
- source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
- referencedClasses: [],
- messageSends: ["value"]
- }),
- $globals.UndefinedObject);
- $core.addMethod(
- $core.method({
- selector: "ifNotNil:",
- protocol: 'testing',
- fn: function (aBlock){
- var self=this;
- return self;
- },
- args: ["aBlock"],
- source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.UndefinedObject);
- $core.addMethod(
- $core.method({
- selector: "ifNotNil:ifNil:",
- protocol: 'testing',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(anotherBlock)._value();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
- },
- args: ["aBlock", "anotherBlock"],
- source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
- referencedClasses: [],
- messageSends: ["value"]
- }),
- $globals.UndefinedObject);
- $core.addMethod(
- $core.method({
- selector: "isImmutable",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isImmutable\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.UndefinedObject);
- $core.addMethod(
- $core.method({
- selector: "isNil",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isNil\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.UndefinedObject);
- $core.addMethod(
- $core.method({
- selector: "notNil",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "notNil\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.UndefinedObject);
- $core.addMethod(
- $core.method({
- selector: "printOn:",
- protocol: 'printing',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aStream)._nextPutAll_("nil");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
- },
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
- referencedClasses: [],
- messageSends: ["nextPutAll:"]
- }),
- $globals.UndefinedObject);
- $core.addMethod(
- $core.method({
- selector: "shallowCopy",
- protocol: 'copying',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "shallowCopy\x0a\x09^ self",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.UndefinedObject);
- $core.addMethod(
- $core.method({
- selector: "subclass:instanceVariableNames:",
- protocol: 'class creation',
- fn: function (aString,anotherString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.UndefinedObject)});
- },
- args: ["aString", "anotherString"],
- source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
- referencedClasses: [],
- messageSends: ["subclass:instanceVariableNames:package:"]
- }),
- $globals.UndefinedObject);
- $core.addMethod(
- $core.method({
- selector: "subclass:instanceVariableNames:category:",
- protocol: 'class creation',
- fn: function (aString,aString2,aString3){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
- },
- args: ["aString", "aString2", "aString3"],
- source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
- referencedClasses: [],
- messageSends: ["subclass:instanceVariableNames:package:"]
- }),
- $globals.UndefinedObject);
- $core.addMethod(
- $core.method({
- selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
- protocol: 'class creation',
- fn: function (aString,aString2,classVars,pools,aString3){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.UndefinedObject)});
- },
- args: ["aString", "aString2", "classVars", "pools", "aString3"],
- 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",
- referencedClasses: [],
- messageSends: ["subclass:instanceVariableNames:package:"]
- }),
- $globals.UndefinedObject);
- $core.addMethod(
- $core.method({
- selector: "subclass:instanceVariableNames:package:",
- protocol: 'class creation',
- fn: function (aString,aString2,aString3){
- var self=this;
- function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
- },
- args: ["aString", "aString2", "aString3"],
- source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
- referencedClasses: ["ClassBuilder"],
- messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
- }),
- $globals.UndefinedObject);
- $core.addMethod(
- $core.method({
- selector: "new",
- protocol: 'instance creation',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._error_("You cannot create new instances of UndefinedObject. Use nil");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.klass)});
- },
- args: [],
- source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
- referencedClasses: [],
- messageSends: ["error:"]
- }),
- $globals.UndefinedObject.klass);
- });
- define("amber_core/Kernel-Classes", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
- var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
- $core.addPackage('Kernel-Classes');
- $core.packages["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
- $core.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
- $core.addClass('Behavior', $globals.Object, [], 'Kernel-Classes');
- $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.";
- $core.addMethod(
- $core.method({
- selector: ">>",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._methodAt_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.Behavior)});
- },
- args: ["aString"],
- source: ">> aString\x0a\x09^ self methodAt: aString",
- referencedClasses: [],
- messageSends: ["methodAt:"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "addCompiledMethod:",
- protocol: 'compiling',
- fn: function (aMethod){
- var self=this;
- var oldMethod,announcement;
- function $MethodAdded(){return $globals.MethodAdded||(typeof MethodAdded=="undefined"?nil:MethodAdded)}
- function $MethodModified(){return $globals.MethodModified||(typeof MethodModified=="undefined"?nil:MethodModified)}
- function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$receiver;
- oldMethod=$recv(self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
- return nil;
- }));
- $2=self._protocols();
- $3=$recv(aMethod)._protocol();
- $ctx1.sendIdx["protocol"]=1;
- $1=$recv($2)._includes_($3);
- if(!$core.assert($1)){
- $4=self._organization();
- $5=$recv(aMethod)._protocol();
- $ctx1.sendIdx["protocol"]=2;
- $recv($4)._addElement_($5);
- };
- self._basicAddCompiledMethod_(aMethod);
- $6=oldMethod;
- if(($receiver = $6) == null || $receiver.isNil){
- $6;
- } else {
- self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
- };
- $7=oldMethod;
- if(($receiver = $7) == null || $receiver.isNil){
- $8=$recv($MethodAdded())._new();
- $ctx1.sendIdx["new"]=1;
- $recv($8)._method_(aMethod);
- $ctx1.sendIdx["method:"]=1;
- $9=$recv($8)._yourself();
- $ctx1.sendIdx["yourself"]=1;
- announcement=$9;
- } else {
- $10=$recv($MethodModified())._new();
- $recv($10)._oldMethod_(oldMethod);
- $recv($10)._method_(aMethod);
- $11=$recv($10)._yourself();
- announcement=$11;
- };
- $recv($recv($SystemAnnouncer())._current())._announce_(announcement);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.Behavior)});
- },
- args: ["aMethod"],
- 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",
- referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
- messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "allInstanceVariableNames",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var result;
- return $core.withContext(function($ctx1) {
- var $1,$2,$receiver;
- result=$recv(self._instanceVariableNames())._copy();
- $1=self._superclass();
- $ctx1.sendIdx["superclass"]=1;
- if(($receiver = $1) == null || $receiver.isNil){
- $1;
- } else {
- $recv(result)._addAll_($recv(self._superclass())._allInstanceVariableNames());
- };
- $2=result;
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
- },
- args: [],
- source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
- referencedClasses: [],
- messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "allSelectors",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$4,$1;
- $2=self._allSuperclasses();
- $3=self._selectors();
- $ctx1.sendIdx["selectors"]=1;
- $1=$recv($2)._inject_into_($3,(function(acc,each){
- return $core.withContext(function($ctx2) {
- $recv(acc)._addAll_($recv(each)._selectors());
- $4=$recv(acc)._yourself();
- return $4;
- }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
- },
- args: [],
- source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
- referencedClasses: [],
- messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "allSubclasses",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var subclasses,index;
- return $core.withContext(function($ctx1) {
- var $1;
- subclasses=self._subclasses();
- $ctx1.sendIdx["subclasses"]=1;
- index=(1);
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return $recv(index).__gt($recv(subclasses)._size());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._whileFalse_((function(){
- return $core.withContext(function($ctx2) {
- $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
- index=$recv(index).__plus((1));
- return index;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- $1=subclasses;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{subclasses:subclasses,index:index},$globals.Behavior)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "allSubclassesDo:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._allSubclasses())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(aBlock)._value_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
- },
- args: ["aBlock"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["do:", "allSubclasses", "value:"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "allSuperclasses",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$5,$4,$6,$3,$receiver;
- $1=self._superclass();
- $ctx1.sendIdx["superclass"]=1;
- if(($receiver = $1) == null || $receiver.isNil){
- $2=[];
- return $2;
- } else {
- $1;
- };
- $5=self._superclass();
- $ctx1.sendIdx["superclass"]=2;
- $4=$recv($OrderedCollection())._with_($5);
- $recv($4)._addAll_($recv(self._superclass())._allSuperclasses());
- $6=$recv($4)._yourself();
- $3=$6;
- return $3;
- }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
- },
- args: [],
- 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",
- referencedClasses: ["OrderedCollection"],
- messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "basicAddCompiledMethod:",
- protocol: 'private',
- fn: function (aMethod){
- var self=this;
- return $core.withContext(function($ctx1) {
- $core.addMethod(aMethod, self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
- },
- args: ["aMethod"],
- source: "basicAddCompiledMethod: aMethod\x0a\x09<$core.addMethod(aMethod, self)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "basicNew",
- protocol: 'instance creation',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return new self.fn();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
- },
- args: [],
- source: "basicNew\x0a\x09<return new self.fn()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "basicRemoveCompiledMethod:",
- protocol: 'private',
- fn: function (aMethod){
- var self=this;
- return $core.withContext(function($ctx1) {
- $core.removeMethod(aMethod,self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
- },
- args: ["aMethod"],
- source: "basicRemoveCompiledMethod: aMethod\x0a\x09<$core.removeMethod(aMethod,self)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "canUnderstand:",
- protocol: 'testing',
- fn: function (aSelector){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $3,$2,$1;
- $1=$recv(self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
- return $core.withContext(function($ctx2) {
- $3=self._superclass();
- $ctx2.sendIdx["superclass"]=1;
- $2=$recv($3)._notNil();
- return $recv($2)._and_((function(){
- return $core.withContext(function($ctx3) {
- return $recv(self._superclass())._canUnderstand_(aSelector);
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
- },
- args: ["aSelector"],
- source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
- referencedClasses: [],
- messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "comment",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self._basicAt_("comment");
- if(($receiver = $2) == null || $receiver.isNil){
- $1="";
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.Behavior)});
- },
- args: [],
- source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
- referencedClasses: [],
- messageSends: ["ifNil:", "basicAt:"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "comment:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- function $ClassCommentChanged(){return $globals.ClassCommentChanged||(typeof ClassCommentChanged=="undefined"?nil:ClassCommentChanged)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- self._basicAt_put_("comment",aString);
- $1=$recv($ClassCommentChanged())._new();
- $recv($1)._theClass_(self);
- $2=$recv($1)._yourself();
- $recv($recv($SystemAnnouncer())._current())._announce_($2);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.Behavior)});
- },
- args: ["aString"],
- 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)",
- referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
- messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "compile:protocol:",
- protocol: 'compiling',
- fn: function (aString,anotherString){
- var self=this;
- function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv($Compiler())._new())._install_forClass_protocol_(aString,self,anotherString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.Behavior)});
- },
- args: ["aString", "anotherString"],
- source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
- referencedClasses: ["Compiler"],
- messageSends: ["install:forClass:protocol:", "new"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "definition",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return "";
- },
- args: [],
- source: "definition\x0a\x09^ ''",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "includesBehavior:",
- protocol: 'testing',
- fn: function (aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self.__eq_eq(aClass))._or_((function(){
- return $core.withContext(function($ctx2) {
- return self._inheritsFrom_(aClass);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
- },
- args: ["aClass"],
- source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
- referencedClasses: [],
- messageSends: ["or:", "==", "inheritsFrom:"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "includesSelector:",
- protocol: 'testing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._methodDictionary())._includesKey_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.Behavior)});
- },
- args: ["aString"],
- source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
- referencedClasses: [],
- messageSends: ["includesKey:", "methodDictionary"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "inheritsFrom:",
- protocol: 'testing',
- fn: function (aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$4,$3,$2,$receiver;
- $1=self._superclass();
- $ctx1.sendIdx["superclass"]=1;
- if(($receiver = $1) == null || $receiver.isNil){
- return false;
- } else {
- $1;
- };
- $4=self._superclass();
- $ctx1.sendIdx["superclass"]=2;
- $3=$recv(aClass).__eq_eq($4);
- $2=$recv($3)._or_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self._superclass())._inheritsFrom_(aClass);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
- },
- args: ["aClass"],
- source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
- referencedClasses: [],
- messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "instanceVariableNames",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.iVarNames;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
- },
- args: [],
- source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "isBehavior",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isBehavior\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "javascriptConstructor",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.fn;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
- },
- args: [],
- source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<return self.fn>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "javascriptConstructor:",
- protocol: 'accessing',
- fn: function (aJavaScriptFunction){
- var self=this;
- return $core.withContext(function($ctx1) {
- $core.setClassConstructor(self, aJavaScriptFunction);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
- },
- args: ["aJavaScriptFunction"],
- 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);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "lookupSelector:",
- protocol: 'accessing',
- fn: function (selector){
- var self=this;
- var lookupClass;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- var $early={};
- try {
- lookupClass=self;
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return $recv(lookupClass).__eq(nil);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._whileFalse_((function(){
- return $core.withContext(function($ctx2) {
- $1=$recv(lookupClass)._includesSelector_(selector);
- if($core.assert($1)){
- $2=$recv(lookupClass)._methodAt_(selector);
- throw $early=[$2];
- };
- lookupClass=$recv(lookupClass)._superclass();
- return lookupClass;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- return nil;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
- },
- args: ["selector"],
- 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",
- referencedClasses: [],
- messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "methodAt:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._methodDictionary())._at_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.Behavior)});
- },
- args: ["aString"],
- source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
- referencedClasses: [],
- messageSends: ["at:", "methodDictionary"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "methodDictionary",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var dict = $globals.HashedCollection._new();
- var methods = self.methods;
- Object.keys(methods).forEach(function(i) {
- if(methods[i].selector) {
- dict._at_put_(methods[i].selector, methods[i]);
- }
- });
- return dict;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.Behavior)});
- },
- args: [],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "methodTemplate",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $core.withContext(function($ctx1) {
- var $3,$4,$2,$7,$8,$6,$9,$5,$10,$1;
- $1=$recv($String())._streamContents_((function(stream){
- return $core.withContext(function($ctx2) {
- $recv(stream)._nextPutAll_("messageSelectorAndArgumentNames");
- $ctx2.sendIdx["nextPutAll:"]=1;
- $3=$recv($String())._lf();
- $ctx2.sendIdx["lf"]=1;
- $4=$recv($String())._tab();
- $ctx2.sendIdx["tab"]=1;
- $2=$recv($3).__comma($4);
- $ctx2.sendIdx[","]=1;
- $recv(stream)._nextPutAll_($2);
- $ctx2.sendIdx["nextPutAll:"]=2;
- $recv(stream)._nextPutAll_("\x22comment stating purpose of message\x22");
- $ctx2.sendIdx["nextPutAll:"]=3;
- $7=$recv($String())._lf();
- $ctx2.sendIdx["lf"]=2;
- $8=$recv($String())._lf();
- $ctx2.sendIdx["lf"]=3;
- $6=$recv($7).__comma($8);
- $ctx2.sendIdx[","]=3;
- $9=$recv($String())._tab();
- $ctx2.sendIdx["tab"]=2;
- $5=$recv($6).__comma($9);
- $ctx2.sendIdx[","]=2;
- $recv(stream)._nextPutAll_($5);
- $ctx2.sendIdx["nextPutAll:"]=4;
- $recv(stream)._nextPutAll_("| temporary variable names |");
- $ctx2.sendIdx["nextPutAll:"]=5;
- $recv(stream)._nextPutAll_($recv($recv($String())._lf()).__comma($recv($String())._tab()));
- $ctx2.sendIdx["nextPutAll:"]=6;
- $10=$recv(stream)._nextPutAll_("statements");
- return $10;
- }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.Behavior)});
- },
- args: [],
- 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' ]",
- referencedClasses: ["String"],
- messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "methods",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._methodDictionary())._values();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.Behavior)});
- },
- args: [],
- source: "methods\x0a\x09^ self methodDictionary values",
- referencedClasses: [],
- messageSends: ["values", "methodDictionary"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "methodsInProtocol:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._methods())._select_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv($recv(each)._protocol()).__eq(aString);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.Behavior)});
- },
- args: ["aString"],
- source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
- referencedClasses: [],
- messageSends: ["select:", "methods", "=", "protocol"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "name",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.className || nil;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Behavior)});
- },
- args: [],
- source: "name\x0a\x09<return self.className || nil>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "new",
- protocol: 'instance creation',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._basicNew())._initialize();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
- },
- args: [],
- source: "new\x0a\x09^ self basicNew initialize",
- referencedClasses: [],
- messageSends: ["initialize", "basicNew"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "organization",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._basicAt_("organization");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Behavior)});
- },
- args: [],
- source: "organization\x0a\x09^ self basicAt: 'organization'",
- referencedClasses: [],
- messageSends: ["basicAt:"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "ownMethods",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $1=$recv($recv(self._ownProtocols())._inject_into_($recv($OrderedCollection())._new(),(function(acc,each){
- return $core.withContext(function($ctx2) {
- return $recv(acc).__comma(self._methodsInProtocol_(each));
- }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
- })))._sorted_((function(a,b){
- return $core.withContext(function($ctx2) {
- $2=$recv(a)._selector();
- $ctx2.sendIdx["selector"]=1;
- return $recv($2).__lt_eq($recv(b)._selector());
- }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.Behavior)});
- },
- args: [],
- 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 ]",
- referencedClasses: ["OrderedCollection"],
- messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "methodsInProtocol:", "<=", "selector"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "ownProtocols",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._protocols())._reject_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._match_("^\x5c*");
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.Behavior)});
- },
- args: [],
- 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*' ]",
- referencedClasses: [],
- messageSends: ["reject:", "protocols", "match:"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "packageOfProtocol:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3;
- $1=$recv(aString)._beginsWith_("*");
- if(!$core.assert($1)){
- $2=self._package();
- return $2;
- };
- $3=$recv($Package())._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
- return nil;
- }));
- return $3;
- }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.Behavior)});
- },
- args: ["aString"],
- 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 ]",
- referencedClasses: ["Package"],
- messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "protocols",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv(self._organization())._elements())._sorted();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.Behavior)});
- },
- args: [],
- source: "protocols\x0a\x09^ self organization elements sorted",
- referencedClasses: [],
- messageSends: ["sorted", "elements", "organization"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "protocolsDo:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- var methodsByProtocol;
- function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
- function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
- return $core.withContext(function($ctx1) {
- methodsByProtocol=$recv($HashedCollection())._new();
- $ctx1.sendIdx["new"]=1;
- $recv(self._methodDictionary())._valuesDo_((function(m){
- return $core.withContext(function($ctx2) {
- return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
- return $core.withContext(function($ctx3) {
- return $recv($Array())._new();
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- })))._add_(m);
- }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
- }));
- $recv(self._protocols())._do_((function(protocol){
- return $core.withContext(function($ctx2) {
- return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
- }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.Behavior)});
- },
- args: ["aBlock"],
- 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) ]",
- referencedClasses: ["HashedCollection", "Array"],
- messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "prototype",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.fn.prototype;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
- },
- args: [],
- source: "prototype\x0a\x09<return self.fn.prototype>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "recompile",
- protocol: 'compiling',
- fn: function (){
- var self=this;
- function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv($Compiler())._new())._recompile_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.Behavior)});
- },
- args: [],
- source: "recompile\x0a\x09^ Compiler new recompile: self",
- referencedClasses: ["Compiler"],
- messageSends: ["recompile:", "new"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "removeCompiledMethod:",
- protocol: 'compiling',
- fn: function (aMethod){
- var self=this;
- function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- function $MethodRemoved(){return $globals.MethodRemoved||(typeof MethodRemoved=="undefined"?nil:MethodRemoved)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- self._basicRemoveCompiledMethod_(aMethod);
- self._removeProtocolIfEmpty_($recv(aMethod)._protocol());
- $1=$recv($MethodRemoved())._new();
- $recv($1)._method_(aMethod);
- $2=$recv($1)._yourself();
- $recv($recv($SystemAnnouncer())._current())._announce_($2);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
- },
- args: ["aMethod"],
- 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)",
- referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
- messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "removeProtocolIfEmpty:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._methods())._detect_ifNone_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv($recv(each)._protocol()).__eq(aString);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- return $recv(self._organization())._removeElement_(aString);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.Behavior)});
- },
- args: ["aString"],
- source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
- referencedClasses: [],
- messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "selectors",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._methodDictionary())._keys();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.Behavior)});
- },
- args: [],
- source: "selectors\x0a\x09^ self methodDictionary keys",
- referencedClasses: [],
- messageSends: ["keys", "methodDictionary"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "subclasses",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
- },
- args: [],
- source: "subclasses\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "superclass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.superclass || nil;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
- },
- args: [],
- source: "superclass\x0a\x09<return self.superclass || nil>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "theMetaClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
- },
- args: [],
- source: "theMetaClass\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "theNonMetaClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
- },
- args: [],
- source: "theNonMetaClass\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "withAllSubclasses",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($Array())._with_(self);
- $recv($2)._addAll_(self._allSubclasses());
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
- },
- args: [],
- source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
- referencedClasses: ["Array"],
- messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
- }),
- $globals.Behavior);
- $core.addClass('Class', $globals.Behavior, [], 'Kernel-Classes');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "asJavascript",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1="$globals.".__comma(self._name());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Class)});
- },
- args: [],
- source: "asJavascript\x0a\x09^ '$globals.', self name",
- referencedClasses: [],
- messageSends: [",", "name"]
- }),
- $globals.Class);
- $core.addMethod(
- $core.method({
- selector: "browse",
- protocol: 'browsing',
- fn: function (){
- var self=this;
- function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
- return $core.withContext(function($ctx1) {
- $recv($Finder())._findClass_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Class)});
- },
- args: [],
- source: "browse\x0a\x09Finder findClass: self",
- referencedClasses: ["Finder"],
- messageSends: ["findClass:"]
- }),
- $globals.Class);
- $core.addMethod(
- $core.method({
- selector: "category",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self._package();
- $ctx1.sendIdx["package"]=1;
- if(($receiver = $2) == null || $receiver.isNil){
- $1="Unclassified";
- } else {
- $1=$recv(self._package())._name();
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.Class)});
- },
- args: [],
- source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
- referencedClasses: [],
- messageSends: ["ifNil:ifNotNil:", "package", "name"]
- }),
- $globals.Class);
- $core.addMethod(
- $core.method({
- selector: "classTag",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return "class";
- },
- args: [],
- 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'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Class);
- $core.addMethod(
- $core.method({
- selector: "definition",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $core.withContext(function($ctx1) {
- var $3,$4,$2,$5,$6,$7,$1;
- $1=$recv($String())._streamContents_((function(stream){
- return $core.withContext(function($ctx2) {
- $recv(stream)._nextPutAll_($recv(self._superclass())._asString());
- $ctx2.sendIdx["nextPutAll:"]=1;
- $recv(stream)._nextPutAll_(" subclass: #");
- $ctx2.sendIdx["nextPutAll:"]=2;
- $recv(stream)._nextPutAll_(self._name());
- $ctx2.sendIdx["nextPutAll:"]=3;
- $3=$recv($String())._lf();
- $ctx2.sendIdx["lf"]=1;
- $4=$recv($String())._tab();
- $ctx2.sendIdx["tab"]=1;
- $2=$recv($3).__comma($4);
- $ctx2.sendIdx[","]=1;
- $recv(stream)._nextPutAll_($2);
- $ctx2.sendIdx["nextPutAll:"]=4;
- $5=$recv(stream)._nextPutAll_("instanceVariableNames: '");
- $ctx2.sendIdx["nextPutAll:"]=5;
- $5;
- $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
- return $core.withContext(function($ctx3) {
- return $recv(stream)._nextPutAll_(each);
- $ctx3.sendIdx["nextPutAll:"]=6;
- }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
- }),(function(){
- return $core.withContext(function($ctx3) {
- return $recv(stream)._nextPutAll_(" ");
- $ctx3.sendIdx["nextPutAll:"]=7;
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
- }));
- $6=$recv("'".__comma($recv($String())._lf())).__comma($recv($String())._tab());
- $ctx2.sendIdx[","]=2;
- $recv(stream)._nextPutAll_($6);
- $ctx2.sendIdx["nextPutAll:"]=8;
- $recv(stream)._nextPutAll_("package: '");
- $ctx2.sendIdx["nextPutAll:"]=9;
- $recv(stream)._nextPutAll_(self._category());
- $ctx2.sendIdx["nextPutAll:"]=10;
- $7=$recv(stream)._nextPutAll_("'");
- return $7;
- }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
- },
- args: [],
- 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: '''' ]",
- referencedClasses: ["String"],
- messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category"]
- }),
- $globals.Class);
- $core.addMethod(
- $core.method({
- selector: "isClass",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isClass\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Class);
- $core.addMethod(
- $core.method({
- selector: "package",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._basicAt_("pkg");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Class)});
- },
- args: [],
- source: "package\x0a\x09^ self basicAt: 'pkg'",
- referencedClasses: [],
- messageSends: ["basicAt:"]
- }),
- $globals.Class);
- $core.addMethod(
- $core.method({
- selector: "package:",
- protocol: 'accessing',
- fn: function (aPackage){
- var self=this;
- var oldPackage;
- function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- function $ClassMoved(){return $globals.ClassMoved||(typeof ClassMoved=="undefined"?nil:ClassMoved)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$3,$4,$5;
- $2=self._package();
- $ctx1.sendIdx["package"]=1;
- $1=$recv($2).__eq(aPackage);
- if($core.assert($1)){
- return self;
- };
- oldPackage=self._package();
- self._basicAt_put_("pkg",aPackage);
- $3=$recv(oldPackage)._organization();
- $ctx1.sendIdx["organization"]=1;
- $recv($3)._removeElement_(self);
- $recv($recv(aPackage)._organization())._addElement_(self);
- $4=$recv($ClassMoved())._new();
- $recv($4)._theClass_(self);
- $recv($4)._oldPackage_(oldPackage);
- $5=$recv($4)._yourself();
- $recv($recv($SystemAnnouncer())._current())._announce_($5);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.Class)});
- },
- args: ["aPackage"],
- 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)",
- referencedClasses: ["SystemAnnouncer", "ClassMoved"],
- messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
- }),
- $globals.Class);
- $core.addMethod(
- $core.method({
- selector: "printOn:",
- protocol: 'printing',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aStream)._nextPutAll_(self._name());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Class)});
- },
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "name"]
- }),
- $globals.Class);
- $core.addMethod(
- $core.method({
- selector: "rename:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
- return $core.withContext(function($ctx1) {
- $recv($recv($ClassBuilder())._new())._renameClass_to_(self,aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
- },
- args: ["aString"],
- source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
- referencedClasses: ["ClassBuilder"],
- messageSends: ["renameClass:to:", "new"]
- }),
- $globals.Class);
- $core.addMethod(
- $core.method({
- selector: "subclass:instanceVariableNames:",
- protocol: 'class creation',
- fn: function (aString,anotherString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.Class)});
- },
- args: ["aString", "anotherString"],
- source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
- referencedClasses: [],
- messageSends: ["subclass:instanceVariableNames:package:"]
- }),
- $globals.Class);
- $core.addMethod(
- $core.method({
- selector: "subclass:instanceVariableNames:category:",
- protocol: 'class creation',
- fn: function (aString,aString2,aString3){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
- },
- args: ["aString", "aString2", "aString3"],
- source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
- referencedClasses: [],
- messageSends: ["subclass:instanceVariableNames:package:"]
- }),
- $globals.Class);
- $core.addMethod(
- $core.method({
- selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
- protocol: 'class creation',
- fn: function (aString,aString2,classVars,pools,aString3){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.Class)});
- },
- args: ["aString", "aString2", "classVars", "pools", "aString3"],
- 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",
- referencedClasses: [],
- messageSends: ["subclass:instanceVariableNames:package:"]
- }),
- $globals.Class);
- $core.addMethod(
- $core.method({
- selector: "subclass:instanceVariableNames:package:",
- protocol: 'class creation',
- fn: function (aString,aString2,aString3){
- var self=this;
- function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
- },
- args: ["aString", "aString2", "aString3"],
- source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
- referencedClasses: ["ClassBuilder"],
- messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
- }),
- $globals.Class);
- $core.addMethod(
- $core.method({
- selector: "subclasses",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.subclasses._copy();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
- },
- args: [],
- source: "subclasses\x0a\x09<return self.subclasses._copy()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Class);
- $core.addMethod(
- $core.method({
- selector: "theMetaClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._class();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
- },
- args: [],
- source: "theMetaClass\x0a\x09^ self class",
- referencedClasses: [],
- messageSends: ["class"]
- }),
- $globals.Class);
- $core.addMethod(
- $core.method({
- selector: "theNonMetaClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "theNonMetaClass\x0a\x09^ self",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Class);
- $core.addClass('Metaclass', $globals.Behavior, [], 'Kernel-Classes');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "asJavascript",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv("$globals.".__comma($recv(self._instanceClass())._name())).__comma(".klass");
- $ctx1.sendIdx[","]=1;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Metaclass)});
- },
- args: [],
- source: "asJavascript\x0a\x09^ '$globals.', self instanceClass name, '.klass'",
- referencedClasses: [],
- messageSends: [",", "name", "instanceClass"]
- }),
- $globals.Metaclass);
- $core.addMethod(
- $core.method({
- selector: "definition",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $1=$recv($String())._streamContents_((function(stream){
- return $core.withContext(function($ctx2) {
- $recv(stream)._nextPutAll_(self._asString());
- $ctx2.sendIdx["nextPutAll:"]=1;
- $2=$recv(stream)._nextPutAll_(" instanceVariableNames: '");
- $ctx2.sendIdx["nextPutAll:"]=2;
- $2;
- $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
- return $core.withContext(function($ctx3) {
- return $recv(stream)._nextPutAll_(each);
- $ctx3.sendIdx["nextPutAll:"]=3;
- }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
- }),(function(){
- return $core.withContext(function($ctx3) {
- return $recv(stream)._nextPutAll_(" ");
- $ctx3.sendIdx["nextPutAll:"]=4;
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
- }));
- return $recv(stream)._nextPutAll_("'");
- }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
- },
- args: [],
- 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: '''' ]",
- referencedClasses: ["String"],
- messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"]
- }),
- $globals.Metaclass);
- $core.addMethod(
- $core.method({
- selector: "instanceClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.instanceClass;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
- },
- args: [],
- source: "instanceClass\x0a\x09<return self.instanceClass>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Metaclass);
- $core.addMethod(
- $core.method({
- selector: "instanceVariableNames:",
- protocol: 'accessing',
- fn: function (aCollection){
- var self=this;
- function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
- return $core.withContext(function($ctx1) {
- $recv($recv($ClassBuilder())._new())._class_instanceVariableNames_(self,aCollection);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
- },
- args: ["aCollection"],
- source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
- referencedClasses: ["ClassBuilder"],
- messageSends: ["class:instanceVariableNames:", "new"]
- }),
- $globals.Metaclass);
- $core.addMethod(
- $core.method({
- selector: "isMetaclass",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isMetaclass\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Metaclass);
- $core.addMethod(
- $core.method({
- selector: "package",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._instanceClass())._package();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
- },
- args: [],
- source: "package\x0a\x09^ self instanceClass package",
- referencedClasses: [],
- messageSends: ["package", "instanceClass"]
- }),
- $globals.Metaclass);
- $core.addMethod(
- $core.method({
- selector: "printOn:",
- protocol: 'printing',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $recv(aStream)._nextPutAll_($recv(self._instanceClass())._name());
- $ctx1.sendIdx["nextPutAll:"]=1;
- $1=$recv(aStream)._nextPutAll_(" class");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Metaclass)});
- },
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "name", "instanceClass"]
- }),
- $globals.Metaclass);
- $core.addMethod(
- $core.method({
- selector: "subclasses",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv($recv(self._instanceClass())._subclasses())._select_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv($recv(each)._isMetaclass())._not();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- })))._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._theMetaClass();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
- },
- args: [],
- source: "subclasses\x0a\x09^ (self instanceClass subclasses \x0a\x09\x09select: [ :each | each isMetaclass not ])\x0a\x09\x09collect: [ :each | each theMetaClass ]",
- referencedClasses: [],
- messageSends: ["collect:", "select:", "subclasses", "instanceClass", "not", "isMetaclass", "theMetaClass"]
- }),
- $globals.Metaclass);
- $core.addMethod(
- $core.method({
- selector: "theMetaClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "theMetaClass\x0a\x09^ self",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Metaclass);
- $core.addMethod(
- $core.method({
- selector: "theNonMetaClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._instanceClass();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
- },
- args: [],
- source: "theNonMetaClass\x0a\x09^ self instanceClass",
- referencedClasses: [],
- messageSends: ["instanceClass"]
- }),
- $globals.Metaclass);
- $core.addClass('ClassBuilder', $globals.Object, [], 'Kernel-Classes');
- $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:`.";
- $core.addMethod(
- $core.method({
- selector: "addSubclassOf:named:instanceVariableNames:package:",
- protocol: 'class definition',
- fn: function (aClass,className,aCollection,packageName){
- var self=this;
- var theClass,thePackage;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$receiver;
- theClass=$recv($recv($Smalltalk())._globals())._at_(className);
- thePackage=$recv($Package())._named_(packageName);
- $1=theClass;
- if(($receiver = $1) == null || $receiver.isNil){
- $1;
- } else {
- $recv(theClass)._package_(thePackage);
- $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
- if(!$core.assert($2)){
- $3=self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
- return $3;
- };
- };
- $4=self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
- return $4;
- }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
- },
- args: ["aClass", "className", "aCollection", "packageName"],
- 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",
- referencedClasses: ["Smalltalk", "Package"],
- messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "basicAddSubclassOf:named:instanceVariableNames:package:"]
- }),
- $globals.ClassBuilder);
- $core.addMethod(
- $core.method({
- selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
- protocol: 'private',
- fn: function (aClass,aString,aCollection,packageName){
- var self=this;
- return $core.withContext(function($ctx1) {
- $core.addClass(aString, aClass, aCollection, packageName);
- return $globals[aString]
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
- },
- args: ["aClass", "aString", "aCollection", "packageName"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ClassBuilder);
- $core.addMethod(
- $core.method({
- selector: "basicClass:instanceVariableNames:",
- protocol: 'private',
- fn: function (aClass,aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
- },
- args: ["aClass", "aString"],
- source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
- referencedClasses: [],
- messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"]
- }),
- $globals.ClassBuilder);
- $core.addMethod(
- $core.method({
- selector: "basicClass:instanceVariables:",
- protocol: 'private',
- fn: function (aClass,aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aClass)._isMetaclass();
- if(!$core.assert($1)){
- self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
- };
- $recv(aClass)._basicAt_put_("iVarNames",aCollection);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
- },
- args: ["aClass", "aCollection"],
- source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
- referencedClasses: [],
- messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
- }),
- $globals.ClassBuilder);
- $core.addMethod(
- $core.method({
- selector: "basicRemoveClass:",
- protocol: 'private',
- fn: function (aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- $core.removeClass(aClass);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
- },
- args: ["aClass"],
- source: "basicRemoveClass: aClass\x0a\x09<$core.removeClass(aClass)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ClassBuilder);
- $core.addMethod(
- $core.method({
- selector: "basicRenameClass:to:",
- protocol: 'private',
- fn: function (aClass,aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- $globals[aString] = aClass;
- delete $globals[aClass.className];
- aClass.className = aString;
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
- },
- args: ["aClass", "aString"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ClassBuilder);
- $core.addMethod(
- $core.method({
- selector: "basicSwapClassNames:with:",
- protocol: 'private',
- fn: function (aClass,anotherClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- var tmp = aClass.className;
- aClass.className = anotherClass.className;
- anotherClass.className = tmp;
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
- },
- args: ["aClass", "anotherClass"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ClassBuilder);
- $core.addMethod(
- $core.method({
- selector: "class:instanceVariableNames:",
- protocol: 'class definition',
- fn: function (aClass,ivarNames){
- var self=this;
- function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- function $ClassDefinitionChanged(){return $globals.ClassDefinitionChanged||(typeof ClassDefinitionChanged=="undefined"?nil:ClassDefinitionChanged)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- self._basicClass_instanceVariableNames_(aClass,ivarNames);
- self._setupClass_(aClass);
- $1=$recv($ClassDefinitionChanged())._new();
- $recv($1)._theClass_(aClass);
- $2=$recv($1)._yourself();
- $recv($recv($SystemAnnouncer())._current())._announce_($2);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
- },
- args: ["aClass", "ivarNames"],
- 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)",
- referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
- messageSends: ["basicClass:instanceVariableNames:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"]
- }),
- $globals.ClassBuilder);
- $core.addMethod(
- $core.method({
- selector: "copyClass:named:",
- protocol: 'copying',
- fn: function (aClass,className){
- var self=this;
- var newClass;
- function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- function $ClassAdded(){return $globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3;
- newClass=self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
- self._copyClass_to_(aClass,newClass);
- $1=$recv($ClassAdded())._new();
- $recv($1)._theClass_(newClass);
- $2=$recv($1)._yourself();
- $recv($recv($SystemAnnouncer())._current())._announce_($2);
- $3=newClass;
- return $3;
- }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
- },
- args: ["aClass", "className"],
- 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",
- referencedClasses: ["SystemAnnouncer", "ClassAdded"],
- messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
- }),
- $globals.ClassBuilder);
- $core.addMethod(
- $core.method({
- selector: "copyClass:to:",
- protocol: 'copying',
- fn: function (aClass,anotherClass){
- var self=this;
- function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5,$7,$6,$9,$8;
- $recv(anotherClass)._comment_($recv(aClass)._comment());
- $1=$recv(aClass)._methodDictionary();
- $ctx1.sendIdx["methodDictionary"]=1;
- $recv($1)._valuesDo_((function(each){
- return $core.withContext(function($ctx2) {
- $2=$recv($Compiler())._new();
- $ctx2.sendIdx["new"]=1;
- $3=$recv(each)._source();
- $ctx2.sendIdx["source"]=1;
- $4=$recv(each)._protocol();
- $ctx2.sendIdx["protocol"]=1;
- return $recv($2)._install_forClass_protocol_($3,anotherClass,$4);
- $ctx2.sendIdx["install:forClass:protocol:"]=1;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $ctx1.sendIdx["valuesDo:"]=1;
- $5=$recv(anotherClass)._class();
- $ctx1.sendIdx["class"]=1;
- $7=$recv(aClass)._class();
- $ctx1.sendIdx["class"]=2;
- $6=$recv($7)._instanceVariableNames();
- self._basicClass_instanceVariables_($5,$6);
- $9=$recv(aClass)._class();
- $ctx1.sendIdx["class"]=3;
- $8=$recv($9)._methodDictionary();
- $recv($8)._valuesDo_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv($recv($Compiler())._new())._install_forClass_protocol_($recv(each)._source(),$recv(anotherClass)._class(),$recv(each)._protocol());
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- self._setupClass_(anotherClass);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
- },
- args: ["aClass", "anotherClass"],
- 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",
- referencedClasses: ["Compiler"],
- messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "install:forClass:protocol:", "new", "source", "protocol", "basicClass:instanceVariables:", "class", "instanceVariableNames", "setupClass:"]
- }),
- $globals.ClassBuilder);
- $core.addMethod(
- $core.method({
- selector: "installMethod:forClass:protocol:",
- protocol: 'method definition',
- fn: function (aCompiledMethod,aBehavior,aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aCompiledMethod)._protocol_(aString);
- $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
- return aCompiledMethod;
- }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
- },
- args: ["aCompiledMethod", "aBehavior", "aString"],
- source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
- referencedClasses: [],
- messageSends: ["protocol:", "addCompiledMethod:"]
- }),
- $globals.ClassBuilder);
- $core.addMethod(
- $core.method({
- selector: "instanceVariableNamesFor:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv(aString)._tokenize_(" "))._reject_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._isEmpty();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
- },
- args: ["aString"],
- source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
- referencedClasses: [],
- messageSends: ["reject:", "tokenize:", "isEmpty"]
- }),
- $globals.ClassBuilder);
- $core.addMethod(
- $core.method({
- selector: "migrateClass:superclass:",
- protocol: 'class migration',
- fn: function (aClass,anotherClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=$recv(aClass)._name();
- $ctx1.sendIdx["name"]=1;
- $1=self._migrateClassNamed_superclass_instanceVariableNames_package_($2,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
- },
- args: ["aClass", "anotherClass"],
- 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",
- referencedClasses: [],
- messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
- }),
- $globals.ClassBuilder);
- $core.addMethod(
- $core.method({
- selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
- protocol: 'class migration',
- fn: function (className,aClass,aCollection,packageName){
- var self=this;
- var oldClass,newClass,tmp;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- function $ClassMigrated(){return $globals.ClassMigrated||(typeof ClassMigrated=="undefined"?nil:ClassMigrated)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5;
- tmp="new*".__comma(className);
- oldClass=$recv($recv($Smalltalk())._globals())._at_(className);
- newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
- self._basicSwapClassNames_with_(oldClass,newClass);
- $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return self._copyClass_to_(oldClass,newClass);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._on_do_($Error(),(function(exception){
- return $core.withContext(function($ctx2) {
- self._basicSwapClassNames_with_(oldClass,newClass);
- $1=self._basicRemoveClass_(newClass);
- $ctx2.sendIdx["basicRemoveClass:"]=1;
- $1;
- return $recv(exception)._resignal();
- }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
- }));
- self._rawRenameClass_to_(oldClass,tmp);
- $ctx1.sendIdx["rawRenameClass:to:"]=1;
- $2=self._rawRenameClass_to_(newClass,className);
- $recv($recv(oldClass)._subclasses())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return self._migrateClass_superclass_(each,newClass);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
- }));
- self._basicRemoveClass_(oldClass);
- $3=$recv($ClassMigrated())._new();
- $recv($3)._theClass_(newClass);
- $recv($3)._oldClass_(oldClass);
- $4=$recv($3)._yourself();
- $recv($recv($SystemAnnouncer())._current())._announce_($4);
- $5=newClass;
- return $5;
- }, 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)});
- },
- args: ["className", "aClass", "aCollection", "packageName"],
- 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",
- referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
- 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"]
- }),
- $globals.ClassBuilder);
- $core.addMethod(
- $core.method({
- selector: "rawRenameClass:to:",
- protocol: 'private',
- fn: function (aClass,aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- $globals[aString] = aClass;
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
- },
- args: ["aClass", "aString"],
- source: "rawRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09$globals[aString] = aClass;\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ClassBuilder);
- $core.addMethod(
- $core.method({
- selector: "renameClass:to:",
- protocol: 'class migration',
- fn: function (aClass,className){
- var self=this;
- function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- function $ClassRenamed(){return $globals.ClassRenamed||(typeof ClassRenamed=="undefined"?nil:ClassRenamed)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- self._basicRenameClass_to_(aClass,className);
- $recv(aClass)._recompile();
- $1=$recv($ClassRenamed())._new();
- $recv($1)._theClass_(aClass);
- $2=$recv($1)._yourself();
- $recv($recv($SystemAnnouncer())._current())._announce_($2);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
- },
- args: ["aClass", "className"],
- 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)",
- referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
- messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
- }),
- $globals.ClassBuilder);
- $core.addMethod(
- $core.method({
- selector: "setupClass:",
- protocol: 'public',
- fn: function (aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- $core.init(aClass);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},$globals.ClassBuilder)});
- },
- args: ["aClass"],
- source: "setupClass: aClass\x0a\x09<$core.init(aClass);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ClassBuilder);
- $core.addMethod(
- $core.method({
- selector: "superclass:subclass:",
- protocol: 'class definition',
- fn: function (aClass,className){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
- },
- args: ["aClass", "className"],
- source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
- referencedClasses: [],
- messageSends: ["superclass:subclass:instanceVariableNames:package:"]
- }),
- $globals.ClassBuilder);
- $core.addMethod(
- $core.method({
- selector: "superclass:subclass:instanceVariableNames:package:",
- protocol: 'class definition',
- fn: function (aClass,className,ivarNames,packageName){
- var self=this;
- var newClass;
- function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- function $ClassAdded(){return $globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5,$receiver;
- $1=self._instanceVariableNamesFor_(ivarNames);
- if(($receiver = packageName) == null || $receiver.isNil){
- $2="unclassified";
- } else {
- $2=packageName;
- };
- newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
- self._setupClass_(newClass);
- $3=$recv($ClassAdded())._new();
- $recv($3)._theClass_(newClass);
- $4=$recv($3)._yourself();
- $recv($recv($SystemAnnouncer())._current())._announce_($4);
- $5=newClass;
- return $5;
- }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
- },
- args: ["aClass", "className", "ivarNames", "packageName"],
- 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",
- referencedClasses: ["SystemAnnouncer", "ClassAdded"],
- messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"]
- }),
- $globals.ClassBuilder);
- $core.addClass('ClassSorterNode', $globals.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "getNodesFrom:",
- protocol: 'accessing',
- fn: function (aCollection){
- var self=this;
- var children,others;
- function $ClassSorterNode(){return $globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
- return $core.withContext(function($ctx1) {
- var $1;
- children=[];
- others=[];
- $recv(aCollection)._do_((function(each){
- return $core.withContext(function($ctx2) {
- $1=$recv($recv(each)._superclass()).__eq(self._theClass());
- if($core.assert($1)){
- return $recv(children)._add_(each);
- $ctx2.sendIdx["add:"]=1;
- } else {
- return $recv(others)._add_(each);
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- self["@nodes"]=$recv(children)._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv($ClassSorterNode())._on_classes_level_(each,others,$recv(self._level()).__plus((1)));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
- },
- args: ["aCollection"],
- 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 ]",
- referencedClasses: ["ClassSorterNode"],
- messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
- }),
- $globals.ClassSorterNode);
- $core.addMethod(
- $core.method({
- selector: "level",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@level"];
- return $1;
- },
- args: [],
- source: "level\x0a\x09^ level",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ClassSorterNode);
- $core.addMethod(
- $core.method({
- selector: "level:",
- protocol: 'accessing',
- fn: function (anInteger){
- var self=this;
- self["@level"]=anInteger;
- return self;
- },
- args: ["anInteger"],
- source: "level: anInteger\x0a\x09level := anInteger",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ClassSorterNode);
- $core.addMethod(
- $core.method({
- selector: "nodes",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@nodes"];
- return $1;
- },
- args: [],
- source: "nodes\x0a\x09^ nodes",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ClassSorterNode);
- $core.addMethod(
- $core.method({
- selector: "theClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@theClass"];
- return $1;
- },
- args: [],
- source: "theClass\x0a\x09^ theClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ClassSorterNode);
- $core.addMethod(
- $core.method({
- selector: "theClass:",
- protocol: 'accessing',
- fn: function (aClass){
- var self=this;
- self["@theClass"]=aClass;
- return self;
- },
- args: ["aClass"],
- source: "theClass: aClass\x0a\x09theClass := aClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ClassSorterNode);
- $core.addMethod(
- $core.method({
- selector: "traverseClassesWith:",
- protocol: 'visiting',
- fn: function (aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$3,$2;
- $1=self._theClass();
- $ctx1.sendIdx["theClass"]=1;
- $recv(aCollection)._add_($1);
- $recv($recv(self._nodes())._sorted_((function(a,b){
- return $core.withContext(function($ctx2) {
- $3=$recv(a)._theClass();
- $ctx2.sendIdx["theClass"]=2;
- $2=$recv($3)._name();
- $ctx2.sendIdx["name"]=1;
- return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
- }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
- })))._do_((function(aNode){
- return $core.withContext(function($ctx2) {
- return $recv(aNode)._traverseClassesWith_(aCollection);
- }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
- },
- args: ["aCollection"],
- 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 ].",
- referencedClasses: [],
- messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
- }),
- $globals.ClassSorterNode);
- $core.addMethod(
- $core.method({
- selector: "on:classes:level:",
- protocol: 'instance creation',
- fn: function (aClass,aCollection,anInteger){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- $recv($2)._theClass_(aClass);
- $recv($2)._level_(anInteger);
- $recv($2)._getNodesFrom_(aCollection);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.klass)});
- },
- args: ["aClass", "aCollection", "anInteger"],
- 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",
- referencedClasses: [],
- messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
- }),
- $globals.ClassSorterNode.klass);
- });
- define("amber_core/Kernel-Methods", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
- var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
- $core.addPackage('Kernel-Methods');
- $core.packages["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
- $core.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
- $core.addClass('BlockClosure', $globals.Object, [], 'Kernel-Methods');
- $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 | ... ] `";
- $core.addMethod(
- $core.method({
- selector: "applyTo:arguments:",
- protocol: 'evaluating',
- fn: function (anObject,aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.apply(anObject, aCollection);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
- },
- args: ["anObject", "aCollection"],
- source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "asCompiledMethod:",
- protocol: 'converting',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- return $core.method({selector:aString, fn:self});;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
- },
- args: ["aString"],
- source: "asCompiledMethod: aString\x0a\x09<return $core.method({selector:aString, fn:self});>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "compiledSource",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.toString();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
- },
- args: [],
- source: "compiledSource\x0a\x09<return self.toString()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "currySelf",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return function () {
- var args = [ this ];
- args.push.apply(args, arguments);
- return self.apply(null, args);
- }
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
- },
- args: [],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "ensure:",
- protocol: 'evaluating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- try{return self._value()}finally{aBlock._value()};
- return self;
- }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
- },
- args: ["aBlock"],
- source: "ensure: aBlock\x0a\x09<try{return self._value()}finally{aBlock._value()}>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "fork",
- protocol: 'timeout/interval',
- fn: function (){
- var self=this;
- function $ForkPool(){return $globals.ForkPool||(typeof ForkPool=="undefined"?nil:ForkPool)}
- return $core.withContext(function($ctx1) {
- $recv($recv($ForkPool())._default())._fork_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
- },
- args: [],
- source: "fork\x0a\x09ForkPool default fork: self",
- referencedClasses: ["ForkPool"],
- messageSends: ["fork:", "default"]
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "new",
- protocol: 'evaluating',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return new self();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
- },
- args: [],
- 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()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "newValue:",
- protocol: 'evaluating',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._newWithValues_([anObject]);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
- },
- args: ["anObject"],
- source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
- referencedClasses: [],
- messageSends: ["newWithValues:"]
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "newValue:value:",
- protocol: 'evaluating',
- fn: function (anObject,anObject2){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._newWithValues_([anObject,anObject2]);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
- },
- args: ["anObject", "anObject2"],
- source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
- referencedClasses: [],
- messageSends: ["newWithValues:"]
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "newValue:value:value:",
- protocol: 'evaluating',
- fn: function (anObject,anObject2,anObject3){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._newWithValues_([anObject,anObject2,anObject3]);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
- },
- args: ["anObject", "anObject2", "anObject3"],
- source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
- referencedClasses: [],
- messageSends: ["newWithValues:"]
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "newWithValues:",
- protocol: 'evaluating',
- fn: function (aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- var object = Object.create(self.prototype);
- var result = self.apply(object, aCollection);
- return typeof result === "object" ? result : object;
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
- },
- args: ["aCollection"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "numArgs",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.length;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
- },
- args: [],
- source: "numArgs\x0a\x09<return self.length>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "on:do:",
- protocol: 'error handling',
- fn: function (anErrorClass,aBlock){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $1=self._tryCatch_((function(error){
- var smalltalkError;
- return $core.withContext(function($ctx2) {
- smalltalkError=$recv($Smalltalk())._asSmalltalkException_(error);
- smalltalkError;
- $2=$recv(smalltalkError)._isKindOf_(anErrorClass);
- if($core.assert($2)){
- return $recv(aBlock)._value_(smalltalkError);
- } else {
- return $recv(smalltalkError)._resignal();
- };
- }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
- },
- args: ["anErrorClass", "aBlock"],
- 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 ] ]",
- referencedClasses: ["Smalltalk"],
- messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"]
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "receiver",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return nil;
- },
- args: [],
- source: "receiver\x0a\x09^ nil",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "timeToRun",
- protocol: 'evaluating',
- fn: function (){
- var self=this;
- function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Date())._millisecondsToRun_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
- },
- args: [],
- source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
- referencedClasses: ["Date"],
- messageSends: ["millisecondsToRun:"]
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "tryCatch:",
- protocol: 'error handling',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- try {
- return self._value();
- } catch(error) {
- // pass non-local returns undetected
- if (Array.isArray(error) && error.length === 1) throw error;
- return aBlock._value_(error);
- }
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
- },
- args: ["aBlock"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "value",
- protocol: 'evaluating',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self();;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
- },
- args: [],
- source: "value\x0a\x09<return self();>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "value:",
- protocol: 'evaluating',
- fn: function (anArg){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self(anArg);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
- },
- args: ["anArg"],
- source: "value: anArg\x0a\x09<return self(anArg);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "value:value:",
- protocol: 'evaluating',
- fn: function (firstArg,secondArg){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self(firstArg, secondArg);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
- },
- args: ["firstArg", "secondArg"],
- source: "value: firstArg value: secondArg\x0a\x09<return self(firstArg, secondArg);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "value:value:value:",
- protocol: 'evaluating',
- fn: function (firstArg,secondArg,thirdArg){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self(firstArg, secondArg, thirdArg);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
- },
- args: ["firstArg", "secondArg", "thirdArg"],
- source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "valueWithInterval:",
- protocol: 'timeout/interval',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- var interval = setInterval(self, aNumber);
- return $globals.Timeout._on_(interval);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
- },
- args: ["aNumber"],
- source: "valueWithInterval: aNumber\x0a\x09<\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "valueWithPossibleArguments:",
- protocol: 'evaluating',
- fn: function (aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.apply(null, aCollection);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
- },
- args: ["aCollection"],
- source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "valueWithTimeout:",
- protocol: 'timeout/interval',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- var timeout = setTimeout(self, aNumber);
- return $globals.Timeout._on_(timeout);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
- },
- args: ["aNumber"],
- source: "valueWithTimeout: aNumber\x0a\x09<\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "whileFalse",
- protocol: 'controlling',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._whileFalse_((function(){
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
- },
- args: [],
- source: "whileFalse\x0a\x09self whileFalse: []",
- referencedClasses: [],
- messageSends: ["whileFalse:"]
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "whileFalse:",
- protocol: 'controlling',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- while(!$core.assert(self._value())) {aBlock._value()};
- return self;
- }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
- },
- args: ["aBlock"],
- source: "whileFalse: aBlock\x0a\x09<while(!$core.assert(self._value())) {aBlock._value()}>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "whileTrue",
- protocol: 'controlling',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._whileTrue_((function(){
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
- },
- args: [],
- source: "whileTrue\x0a\x09self whileTrue: []",
- referencedClasses: [],
- messageSends: ["whileTrue:"]
- }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "whileTrue:",
- protocol: 'controlling',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- while($core.assert(self._value())) {aBlock._value()};
- return self;
- }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
- },
- args: ["aBlock"],
- source: "whileTrue: aBlock\x0a\x09<while($core.assert(self._value())) {aBlock._value()}>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockClosure);
- $core.addClass('CompiledMethod', $globals.Object, [], 'Kernel-Methods');
- $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";
- $core.addMethod(
- $core.method({
- selector: "arguments",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.args || [];
- return self;
- }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
- },
- args: [],
- source: "arguments\x0a\x09<return self.args || []>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "browse",
- protocol: 'browsing',
- fn: function (){
- var self=this;
- function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
- return $core.withContext(function($ctx1) {
- $recv($Finder())._findMethod_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
- },
- args: [],
- source: "browse\x0a\x09Finder findMethod: self",
- referencedClasses: ["Finder"],
- messageSends: ["findMethod:"]
- }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "category",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._protocol();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
- },
- args: [],
- source: "category\x0a\x09^ self protocol",
- referencedClasses: [],
- messageSends: ["protocol"]
- }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "defaultProtocol",
- protocol: 'defaults',
- fn: function (){
- var self=this;
- return "as yet unclassified";
- },
- args: [],
- source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "fn",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._basicAt_("fn");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
- },
- args: [],
- source: "fn\x0a\x09^ self basicAt: 'fn'",
- referencedClasses: [],
- messageSends: ["basicAt:"]
- }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "fn:",
- protocol: 'accessing',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._basicAt_put_("fn",aBlock);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
- },
- args: ["aBlock"],
- source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
- referencedClasses: [],
- messageSends: ["basicAt:put:"]
- }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "isCompiledMethod",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isCompiledMethod\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "isOverridden",
- protocol: 'testing',
- fn: function (){
- var self=this;
- var selector;
- return $core.withContext(function($ctx1) {
- var $1;
- var $early={};
- try {
- selector=self._selector();
- $recv(self._methodClass())._allSubclassesDo_((function(each){
- return $core.withContext(function($ctx2) {
- $1=$recv(each)._includesSelector_(selector);
- if($core.assert($1)){
- throw $early=[true];
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return false;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
- }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "isOverride",
- protocol: 'testing',
- fn: function (){
- var self=this;
- var superclass;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$receiver;
- $1=self._methodClass();
- $ctx1.sendIdx["methodClass"]=1;
- superclass=$recv($1)._superclass();
- $ctx1.sendIdx["superclass"]=1;
- $2=superclass;
- if(($receiver = $2) == null || $receiver.isNil){
- return false;
- } else {
- $2;
- };
- $3=$recv($recv($recv(self._methodClass())._superclass())._lookupSelector_(self._selector()))._notNil();
- return $3;
- }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
- }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "messageSends",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._basicAt_("messageSends");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
- },
- args: [],
- source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
- referencedClasses: [],
- messageSends: ["basicAt:"]
- }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "methodClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._basicAt_("methodClass");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
- },
- args: [],
- source: "methodClass\x0a\x09^ self basicAt: 'methodClass'",
- referencedClasses: [],
- messageSends: ["basicAt:"]
- }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "package",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self._methodClass();
- if(($receiver = $2) == null || $receiver.isNil){
- $1=$2;
- } else {
- var class_;
- class_=$receiver;
- $1=$recv(class_)._packageOfProtocol_(self._protocol());
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
- },
- args: [],
- 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 ]",
- referencedClasses: [],
- messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
- }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "protocol",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self._basicAt_("protocol");
- if(($receiver = $2) == null || $receiver.isNil){
- $1=self._defaultProtocol();
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
- },
- args: [],
- source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
- referencedClasses: [],
- messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
- }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "protocol:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- var oldProtocol;
- function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- function $MethodMoved(){return $globals.MethodMoved||(typeof MethodMoved=="undefined"?nil:MethodMoved)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$receiver;
- oldProtocol=self._protocol();
- self._basicAt_put_("protocol",aString);
- $1=$recv($MethodMoved())._new();
- $recv($1)._method_(self);
- $recv($1)._oldProtocol_(oldProtocol);
- $2=$recv($1)._yourself();
- $recv($recv($SystemAnnouncer())._current())._announce_($2);
- $3=self._methodClass();
- if(($receiver = $3) == null || $receiver.isNil){
- $3;
- } else {
- var methodClass;
- methodClass=$receiver;
- $recv($recv(methodClass)._organization())._addElement_(aString);
- $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
- },
- args: ["aString"],
- 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 ]",
- referencedClasses: ["SystemAnnouncer", "MethodMoved"],
- messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
- }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "referencedClasses",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._basicAt_("referencedClasses");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
- },
- args: [],
- source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
- referencedClasses: [],
- messageSends: ["basicAt:"]
- }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "selector",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._basicAt_("selector");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
- },
- args: [],
- source: "selector\x0a\x09^ self basicAt: 'selector'",
- referencedClasses: [],
- messageSends: ["basicAt:"]
- }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "selector:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._basicAt_put_("selector",aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
- },
- args: ["aString"],
- source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
- referencedClasses: [],
- messageSends: ["basicAt:put:"]
- }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "sendTo:arguments:",
- protocol: 'evaluating',
- fn: function (anObject,aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._fn())._applyTo_arguments_(anObject,aCollection);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
- },
- args: ["anObject", "aCollection"],
- source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
- referencedClasses: [],
- messageSends: ["applyTo:arguments:", "fn"]
- }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "source",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self._basicAt_("source");
- if(($receiver = $2) == null || $receiver.isNil){
- $1="";
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
- },
- args: [],
- source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
- referencedClasses: [],
- messageSends: ["ifNil:", "basicAt:"]
- }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "source:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._basicAt_put_("source",aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
- },
- args: ["aString"],
- source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
- referencedClasses: [],
- messageSends: ["basicAt:put:"]
- }),
- $globals.CompiledMethod);
- $core.addClass('ForkPool', $globals.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
- $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`";
- $core.addMethod(
- $core.method({
- selector: "addWorker",
- protocol: 'private',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self["@worker"])._valueWithTimeout_((0));
- self["@poolSize"]=$recv(self["@poolSize"]).__plus((1));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
- },
- args: [],
- source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
- referencedClasses: [],
- messageSends: ["valueWithTimeout:", "+"]
- }),
- $globals.ForkPool);
- $core.addMethod(
- $core.method({
- selector: "defaultMaxPoolSize",
- protocol: 'defaults',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._class())._defaultMaxPoolSize();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
- },
- args: [],
- source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
- referencedClasses: [],
- messageSends: ["defaultMaxPoolSize", "class"]
- }),
- $globals.ForkPool);
- $core.addMethod(
- $core.method({
- selector: "fork:",
- protocol: 'actions',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self["@poolSize"]).__lt(self._maxPoolSize());
- if($core.assert($1)){
- self._addWorker();
- };
- $recv(self["@queue"])._nextPut_(aBlock);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
- },
- args: ["aBlock"],
- source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
- referencedClasses: [],
- messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
- }),
- $globals.ForkPool);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.ForkPool.superclass.fn.prototype._initialize.apply($recv(self), []));
- $ctx1.supercall = false;
- self["@poolSize"]=(0);
- self["@queue"]=$recv($Queue())._new();
- self["@worker"]=self._makeWorker();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
- },
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
- referencedClasses: ["Queue"],
- messageSends: ["initialize", "new", "makeWorker"]
- }),
- $globals.ForkPool);
- $core.addMethod(
- $core.method({
- selector: "makeWorker",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- var sentinel;
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- return $core.withContext(function($ctx1) {
- var $2,$1;
- sentinel=$recv($Object())._new();
- $1=(function(){
- var block;
- return $core.withContext(function($ctx2) {
- self["@poolSize"]=$recv(self["@poolSize"]).__minus((1));
- self["@poolSize"];
- block=$recv(self["@queue"])._nextIfAbsent_((function(){
- return sentinel;
- }));
- block;
- $2=$recv(block).__eq_eq(sentinel);
- if(!$core.assert($2)){
- return $recv((function(){
- return $core.withContext(function($ctx3) {
- return $recv(block)._value();
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
- }))._ensure_((function(){
- return $core.withContext(function($ctx3) {
- return self._addWorker();
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
- }));
- };
- }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
- });
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
- },
- args: [],
- 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 ] ]]",
- referencedClasses: ["Object"],
- messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
- }),
- $globals.ForkPool);
- $core.addMethod(
- $core.method({
- selector: "maxPoolSize",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@maxPoolSize"];
- if(($receiver = $2) == null || $receiver.isNil){
- $1=self._defaultMaxPoolSize();
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
- },
- args: [],
- source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
- referencedClasses: [],
- messageSends: ["ifNil:", "defaultMaxPoolSize"]
- }),
- $globals.ForkPool);
- $core.addMethod(
- $core.method({
- selector: "maxPoolSize:",
- protocol: 'accessing',
- fn: function (anInteger){
- var self=this;
- self["@maxPoolSize"]=anInteger;
- return self;
- },
- args: ["anInteger"],
- source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ForkPool);
- $globals.ForkPool.klass.iVarNames = ['default'];
- $core.addMethod(
- $core.method({
- selector: "default",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@default"];
- if(($receiver = $2) == null || $receiver.isNil){
- self["@default"]=self._new();
- $1=self["@default"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.klass)});
- },
- args: [],
- source: "default\x0a\x09^ default ifNil: [ default := self new ]",
- referencedClasses: [],
- messageSends: ["ifNil:", "new"]
- }),
- $globals.ForkPool.klass);
- $core.addMethod(
- $core.method({
- selector: "defaultMaxPoolSize",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return (100);
- },
- args: [],
- source: "defaultMaxPoolSize\x0a\x09^ 100",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ForkPool.klass);
- $core.addMethod(
- $core.method({
- selector: "resetDefault",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- self["@default"]=nil;
- return self;
- },
- args: [],
- source: "resetDefault\x0a\x09default := nil",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ForkPool.klass);
- $core.addClass('Message', $globals.Object, ['selector', 'arguments'], 'Kernel-Methods');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "arguments",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@arguments"];
- return $1;
- },
- args: [],
- source: "arguments\x0a\x09^ arguments",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Message);
- $core.addMethod(
- $core.method({
- selector: "arguments:",
- protocol: 'accessing',
- fn: function (anArray){
- var self=this;
- self["@arguments"]=anArray;
- return self;
- },
- args: ["anArray"],
- source: "arguments: anArray\x0a\x09arguments := anArray",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Message);
- $core.addMethod(
- $core.method({
- selector: "printOn:",
- protocol: 'printing',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- (
- $ctx1.supercall = true,
- $globals.Message.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
- $ctx1.supercall = false;
- $recv(aStream)._nextPutAll_("(");
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv(aStream)._nextPutAll_(self._selector());
- $ctx1.sendIdx["nextPutAll:"]=2;
- $1=$recv(aStream)._nextPutAll_(")");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
- },
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
- referencedClasses: [],
- messageSends: ["printOn:", "nextPutAll:", "selector"]
- }),
- $globals.Message);
- $core.addMethod(
- $core.method({
- selector: "selector",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@selector"];
- return $1;
- },
- args: [],
- source: "selector\x0a\x09^ selector",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Message);
- $core.addMethod(
- $core.method({
- selector: "selector:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@selector"]=aString;
- return self;
- },
- args: ["aString"],
- source: "selector: aString\x0a\x09selector := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Message);
- $core.addMethod(
- $core.method({
- selector: "sendTo:",
- protocol: 'actions',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(anObject)._perform_withArguments_(self._selector(),self._arguments());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
- },
- args: ["anObject"],
- source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
- referencedClasses: [],
- messageSends: ["perform:withArguments:", "selector", "arguments"]
- }),
- $globals.Message);
- $core.addMethod(
- $core.method({
- selector: "selector:arguments:",
- protocol: 'instance creation',
- fn: function (aString,anArray){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- $recv($2)._selector_(aString);
- $recv($2)._arguments_(anArray);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.klass)});
- },
- args: ["aString", "anArray"],
- source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["selector:", "new", "arguments:", "yourself"]
- }),
- $globals.Message.klass);
- $core.addClass('MessageSend', $globals.Object, ['receiver', 'message'], 'Kernel-Methods');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "arguments",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self["@message"])._arguments();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
- },
- args: [],
- source: "arguments\x0a\x09^ message arguments",
- referencedClasses: [],
- messageSends: ["arguments"]
- }),
- $globals.MessageSend);
- $core.addMethod(
- $core.method({
- selector: "arguments:",
- protocol: 'accessing',
- fn: function (aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self["@message"])._arguments_(aCollection);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
- },
- args: ["aCollection"],
- source: "arguments: aCollection\x0a\x09message arguments: aCollection",
- referencedClasses: [],
- messageSends: ["arguments:"]
- }),
- $globals.MessageSend);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- function $Message(){return $globals.Message||(typeof Message=="undefined"?nil:Message)}
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.MessageSend.superclass.fn.prototype._initialize.apply($recv(self), []));
- $ctx1.supercall = false;
- self["@message"]=$recv($Message())._new();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
- },
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
- referencedClasses: ["Message"],
- messageSends: ["initialize", "new"]
- }),
- $globals.MessageSend);
- $core.addMethod(
- $core.method({
- selector: "printOn:",
- protocol: 'printing',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- (
- $ctx1.supercall = true,
- $globals.MessageSend.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
- $ctx1.supercall = false;
- $recv(aStream)._nextPutAll_("(");
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv(aStream)._nextPutAll_(self._receiver());
- $ctx1.sendIdx["nextPutAll:"]=2;
- $recv(aStream)._nextPutAll_(" >> ");
- $ctx1.sendIdx["nextPutAll:"]=3;
- $recv(aStream)._nextPutAll_(self._selector());
- $ctx1.sendIdx["nextPutAll:"]=4;
- $1=$recv(aStream)._nextPutAll_(")");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
- },
- args: ["aStream"],
- 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: ')'",
- referencedClasses: [],
- messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
- }),
- $globals.MessageSend);
- $core.addMethod(
- $core.method({
- selector: "receiver",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@receiver"];
- return $1;
- },
- args: [],
- source: "receiver\x0a\x09^ receiver",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MessageSend);
- $core.addMethod(
- $core.method({
- selector: "receiver:",
- protocol: 'accessing',
- fn: function (anObject){
- var self=this;
- self["@receiver"]=anObject;
- return self;
- },
- args: ["anObject"],
- source: "receiver: anObject\x0a\x09receiver := anObject",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MessageSend);
- $core.addMethod(
- $core.method({
- selector: "selector",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self["@message"])._selector();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
- },
- args: [],
- source: "selector\x0a\x09^ message selector",
- referencedClasses: [],
- messageSends: ["selector"]
- }),
- $globals.MessageSend);
- $core.addMethod(
- $core.method({
- selector: "selector:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self["@message"])._selector_(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
- },
- args: ["aString"],
- source: "selector: aString\x0a\x09message selector: aString",
- referencedClasses: [],
- messageSends: ["selector:"]
- }),
- $globals.MessageSend);
- $core.addMethod(
- $core.method({
- selector: "value",
- protocol: 'evaluating',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self["@message"])._sendTo_(self._receiver());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
- },
- args: [],
- source: "value\x0a\x09^ message sendTo: self receiver",
- referencedClasses: [],
- messageSends: ["sendTo:", "receiver"]
- }),
- $globals.MessageSend);
- $core.addMethod(
- $core.method({
- selector: "value:",
- protocol: 'evaluating',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self["@message"];
- $recv($2)._arguments_([anObject]);
- $3=$recv($2)._sendTo_(self._receiver());
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
- },
- args: ["anObject"],
- source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
- referencedClasses: [],
- messageSends: ["arguments:", "sendTo:", "receiver"]
- }),
- $globals.MessageSend);
- $core.addMethod(
- $core.method({
- selector: "value:value:",
- protocol: 'evaluating',
- fn: function (firstArgument,secondArgument){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self["@message"];
- $recv($2)._arguments_([firstArgument,secondArgument]);
- $3=$recv($2)._sendTo_(self._receiver());
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
- },
- args: ["firstArgument", "secondArgument"],
- source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
- referencedClasses: [],
- messageSends: ["arguments:", "sendTo:", "receiver"]
- }),
- $globals.MessageSend);
- $core.addMethod(
- $core.method({
- selector: "value:value:value:",
- protocol: 'evaluating',
- fn: function (firstArgument,secondArgument,thirdArgument){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self["@message"];
- $recv($2)._arguments_([firstArgument,secondArgument,thirdArgument]);
- $3=$recv($2)._sendTo_(self._receiver());
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
- },
- args: ["firstArgument", "secondArgument", "thirdArgument"],
- source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
- referencedClasses: [],
- messageSends: ["arguments:", "sendTo:", "receiver"]
- }),
- $globals.MessageSend);
- $core.addMethod(
- $core.method({
- selector: "valueWithPossibleArguments:",
- protocol: 'evaluating',
- fn: function (aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- self._arguments_(aCollection);
- $1=self._value();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
- },
- args: ["aCollection"],
- source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
- referencedClasses: [],
- messageSends: ["arguments:", "value"]
- }),
- $globals.MessageSend);
- $core.addClass('MethodContext', $globals.Object, [], 'Kernel-Methods');
- $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`.";
- $core.addMethod(
- $core.method({
- selector: "asString",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
- $2=self._isBlockContext();
- if($core.assert($2)){
- $3="a block (in ".__comma($recv(self._methodContext())._asString());
- $ctx1.sendIdx[","]=2;
- $1=$recv($3).__comma(")");
- $ctx1.sendIdx[","]=1;
- } else {
- var methodClass;
- methodClass=$recv(self._method())._methodClass();
- methodClass;
- $5=methodClass;
- $7=self._receiver();
- $ctx1.sendIdx["receiver"]=1;
- $6=$recv($7)._class();
- $ctx1.sendIdx["class"]=1;
- $4=$recv($5).__eq($6);
- if($core.assert($4)){
- $11=self._receiver();
- $ctx1.sendIdx["receiver"]=2;
- $10=$recv($11)._class();
- $ctx1.sendIdx["class"]=2;
- $9=$recv($10)._name();
- $ctx1.sendIdx["name"]=1;
- $8=$recv($9).__comma(" >> ");
- $ctx1.sendIdx[","]=4;
- $12=self._selector();
- $ctx1.sendIdx["selector"]=1;
- $1=$recv($8).__comma($12);
- $ctx1.sendIdx[","]=3;
- } else {
- $16=$recv($recv(self._receiver())._class())._name();
- $ctx1.sendIdx["name"]=2;
- $15=$recv($16).__comma("(");
- $14=$recv($15).__comma($recv(methodClass)._name());
- $ctx1.sendIdx[","]=7;
- $13=$recv($14).__comma(") >> ");
- $ctx1.sendIdx[","]=6;
- $1=$recv($13).__comma(self._selector());
- $ctx1.sendIdx[","]=5;
- };
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
- },
- args: [],
- 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 ] ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
- }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "basicReceiver",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.receiver;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
- },
- args: [],
- source: "basicReceiver\x0a\x09<return self.receiver>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "evaluatedSelector",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.evaluatedSelector;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
- },
- args: [],
- source: "evaluatedSelector\x0a\x09<return self.evaluatedSelector>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "findContextSuchThat:",
- protocol: 'accessing',
- fn: function (testBlock){
- var self=this;
- var context;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- var $early={};
- try {
- context=self;
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return $recv(context)._isNil();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._whileFalse_((function(){
- return $core.withContext(function($ctx2) {
- $1=$recv(testBlock)._value_(context);
- if($core.assert($1)){
- $2=context;
- throw $early=[$2];
- };
- context=$recv(context)._outerContext();
- return context;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- return nil;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
- },
- args: ["testBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
- }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "home",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.homeContext;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
- },
- args: [],
- source: "home\x0a\x09<return self.homeContext>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "index",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.index || 0;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
- },
- args: [],
- source: "index\x0a\x09<return self.index || 0>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "isBlockContext",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._selector())._isNil();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
- },
- args: [],
- source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
- referencedClasses: [],
- messageSends: ["isNil", "selector"]
- }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "locals",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.locals || {};
- return self;
- }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
- },
- args: [],
- source: "locals\x0a\x09<return self.locals || {}>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "method",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var method,lookupClass,receiverClass,supercall;
- return $core.withContext(function($ctx1) {
- var $1,$3,$2,$4,$6,$5,$7,$9,$8,$receiver;
- $1=self._methodContext();
- $ctx1.sendIdx["methodContext"]=1;
- if(($receiver = $1) == null || $receiver.isNil){
- return nil;
- } else {
- $1;
- };
- $3=self._methodContext();
- $ctx1.sendIdx["methodContext"]=2;
- $2=$recv($3)._receiver();
- receiverClass=$recv($2)._class();
- $4=receiverClass;
- $6=self._methodContext();
- $ctx1.sendIdx["methodContext"]=3;
- $5=$recv($6)._selector();
- $ctx1.sendIdx["selector"]=1;
- method=$recv($4)._lookupSelector_($5);
- $ctx1.sendIdx["lookupSelector:"]=1;
- $7=self._outerContext();
- if(($receiver = $7) == null || $receiver.isNil){
- supercall=false;
- } else {
- var outer;
- outer=$receiver;
- supercall=$recv(outer)._supercall();
- };
- $9=supercall;
- if($core.assert($9)){
- $8=$recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv(self._methodContext())._selector());
- } else {
- $8=method;
- };
- return $8;
- }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
- },
- args: [],
- 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 ]",
- referencedClasses: [],
- messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
- }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "methodContext",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$3,$2,$receiver;
- $1=self._isBlockContext();
- if(!$core.assert($1)){
- return self;
- };
- $3=self._outerContext();
- if(($receiver = $3) == null || $receiver.isNil){
- $2=$3;
- } else {
- var outer;
- outer=$receiver;
- $2=$recv(outer)._methodContext();
- };
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
- },
- args: [],
- source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
- referencedClasses: [],
- messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
- }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "outerContext",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.outerContext || self.homeContext;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
- },
- args: [],
- source: "outerContext\x0a\x09<return self.outerContext || self.homeContext>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "printOn:",
- protocol: 'printing',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- (
- $ctx1.supercall = true,
- $globals.MethodContext.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
- $ctx1.supercall = false;
- $recv(aStream)._nextPutAll_("(");
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv(aStream)._nextPutAll_(self._asString());
- $ctx1.sendIdx["nextPutAll:"]=2;
- $1=$recv(aStream)._nextPutAll_(")");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
- },
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
- referencedClasses: [],
- messageSends: ["printOn:", "nextPutAll:", "asString"]
- }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "receiver",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $3,$2,$1;
- $2=$recv(self._isBlockContext())._and_((function(){
- return $core.withContext(function($ctx2) {
- $3=self._outerContext();
- $ctx2.sendIdx["outerContext"]=1;
- return $recv($3)._notNil();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- if($core.assert($2)){
- $1=$recv(self._outerContext())._receiver();
- } else {
- $1=self._basicReceiver();
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
- },
- args: [],
- source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
- }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "selector",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- if(self.selector) {
- return $core.js2st(self.selector);
- } else {
- return nil;
- }
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
- },
- args: [],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "sendIndexAt:",
- protocol: 'accessing',
- fn: function (aSelector){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.sendIdx[aSelector] || 0;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
- },
- args: ["aSelector"],
- source: "sendIndexAt: aSelector\x0a\x09<return self.sendIdx[aSelector] || 0>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "sendIndexes",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.sendIdx;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
- },
- args: [],
- source: "sendIndexes\x0a\x09<return self.sendIdx>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "supercall",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.supercall == true;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
- },
- args: [],
- source: "supercall\x0a\x09<return self.supercall == true>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodContext);
- $core.addClass('NativeFunction', $globals.Object, [], 'Kernel-Methods');
- $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' ]";
- $core.addMethod(
- $core.method({
- selector: "constructor:",
- protocol: 'instance creation',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._deprecatedAPI_("Use constructorNamed:");
- var nativeFunc=eval(aString);
- return new nativeFunc();
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},$globals.NativeFunction.klass)});
- },
- args: ["aString"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "constructor:value:",
- protocol: 'instance creation',
- fn: function (aString,anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._deprecatedAPI_("Use constructorNamed:value:");
- var nativeFunc=eval(aString);
- return new nativeFunc(anObject);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
- },
- args: ["aString", "anObject"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "constructor:value:value:",
- protocol: 'instance creation',
- fn: function (aString,anObject,anObject2){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._deprecatedAPI_("Use constructorNamed:value:value:");
- var nativeFunc=eval(aString);
- return new nativeFunc(anObject,anObject2);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
- },
- args: ["aString", "anObject", "anObject2"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "constructor:value:value:value:",
- protocol: 'instance creation',
- fn: function (aString,anObject,anObject2,anObject3){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._deprecatedAPI_("Use constructorNamed:value:value:value");
- var nativeFunc=eval(aString);
- return new nativeFunc(anObject,anObject2, anObject3);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
- },
- args: ["aString", "anObject", "anObject2", "anObject3"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "constructorNamed:",
- protocol: 'instance creation',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var nativeFunc=(new Function('return this'))()[aString];
- return new nativeFunc();
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.klass)});
- },
- args: ["aString"],
- source: "constructorNamed: aString\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "constructorNamed:value:",
- protocol: 'instance creation',
- fn: function (aString,anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var nativeFunc=(new Function('return this'))()[aString];
- return new nativeFunc(anObject);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
- },
- args: ["aString", "anObject"],
- source: "constructorNamed: aString value: anObject\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "constructorNamed:value:value:",
- protocol: 'instance creation',
- fn: function (aString,anObject,anObject2){
- var self=this;
- return $core.withContext(function($ctx1) {
- var nativeFunc=(new Function('return this'))()[aString];
- return new nativeFunc(anObject,anObject2);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
- },
- args: ["aString", "anObject", "anObject2"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "constructorNamed:value:value:value:",
- protocol: 'instance creation',
- fn: function (aString,anObject,anObject2,anObject3){
- var self=this;
- return $core.withContext(function($ctx1) {
- var nativeFunc=(new Function('return this'))()[aString];
- return new nativeFunc(anObject,anObject2, anObject3);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
- },
- args: ["aString", "anObject", "anObject2", "anObject3"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "constructorOf:",
- protocol: 'instance creation',
- fn: function (nativeFunc){
- var self=this;
- return $core.withContext(function($ctx1) {
- return new nativeFunc();
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
- },
- args: ["nativeFunc"],
- source: "constructorOf: nativeFunc\x0a\x09<\x0a\x09\x09return new nativeFunc();\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "constructorOf:value:",
- protocol: 'instance creation',
- fn: function (nativeFunc,anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- return new nativeFunc(anObject);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
- },
- args: ["nativeFunc", "anObject"],
- source: "constructorOf: nativeFunc value: anObject\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "constructorOf:value:value:",
- protocol: 'instance creation',
- fn: function (nativeFunc,anObject,anObject2){
- var self=this;
- return $core.withContext(function($ctx1) {
- return new nativeFunc(anObject,anObject2);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
- },
- args: ["nativeFunc", "anObject", "anObject2"],
- source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "constructorOf:value:value:value:",
- protocol: 'instance creation',
- fn: function (nativeFunc,anObject,anObject2,anObject3){
- var self=this;
- return $core.withContext(function($ctx1) {
- return new nativeFunc(anObject,anObject2, anObject3);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
- },
- args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
- source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "exists:",
- protocol: 'testing',
- fn: function (aString){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Smalltalk())._existsJsGlobal_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.klass)});
- },
- args: ["aString"],
- source: "exists: aString\x0a\x09^ Smalltalk existsJsGlobal: aString",
- referencedClasses: ["Smalltalk"],
- messageSends: ["existsJsGlobal:"]
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "functionNamed:",
- protocol: 'function calling',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var nativeFunc=(new Function('return this'))()[aString];
- return nativeFunc();
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.klass)});
- },
- args: ["aString"],
- source: "functionNamed: aString\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc();\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "functionNamed:value:",
- protocol: 'function calling',
- fn: function (aString,anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var nativeFunc=(new Function('return this'))()[aString];
- return nativeFunc(anObject);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
- },
- args: ["aString", "anObject"],
- source: "functionNamed: aString value: anObject\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "functionNamed:value:value:",
- protocol: 'function calling',
- fn: function (aString,anObject,anObject2){
- var self=this;
- return $core.withContext(function($ctx1) {
- var nativeFunc=(new Function('return this'))()[aString];
- return nativeFunc(anObject,anObject2);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
- },
- args: ["aString", "anObject", "anObject2"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "functionNamed:value:value:value:",
- protocol: 'function calling',
- fn: function (aString,anObject,anObject2,anObject3){
- var self=this;
- return $core.withContext(function($ctx1) {
- var nativeFunc=(new Function('return this'))()[aString];
- return nativeFunc(anObject,anObject2, anObject3);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
- },
- args: ["aString", "anObject", "anObject2", "anObject3"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "functionNamed:valueWithArgs:",
- protocol: 'function calling',
- fn: function (aString,args){
- var self=this;
- return $core.withContext(function($ctx1) {
- var nativeFunc=(new Function('return this'))()[aString];
- return Function.prototype.apply.call(nativeFunc, null, args);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.klass)});
- },
- args: ["aString", "args"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "functionOf:",
- protocol: 'function calling',
- fn: function (nativeFunc){
- var self=this;
- return $core.withContext(function($ctx1) {
- return nativeFunc();
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
- },
- args: ["nativeFunc"],
- source: "functionOf: nativeFunc\x0a\x09<\x0a\x09\x09return nativeFunc();\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "functionOf:value:",
- protocol: 'function calling',
- fn: function (nativeFunc,anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- return nativeFunc(anObject);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
- },
- args: ["nativeFunc", "anObject"],
- source: "functionOf: nativeFunc value: anObject\x0a\x09<\x0a\x09\x09return nativeFunc(anObject);\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "functionOf:value:value:",
- protocol: 'function calling',
- fn: function (nativeFunc,anObject,anObject2){
- var self=this;
- return $core.withContext(function($ctx1) {
- return nativeFunc(anObject,anObject2);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
- },
- args: ["nativeFunc", "anObject", "anObject2"],
- source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "functionOf:value:value:value:",
- protocol: 'function calling',
- fn: function (nativeFunc,anObject,anObject2,anObject3){
- var self=this;
- return $core.withContext(function($ctx1) {
- return nativeFunc(anObject,anObject2, anObject3);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
- },
- args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
- source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "functionOf:valueWithArgs:",
- protocol: 'function calling',
- fn: function (nativeFunc,args){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Function.prototype.apply.call(nativeFunc, null, args);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.klass)});
- },
- args: ["nativeFunc", "args"],
- source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "methodOf:this:",
- protocol: 'method calling',
- fn: function (nativeFunc,thisObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Function.prototype.call.call(nativeFunc, thisObject);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.klass)});
- },
- args: ["nativeFunc", "thisObject"],
- source: "methodOf: nativeFunc this: thisObject\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "methodOf:this:value:",
- protocol: 'method calling',
- fn: function (nativeFunc,thisObject,anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Function.prototype.call.call(nativeFunc, thisObject, anObject);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.klass)});
- },
- args: ["nativeFunc", "thisObject", "anObject"],
- source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "methodOf:this:value:value:",
- protocol: 'method calling',
- fn: function (nativeFunc,thisObject,anObject,anObject2){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
- },
- args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
- source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "methodOf:this:value:value:value:",
- protocol: 'method calling',
- fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
- },
- args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addMethod(
- $core.method({
- selector: "methodOf:this:valueWithArgs:",
- protocol: 'method calling',
- fn: function (nativeFunc,thisObject,args){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Function.prototype.apply.call(nativeFunc, thisObject, args);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.klass)});
- },
- args: ["nativeFunc", "thisObject", "args"],
- source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NativeFunction.klass);
- $core.addClass('Timeout', $globals.Object, ['rawTimeout'], 'Kernel-Methods');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "clearInterval",
- protocol: 'timeout/interval',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var interval = self["@rawTimeout"];
- clearInterval(interval);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
- },
- args: [],
- source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Timeout);
- $core.addMethod(
- $core.method({
- selector: "clearTimeout",
- protocol: 'timeout/interval',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var timeout = self["@rawTimeout"];
- clearTimeout(timeout);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
- },
- args: [],
- source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Timeout);
- $core.addMethod(
- $core.method({
- selector: "rawTimeout:",
- protocol: 'accessing',
- fn: function (anObject){
- var self=this;
- self["@rawTimeout"]=anObject;
- return self;
- },
- args: ["anObject"],
- source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Timeout);
- $core.addMethod(
- $core.method({
- selector: "on:",
- protocol: 'instance creation',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- $recv($2)._rawTimeout_(anObject);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.klass)});
- },
- args: ["anObject"],
- source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
- referencedClasses: [],
- messageSends: ["rawTimeout:", "new", "yourself"]
- }),
- $globals.Timeout.klass);
- });
- define("amber_core/Kernel-Collections", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
- var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
- $core.addPackage('Kernel-Collections');
- $core.packages["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
- $core.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
- $core.addClass('Association', $globals.Object, ['key', 'value'], 'Kernel-Collections');
- $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:`";
- $core.addMethod(
- $core.method({
- selector: "=",
- protocol: 'comparing',
- fn: function (anAssociation){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $3,$2,$5,$4,$6,$1;
- $3=self._class();
- $ctx1.sendIdx["class"]=1;
- $2=$recv($3).__eq($recv(anAssociation)._class());
- $ctx1.sendIdx["="]=1;
- $1=$recv($2)._and_((function(){
- return $core.withContext(function($ctx2) {
- $5=self._key();
- $ctx2.sendIdx["key"]=1;
- $4=$recv($5).__eq($recv(anAssociation)._key());
- $ctx2.sendIdx["="]=2;
- return $recv($4)._and_((function(){
- return $core.withContext(function($ctx3) {
- $6=self._value();
- $ctx3.sendIdx["value"]=1;
- return $recv($6).__eq($recv(anAssociation)._value());
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $ctx1.sendIdx["and:"]=1;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
- },
- args: ["anAssociation"],
- source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
- referencedClasses: [],
- messageSends: ["and:", "=", "class", "key", "value"]
- }),
- $globals.Association);
- $core.addMethod(
- $core.method({
- selector: "key",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@key"];
- return $1;
- },
- args: [],
- source: "key\x0a\x09^ key",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Association);
- $core.addMethod(
- $core.method({
- selector: "key:",
- protocol: 'accessing',
- fn: function (aKey){
- var self=this;
- self["@key"]=aKey;
- return self;
- },
- args: ["aKey"],
- source: "key: aKey\x0a\x09key := aKey",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Association);
- $core.addMethod(
- $core.method({
- selector: "printOn:",
- protocol: 'printing',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._key())._printOn_(aStream);
- $ctx1.sendIdx["printOn:"]=1;
- $recv(aStream)._nextPutAll_(" -> ");
- $recv(self._value())._printOn_(aStream);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
- },
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
- referencedClasses: [],
- messageSends: ["printOn:", "key", "nextPutAll:", "value"]
- }),
- $globals.Association);
- $core.addMethod(
- $core.method({
- selector: "value",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@value"];
- return $1;
- },
- args: [],
- source: "value\x0a\x09^ value",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Association);
- $core.addMethod(
- $core.method({
- selector: "value:",
- protocol: 'accessing',
- fn: function (aValue){
- var self=this;
- self["@value"]=aValue;
- return self;
- },
- args: ["aValue"],
- source: "value: aValue\x0a\x09value := aValue",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Association);
- $core.addMethod(
- $core.method({
- selector: "key:value:",
- protocol: 'instance creation',
- fn: function (aKey,aValue){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- $recv($2)._key_(aKey);
- $recv($2)._value_(aValue);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.klass)});
- },
- args: ["aKey", "aValue"],
- source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["key:", "new", "value:", "yourself"]
- }),
- $globals.Association.klass);
- $core.addClass('BucketStore', $globals.Object, ['buckets', 'hashBlock'], 'Kernel-Collections');
- $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`.";
- $core.addMethod(
- $core.method({
- selector: "bucketOfElement:",
- protocol: 'accessing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var hash = self['@hashBlock'](anObject);
- if (!hash) return null;
- var buckets = self['@buckets'],
- bucket = buckets[hash];
- if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
- return bucket;
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
- },
- args: ["anObject"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BucketStore);
- $core.addMethod(
- $core.method({
- selector: "do:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var buckets = self['@buckets'];
- var keys = Object.keys(buckets);
- for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
- },
- args: ["aBlock"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BucketStore);
- $core.addMethod(
- $core.method({
- selector: "hashBlock:",
- protocol: 'accessing',
- fn: function (aBlock){
- var self=this;
- self["@hashBlock"]=aBlock;
- return self;
- },
- args: ["aBlock"],
- source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BucketStore);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.BucketStore.superclass.fn.prototype._initialize.apply($recv(self), []));
- $ctx1.supercall = false;
- self._removeAll();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
- },
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
- referencedClasses: [],
- messageSends: ["initialize", "removeAll"]
- }),
- $globals.BucketStore);
- $core.addMethod(
- $core.method({
- selector: "newBucket",
- protocol: 'private',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
- },
- args: [],
- source: "newBucket\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.BucketStore);
- $core.addMethod(
- $core.method({
- selector: "removeAll",
- protocol: 'adding/removing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self['@buckets'] = Object.create(null);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
- },
- args: [],
- source: "removeAll\x0a\x09<self['@buckets'] = Object.create(null);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BucketStore);
- $core.addMethod(
- $core.method({
- selector: "hashBlock:",
- protocol: 'instance creation',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- $recv($2)._hashBlock_(aBlock);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.klass)});
- },
- args: ["aBlock"],
- source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["hashBlock:", "new", "yourself"]
- }),
- $globals.BucketStore.klass);
- $core.addClass('ArrayBucketStore', $globals.BucketStore, [], 'Kernel-Collections');
- $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
- $core.addMethod(
- $core.method({
- selector: "newBucket",
- protocol: 'private',
- fn: function (){
- var self=this;
- var $1;
- $1=[];
- return $1;
- },
- args: [],
- source: "newBucket\x0a\x09^ #()",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ArrayBucketStore);
- $core.addClass('Collection', $globals.Object, [], 'Kernel-Collections');
- $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.";
- $core.addMethod(
- $core.method({
- selector: ",",
- protocol: 'copying',
- fn: function (aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._copy();
- $recv($2)._addAll_(aCollection);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
- },
- args: ["aCollection"],
- source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["addAll:", "copy", "yourself"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "add:",
- protocol: 'adding/removing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
- },
- args: ["anObject"],
- source: "add: anObject\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "addAll:",
- protocol: 'adding/removing',
- fn: function (aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aCollection)._do_((function(each){
- return $core.withContext(function($ctx2) {
- return self._add_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return aCollection;
- }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
- },
- args: ["aCollection"],
- source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
- referencedClasses: [],
- messageSends: ["do:", "add:"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "allSatisfy:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- var $early={};
- try {
- self._do_((function(each){
- return $core.withContext(function($ctx2) {
- $1=$recv(aBlock)._value_(each);
- if(!$core.assert($1)){
- throw $early=[false];
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return true;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
- },
- args: ["aBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["do:", "ifFalse:", "value:"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "anyOne",
- protocol: 'adding/removing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $early={};
- try {
- self._ifEmpty_((function(){
- return $core.withContext(function($ctx2) {
- return self._error_("Collection is empty");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- self._do_((function(each){
- throw $early=[each];
- }));
- return self;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
- },
- args: [],
- 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 ]",
- referencedClasses: [],
- messageSends: ["ifEmpty:", "error:", "do:"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "anySatisfy:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- var $early={};
- try {
- self._do_((function(each){
- return $core.withContext(function($ctx2) {
- $1=$recv(aBlock)._value_(each);
- if($core.assert($1)){
- throw $early=[true];
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return false;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
- },
- args: ["aBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["do:", "ifTrue:", "value:"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "asArray",
- protocol: 'converting',
- fn: function (){
- var self=this;
- function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Array())._withAll_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
- },
- args: [],
- source: "asArray\x0a\x09^ Array withAll: self",
- referencedClasses: ["Array"],
- messageSends: ["withAll:"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "asJSON",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._asArray())._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._asJSON();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.Collection)});
- },
- args: [],
- source: "asJSON\x0a\x09^ self asArray collect: [ :each | each asJSON ]",
- referencedClasses: [],
- messageSends: ["collect:", "asArray", "asJSON"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "asOrderedCollection",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._asArray();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
- },
- args: [],
- source: "asOrderedCollection\x0a\x09^ self asArray",
- referencedClasses: [],
- messageSends: ["asArray"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "asSet",
- protocol: 'converting',
- fn: function (){
- var self=this;
- function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Set())._withAll_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
- },
- args: [],
- source: "asSet\x0a\x09^ Set withAll: self",
- referencedClasses: ["Set"],
- messageSends: ["withAll:"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "collect:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- var stream;
- return $core.withContext(function($ctx1) {
- var $1;
- stream=$recv($recv(self._class())._new())._writeStream();
- self._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $1=$recv(stream)._contents();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
- },
- args: ["aBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "copyWith:",
- protocol: 'copying',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._copy();
- $recv($2)._add_(anObject);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
- },
- args: ["anObject"],
- source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
- referencedClasses: [],
- messageSends: ["add:", "copy", "yourself"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "copyWithAll:",
- protocol: 'copying',
- fn: function (aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._copy();
- $recv($2)._addAll_(aCollection);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
- },
- args: ["aCollection"],
- source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
- referencedClasses: [],
- messageSends: ["addAll:", "copy", "yourself"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "copyWithoutAll:",
- protocol: 'copying',
- fn: function (aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._reject_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(aCollection)._includes_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
- },
- args: ["aCollection"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["reject:", "includes:"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "deepCopy",
- protocol: 'copying',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._deepCopy();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
- },
- args: [],
- source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
- referencedClasses: [],
- messageSends: ["collect:", "deepCopy"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "detect:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._detect_ifNone_(aBlock,(function(){
- return $core.withContext(function($ctx2) {
- return self._errorNotFound();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
- },
- args: ["aBlock"],
- source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
- referencedClasses: [],
- messageSends: ["detect:ifNone:", "errorNotFound"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "detect:ifNone:",
- protocol: 'enumerating',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
- },
- args: ["aBlock", "anotherBlock"],
- source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "do:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
- },
- args: ["aBlock"],
- source: "do: aBlock\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "do:separatedBy:",
- protocol: 'enumerating',
- fn: function (aBlock,anotherBlock){
- var self=this;
- var actionBeforeElement;
- return $core.withContext(function($ctx1) {
- actionBeforeElement=(function(){
- actionBeforeElement=anotherBlock;
- return actionBeforeElement;
- });
- self._do_((function(each){
- return $core.withContext(function($ctx2) {
- $recv(actionBeforeElement)._value();
- return $recv(aBlock)._value_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
- },
- args: ["aBlock", "anotherBlock"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["do:", "value", "value:"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "errorNotFound",
- protocol: 'error handling',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._error_("Object is not in the collection");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
- },
- args: [],
- source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
- referencedClasses: [],
- messageSends: ["error:"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "ifEmpty:",
- protocol: 'testing',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=self._isEmpty();
- $1=$recv($2)._ifTrue_ifFalse_(aBlock,(function(){
- return self;
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
- },
- args: ["aBlock"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "isEmpty"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "ifEmpty:ifNotEmpty:",
- protocol: 'testing',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=self._isEmpty();
- $1=$recv($2)._ifTrue_ifFalse_(aBlock,(function(){
- return $core.withContext(function($ctx2) {
- return $recv(anotherBlock)._value_(self);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
- },
- args: ["aBlock", "anotherBlock"],
- source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "isEmpty", "value:"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "ifNotEmpty:",
- protocol: 'testing',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=self._notEmpty();
- if($core.assert($2)){
- $1=$recv(aBlock)._value_(self);
- } else {
- $1=self;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
- },
- args: ["aBlock"],
- source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "ifNotEmpty:ifEmpty:",
- protocol: 'testing',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=self._notEmpty();
- $1=$recv($2)._ifTrue_ifFalse_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(aBlock)._value_(self);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),anotherBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
- },
- args: ["aBlock", "anotherBlock"],
- source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: anotherBlock",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "includes:",
- protocol: 'testing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._anySatisfy_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each).__eq(anObject);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
- },
- args: ["anObject"],
- source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
- referencedClasses: [],
- messageSends: ["anySatisfy:", "="]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "inject:into:",
- protocol: 'enumerating',
- fn: function (anObject,aBlock){
- var self=this;
- var result;
- return $core.withContext(function($ctx1) {
- var $1;
- result=anObject;
- self._do_((function(each){
- return $core.withContext(function($ctx2) {
- result=$recv(aBlock)._value_value_(result,each);
- return result;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $1=result;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
- },
- args: ["anObject", "aBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["do:", "value:value:"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "intersection:",
- protocol: 'enumerating',
- fn: function (aCollection){
- var self=this;
- var set,outputSet;
- function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$3;
- set=self._asSet();
- outputSet=$recv($Set())._new();
- $recv(aCollection)._do_((function(each){
- return $core.withContext(function($ctx2) {
- $2=$recv(set)._includes_(each);
- $ctx2.sendIdx["includes:"]=1;
- $1=$recv($2)._and_((function(){
- return $core.withContext(function($ctx3) {
- return $recv($recv(outputSet)._includes_(each))._not();
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }));
- if($core.assert($1)){
- return $recv(outputSet)._add_(each);
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $3=$recv(self._class())._withAll_($recv(outputSet)._asArray());
- return $3;
- }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
- },
- args: ["aCollection"],
- 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",
- referencedClasses: ["Set"],
- messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "isEmpty",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._size()).__eq((0));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
- },
- args: [],
- source: "isEmpty\x0a\x09^ self size = 0",
- referencedClasses: [],
- messageSends: ["=", "size"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "noneSatisfy:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- var $early={};
- try {
- self._do_((function(item){
- return $core.withContext(function($ctx2) {
- $1=$recv(aBlock)._value_(item);
- if($core.assert($1)){
- throw $early=[false];
- };
- }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
- }));
- return true;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
- },
- args: ["aBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["do:", "ifTrue:", "value:"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "notEmpty",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._isEmpty())._not();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
- },
- args: [],
- source: "notEmpty\x0a\x09^ self isEmpty not",
- referencedClasses: [],
- messageSends: ["not", "isEmpty"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "occurrencesOf:",
- protocol: 'accessing',
- fn: function (anObject){
- var self=this;
- var tally;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- tally=(0);
- self._do_((function(each){
- return $core.withContext(function($ctx2) {
- $1=$recv(anObject).__eq(each);
- if($core.assert($1)){
- tally=$recv(tally).__plus((1));
- return tally;
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $2=tally;
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
- },
- args: ["anObject"],
- 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",
- referencedClasses: [],
- messageSends: ["do:", "ifTrue:", "=", "+"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "putOn:",
- protocol: 'streaming',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._putOn_(aStream);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
- },
- args: ["aStream"],
- source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
- referencedClasses: [],
- messageSends: ["do:", "putOn:"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "reject:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._select_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv($recv(aBlock)._value_(each)).__eq(false);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
- },
- args: ["aBlock"],
- source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
- referencedClasses: [],
- messageSends: ["select:", "=", "value:"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "remove:",
- protocol: 'adding/removing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._remove_ifAbsent_(anObject,(function(){
- return $core.withContext(function($ctx2) {
- return self._errorNotFound();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
- },
- args: ["anObject"],
- source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
- referencedClasses: [],
- messageSends: ["remove:ifAbsent:", "errorNotFound"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "remove:ifAbsent:",
- protocol: 'adding/removing',
- fn: function (anObject,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
- },
- args: ["anObject", "aBlock"],
- source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "removeAll",
- protocol: 'adding/removing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
- },
- args: [],
- source: "removeAll\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "select:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- var stream;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- stream=$recv($recv(self._class())._new())._writeStream();
- self._do_((function(each){
- return $core.withContext(function($ctx2) {
- $1=$recv(aBlock)._value_(each);
- if($core.assert($1)){
- return $recv(stream)._nextPut_(each);
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $2=$recv(stream)._contents();
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
- },
- args: ["aBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "select:thenCollect:",
- protocol: 'enumerating',
- fn: function (selectBlock,collectBlock){
- var self=this;
- var stream;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- stream=$recv($recv(self._class())._new())._writeStream();
- self._do_((function(each){
- return $core.withContext(function($ctx2) {
- $1=$recv(selectBlock)._value_(each);
- $ctx2.sendIdx["value:"]=1;
- if($core.assert($1)){
- return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $2=$recv(stream)._contents();
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
- },
- args: ["selectBlock", "collectBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "shallowCopy",
- protocol: 'copying',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._collect_((function(each){
- return each;
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
- },
- args: [],
- source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
- referencedClasses: [],
- messageSends: ["collect:"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "size",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
- },
- args: [],
- source: "size\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "classTag",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return "collection";
- },
- args: [],
- 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'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Collection.klass);
- $core.addMethod(
- $core.method({
- selector: "new:",
- protocol: 'instance creation',
- fn: function (anInteger){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._new();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.klass)});
- },
- args: ["anInteger"],
- source: "new: anInteger\x0a\x09^ self new",
- referencedClasses: [],
- messageSends: ["new"]
- }),
- $globals.Collection.klass);
- $core.addMethod(
- $core.method({
- selector: "with:",
- protocol: 'instance creation',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- $recv($2)._add_(anObject);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.klass)});
- },
- args: ["anObject"],
- source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["add:", "new", "yourself"]
- }),
- $globals.Collection.klass);
- $core.addMethod(
- $core.method({
- selector: "with:with:",
- protocol: 'instance creation',
- fn: function (anObject,anotherObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- $recv($2)._add_(anObject);
- $ctx1.sendIdx["add:"]=1;
- $recv($2)._add_(anotherObject);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.klass)});
- },
- args: ["anObject", "anotherObject"],
- source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["add:", "new", "yourself"]
- }),
- $globals.Collection.klass);
- $core.addMethod(
- $core.method({
- selector: "with:with:with:",
- protocol: 'instance creation',
- fn: function (firstObject,secondObject,thirdObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- $recv($2)._add_(firstObject);
- $ctx1.sendIdx["add:"]=1;
- $recv($2)._add_(secondObject);
- $ctx1.sendIdx["add:"]=2;
- $recv($2)._add_(thirdObject);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.klass)});
- },
- args: ["firstObject", "secondObject", "thirdObject"],
- 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",
- referencedClasses: [],
- messageSends: ["add:", "new", "yourself"]
- }),
- $globals.Collection.klass);
- $core.addMethod(
- $core.method({
- selector: "withAll:",
- protocol: 'instance creation',
- fn: function (aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- $recv($2)._addAll_(aCollection);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.klass)});
- },
- args: ["aCollection"],
- source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["addAll:", "new", "yourself"]
- }),
- $globals.Collection.klass);
- $core.addClass('IndexableCollection', $globals.Collection, [], 'Kernel-Collections');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "at:",
- protocol: 'accessing',
- fn: function (anIndex){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._at_ifAbsent_(anIndex,(function(){
- return $core.withContext(function($ctx2) {
- return self._errorNotFound();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
- },
- args: ["anIndex"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["at:ifAbsent:", "errorNotFound"]
- }),
- $globals.IndexableCollection);
- $core.addMethod(
- $core.method({
- selector: "at:ifAbsent:",
- protocol: 'accessing',
- fn: function (anIndex,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
- },
- args: ["anIndex", "aBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.IndexableCollection);
- $core.addMethod(
- $core.method({
- selector: "at:ifAbsentPut:",
- protocol: 'accessing',
- fn: function (aKey,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._at_ifAbsent_(aKey,(function(){
- return $core.withContext(function($ctx2) {
- return self._at_put_(aKey,$recv(aBlock)._value());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
- },
- args: ["aKey", "aBlock"],
- source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
- referencedClasses: [],
- messageSends: ["at:ifAbsent:", "at:put:", "value"]
- }),
- $globals.IndexableCollection);
- $core.addMethod(
- $core.method({
- selector: "at:ifPresent:",
- protocol: 'accessing',
- fn: function (anIndex,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
- return nil;
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
- },
- args: ["anIndex", "aBlock"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["at:ifPresent:ifAbsent:"]
- }),
- $globals.IndexableCollection);
- $core.addMethod(
- $core.method({
- selector: "at:ifPresent:ifAbsent:",
- protocol: 'accessing',
- fn: function (anIndex,aBlock,anotherBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
- },
- args: ["anIndex", "aBlock", "anotherBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.IndexableCollection);
- $core.addMethod(
- $core.method({
- selector: "at:put:",
- protocol: 'accessing',
- fn: function (anIndex,anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
- },
- args: ["anIndex", "anObject"],
- source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.IndexableCollection);
- $core.addMethod(
- $core.method({
- selector: "indexOf:",
- protocol: 'accessing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._indexOf_ifAbsent_(anObject,(function(){
- return $core.withContext(function($ctx2) {
- return self._errorNotFound();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
- },
- args: ["anObject"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
- }),
- $globals.IndexableCollection);
- $core.addMethod(
- $core.method({
- selector: "indexOf:ifAbsent:",
- protocol: 'accessing',
- fn: function (anObject,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
- },
- args: ["anObject", "aBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.IndexableCollection);
- $core.addMethod(
- $core.method({
- selector: "with:do:",
- protocol: 'enumerating',
- fn: function (anotherCollection,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._withIndexDo_((function(each,index){
- return $core.withContext(function($ctx2) {
- return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
- }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
- },
- args: ["anotherCollection", "aBlock"],
- 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) ]",
- referencedClasses: [],
- messageSends: ["withIndexDo:", "value:value:", "at:"]
- }),
- $globals.IndexableCollection);
- $core.addMethod(
- $core.method({
- selector: "withIndexDo:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
- },
- args: ["aBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.IndexableCollection);
- $core.addClass('AssociativeCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
- $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
- $core.addMethod(
- $core.method({
- selector: "=",
- protocol: 'comparing',
- fn: function (anAssocitativeCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$4,$3,$6,$5;
- $2=self._class();
- $ctx1.sendIdx["class"]=1;
- $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
- $ctx1.sendIdx["="]=1;
- if(!$core.assert($1)){
- return false;
- };
- $4=self._size();
- $ctx1.sendIdx["size"]=1;
- $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
- $ctx1.sendIdx["="]=2;
- if(!$core.assert($3)){
- return false;
- };
- $6=self._associations();
- $ctx1.sendIdx["associations"]=1;
- $5=$recv($6).__eq($recv(anAssocitativeCollection)._associations());
- return $5;
- }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
- },
- args: ["anAssocitativeCollection"],
- source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
- referencedClasses: [],
- messageSends: ["ifFalse:", "=", "class", "size", "associations"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "add:",
- protocol: 'adding/removing',
- fn: function (anAssociation){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
- },
- args: ["anAssociation"],
- source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
- referencedClasses: [],
- messageSends: ["at:put:", "key", "value"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "addAll:",
- protocol: 'adding/removing',
- fn: function (anAssociativeCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.AssociativeCollection.superclass.fn.prototype._addAll_.apply($recv(self), [$recv(anAssociativeCollection)._associations()]));
- $ctx1.supercall = false;
- return anAssociativeCollection;
- }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
- },
- args: ["anAssociativeCollection"],
- source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
- referencedClasses: [],
- messageSends: ["addAll:", "associations"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "asDictionary",
- protocol: 'converting',
- fn: function (){
- var self=this;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Dictionary())._from_(self._associations());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
- },
- args: [],
- source: "asDictionary\x0a\x09^ Dictionary from: self associations",
- referencedClasses: ["Dictionary"],
- messageSends: ["from:", "associations"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "asHashedCollection",
- protocol: 'converting',
- fn: function (){
- var self=this;
- function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($HashedCollection())._from_(self._associations());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
- },
- args: [],
- source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
- referencedClasses: ["HashedCollection"],
- messageSends: ["from:", "associations"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "asJSON",
- protocol: 'converting',
- fn: function (){
- var self=this;
- var hash;
- function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
- return $core.withContext(function($ctx1) {
- var $1;
- hash=$recv($HashedCollection())._new();
- self._keysAndValuesDo_((function(key,value){
- return $core.withContext(function($ctx2) {
- return $recv(hash)._at_put_(key,$recv(value)._asJSON());
- }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
- }));
- $1=hash;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},$globals.AssociativeCollection)});
- },
- args: [],
- 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",
- referencedClasses: ["HashedCollection"],
- messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "associations",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var associations;
- return $core.withContext(function($ctx1) {
- var $1;
- associations=[];
- self._associationsDo_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(associations)._add_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $1=associations;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
- },
- args: [],
- source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
- referencedClasses: [],
- messageSends: ["associationsDo:", "add:"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "associationsDo:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- function $Association(){return $globals.Association||(typeof Association=="undefined"?nil:Association)}
- return $core.withContext(function($ctx1) {
- self._keysAndValuesDo_((function(key,value){
- return $core.withContext(function($ctx2) {
- return $recv(aBlock)._value_($recv($Association())._key_value_(key,value));
- }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
- },
- args: ["aBlock"],
- source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
- referencedClasses: ["Association"],
- messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "at:ifPresent:ifAbsent:",
- protocol: 'accessing',
- fn: function (aKey,aBlock,anotherBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=self._includesKey_(aKey);
- if($core.assert($2)){
- $1=$recv(aBlock)._value_(self._at_(aKey));
- } else {
- $1=$recv(anotherBlock)._value();
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
- },
- args: ["aKey", "aBlock", "anotherBlock"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "collect:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- var newDict;
- return $core.withContext(function($ctx1) {
- var $1;
- newDict=$recv(self._class())._new();
- self._keysAndValuesDo_((function(key,value){
- return $core.withContext(function($ctx2) {
- return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
- }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
- }));
- $1=newDict;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
- },
- args: ["aBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "deepCopy",
- protocol: 'copying',
- fn: function (){
- var self=this;
- var copy;
- return $core.withContext(function($ctx1) {
- var $1;
- copy=$recv(self._class())._new();
- self._keysAndValuesDo_((function(key,value){
- return $core.withContext(function($ctx2) {
- return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
- }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
- }));
- $1=copy;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "detect:ifNone:",
- protocol: 'enumerating',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._values())._detect_ifNone_(aBlock,anotherBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
- },
- args: ["aBlock", "anotherBlock"],
- source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
- referencedClasses: [],
- messageSends: ["detect:ifNone:", "values"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "do:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._valuesDo_(aBlock);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
- },
- args: ["aBlock"],
- source: "do: aBlock\x0a\x09self valuesDo: aBlock",
- referencedClasses: [],
- messageSends: ["valuesDo:"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "includes:",
- protocol: 'enumerating',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._values())._includes_(anObject);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
- },
- args: ["anObject"],
- source: "includes: anObject\x0a\x09^ self values includes: anObject",
- referencedClasses: [],
- messageSends: ["includes:", "values"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "includesKey:",
- protocol: 'testing',
- fn: function (aKey){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
- },
- args: ["aKey"],
- source: "includesKey: aKey\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "indexOf:ifAbsent:",
- protocol: 'accessing',
- fn: function (anObject,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._keys())._detect_ifNone_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(self._at_(each)).__eq(anObject);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }),aBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
- },
- args: ["anObject", "aBlock"],
- source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
- referencedClasses: [],
- messageSends: ["detect:ifNone:", "keys", "=", "at:"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "keyAtValue:",
- protocol: 'accessing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._keyAtValue_ifAbsent_(anObject,(function(){
- return $core.withContext(function($ctx2) {
- return self._errorNotFound();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
- },
- args: ["anObject"],
- source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
- referencedClasses: [],
- messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "keyAtValue:ifAbsent:",
- protocol: 'accessing',
- fn: function (anObject,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._indexOf_ifAbsent_(anObject,aBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
- },
- args: ["anObject", "aBlock"],
- source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
- referencedClasses: [],
- messageSends: ["indexOf:ifAbsent:"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "keys",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
- },
- args: [],
- source: "keys\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "keysAndValuesDo:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._keysDo_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(aBlock)._value_value_(each,self._at_(each));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
- },
- args: ["aBlock"],
- source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
- referencedClasses: [],
- messageSends: ["keysDo:", "value:value:", "at:"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "keysDo:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
- },
- args: ["aBlock"],
- source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "printOn:",
- protocol: 'printing',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.AssociativeCollection.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
- $ctx1.supercall = false;
- $ctx1.sendIdx["printOn:"]=1;
- $recv(aStream)._nextPutAll_(" (");
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv(self._associations())._do_separatedBy_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._printOn_(aStream);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- return $recv(aStream)._nextPutAll_(" , ");
- $ctx2.sendIdx["nextPutAll:"]=2;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- $recv(aStream)._nextPutAll_(")");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
- },
- args: ["aStream"],
- 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: ')'",
- referencedClasses: [],
- messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "remove:ifAbsent:",
- protocol: 'adding/removing',
- fn: function (aKey,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._removeKey_ifAbsent_(aKey,aBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
- },
- args: ["aKey", "aBlock"],
- source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
- referencedClasses: [],
- messageSends: ["removeKey:ifAbsent:"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "removeAll",
- protocol: 'adding/removing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._keys())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return self._removeKey_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
- },
- args: [],
- source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
- referencedClasses: [],
- messageSends: ["do:", "keys", "removeKey:"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "removeKey:",
- protocol: 'adding/removing',
- fn: function (aKey){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._remove_(aKey);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
- },
- args: ["aKey"],
- source: "removeKey: aKey\x0a\x09^ self remove: aKey",
- referencedClasses: [],
- messageSends: ["remove:"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "removeKey:ifAbsent:",
- protocol: 'adding/removing',
- fn: function (aKey,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
- },
- args: ["aKey", "aBlock"],
- source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "select:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- var newDict;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- newDict=$recv(self._class())._new();
- self._keysAndValuesDo_((function(key,value){
- return $core.withContext(function($ctx2) {
- $1=$recv(aBlock)._value_(value);
- if($core.assert($1)){
- return $recv(newDict)._at_put_(key,value);
- };
- }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
- }));
- $2=newDict;
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
- },
- args: ["aBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "shallowCopy",
- protocol: 'copying',
- fn: function (){
- var self=this;
- var copy;
- return $core.withContext(function($ctx1) {
- var $1;
- copy=$recv(self._class())._new();
- self._keysAndValuesDo_((function(key,value){
- return $core.withContext(function($ctx2) {
- return $recv(copy)._at_put_(key,value);
- }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
- }));
- $1=copy;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "size",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._keys())._size();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
- },
- args: [],
- source: "size\x0a\x09^ self keys size",
- referencedClasses: [],
- messageSends: ["size", "keys"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "values",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
- },
- args: [],
- source: "values\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "valuesDo:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
- },
- args: ["aBlock"],
- source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "withIndexDo:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._keysAndValuesDo_((function(key,value){
- return $core.withContext(function($ctx2) {
- return $recv(aBlock)._value_value_(value,key);
- }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
- },
- args: ["aBlock"],
- source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
- referencedClasses: [],
- messageSends: ["keysAndValuesDo:", "value:value:"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "from:",
- protocol: 'instance creation',
- fn: function (aCollection){
- var self=this;
- var newCollection;
- return $core.withContext(function($ctx1) {
- var $1;
- newCollection=self._new();
- $recv(aCollection)._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(newCollection)._add_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $1=newCollection;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
- },
- args: ["aCollection"],
- source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
- referencedClasses: [],
- messageSends: ["new", "do:", "add:"]
- }),
- $globals.AssociativeCollection.klass);
- $core.addMethod(
- $core.method({
- selector: "fromPairs:",
- protocol: 'instance creation',
- fn: function (aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._from_(aCollection);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.klass)});
- },
- args: ["aCollection"],
- source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
- referencedClasses: [],
- messageSends: ["from:"]
- }),
- $globals.AssociativeCollection.klass);
- $core.addMethod(
- $core.method({
- selector: "newFromPairs:",
- protocol: 'instance creation',
- fn: function (aCollection){
- var self=this;
- var newCollection;
- return $core.withContext(function($ctx1) {
- var $2,$1,$3,$4,$5;
- $2=$recv(aCollection)._size();
- $ctx1.sendIdx["size"]=1;
- $1=$recv($2)._even();
- if(!$core.assert($1)){
- self._error_("#newFromPairs only accepts arrays of an even length");
- };
- newCollection=self._new();
- $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
- return $core.withContext(function($ctx2) {
- $3=newCollection;
- $4=$recv(aCollection)._at_(each);
- $ctx2.sendIdx["at:"]=1;
- return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- $5=newCollection;
- return $5;
- }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
- },
- args: ["aCollection"],
- 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",
- referencedClasses: [],
- messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
- }),
- $globals.AssociativeCollection.klass);
- $core.addClass('Dictionary', $globals.AssociativeCollection, ['keys', 'values'], 'Kernel-Collections');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "at:ifAbsent:",
- protocol: 'accessing',
- fn: function (aKey,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var index = self._positionOfKey_(aKey);
- return index >=0 ? self['@values'][index] : aBlock._value();
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
- },
- args: ["aKey", "aBlock"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Dictionary);
- $core.addMethod(
- $core.method({
- selector: "at:put:",
- protocol: 'accessing',
- fn: function (aKey,aValue){
- var self=this;
- return $core.withContext(function($ctx1) {
- var index = self._positionOfKey_(aKey);
- if(index === -1) {
- var keys = self['@keys'];
- index = keys.length;
- keys.push(aKey);
- }
- return self['@values'][index] = aValue;
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
- },
- args: ["aKey", "aValue"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Dictionary);
- $core.addMethod(
- $core.method({
- selector: "includesKey:",
- protocol: 'testing',
- fn: function (aKey){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self._positionOfKey_(aKey) >= 0; ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
- },
- args: ["aKey"],
- source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Dictionary);
- $core.addMethod(
- $core.method({
- selector: "indexOf:ifAbsent:",
- protocol: 'accessing',
- fn: function (anObject,aBlock){
- var self=this;
- var index;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- index=$recv(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
- return (0);
- }));
- $2=$recv(index).__eq((0));
- if($core.assert($2)){
- $1=$recv(aBlock)._value();
- } else {
- $1=$recv(self["@keys"])._at_(index);
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
- },
- args: ["anObject", "aBlock"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
- }),
- $globals.Dictionary);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.Dictionary.superclass.fn.prototype._initialize.apply($recv(self), []));
- $ctx1.supercall = false;
- self["@keys"]=[];
- self["@values"]=[];
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
- },
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
- referencedClasses: [],
- messageSends: ["initialize"]
- }),
- $globals.Dictionary);
- $core.addMethod(
- $core.method({
- selector: "keys",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self["@keys"])._copy();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
- },
- args: [],
- source: "keys\x0a\x09^ keys copy",
- referencedClasses: [],
- messageSends: ["copy"]
- }),
- $globals.Dictionary);
- $core.addMethod(
- $core.method({
- selector: "keysAndValuesDo:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self["@keys"])._with_do_(self["@values"],aBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
- },
- args: ["aBlock"],
- source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
- referencedClasses: [],
- messageSends: ["with:do:"]
- }),
- $globals.Dictionary);
- $core.addMethod(
- $core.method({
- selector: "keysDo:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self["@keys"])._do_(aBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
- },
- args: ["aBlock"],
- source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
- referencedClasses: [],
- messageSends: ["do:"]
- }),
- $globals.Dictionary);
- $core.addMethod(
- $core.method({
- selector: "positionOfKey:",
- protocol: 'private',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var keys = self['@keys'];
- for(var i=0;i<keys.length;i++){
- if(keys[i].__eq(anObject)) { return i;}
- }
- return -1;
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
- },
- args: ["anObject"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Dictionary);
- $core.addMethod(
- $core.method({
- selector: "removeAll",
- protocol: 'adding/removing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self["@keys"])._removeAll();
- $ctx1.sendIdx["removeAll"]=1;
- $recv(self["@values"])._removeAll();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
- },
- args: [],
- source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
- referencedClasses: [],
- messageSends: ["removeAll"]
- }),
- $globals.Dictionary);
- $core.addMethod(
- $core.method({
- selector: "removeKey:ifAbsent:",
- protocol: 'adding/removing',
- fn: function (aKey,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var index = self._positionOfKey_(aKey);
- if(index === -1) {
- return aBlock._value()
- } else {
- var keys = self['@keys'], values = self['@values'];
- var value = values[index], l = keys.length;
- keys[index] = keys[l-1];
- keys.pop();
- values[index] = values[l-1];
- values.pop();
- return value;
- }
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
- },
- args: ["aKey", "aBlock"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Dictionary);
- $core.addMethod(
- $core.method({
- selector: "values",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@values"];
- return $1;
- },
- args: [],
- source: "values\x0a\x09^ values",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Dictionary);
- $core.addMethod(
- $core.method({
- selector: "valuesDo:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self["@values"])._do_(aBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
- },
- args: ["aBlock"],
- source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
- referencedClasses: [],
- messageSends: ["do:"]
- }),
- $globals.Dictionary);
- $core.addClass('HashedCollection', $globals.AssociativeCollection, [], 'Kernel-Collections');
- $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
- $core.addMethod(
- $core.method({
- selector: "at:ifAbsent:",
- protocol: 'accessing',
- fn: function (aKey,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=self._includesKey_(aKey);
- if($core.assert($2)){
- $1=self._basicAt_(aKey);
- } else {
- $1=$recv(aBlock)._value();
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
- },
- args: ["aKey", "aBlock"],
- source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
- }),
- $globals.HashedCollection);
- $core.addMethod(
- $core.method({
- selector: "at:put:",
- protocol: 'accessing',
- fn: function (aKey,aValue){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._basicAt_put_(aKey,aValue);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
- },
- args: ["aKey", "aValue"],
- source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
- referencedClasses: [],
- messageSends: ["basicAt:put:"]
- }),
- $globals.HashedCollection);
- $core.addMethod(
- $core.method({
- selector: "includesKey:",
- protocol: 'testing',
- fn: function (aKey){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.hasOwnProperty(aKey);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
- },
- args: ["aKey"],
- source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.HashedCollection);
- $core.addMethod(
- $core.method({
- selector: "keys",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Object.keys(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
- },
- args: [],
- source: "keys\x0a\x09<return Object.keys(self)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.HashedCollection);
- $core.addMethod(
- $core.method({
- selector: "keysDo:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._keys())._do_(aBlock);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
- },
- args: ["aBlock"],
- source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
- referencedClasses: [],
- messageSends: ["do:", "keys"]
- }),
- $globals.HashedCollection);
- $core.addMethod(
- $core.method({
- selector: "removeKey:ifAbsent:",
- protocol: 'adding/removing',
- fn: function (aKey,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._at_ifPresent_ifAbsent_(aKey,(function(removed){
- return $core.withContext(function($ctx2) {
- self._basicDelete_(aKey);
- return removed;
- }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- return $recv(aBlock)._value();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
- },
- args: ["aKey", "aBlock"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
- }),
- $globals.HashedCollection);
- $core.addMethod(
- $core.method({
- selector: "values",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self._keys().map(function(key){
- return self._at_(key);
- });
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
- },
- args: [],
- source: "values\x0a\x09<\x0a\x09\x09return self._keys().map(function(key){\x0a\x09\x09\x09return self._at_(key);\x0a\x09\x09});\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.HashedCollection);
- $core.addMethod(
- $core.method({
- selector: "valuesDo:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._values())._do_(aBlock);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
- },
- args: ["aBlock"],
- source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
- referencedClasses: [],
- messageSends: ["do:", "values"]
- }),
- $globals.HashedCollection);
- $core.addClass('SequenceableCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
- $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
- $core.addMethod(
- $core.method({
- selector: "=",
- protocol: 'comparing',
- fn: function (aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $3,$2,$4,$1,$5;
- var $early={};
- try {
- $3=self._class();
- $ctx1.sendIdx["class"]=1;
- $2=$recv($3).__eq($recv(aCollection)._class());
- $ctx1.sendIdx["="]=1;
- $1=$recv($2)._and_((function(){
- return $core.withContext(function($ctx2) {
- $4=self._size();
- $ctx2.sendIdx["size"]=1;
- return $recv($4).__eq($recv(aCollection)._size());
- $ctx2.sendIdx["="]=2;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- if(!$core.assert($1)){
- return false;
- };
- self._withIndexDo_((function(each,i){
- return $core.withContext(function($ctx2) {
- $5=$recv($recv(aCollection)._at_(i)).__eq(each);
- if(!$core.assert($5)){
- throw $early=[false];
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
- }));
- return true;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
- },
- args: ["aCollection"],
- 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",
- referencedClasses: [],
- messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "addLast:",
- protocol: 'adding/removing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._add_(anObject);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
- },
- args: ["anObject"],
- source: "addLast: anObject\x0a\x09self add: anObject",
- referencedClasses: [],
- messageSends: ["add:"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "allButFirst",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._copyFrom_to_((2),self._size());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
- },
- args: [],
- source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
- referencedClasses: [],
- messageSends: ["copyFrom:to:", "size"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "allButLast",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._copyFrom_to_((1),$recv(self._size()).__minus((1)));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
- },
- args: [],
- source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
- referencedClasses: [],
- messageSends: ["copyFrom:to:", "-", "size"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "atRandom",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._at_($recv(self._size())._atRandom());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
- },
- args: [],
- source: "atRandom\x0a\x09^ self at: self size atRandom",
- referencedClasses: [],
- messageSends: ["at:", "atRandom", "size"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "beginsWith:",
- protocol: 'testing',
- fn: function (prefix){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1,$4;
- $2=self._size();
- $ctx1.sendIdx["size"]=1;
- $3=$recv(prefix)._size();
- $ctx1.sendIdx["size"]=2;
- $1=$recv($2).__lt($3);
- if($core.assert($1)){
- return false;
- };
- $4=$recv(self._first_($recv(prefix)._size())).__eq(prefix);
- return $4;
- }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
- },
- args: ["prefix"],
- source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
- referencedClasses: [],
- messageSends: ["ifTrue:", "<", "size", "=", "first:"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "copyFrom:to:",
- protocol: 'copying',
- fn: function (anIndex,anotherIndex){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
- },
- args: ["anIndex", "anotherIndex"],
- source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "detect:ifNone:",
- protocol: 'enumerating',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self = self._numericallyIndexable();
- for(var i = 0; i < self.length; i++)
- if(aBlock._value_(self[i]))
- return self[i];
- return anotherBlock._value();
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
- },
- args: ["aBlock", "anotherBlock"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "do:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self = self._numericallyIndexable();
- for(var i=0; i < self.length; i++) {
- aBlock._value_(self[i]);
- }
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
- },
- args: ["aBlock"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "endsWith:",
- protocol: 'testing',
- fn: function (suffix){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1,$4;
- $2=self._size();
- $ctx1.sendIdx["size"]=1;
- $3=$recv(suffix)._size();
- $ctx1.sendIdx["size"]=2;
- $1=$recv($2).__lt($3);
- if($core.assert($1)){
- return false;
- };
- $4=$recv(self._last_($recv(suffix)._size())).__eq(suffix);
- return $4;
- }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
- },
- args: ["suffix"],
- source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
- referencedClasses: [],
- messageSends: ["ifTrue:", "<", "size", "=", "last:"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "first",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._at_((1));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
- },
- args: [],
- source: "first\x0a\x09^ self at: 1",
- referencedClasses: [],
- messageSends: ["at:"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "first:",
- protocol: 'accessing',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=$recv(self._size()).__lt(aNumber);
- if($core.assert($1)){
- self._error_("Invalid number of elements");
- };
- $2=self._copyFrom_to_((1),aNumber);
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
- },
- args: ["aNumber"],
- 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",
- referencedClasses: [],
- messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "fourth",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._at_((4));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
- },
- args: [],
- source: "fourth\x0a\x09^ self at: 4",
- referencedClasses: [],
- messageSends: ["at:"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "includes:",
- protocol: 'testing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._indexOf_ifAbsent_(anObject,(function(){
- return nil;
- })))._notNil();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
- },
- args: ["anObject"],
- source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
- referencedClasses: [],
- messageSends: ["notNil", "indexOf:ifAbsent:"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "indexOf:ifAbsent:",
- protocol: 'accessing',
- fn: function (anObject,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self = self._numericallyIndexable();
- for(var i=0; i < self.length; i++) {
- if($recv(self[i]).__eq(anObject)) {return i+1}
- };
- return aBlock._value();
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
- },
- args: ["anObject", "aBlock"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "indexOf:startingAt:",
- protocol: 'accessing',
- fn: function (anObject,start){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
- return (0);
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
- },
- args: ["anObject", "start"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["indexOf:startingAt:ifAbsent:"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "indexOf:startingAt:ifAbsent:",
- protocol: 'accessing',
- fn: function (anObject,start,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self = self._numericallyIndexable();
- for(var i=start - 1; i < self.length; i++){
- if($recv(self[i]).__eq(anObject)) {return i+1}
- }
- return aBlock._value();
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
- },
- args: ["anObject", "start", "aBlock"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "last",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._at_(self._size());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
- },
- args: [],
- source: "last\x0a\x09^ self at: self size",
- referencedClasses: [],
- messageSends: ["at:", "size"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "last:",
- protocol: 'accessing',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$6,$5,$4,$3;
- $2=self._size();
- $ctx1.sendIdx["size"]=1;
- $1=$recv($2).__lt(aNumber);
- if($core.assert($1)){
- self._error_("Invalid number of elements");
- };
- $6=self._size();
- $ctx1.sendIdx["size"]=2;
- $5=$recv($6).__minus(aNumber);
- $4=$recv($5).__plus((1));
- $3=self._copyFrom_to_($4,self._size());
- return $3;
- }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
- },
- args: ["aNumber"],
- 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",
- referencedClasses: [],
- messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "newStream",
- protocol: 'streaming',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._streamClass())._on_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
- },
- args: [],
- source: "newStream\x0a\x09^ self streamClass on: self",
- referencedClasses: [],
- messageSends: ["on:", "streamClass"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "numericallyIndexable",
- protocol: 'private',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "readStream",
- protocol: 'streaming',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._stream();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
- },
- args: [],
- source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
- referencedClasses: [],
- messageSends: ["stream"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "removeLast",
- protocol: 'adding/removing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._remove_(self._last());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
- },
- args: [],
- source: "removeLast\x0a\x09^ self remove: self last",
- referencedClasses: [],
- messageSends: ["remove:", "last"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "reversed",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
- },
- args: [],
- source: "reversed\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "second",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._at_((2));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
- },
- args: [],
- source: "second\x0a\x09^ self at: 2",
- referencedClasses: [],
- messageSends: ["at:"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "stream",
- protocol: 'streaming',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._newStream();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
- },
- args: [],
- source: "stream\x0a\x09^ self newStream",
- referencedClasses: [],
- messageSends: ["newStream"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "streamClass",
- protocol: 'streaming',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._class())._streamClass();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
- },
- args: [],
- source: "streamClass\x0a\x09^ self class streamClass",
- referencedClasses: [],
- messageSends: ["streamClass", "class"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "third",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._at_((3));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
- },
- args: [],
- source: "third\x0a\x09^ self at: 3",
- referencedClasses: [],
- messageSends: ["at:"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "with:do:",
- protocol: 'enumerating',
- fn: function (anotherCollection,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self = self._numericallyIndexable();
- anotherCollection = anotherCollection._numericallyIndexable();
- for(var i=0; i<self.length; i++) {
- aBlock._value_value_(self[i], anotherCollection[i]);
- }
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
- },
- args: ["anotherCollection", "aBlock"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "withIndexDo:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self = self._numericallyIndexable();
- for(var i=0; i < self.length; i++) {
- aBlock._value_value_(self[i], i+1);
- }
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
- },
- args: ["aBlock"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "writeStream",
- protocol: 'streaming',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._stream();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
- },
- args: [],
- source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
- referencedClasses: [],
- messageSends: ["stream"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "streamClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Stream(){return $globals.Stream||(typeof Stream=="undefined"?nil:Stream)}
- return $Stream();
- },
- args: [],
- source: "streamClass\x0a\x09\x09^ Stream",
- referencedClasses: ["Stream"],
- messageSends: []
- }),
- $globals.SequenceableCollection.klass);
- $core.addMethod(
- $core.method({
- selector: "streamContents:",
- protocol: 'streaming',
- fn: function (aBlock){
- var self=this;
- var stream;
- return $core.withContext(function($ctx1) {
- var $1;
- stream=$recv(self._streamClass())._on_(self._new());
- $recv(aBlock)._value_(stream);
- $1=$recv(stream)._contents();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.klass)});
- },
- args: ["aBlock"],
- source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
- referencedClasses: [],
- messageSends: ["on:", "streamClass", "new", "value:", "contents"]
- }),
- $globals.SequenceableCollection.klass);
- $core.addClass('Array', $globals.SequenceableCollection, [], 'Kernel-Collections');
- $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`.";
- $core.addMethod(
- $core.method({
- selector: "add:",
- protocol: 'adding/removing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- self.push(anObject); return anObject;;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
- },
- args: ["anObject"],
- source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "addAll:",
- protocol: 'adding/removing',
- fn: function (aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
- else $globals.Array.superclass.fn.prototype._addAll_.call(self, aCollection);
- return aCollection;;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
- },
- args: ["aCollection"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "addFirst:",
- protocol: 'adding/removing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- self.unshift(anObject); return anObject;;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
- },
- args: ["anObject"],
- source: "addFirst: anObject\x0a\x09<self.unshift(anObject); return anObject;>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "asJavascript",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv("[".__comma($recv(self._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._asJavascript();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- })))._join_(", "))).__comma("]");
- $ctx1.sendIdx[","]=1;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Array)});
- },
- args: [],
- source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'",
- referencedClasses: [],
- messageSends: [",", "join:", "collect:", "asJavascript"]
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "at:ifAbsent:",
- protocol: 'accessing',
- fn: function (anIndex,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- return anIndex >= 1 && anIndex <= self.length
- ? self[anIndex - 1]
- : aBlock._value()
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
- },
- args: ["anIndex", "aBlock"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "at:ifPresent:ifAbsent:",
- protocol: 'accessing',
- fn: function (anIndex,aBlock,anotherBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- return anIndex >= 1 && anIndex <= self.length
- ? aBlock._value_(self[anIndex - 1])
- : anotherBlock._value()
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
- },
- args: ["anIndex", "aBlock", "anotherBlock"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "at:put:",
- protocol: 'accessing',
- fn: function (anIndex,anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self[anIndex - 1] = anObject;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
- },
- args: ["anIndex", "anObject"],
- source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "collect:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.map(function(each) {return aBlock._value_(each)});
- return self;
- }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
- },
- args: ["aBlock"],
- source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.map(function(each) {return aBlock._value_(each)})>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "copyFrom:to:",
- protocol: 'copying',
- fn: function (anIndex,anotherIndex){
- var self=this;
- return $core.withContext(function($ctx1) {
- if (anIndex >= 1 && anotherIndex <= self.length) {
- return self.slice(anIndex - 1, anotherIndex);
- } else {
- self._at_(anIndex);
- self._at_(self.length + 1);
- throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
- },
- args: ["anIndex", "anotherIndex"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "join:",
- protocol: 'enumerating',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.join(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
- },
- args: ["aString"],
- source: "join: aString\x0a\x09<return self.join(aString)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "numericallyIndexable",
- protocol: 'private',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "numericallyIndexable\x0a\x09^ self",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "printOn:",
- protocol: 'printing',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.Array.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
- $ctx1.supercall = false;
- $ctx1.sendIdx["printOn:"]=1;
- $recv(aStream)._nextPutAll_(" (");
- $ctx1.sendIdx["nextPutAll:"]=1;
- self._do_separatedBy_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._printOn_(aStream);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- return $recv(aStream)._nextPutAll_(" ");
- $ctx2.sendIdx["nextPutAll:"]=2;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- $recv(aStream)._nextPutAll_(")");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
- },
- args: ["aStream"],
- 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: ')'",
- referencedClasses: [],
- messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "remove:ifAbsent:",
- protocol: 'adding/removing',
- fn: function (anObject,aBlock){
- var self=this;
- var index;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- index=self._indexOf_ifAbsent_(anObject,(function(){
- return (0);
- }));
- $2=$recv(index).__eq((0));
- if($core.assert($2)){
- $1=$recv(aBlock)._value();
- } else {
- self._removeIndex_(index);
- $1=anObject;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
- },
- args: ["anObject", "aBlock"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "removeAll",
- protocol: 'adding/removing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self.length = 0;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
- },
- args: [],
- source: "removeAll\x0a\x09<self.length = 0>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "removeFrom:to:",
- protocol: 'adding/removing',
- fn: function (aNumber,anotherNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- self.splice(aNumber -1, anotherNumber - aNumber + 1);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
- },
- args: ["aNumber", "anotherNumber"],
- source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber -1, anotherNumber - aNumber + 1)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "removeIndex:",
- protocol: 'adding/removing',
- fn: function (anInteger){
- var self=this;
- return $core.withContext(function($ctx1) {
- self.splice(anInteger - 1, 1);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
- },
- args: ["anInteger"],
- source: "removeIndex: anInteger\x0a\x09<self.splice(anInteger - 1, 1)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "removeLast",
- protocol: 'adding/removing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.pop();;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
- },
- args: [],
- source: "removeLast\x0a\x09<return self.pop();>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "reversed",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.slice().reverse();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
- },
- args: [],
- source: "reversed\x0a\x09<return self.slice().reverse()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "select:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.filter(function(each) {return aBlock._value_(each)});
- return self;
- }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
- },
- args: ["aBlock"],
- source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.filter(function(each) {return aBlock._value_(each)})>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "shallowCopy",
- protocol: 'copying',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.slice();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
- },
- args: [],
- source: "shallowCopy\x0a\x09<return self.slice()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "size",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.length;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
- },
- args: [],
- source: "size\x0a\x09<return self.length>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "sort",
- protocol: 'enumerating',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._sort_((function(a,b){
- return $core.withContext(function($ctx2) {
- return $recv(a).__lt(b);
- }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
- },
- args: [],
- source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
- referencedClasses: [],
- messageSends: ["sort:", "<"]
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "sort:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.sort(function(a, b) {
- if(aBlock._value_value_(a,b)) {return -1} else {return 1}
- })
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
- },
- args: ["aBlock"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "sorted",
- protocol: 'enumerating',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._copy())._sort();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
- },
- args: [],
- source: "sorted\x0a\x09^ self copy sort",
- referencedClasses: [],
- messageSends: ["sort", "copy"]
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "sorted:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._copy())._sort_(aBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
- },
- args: ["aBlock"],
- source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
- referencedClasses: [],
- messageSends: ["sort:", "copy"]
- }),
- $globals.Array);
- $core.addMethod(
- $core.method({
- selector: "new:",
- protocol: 'instance creation',
- fn: function (anInteger){
- var self=this;
- return $core.withContext(function($ctx1) {
- return new Array(anInteger);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.klass)});
- },
- args: ["anInteger"],
- source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Array.klass);
- $core.addMethod(
- $core.method({
- selector: "with:",
- protocol: 'instance creation',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new_((1));
- $recv($2)._at_put_((1),anObject);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.klass)});
- },
- args: ["anObject"],
- source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["at:put:", "new:", "yourself"]
- }),
- $globals.Array.klass);
- $core.addMethod(
- $core.method({
- selector: "with:with:",
- protocol: 'instance creation',
- fn: function (anObject,anObject2){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new_((2));
- $recv($2)._at_put_((1),anObject);
- $ctx1.sendIdx["at:put:"]=1;
- $recv($2)._at_put_((2),anObject2);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.klass)});
- },
- args: ["anObject", "anObject2"],
- 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",
- referencedClasses: [],
- messageSends: ["at:put:", "new:", "yourself"]
- }),
- $globals.Array.klass);
- $core.addMethod(
- $core.method({
- selector: "with:with:with:",
- protocol: 'instance creation',
- fn: function (anObject,anObject2,anObject3){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new_((3));
- $recv($2)._at_put_((1),anObject);
- $ctx1.sendIdx["at:put:"]=1;
- $recv($2)._at_put_((2),anObject2);
- $ctx1.sendIdx["at:put:"]=2;
- $recv($2)._at_put_((3),anObject3);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.klass)});
- },
- args: ["anObject", "anObject2", "anObject3"],
- 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",
- referencedClasses: [],
- messageSends: ["at:put:", "new:", "yourself"]
- }),
- $globals.Array.klass);
- $core.addMethod(
- $core.method({
- selector: "withAll:",
- protocol: 'instance creation',
- fn: function (aCollection){
- var self=this;
- var instance,index;
- return $core.withContext(function($ctx1) {
- var $1;
- index=(1);
- instance=self._new_($recv(aCollection)._size());
- $recv(aCollection)._do_((function(each){
- return $core.withContext(function($ctx2) {
- $recv(instance)._at_put_(index,each);
- index=$recv(index).__plus((1));
- return index;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $1=instance;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.klass)});
- },
- args: ["aCollection"],
- 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",
- referencedClasses: [],
- messageSends: ["new:", "size", "do:", "at:put:", "+"]
- }),
- $globals.Array.klass);
- $core.addClass('CharacterArray', $globals.SequenceableCollection, [], 'Kernel-Collections');
- $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
- $core.addMethod(
- $core.method({
- selector: ",",
- protocol: 'copying',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=self._asString();
- $ctx1.sendIdx["asString"]=1;
- $1=$recv($2).__comma($recv(aString)._asString());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
- },
- args: ["aString"],
- source: ", aString\x0a\x09^ self asString, aString asString",
- referencedClasses: [],
- messageSends: [",", "asString"]
- }),
- $globals.CharacterArray);
- $core.addMethod(
- $core.method({
- selector: "add:",
- protocol: 'adding/removing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._errorReadOnly();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
- },
- args: ["anObject"],
- source: "add: anObject\x0a\x09self errorReadOnly",
- referencedClasses: [],
- messageSends: ["errorReadOnly"]
- }),
- $globals.CharacterArray);
- $core.addMethod(
- $core.method({
- selector: "asLowercase",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._class())._fromString_($recv(self._asString())._asLowercase());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
- },
- args: [],
- source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
- referencedClasses: [],
- messageSends: ["fromString:", "class", "asLowercase", "asString"]
- }),
- $globals.CharacterArray);
- $core.addMethod(
- $core.method({
- selector: "asNumber",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._asString())._asNumber();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
- },
- args: [],
- source: "asNumber\x0a\x09^ self asString asNumber",
- referencedClasses: [],
- messageSends: ["asNumber", "asString"]
- }),
- $globals.CharacterArray);
- $core.addMethod(
- $core.method({
- selector: "asString",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._subclassResponsibility();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
- },
- args: [],
- source: "asString\x0a\x09^ self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.CharacterArray);
- $core.addMethod(
- $core.method({
- selector: "asSymbol",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._asString();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
- },
- args: [],
- source: "asSymbol\x0a\x09^ self asString",
- referencedClasses: [],
- messageSends: ["asString"]
- }),
- $globals.CharacterArray);
- $core.addMethod(
- $core.method({
- selector: "asUppercase",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._class())._fromString_($recv(self._asString())._asUppercase());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
- },
- args: [],
- source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
- referencedClasses: [],
- messageSends: ["fromString:", "class", "asUppercase", "asString"]
- }),
- $globals.CharacterArray);
- $core.addMethod(
- $core.method({
- selector: "at:put:",
- protocol: 'accessing',
- fn: function (anIndex,anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._errorReadOnly();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
- },
- args: ["anIndex", "anObject"],
- source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
- referencedClasses: [],
- messageSends: ["errorReadOnly"]
- }),
- $globals.CharacterArray);
- $core.addMethod(
- $core.method({
- selector: "errorReadOnly",
- protocol: 'error handling',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._error_("Object is read-only");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
- },
- args: [],
- source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
- referencedClasses: [],
- messageSends: ["error:"]
- }),
- $globals.CharacterArray);
- $core.addMethod(
- $core.method({
- selector: "printOn:",
- protocol: 'printing',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._asString())._printOn_(aStream);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
- },
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09self asString printOn: aStream",
- referencedClasses: [],
- messageSends: ["printOn:", "asString"]
- }),
- $globals.CharacterArray);
- $core.addMethod(
- $core.method({
- selector: "putOn:",
- protocol: 'streaming',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aStream)._nextPutString_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
- },
- args: ["aStream"],
- source: "putOn: aStream\x0a\x09aStream nextPutString: self",
- referencedClasses: [],
- messageSends: ["nextPutString:"]
- }),
- $globals.CharacterArray);
- $core.addMethod(
- $core.method({
- selector: "remove:",
- protocol: 'adding/removing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._errorReadOnly();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
- },
- args: ["anObject"],
- source: "remove: anObject\x0a\x09self errorReadOnly",
- referencedClasses: [],
- messageSends: ["errorReadOnly"]
- }),
- $globals.CharacterArray);
- $core.addMethod(
- $core.method({
- selector: "fromString:",
- protocol: 'instance creation',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.klass)});
- },
- args: ["aString"],
- source: "fromString: aString\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.CharacterArray.klass);
- $core.addClass('String', $globals.CharacterArray, [], 'Kernel-Collections');
- $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 >> #,`";
- $core.addMethod(
- $core.method({
- selector: ",",
- protocol: 'copying',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- return String(self) + aString;
- return self;
- }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
- },
- args: ["aString"],
- source: ", aString\x0a\x09<return String(self) + aString>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "<",
- protocol: 'comparing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- return String(self) < aString._asString();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
- },
- args: ["aString"],
- source: "< aString\x0a\x09<return String(self) < aString._asString()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "<=",
- protocol: 'comparing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- return String(self) <= aString._asString();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
- },
- args: ["aString"],
- source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "=",
- protocol: 'comparing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
- },
- args: ["aString"],
- source: "= aString\x0a<return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "==",
- protocol: 'comparing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
- },
- args: ["aString"],
- source: "== aString\x0a<return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: ">",
- protocol: 'comparing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- return String(self) > aString._asString();
- return self;
- }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
- },
- args: ["aString"],
- source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: ">=",
- protocol: 'comparing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- return String(self) >= aString._asString();
- return self;
- }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
- },
- args: ["aString"],
- source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "asJSON",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "asJSON\x0a\x09^ self",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "asJavaScriptMethodName",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return $core.st2js(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
- },
- args: [],
- source: "asJavaScriptMethodName\x0a\x09<return $core.st2js(self)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "asJavascript",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
- return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
- else
- return "\"" + self + "\"";
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.String)});
- },
- args: [],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "asLowercase",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.toLowerCase();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
- },
- args: [],
- source: "asLowercase\x0a\x09<return self.toLowerCase()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "asMutator",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=$recv(self._last()).__eq(":");
- if(!$core.assert($1)){
- $2=self.__comma(":");
- return $2;
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["ifFalse:", "=", "last", ","]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "asNumber",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Number(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
- },
- args: [],
- source: "asNumber\x0a\x09<return Number(self)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "asRegexp",
- protocol: 'converting',
- fn: function (){
- var self=this;
- function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($RegularExpression())._fromString_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
- },
- args: [],
- source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
- referencedClasses: ["RegularExpression"],
- messageSends: ["fromString:"]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "asString",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "asString\x0a\x09^ self",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "asSymbol",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "asSymbol\x0a\x09^ self",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "asUppercase",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.toUpperCase();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
- },
- args: [],
- source: "asUppercase\x0a\x09<return self.toUpperCase()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "asciiValue",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.charCodeAt(0);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
- },
- args: [],
- source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "at:ifAbsent:",
- protocol: 'accessing',
- fn: function (anIndex,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- return String(self)[anIndex - 1] || aBlock._value();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
- },
- args: ["anIndex", "aBlock"],
- source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self)[anIndex - 1] || aBlock._value()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "at:ifPresent:ifAbsent:",
- protocol: 'accessing',
- fn: function (anIndex,aBlock,anotherBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var result = String(self)[anIndex - 1];
- return result ? aBlock._value_(result) : anotherBlock._value();
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
- },
- args: ["anIndex", "aBlock", "anotherBlock"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "capitalized",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=self._isEmpty();
- if($core.assert($2)){
- $1=self;
- } else {
- $1=$recv($recv(self._first())._asUppercase()).__comma(self._allButFirst());
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
- },
- args: [],
- source: "capitalized\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self first asUppercase, self allButFirst ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "isEmpty", ",", "asUppercase", "first", "allButFirst"]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "charCodeAt:",
- protocol: 'accessing',
- fn: function (anInteger){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.charCodeAt(anInteger - 1);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
- },
- args: ["anInteger"],
- source: "charCodeAt: anInteger\x0a\x09<return self.charCodeAt(anInteger - 1)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "copyFrom:to:",
- protocol: 'copying',
- fn: function (anIndex,anotherIndex){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.substring(anIndex - 1, anotherIndex);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
- },
- args: ["anIndex", "anotherIndex"],
- source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "crlfSanitized",
- protocol: 'converting',
- fn: function (){
- var self=this;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._lines())._join_($recv($String())._lf());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
- },
- args: [],
- source: "crlfSanitized\x0a\x09^ self lines join: String lf",
- referencedClasses: ["String"],
- messageSends: ["join:", "lines", "lf"]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "deepCopy",
- protocol: 'copying',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._shallowCopy();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
- },
- args: [],
- source: "deepCopy\x0a\x09^ self shallowCopy",
- referencedClasses: [],
- messageSends: ["shallowCopy"]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "escaped",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return escape(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
- },
- args: [],
- source: "escaped\x0a\x09<return escape(self)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "includesSubString:",
- protocol: 'testing',
- fn: function (subString){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.indexOf(subString) != -1;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
- },
- args: ["subString"],
- source: "includesSubString: subString\x0a\x09<return self.indexOf(subString) != -1>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "isCapitalized",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $3,$2,$1;
- $3=self._first();
- $ctx1.sendIdx["first"]=1;
- $2=$recv($3)._asUppercase();
- $1=$recv($2).__eq_eq(self._first());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
- },
- args: [],
- source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
- referencedClasses: [],
- messageSends: ["==", "asUppercase", "first"]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "isImmutable",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isImmutable\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "isString",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isString\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "isVowel",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv(self._size()).__eq((1)))._and_((function(){
- return $core.withContext(function($ctx2) {
- return "aeiou"._includes_(self._asLowercase());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
- },
- args: [],
- 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 ]",
- referencedClasses: [],
- messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "join:",
- protocol: 'split join',
- fn: function (aCollection){
- var self=this;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($String())._streamContents_((function(stream){
- return $core.withContext(function($ctx2) {
- return $recv(aCollection)._do_separatedBy_((function(each){
- return $core.withContext(function($ctx3) {
- return $recv(stream)._nextPutAll_($recv(each)._asString());
- $ctx3.sendIdx["nextPutAll:"]=1;
- }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
- }),(function(){
- return $core.withContext(function($ctx3) {
- return $recv(stream)._nextPutAll_(self);
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
- }));
- }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
- },
- args: ["aCollection"],
- 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 ]]",
- referencedClasses: ["String"],
- messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "lineIndicesDo:",
- protocol: 'split join',
- fn: function (aBlock){
- var self=this;
- var cr,lf,start,sz,nextLF,nextCR;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
- var $early={};
- try {
- start=(1);
- sz=self._size();
- cr=$recv($String())._cr();
- nextCR=self._indexOf_startingAt_(cr,(1));
- $ctx1.sendIdx["indexOf:startingAt:"]=1;
- lf=$recv($String())._lf();
- nextLF=self._indexOf_startingAt_(lf,(1));
- $ctx1.sendIdx["indexOf:startingAt:"]=2;
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return $recv(start).__lt_eq(sz);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._whileTrue_((function(){
- return $core.withContext(function($ctx2) {
- $2=$recv(nextLF).__eq((0));
- $ctx2.sendIdx["="]=1;
- $1=$recv($2)._and_((function(){
- return $core.withContext(function($ctx3) {
- return $recv(nextCR).__eq((0));
- $ctx3.sendIdx["="]=2;
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
- }));
- $ctx2.sendIdx["and:"]=1;
- if($core.assert($1)){
- $recv(aBlock)._value_value_value_(start,sz,sz);
- $ctx2.sendIdx["value:value:value:"]=1;
- throw $early=[self];
- };
- $4=$recv(nextCR).__eq((0));
- $ctx2.sendIdx["="]=3;
- $3=$recv($4)._or_((function(){
- return $core.withContext(function($ctx3) {
- $5=(0).__lt(nextLF);
- $ctx3.sendIdx["<"]=1;
- return $recv($5)._and_((function(){
- return $core.withContext(function($ctx4) {
- return $recv(nextLF).__lt(nextCR);
- }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
- }));
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
- }));
- if($core.assert($3)){
- $6=start;
- $7=$recv(nextLF).__minus((1));
- $ctx2.sendIdx["-"]=1;
- $recv(aBlock)._value_value_value_($6,$7,nextLF);
- $ctx2.sendIdx["value:value:value:"]=2;
- start=(1).__plus(nextLF);
- $ctx2.sendIdx["+"]=1;
- start;
- nextLF=self._indexOf_startingAt_(lf,start);
- $ctx2.sendIdx["indexOf:startingAt:"]=3;
- return nextLF;
- } else {
- $9=(1).__plus(nextCR);
- $ctx2.sendIdx["+"]=2;
- $8=$recv($9).__eq(nextLF);
- if($core.assert($8)){
- $10=start;
- $11=$recv(nextCR).__minus((1));
- $ctx2.sendIdx["-"]=2;
- $recv(aBlock)._value_value_value_($10,$11,nextLF);
- $ctx2.sendIdx["value:value:value:"]=3;
- start=(1).__plus(nextLF);
- $ctx2.sendIdx["+"]=3;
- start;
- nextCR=self._indexOf_startingAt_(cr,start);
- $ctx2.sendIdx["indexOf:startingAt:"]=4;
- nextCR;
- nextLF=self._indexOf_startingAt_(lf,start);
- $ctx2.sendIdx["indexOf:startingAt:"]=5;
- return nextLF;
- } else {
- $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
- start=(1).__plus(nextCR);
- start;
- nextCR=self._indexOf_startingAt_(cr,start);
- return nextCR;
- };
- };
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- return self;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
- },
- args: ["aBlock"],
- 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 ] ]]",
- referencedClasses: ["String"],
- messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "lineNumber:",
- protocol: 'split join',
- fn: function (anIndex){
- var self=this;
- var lineCount;
- return $core.withContext(function($ctx1) {
- var $2,$1,$3;
- var $early={};
- try {
- lineCount=(0);
- self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
- return $core.withContext(function($ctx2) {
- lineCount=$recv(lineCount).__plus((1));
- $2=lineCount;
- $1=$recv($2).__eq(anIndex);
- if($core.assert($1)){
- $3=self._copyFrom_to_(start,endWithoutDelimiters);
- throw $early=[$3];
- };
- }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
- }));
- return nil;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
- },
- args: ["anIndex"],
- 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",
- referencedClasses: [],
- messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "lines",
- protocol: 'split join',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var result = self.split(/\r\n|\r|\n/);
- if (!result[result.length-1]) result.pop();
- return result;;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
- },
- args: [],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "linesDo:",
- protocol: 'split join',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._lines())._do_(aBlock);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
- },
- args: ["aBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["do:", "lines"]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "match:",
- protocol: 'regular expressions',
- fn: function (aRegexp){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.search(aRegexp) != -1;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
- },
- args: ["aRegexp"],
- source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "matchesOf:",
- protocol: 'regular expressions',
- fn: function (aRegularExpression){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.match(aRegularExpression);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
- },
- args: ["aRegularExpression"],
- source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "numericallyIndexable",
- protocol: 'private',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return String(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
- },
- args: [],
- source: "numericallyIndexable\x0a\x09<return String(self)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "printNl",
- protocol: 'printing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- console.log(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
- },
- args: [],
- source: "printNl\x0a\x09<console.log(self)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "printOn:",
- protocol: 'printing',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $recv(aStream)._nextPutAll_("'");
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv(aStream)._nextPutAll_(self);
- $ctx1.sendIdx["nextPutAll:"]=2;
- $1=$recv(aStream)._nextPutAll_("'");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
- },
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
- referencedClasses: [],
- messageSends: ["nextPutAll:"]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "replace:with:",
- protocol: 'regular expressions',
- fn: function (aString,anotherString){
- var self=this;
- function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._replaceRegexp_with_($recv($RegularExpression())._fromString_flag_(aString,"g"),anotherString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
- },
- args: ["aString", "anotherString"],
- source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
- referencedClasses: ["RegularExpression"],
- messageSends: ["replaceRegexp:with:", "fromString:flag:"]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "replaceRegexp:with:",
- protocol: 'regular expressions',
- fn: function (aRegexp,aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.replace(aRegexp, aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
- },
- args: ["aRegexp", "aString"],
- source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "reversed",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.split("").reverse().join("");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
- },
- args: [],
- source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "shallowCopy",
- protocol: 'copying',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "shallowCopy\x0a\x09^ self",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "size",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.length;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
- },
- args: [],
- source: "size\x0a\x09<return self.length>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "subStrings:",
- protocol: 'split join',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._tokenize_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
- },
- args: ["aString"],
- source: "subStrings: aString\x0a\x09^ self tokenize: aString",
- referencedClasses: [],
- messageSends: ["tokenize:"]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "tokenize:",
- protocol: 'split join',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.split(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
- },
- args: ["aString"],
- source: "tokenize: aString\x0a\x09<return self.split(aString)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "trimBoth",
- protocol: 'regular expressions',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._trimBoth_("\x5cs");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
- },
- args: [],
- source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
- referencedClasses: [],
- messageSends: ["trimBoth:"]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "trimBoth:",
- protocol: 'regular expressions',
- fn: function (separators){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._trimLeft_(separators))._trimRight_(separators);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
- },
- args: ["separators"],
- source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
- referencedClasses: [],
- messageSends: ["trimRight:", "trimLeft:"]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "trimLeft",
- protocol: 'regular expressions',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._trimLeft_("\x5cs");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
- },
- args: [],
- source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
- referencedClasses: [],
- messageSends: ["trimLeft:"]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "trimLeft:",
- protocol: 'regular expressions',
- fn: function (separators){
- var self=this;
- function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
- return $core.withContext(function($ctx1) {
- var $3,$2,$1;
- $3=$recv("^[".__comma(separators)).__comma("]+");
- $ctx1.sendIdx[","]=1;
- $2=$recv($RegularExpression())._fromString_flag_($3,"g");
- $1=self._replaceRegexp_with_($2,"");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
- },
- args: ["separators"],
- source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
- referencedClasses: ["RegularExpression"],
- messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "trimRight",
- protocol: 'regular expressions',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._trimRight_("\x5cs");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
- },
- args: [],
- source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
- referencedClasses: [],
- messageSends: ["trimRight:"]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "trimRight:",
- protocol: 'regular expressions',
- fn: function (separators){
- var self=this;
- function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
- return $core.withContext(function($ctx1) {
- var $3,$2,$1;
- $3=$recv("[".__comma(separators)).__comma("]+$");
- $ctx1.sendIdx[","]=1;
- $2=$recv($RegularExpression())._fromString_flag_($3,"g");
- $1=self._replaceRegexp_with_($2,"");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
- },
- args: ["separators"],
- source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
- referencedClasses: ["RegularExpression"],
- messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "unescaped",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return unescape(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
- },
- args: [],
- source: "unescaped\x0a\x09<return unescape(self)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "uriComponentDecoded",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return decodeURIComponent(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
- },
- args: [],
- source: "uriComponentDecoded\x0a\x09<return decodeURIComponent(self)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "uriComponentEncoded",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return encodeURIComponent(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
- },
- args: [],
- source: "uriComponentEncoded\x0a\x09<return encodeURIComponent(self)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "uriDecoded",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return decodeURI(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
- },
- args: [],
- source: "uriDecoded\x0a\x09<return decodeURI(self)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "uriEncoded",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return encodeURI(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
- },
- args: [],
- source: "uriEncoded\x0a\x09<return encodeURI(self)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "value:",
- protocol: 'evaluating',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(anObject)._perform_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
- },
- args: ["anObject"],
- source: "value: anObject \x0a\x09^ anObject perform: self",
- referencedClasses: [],
- messageSends: ["perform:"]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "cr",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return '\r';
- return self;
- }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.klass)});
- },
- args: [],
- source: "cr\x0a\x09<return '\x5cr'>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String.klass);
- $core.addMethod(
- $core.method({
- selector: "crlf",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return '\r\n';
- return self;
- }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.klass)});
- },
- args: [],
- source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String.klass);
- $core.addMethod(
- $core.method({
- selector: "esc",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._fromCharCode_((27));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.klass)});
- },
- args: [],
- source: "esc\x0a\x09^ self fromCharCode: 27",
- referencedClasses: [],
- messageSends: ["fromCharCode:"]
- }),
- $globals.String.klass);
- $core.addMethod(
- $core.method({
- selector: "fromCharCode:",
- protocol: 'instance creation',
- fn: function (anInteger){
- var self=this;
- return $core.withContext(function($ctx1) {
- return String.fromCharCode(anInteger);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.klass)});
- },
- args: ["anInteger"],
- source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String.klass);
- $core.addMethod(
- $core.method({
- selector: "fromString:",
- protocol: 'instance creation',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- return String(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.klass)});
- },
- args: ["aString"],
- source: "fromString: aString\x0a\x09\x09<return String(aString)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String.klass);
- $core.addMethod(
- $core.method({
- selector: "lf",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return '\n';
- return self;
- }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.klass)});
- },
- args: [],
- source: "lf\x0a\x09<return '\x5cn'>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String.klass);
- $core.addMethod(
- $core.method({
- selector: "random",
- protocol: 'random',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.klass)});
- },
- args: [],
- 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);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String.klass);
- $core.addMethod(
- $core.method({
- selector: "randomNotIn:",
- protocol: 'random',
- fn: function (aString){
- var self=this;
- var result;
- return $core.withContext(function($ctx1) {
- var $1;
- $recv((function(){
- return $core.withContext(function($ctx2) {
- result=self._random();
- result;
- return $recv(aString)._includesSubString_(result);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._whileTrue();
- $1=result;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.klass)});
- },
- args: ["aString"],
- source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
- referencedClasses: [],
- messageSends: ["whileTrue", "random", "includesSubString:"]
- }),
- $globals.String.klass);
- $core.addMethod(
- $core.method({
- selector: "space",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return ' ';
- return self;
- }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.klass)});
- },
- args: [],
- source: "space\x0a\x09<return ' '>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String.klass);
- $core.addMethod(
- $core.method({
- selector: "streamClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $StringStream(){return $globals.StringStream||(typeof StringStream=="undefined"?nil:StringStream)}
- return $StringStream();
- },
- args: [],
- source: "streamClass\x0a\x09\x09^ StringStream",
- referencedClasses: ["StringStream"],
- messageSends: []
- }),
- $globals.String.klass);
- $core.addMethod(
- $core.method({
- selector: "tab",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return '\t';
- return self;
- }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.klass)});
- },
- args: [],
- source: "tab\x0a\x09<return '\x5ct'>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String.klass);
- $core.addMethod(
- $core.method({
- selector: "value:",
- protocol: 'instance creation',
- fn: function (aUTFCharCode){
- var self=this;
- return $core.withContext(function($ctx1) {
- return String.fromCharCode(aUTFCharCode);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.klass)});
- },
- args: ["aUTFCharCode"],
- source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String.klass);
- $core.addClass('Set', $globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections');
- $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`.";
- $core.addMethod(
- $core.method({
- selector: "=",
- protocol: 'comparing',
- fn: function (aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$4,$3,$5;
- var $early={};
- try {
- $2=self._class();
- $ctx1.sendIdx["class"]=1;
- $1=$recv($2).__eq($recv(aCollection)._class());
- $ctx1.sendIdx["="]=1;
- if(!$core.assert($1)){
- return false;
- };
- $4=self._size();
- $ctx1.sendIdx["size"]=1;
- $3=$recv($4).__eq($recv(aCollection)._size());
- if(!$core.assert($3)){
- return false;
- };
- self._do_((function(each){
- return $core.withContext(function($ctx2) {
- $5=$recv(aCollection)._includes_(each);
- if(!$core.assert($5)){
- throw $early=[false];
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
- }));
- return true;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
- },
- args: ["aCollection"],
- 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",
- referencedClasses: [],
- messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
- }),
- $globals.Set);
- $core.addMethod(
- $core.method({
- selector: "add:",
- protocol: 'adding/removing',
- fn: function (anObject){
- var self=this;
- var bucket;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- bucket=self._bucketsOfElement_(anObject);
- $2=$recv(bucket)._second();
- if(($receiver = $2) == null || $receiver.isNil){
- var object,slowBucket;
- object=$recv(bucket)._first();
- $ctx1.sendIdx["first"]=1;
- object;
- slowBucket=$recv(bucket)._third();
- slowBucket;
- $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
- return $core.withContext(function($ctx2) {
- $recv(slowBucket)._add_(object);
- self["@size"]=$recv(self["@size"]).__plus((1));
- return self["@size"];
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- $1=object;
- } else {
- var primitiveBucket;
- primitiveBucket=$receiver;
- $1=self._add_in_($recv(bucket)._first(),primitiveBucket);
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
- },
- args: ["anObject"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
- }),
- $globals.Set);
- $core.addMethod(
- $core.method({
- selector: "add:in:",
- protocol: 'private',
- fn: function (anObject,anotherObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- if (anObject in anotherObject.store) { return false; }
- self['@size']++;
- anotherObject.store[anObject] = true;
- return anObject;
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
- },
- args: ["anObject", "anotherObject"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Set);
- $core.addMethod(
- $core.method({
- selector: "bucketsOfElement:",
- protocol: 'private',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();
- if ((type = typeof prim) === "object") {
- if (anObject !== nil) {
- bucket = null;
- self['@slowBucketStores'].some(function (store) {
- return bucket = store._bucketOfElement_(anObject);
- });
- return [ anObject, null, bucket || self['@defaultBucket'] ];
- }
-
- // include nil to well-known objects under 'boolean' fastBucket
- prim = null;
- type = 'boolean';
- }
- return [ prim, self['@fastBuckets'][type] ];
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
- },
- args: ["anObject"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Set);
- $core.addMethod(
- $core.method({
- selector: "classNameOf:",
- protocol: 'private',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- return anObject.klass != null && anObject.klass.className;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
- },
- args: ["anObject"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Set);
- $core.addMethod(
- $core.method({
- selector: "collect:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- var collection;
- return $core.withContext(function($ctx1) {
- var $1;
- collection=$recv(self._class())._new();
- self._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(collection)._add_($recv(aBlock)._value_(each));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $1=collection;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
- },
- args: ["aBlock"],
- source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
- referencedClasses: [],
- messageSends: ["new", "class", "do:", "add:", "value:"]
- }),
- $globals.Set);
- $core.addMethod(
- $core.method({
- selector: "detect:ifNone:",
- protocol: 'enumerating',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- var $early={};
- try {
- self._do_((function(each){
- return $core.withContext(function($ctx2) {
- $1=$recv(aBlock)._value_(each);
- if($core.assert($1)){
- throw $early=[each];
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $2=$recv(anotherBlock)._value();
- return $2;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
- },
- args: ["aBlock", "anotherBlock"],
- source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
- referencedClasses: [],
- messageSends: ["do:", "ifTrue:", "value:", "value"]
- }),
- $globals.Set);
- $core.addMethod(
- $core.method({
- selector: "do:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var el, keys, i;
- el = self['@fastBuckets'];
- keys = Object.keys(el);
- for (i = 0; i < keys.length; ++i) {
- var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
- if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
- else { store._do_(aBlock); }
- }
- el = self['@slowBucketStores'];
- for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
- self['@defaultBucket']._do_(aBlock);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
- },
- args: ["aBlock"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Set);
- $core.addMethod(
- $core.method({
- selector: "includes:",
- protocol: 'testing',
- fn: function (anObject){
- var self=this;
- var bucket;
- return $core.withContext(function($ctx1) {
- var $2,$3,$4,$1,$receiver;
- bucket=self._bucketsOfElement_(anObject);
- $2=$recv(bucket)._second();
- if(($receiver = $2) == null || $receiver.isNil){
- $3=$recv(bucket)._third();
- $4=$recv(bucket)._first();
- $ctx1.sendIdx["first"]=1;
- $1=$recv($3)._includes_($4);
- } else {
- var primitiveBucket;
- primitiveBucket=$receiver;
- $1=self._includes_in_($recv(bucket)._first(),primitiveBucket);
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
- },
- args: ["anObject"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
- }),
- $globals.Set);
- $core.addMethod(
- $core.method({
- selector: "includes:in:",
- protocol: 'private',
- fn: function (anObject,anotherObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- return anObject in anotherObject.store;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
- },
- args: ["anObject", "anotherObject"],
- source: "includes: anObject in: anotherObject\x0a\x09<return anObject in anotherObject.store>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Set);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- (
- $ctx1.supercall = true,
- $globals.Set.superclass.fn.prototype._initialize.apply($recv(self), []));
- $ctx1.supercall = false;
- self["@defaultBucket"]=[];
- self._initializeSlowBucketStores();
- $1=self._removeAll();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
- },
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
- referencedClasses: [],
- messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
- }),
- $globals.Set);
- $core.addMethod(
- $core.method({
- selector: "initializeSlowBucketStores",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- function $ArrayBucketStore(){return $globals.ArrayBucketStore||(typeof ArrayBucketStore=="undefined"?nil:ArrayBucketStore)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($ArrayBucketStore())._hashBlock_((function(x){
- return $core.withContext(function($ctx2) {
- return self._classNameOf_(x);
- }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
- }));
- $ctx1.sendIdx["hashBlock:"]=1;
- self["@slowBucketStores"]=[$1,$recv($ArrayBucketStore())._hashBlock_((function(x){
- return $core.withContext(function($ctx2) {
- return self._jsConstructorNameOf_(x);
- }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
- }))];
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
- },
- args: [],
- source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
- referencedClasses: ["ArrayBucketStore"],
- messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
- }),
- $globals.Set);
- $core.addMethod(
- $core.method({
- selector: "jsConstructorNameOf:",
- protocol: 'private',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- return anObject.constructor && anObject.constructor.name;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
- },
- args: ["anObject"],
- source: "jsConstructorNameOf: anObject\x0a\x09<return anObject.constructor && anObject.constructor.name>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Set);
- $core.addMethod(
- $core.method({
- selector: "printOn:",
- protocol: 'printing',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.Set.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
- $ctx1.supercall = false;
- $ctx1.sendIdx["printOn:"]=1;
- $recv(aStream)._nextPutAll_(" (");
- $ctx1.sendIdx["nextPutAll:"]=1;
- self._do_separatedBy_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._printOn_(aStream);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- return $recv(aStream)._nextPutAll_(" ");
- $ctx2.sendIdx["nextPutAll:"]=2;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- $recv(aStream)._nextPutAll_(")");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
- },
- args: ["aStream"],
- 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: ')'",
- referencedClasses: [],
- messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
- }),
- $globals.Set);
- $core.addMethod(
- $core.method({
- selector: "remove:ifAbsent:",
- protocol: 'adding/removing',
- fn: function (anObject,aBlock){
- var self=this;
- var bucket;
- return $core.withContext(function($ctx1) {
- var $2,$3,$4,$5,$1,$receiver;
- var $early={};
- try {
- bucket=self._bucketsOfElement_(anObject);
- $2=$recv(bucket)._second();
- if(($receiver = $2) == null || $receiver.isNil){
- $3=$recv(bucket)._third();
- $4=$recv(bucket)._first();
- $ctx1.sendIdx["first"]=1;
- $recv($3)._remove_ifAbsent_($4,(function(){
- return $core.withContext(function($ctx2) {
- $5=$recv(aBlock)._value();
- throw $early=[$5];
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- self["@size"]=$recv(self["@size"]).__minus((1));
- $1=self["@size"];
- } else {
- var primitiveBucket;
- primitiveBucket=$receiver;
- $1=self._remove_in_($recv(bucket)._first(),primitiveBucket);
- };
- return $1;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
- },
- args: ["anObject", "aBlock"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
- }),
- $globals.Set);
- $core.addMethod(
- $core.method({
- selector: "remove:in:",
- protocol: 'private',
- fn: function (anObject,anotherObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- if (delete anotherObject.store[anObject]) self['@size']--;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
- },
- args: ["anObject", "anotherObject"],
- source: "remove: anObject in: anotherObject\x0a\x09<if (delete anotherObject.store[anObject]) self['@size']-->",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Set);
- $core.addMethod(
- $core.method({
- selector: "removeAll",
- protocol: 'adding/removing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self['@fastBuckets'] = {
- 'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },
- 'number': { store: Object.create(null), fn: Number },
- 'string': { store: Object.create(null) }
- };
- self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
- self['@defaultBucket']._removeAll();
- self['@size'] = 0;
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
- },
- args: [],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Set);
- $core.addMethod(
- $core.method({
- selector: "select:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- var collection;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- collection=$recv(self._class())._new();
- self._do_((function(each){
- return $core.withContext(function($ctx2) {
- $1=$recv(aBlock)._value_(each);
- if($core.assert($1)){
- return $recv(collection)._add_(each);
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $2=collection;
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
- },
- args: ["aBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
- }),
- $globals.Set);
- $core.addMethod(
- $core.method({
- selector: "size",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@size"];
- return $1;
- },
- args: [],
- source: "size\x0a\x09^ size",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Set);
- $core.addClass('ProtoStream', $globals.Object, [], 'Kernel-Collections');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "<<",
- protocol: 'writing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._write_(anObject);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
- },
- args: ["anObject"],
- source: "<< anObject\x0a\x09self write: anObject",
- referencedClasses: [],
- messageSends: ["write:"]
- }),
- $globals.ProtoStream);
- $core.addMethod(
- $core.method({
- selector: "atEnd",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
- },
- args: [],
- source: "atEnd\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.ProtoStream);
- $core.addMethod(
- $core.method({
- selector: "atStart",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
- },
- args: [],
- source: "atStart\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.ProtoStream);
- $core.addMethod(
- $core.method({
- selector: "contents",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
- },
- args: [],
- source: "contents\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.ProtoStream);
- $core.addMethod(
- $core.method({
- selector: "do:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return self._atEnd();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._whileFalse_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(aBlock)._value_(self._next());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
- },
- args: ["aBlock"],
- source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
- referencedClasses: [],
- messageSends: ["whileFalse:", "atEnd", "value:", "next"]
- }),
- $globals.ProtoStream);
- $core.addMethod(
- $core.method({
- selector: "isEmpty",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._atStart())._and_((function(){
- return $core.withContext(function($ctx2) {
- return self._atEnd();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
- },
- args: [],
- source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
- referencedClasses: [],
- messageSends: ["and:", "atStart", "atEnd"]
- }),
- $globals.ProtoStream);
- $core.addMethod(
- $core.method({
- selector: "next",
- protocol: 'reading',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=self._atEnd();
- if($core.assert($2)){
- $1=nil;
- } else {
- $1=self._subclassResponsibility();
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
- },
- args: [],
- source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
- }),
- $globals.ProtoStream);
- $core.addMethod(
- $core.method({
- selector: "nextPut:",
- protocol: 'writing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
- },
- args: ["anObject"],
- source: "nextPut: anObject\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.ProtoStream);
- $core.addMethod(
- $core.method({
- selector: "nextPutAll:",
- protocol: 'writing',
- fn: function (aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aCollection)._do_((function(each){
- return $core.withContext(function($ctx2) {
- return self._nextPut_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
- },
- args: ["aCollection"],
- source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
- referencedClasses: [],
- messageSends: ["do:", "nextPut:"]
- }),
- $globals.ProtoStream);
- $core.addMethod(
- $core.method({
- selector: "nextPutJSObject:",
- protocol: 'writing',
- fn: function (aJSObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._nextPut_(aJSObject);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
- },
- args: ["aJSObject"],
- source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
- referencedClasses: [],
- messageSends: ["nextPut:"]
- }),
- $globals.ProtoStream);
- $core.addMethod(
- $core.method({
- selector: "nextPutString:",
- protocol: 'writing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._nextPut_(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
- },
- args: ["aString"],
- source: "nextPutString: aString\x0a\x09self nextPut: aString",
- referencedClasses: [],
- messageSends: ["nextPut:"]
- }),
- $globals.ProtoStream);
- $core.addMethod(
- $core.method({
- selector: "peek",
- protocol: 'reading',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=self._atEnd();
- if($core.assert($2)){
- $1=nil;
- } else {
- $1=self._subclassResponsibility();
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
- },
- args: [],
- source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
- }),
- $globals.ProtoStream);
- $core.addMethod(
- $core.method({
- selector: "reset",
- protocol: 'actions',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
- },
- args: [],
- source: "reset\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.ProtoStream);
- $core.addMethod(
- $core.method({
- selector: "resetContents",
- protocol: 'actions',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
- },
- args: [],
- source: "resetContents\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.ProtoStream);
- $core.addMethod(
- $core.method({
- selector: "setToEnd",
- protocol: 'positioning',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
- },
- args: [],
- source: "setToEnd\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.ProtoStream);
- $core.addMethod(
- $core.method({
- selector: "setToStart",
- protocol: 'positioning',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._reset();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
- },
- args: [],
- source: "setToStart\x0a\x09self reset",
- referencedClasses: [],
- messageSends: ["reset"]
- }),
- $globals.ProtoStream);
- $core.addMethod(
- $core.method({
- selector: "write:",
- protocol: 'writing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(anObject)._putOn_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
- },
- args: ["anObject"],
- source: "write: anObject\x0a\x09anObject putOn: self",
- referencedClasses: [],
- messageSends: ["putOn:"]
- }),
- $globals.ProtoStream);
- $core.addMethod(
- $core.method({
- selector: "on:",
- protocol: 'instance creation',
- fn: function (aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- $recv($2)._setCollection_(aCollection);
- $recv($2)._setStreamSize_($recv(aCollection)._size());
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.klass)});
- },
- args: ["aCollection"],
- source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
- }),
- $globals.ProtoStream.klass);
- $core.addClass('Stream', $globals.ProtoStream, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "atEnd",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._position()).__eq(self._size());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
- },
- args: [],
- source: "atEnd\x0a\x09^ self position = self size",
- referencedClasses: [],
- messageSends: ["=", "position", "size"]
- }),
- $globals.Stream);
- $core.addMethod(
- $core.method({
- selector: "atStart",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._position()).__eq((0));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
- },
- args: [],
- source: "atStart\x0a\x09^ self position = 0",
- referencedClasses: [],
- messageSends: ["=", "position"]
- }),
- $globals.Stream);
- $core.addMethod(
- $core.method({
- selector: "close",
- protocol: 'actions',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "close",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Stream);
- $core.addMethod(
- $core.method({
- selector: "collection",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@collection"];
- return $1;
- },
- args: [],
- source: "collection\x0a\x09^ collection",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Stream);
- $core.addMethod(
- $core.method({
- selector: "contents",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._collection())._copyFrom_to_((1),self._streamSize());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
- },
- args: [],
- source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
- referencedClasses: [],
- messageSends: ["copyFrom:to:", "collection", "streamSize"]
- }),
- $globals.Stream);
- $core.addMethod(
- $core.method({
- selector: "flush",
- protocol: 'actions',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "flush",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Stream);
- $core.addMethod(
- $core.method({
- selector: "isEmpty",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._size()).__eq((0));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
- },
- args: [],
- source: "isEmpty\x0a\x09^ self size = 0",
- referencedClasses: [],
- messageSends: ["=", "size"]
- }),
- $globals.Stream);
- $core.addMethod(
- $core.method({
- selector: "next",
- protocol: 'reading',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$4,$3,$1;
- $2=self._atEnd();
- if($core.assert($2)){
- $1=nil;
- } else {
- $4=self._position();
- $ctx1.sendIdx["position"]=1;
- $3=$recv($4).__plus((1));
- self._position_($3);
- $1=$recv(self["@collection"])._at_(self._position());
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
- },
- args: [],
- 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 ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
- }),
- $globals.Stream);
- $core.addMethod(
- $core.method({
- selector: "next:",
- protocol: 'reading',
- fn: function (anInteger){
- var self=this;
- var tempCollection;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- tempCollection=$recv($recv(self._collection())._class())._new();
- $recv(anInteger)._timesRepeat_((function(){
- return $core.withContext(function($ctx2) {
- $1=self._atEnd();
- if(!$core.assert($1)){
- return $recv(tempCollection)._add_(self._next());
- };
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $2=tempCollection;
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
- },
- args: ["anInteger"],
- 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",
- referencedClasses: [],
- messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
- }),
- $globals.Stream);
- $core.addMethod(
- $core.method({
- selector: "nextPut:",
- protocol: 'writing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$3,$4;
- $2=self._position();
- $ctx1.sendIdx["position"]=1;
- $1=$recv($2).__plus((1));
- self._position_($1);
- $3=self._collection();
- $4=self._position();
- $ctx1.sendIdx["position"]=2;
- $recv($3)._at_put_($4,anObject);
- self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
- },
- args: ["anObject"],
- 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)",
- referencedClasses: [],
- messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
- }),
- $globals.Stream);
- $core.addMethod(
- $core.method({
- selector: "peek",
- protocol: 'reading',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=self._atEnd();
- if(!$core.assert($2)){
- $1=$recv(self._collection())._at_($recv(self._position()).__plus((1)));
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
- },
- args: [],
- source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
- referencedClasses: [],
- messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
- }),
- $globals.Stream);
- $core.addMethod(
- $core.method({
- selector: "position",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@position"];
- if(($receiver = $2) == null || $receiver.isNil){
- self["@position"]=(0);
- $1=self["@position"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
- },
- args: [],
- source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
- referencedClasses: [],
- messageSends: ["ifNil:"]
- }),
- $globals.Stream);
- $core.addMethod(
- $core.method({
- selector: "position:",
- protocol: 'accessing',
- fn: function (anInteger){
- var self=this;
- self["@position"]=anInteger;
- return self;
- },
- args: ["anInteger"],
- source: "position: anInteger\x0a\x09position := anInteger",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Stream);
- $core.addMethod(
- $core.method({
- selector: "reset",
- protocol: 'actions',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._position_((0));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
- },
- args: [],
- source: "reset\x0a\x09self position: 0",
- referencedClasses: [],
- messageSends: ["position:"]
- }),
- $globals.Stream);
- $core.addMethod(
- $core.method({
- selector: "resetContents",
- protocol: 'actions',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._reset();
- self._setStreamSize_((0));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
- },
- args: [],
- source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
- referencedClasses: [],
- messageSends: ["reset", "setStreamSize:"]
- }),
- $globals.Stream);
- $core.addMethod(
- $core.method({
- selector: "setCollection:",
- protocol: 'accessing',
- fn: function (aCollection){
- var self=this;
- self["@collection"]=aCollection;
- return self;
- },
- args: ["aCollection"],
- source: "setCollection: aCollection\x0a\x09collection := aCollection",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Stream);
- $core.addMethod(
- $core.method({
- selector: "setStreamSize:",
- protocol: 'accessing',
- fn: function (anInteger){
- var self=this;
- self["@streamSize"]=anInteger;
- return self;
- },
- args: ["anInteger"],
- source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Stream);
- $core.addMethod(
- $core.method({
- selector: "setToEnd",
- protocol: 'positioning',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._position_(self._size());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
- },
- args: [],
- source: "setToEnd\x0a\x09self position: self size",
- referencedClasses: [],
- messageSends: ["position:", "size"]
- }),
- $globals.Stream);
- $core.addMethod(
- $core.method({
- selector: "size",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._streamSize();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
- },
- args: [],
- source: "size\x0a\x09^ self streamSize",
- referencedClasses: [],
- messageSends: ["streamSize"]
- }),
- $globals.Stream);
- $core.addMethod(
- $core.method({
- selector: "skip:",
- protocol: 'positioning',
- fn: function (anInteger){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._position_($recv($recv(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
- },
- args: ["anInteger"],
- source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
- referencedClasses: [],
- messageSends: ["position:", "min:max:", "+", "position", "size"]
- }),
- $globals.Stream);
- $core.addMethod(
- $core.method({
- selector: "streamSize",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@streamSize"];
- return $1;
- },
- args: [],
- source: "streamSize\x0a\x09^ streamSize",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Stream);
- $core.addMethod(
- $core.method({
- selector: "on:",
- protocol: 'instance creation',
- fn: function (aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- $recv($2)._setCollection_(aCollection);
- $recv($2)._setStreamSize_($recv(aCollection)._size());
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.klass)});
- },
- args: ["aCollection"],
- source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
- }),
- $globals.Stream.klass);
- $core.addClass('StringStream', $globals.Stream, [], 'Kernel-Collections');
- $globals.StringStream.comment="I am a Stream specific to `String` objects.";
- $core.addMethod(
- $core.method({
- selector: "cr",
- protocol: 'writing',
- fn: function (){
- var self=this;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._nextPutAll_($recv($String())._cr());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
- },
- args: [],
- source: "cr\x0a\x09^ self nextPutAll: String cr",
- referencedClasses: ["String"],
- messageSends: ["nextPutAll:", "cr"]
- }),
- $globals.StringStream);
- $core.addMethod(
- $core.method({
- selector: "crlf",
- protocol: 'writing',
- fn: function (){
- var self=this;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._nextPutAll_($recv($String())._crlf());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
- },
- args: [],
- source: "crlf\x0a\x09^ self nextPutAll: String crlf",
- referencedClasses: ["String"],
- messageSends: ["nextPutAll:", "crlf"]
- }),
- $globals.StringStream);
- $core.addMethod(
- $core.method({
- selector: "lf",
- protocol: 'writing',
- fn: function (){
- var self=this;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._nextPutAll_($recv($String())._lf());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
- },
- args: [],
- source: "lf\x0a\x09^ self nextPutAll: String lf",
- referencedClasses: ["String"],
- messageSends: ["nextPutAll:", "lf"]
- }),
- $globals.StringStream);
- $core.addMethod(
- $core.method({
- selector: "next:",
- protocol: 'reading',
- fn: function (anInteger){
- var self=this;
- var tempCollection;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- tempCollection=$recv($recv(self._collection())._class())._new();
- $recv(anInteger)._timesRepeat_((function(){
- return $core.withContext(function($ctx2) {
- $1=self._atEnd();
- if(!$core.assert($1)){
- tempCollection=$recv(tempCollection).__comma(self._next());
- return tempCollection;
- };
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $2=tempCollection;
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
- },
- args: ["anInteger"],
- 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",
- referencedClasses: [],
- messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
- }),
- $globals.StringStream);
- $core.addMethod(
- $core.method({
- selector: "nextPut:",
- protocol: 'writing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._nextPutAll_(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
- },
- args: ["aString"],
- source: "nextPut: aString\x0a\x09self nextPutAll: aString",
- referencedClasses: [],
- messageSends: ["nextPutAll:"]
- }),
- $globals.StringStream);
- $core.addMethod(
- $core.method({
- selector: "nextPutAll:",
- protocol: 'writing',
- fn: function (aString){
- var self=this;
- var pre,post;
- return $core.withContext(function($ctx1) {
- var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
- $1=self._atEnd();
- if($core.assert($1)){
- $3=self._collection();
- $ctx1.sendIdx["collection"]=1;
- $2=$recv($3).__comma(aString);
- $ctx1.sendIdx[","]=1;
- self._setCollection_($2);
- $ctx1.sendIdx["setCollection:"]=1;
- } else {
- $4=self._collection();
- $ctx1.sendIdx["collection"]=2;
- $5=self._position();
- $ctx1.sendIdx["position"]=1;
- pre=$recv($4)._copyFrom_to_((1),$5);
- $ctx1.sendIdx["copyFrom:to:"]=1;
- pre;
- $6=self._collection();
- $ctx1.sendIdx["collection"]=3;
- $9=self._position();
- $ctx1.sendIdx["position"]=2;
- $8=$recv($9).__plus((1));
- $ctx1.sendIdx["+"]=2;
- $10=$recv(aString)._size();
- $ctx1.sendIdx["size"]=1;
- $7=$recv($8).__plus($10);
- $ctx1.sendIdx["+"]=1;
- $11=$recv(self._collection())._size();
- $ctx1.sendIdx["size"]=2;
- post=$recv($6)._copyFrom_to_($7,$11);
- post;
- $12=$recv($recv(pre).__comma(aString)).__comma(post);
- $ctx1.sendIdx[","]=2;
- self._setCollection_($12);
- };
- $14=self._position();
- $ctx1.sendIdx["position"]=3;
- $13=$recv($14).__plus($recv(aString)._size());
- self._position_($13);
- self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
- },
- args: ["aString"],
- 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)",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
- }),
- $globals.StringStream);
- $core.addMethod(
- $core.method({
- selector: "nextPutString:",
- protocol: 'writing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._nextPutAll_(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
- },
- args: ["aString"],
- source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
- referencedClasses: [],
- messageSends: ["nextPutAll:"]
- }),
- $globals.StringStream);
- $core.addMethod(
- $core.method({
- selector: "space",
- protocol: 'writing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._nextPut_(" ");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
- },
- args: [],
- source: "space\x0a\x09self nextPut: ' '",
- referencedClasses: [],
- messageSends: ["nextPut:"]
- }),
- $globals.StringStream);
- $core.addMethod(
- $core.method({
- selector: "tab",
- protocol: 'writing',
- fn: function (){
- var self=this;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._nextPutAll_($recv($String())._tab());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
- },
- args: [],
- source: "tab\x0a\x09^ self nextPutAll: String tab",
- referencedClasses: ["String"],
- messageSends: ["nextPutAll:", "tab"]
- }),
- $globals.StringStream);
- $core.addClass('Queue', $globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.Queue.superclass.fn.prototype._initialize.apply($recv(self), []));
- $ctx1.supercall = false;
- self["@read"]=$recv($OrderedCollection())._new();
- $ctx1.sendIdx["new"]=1;
- self["@write"]=$recv($OrderedCollection())._new();
- self["@readIndex"]=(1);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
- },
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
- referencedClasses: ["OrderedCollection"],
- messageSends: ["initialize", "new"]
- }),
- $globals.Queue);
- $core.addMethod(
- $core.method({
- selector: "next",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._nextIfAbsent_((function(){
- return $core.withContext(function($ctx2) {
- return self._error_("Cannot read from empty Queue.");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
- },
- args: [],
- source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
- referencedClasses: [],
- messageSends: ["nextIfAbsent:", "error:"]
- }),
- $globals.Queue);
- $core.addMethod(
- $core.method({
- selector: "nextIfAbsent:",
- protocol: 'accessing',
- fn: function (aBlock){
- var self=this;
- var result;
- function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- var $early={};
- try {
- result=$recv(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
- return $core.withContext(function($ctx2) {
- $1=$recv(self["@write"])._isEmpty();
- if($core.assert($1)){
- $2=$recv(self["@readIndex"]).__gt((1));
- if($core.assert($2)){
- self["@read"]=[];
- self["@read"];
- self["@readIndex"]=(1);
- self["@readIndex"];
- };
- $3=$recv(aBlock)._value();
- throw $early=[$3];
- };
- self["@read"]=self["@write"];
- self["@read"];
- self["@readIndex"]=(1);
- self["@readIndex"];
- self["@write"]=$recv($OrderedCollection())._new();
- self["@write"];
- return $recv(self["@read"])._first();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $recv(self["@read"])._at_put_(self["@readIndex"],nil);
- self["@readIndex"]=$recv(self["@readIndex"]).__plus((1));
- $4=result;
- return $4;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
- },
- args: ["aBlock"],
- 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",
- referencedClasses: ["OrderedCollection"],
- messageSends: ["at:ifAbsent:", "ifTrue:", "isEmpty", ">", "value", "new", "first", "at:put:", "+"]
- }),
- $globals.Queue);
- $core.addMethod(
- $core.method({
- selector: "nextPut:",
- protocol: 'accessing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self["@write"])._add_(anObject);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
- },
- args: ["anObject"],
- source: "nextPut: anObject\x0a\x09write add: anObject",
- referencedClasses: [],
- messageSends: ["add:"]
- }),
- $globals.Queue);
- $core.addClass('RegularExpression', $globals.Object, [], 'Kernel-Collections');
- $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
- $core.addMethod(
- $core.method({
- selector: "compile:",
- protocol: 'evaluating',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.compile(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
- },
- args: ["aString"],
- source: "compile: aString\x0a\x09<return self.compile(aString)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.RegularExpression);
- $core.addMethod(
- $core.method({
- selector: "exec:",
- protocol: 'evaluating',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.exec(aString) || nil;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
- },
- args: ["aString"],
- source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.RegularExpression);
- $core.addMethod(
- $core.method({
- selector: "test:",
- protocol: 'evaluating',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.test(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
- },
- args: ["aString"],
- source: "test: aString\x0a\x09<return self.test(aString)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.RegularExpression);
- $core.addMethod(
- $core.method({
- selector: "fromString:",
- protocol: 'instance creation',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._fromString_flag_(aString,"");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.klass)});
- },
- args: ["aString"],
- source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
- referencedClasses: [],
- messageSends: ["fromString:flag:"]
- }),
- $globals.RegularExpression.klass);
- $core.addMethod(
- $core.method({
- selector: "fromString:flag:",
- protocol: 'instance creation',
- fn: function (aString,anotherString){
- var self=this;
- return $core.withContext(function($ctx1) {
- return new RegExp(aString, anotherString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.klass)});
- },
- args: ["aString", "anotherString"],
- source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.RegularExpression.klass);
- });
- define("amber_core/Kernel-Exceptions", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
- var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
- $core.addPackage('Kernel-Exceptions');
- $core.packages["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
- $core.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
- $core.addClass('Error', $globals.Object, ['messageText'], 'Kernel-Exceptions');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "beHandled",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self.amberHandled = true;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
- },
- args: [],
- source: "beHandled\x0a\x09<self.amberHandled = true>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "beUnhandled",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self.amberHandled = false;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
- },
- args: [],
- source: "beUnhandled\x0a\x09<self.amberHandled = false>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "context",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.context;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
- },
- args: [],
- source: "context\x0a\x09<return self.context>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._messageText_("Errorclass: ".__comma($recv(self._class())._name()));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
- },
- args: [],
- source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
- referencedClasses: [],
- messageSends: ["messageText:", ",", "name", "class"]
- }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "isSmalltalkError",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.smalltalkError === true;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
- },
- args: [],
- source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "jsStack",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.stack;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
- },
- args: [],
- source: "jsStack\x0a\x09<return self.stack>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "messageText",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@messageText"];
- return $1;
- },
- args: [],
- source: "messageText\x0a\x09^ messageText",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "messageText:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@messageText"]=aString;
- return self;
- },
- args: ["aString"],
- source: "messageText: aString\x0a\x09messageText := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "resignal",
- protocol: 'signaling',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self.amberHandled = false;
- throw(self);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
- },
- args: [],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "signal",
- protocol: 'signaling',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self.amberHandled = false;
- self.context = $core.getThisContext();
- self.smalltalkError = true;
- throw self;
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
- },
- args: [],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "signal:",
- protocol: 'signaling',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._messageText_(aString);
- self._signal();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
- },
- args: ["aString"],
- source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
- referencedClasses: [],
- messageSends: ["messageText:", "signal"]
- }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "signalerContext",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._signalerContextFrom_(self._context());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
- },
- args: [],
- source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
- referencedClasses: [],
- messageSends: ["signalerContextFrom:", "context"]
- }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "signalerContextFrom:",
- protocol: 'accessing',
- fn: function (aContext){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $4,$3,$2,$1;
- $1=$recv(aContext)._findContextSuchThat_((function(context){
- return $core.withContext(function($ctx2) {
- $4=$recv(context)._receiver();
- $ctx2.sendIdx["receiver"]=1;
- $3=$recv($4).__eq_eq(self);
- $ctx2.sendIdx["=="]=1;
- $2=$recv($3)._or_((function(){
- return $core.withContext(function($ctx3) {
- return $recv($recv(context)._receiver()).__eq_eq(self._class());
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }));
- return $recv($2)._not();
- }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
- },
- args: ["aContext"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
- }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "wasHandled",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.amberHandled || false;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
- },
- args: [],
- source: "wasHandled\x0a\x09<return self.amberHandled || false>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Error);
- $core.addMethod(
- $core.method({
- selector: "classTag",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return "exception";
- },
- args: [],
- 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'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Error.klass);
- $core.addMethod(
- $core.method({
- selector: "signal",
- protocol: 'instance creation',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._new())._signal();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.klass)});
- },
- args: [],
- source: "signal\x0a\x09^ self new signal",
- referencedClasses: [],
- messageSends: ["signal", "new"]
- }),
- $globals.Error.klass);
- $core.addMethod(
- $core.method({
- selector: "signal:",
- protocol: 'instance creation',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._new())._signal_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.klass)});
- },
- args: ["aString"],
- source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
- referencedClasses: [],
- messageSends: ["signal:", "new"]
- }),
- $globals.Error.klass);
- $core.addClass('Halt', $globals.Error, [], 'Kernel-Exceptions');
- $globals.Halt.comment="I am provided to support `Object>>#halt`.";
- $core.addMethod(
- $core.method({
- selector: "messageText",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return "Halt encountered";
- },
- args: [],
- source: "messageText\x0a\x09^ 'Halt encountered'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Halt);
- $core.addMethod(
- $core.method({
- selector: "signalerContextFrom:",
- protocol: 'accessing',
- fn: function (aContext){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $4,$3,$2,$1;
- $1=$recv(aContext)._findContextSuchThat_((function(context){
- return $core.withContext(function($ctx2) {
- $4=$recv(context)._receiver();
- $ctx2.sendIdx["receiver"]=1;
- $3=$recv($4).__eq_eq(self);
- $ctx2.sendIdx["=="]=1;
- $2=$recv($3)._or_((function(){
- return $core.withContext(function($ctx3) {
- return $recv($recv($recv(context)._receiver()).__eq_eq(self._class()))._or_((function(){
- return $core.withContext(function($ctx4) {
- return $recv($recv($recv(context)._method())._selector()).__eq("halt");
- }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
- }));
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }));
- $ctx2.sendIdx["or:"]=1;
- return $recv($2)._not();
- }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
- },
- args: ["aContext"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
- }),
- $globals.Halt);
- $core.addClass('JavaScriptException', $globals.Error, ['exception'], 'Kernel-Exceptions');
- $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:`";
- $core.addMethod(
- $core.method({
- selector: "context:",
- protocol: 'accessing',
- fn: function (aMethodContext){
- var self=this;
- return $core.withContext(function($ctx1) {
- self.context = aMethodContext;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
- },
- args: ["aMethodContext"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JavaScriptException);
- $core.addMethod(
- $core.method({
- selector: "exception",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@exception"];
- return $1;
- },
- args: [],
- source: "exception\x0a\x09^ exception",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JavaScriptException);
- $core.addMethod(
- $core.method({
- selector: "exception:",
- protocol: 'accessing',
- fn: function (anException){
- var self=this;
- self["@exception"]=anException;
- return self;
- },
- args: ["anException"],
- source: "exception: anException\x0a\x09exception := anException",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JavaScriptException);
- $core.addMethod(
- $core.method({
- selector: "messageText",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return 'JavaScript exception: ' + self["@exception"].toString();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
- },
- args: [],
- source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JavaScriptException);
- $core.addMethod(
- $core.method({
- selector: "on:",
- protocol: 'instance creation',
- fn: function (anException){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- $recv($2)._exception_(anException);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.klass)});
- },
- args: ["anException"],
- source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["exception:", "new", "yourself"]
- }),
- $globals.JavaScriptException.klass);
- $core.addMethod(
- $core.method({
- selector: "on:context:",
- protocol: 'instance creation',
- fn: function (anException,aMethodContext){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- $recv($2)._exception_(anException);
- $recv($2)._context_(aMethodContext);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.klass)});
- },
- args: ["anException", "aMethodContext"],
- source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["exception:", "new", "context:", "yourself"]
- }),
- $globals.JavaScriptException.klass);
- $core.addClass('MessageNotUnderstood', $globals.Error, ['message', 'receiver'], 'Kernel-Exceptions');
- $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
- $core.addMethod(
- $core.method({
- selector: "message",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@message"];
- return $1;
- },
- args: [],
- source: "message\x0a\x09^ message",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MessageNotUnderstood);
- $core.addMethod(
- $core.method({
- selector: "message:",
- protocol: 'accessing',
- fn: function (aMessage){
- var self=this;
- self["@message"]=aMessage;
- return self;
- },
- args: ["aMessage"],
- source: "message: aMessage\x0a\x09message := aMessage",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MessageNotUnderstood);
- $core.addMethod(
- $core.method({
- selector: "messageText",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv($recv(self._receiver())._asString()).__comma(" does not understand #")).__comma($recv(self._message())._selector());
- $ctx1.sendIdx[","]=1;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
- },
- args: [],
- source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
- referencedClasses: [],
- messageSends: [",", "asString", "receiver", "selector", "message"]
- }),
- $globals.MessageNotUnderstood);
- $core.addMethod(
- $core.method({
- selector: "receiver",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@receiver"];
- return $1;
- },
- args: [],
- source: "receiver\x0a\x09^ receiver",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MessageNotUnderstood);
- $core.addMethod(
- $core.method({
- selector: "receiver:",
- protocol: 'accessing',
- fn: function (anObject){
- var self=this;
- self["@receiver"]=anObject;
- return self;
- },
- args: ["anObject"],
- source: "receiver: anObject\x0a\x09receiver := anObject",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MessageNotUnderstood);
- $core.addClass('NonBooleanReceiver', $globals.Error, ['object'], 'Kernel-Exceptions');
- $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
- $core.addMethod(
- $core.method({
- selector: "object",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@object"];
- return $1;
- },
- args: [],
- source: "object\x0a\x09^ object",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NonBooleanReceiver);
- $core.addMethod(
- $core.method({
- selector: "object:",
- protocol: 'accessing',
- fn: function (anObject){
- var self=this;
- self["@object"]=anObject;
- return self;
- },
- args: ["anObject"],
- source: "object: anObject\x0a\x09object := anObject",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NonBooleanReceiver);
- });
- define("amber_core/Kernel-Infrastructure", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Collections"], function($boot){"use strict";
- var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
- $core.addPackage('Kernel-Infrastructure');
- $core.packages["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
- $core.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
- $core.addClass('JSObjectProxy', $globals.ProtoObject, ['jsObject'], 'Kernel-Infrastructure');
- $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`.";
- $core.addMethod(
- $core.method({
- selector: "=",
- protocol: 'comparing',
- fn: function (anObject){
- var self=this;
- function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$3;
- $2=$recv(anObject)._class();
- $ctx1.sendIdx["class"]=1;
- $1=$recv($2).__eq_eq(self._class());
- if(!$core.assert($1)){
- return false;
- };
- $3=$recv($JSObjectProxy())._compareJSObjectOfProxy_withProxy_(self,anObject);
- return $3;
- }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
- },
- args: ["anObject"],
- source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
- referencedClasses: ["JSObjectProxy"],
- messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
- }),
- $globals.JSObjectProxy);
- $core.addMethod(
- $core.method({
- selector: "asJSON",
- protocol: 'enumerating',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@jsObject"];
- return $1;
- },
- args: [],
- source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-friendly fashion\x22\x0a\x0a\x09^ jsObject",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JSObjectProxy);
- $core.addMethod(
- $core.method({
- selector: "at:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self['@jsObject'][aString];
- return self;
- }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
- },
- args: ["aString"],
- source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JSObjectProxy);
- $core.addMethod(
- $core.method({
- selector: "at:ifAbsent:",
- protocol: 'accessing',
- fn: function (aString,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var obj = self['@jsObject'];
- return aString in obj ? obj[aString] : aBlock._value();
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
- },
- args: ["aString", "aBlock"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JSObjectProxy);
- $core.addMethod(
- $core.method({
- selector: "at:ifPresent:",
- protocol: 'accessing',
- fn: function (aString,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var obj = self['@jsObject'];
- return aString in obj ? aBlock._value_(obj[aString]) : nil;
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
- },
- args: ["aString", "aBlock"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JSObjectProxy);
- $core.addMethod(
- $core.method({
- selector: "at:ifPresent:ifAbsent:",
- protocol: 'accessing',
- fn: function (aString,aBlock,anotherBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var obj = self['@jsObject'];
- return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
- },
- args: ["aString", "aBlock", "anotherBlock"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JSObjectProxy);
- $core.addMethod(
- $core.method({
- selector: "at:put:",
- protocol: 'accessing',
- fn: function (aString,anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self['@jsObject'][aString] = anObject;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
- },
- args: ["aString", "anObject"],
- source: "at: aString put: anObject\x0a\x09<return self['@jsObject'][aString] = anObject>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JSObjectProxy);
- $core.addMethod(
- $core.method({
- selector: "doesNotUnderstand:",
- protocol: 'proxy',
- fn: function (aMessage){
- var self=this;
- function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=$recv($JSObjectProxy())._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
- if(($receiver = $2) == null || $receiver.isNil){
- $1=(
- $ctx1.supercall = true,
- $globals.JSObjectProxy.superclass.fn.prototype._doesNotUnderstand_.apply($recv(self), [aMessage]));
- $ctx1.supercall = false;
- } else {
- var jsSelector;
- jsSelector=$receiver;
- $1=$recv($JSObjectProxy())._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
- },
- args: ["aMessage"],
- 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 ]",
- referencedClasses: ["JSObjectProxy"],
- messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
- }),
- $globals.JSObjectProxy);
- $core.addMethod(
- $core.method({
- selector: "in:",
- protocol: 'accessing',
- fn: function (aValuable){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aValuable)._value_(self["@jsObject"]);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
- },
- args: ["aValuable"],
- source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
- referencedClasses: [],
- messageSends: ["value:"]
- }),
- $globals.JSObjectProxy);
- $core.addMethod(
- $core.method({
- selector: "jsObject",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@jsObject"];
- return $1;
- },
- args: [],
- source: "jsObject\x0a\x09^ jsObject",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JSObjectProxy);
- $core.addMethod(
- $core.method({
- selector: "keysAndValuesDo:",
- protocol: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var o = self['@jsObject'];
- for(var i in o) {
- aBlock._value_value_(i, o[i]);
- }
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
- },
- args: ["aBlock"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JSObjectProxy);
- $core.addMethod(
- $core.method({
- selector: "printOn:",
- protocol: 'printing',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aStream)._nextPutAll_(self._printString());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
- },
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "printString"]
- }),
- $globals.JSObjectProxy);
- $core.addMethod(
- $core.method({
- selector: "printString",
- protocol: 'printing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var js = self['@jsObject'];
- return js.toString
- ? js.toString()
- : Object.prototype.toString.call(js)
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
- },
- args: [],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JSObjectProxy);
- $core.addMethod(
- $core.method({
- selector: "putOn:",
- protocol: 'streaming',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aStream)._nextPutJSObject_(self["@jsObject"]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
- },
- args: ["aStream"],
- source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
- referencedClasses: [],
- messageSends: ["nextPutJSObject:"]
- }),
- $globals.JSObjectProxy);
- $core.addMethod(
- $core.method({
- selector: "addObjectVariablesTo:ofProxy:",
- protocol: 'proxy',
- fn: function (aDictionary,aProxy){
- var self=this;
- return $core.withContext(function($ctx1) {
- var jsObject = aProxy['@jsObject'];
- for(var i in jsObject) {
- aDictionary._at_put_(i, jsObject[i]);
- }
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.klass)});
- },
- args: ["aDictionary", "aProxy"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JSObjectProxy.klass);
- $core.addMethod(
- $core.method({
- selector: "compareJSObjectOfProxy:withProxy:",
- protocol: 'proxy',
- fn: function (aProxy,anotherProxy){
- var self=this;
- return $core.withContext(function($ctx1) {
- var anotherJSObject = anotherProxy.klass ? anotherProxy["@jsObject"] : anotherProxy;
- return aProxy["@jsObject"] === anotherJSObject;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.klass)});
- },
- args: ["aProxy", "anotherProxy"],
- source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<\x0a\x09var anotherJSObject = anotherProxy.klass ? anotherProxy[\x22@jsObject\x22] : anotherProxy;\x0a\x09return aProxy[\x22@jsObject\x22] === anotherJSObject\x0a>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JSObjectProxy.klass);
- $core.addMethod(
- $core.method({
- selector: "forwardMessage:withArguments:ofProxy:",
- protocol: 'proxy',
- fn: function (aString,anArray,aProxy){
- var self=this;
- return $core.withContext(function($ctx1) {
- return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.klass)});
- },
- args: ["aString", "anArray", "aProxy"],
- source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JSObjectProxy.klass);
- $core.addMethod(
- $core.method({
- selector: "jsObject:ofProxy:",
- protocol: 'proxy',
- fn: function (aJSObject,aProxy){
- var self=this;
- return $core.withContext(function($ctx1) {
- aProxy['@jsObject'] = aJSObject;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.klass)});
- },
- args: ["aJSObject", "aProxy"],
- source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<aProxy['@jsObject'] = aJSObject>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JSObjectProxy.klass);
- $core.addMethod(
- $core.method({
- selector: "lookupProperty:ofProxy:",
- protocol: 'proxy',
- fn: function (aString,aProxy){
- var self=this;
- return $core.withContext(function($ctx1) {
- return aString in aProxy._jsObject() ? aString : nil;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.klass)});
- },
- args: ["aString", "aProxy"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JSObjectProxy.klass);
- $core.addMethod(
- $core.method({
- selector: "on:",
- protocol: 'instance creation',
- fn: function (aJSObject){
- var self=this;
- var instance;
- return $core.withContext(function($ctx1) {
- var $1;
- instance=self._new();
- self._jsObject_ofProxy_(aJSObject,instance);
- $1=instance;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.klass)});
- },
- args: ["aJSObject"],
- source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
- referencedClasses: [],
- messageSends: ["new", "jsObject:ofProxy:"]
- }),
- $globals.JSObjectProxy.klass);
- $core.addClass('Organizer', $globals.Object, [], 'Kernel-Infrastructure');
- $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
- $core.addMethod(
- $core.method({
- selector: "addElement:",
- protocol: 'accessing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- self.elements.addElement(anObject);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
- },
- args: ["anObject"],
- source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Organizer);
- $core.addMethod(
- $core.method({
- selector: "elements",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._basicAt_("elements"))._copy();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"elements",{},$globals.Organizer)});
- },
- args: [],
- source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
- referencedClasses: [],
- messageSends: ["copy", "basicAt:"]
- }),
- $globals.Organizer);
- $core.addMethod(
- $core.method({
- selector: "removeElement:",
- protocol: 'accessing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- self.elements.removeElement(anObject);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
- },
- args: ["anObject"],
- source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Organizer);
- $core.addClass('ClassOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
- $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
- $core.addMethod(
- $core.method({
- selector: "addElement:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- function $ProtocolAdded(){return $globals.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- (
- $ctx1.supercall = true,
- $globals.ClassOrganizer.superclass.fn.prototype._addElement_.apply($recv(self), [aString]));
- $ctx1.supercall = false;
- $1=$recv($ProtocolAdded())._new();
- $recv($1)._protocol_(aString);
- $recv($1)._theClass_(self._theClass());
- $2=$recv($1)._yourself();
- $recv($recv($SystemAnnouncer())._current())._announce_($2);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
- },
- args: ["aString"],
- 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)",
- referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
- messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
- }),
- $globals.ClassOrganizer);
- $core.addMethod(
- $core.method({
- selector: "removeElement:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- function $ProtocolRemoved(){return $globals.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- (
- $ctx1.supercall = true,
- $globals.ClassOrganizer.superclass.fn.prototype._removeElement_.apply($recv(self), [aString]));
- $ctx1.supercall = false;
- $1=$recv($ProtocolRemoved())._new();
- $recv($1)._protocol_(aString);
- $recv($1)._theClass_(self._theClass());
- $2=$recv($1)._yourself();
- $recv($recv($SystemAnnouncer())._current())._announce_($2);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
- },
- args: ["aString"],
- 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)",
- referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
- messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
- }),
- $globals.ClassOrganizer);
- $core.addMethod(
- $core.method({
- selector: "theClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.theClass ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"theClass",{},$globals.ClassOrganizer)});
- },
- args: [],
- source: "theClass\x0a\x09< return self.theClass >",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ClassOrganizer);
- $core.addClass('PackageOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
- $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
- $core.addClass('Package', $globals.Object, ['transport', 'imports', 'dirty'], 'Kernel-Infrastructure');
- $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'";
- $core.addMethod(
- $core.method({
- selector: "basicImports",
- protocol: 'private',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.imports || [];
- return self;
- }, function($ctx1) {$ctx1.fill(self,"basicImports",{},$globals.Package)});
- },
- args: [],
- 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 || []>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "basicName:",
- protocol: 'private',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- self.pkgName = aString;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"basicName:",{aString:aString},$globals.Package)});
- },
- args: ["aString"],
- source: "basicName: aString\x0a\x09<self.pkgName = aString>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "basicTransport",
- protocol: 'private',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.transport;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"basicTransport",{},$globals.Package)});
- },
- args: [],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "beClean",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- function $PackageClean(){return $globals.PackageClean||(typeof PackageClean=="undefined"?nil:PackageClean)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- self["@dirty"]=false;
- $1=$recv($PackageClean())._new();
- $recv($1)._package_(self);
- $2=$recv($1)._yourself();
- $recv($recv($SystemAnnouncer())._current())._announce_($2);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
- },
- args: [],
- source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
- referencedClasses: ["SystemAnnouncer", "PackageClean"],
- messageSends: ["announce:", "current", "package:", "new", "yourself"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "beDirty",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- function $PackageDirty(){return $globals.PackageDirty||(typeof PackageDirty=="undefined"?nil:PackageDirty)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- self["@dirty"]=true;
- $1=$recv($PackageDirty())._new();
- $recv($1)._package_(self);
- $2=$recv($1)._yourself();
- $recv($recv($SystemAnnouncer())._current())._announce_($2);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
- },
- args: [],
- source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
- referencedClasses: ["SystemAnnouncer", "PackageDirty"],
- messageSends: ["announce:", "current", "package:", "new", "yourself"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "classTemplate",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $core.withContext(function($ctx1) {
- var $3,$4,$2,$5,$6,$7,$1;
- $1=$recv($String())._streamContents_((function(stream){
- return $core.withContext(function($ctx2) {
- $recv(stream)._nextPutAll_("Object");
- $ctx2.sendIdx["nextPutAll:"]=1;
- $recv(stream)._nextPutAll_(" subclass: #NameOfSubclass");
- $ctx2.sendIdx["nextPutAll:"]=2;
- $3=$recv($String())._lf();
- $ctx2.sendIdx["lf"]=1;
- $4=$recv($String())._tab();
- $ctx2.sendIdx["tab"]=1;
- $2=$recv($3).__comma($4);
- $ctx2.sendIdx[","]=1;
- $recv(stream)._nextPutAll_($2);
- $ctx2.sendIdx["nextPutAll:"]=3;
- $5=$recv(stream)._nextPutAll_("instanceVariableNames: ''");
- $ctx2.sendIdx["nextPutAll:"]=4;
- $5;
- $6=$recv("'".__comma($recv($String())._lf())).__comma($recv($String())._tab());
- $ctx2.sendIdx[","]=2;
- $recv(stream)._nextPutAll_($6);
- $ctx2.sendIdx["nextPutAll:"]=5;
- $recv(stream)._nextPutAll_("package: '");
- $ctx2.sendIdx["nextPutAll:"]=6;
- $recv(stream)._nextPutAll_(self._name());
- $ctx2.sendIdx["nextPutAll:"]=7;
- $7=$recv(stream)._nextPutAll_("'");
- return $7;
- }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
- },
- args: [],
- 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: '''' ]",
- referencedClasses: ["String"],
- messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab", "name"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "classes",
- protocol: 'classes',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._organization())._elements();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
- },
- args: [],
- source: "classes\x0a\x09^ self organization elements",
- referencedClasses: [],
- messageSends: ["elements", "organization"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "definition",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $core.withContext(function($ctx1) {
- var $2,$4,$5,$3,$7,$6,$9,$10,$8,$11,$12,$1;
- $1=$recv($String())._streamContents_((function(stream){
- return $core.withContext(function($ctx2) {
- $2=$recv(self._class())._name();
- $ctx2.sendIdx["name"]=1;
- $recv(stream)._nextPutAll_($2);
- $ctx2.sendIdx["nextPutAll:"]=1;
- $4=$recv($String())._lf();
- $ctx2.sendIdx["lf"]=1;
- $5=$recv($String())._tab();
- $ctx2.sendIdx["tab"]=1;
- $3=$recv($4).__comma($5);
- $ctx2.sendIdx[","]=1;
- $recv(stream)._nextPutAll_($3);
- $ctx2.sendIdx["nextPutAll:"]=2;
- $recv(stream)._nextPutAll_("named: ");
- $ctx2.sendIdx["nextPutAll:"]=3;
- $7="'".__comma(self._name());
- $ctx2.sendIdx[","]=3;
- $6=$recv($7).__comma("'");
- $ctx2.sendIdx[","]=2;
- $recv(stream)._nextPutAll_($6);
- $ctx2.sendIdx["nextPutAll:"]=4;
- $9=$recv($String())._lf();
- $ctx2.sendIdx["lf"]=2;
- $10=$recv($String())._tab();
- $ctx2.sendIdx["tab"]=2;
- $8=$recv($9).__comma($10);
- $ctx2.sendIdx[","]=4;
- $recv(stream)._nextPutAll_($8);
- $ctx2.sendIdx["nextPutAll:"]=5;
- $recv(stream)._nextPutAll_("imports: ");
- $ctx2.sendIdx["nextPutAll:"]=6;
- $recv(stream)._nextPutAll_(self._importsDefinition());
- $ctx2.sendIdx["nextPutAll:"]=7;
- $11=$recv($recv($String())._lf()).__comma($recv($String())._tab());
- $ctx2.sendIdx[","]=5;
- $recv(stream)._nextPutAll_($11);
- $ctx2.sendIdx["nextPutAll:"]=8;
- $recv(stream)._nextPutAll_("transport: (");
- $ctx2.sendIdx["nextPutAll:"]=9;
- $12=$recv(stream)._nextPutAll_($recv($recv(self._transport())._definition()).__comma(")"));
- return $12;
- }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
- },
- args: [],
- 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, ')' ]",
- referencedClasses: ["String"],
- messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "lf", "tab", "importsDefinition", "definition", "transport"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "imports",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@imports"];
- if(($receiver = $2) == null || $receiver.isNil){
- var parsed;
- parsed=self._importsFromJson_(self._basicImports());
- parsed;
- self._imports_(parsed);
- $1=self["@imports"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
- },
- args: [],
- 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 ]",
- referencedClasses: [],
- messageSends: ["ifNil:", "importsFromJson:", "basicImports", "imports:"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "imports:",
- protocol: 'accessing',
- fn: function (anArray){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._validateImports_(anArray);
- self["@imports"]=$recv(anArray)._asSet();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
- },
- args: ["anArray"],
- source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
- referencedClasses: [],
- messageSends: ["validateImports:", "asSet"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "importsAsJson",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $1=$recv(self._sortedImportsAsArray())._collect_((function(each){
- return $core.withContext(function($ctx2) {
- $2=$recv(each)._isString();
- if($core.assert($2)){
- return each;
- } else {
- return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
- $ctx2.sendIdx[","]=1;
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
- },
- args: [],
- 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 ]]",
- referencedClasses: [],
- messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "importsDefinition",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($String())._streamContents_((function(stream){
- return $core.withContext(function($ctx2) {
- $recv(stream)._nextPutAll_("{");
- $ctx2.sendIdx["nextPutAll:"]=1;
- $recv(self._sortedImportsAsArray())._do_separatedBy_((function(each){
- return $core.withContext(function($ctx3) {
- return $recv(stream)._nextPutAll_($recv(each)._importsString());
- $ctx3.sendIdx["nextPutAll:"]=2;
- }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
- }),(function(){
- return $core.withContext(function($ctx3) {
- return $recv(stream)._nextPutAll_(". ");
- $ctx3.sendIdx["nextPutAll:"]=3;
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
- }));
- return $recv(stream)._nextPutAll_("}");
- }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
- },
- args: [],
- 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: '}' ]",
- referencedClasses: ["String"],
- messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "sortedImportsAsArray", "importsString"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "importsFromJson:",
- protocol: 'converting',
- fn: function (anArray){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $1=$recv(anArray)._collect_((function(each){
- var split;
- return $core.withContext(function($ctx2) {
- split=$recv(each)._tokenize_("=");
- split;
- $2=$recv($recv(split)._size()).__eq((1));
- if($core.assert($2)){
- return $recv(split)._first();
- $ctx2.sendIdx["first"]=1;
- } else {
- return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
- },
- args: ["anArray"],
- 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 ]]",
- referencedClasses: [],
- messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "isDirty",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@dirty"];
- if(($receiver = $2) == null || $receiver.isNil){
- $1=false;
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
- },
- args: [],
- source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
- referencedClasses: [],
- messageSends: ["ifNil:"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "isPackage",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isPackage\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "loadDependencies",
- protocol: 'dependencies',
- fn: function (){
- var self=this;
- var classes,packages;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- classes=self._loadDependencyClasses();
- $2=$recv($recv(classes)._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._package();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- })))._asSet();
- $recv($2)._remove_ifAbsent_(self,(function(){
- }));
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "loadDependencyClasses",
- protocol: 'dependencies',
- fn: function (){
- var self=this;
- var starCategoryName;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $4,$3,$2,$6,$5,$7,$1;
- starCategoryName="*".__comma(self._name());
- $ctx1.sendIdx[","]=1;
- $4=self._classes();
- $ctx1.sendIdx["classes"]=1;
- $3=$recv($4)._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._superclass();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $2=$recv($3)._asSet();
- $recv($2)._remove_ifAbsent_(nil,(function(){
- }));
- $recv($2)._addAll_($recv($recv($Smalltalk())._classes())._select_((function(each){
- return $core.withContext(function($ctx2) {
- $6=$recv(each)._protocols();
- $ctx2.sendIdx["protocols"]=1;
- $5=$recv($6).__comma($recv($recv(each)._class())._protocols());
- return $recv($5)._includes_(starCategoryName);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
- })));
- $7=$recv($2)._yourself();
- $1=$7;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
- },
- args: [],
- 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",
- referencedClasses: ["Smalltalk"],
- messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "includes:", "protocols", "class", "yourself"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "name",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return self.pkgName;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Package)});
- },
- args: [],
- source: "name\x0a\x09<return self.pkgName>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "name:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._basicName_(aString);
- self._beDirty();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},$globals.Package)});
- },
- args: ["aString"],
- source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty",
- referencedClasses: [],
- messageSends: ["basicName:", "beDirty"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "organization",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._basicAt_("organization");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Package)});
- },
- args: [],
- source: "organization\x0a\x09^ self basicAt: 'organization'",
- referencedClasses: [],
- messageSends: ["basicAt:"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "printOn:",
- protocol: 'printing',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- (
- $ctx1.supercall = true,
- $globals.Package.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
- $ctx1.supercall = false;
- $recv(aStream)._nextPutAll_(" (");
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv(aStream)._nextPutAll_(self._name());
- $ctx1.sendIdx["nextPutAll:"]=2;
- $1=$recv(aStream)._nextPutAll_(")");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
- },
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
- referencedClasses: [],
- messageSends: ["printOn:", "nextPutAll:", "name"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "setupClasses",
- protocol: 'classes',
- fn: function (){
- var self=this;
- function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=self._classes();
- $recv($1)._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv($recv($ClassBuilder())._new())._setupClass_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $ctx1.sendIdx["do:"]=1;
- $2=$recv($1)._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._initialize();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
- },
- args: [],
- source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
- referencedClasses: ["ClassBuilder"],
- messageSends: ["do:", "classes", "setupClass:", "new", "initialize"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "sortedClasses",
- protocol: 'classes',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._class())._sortedClasses_(self._classes());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["sortedClasses:", "class", "classes"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "sortedImportsAsArray",
- protocol: 'private',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $4,$3,$5,$2,$7,$6,$8,$1;
- $1=$recv($recv(self._imports())._asArray())._sorted_((function(a,b){
- return $core.withContext(function($ctx2) {
- $4=$recv(a)._isString();
- $ctx2.sendIdx["isString"]=1;
- $3=$recv($4)._not();
- $5=$recv(b)._isString();
- $ctx2.sendIdx["isString"]=2;
- $2=$recv($3).__and($5);
- return $recv($2)._or_((function(){
- return $core.withContext(function($ctx3) {
- $7=$recv(a)._isString();
- $ctx3.sendIdx["isString"]=3;
- $6=$recv($7).__eq($recv(b)._isString());
- return $recv($6)._and_((function(){
- return $core.withContext(function($ctx4) {
- $8=$recv(a)._value();
- $ctx4.sendIdx["value"]=1;
- return $recv($8).__lt_eq($recv(b)._value());
- }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
- }));
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }));
- }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
- },
- args: [],
- 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 ]]]",
- referencedClasses: [],
- messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "transport",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$4,$1,$receiver;
- $2=self["@transport"];
- if(($receiver = $2) == null || $receiver.isNil){
- $3=$recv($PackageTransport())._fromJson_(self._basicTransport());
- $recv($3)._package_(self);
- $4=$recv($3)._yourself();
- self["@transport"]=$4;
- $1=self["@transport"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
- },
- args: [],
- source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
- referencedClasses: ["PackageTransport"],
- messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "transport:",
- protocol: 'accessing',
- fn: function (aPackageTransport){
- var self=this;
- return $core.withContext(function($ctx1) {
- self["@transport"]=aPackageTransport;
- $recv(aPackageTransport)._package_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
- },
- args: ["aPackageTransport"],
- source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
- referencedClasses: [],
- messageSends: ["package:"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "validateImports:",
- protocol: 'validation',
- fn: function (aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$5,$4,$3,$6;
- $recv(aCollection)._do_((function(import_){
- return $core.withContext(function($ctx2) {
- $1=$recv(import_)._isString();
- $ctx2.sendIdx["isString"]=1;
- if(!$core.assert($1)){
- $2=$recv(import_)._respondsTo_("key");
- if(!$core.assert($2)){
- self._error_("Imports must be Strings or Associations");
- $ctx2.sendIdx["error:"]=1;
- };
- $5=$recv(import_)._key();
- $ctx2.sendIdx["key"]=1;
- $4=$recv($5)._isString();
- $ctx2.sendIdx["isString"]=2;
- $3=$recv($4).__and($recv($recv(import_)._value())._isString());
- if(!$core.assert($3)){
- self._error_("Key and value must be Strings");
- $ctx2.sendIdx["error:"]=2;
- };
- $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
- if(!$core.assert($6)){
- return self._error_("Keys must be identifiers");
- };
- };
- }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
- },
- args: ["aCollection"],
- 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' ]]]",
- referencedClasses: [],
- messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
- }),
- $globals.Package);
- $globals.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
- $core.addMethod(
- $core.method({
- selector: "named:",
- protocol: 'accessing',
- fn: function (aPackageName){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Smalltalk())._packageAt_ifAbsent_(aPackageName,(function(){
- return $core.withContext(function($ctx2) {
- return $recv($Smalltalk())._createPackage_(aPackageName);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.klass)});
- },
- args: ["aPackageName"],
- source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
- referencedClasses: ["Smalltalk"],
- messageSends: ["packageAt:ifAbsent:", "createPackage:"]
- }),
- $globals.Package.klass);
- $core.addMethod(
- $core.method({
- selector: "named:ifAbsent:",
- protocol: 'accessing',
- fn: function (aPackageName,aBlock){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Smalltalk())._packageAt_ifAbsent_(aPackageName,aBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.klass)});
- },
- args: ["aPackageName", "aBlock"],
- source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
- referencedClasses: ["Smalltalk"],
- messageSends: ["packageAt:ifAbsent:"]
- }),
- $globals.Package.klass);
- $core.addMethod(
- $core.method({
- selector: "named:imports:transport:",
- protocol: 'accessing',
- fn: function (aPackageName,anArray,aTransport){
- var self=this;
- var package_;
- return $core.withContext(function($ctx1) {
- var $1;
- package_=self._named_(aPackageName);
- $recv(package_)._imports_(anArray);
- $recv(package_)._transport_(aTransport);
- $1=package_;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,package_:package_},$globals.Package.klass)});
- },
- args: ["aPackageName", "anArray", "aTransport"],
- 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",
- referencedClasses: [],
- messageSends: ["named:", "imports:", "transport:"]
- }),
- $globals.Package.klass);
- $core.addMethod(
- $core.method({
- selector: "named:transport:",
- protocol: 'accessing',
- fn: function (aPackageName,aTransport){
- var self=this;
- var package_;
- return $core.withContext(function($ctx1) {
- var $1;
- package_=self._named_(aPackageName);
- $recv(package_)._transport_(aTransport);
- $1=package_;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},$globals.Package.klass)});
- },
- args: ["aPackageName", "aTransport"],
- source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
- referencedClasses: [],
- messageSends: ["named:", "transport:"]
- }),
- $globals.Package.klass);
- $core.addMethod(
- $core.method({
- selector: "sortedClasses:",
- protocol: 'sorting',
- fn: function (classes){
- var self=this;
- var children,others,nodes,expandedClasses;
- function $ClassSorterNode(){return $globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
- function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
- return $core.withContext(function($ctx1) {
- var $1,$3,$2,$4;
- children=[];
- others=[];
- $recv(classes)._do_((function(each){
- return $core.withContext(function($ctx2) {
- $1=$recv(classes)._includes_($recv(each)._superclass());
- if($core.assert($1)){
- return $recv(others)._add_(each);
- } else {
- return $recv(children)._add_(each);
- $ctx2.sendIdx["add:"]=1;
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $ctx1.sendIdx["do:"]=1;
- nodes=$recv(children)._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv($ClassSorterNode())._on_classes_level_(each,others,(0));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
- }));
- nodes=$recv(nodes)._sorted_((function(a,b){
- return $core.withContext(function($ctx2) {
- $3=$recv(a)._theClass();
- $ctx2.sendIdx["theClass"]=1;
- $2=$recv($3)._name();
- $ctx2.sendIdx["name"]=1;
- return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
- }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
- }));
- expandedClasses=$recv($Array())._new();
- $recv(nodes)._do_((function(aNode){
- return $core.withContext(function($ctx2) {
- return $recv(aNode)._traverseClassesWith_(expandedClasses);
- }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
- }));
- $4=expandedClasses;
- return $4;
- }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.klass)});
- },
- args: ["classes"],
- 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",
- referencedClasses: ["ClassSorterNode", "Array"],
- messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
- }),
- $globals.Package.klass);
- $core.addClass('PackageStateObserver', $globals.Object, [], 'Kernel-Infrastructure');
- $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
- $core.addMethod(
- $core.method({
- selector: "announcer",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($SystemAnnouncer())._current();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
- },
- args: [],
- source: "announcer\x0a\x09^ SystemAnnouncer current",
- referencedClasses: ["SystemAnnouncer"],
- messageSends: ["current"]
- }),
- $globals.PackageStateObserver);
- $core.addMethod(
- $core.method({
- selector: "observeSystem",
- protocol: 'actions',
- fn: function (){
- var self=this;
- function $PackageAdded(){return $globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
- function $ClassAnnouncement(){return $globals.ClassAnnouncement||(typeof ClassAnnouncement=="undefined"?nil:ClassAnnouncement)}
- function $MethodAnnouncement(){return $globals.MethodAnnouncement||(typeof MethodAnnouncement=="undefined"?nil:MethodAnnouncement)}
- function $ProtocolAnnouncement(){return $globals.ProtocolAnnouncement||(typeof ProtocolAnnouncement=="undefined"?nil:ProtocolAnnouncement)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=self._announcer();
- $recv($1)._on_send_to_($PackageAdded(),"onPackageAdded:",self);
- $ctx1.sendIdx["on:send:to:"]=1;
- $recv($1)._on_send_to_($ClassAnnouncement(),"onClassModification:",self);
- $ctx1.sendIdx["on:send:to:"]=2;
- $recv($1)._on_send_to_($MethodAnnouncement(),"onMethodModification:",self);
- $ctx1.sendIdx["on:send:to:"]=3;
- $2=$recv($1)._on_send_to_($ProtocolAnnouncement(),"onProtocolModification:",self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
- },
- args: [],
- 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",
- referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
- messageSends: ["on:send:to:", "announcer"]
- }),
- $globals.PackageStateObserver);
- $core.addMethod(
- $core.method({
- selector: "onClassModification:",
- protocol: 'reactions',
- fn: function (anAnnouncement){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$receiver;
- $1=$recv(anAnnouncement)._theClass();
- if(($receiver = $1) == null || $receiver.isNil){
- $1;
- } else {
- var theClass;
- theClass=$receiver;
- $recv($recv(theClass)._package())._beDirty();
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
- },
- args: ["anAnnouncement"],
- source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
- referencedClasses: [],
- messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
- }),
- $globals.PackageStateObserver);
- $core.addMethod(
- $core.method({
- selector: "onMethodModification:",
- protocol: 'reactions',
- fn: function (anAnnouncement){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$receiver;
- $1=$recv($recv(anAnnouncement)._method())._package();
- if(($receiver = $1) == null || $receiver.isNil){
- $1;
- } else {
- var package_;
- package_=$receiver;
- $recv(package_)._beDirty();
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
- },
- args: ["anAnnouncement"],
- source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
- referencedClasses: [],
- messageSends: ["ifNotNil:", "package", "method", "beDirty"]
- }),
- $globals.PackageStateObserver);
- $core.addMethod(
- $core.method({
- selector: "onPackageAdded:",
- protocol: 'reactions',
- fn: function (anAnnouncement){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv($recv(anAnnouncement)._package())._beDirty();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
- },
- args: ["anAnnouncement"],
- source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
- referencedClasses: [],
- messageSends: ["beDirty", "package"]
- }),
- $globals.PackageStateObserver);
- $core.addMethod(
- $core.method({
- selector: "onProtocolModification:",
- protocol: 'reactions',
- fn: function (anAnnouncement){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$receiver;
- $1=$recv(anAnnouncement)._package();
- if(($receiver = $1) == null || $receiver.isNil){
- $1;
- } else {
- var package_;
- package_=$receiver;
- $recv(package_)._beDirty();
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
- },
- args: ["anAnnouncement"],
- source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
- referencedClasses: [],
- messageSends: ["ifNotNil:", "package", "beDirty"]
- }),
- $globals.PackageStateObserver);
- $globals.PackageStateObserver.klass.iVarNames = ['current'];
- $core.addMethod(
- $core.method({
- selector: "current",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@current"];
- if(($receiver = $2) == null || $receiver.isNil){
- self["@current"]=self._new();
- $1=self["@current"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.klass)});
- },
- args: [],
- source: "current\x0a\x09^ current ifNil: [ current := self new ]",
- referencedClasses: [],
- messageSends: ["ifNil:", "new"]
- }),
- $globals.PackageStateObserver.klass);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._current())._observeSystem();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.klass)});
- },
- args: [],
- source: "initialize\x0a\x09self current observeSystem",
- referencedClasses: [],
- messageSends: ["observeSystem", "current"]
- }),
- $globals.PackageStateObserver.klass);
- $core.addClass('ParseError', $globals.Error, [], 'Kernel-Infrastructure');
- $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
- $core.addClass('RethrowErrorHandler', $globals.Object, [], 'Kernel-Infrastructure');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "basicSignal:",
- protocol: 'error handling',
- fn: function (anError){
- var self=this;
- return $core.withContext(function($ctx1) {
- throw anError;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"basicSignal:",{anError:anError},$globals.RethrowErrorHandler)});
- },
- args: ["anError"],
- source: "basicSignal: anError\x0a <throw anError>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.RethrowErrorHandler);
- $core.addMethod(
- $core.method({
- selector: "handleError:",
- protocol: 'error handling',
- fn: function (anError){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._basicSignal_(anError);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.RethrowErrorHandler)});
- },
- args: ["anError"],
- source: "handleError: anError\x0a self basicSignal: anError",
- referencedClasses: [],
- messageSends: ["basicSignal:"]
- }),
- $globals.RethrowErrorHandler);
- $core.addClass('Setting', $globals.Object, ['key', 'value', 'defaultValue'], 'Kernel-Infrastructure');
- $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`";
- $core.addMethod(
- $core.method({
- selector: "defaultValue",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@defaultValue"];
- return $1;
- },
- args: [],
- source: "defaultValue\x0a\x09^ defaultValue",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Setting);
- $core.addMethod(
- $core.method({
- selector: "defaultValue:",
- protocol: 'accessing',
- fn: function (aStringifiableObject){
- var self=this;
- self["@defaultValue"]=aStringifiableObject;
- return self;
- },
- args: ["aStringifiableObject"],
- source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Setting);
- $core.addMethod(
- $core.method({
- selector: "key",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@key"];
- return $1;
- },
- args: [],
- source: "key\x0a\x09^ key",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Setting);
- $core.addMethod(
- $core.method({
- selector: "key:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@key"]=aString;
- return self;
- },
- args: ["aString"],
- source: "key: aString\x0a\x09key := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Setting);
- $core.addMethod(
- $core.method({
- selector: "value",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv($Smalltalk())._settings())._at_ifAbsent_(self._key(),(function(){
- return $core.withContext(function($ctx2) {
- return self._defaultValue();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
- },
- args: [],
- source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
- referencedClasses: ["Smalltalk"],
- messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
- }),
- $globals.Setting);
- $core.addMethod(
- $core.method({
- selector: "value:",
- protocol: 'accessing',
- fn: function (aStringifiableObject){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv($Smalltalk())._settings())._at_put_(self._key(),aStringifiableObject);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
- },
- args: ["aStringifiableObject"],
- source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
- referencedClasses: ["Smalltalk"],
- messageSends: ["at:put:", "settings", "key"]
- }),
- $globals.Setting);
- $core.addMethod(
- $core.method({
- selector: "at:ifAbsent:",
- protocol: 'instance creation',
- fn: function (aString,aDefaultValue){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=(
- $ctx1.supercall = true,
- $globals.Setting.klass.superclass.fn.prototype._new.apply($recv(self), []));
- $ctx1.supercall = false;
- $recv($2)._key_(aString);
- $recv($2)._defaultValue_(aDefaultValue);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.klass)});
- },
- args: ["aString", "aDefaultValue"],
- source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["key:", "new", "defaultValue:", "yourself"]
- }),
- $globals.Setting.klass);
- $core.addMethod(
- $core.method({
- selector: "new",
- protocol: 'instance creation',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._shouldNotImplement();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.klass)});
- },
- args: [],
- source: "new\x0a\x09self shouldNotImplement",
- referencedClasses: [],
- messageSends: ["shouldNotImplement"]
- }),
- $globals.Setting.klass);
- $core.addClass('SmalltalkImage', $globals.Object, [], 'Kernel-Infrastructure');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "addGlobalJsVariable:",
- protocol: 'globals',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._globalJsVariables())._add_(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
- },
- args: ["aString"],
- source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
- referencedClasses: [],
- messageSends: ["add:", "globalJsVariables"]
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "amdRequire",
- protocol: 'accessing amd',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._core())._at_("amdRequire");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
- },
- args: [],
- source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
- referencedClasses: [],
- messageSends: ["at:", "core"]
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "asSmalltalkException:",
- protocol: 'error handling',
- fn: function (anObject){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=$recv(self._isSmalltalkObject_(anObject))._and_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(anObject)._isKindOf_($Error());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- if($core.assert($2)){
- $1=anObject;
- } else {
- $1=$recv($JavaScriptException())._on_(anObject);
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
- },
- args: ["anObject"],
- 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 ]",
- referencedClasses: ["Error", "JavaScriptException"],
- messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "basicCreatePackage:",
- protocol: 'private',
- fn: function (packageName){
- var self=this;
- return $core.withContext(function($ctx1) {
- return $core.addPackage(packageName);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
- },
- args: ["packageName"],
- 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)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "basicParse:",
- protocol: 'private',
- fn: function (aString){
- var self=this;
- function $SmalltalkParser(){return $globals.SmalltalkParser||(typeof SmalltalkParser=="undefined"?nil:SmalltalkParser)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($SmalltalkParser())._parse_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
- },
- args: ["aString"],
- source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
- referencedClasses: ["SmalltalkParser"],
- messageSends: ["parse:"]
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "basicRegisterPackage:",
- protocol: 'private',
- fn: function (aPackage){
- var self=this;
- return $core.withContext(function($ctx1) {
- $core.packages[aPackage.pkgName]=aPackage;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"basicRegisterPackage:",{aPackage:aPackage},$globals.SmalltalkImage)});
- },
- args: ["aPackage"],
- source: "basicRegisterPackage: aPackage\x0a\x09\x22Put aPackage in $core.packages object.\x22\x0a\x09<$core.packages[aPackage.pkgName]=aPackage>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "cancelOptOut:",
- protocol: 'accessing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- delete anObject.klass;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
- },
- args: ["anObject"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "classes",
- protocol: 'classes',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return $core.classes();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
- },
- args: [],
- source: "classes\x0a\x09<return $core.classes()>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "core",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return $core;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
- },
- args: [],
- source: "core\x0a\x09<return $core>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "createPackage:",
- protocol: 'packages',
- fn: function (packageName){
- var self=this;
- var package_,announcement;
- function $PackageAdded(){return $globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
- function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3;
- package_=self._basicCreatePackage_(packageName);
- $1=$recv($PackageAdded())._new();
- $recv($1)._package_(package_);
- $2=$recv($1)._yourself();
- announcement=$2;
- $recv($recv($SystemAnnouncer())._current())._announce_(announcement);
- $3=package_;
- return $3;
- }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
- },
- args: ["packageName"],
- 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",
- referencedClasses: ["PackageAdded", "SystemAnnouncer"],
- messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "defaultAmdNamespace",
- protocol: 'accessing amd',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1="transport.defaultAmdNamespace"._settingValue();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
- },
- args: [],
- source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
- referencedClasses: [],
- messageSends: ["settingValue"]
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "defaultAmdNamespace:",
- protocol: 'accessing amd',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- "transport.defaultAmdNamespace"._settingValue_(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
- },
- args: ["aString"],
- source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
- referencedClasses: [],
- messageSends: ["settingValue:"]
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "deleteClass:",
- protocol: 'private',
- fn: function (aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- $core.removeClass(aClass);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
- },
- args: ["aClass"],
- source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<$core.removeClass(aClass)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "deleteGlobalJsVariable:",
- protocol: 'globals',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
- },
- args: ["aString"],
- source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
- referencedClasses: [],
- messageSends: ["remove:ifAbsent:", "globalJsVariables"]
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "deletePackage:",
- protocol: 'private',
- fn: function (packageName){
- var self=this;
- return $core.withContext(function($ctx1) {
- delete $core.packages[packageName];
- return self;
- }, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},$globals.SmalltalkImage)});
- },
- args: ["packageName"],
- 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]>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "existsJsGlobal:",
- protocol: 'testing',
- fn: function (aString){
- var self=this;
- function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv($Platform())._globals())._at_ifPresent_ifAbsent_(aString,(function(){
- return true;
- }),(function(){
- return false;
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
- },
- args: ["aString"],
- source: "existsJsGlobal: aString\x0a\x09^ Platform globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
- referencedClasses: ["Platform"],
- messageSends: ["at:ifPresent:ifAbsent:", "globals"]
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "globalJsVariables",
- protocol: 'globals',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return $core.globalJsVariables;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
- },
- args: [],
- source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<return $core.globalJsVariables>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "globals",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return $globals;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
- },
- args: [],
- source: "globals\x0a\x09<return $globals>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "includesKey:",
- protocol: 'accessing',
- fn: function (aKey){
- var self=this;
- return $core.withContext(function($ctx1) {
- return $core.hasOwnProperty(aKey);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
- },
- args: ["aKey"],
- source: "includesKey: aKey\x0a\x09<return $core.hasOwnProperty(aKey)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "isSmalltalkObject:",
- protocol: 'testing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- return anObject.klass != null;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
- },
- args: ["anObject"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "optOut:",
- protocol: 'accessing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- anObject.klass = null;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
- },
- args: ["anObject"],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "packageAt:",
- protocol: 'packages',
- fn: function (packageName){
- var self=this;
- return $core.withContext(function($ctx1) {
- return $core.packages[packageName];
- return self;
- }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
- },
- args: ["packageName"],
- source: "packageAt: packageName\x0a\x09<return $core.packages[packageName]>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "packageAt:ifAbsent:",
- protocol: 'packages',
- fn: function (packageName,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=self._packageAt_(packageName);
- $1=$recv($2)._ifNil_(aBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
- },
- args: ["packageName", "aBlock"],
- source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
- referencedClasses: [],
- messageSends: ["ifNil:", "packageAt:"]
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "packages",
- protocol: 'packages',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return Object.keys($core.packages).map(function(k) {
- return $core.packages[k];
- })
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
- },
- args: [],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "parse:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- var result;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $recv((function(){
- return $core.withContext(function($ctx2) {
- result=self._basicParse_(aString);
- return result;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._tryCatch_((function(ex){
- return $core.withContext(function($ctx2) {
- return $recv(self._parseError_parsing_(ex,aString))._signal();
- }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
- }));
- $2=result;
- $recv($2)._source_(aString);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
- },
- args: ["aString"],
- 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",
- referencedClasses: [],
- messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "parseError:parsing:",
- protocol: 'error handling',
- fn: function (anException,aString){
- var self=this;
- function $ParseError(){return $globals.ParseError||(typeof ParseError=="undefined"?nil:ParseError)}
- return $core.withContext(function($ctx1) {
- var $2,$8,$7,$6,$9,$5,$4,$3,$1;
- $2=$recv($ParseError())._new();
- $8=$recv(anException)._basicAt_("line");
- $ctx1.sendIdx["basicAt:"]=1;
- $7="Parse error on line ".__comma($8);
- $6=$recv($7).__comma(" column ");
- $ctx1.sendIdx[","]=4;
- $9=$recv(anException)._basicAt_("column");
- $ctx1.sendIdx["basicAt:"]=2;
- $5=$recv($6).__comma($9);
- $ctx1.sendIdx[","]=3;
- $4=$recv($5).__comma(" : Unexpected character ");
- $ctx1.sendIdx[","]=2;
- $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
- $ctx1.sendIdx[","]=1;
- $1=$recv($2)._messageText_($3);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
- },
- args: ["anException", "aString"],
- 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')",
- referencedClasses: ["ParseError"],
- messageSends: ["messageText:", "new", ",", "basicAt:"]
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "pseudoVariableNames",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=["self", "super", "nil", "true", "false", "thisContext"];
- return $1;
- },
- args: [],
- source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "readJSObject:",
- protocol: 'accessing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- return $core.readJSObject(anObject);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
- },
- args: ["anObject"],
- source: "readJSObject: anObject\x0a\x09<return $core.readJSObject(anObject)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "removeClass:",
- protocol: 'classes',
- fn: function (aClass){
- var self=this;
- function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- function $ClassRemoved(){return $globals.ClassRemoved||(typeof ClassRemoved=="undefined"?nil:ClassRemoved)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3;
- $1=$recv(aClass)._isMetaclass();
- if($core.assert($1)){
- self._error_($recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
- };
- self._deleteClass_(aClass);
- $2=$recv($ClassRemoved())._new();
- $recv($2)._theClass_(aClass);
- $3=$recv($2)._yourself();
- $recv($recv($SystemAnnouncer())._current())._announce_($3);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
- },
- args: ["aClass"],
- 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)",
- referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
- messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"]
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "removePackage:",
- protocol: 'packages',
- fn: function (packageName){
- var self=this;
- var pkg;
- return $core.withContext(function($ctx1) {
- pkg=self._packageAt_ifAbsent_(packageName,(function(){
- return $core.withContext(function($ctx2) {
- return self._error_("Missing package: ".__comma(packageName));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $recv($recv(pkg)._classes())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return self._removeClass_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- self._deletePackage_(packageName);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
- },
- args: ["packageName"],
- 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",
- referencedClasses: [],
- messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"]
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "renamePackage:to:",
- protocol: 'packages',
- fn: function (packageName,newName){
- var self=this;
- var pkg;
- return $core.withContext(function($ctx1) {
- var $1,$2,$receiver;
- pkg=self._packageAt_ifAbsent_(packageName,(function(){
- return $core.withContext(function($ctx2) {
- $1="Missing package: ".__comma(packageName);
- $ctx2.sendIdx[","]=1;
- return self._error_($1);
- $ctx2.sendIdx["error:"]=1;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $2=self._packageAt_(newName);
- if(($receiver = $2) == null || $receiver.isNil){
- $2;
- } else {
- self._error_("Already exists a package called: ".__comma(newName));
- };
- $recv(pkg)._name_(newName);
- self._basicRegisterPackage_(pkg);
- self._deletePackage_(packageName);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
- },
- args: ["packageName", "newName"],
- 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.",
- referencedClasses: [],
- messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "basicRegisterPackage:", "deletePackage:"]
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "reservedWords",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return $core.reservedWords;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"reservedWords",{},$globals.SmalltalkImage)});
- },
- args: [],
- source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return $core.reservedWords>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "settings",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $SmalltalkSettings(){return $globals.SmalltalkSettings||(typeof SmalltalkSettings=="undefined"?nil:SmalltalkSettings)}
- return $SmalltalkSettings();
- },
- args: [],
- source: "settings\x0a\x09^ SmalltalkSettings",
- referencedClasses: ["SmalltalkSettings"],
- messageSends: []
- }),
- $globals.SmalltalkImage);
- $core.addMethod(
- $core.method({
- selector: "version",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return "0.15.0-pre";
- },
- args: [],
- source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.15.0-pre'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SmalltalkImage);
- $globals.SmalltalkImage.klass.iVarNames = ['current'];
- $core.addMethod(
- $core.method({
- selector: "current",
- protocol: 'instance creation',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@current"];
- if(($receiver = $2) == null || $receiver.isNil){
- self["@current"]=(
- $ctx1.supercall = true,
- $globals.SmalltalkImage.klass.superclass.fn.prototype._new.apply($recv(self), []));
- $ctx1.supercall = false;
- $1=self["@current"];
- } else {
- self._deprecatedAPI();
- $1=self["@current"];
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.klass)});
- },
- args: [],
- source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
- referencedClasses: [],
- messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
- }),
- $globals.SmalltalkImage.klass);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- var st;
- return $core.withContext(function($ctx1) {
- st=self._current();
- $recv($recv(st)._globals())._at_put_("Smalltalk",st);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.klass)});
- },
- args: [],
- source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
- referencedClasses: [],
- messageSends: ["current", "at:put:", "globals"]
- }),
- $globals.SmalltalkImage.klass);
- $core.addMethod(
- $core.method({
- selector: "new",
- protocol: 'instance creation',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._shouldNotImplement();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.klass)});
- },
- args: [],
- source: "new\x0a\x09self shouldNotImplement",
- referencedClasses: [],
- messageSends: ["shouldNotImplement"]
- }),
- $globals.SmalltalkImage.klass);
- $core.addMethod(
- $core.method({
- selector: "importsString",
- protocol: '*Kernel-Infrastructure',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $3,$2,$1;
- $3=$recv(self._key())._importsString();
- $ctx1.sendIdx["importsString"]=1;
- $2=$recv($3).__comma(" -> ");
- $1=$recv($2).__comma($recv(self._value())._importsString());
- $ctx1.sendIdx[","]=1;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.Association)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: [",", "importsString", "key", "value"]
- }),
- $globals.Association);
- $core.addMethod(
- $core.method({
- selector: "asJavaScriptPropertyName",
- protocol: '*Kernel-Infrastructure',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return $core.st2prop(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
- },
- args: [],
- source: "asJavaScriptPropertyName\x0a<return $core.st2prop(self)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "asSetting",
- protocol: '*Kernel-Infrastructure',
- fn: function (){
- var self=this;
- function $Setting(){return $globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Setting())._at_ifAbsent_(self,nil);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
- },
- args: [],
- 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",
- referencedClasses: ["Setting"],
- messageSends: ["at:ifAbsent:"]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "asSettingIfAbsent:",
- protocol: '*Kernel-Infrastructure',
- fn: function (aDefaultValue){
- var self=this;
- function $Setting(){return $globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Setting())._at_ifAbsent_(self,aDefaultValue);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
- },
- args: ["aDefaultValue"],
- 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",
- referencedClasses: ["Setting"],
- messageSends: ["at:ifAbsent:"]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "importsString",
- protocol: '*Kernel-Infrastructure',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv("'".__comma(self._replace_with_("'","''"))).__comma("'");
- $ctx1.sendIdx[","]=1;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.String)});
- },
- args: [],
- source: "importsString\x0a\x09\x22Answer receiver as Smalltalk expression\x22\x0a\x09^ '''', (self replace: '''' with: ''''''), ''''",
- referencedClasses: [],
- messageSends: [",", "replace:with:"]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "settingValue",
- protocol: '*Kernel-Infrastructure',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._asSetting())._value();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
- },
- args: [],
- source: "settingValue\x0a\x09^ self asSetting value",
- referencedClasses: [],
- messageSends: ["value", "asSetting"]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "settingValue:",
- protocol: '*Kernel-Infrastructure',
- fn: function (aValue){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._asSetting())._value_(aValue);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
- },
- args: ["aValue"],
- 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",
- referencedClasses: [],
- messageSends: ["value:", "asSetting"]
- }),
- $globals.String);
- $core.addMethod(
- $core.method({
- selector: "settingValueIfAbsent:",
- protocol: '*Kernel-Infrastructure',
- fn: function (aDefaultValue){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._asSettingIfAbsent_(aDefaultValue))._value();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
- },
- args: ["aDefaultValue"],
- 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",
- referencedClasses: [],
- messageSends: ["value", "asSettingIfAbsent:"]
- }),
- $globals.String);
- });
- define("amber_core/Kernel-Announcements", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
- var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
- $core.addPackage('Kernel-Announcements');
- $core.packages["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
- $core.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
- $core.addClass('AnnouncementSubscription', $globals.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
- $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
- $core.addMethod(
- $core.method({
- selector: "announcementClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@announcementClass"];
- return $1;
- },
- args: [],
- source: "announcementClass\x0a\x09^ announcementClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AnnouncementSubscription);
- $core.addMethod(
- $core.method({
- selector: "announcementClass:",
- protocol: 'accessing',
- fn: function (aClass){
- var self=this;
- self["@announcementClass"]=aClass;
- return self;
- },
- args: ["aClass"],
- source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AnnouncementSubscription);
- $core.addMethod(
- $core.method({
- selector: "deliver:",
- protocol: 'announcing',
- fn: function (anAnnouncement){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._handlesAnnouncement_(anAnnouncement);
- if($core.assert($1)){
- $recv(self._valuable())._value_(anAnnouncement);
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
- },
- args: ["anAnnouncement"],
- source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
- referencedClasses: [],
- messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
- }),
- $globals.AnnouncementSubscription);
- $core.addMethod(
- $core.method({
- selector: "handlesAnnouncement:",
- protocol: 'announcing',
- fn: function (anAnnouncement){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $3,$4,$2,$1,$receiver;
- $3=$recv($Smalltalk())._globals();
- $ctx1.sendIdx["globals"]=1;
- $4=$recv(self._announcementClass())._name();
- $ctx1.sendIdx["name"]=1;
- $2=$recv($3)._at_($4);
- $ctx1.sendIdx["at:"]=1;
- if(($receiver = $2) == null || $receiver.isNil){
- return false;
- } else {
- var class_;
- class_=$receiver;
- $1=$recv($recv($recv($Smalltalk())._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
- },
- args: ["anAnnouncement"],
- 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 ]",
- referencedClasses: ["Smalltalk"],
- messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
- }),
- $globals.AnnouncementSubscription);
- $core.addMethod(
- $core.method({
- selector: "receiver",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._valuable())._receiver();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
- },
- args: [],
- source: "receiver\x0a\x09^ self valuable receiver",
- referencedClasses: [],
- messageSends: ["receiver", "valuable"]
- }),
- $globals.AnnouncementSubscription);
- $core.addMethod(
- $core.method({
- selector: "valuable",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@valuable"];
- return $1;
- },
- args: [],
- source: "valuable\x0a\x09^ valuable",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AnnouncementSubscription);
- $core.addMethod(
- $core.method({
- selector: "valuable:",
- protocol: 'accessing',
- fn: function (aValuable){
- var self=this;
- self["@valuable"]=aValuable;
- return self;
- },
- args: ["aValuable"],
- source: "valuable: aValuable\x0a\x09valuable := aValuable",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AnnouncementSubscription);
- $core.addClass('AnnouncementValuable', $globals.Object, ['valuable', 'receiver'], 'Kernel-Announcements');
- $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
- $core.addMethod(
- $core.method({
- selector: "receiver",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@receiver"];
- return $1;
- },
- args: [],
- source: "receiver\x0a\x09^ receiver",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AnnouncementValuable);
- $core.addMethod(
- $core.method({
- selector: "receiver:",
- protocol: 'accessing',
- fn: function (anObject){
- var self=this;
- self["@receiver"]=anObject;
- return self;
- },
- args: ["anObject"],
- source: "receiver: anObject\x0a\x09receiver := anObject",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AnnouncementValuable);
- $core.addMethod(
- $core.method({
- selector: "valuable",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@valuable"];
- return $1;
- },
- args: [],
- source: "valuable\x0a\x09^ valuable",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AnnouncementValuable);
- $core.addMethod(
- $core.method({
- selector: "valuable:",
- protocol: 'accessing',
- fn: function (anObject){
- var self=this;
- self["@valuable"]=anObject;
- return self;
- },
- args: ["anObject"],
- source: "valuable: anObject\x0a\x09valuable := anObject",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AnnouncementValuable);
- $core.addMethod(
- $core.method({
- selector: "value",
- protocol: 'evaluating',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._valuable())._value();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
- },
- args: [],
- source: "value\x0a\x09^ self valuable value",
- referencedClasses: [],
- messageSends: ["value", "valuable"]
- }),
- $globals.AnnouncementValuable);
- $core.addMethod(
- $core.method({
- selector: "value:",
- protocol: 'evaluating',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._valuable())._value_(anObject);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
- },
- args: ["anObject"],
- source: "value: anObject\x0a\x09^ self valuable value: anObject",
- referencedClasses: [],
- messageSends: ["value:", "valuable"]
- }),
- $globals.AnnouncementValuable);
- $core.addClass('Announcer', $globals.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
- $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' ].";
- $core.addMethod(
- $core.method({
- selector: "announce:",
- protocol: 'announcing',
- fn: function (anAnnouncement){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self["@subscriptions"])._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._deliver_(anAnnouncement);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
- },
- args: ["anAnnouncement"],
- source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
- referencedClasses: [],
- messageSends: ["do:", "deliver:"]
- }),
- $globals.Announcer);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.Announcer.superclass.fn.prototype._initialize.apply($recv(self), []));
- $ctx1.supercall = false;
- self["@subscriptions"]=$recv($OrderedCollection())._new();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
- },
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
- referencedClasses: ["OrderedCollection"],
- messageSends: ["initialize", "new"]
- }),
- $globals.Announcer);
- $core.addMethod(
- $core.method({
- selector: "on:do:",
- protocol: 'subscribing',
- fn: function (aClass,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._on_do_for_(aClass,aBlock,nil);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
- },
- args: ["aClass", "aBlock"],
- source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
- referencedClasses: [],
- messageSends: ["on:do:for:"]
- }),
- $globals.Announcer);
- $core.addMethod(
- $core.method({
- selector: "on:do:for:",
- protocol: 'subscribing',
- fn: function (aClass,aBlock,aReceiver){
- var self=this;
- function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
- function $AnnouncementValuable(){return $globals.AnnouncementValuable||(typeof AnnouncementValuable=="undefined"?nil:AnnouncementValuable)}
- return $core.withContext(function($ctx1) {
- var $1,$3,$4,$6,$7,$5,$8,$2;
- $1=self["@subscriptions"];
- $3=$recv($AnnouncementSubscription())._new();
- $ctx1.sendIdx["new"]=1;
- $4=$3;
- $6=$recv($AnnouncementValuable())._new();
- $recv($6)._valuable_(aBlock);
- $recv($6)._receiver_(aReceiver);
- $7=$recv($6)._yourself();
- $ctx1.sendIdx["yourself"]=1;
- $5=$7;
- $recv($4)._valuable_($5);
- $ctx1.sendIdx["valuable:"]=1;
- $recv($3)._announcementClass_(aClass);
- $8=$recv($3)._yourself();
- $2=$8;
- $recv($1)._add_($2);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
- },
- args: ["aClass", "aBlock", "aReceiver"],
- 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)",
- referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
- messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
- }),
- $globals.Announcer);
- $core.addMethod(
- $core.method({
- selector: "on:doOnce:",
- protocol: 'subscribing',
- fn: function (aClass,aBlock){
- var self=this;
- var subscription;
- function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=$recv($AnnouncementSubscription())._new();
- $recv($1)._announcementClass_(aClass);
- $2=$recv($1)._yourself();
- subscription=$2;
- $recv(subscription)._valuable_((function(ann){
- return $core.withContext(function($ctx2) {
- $recv(self["@subscriptions"])._remove_(subscription);
- return $recv(aBlock)._value_(ann);
- }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
- }));
- $recv(self["@subscriptions"])._add_(subscription);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
- },
- args: ["aClass", "aBlock"],
- 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",
- referencedClasses: ["AnnouncementSubscription"],
- messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
- }),
- $globals.Announcer);
- $core.addMethod(
- $core.method({
- selector: "on:send:to:",
- protocol: 'subscribing',
- fn: function (aClass,aSelector,anObject){
- var self=this;
- function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
- function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
- return $core.withContext(function($ctx1) {
- var $1,$3,$4,$6,$7,$5,$8,$2;
- $1=self["@subscriptions"];
- $3=$recv($AnnouncementSubscription())._new();
- $ctx1.sendIdx["new"]=1;
- $4=$3;
- $6=$recv($MessageSend())._new();
- $recv($6)._receiver_(anObject);
- $recv($6)._selector_(aSelector);
- $7=$recv($6)._yourself();
- $ctx1.sendIdx["yourself"]=1;
- $5=$7;
- $recv($4)._valuable_($5);
- $recv($3)._announcementClass_(aClass);
- $8=$recv($3)._yourself();
- $2=$8;
- $recv($1)._add_($2);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
- },
- args: ["aClass", "aSelector", "anObject"],
- 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)",
- referencedClasses: ["AnnouncementSubscription", "MessageSend"],
- messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
- }),
- $globals.Announcer);
- $core.addMethod(
- $core.method({
- selector: "unsubscribe:",
- protocol: 'subscribing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- self["@subscriptions"]=$recv(self["@subscriptions"])._reject_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv($recv(each)._receiver()).__eq(anObject);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
- },
- args: ["anObject"],
- source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
- referencedClasses: [],
- messageSends: ["reject:", "=", "receiver"]
- }),
- $globals.Announcer);
- $core.addClass('SystemAnnouncer', $globals.Announcer, [], 'Kernel-Announcements');
- $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`";
- $globals.SystemAnnouncer.klass.iVarNames = ['current'];
- $core.addMethod(
- $core.method({
- selector: "current",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@current"];
- if(($receiver = $2) == null || $receiver.isNil){
- self["@current"]=(
- $ctx1.supercall = true,
- $globals.SystemAnnouncer.klass.superclass.fn.prototype._new.apply($recv(self), []));
- $ctx1.supercall = false;
- $1=self["@current"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.klass)});
- },
- args: [],
- source: "current\x0a\x09^ current ifNil: [ current := super new ]",
- referencedClasses: [],
- messageSends: ["ifNil:", "new"]
- }),
- $globals.SystemAnnouncer.klass);
- $core.addMethod(
- $core.method({
- selector: "new",
- protocol: 'instance creation',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._shouldNotImplement();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.klass)});
- },
- args: [],
- source: "new\x0a\x09self shouldNotImplement",
- referencedClasses: [],
- messageSends: ["shouldNotImplement"]
- }),
- $globals.SystemAnnouncer.klass);
- $core.addClass('SystemAnnouncement', $globals.Object, [], 'Kernel-Announcements');
- $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
- $core.addMethod(
- $core.method({
- selector: "classTag",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return "announcement";
- },
- args: [],
- 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'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SystemAnnouncement.klass);
- $core.addClass('ClassAnnouncement', $globals.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
- $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
- $core.addMethod(
- $core.method({
- selector: "theClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@theClass"];
- return $1;
- },
- args: [],
- source: "theClass\x0a\x09^ theClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ClassAnnouncement);
- $core.addMethod(
- $core.method({
- selector: "theClass:",
- protocol: 'accessing',
- fn: function (aClass){
- var self=this;
- self["@theClass"]=aClass;
- return self;
- },
- args: ["aClass"],
- source: "theClass: aClass\x0a\x09theClass := aClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ClassAnnouncement);
- $core.addClass('ClassAdded', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
- $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
- $core.addClass('ClassCommentChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
- $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
- $core.addClass('ClassDefinitionChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
- $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
- $core.addClass('ClassMigrated', $globals.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements');
- $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
- $core.addMethod(
- $core.method({
- selector: "oldClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@oldClass"];
- return $1;
- },
- args: [],
- source: "oldClass\x0a\x09^ oldClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ClassMigrated);
- $core.addMethod(
- $core.method({
- selector: "oldClass:",
- protocol: 'accessing',
- fn: function (aClass){
- var self=this;
- self["@oldClass"]=aClass;
- return self;
- },
- args: ["aClass"],
- source: "oldClass: aClass\x0a\x09oldClass := aClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ClassMigrated);
- $core.addClass('ClassMoved', $globals.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
- $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
- $core.addMethod(
- $core.method({
- selector: "oldPackage",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@oldPackage"];
- return $1;
- },
- args: [],
- source: "oldPackage\x0a\x09^ oldPackage",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ClassMoved);
- $core.addMethod(
- $core.method({
- selector: "oldPackage:",
- protocol: 'accessing',
- fn: function (aPackage){
- var self=this;
- self["@oldPackage"]=aPackage;
- return self;
- },
- args: ["aPackage"],
- source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ClassMoved);
- $core.addClass('ClassRemoved', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
- $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
- $core.addClass('ClassRenamed', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
- $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
- $core.addClass('MethodAnnouncement', $globals.SystemAnnouncement, ['method'], 'Kernel-Announcements');
- $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
- $core.addMethod(
- $core.method({
- selector: "method",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@method"];
- return $1;
- },
- args: [],
- source: "method\x0a\x09^ method",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodAnnouncement);
- $core.addMethod(
- $core.method({
- selector: "method:",
- protocol: 'accessing',
- fn: function (aCompiledMethod){
- var self=this;
- self["@method"]=aCompiledMethod;
- return self;
- },
- args: ["aCompiledMethod"],
- source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodAnnouncement);
- $core.addClass('MethodAdded', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
- $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
- $core.addClass('MethodModified', $globals.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "oldMethod",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@oldMethod"];
- return $1;
- },
- args: [],
- source: "oldMethod\x0a\x09^ oldMethod",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodModified);
- $core.addMethod(
- $core.method({
- selector: "oldMethod:",
- protocol: 'accessing',
- fn: function (aMethod){
- var self=this;
- self["@oldMethod"]=aMethod;
- return self;
- },
- args: ["aMethod"],
- source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodModified);
- $core.addClass('MethodMoved', $globals.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "oldProtocol",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@oldProtocol"];
- return $1;
- },
- args: [],
- source: "oldProtocol\x0a\x09^ oldProtocol",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodMoved);
- $core.addMethod(
- $core.method({
- selector: "oldProtocol:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@oldProtocol"]=aString;
- return self;
- },
- args: ["aString"],
- source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodMoved);
- $core.addClass('MethodRemoved', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
- $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
- $core.addClass('PackageAnnouncement', $globals.SystemAnnouncement, ['package'], 'Kernel-Announcements');
- $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
- $core.addMethod(
- $core.method({
- selector: "package",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@package"];
- return $1;
- },
- args: [],
- source: "package\x0a\x09^ package",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.PackageAnnouncement);
- $core.addMethod(
- $core.method({
- selector: "package:",
- protocol: 'accessing',
- fn: function (aPackage){
- var self=this;
- self["@package"]=aPackage;
- return self;
- },
- args: ["aPackage"],
- source: "package: aPackage\x0a\x09package := aPackage",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.PackageAnnouncement);
- $core.addClass('PackageAdded', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
- $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
- $core.addClass('PackageClean', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
- $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
- $core.addClass('PackageDirty', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
- $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
- $core.addClass('PackageRemoved', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
- $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
- $core.addClass('ProtocolAnnouncement', $globals.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
- $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
- $core.addMethod(
- $core.method({
- selector: "package",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self._theClass();
- if(($receiver = $2) == null || $receiver.isNil){
- $1=$2;
- } else {
- var class_;
- class_=$receiver;
- $1=$recv(class_)._packageOfProtocol_(self._protocol());
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
- },
- args: [],
- source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
- referencedClasses: [],
- messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
- }),
- $globals.ProtocolAnnouncement);
- $core.addMethod(
- $core.method({
- selector: "protocol",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@protocol"];
- return $1;
- },
- args: [],
- source: "protocol\x0a\x09^ protocol",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ProtocolAnnouncement);
- $core.addMethod(
- $core.method({
- selector: "protocol:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@protocol"]=aString;
- return self;
- },
- args: ["aString"],
- source: "protocol: aString\x0a\x09protocol := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ProtocolAnnouncement);
- $core.addMethod(
- $core.method({
- selector: "theClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@theClass"];
- return $1;
- },
- args: [],
- source: "theClass\x0a\x09^ theClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ProtocolAnnouncement);
- $core.addMethod(
- $core.method({
- selector: "theClass:",
- protocol: 'accessing',
- fn: function (aClass){
- var self=this;
- self["@theClass"]=aClass;
- return self;
- },
- args: ["aClass"],
- source: "theClass: aClass\x0a\x09theClass := aClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ProtocolAnnouncement);
- $core.addClass('ProtocolAdded', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
- $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
- $core.addClass('ProtocolRemoved', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
- $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
- });
- 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";
- var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
- $core.addPackage('Platform-Services');
- $core.packages["Platform-Services"].innerEval = function (expr) { return eval(expr); };
- $core.packages["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
- $core.addClass('ConsoleErrorHandler', $globals.Object, [], 'Platform-Services');
- $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
- $core.addMethod(
- $core.method({
- selector: "handleError:",
- protocol: 'error handling',
- fn: function (anError){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$receiver;
- $1=$recv(anError)._context();
- $ctx1.sendIdx["context"]=1;
- if(($receiver = $1) == null || $receiver.isNil){
- $1;
- } else {
- self._logErrorContext_($recv(anError)._context());
- };
- self._logError_(anError);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
- },
- args: ["anError"],
- source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
- referencedClasses: [],
- messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
- }),
- $globals.ConsoleErrorHandler);
- $core.addMethod(
- $core.method({
- selector: "log:",
- protocol: 'private',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(console)._log_(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
- },
- args: ["aString"],
- source: "log: aString\x0a\x09console log: aString",
- referencedClasses: [],
- messageSends: ["log:"]
- }),
- $globals.ConsoleErrorHandler);
- $core.addMethod(
- $core.method({
- selector: "logContext:",
- protocol: 'private',
- fn: function (aContext){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$receiver;
- $1=$recv(aContext)._home();
- $ctx1.sendIdx["home"]=1;
- if(($receiver = $1) == null || $receiver.isNil){
- $1;
- } else {
- self._logContext_($recv(aContext)._home());
- };
- self._log_($recv(aContext)._asString());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
- },
- args: ["aContext"],
- source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
- referencedClasses: [],
- messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
- }),
- $globals.ConsoleErrorHandler);
- $core.addMethod(
- $core.method({
- selector: "logError:",
- protocol: 'private',
- fn: function (anError){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._log_($recv(anError)._messageText());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
- },
- args: ["anError"],
- source: "logError: anError\x0a\x09self log: anError messageText",
- referencedClasses: [],
- messageSends: ["log:", "messageText"]
- }),
- $globals.ConsoleErrorHandler);
- $core.addMethod(
- $core.method({
- selector: "logErrorContext:",
- protocol: 'private',
- fn: function (aContext){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$receiver;
- if(($receiver = aContext) == null || $receiver.isNil){
- aContext;
- } else {
- $1=$recv(aContext)._home();
- $ctx1.sendIdx["home"]=1;
- if(($receiver = $1) == null || $receiver.isNil){
- $1;
- } else {
- self._logContext_($recv(aContext)._home());
- };
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
- },
- args: ["aContext"],
- source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
- referencedClasses: [],
- messageSends: ["ifNotNil:", "home", "logContext:"]
- }),
- $globals.ConsoleErrorHandler);
- $globals.ConsoleErrorHandler.klass.iVarNames = ['current'];
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- function $ErrorHandler(){return $globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
- return $core.withContext(function($ctx1) {
- $recv($ErrorHandler())._registerIfNone_(self._new());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.klass)});
- },
- args: [],
- source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
- referencedClasses: ["ErrorHandler"],
- messageSends: ["registerIfNone:", "new"]
- }),
- $globals.ConsoleErrorHandler.klass);
- $core.addClass('ConsoleTranscript', $globals.Object, ['textarea'], 'Platform-Services');
- $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
- $core.addMethod(
- $core.method({
- selector: "clear",
- protocol: 'printing',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "clear\x0a\x09\x22no op\x22",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ConsoleTranscript);
- $core.addMethod(
- $core.method({
- selector: "cr",
- protocol: 'printing',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "cr\x0a\x09\x22no op\x22",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ConsoleTranscript);
- $core.addMethod(
- $core.method({
- selector: "open",
- protocol: 'actions',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "open",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ConsoleTranscript);
- $core.addMethod(
- $core.method({
- selector: "show:",
- protocol: 'printing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- console.log(String($recv(anObject)._asString()));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
- },
- args: ["anObject"],
- 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()))>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ConsoleTranscript);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
- return $core.withContext(function($ctx1) {
- $recv($Transcript())._registerIfNone_(self._new());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.klass)});
- },
- args: [],
- source: "initialize\x0a\x09Transcript registerIfNone: self new",
- referencedClasses: ["Transcript"],
- messageSends: ["registerIfNone:", "new"]
- }),
- $globals.ConsoleTranscript.klass);
- $core.addClass('InterfacingObject', $globals.Object, [], 'Platform-Services');
- $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 }.";
- $core.addMethod(
- $core.method({
- selector: "ajax:",
- protocol: 'actions',
- fn: function (anObject){
- var self=this;
- function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
- return $core.withContext(function($ctx1) {
- var $1;
- self._deprecatedAPI();
- $1=$recv($PlatformInterface())._ajax_(anObject);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.InterfacingObject)});
- },
- args: ["anObject"],
- source: "ajax: anObject\x0a\x09self deprecatedAPI.\x0a\x09^ PlatformInterface ajax: anObject",
- referencedClasses: ["PlatformInterface"],
- messageSends: ["deprecatedAPI", "ajax:"]
- }),
- $globals.InterfacingObject);
- $core.addMethod(
- $core.method({
- selector: "alert:",
- protocol: 'actions',
- fn: function (aString){
- var self=this;
- function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Terminal())._alert_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.InterfacingObject)});
- },
- args: ["aString"],
- source: "alert: aString\x0a\x09^ Terminal alert: aString",
- referencedClasses: ["Terminal"],
- messageSends: ["alert:"]
- }),
- $globals.InterfacingObject);
- $core.addMethod(
- $core.method({
- selector: "confirm:",
- protocol: 'actions',
- fn: function (aString){
- var self=this;
- function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Terminal())._confirm_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.InterfacingObject)});
- },
- args: ["aString"],
- source: "confirm: aString\x0a\x09^ Terminal confirm: aString",
- referencedClasses: ["Terminal"],
- messageSends: ["confirm:"]
- }),
- $globals.InterfacingObject);
- $core.addMethod(
- $core.method({
- selector: "prompt:",
- protocol: 'actions',
- fn: function (aString){
- var self=this;
- function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Terminal())._prompt_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.InterfacingObject)});
- },
- args: ["aString"],
- source: "prompt: aString\x0a\x09^ Terminal prompt: aString",
- referencedClasses: ["Terminal"],
- messageSends: ["prompt:"]
- }),
- $globals.InterfacingObject);
- $core.addMethod(
- $core.method({
- selector: "prompt:default:",
- protocol: 'actions',
- fn: function (aString,defaultString){
- var self=this;
- function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Terminal())._prompt_default_(aString,defaultString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.InterfacingObject)});
- },
- args: ["aString", "defaultString"],
- source: "prompt: aString default: defaultString\x0a\x09^ Terminal prompt: aString default: defaultString",
- referencedClasses: ["Terminal"],
- messageSends: ["prompt:default:"]
- }),
- $globals.InterfacingObject);
- $core.addClass('Environment', $globals.InterfacingObject, [], 'Platform-Services');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "addInstVarNamed:to:",
- protocol: 'compiling',
- fn: function (aString,aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5;
- $1=self._classBuilder();
- $2=$recv(aClass)._superclass();
- $3=$recv(aClass)._name();
- $ctx1.sendIdx["name"]=1;
- $4=$recv($recv(aClass)._instanceVariableNames())._copy();
- $recv($4)._add_(aString);
- $5=$recv($4)._yourself();
- $recv($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$5,$recv($recv(aClass)._package())._name());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},$globals.Environment)});
- },
- args: ["aString", "aClass"],
- 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",
- referencedClasses: [],
- messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "allSelectors",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv($Smalltalk())._core())._allSelectors();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
- },
- args: [],
- source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
- referencedClasses: ["Smalltalk"],
- messageSends: ["allSelectors", "core"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "availableClassNames",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv($Smalltalk())._classes())._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._name();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
- },
- args: [],
- source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
- referencedClasses: ["Smalltalk"],
- messageSends: ["collect:", "classes", "name"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "availablePackageNames",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv($Smalltalk())._packages())._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._name();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
- },
- args: [],
- source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
- referencedClasses: ["Smalltalk"],
- messageSends: ["collect:", "packages", "name"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "availableProtocolsFor:",
- protocol: 'accessing',
- fn: function (aClass){
- var self=this;
- var protocols;
- return $core.withContext(function($ctx1) {
- var $1,$2,$receiver;
- protocols=$recv(aClass)._protocols();
- $1=$recv(aClass)._superclass();
- $ctx1.sendIdx["superclass"]=1;
- if(($receiver = $1) == null || $receiver.isNil){
- $1;
- } else {
- $recv(protocols)._addAll_(self._availableProtocolsFor_($recv(aClass)._superclass()));
- };
- $2=$recv($recv($recv(protocols)._asSet())._asArray())._sort();
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
- },
- args: ["aClass"],
- 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",
- referencedClasses: [],
- messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "classBuilder",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($ClassBuilder())._new();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
- },
- args: [],
- source: "classBuilder\x0a\x09^ ClassBuilder new",
- referencedClasses: ["ClassBuilder"],
- messageSends: ["new"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "classNamed:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=$recv($recv($Smalltalk())._globals())._at_($recv(aString)._asSymbol());
- if(($receiver = $2) == null || $receiver.isNil){
- $1=self._error_("Invalid class name");
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
- },
- args: ["aString"],
- source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
- referencedClasses: ["Smalltalk"],
- messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "classes",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Smalltalk())._classes();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
- },
- args: [],
- source: "classes\x0a\x09^ Smalltalk classes",
- referencedClasses: ["Smalltalk"],
- messageSends: ["classes"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "commitPackage:onSuccess:onError:",
- protocol: 'actions',
- fn: function (aPackage,aBlock,anotherBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
- },
- args: ["aPackage", "aBlock", "anotherBlock"],
- source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
- referencedClasses: [],
- messageSends: ["commitOnSuccess:onError:", "transport"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "compileClassComment:for:",
- protocol: 'compiling',
- fn: function (aString,aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aClass)._comment_(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
- },
- args: ["aString", "aClass"],
- source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
- referencedClasses: [],
- messageSends: ["comment:"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "compileClassDefinition:",
- protocol: 'compiling',
- fn: function (aString){
- var self=this;
- function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return self._evaluate_for_(aString,$recv($DoIt())._new());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._on_do_($Error(),(function(error){
- return $core.withContext(function($ctx2) {
- return self._alert_($recv(error)._messageText());
- }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
- },
- args: ["aString"],
- source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | self alert: error messageText ]",
- referencedClasses: ["DoIt", "Error"],
- messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "compileMethod:for:protocol:",
- protocol: 'compiling',
- fn: function (sourceCode,class_,protocol){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(class_)._compile_protocol_(sourceCode,protocol);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
- },
- args: ["sourceCode", "class", "protocol"],
- source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
- referencedClasses: [],
- messageSends: ["compile:protocol:"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "copyClass:to:",
- protocol: 'actions',
- fn: function (aClass,aClassName){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$receiver;
- $1=$recv($recv($Smalltalk())._globals())._at_(aClassName);
- if(($receiver = $1) == null || $receiver.isNil){
- $1;
- } else {
- $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
- $ctx1.sendIdx[","]=1;
- self._error_($2);
- };
- $recv($recv($ClassBuilder())._new())._copyClass_named_(aClass,aClassName);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
- },
- args: ["aClass", "aClassName"],
- 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",
- referencedClasses: ["Smalltalk", "ClassBuilder"],
- messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "doItReceiver",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($DoIt())._new();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
- },
- args: [],
- source: "doItReceiver\x0a\x09^ DoIt new",
- referencedClasses: ["DoIt"],
- messageSends: ["new"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "evaluate:for:",
- protocol: 'evaluating',
- fn: function (aString,anObject){
- var self=this;
- function $Evaluator(){return $globals.Evaluator||(typeof Evaluator=="undefined"?nil:Evaluator)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Evaluator())._evaluate_for_(aString,anObject);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
- },
- args: ["aString", "anObject"],
- source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
- referencedClasses: ["Evaluator"],
- messageSends: ["evaluate:for:"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "evaluate:on:do:",
- protocol: 'error handling',
- fn: function (aBlock,anErrorClass,exceptionBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $recv(aBlock)._tryCatch_((function(exception){
- return $core.withContext(function($ctx2) {
- $1=$recv(exception)._isKindOf_(self._classNamed_($recv(anErrorClass)._name()));
- if($core.assert($1)){
- return $recv(exceptionBlock)._value_(exception);
- } else {
- return $recv(exception)._resignal();
- };
- }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
- },
- args: ["aBlock", "anErrorClass", "exceptionBlock"],
- 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 ] ]",
- referencedClasses: [],
- messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "resignal"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "inspect:",
- protocol: 'actions',
- fn: function (anObject){
- var self=this;
- function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
- return $core.withContext(function($ctx1) {
- $recv($Inspector())._inspect_(anObject);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
- },
- args: ["anObject"],
- source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
- referencedClasses: ["Inspector"],
- messageSends: ["inspect:"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "moveClass:toPackage:",
- protocol: 'actions',
- fn: function (aClass,aPackageName){
- var self=this;
- var package_;
- function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$receiver;
- package_=$recv($Package())._named_(aPackageName);
- $1=package_;
- if(($receiver = $1) == null || $receiver.isNil){
- self._error_("Invalid package name");
- } else {
- $1;
- };
- $2=$recv(package_).__eq_eq($recv(aClass)._package());
- if($core.assert($2)){
- return self;
- };
- $recv(aClass)._package_(package_);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
- },
- args: ["aClass", "aPackageName"],
- 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",
- referencedClasses: ["Package"],
- messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "moveMethod:toClass:",
- protocol: 'actions',
- fn: function (aMethod,aClassName){
- var self=this;
- var destinationClass;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1,$5,$4;
- destinationClass=self._classNamed_(aClassName);
- $2=destinationClass;
- $3=$recv(aMethod)._methodClass();
- $ctx1.sendIdx["methodClass"]=1;
- $1=$recv($2).__eq_eq($3);
- if($core.assert($1)){
- return self;
- };
- $5=$recv(aMethod)._methodClass();
- $ctx1.sendIdx["methodClass"]=2;
- $4=$recv($5)._isMetaclass();
- if($core.assert($4)){
- destinationClass=$recv(destinationClass)._class();
- destinationClass;
- };
- $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
- $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
- },
- args: ["aMethod", "aClassName"],
- 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",
- referencedClasses: [],
- messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "class", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "moveMethod:toProtocol:",
- protocol: 'actions',
- fn: function (aMethod,aProtocol){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aMethod)._protocol_(aProtocol);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
- },
- args: ["aMethod", "aProtocol"],
- source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol",
- referencedClasses: [],
- messageSends: ["protocol:"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "packages",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Smalltalk())._packages();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
- },
- args: [],
- source: "packages\x0a\x09^ Smalltalk packages",
- referencedClasses: ["Smalltalk"],
- messageSends: ["packages"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "registerErrorHandler:",
- protocol: 'services',
- fn: function (anErrorHandler){
- var self=this;
- function $ErrorHandler(){return $globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
- return $core.withContext(function($ctx1) {
- $recv($ErrorHandler())._register_(anErrorHandler);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
- },
- args: ["anErrorHandler"],
- source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
- referencedClasses: ["ErrorHandler"],
- messageSends: ["register:"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "registerFinder:",
- protocol: 'services',
- fn: function (aFinder){
- var self=this;
- function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
- return $core.withContext(function($ctx1) {
- $recv($Finder())._register_(aFinder);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
- },
- args: ["aFinder"],
- source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
- referencedClasses: ["Finder"],
- messageSends: ["register:"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "registerInspector:",
- protocol: 'services',
- fn: function (anInspector){
- var self=this;
- function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
- return $core.withContext(function($ctx1) {
- $recv($Inspector())._register_(anInspector);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
- },
- args: ["anInspector"],
- source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
- referencedClasses: ["Inspector"],
- messageSends: ["register:"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "registerProgressHandler:",
- protocol: 'services',
- fn: function (aProgressHandler){
- var self=this;
- function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
- return $core.withContext(function($ctx1) {
- $recv($ProgressHandler())._register_(aProgressHandler);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
- },
- args: ["aProgressHandler"],
- source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
- referencedClasses: ["ProgressHandler"],
- messageSends: ["register:"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "registerTranscript:",
- protocol: 'services',
- fn: function (aTranscript){
- var self=this;
- function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
- return $core.withContext(function($ctx1) {
- $recv($Transcript())._register_(aTranscript);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
- },
- args: ["aTranscript"],
- source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
- referencedClasses: ["Transcript"],
- messageSends: ["register:"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "removeClass:",
- protocol: 'actions',
- fn: function (aClass){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- $recv($Smalltalk())._removeClass_(aClass);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
- },
- args: ["aClass"],
- source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
- referencedClasses: ["Smalltalk"],
- messageSends: ["removeClass:"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "removeMethod:",
- protocol: 'actions',
- fn: function (aMethod){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
- },
- args: ["aMethod"],
- source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
- referencedClasses: [],
- messageSends: ["removeCompiledMethod:", "methodClass"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "removeProtocol:from:",
- protocol: 'actions',
- fn: function (aString,aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(aClass)._removeCompiledMethod_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
- },
- args: ["aString", "aClass"],
- source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
- referencedClasses: [],
- messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "renameClass:to:",
- protocol: 'actions',
- fn: function (aClass,aClassName){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$receiver;
- $1=$recv($recv($Smalltalk())._globals())._at_(aClassName);
- if(($receiver = $1) == null || $receiver.isNil){
- $1;
- } else {
- $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
- $ctx1.sendIdx[","]=1;
- self._error_($2);
- };
- $recv($recv($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
- },
- args: ["aClass", "aClassName"],
- 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",
- referencedClasses: ["Smalltalk", "ClassBuilder"],
- messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "renamePackage:to:",
- protocol: 'actions',
- fn: function (aPackageName,aNewPackageName){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$receiver;
- $1=$recv($recv($Smalltalk())._globals())._at_(aNewPackageName);
- if(($receiver = $1) == null || $receiver.isNil){
- $1;
- } else {
- $2=$recv("A package named ".__comma(aNewPackageName)).__comma(" already exists");
- $ctx1.sendIdx[","]=1;
- self._error_($2);
- };
- $recv($Smalltalk())._renamePackage_to_(aPackageName,aNewPackageName);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
- },
- args: ["aPackageName", "aNewPackageName"],
- 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",
- referencedClasses: ["Smalltalk"],
- messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renamePackage:to:"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "renameProtocol:to:in:",
- protocol: 'actions',
- fn: function (aString,anotherString,aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._protocol_(anotherString);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
- },
- args: ["aString", "anotherString", "aClass"],
- source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
- referencedClasses: [],
- messageSends: ["do:", "methodsInProtocol:", "protocol:"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "setClassCommentOf:to:",
- protocol: 'actions',
- fn: function (aClass,aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aClass)._comment_(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
- },
- args: ["aClass", "aString"],
- source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
- referencedClasses: [],
- messageSends: ["comment:"]
- }),
- $globals.Environment);
- $core.addMethod(
- $core.method({
- selector: "systemAnnouncer",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv($recv($Smalltalk())._globals())._at_("SystemAnnouncer"))._current();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
- },
- args: [],
- source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
- referencedClasses: ["Smalltalk"],
- messageSends: ["current", "at:", "globals"]
- }),
- $globals.Environment);
- $core.addClass('NullProgressHandler', $globals.Object, [], 'Platform-Services');
- $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
- $core.addMethod(
- $core.method({
- selector: "do:on:displaying:",
- protocol: 'progress handling',
- fn: function (aBlock,aCollection,aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aCollection)._do_(aBlock);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
- },
- args: ["aBlock", "aCollection", "aString"],
- source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
- referencedClasses: [],
- messageSends: ["do:"]
- }),
- $globals.NullProgressHandler);
- $globals.NullProgressHandler.klass.iVarNames = ['current'];
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
- return $core.withContext(function($ctx1) {
- $recv($ProgressHandler())._registerIfNone_(self._new());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.klass)});
- },
- args: [],
- source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
- referencedClasses: ["ProgressHandler"],
- messageSends: ["registerIfNone:", "new"]
- }),
- $globals.NullProgressHandler.klass);
- $core.addClass('PlatformInterface', $globals.Object, [], 'Platform-Services');
- $globals.PlatformInterface.comment="Deprecated. Use `Platform` or `Terminal`.";
- $core.addMethod(
- $core.method({
- selector: "ajax:",
- protocol: 'actions',
- fn: function (anObject){
- var self=this;
- function $JQuery(){return $globals.JQuery||(typeof JQuery=="undefined"?nil:JQuery)}
- return $core.withContext(function($ctx1) {
- var $1,$receiver;
- self._deprecatedAPI_("Use Platform newXhr or dedicated library.");
- if(($receiver = $JQuery()) == null || $receiver.isNil){
- $1=self._error_("JQuery wrapper not loaded, cannot do AJAX.");
- } else {
- $1=$recv($recv($JQuery())._current())._ajax_(anObject);
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.PlatformInterface.klass)});
- },
- args: ["anObject"],
- 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.' ]",
- referencedClasses: ["JQuery"],
- messageSends: ["deprecatedAPI:", "ifNotNil:ifNil:", "ajax:", "current", "error:"]
- }),
- $globals.PlatformInterface.klass);
- $core.addMethod(
- $core.method({
- selector: "alert:",
- protocol: 'actions',
- fn: function (aString){
- var self=this;
- function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
- return $core.withContext(function($ctx1) {
- var $1;
- self._deprecatedAPI_("Use Terminal alert:");
- $1=$recv($Terminal())._alert_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.PlatformInterface.klass)});
- },
- args: ["aString"],
- source: "alert: aString\x0a\x09self deprecatedAPI: 'Use Terminal alert:'.\x0a\x09^ Terminal alert: aString",
- referencedClasses: ["Terminal"],
- messageSends: ["deprecatedAPI:", "alert:"]
- }),
- $globals.PlatformInterface.klass);
- $core.addMethod(
- $core.method({
- selector: "confirm:",
- protocol: 'actions',
- fn: function (aString){
- var self=this;
- function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
- return $core.withContext(function($ctx1) {
- var $1;
- self._deprecatedAPI_("Use Terminal confirm:");
- $1=$recv($Terminal())._confirm_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.PlatformInterface.klass)});
- },
- args: ["aString"],
- source: "confirm: aString\x0a\x09self deprecatedAPI: 'Use Terminal confirm:'.\x0a\x09^ Terminal confirm: aString",
- referencedClasses: ["Terminal"],
- messageSends: ["deprecatedAPI:", "confirm:"]
- }),
- $globals.PlatformInterface.klass);
- $core.addMethod(
- $core.method({
- selector: "existsGlobal:",
- protocol: 'actions',
- fn: function (aString){
- var self=this;
- function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
- return $core.withContext(function($ctx1) {
- var $1;
- self._deprecatedAPI_("Use Smalltalk existsJsGlobal:");
- $1=$recv($recv($PlatformInterface())._globals())._at_ifPresent_ifAbsent_(aString,(function(){
- return true;
- }),(function(){
- return false;
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"existsGlobal:",{aString:aString},$globals.PlatformInterface.klass)});
- },
- args: ["aString"],
- 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 ]",
- referencedClasses: ["PlatformInterface"],
- messageSends: ["deprecatedAPI:", "at:ifPresent:ifAbsent:", "globals"]
- }),
- $globals.PlatformInterface.klass);
- $core.addMethod(
- $core.method({
- selector: "globals",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
- return $core.withContext(function($ctx1) {
- var $1;
- self._deprecatedAPI_("Use Platform globals");
- $1=$recv($Platform())._globals();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.PlatformInterface.klass)});
- },
- args: [],
- source: "globals\x0a\x09self deprecatedAPI: 'Use Platform globals'.\x0a\x09^ Platform globals",
- referencedClasses: ["Platform"],
- messageSends: ["deprecatedAPI:", "globals"]
- }),
- $globals.PlatformInterface.klass);
- $core.addMethod(
- $core.method({
- selector: "newXhr",
- protocol: 'actions',
- fn: function (){
- var self=this;
- function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
- return $core.withContext(function($ctx1) {
- var $1;
- self._deprecatedAPI_("Use Platform newXhr");
- $1=$recv($Platform())._newXhr();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.PlatformInterface.klass)});
- },
- args: [],
- source: "newXhr\x0a\x09self deprecatedAPI: 'Use Platform newXhr'.\x0a\x09^ Platform newXhr",
- referencedClasses: ["Platform"],
- messageSends: ["deprecatedAPI:", "newXhr"]
- }),
- $globals.PlatformInterface.klass);
- $core.addMethod(
- $core.method({
- selector: "prompt:",
- protocol: 'actions',
- fn: function (aString){
- var self=this;
- function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
- return $core.withContext(function($ctx1) {
- var $1;
- self._deprecatedAPI_("Use Terminal prompt:");
- $1=$recv($Terminal())._prompt_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.PlatformInterface.klass)});
- },
- args: ["aString"],
- source: "prompt: aString\x0a\x09self deprecatedAPI: 'Use Terminal prompt:'.\x0a\x09^ Terminal prompt: aString",
- referencedClasses: ["Terminal"],
- messageSends: ["deprecatedAPI:", "prompt:"]
- }),
- $globals.PlatformInterface.klass);
- $core.addMethod(
- $core.method({
- selector: "prompt:default:",
- protocol: 'actions',
- fn: function (aString,defaultString){
- var self=this;
- function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
- return $core.withContext(function($ctx1) {
- var $1;
- self._deprecatedAPI_("Use Terminal prompt:default:");
- $1=$recv($Terminal())._prompt_default_(aString,defaultString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.PlatformInterface.klass)});
- },
- args: ["aString", "defaultString"],
- source: "prompt: aString default: defaultString\x0a\x09self deprecatedAPI: 'Use Terminal prompt:default:'.\x0a\x09^ Terminal prompt: aString default: defaultString",
- referencedClasses: ["Terminal"],
- messageSends: ["deprecatedAPI:", "prompt:default:"]
- }),
- $globals.PlatformInterface.klass);
- $core.addClass('Service', $globals.Object, [], 'Platform-Services');
- $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.";
- $globals.Service.klass.iVarNames = ['current'];
- $core.addMethod(
- $core.method({
- selector: "current",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@current"];
- return $1;
- },
- args: [],
- source: "current\x0a\x09^ current",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Service.klass);
- $core.addMethod(
- $core.method({
- selector: "new",
- protocol: 'instance creation',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._shouldNotImplement();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.klass)});
- },
- args: [],
- source: "new\x0a\x09self shouldNotImplement",
- referencedClasses: [],
- messageSends: ["shouldNotImplement"]
- }),
- $globals.Service.klass);
- $core.addMethod(
- $core.method({
- selector: "register:",
- protocol: 'registration',
- fn: function (anObject){
- var self=this;
- self["@current"]=anObject;
- return self;
- },
- args: ["anObject"],
- source: "register: anObject\x0a\x09current := anObject",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Service.klass);
- $core.addMethod(
- $core.method({
- selector: "registerIfNone:",
- protocol: 'registration',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$receiver;
- $1=self._current();
- if(($receiver = $1) == null || $receiver.isNil){
- self._register_(anObject);
- } else {
- $1;
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.klass)});
- },
- args: ["anObject"],
- source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
- referencedClasses: [],
- messageSends: ["ifNil:", "current", "register:"]
- }),
- $globals.Service.klass);
- $core.addClass('ErrorHandler', $globals.Service, [], 'Platform-Services');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "handleError:",
- protocol: 'error handling',
- fn: function (anError){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._handleUnhandledError_(anError);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.klass)});
- },
- args: ["anError"],
- source: "handleError: anError\x0a\x09self handleUnhandledError: anError",
- referencedClasses: [],
- messageSends: ["handleUnhandledError:"]
- }),
- $globals.ErrorHandler.klass);
- $core.addMethod(
- $core.method({
- selector: "handleUnhandledError:",
- protocol: 'error handling',
- fn: function (anError){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=$recv(anError)._wasHandled();
- if($core.assert($1)){
- return self;
- };
- $2=$recv(self._current())._handleError_(anError);
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.klass)});
- },
- args: ["anError"],
- source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifTrue: [ ^ self ].\x0a\x09\x0a\x09^ self current handleError: anError",
- referencedClasses: [],
- messageSends: ["ifTrue:", "wasHandled", "handleError:", "current"]
- }),
- $globals.ErrorHandler.klass);
- $core.addClass('Finder', $globals.Service, [], 'Platform-Services');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "findClass:",
- protocol: 'finding',
- fn: function (aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._current())._findClass_(aClass);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.klass)});
- },
- args: ["aClass"],
- source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
- referencedClasses: [],
- messageSends: ["findClass:", "current"]
- }),
- $globals.Finder.klass);
- $core.addMethod(
- $core.method({
- selector: "findMethod:",
- protocol: 'finding',
- fn: function (aCompiledMethod){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._current())._findMethod_(aCompiledMethod);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.klass)});
- },
- args: ["aCompiledMethod"],
- source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
- referencedClasses: [],
- messageSends: ["findMethod:", "current"]
- }),
- $globals.Finder.klass);
- $core.addMethod(
- $core.method({
- selector: "findString:",
- protocol: 'finding',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._current())._findString_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.klass)});
- },
- args: ["aString"],
- source: "findString: aString\x0a\x09^ self current findString: aString",
- referencedClasses: [],
- messageSends: ["findString:", "current"]
- }),
- $globals.Finder.klass);
- $core.addClass('Inspector', $globals.Service, [], 'Platform-Services');
- $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
- $core.addMethod(
- $core.method({
- selector: "inspect:",
- protocol: 'inspecting',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._current())._inspect_(anObject);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.klass)});
- },
- args: ["anObject"],
- source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
- referencedClasses: [],
- messageSends: ["inspect:", "current"]
- }),
- $globals.Inspector.klass);
- $core.addClass('Platform', $globals.Service, [], 'Platform-Services');
- $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";
- $core.addMethod(
- $core.method({
- selector: "globals",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._current())._globals();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.klass)});
- },
- args: [],
- source: "globals\x0a\x09^ self current globals",
- referencedClasses: [],
- messageSends: ["globals", "current"]
- }),
- $globals.Platform.klass);
- $core.addMethod(
- $core.method({
- selector: "newXhr",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._current())._newXhr();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.klass)});
- },
- args: [],
- source: "newXhr\x0a\x09^ self current newXhr",
- referencedClasses: [],
- messageSends: ["newXhr", "current"]
- }),
- $globals.Platform.klass);
- $core.addClass('ProgressHandler', $globals.Service, [], 'Platform-Services');
- $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`.";
- $core.addMethod(
- $core.method({
- selector: "do:on:displaying:",
- protocol: 'progress handling',
- fn: function (aBlock,aCollection,aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._current())._do_on_displaying_(aBlock,aCollection,aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.klass)});
- },
- args: ["aBlock", "aCollection", "aString"],
- source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
- referencedClasses: [],
- messageSends: ["do:on:displaying:", "current"]
- }),
- $globals.ProgressHandler.klass);
- $core.addClass('Terminal', $globals.Service, [], 'Platform-Services');
- $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:'.";
- $core.addMethod(
- $core.method({
- selector: "alert:",
- protocol: 'dialogs',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._current())._alert_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.klass)});
- },
- args: ["aString"],
- source: "alert: aString\x0a\x09^ self current alert: aString",
- referencedClasses: [],
- messageSends: ["alert:", "current"]
- }),
- $globals.Terminal.klass);
- $core.addMethod(
- $core.method({
- selector: "confirm:",
- protocol: 'dialogs',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._current())._confirm_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.klass)});
- },
- args: ["aString"],
- source: "confirm: aString\x0a\x09^ self current confirm: aString",
- referencedClasses: [],
- messageSends: ["confirm:", "current"]
- }),
- $globals.Terminal.klass);
- $core.addMethod(
- $core.method({
- selector: "prompt:",
- protocol: 'dialogs',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._current())._prompt_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.klass)});
- },
- args: ["aString"],
- source: "prompt: aString\x0a\x09^ self current prompt: aString",
- referencedClasses: [],
- messageSends: ["prompt:", "current"]
- }),
- $globals.Terminal.klass);
- $core.addMethod(
- $core.method({
- selector: "prompt:default:",
- protocol: 'dialogs',
- fn: function (aString,defaultString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._current())._prompt_default_(aString,defaultString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.klass)});
- },
- args: ["aString", "defaultString"],
- source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
- referencedClasses: [],
- messageSends: ["prompt:default:", "current"]
- }),
- $globals.Terminal.klass);
- $core.addClass('Transcript', $globals.Service, [], 'Platform-Services');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "clear",
- protocol: 'printing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._current())._clear();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.klass)});
- },
- args: [],
- source: "clear\x0a\x09self current clear",
- referencedClasses: [],
- messageSends: ["clear", "current"]
- }),
- $globals.Transcript.klass);
- $core.addMethod(
- $core.method({
- selector: "cr",
- protocol: 'printing',
- fn: function (){
- var self=this;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $core.withContext(function($ctx1) {
- $recv(self._current())._show_($recv($String())._cr());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.klass)});
- },
- args: [],
- source: "cr\x0a\x09self current show: String cr",
- referencedClasses: ["String"],
- messageSends: ["show:", "current", "cr"]
- }),
- $globals.Transcript.klass);
- $core.addMethod(
- $core.method({
- selector: "inspect:",
- protocol: 'printing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._show_(anObject);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.klass)});
- },
- args: ["anObject"],
- source: "inspect: anObject\x0a\x09self show: anObject",
- referencedClasses: [],
- messageSends: ["show:"]
- }),
- $globals.Transcript.klass);
- $core.addMethod(
- $core.method({
- selector: "open",
- protocol: 'instance creation',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._current())._open();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.klass)});
- },
- args: [],
- source: "open\x0a\x09self current open",
- referencedClasses: [],
- messageSends: ["open", "current"]
- }),
- $globals.Transcript.klass);
- $core.addMethod(
- $core.method({
- selector: "show:",
- protocol: 'printing',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._current())._show_(anObject);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.klass)});
- },
- args: ["anObject"],
- source: "show: anObject\x0a\x09self current show: anObject",
- referencedClasses: [],
- messageSends: ["show:", "current"]
- }),
- $globals.Transcript.klass);
- $core.addMethod(
- $core.method({
- selector: "inspectOn:",
- protocol: '*Platform-Services',
- fn: function (anInspector){
- var self=this;
- var variables;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return $core.withContext(function($ctx1) {
- var $1;
- variables=$recv($Dictionary())._new();
- $recv(variables)._at_put_("#self",self);
- $ctx1.sendIdx["at:put:"]=1;
- $recv(variables)._at_put_("#keys",self._keys());
- $ctx1.sendIdx["at:put:"]=2;
- self._keysAndValuesDo_((function(key,value){
- return $core.withContext(function($ctx2) {
- return $recv(variables)._at_put_(key,value);
- }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
- }));
- $recv(anInspector)._setLabel_(self._printString());
- $1=$recv(anInspector)._setVariables_(variables);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
- },
- args: ["anInspector"],
- 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",
- referencedClasses: ["Dictionary"],
- messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
- }),
- $globals.AssociativeCollection);
- $core.addMethod(
- $core.method({
- selector: "inspectOn:",
- protocol: '*Platform-Services',
- fn: function (anInspector){
- var self=this;
- var variables;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return $core.withContext(function($ctx1) {
- var $1;
- variables=$recv($Dictionary())._new();
- $recv(variables)._at_put_("#self",self);
- $ctx1.sendIdx["at:put:"]=1;
- self._withIndexDo_((function(each,i){
- return $core.withContext(function($ctx2) {
- return $recv(variables)._at_put_(i,each);
- }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
- }));
- $recv(anInspector)._setLabel_(self._printString());
- $1=$recv(anInspector)._setVariables_(variables);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
- },
- args: ["anInspector"],
- 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",
- referencedClasses: ["Dictionary"],
- messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
- }),
- $globals.Collection);
- $core.addMethod(
- $core.method({
- selector: "inspectOn:",
- protocol: '*Platform-Services',
- fn: function (anInspector){
- var self=this;
- var variables;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return $core.withContext(function($ctx1) {
- var $1;
- variables=$recv($Dictionary())._new();
- $recv(variables)._at_put_("#self",self);
- $ctx1.sendIdx["at:put:"]=1;
- $recv(variables)._at_put_("#year",self._year());
- $ctx1.sendIdx["at:put:"]=2;
- $recv(variables)._at_put_("#month",self._month());
- $ctx1.sendIdx["at:put:"]=3;
- $recv(variables)._at_put_("#day",self._day());
- $ctx1.sendIdx["at:put:"]=4;
- $recv(variables)._at_put_("#hours",self._hours());
- $ctx1.sendIdx["at:put:"]=5;
- $recv(variables)._at_put_("#minutes",self._minutes());
- $ctx1.sendIdx["at:put:"]=6;
- $recv(variables)._at_put_("#seconds",self._seconds());
- $ctx1.sendIdx["at:put:"]=7;
- $recv(variables)._at_put_("#milliseconds",self._milliseconds());
- $recv(anInspector)._setLabel_(self._printString());
- $1=$recv(anInspector)._setVariables_(variables);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
- },
- args: ["anInspector"],
- 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",
- referencedClasses: ["Dictionary"],
- messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
- }),
- $globals.Date);
- $core.addMethod(
- $core.method({
- selector: "inspectOn:",
- protocol: '*Platform-Services',
- fn: function (anInspector){
- var self=this;
- var variables;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
- return $core.withContext(function($ctx1) {
- variables=$recv($Dictionary())._new();
- $recv(variables)._at_put_("#self",self._jsObject());
- $recv(anInspector)._setLabel_(self._printString());
- $recv($JSObjectProxy())._addObjectVariablesTo_ofProxy_(variables,self);
- $recv(anInspector)._setVariables_(variables);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
- },
- args: ["anInspector"],
- 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",
- referencedClasses: ["Dictionary", "JSObjectProxy"],
- messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
- }),
- $globals.JSObjectProxy);
- $core.addMethod(
- $core.method({
- selector: "inspectOn:",
- protocol: '*Platform-Services',
- fn: function (anInspector){
- var self=this;
- var variables;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return $core.withContext(function($ctx1) {
- var $1;
- variables=$recv($Dictionary())._new();
- $recv(variables)._at_put_("#self",self);
- $ctx1.sendIdx["at:put:"]=1;
- $recv(variables)._at_put_("#home",self._home());
- $ctx1.sendIdx["at:put:"]=2;
- $recv(variables)._at_put_("#receiver",self._receiver());
- $ctx1.sendIdx["at:put:"]=3;
- $recv(variables)._at_put_("#selector",self._selector());
- $ctx1.sendIdx["at:put:"]=4;
- $recv(variables)._at_put_("#locals",self._locals());
- $ctx1.sendIdx["at:put:"]=5;
- $recv($recv(self._class())._instanceVariableNames())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(variables)._at_put_(each,self._instVarAt_(each));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $recv(anInspector)._setLabel_(self._printString());
- $1=$recv(anInspector)._setVariables_(variables);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
- },
- args: ["anInspector"],
- 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",
- referencedClasses: ["Dictionary"],
- messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
- }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "inspectOn:",
- protocol: '*Platform-Services',
- fn: function (anInspector){
- var self=this;
- var variables;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return $core.withContext(function($ctx1) {
- var $1;
- variables=$recv($Dictionary())._new();
- $recv(variables)._at_put_("#self",self);
- $ctx1.sendIdx["at:put:"]=1;
- $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(variables)._at_put_(each,self._instVarAt_(each));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $recv(anInspector)._setLabel_(self._printString());
- $1=$recv(anInspector)._setVariables_(variables);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
- },
- args: ["anInspector"],
- 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",
- referencedClasses: ["Dictionary"],
- messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
- }),
- $globals.Object);
- $core.addMethod(
- $core.method({
- selector: "do:displayingProgress:",
- protocol: '*Platform-Services',
- fn: function (aBlock,aString){
- var self=this;
- function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
- return $core.withContext(function($ctx1) {
- $recv($ProgressHandler())._do_on_displaying_(aBlock,self,aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
- },
- args: ["aBlock", "aString"],
- source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
- referencedClasses: ["ProgressHandler"],
- messageSends: ["do:on:displaying:"]
- }),
- $globals.SequenceableCollection);
- $core.addMethod(
- $core.method({
- selector: "inspectOn:",
- protocol: '*Platform-Services',
- fn: function (anInspector){
- var self=this;
- var variables,i;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return $core.withContext(function($ctx1) {
- var $1;
- variables=$recv($Dictionary())._new();
- $recv(variables)._at_put_("#self",self);
- $ctx1.sendIdx["at:put:"]=1;
- i=(1);
- self._do_((function(each){
- return $core.withContext(function($ctx2) {
- $recv(variables)._at_put_(i,each);
- i=$recv(i).__plus((1));
- return i;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $recv(anInspector)._setLabel_(self._printString());
- $1=$recv(anInspector)._setVariables_(variables);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
- },
- args: ["anInspector"],
- 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",
- referencedClasses: ["Dictionary"],
- messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
- }),
- $globals.Set);
- $core.addMethod(
- $core.method({
- selector: "inspectOn:",
- protocol: '*Platform-Services',
- fn: function (anInspector){
- var self=this;
- var label;
- return $core.withContext(function($ctx1) {
- var $3,$2,$1,$5,$4;
- (
- $ctx1.supercall = true,
- $globals.String.superclass.fn.prototype._inspectOn_.apply($recv(self), [anInspector]));
- $ctx1.supercall = false;
- $3=self._printString();
- $ctx1.sendIdx["printString"]=1;
- $2=$recv($3)._size();
- $1=$recv($2).__gt((30));
- if($core.assert($1)){
- $5=self._printString();
- $ctx1.sendIdx["printString"]=2;
- $4=$recv($5)._copyFrom_to_((1),(30));
- label=$recv($4).__comma("...'");
- label;
- } else {
- label=self._printString();
- label;
- };
- $recv(anInspector)._setLabel_(label);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
- },
- args: ["anInspector"],
- 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",
- referencedClasses: [],
- messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
- }),
- $globals.String);
- });
- define("amber_core/Platform-Node", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
- var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
- $core.addPackage('Platform-Node');
- $core.packages["Platform-Node"].innerEval = function (expr) { return eval(expr); };
- $core.packages["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
- $core.addClass('NodePlatform', $globals.Object, [], 'Platform-Node');
- $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
- $core.addMethod(
- $core.method({
- selector: "globals",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=global;
- return $1;
- },
- args: [],
- source: "globals\x0a\x09^ global",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NodePlatform);
- $core.addMethod(
- $core.method({
- selector: "newXhr",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $XMLHttpRequest(){return $globals.XMLHttpRequest||(typeof XMLHttpRequest=="undefined"?nil:XMLHttpRequest)}
- return $core.withContext(function($ctx1) {
- var $1,$receiver;
- if(($receiver = $XMLHttpRequest()) == null || $receiver.isNil){
- self._error_("XMLHttpRequest not available.");
- } else {
- $1=$recv($XMLHttpRequest())._new();
- return $1;
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
- },
- args: [],
- source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
- referencedClasses: ["XMLHttpRequest"],
- messageSends: ["ifNotNil:ifNil:", "new", "error:"]
- }),
- $globals.NodePlatform);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'testing',
- fn: function (){
- var self=this;
- function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._isFeasible();
- if($core.assert($1)){
- $recv($Platform())._registerIfNone_(self._new());
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.klass)});
- },
- args: [],
- source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
- referencedClasses: ["Platform"],
- messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
- }),
- $globals.NodePlatform.klass);
- $core.addMethod(
- $core.method({
- selector: "isFeasible",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return typeof global !== "undefined";
- return self;
- }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.klass)});
- },
- args: [],
- source: "isFeasible\x0a<return typeof global !== \x22undefined\x22>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.NodePlatform.klass);
- });
- define('amber/deploy',[
- './helpers',
- // --- packages of the core Amber begin here ---
- 'amber_core/Kernel-Objects',
- 'amber_core/Kernel-Classes',
- 'amber_core/Kernel-Methods',
- 'amber_core/Kernel-Collections',
- 'amber_core/Kernel-Infrastructure',
- 'amber_core/Kernel-Exceptions',
- 'amber_core/Kernel-Announcements',
- 'amber_core/Platform-Services',
- 'amber/Platform'
- // --- packages of the core Amber end here ---
- ], function (amber) { return amber; });
- define("amber/parser", ["./boot"], function($boot) {
- var $globals = $boot.globals, nil = $boot.nil;
- $globals.SmalltalkParser = (function() {
- /*
- * Generated by PEG.js 0.8.0.
- *
- * http://pegjs.majda.cz/
- */
- function peg$subclass(child, parent) {
- function ctor() { this.constructor = child; }
- ctor.prototype = parent.prototype;
- child.prototype = new ctor();
- }
- function SyntaxError(message, expected, found, offset, line, column) {
- this.message = message;
- this.expected = expected;
- this.found = found;
- this.offset = offset;
- this.line = line;
- this.column = column;
- this.name = "SyntaxError";
- }
- peg$subclass(SyntaxError, Error);
- function parse(input) {
- var options = arguments.length > 1 ? arguments[1] : {},
- peg$FAILED = {},
- peg$startRuleFunctions = { start: peg$parsestart },
- peg$startRuleFunction = peg$parsestart,
- peg$c0 = [],
- peg$c1 = peg$FAILED,
- peg$c2 = /^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/,
- peg$c3 = { type: "class", value: "[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]", description: "[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]" },
- peg$c4 = "\"",
- peg$c5 = { type: "literal", value: "\"", description: "\"\\\"\"" },
- peg$c6 = /^[^"]/,
- peg$c7 = { type: "class", value: "[^\"]", description: "[^\"]" },
- peg$c8 = /^[a-zA-Z]/,
- peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
- peg$c10 = /^[a-zA-Z0-9]/,
- peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
- peg$c12 = function(first, others) {return first + others.join("");},
- peg$c13 = ":",
- peg$c14 = { type: "literal", value: ":", description: "\":\"" },
- peg$c15 = function(first, last) {return first + last;},
- peg$c16 = /^[a-zA-Z0-9:]/,
- peg$c17 = { type: "class", value: "[a-zA-Z0-9:]", description: "[a-zA-Z0-9:]" },
- peg$c18 = /^[A-Z]/,
- peg$c19 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
- peg$c20 = "'",
- peg$c21 = { type: "literal", value: "'", description: "\"'\"" },
- peg$c22 = "''",
- peg$c23 = { type: "literal", value: "''", description: "\"''\"" },
- peg$c24 = function() {return "'";},
- peg$c25 = /^[^']/,
- peg$c26 = { type: "class", value: "[^']", description: "[^']" },
- peg$c27 = function(val) {
- return $globals.ValueNode._new()
- ._position_((line()).__at(column()))
- ._source_(text())
- ._value_(val.join(""));
- },
- peg$c28 = "$",
- peg$c29 = { type: "literal", value: "$", description: "\"$\"" },
- peg$c30 = { type: "any", description: "any character" },
- peg$c31 = function(char) {
- return $globals.ValueNode._new()
- ._position_((line()).__at(column()))
- ._source_(text())
- ._value_(char);
- },
- peg$c32 = "#",
- peg$c33 = { type: "literal", value: "#", description: "\"#\"" },
- peg$c34 = function(rest) {return rest;},
- peg$c35 = function(node) {return node._value();},
- peg$c36 = function(val) {
- return $globals.ValueNode._new()
- ._position_((line()).__at(column()))
- ._source_(text())
- ._value_(val);
- },
- peg$c37 = function(n) {
- return $globals.ValueNode._new()
- ._position_((line()).__at(column()))
- ._source_(text())
- ._value_(n);
- },
- peg$c38 = "e",
- peg$c39 = { type: "literal", value: "e", description: "\"e\"" },
- peg$c40 = function(n) {return parseFloat(n.join(""));},
- peg$c41 = null,
- peg$c42 = "-",
- peg$c43 = { type: "literal", value: "-", description: "\"-\"" },
- peg$c44 = "16r",
- peg$c45 = { type: "literal", value: "16r", description: "\"16r\"" },
- peg$c46 = /^[0-9a-fA-F]/,
- peg$c47 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
- peg$c48 = function(neg, num) {return parseInt(((neg || '') + num.join("")), 16);},
- peg$c49 = /^[0-9]/,
- peg$c50 = { type: "class", value: "[0-9]", description: "[0-9]" },
- peg$c51 = ".",
- peg$c52 = { type: "literal", value: ".", description: "\".\"" },
- peg$c53 = function(neg, digits, dec) {return parseFloat(((neg || '') + digits.join("") + "." + dec.join("")), 10);},
- peg$c54 = function(neg, digits) {return (parseInt((neg || '') + digits.join(""), 10));},
- peg$c55 = "#(",
- peg$c56 = { type: "literal", value: "#(", description: "\"#(\"" },
- peg$c57 = "(",
- peg$c58 = { type: "literal", value: "(", description: "\"(\"" },
- peg$c59 = function(lit) {return lit._value();},
- peg$c60 = ")",
- peg$c61 = { type: "literal", value: ")", description: "\")\"" },
- peg$c62 = function(lits) {
- return $globals.ValueNode._new()
- ._position_((line()).__at(column()))
- ._source_(text())
- ._value_(lits);
- },
- peg$c63 = "{",
- peg$c64 = { type: "literal", value: "{", description: "\"{\"" },
- peg$c65 = "}",
- peg$c66 = { type: "literal", value: "}", description: "\"}\"" },
- peg$c67 = function(expressions) {
- return $globals.DynamicArrayNode._new()
- ._position_((line()).__at(column()))
- ._source_(text())
- ._nodes_(expressions || []);
- },
- peg$c68 = "#{",
- peg$c69 = { type: "literal", value: "#{", description: "\"#{\"" },
- peg$c70 = function(expressions) {
- return $globals.DynamicDictionaryNode._new()
- ._position_((line()).__at(column()))
- ._source_(text())
- ._nodes_(expressions || []);
- },
- peg$c71 = "true",
- peg$c72 = { type: "literal", value: "true", description: "\"true\"" },
- peg$c73 = function() {return true;},
- peg$c74 = "false",
- peg$c75 = { type: "literal", value: "false", description: "\"false\"" },
- peg$c76 = function() {return false;},
- peg$c77 = "nil",
- peg$c78 = { type: "literal", value: "nil", description: "\"nil\"" },
- peg$c79 = function() {return nil;},
- peg$c80 = function(val) {
- return $globals.ValueNode._new()
- ._position_((line()).__at(column()))
- ._source_(text())
- ._value_(val);
- },
- peg$c81 = function(identifier) {
- return $globals.VariableNode._new()
- ._position_((line()).__at(column()))
- ._source_(text())
- ._value_(identifier);
- },
- peg$c82 = function(key, arg) {return {key:key, arg:arg};},
- peg$c83 = /^[\\+*\/=><,@%~|&\-]/,
- peg$c84 = { type: "class", value: "[\\\\+*\\/=><,@%~|&\\-]", description: "[\\\\+*\\/=><,@%~|&\\-]" },
- peg$c85 = function(bin) {return bin.join("");},
- peg$c86 = function(pairs) {
- var keywords = [];
- var params = [];
- var i = 0;
- for(i = 0; i < pairs.length; i++){
- keywords.push(pairs[i].key);
- }
- for(i = 0; i < pairs.length; i++){
- params.push(pairs[i].arg);
- }
- return [keywords.join(""), params];
- },
- peg$c87 = function(selector, arg) {return [selector, [arg]];},
- peg$c88 = function(selector) {return [selector, []];},
- peg$c89 = function(expression) {return expression;},
- peg$c90 = function(first, others) { return [first].concat(others); },
- peg$c91 = ":=",
- peg$c92 = { type: "literal", value: ":=", description: "\":=\"" },
- peg$c93 = function(variable, expression) {
- return $globals.AssignmentNode._new()
- ._position_((line()).__at(column()))
- ._source_(text())
- ._left_(variable)
- ._right_(expression);
- },
- peg$c94 = "^",
- peg$c95 = { type: "literal", value: "^", description: "\"^\"" },
- peg$c96 = function(expression) {
- return $globals.ReturnNode._new()
- ._position_((line()).__at(column()))
- ._source_(text())
- ._nodes_([expression]);
- },
- peg$c97 = "|",
- peg$c98 = { type: "literal", value: "|", description: "\"|\"" },
- peg$c99 = function(variable) {return variable;},
- peg$c100 = function(vars) {return vars;},
- peg$c101 = function(param) {return param;},
- peg$c102 = function(params) {return params;},
- peg$c103 = function(ret) {return [ret];},
- peg$c104 = function(exps, ret) {
- var expressions = exps;
- expressions.push(ret);
- return expressions;
- },
- peg$c105 = function(expressions) {
- return expressions || [];
- },
- peg$c106 = function(temps, statements) {
- return $globals.SequenceNode._new()
- ._position_((line()).__at(column()))
- ._source_(text())
- ._temps_(temps || [])
- ._nodes_(statements || []);
- },
- peg$c107 = "[",
- peg$c108 = { type: "literal", value: "[", description: "\"[\"" },
- peg$c109 = "]",
- peg$c110 = { type: "literal", value: "]", description: "\"]\"" },
- peg$c111 = function(params, sequence) {
- return $globals.BlockNode._new()
- ._position_((line()).__at(column()))
- ._source_(text())
- ._parameters_(params || [])
- ._nodes_([sequence._asBlockSequenceNode()]);
- },
- peg$c112 = void 0,
- peg$c113 = function(selector) {
- return $globals.SendNode._new()
- ._position_((line()).__at(column()))
- ._source_(text())
- ._selector_(selector);
- },
- peg$c114 = function(message, tail) {
- if(tail) {
- return tail._valueForReceiver_(message);
- }
- else {
- return message;
- }
- },
- peg$c115 = function(receiver, tail) {
- if(tail) {
- return tail._valueForReceiver_(receiver);
- }
- else {
- return receiver;
- }
- },
- peg$c116 = function(selector, arg) {
- return $globals.SendNode._new()
- ._position_((line()).__at(column()))
- ._source_(text())
- ._selector_(selector)
- ._arguments_([arg]);
- },
- peg$c117 = function(message, tail) {
- if(tail) {
- return tail._valueForReceiver_(message);
- }
- else {
- return message;
- }
- },
- peg$c118 = function(pairs) {
- var selector = [];
- var args = [];
- for(var i = 0; i < pairs.length; i++) {
- selector.push(pairs[i].key);
- args.push(pairs[i].arg);
- }
- return $globals.SendNode._new()
- ._position_((line()).__at(column()))
- ._source_(text())
- ._selector_(selector.join(""))
- ._arguments_(args);
- },
- peg$c119 = function(receiver, tail) {
- return tail._valueForReceiver_(receiver);
- },
- peg$c120 = ";",
- peg$c121 = { type: "literal", value: ";", description: "\";\"" },
- peg$c122 = function(mess) {return mess;},
- peg$c123 = function(send, messages) {
- var cascade = [];
- cascade.push(send);
- for(var i = 0; i < messages.length; i++) {
- cascade.push(messages[i]);
- }
- return $globals.CascadeNode._new()
- ._position_((line()).__at(column()))
- ._source_(text())
- ._receiver_(send._receiver())
- ._nodes_(cascade);
- },
- peg$c124 = "<",
- peg$c125 = { type: "literal", value: "<", description: "\"<\"" },
- peg$c126 = ">>",
- peg$c127 = { type: "literal", value: ">>", description: "\">>\"" },
- peg$c128 = function() {return ">";},
- peg$c129 = /^[^>]/,
- peg$c130 = { type: "class", value: "[^>]", description: "[^>]" },
- peg$c131 = ">",
- peg$c132 = { type: "literal", value: ">", description: "\">\"" },
- peg$c133 = function(val) {
- return $globals.JSStatementNode._new()
- ._position_((line()).__at(column()))
- ._source_(val.join(""))
- },
- peg$c134 = function(pattern, sequence) {
- return $globals.MethodNode._new()
- ._position_((line()).__at(column()))
- ._source_(text())
- ._selector_(pattern[0])
- ._arguments_(pattern[1])
- ._nodes_([sequence]);
- },
- peg$c135 = function(send) { return send._selector() === "->" },
- peg$c136 = function(send) { return [send._receiver(), send._arguments()[0]]; },
- peg$c137 = function(first, others) { return first.concat.apply(first, others); },
- peg$currPos = 0,
- peg$reportedPos = 0,
- peg$cachedPos = 0,
- peg$cachedPosDetails = { line: 1, column: 1, seenCR: false },
- peg$maxFailPos = 0,
- peg$maxFailExpected = [],
- peg$silentFails = 0,
- peg$cache = {},
- peg$result;
- if ("startRule" in options) {
- if (!(options.startRule in peg$startRuleFunctions)) {
- throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
- }
- peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
- }
- function text() {
- return input.substring(peg$reportedPos, peg$currPos);
- }
- function offset() {
- return peg$reportedPos;
- }
- function line() {
- return peg$computePosDetails(peg$reportedPos).line;
- }
- function column() {
- return peg$computePosDetails(peg$reportedPos).column;
- }
- function expected(description) {
- throw peg$buildException(
- null,
- [{ type: "other", description: description }],
- peg$reportedPos
- );
- }
- function error(message) {
- throw peg$buildException(message, null, peg$reportedPos);
- }
- function peg$computePosDetails(pos) {
- function advance(details, startPos, endPos) {
- var p, ch;
- for (p = startPos; p < endPos; p++) {
- ch = input.charAt(p);
- if (ch === "\n") {
- if (!details.seenCR) { details.line++; }
- details.column = 1;
- details.seenCR = false;
- } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
- details.line++;
- details.column = 1;
- details.seenCR = true;
- } else {
- details.column++;
- details.seenCR = false;
- }
- }
- }
- if (peg$cachedPos !== pos) {
- if (peg$cachedPos > pos) {
- peg$cachedPos = 0;
- peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
- }
- advance(peg$cachedPosDetails, peg$cachedPos, pos);
- peg$cachedPos = pos;
- }
- return peg$cachedPosDetails;
- }
- function peg$fail(expected) {
- if (peg$currPos < peg$maxFailPos) { return; }
- if (peg$currPos > peg$maxFailPos) {
- peg$maxFailPos = peg$currPos;
- peg$maxFailExpected = [];
- }
- peg$maxFailExpected.push(expected);
- }
- function peg$buildException(message, expected, pos) {
- function cleanupExpected(expected) {
- var i = 1;
- expected.sort(function(a, b) {
- if (a.description < b.description) {
- return -1;
- } else if (a.description > b.description) {
- return 1;
- } else {
- return 0;
- }
- });
- while (i < expected.length) {
- if (expected[i - 1] === expected[i]) {
- expected.splice(i, 1);
- } else {
- i++;
- }
- }
- }
- function buildMessage(expected, found) {
- function stringEscape(s) {
- function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
- return s
- .replace(/\\/g, '\\\\')
- .replace(/"/g, '\\"')
- .replace(/\x08/g, '\\b')
- .replace(/\t/g, '\\t')
- .replace(/\n/g, '\\n')
- .replace(/\f/g, '\\f')
- .replace(/\r/g, '\\r')
- .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
- .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
- .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
- .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
- }
- var expectedDescs = new Array(expected.length),
- expectedDesc, foundDesc, i;
- for (i = 0; i < expected.length; i++) {
- expectedDescs[i] = expected[i].description;
- }
- expectedDesc = expected.length > 1
- ? expectedDescs.slice(0, -1).join(", ")
- + " or "
- + expectedDescs[expected.length - 1]
- : expectedDescs[0];
- foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
- return "Expected " + expectedDesc + " but " + foundDesc + " found.";
- }
- var posDetails = peg$computePosDetails(pos),
- found = pos < input.length ? input.charAt(pos) : null;
- if (expected !== null) {
- cleanupExpected(expected);
- }
- return new SyntaxError(
- message !== null ? message : buildMessage(expected, found),
- expected,
- found,
- pos,
- posDetails.line,
- posDetails.column
- );
- }
- function peg$parsestart() {
- var s0;
- var key = peg$currPos * 60 + 0,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$parsemethod();
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseseparator() {
- var s0, s1;
- var key = peg$currPos * 60 + 1,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = [];
- if (peg$c2.test(input.charAt(peg$currPos))) {
- s1 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c3); }
- }
- if (s1 !== peg$FAILED) {
- while (s1 !== peg$FAILED) {
- s0.push(s1);
- if (peg$c2.test(input.charAt(peg$currPos))) {
- s1 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c3); }
- }
- }
- } else {
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsecomments() {
- var s0, s1, s2, s3, s4;
- var key = peg$currPos * 60 + 2,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = [];
- s1 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 34) {
- s2 = peg$c4;
- peg$currPos++;
- } else {
- s2 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c5); }
- }
- if (s2 !== peg$FAILED) {
- s3 = [];
- if (peg$c6.test(input.charAt(peg$currPos))) {
- s4 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c7); }
- }
- while (s4 !== peg$FAILED) {
- s3.push(s4);
- if (peg$c6.test(input.charAt(peg$currPos))) {
- s4 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c7); }
- }
- }
- if (s3 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 34) {
- s4 = peg$c4;
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c5); }
- }
- if (s4 !== peg$FAILED) {
- s2 = [s2, s3, s4];
- s1 = s2;
- } else {
- peg$currPos = s1;
- s1 = peg$c1;
- }
- } else {
- peg$currPos = s1;
- s1 = peg$c1;
- }
- } else {
- peg$currPos = s1;
- s1 = peg$c1;
- }
- if (s1 !== peg$FAILED) {
- while (s1 !== peg$FAILED) {
- s0.push(s1);
- s1 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 34) {
- s2 = peg$c4;
- peg$currPos++;
- } else {
- s2 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c5); }
- }
- if (s2 !== peg$FAILED) {
- s3 = [];
- if (peg$c6.test(input.charAt(peg$currPos))) {
- s4 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c7); }
- }
- while (s4 !== peg$FAILED) {
- s3.push(s4);
- if (peg$c6.test(input.charAt(peg$currPos))) {
- s4 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c7); }
- }
- }
- if (s3 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 34) {
- s4 = peg$c4;
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c5); }
- }
- if (s4 !== peg$FAILED) {
- s2 = [s2, s3, s4];
- s1 = s2;
- } else {
- peg$currPos = s1;
- s1 = peg$c1;
- }
- } else {
- peg$currPos = s1;
- s1 = peg$c1;
- }
- } else {
- peg$currPos = s1;
- s1 = peg$c1;
- }
- }
- } else {
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsews() {
- var s0, s1;
- var key = peg$currPos * 60 + 3,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = [];
- s1 = peg$parseseparator();
- if (s1 === peg$FAILED) {
- s1 = peg$parsecomments();
- }
- while (s1 !== peg$FAILED) {
- s0.push(s1);
- s1 = peg$parseseparator();
- if (s1 === peg$FAILED) {
- s1 = peg$parsecomments();
- }
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseidentifier() {
- var s0, s1, s2, s3;
- var key = peg$currPos * 60 + 4,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- if (peg$c8.test(input.charAt(peg$currPos))) {
- s1 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c9); }
- }
- if (s1 !== peg$FAILED) {
- s2 = [];
- if (peg$c10.test(input.charAt(peg$currPos))) {
- s3 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c11); }
- }
- while (s3 !== peg$FAILED) {
- s2.push(s3);
- if (peg$c10.test(input.charAt(peg$currPos))) {
- s3 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c11); }
- }
- }
- if (s2 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c12(s1, s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsekeyword() {
- var s0, s1, s2;
- var key = peg$currPos * 60 + 5,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$parseidentifier();
- if (s1 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 58) {
- s2 = peg$c13;
- peg$currPos++;
- } else {
- s2 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c14); }
- }
- if (s2 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c15(s1, s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseselector() {
- var s0, s1, s2, s3;
- var key = peg$currPos * 60 + 6,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- if (peg$c8.test(input.charAt(peg$currPos))) {
- s1 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c9); }
- }
- if (s1 !== peg$FAILED) {
- s2 = [];
- if (peg$c16.test(input.charAt(peg$currPos))) {
- s3 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c17); }
- }
- while (s3 !== peg$FAILED) {
- s2.push(s3);
- if (peg$c16.test(input.charAt(peg$currPos))) {
- s3 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c17); }
- }
- }
- if (s2 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c12(s1, s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseclassName() {
- var s0, s1, s2, s3;
- var key = peg$currPos * 60 + 7,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- if (peg$c18.test(input.charAt(peg$currPos))) {
- s1 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c19); }
- }
- if (s1 !== peg$FAILED) {
- s2 = [];
- if (peg$c10.test(input.charAt(peg$currPos))) {
- s3 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c11); }
- }
- while (s3 !== peg$FAILED) {
- s2.push(s3);
- if (peg$c10.test(input.charAt(peg$currPos))) {
- s3 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c11); }
- }
- }
- if (s2 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c12(s1, s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsestring() {
- var s0, s1, s2, s3, s4;
- var key = peg$currPos * 60 + 8,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 39) {
- s1 = peg$c20;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c21); }
- }
- if (s1 !== peg$FAILED) {
- s2 = [];
- s3 = peg$currPos;
- if (input.substr(peg$currPos, 2) === peg$c22) {
- s4 = peg$c22;
- peg$currPos += 2;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c23); }
- }
- if (s4 !== peg$FAILED) {
- peg$reportedPos = s3;
- s4 = peg$c24();
- }
- s3 = s4;
- if (s3 === peg$FAILED) {
- if (peg$c25.test(input.charAt(peg$currPos))) {
- s3 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c26); }
- }
- }
- while (s3 !== peg$FAILED) {
- s2.push(s3);
- s3 = peg$currPos;
- if (input.substr(peg$currPos, 2) === peg$c22) {
- s4 = peg$c22;
- peg$currPos += 2;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c23); }
- }
- if (s4 !== peg$FAILED) {
- peg$reportedPos = s3;
- s4 = peg$c24();
- }
- s3 = s4;
- if (s3 === peg$FAILED) {
- if (peg$c25.test(input.charAt(peg$currPos))) {
- s3 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c26); }
- }
- }
- }
- if (s2 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 39) {
- s3 = peg$c20;
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c21); }
- }
- if (s3 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c27(s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsecharacter() {
- var s0, s1, s2;
- var key = peg$currPos * 60 + 9,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 36) {
- s1 = peg$c28;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c29); }
- }
- if (s1 !== peg$FAILED) {
- if (input.length > peg$currPos) {
- s2 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s2 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c30); }
- }
- if (s2 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c31(s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsesymbol() {
- var s0, s1, s2;
- var key = peg$currPos * 60 + 10,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 35) {
- s1 = peg$c32;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c33); }
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parsebareSymbol();
- if (s2 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c34(s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsebareSymbol() {
- var s0, s1, s2;
- var key = peg$currPos * 60 + 11,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$parseselector();
- if (s1 === peg$FAILED) {
- s1 = peg$parsebinarySelector();
- if (s1 === peg$FAILED) {
- s1 = peg$currPos;
- s2 = peg$parsestring();
- if (s2 !== peg$FAILED) {
- peg$reportedPos = s1;
- s2 = peg$c35(s2);
- }
- s1 = s2;
- }
- }
- if (s1 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c36(s1);
- }
- s0 = s1;
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsenumber() {
- var s0, s1;
- var key = peg$currPos * 60 + 12,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$parsenumberExp();
- if (s1 === peg$FAILED) {
- s1 = peg$parsehex();
- if (s1 === peg$FAILED) {
- s1 = peg$parsefloat();
- if (s1 === peg$FAILED) {
- s1 = peg$parseinteger();
- }
- }
- }
- if (s1 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c37(s1);
- }
- s0 = s1;
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsenumberExp() {
- var s0, s1, s2, s3, s4;
- var key = peg$currPos * 60 + 13,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$currPos;
- s2 = peg$parsefloat();
- if (s2 === peg$FAILED) {
- s2 = peg$parseinteger();
- }
- if (s2 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 101) {
- s3 = peg$c38;
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c39); }
- }
- if (s3 !== peg$FAILED) {
- s4 = peg$parseinteger();
- if (s4 !== peg$FAILED) {
- s2 = [s2, s3, s4];
- s1 = s2;
- } else {
- peg$currPos = s1;
- s1 = peg$c1;
- }
- } else {
- peg$currPos = s1;
- s1 = peg$c1;
- }
- } else {
- peg$currPos = s1;
- s1 = peg$c1;
- }
- if (s1 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c40(s1);
- }
- s0 = s1;
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsehex() {
- var s0, s1, s2, s3, s4;
- var key = peg$currPos * 60 + 14,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 45) {
- s1 = peg$c42;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c43); }
- }
- if (s1 === peg$FAILED) {
- s1 = peg$c41;
- }
- if (s1 !== peg$FAILED) {
- if (input.substr(peg$currPos, 3) === peg$c44) {
- s2 = peg$c44;
- peg$currPos += 3;
- } else {
- s2 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c45); }
- }
- if (s2 !== peg$FAILED) {
- s3 = [];
- if (peg$c46.test(input.charAt(peg$currPos))) {
- s4 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c47); }
- }
- if (s4 !== peg$FAILED) {
- while (s4 !== peg$FAILED) {
- s3.push(s4);
- if (peg$c46.test(input.charAt(peg$currPos))) {
- s4 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c47); }
- }
- }
- } else {
- s3 = peg$c1;
- }
- if (s3 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c48(s1, s3);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsefloat() {
- var s0, s1, s2, s3, s4, s5;
- var key = peg$currPos * 60 + 15,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 45) {
- s1 = peg$c42;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c43); }
- }
- if (s1 === peg$FAILED) {
- s1 = peg$c41;
- }
- if (s1 !== peg$FAILED) {
- s2 = [];
- if (peg$c49.test(input.charAt(peg$currPos))) {
- s3 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c50); }
- }
- if (s3 !== peg$FAILED) {
- while (s3 !== peg$FAILED) {
- s2.push(s3);
- if (peg$c49.test(input.charAt(peg$currPos))) {
- s3 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c50); }
- }
- }
- } else {
- s2 = peg$c1;
- }
- if (s2 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 46) {
- s3 = peg$c51;
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c52); }
- }
- if (s3 !== peg$FAILED) {
- s4 = [];
- if (peg$c49.test(input.charAt(peg$currPos))) {
- s5 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s5 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c50); }
- }
- if (s5 !== peg$FAILED) {
- while (s5 !== peg$FAILED) {
- s4.push(s5);
- if (peg$c49.test(input.charAt(peg$currPos))) {
- s5 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s5 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c50); }
- }
- }
- } else {
- s4 = peg$c1;
- }
- if (s4 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c53(s1, s2, s4);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseinteger() {
- var s0, s1, s2, s3;
- var key = peg$currPos * 60 + 16,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 45) {
- s1 = peg$c42;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c43); }
- }
- if (s1 === peg$FAILED) {
- s1 = peg$c41;
- }
- if (s1 !== peg$FAILED) {
- s2 = [];
- if (peg$c49.test(input.charAt(peg$currPos))) {
- s3 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c50); }
- }
- if (s3 !== peg$FAILED) {
- while (s3 !== peg$FAILED) {
- s2.push(s3);
- if (peg$c49.test(input.charAt(peg$currPos))) {
- s3 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c50); }
- }
- }
- } else {
- s2 = peg$c1;
- }
- if (s2 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c54(s1, s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseliteralArray() {
- var s0, s1, s2;
- var key = peg$currPos * 60 + 17,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- if (input.substr(peg$currPos, 2) === peg$c55) {
- s1 = peg$c55;
- peg$currPos += 2;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c56); }
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parseliteralArrayRest();
- if (s2 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c34(s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsebareLiteralArray() {
- var s0, s1, s2;
- var key = peg$currPos * 60 + 18,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 40) {
- s1 = peg$c57;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c58); }
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parseliteralArrayRest();
- if (s2 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c34(s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseliteralArrayRest() {
- var s0, s1, s2, s3, s4;
- var key = peg$currPos * 60 + 19,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = [];
- s2 = peg$currPos;
- s3 = peg$parsews();
- if (s3 !== peg$FAILED) {
- s4 = peg$parseparseTimeLiteral();
- if (s4 === peg$FAILED) {
- s4 = peg$parsebareLiteralArray();
- if (s4 === peg$FAILED) {
- s4 = peg$parsebareSymbol();
- }
- }
- if (s4 !== peg$FAILED) {
- peg$reportedPos = s2;
- s3 = peg$c59(s4);
- s2 = s3;
- } else {
- peg$currPos = s2;
- s2 = peg$c1;
- }
- } else {
- peg$currPos = s2;
- s2 = peg$c1;
- }
- while (s2 !== peg$FAILED) {
- s1.push(s2);
- s2 = peg$currPos;
- s3 = peg$parsews();
- if (s3 !== peg$FAILED) {
- s4 = peg$parseparseTimeLiteral();
- if (s4 === peg$FAILED) {
- s4 = peg$parsebareLiteralArray();
- if (s4 === peg$FAILED) {
- s4 = peg$parsebareSymbol();
- }
- }
- if (s4 !== peg$FAILED) {
- peg$reportedPos = s2;
- s3 = peg$c59(s4);
- s2 = s3;
- } else {
- peg$currPos = s2;
- s2 = peg$c1;
- }
- } else {
- peg$currPos = s2;
- s2 = peg$c1;
- }
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parsews();
- if (s2 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 41) {
- s3 = peg$c60;
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c61); }
- }
- if (s3 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c62(s1);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsedynamicArray() {
- var s0, s1, s2, s3, s4, s5, s6;
- var key = peg$currPos * 60 + 20,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 123) {
- s1 = peg$c63;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c64); }
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parsews();
- if (s2 !== peg$FAILED) {
- s3 = peg$parseexpressions();
- if (s3 === peg$FAILED) {
- s3 = peg$c41;
- }
- if (s3 !== peg$FAILED) {
- s4 = peg$parsews();
- if (s4 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 46) {
- s5 = peg$c51;
- peg$currPos++;
- } else {
- s5 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c52); }
- }
- if (s5 === peg$FAILED) {
- s5 = peg$c41;
- }
- if (s5 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 125) {
- s6 = peg$c65;
- peg$currPos++;
- } else {
- s6 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c66); }
- }
- if (s6 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c67(s3);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsedynamicDictionary() {
- var s0, s1, s2, s3, s4, s5;
- var key = peg$currPos * 60 + 21,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- if (input.substr(peg$currPos, 2) === peg$c68) {
- s1 = peg$c68;
- peg$currPos += 2;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c69); }
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parsews();
- if (s2 !== peg$FAILED) {
- s3 = peg$parseassociations();
- if (s3 === peg$FAILED) {
- s3 = peg$c41;
- }
- if (s3 !== peg$FAILED) {
- s4 = peg$parsews();
- if (s4 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 125) {
- s5 = peg$c65;
- peg$currPos++;
- } else {
- s5 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c66); }
- }
- if (s5 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c70(s3);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsepseudoVariable() {
- var s0, s1, s2;
- var key = peg$currPos * 60 + 22,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$currPos;
- if (input.substr(peg$currPos, 4) === peg$c71) {
- s2 = peg$c71;
- peg$currPos += 4;
- } else {
- s2 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c72); }
- }
- if (s2 !== peg$FAILED) {
- peg$reportedPos = s1;
- s2 = peg$c73();
- }
- s1 = s2;
- if (s1 === peg$FAILED) {
- s1 = peg$currPos;
- if (input.substr(peg$currPos, 5) === peg$c74) {
- s2 = peg$c74;
- peg$currPos += 5;
- } else {
- s2 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c75); }
- }
- if (s2 !== peg$FAILED) {
- peg$reportedPos = s1;
- s2 = peg$c76();
- }
- s1 = s2;
- if (s1 === peg$FAILED) {
- s1 = peg$currPos;
- if (input.substr(peg$currPos, 3) === peg$c77) {
- s2 = peg$c77;
- peg$currPos += 3;
- } else {
- s2 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c78); }
- }
- if (s2 !== peg$FAILED) {
- peg$reportedPos = s1;
- s2 = peg$c79();
- }
- s1 = s2;
- }
- }
- if (s1 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c80(s1);
- }
- s0 = s1;
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseparseTimeLiteral() {
- var s0;
- var key = peg$currPos * 60 + 23,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$parsepseudoVariable();
- if (s0 === peg$FAILED) {
- s0 = peg$parsenumber();
- if (s0 === peg$FAILED) {
- s0 = peg$parseliteralArray();
- if (s0 === peg$FAILED) {
- s0 = peg$parsestring();
- if (s0 === peg$FAILED) {
- s0 = peg$parsesymbol();
- if (s0 === peg$FAILED) {
- s0 = peg$parsecharacter();
- }
- }
- }
- }
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseruntimeLiteral() {
- var s0;
- var key = peg$currPos * 60 + 24,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$parsedynamicDictionary();
- if (s0 === peg$FAILED) {
- s0 = peg$parsedynamicArray();
- if (s0 === peg$FAILED) {
- s0 = peg$parseblock();
- }
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseliteral() {
- var s0;
- var key = peg$currPos * 60 + 25,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$parseruntimeLiteral();
- if (s0 === peg$FAILED) {
- s0 = peg$parseparseTimeLiteral();
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsevariable() {
- var s0, s1;
- var key = peg$currPos * 60 + 26,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$parseidentifier();
- if (s1 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c81(s1);
- }
- s0 = s1;
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsekeywordPair() {
- var s0, s1, s2, s3, s4;
- var key = peg$currPos * 60 + 27,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$parsews();
- if (s1 !== peg$FAILED) {
- s2 = peg$parsekeyword();
- if (s2 !== peg$FAILED) {
- s3 = peg$parsews();
- if (s3 !== peg$FAILED) {
- s4 = peg$parsebinarySend();
- if (s4 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c82(s2, s4);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsebinarySelector() {
- var s0, s1, s2;
- var key = peg$currPos * 60 + 28,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = [];
- if (peg$c83.test(input.charAt(peg$currPos))) {
- s2 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s2 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c84); }
- }
- if (s2 !== peg$FAILED) {
- while (s2 !== peg$FAILED) {
- s1.push(s2);
- if (peg$c83.test(input.charAt(peg$currPos))) {
- s2 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s2 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c84); }
- }
- }
- } else {
- s1 = peg$c1;
- }
- if (s1 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c85(s1);
- }
- s0 = s1;
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsekeywordPattern() {
- var s0, s1, s2, s3, s4, s5, s6;
- var key = peg$currPos * 60 + 29,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = [];
- s2 = peg$currPos;
- s3 = peg$parsews();
- if (s3 !== peg$FAILED) {
- s4 = peg$parsekeyword();
- if (s4 !== peg$FAILED) {
- s5 = peg$parsews();
- if (s5 !== peg$FAILED) {
- s6 = peg$parseidentifier();
- if (s6 !== peg$FAILED) {
- peg$reportedPos = s2;
- s3 = peg$c82(s4, s6);
- s2 = s3;
- } else {
- peg$currPos = s2;
- s2 = peg$c1;
- }
- } else {
- peg$currPos = s2;
- s2 = peg$c1;
- }
- } else {
- peg$currPos = s2;
- s2 = peg$c1;
- }
- } else {
- peg$currPos = s2;
- s2 = peg$c1;
- }
- if (s2 !== peg$FAILED) {
- while (s2 !== peg$FAILED) {
- s1.push(s2);
- s2 = peg$currPos;
- s3 = peg$parsews();
- if (s3 !== peg$FAILED) {
- s4 = peg$parsekeyword();
- if (s4 !== peg$FAILED) {
- s5 = peg$parsews();
- if (s5 !== peg$FAILED) {
- s6 = peg$parseidentifier();
- if (s6 !== peg$FAILED) {
- peg$reportedPos = s2;
- s3 = peg$c82(s4, s6);
- s2 = s3;
- } else {
- peg$currPos = s2;
- s2 = peg$c1;
- }
- } else {
- peg$currPos = s2;
- s2 = peg$c1;
- }
- } else {
- peg$currPos = s2;
- s2 = peg$c1;
- }
- } else {
- peg$currPos = s2;
- s2 = peg$c1;
- }
- }
- } else {
- s1 = peg$c1;
- }
- if (s1 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c86(s1);
- }
- s0 = s1;
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsebinaryPattern() {
- var s0, s1, s2, s3, s4;
- var key = peg$currPos * 60 + 30,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$parsews();
- if (s1 !== peg$FAILED) {
- s2 = peg$parsebinarySelector();
- if (s2 !== peg$FAILED) {
- s3 = peg$parsews();
- if (s3 !== peg$FAILED) {
- s4 = peg$parseidentifier();
- if (s4 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c87(s2, s4);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseunaryPattern() {
- var s0, s1, s2;
- var key = peg$currPos * 60 + 31,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$parsews();
- if (s1 !== peg$FAILED) {
- s2 = peg$parseidentifier();
- if (s2 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c88(s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseexpression() {
- var s0;
- var key = peg$currPos * 60 + 32,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$parseassignment();
- if (s0 === peg$FAILED) {
- s0 = peg$parsecascade();
- if (s0 === peg$FAILED) {
- s0 = peg$parsekeywordSend();
- if (s0 === peg$FAILED) {
- s0 = peg$parsebinarySend();
- }
- }
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseexpressionList() {
- var s0, s1, s2, s3, s4;
- var key = peg$currPos * 60 + 33,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$parsews();
- if (s1 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 46) {
- s2 = peg$c51;
- peg$currPos++;
- } else {
- s2 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c52); }
- }
- if (s2 !== peg$FAILED) {
- s3 = peg$parsews();
- if (s3 !== peg$FAILED) {
- s4 = peg$parseexpression();
- if (s4 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c89(s4);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseexpressions() {
- var s0, s1, s2, s3;
- var key = peg$currPos * 60 + 34,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$parseexpression();
- if (s1 !== peg$FAILED) {
- s2 = [];
- s3 = peg$parseexpressionList();
- while (s3 !== peg$FAILED) {
- s2.push(s3);
- s3 = peg$parseexpressionList();
- }
- if (s2 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c90(s1, s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseassignment() {
- var s0, s1, s2, s3, s4, s5;
- var key = peg$currPos * 60 + 35,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$parsevariable();
- if (s1 !== peg$FAILED) {
- s2 = peg$parsews();
- if (s2 !== peg$FAILED) {
- if (input.substr(peg$currPos, 2) === peg$c91) {
- s3 = peg$c91;
- peg$currPos += 2;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c92); }
- }
- if (s3 !== peg$FAILED) {
- s4 = peg$parsews();
- if (s4 !== peg$FAILED) {
- s5 = peg$parseexpression();
- if (s5 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c93(s1, s5);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseret() {
- var s0, s1, s2, s3, s4, s5;
- var key = peg$currPos * 60 + 36,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 94) {
- s1 = peg$c94;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c95); }
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parsews();
- if (s2 !== peg$FAILED) {
- s3 = peg$parseexpression();
- if (s3 !== peg$FAILED) {
- s4 = peg$parsews();
- if (s4 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 46) {
- s5 = peg$c51;
- peg$currPos++;
- } else {
- s5 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c52); }
- }
- if (s5 === peg$FAILED) {
- s5 = peg$c41;
- }
- if (s5 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c96(s3);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsetemps() {
- var s0, s1, s2, s3, s4, s5;
- var key = peg$currPos * 60 + 37,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 124) {
- s1 = peg$c97;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c98); }
- }
- if (s1 !== peg$FAILED) {
- s2 = [];
- s3 = peg$currPos;
- s4 = peg$parsews();
- if (s4 !== peg$FAILED) {
- s5 = peg$parseidentifier();
- if (s5 !== peg$FAILED) {
- peg$reportedPos = s3;
- s4 = peg$c99(s5);
- s3 = s4;
- } else {
- peg$currPos = s3;
- s3 = peg$c1;
- }
- } else {
- peg$currPos = s3;
- s3 = peg$c1;
- }
- while (s3 !== peg$FAILED) {
- s2.push(s3);
- s3 = peg$currPos;
- s4 = peg$parsews();
- if (s4 !== peg$FAILED) {
- s5 = peg$parseidentifier();
- if (s5 !== peg$FAILED) {
- peg$reportedPos = s3;
- s4 = peg$c99(s5);
- s3 = s4;
- } else {
- peg$currPos = s3;
- s3 = peg$c1;
- }
- } else {
- peg$currPos = s3;
- s3 = peg$c1;
- }
- }
- if (s2 !== peg$FAILED) {
- s3 = peg$parsews();
- if (s3 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 124) {
- s4 = peg$c97;
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c98); }
- }
- if (s4 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c100(s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseblockParamList() {
- var s0, s1, s2, s3, s4, s5, s6;
- var key = peg$currPos * 60 + 38,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = [];
- s2 = peg$currPos;
- s3 = peg$parsews();
- if (s3 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 58) {
- s4 = peg$c13;
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c14); }
- }
- if (s4 !== peg$FAILED) {
- s5 = peg$parsews();
- if (s5 !== peg$FAILED) {
- s6 = peg$parseidentifier();
- if (s6 !== peg$FAILED) {
- peg$reportedPos = s2;
- s3 = peg$c101(s6);
- s2 = s3;
- } else {
- peg$currPos = s2;
- s2 = peg$c1;
- }
- } else {
- peg$currPos = s2;
- s2 = peg$c1;
- }
- } else {
- peg$currPos = s2;
- s2 = peg$c1;
- }
- } else {
- peg$currPos = s2;
- s2 = peg$c1;
- }
- if (s2 !== peg$FAILED) {
- while (s2 !== peg$FAILED) {
- s1.push(s2);
- s2 = peg$currPos;
- s3 = peg$parsews();
- if (s3 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 58) {
- s4 = peg$c13;
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c14); }
- }
- if (s4 !== peg$FAILED) {
- s5 = peg$parsews();
- if (s5 !== peg$FAILED) {
- s6 = peg$parseidentifier();
- if (s6 !== peg$FAILED) {
- peg$reportedPos = s2;
- s3 = peg$c101(s6);
- s2 = s3;
- } else {
- peg$currPos = s2;
- s2 = peg$c1;
- }
- } else {
- peg$currPos = s2;
- s2 = peg$c1;
- }
- } else {
- peg$currPos = s2;
- s2 = peg$c1;
- }
- } else {
- peg$currPos = s2;
- s2 = peg$c1;
- }
- }
- } else {
- s1 = peg$c1;
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parsews();
- if (s2 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 124) {
- s3 = peg$c97;
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c98); }
- }
- if (s3 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c102(s1);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsesubexpression() {
- var s0, s1, s2, s3, s4, s5;
- var key = peg$currPos * 60 + 39,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 40) {
- s1 = peg$c57;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c58); }
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parsews();
- if (s2 !== peg$FAILED) {
- s3 = peg$parseexpression();
- if (s3 !== peg$FAILED) {
- s4 = peg$parsews();
- if (s4 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 41) {
- s5 = peg$c60;
- peg$currPos++;
- } else {
- s5 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c61); }
- }
- if (s5 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c89(s3);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsestatements() {
- var s0, s1, s2, s3, s4, s5, s6, s7;
- var key = peg$currPos * 60 + 40,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$parseret();
- if (s1 !== peg$FAILED) {
- s2 = [];
- if (input.charCodeAt(peg$currPos) === 46) {
- s3 = peg$c51;
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c52); }
- }
- while (s3 !== peg$FAILED) {
- s2.push(s3);
- if (input.charCodeAt(peg$currPos) === 46) {
- s3 = peg$c51;
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c52); }
- }
- }
- if (s2 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c103(s1);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- if (s0 === peg$FAILED) {
- s0 = peg$currPos;
- s1 = peg$parseexpressions();
- if (s1 !== peg$FAILED) {
- s2 = peg$parsews();
- if (s2 !== peg$FAILED) {
- s3 = [];
- if (input.charCodeAt(peg$currPos) === 46) {
- s4 = peg$c51;
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c52); }
- }
- if (s4 !== peg$FAILED) {
- while (s4 !== peg$FAILED) {
- s3.push(s4);
- if (input.charCodeAt(peg$currPos) === 46) {
- s4 = peg$c51;
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c52); }
- }
- }
- } else {
- s3 = peg$c1;
- }
- if (s3 !== peg$FAILED) {
- s4 = peg$parsews();
- if (s4 !== peg$FAILED) {
- s5 = peg$parseret();
- if (s5 !== peg$FAILED) {
- s6 = [];
- if (input.charCodeAt(peg$currPos) === 46) {
- s7 = peg$c51;
- peg$currPos++;
- } else {
- s7 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c52); }
- }
- while (s7 !== peg$FAILED) {
- s6.push(s7);
- if (input.charCodeAt(peg$currPos) === 46) {
- s7 = peg$c51;
- peg$currPos++;
- } else {
- s7 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c52); }
- }
- }
- if (s6 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c104(s1, s5);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- if (s0 === peg$FAILED) {
- s0 = peg$currPos;
- s1 = peg$parseexpressions();
- if (s1 === peg$FAILED) {
- s1 = peg$c41;
- }
- if (s1 !== peg$FAILED) {
- s2 = [];
- if (input.charCodeAt(peg$currPos) === 46) {
- s3 = peg$c51;
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c52); }
- }
- while (s3 !== peg$FAILED) {
- s2.push(s3);
- if (input.charCodeAt(peg$currPos) === 46) {
- s3 = peg$c51;
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c52); }
- }
- }
- if (s2 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c105(s1);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- }
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsesequence() {
- var s0;
- var key = peg$currPos * 60 + 41,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$parsejsStatement();
- if (s0 === peg$FAILED) {
- s0 = peg$parsestSequence();
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsestSequence() {
- var s0, s1, s2, s3, s4;
- var key = peg$currPos * 60 + 42,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$parsetemps();
- if (s1 === peg$FAILED) {
- s1 = peg$c41;
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parsews();
- if (s2 !== peg$FAILED) {
- s3 = peg$parsestatements();
- if (s3 === peg$FAILED) {
- s3 = peg$c41;
- }
- if (s3 !== peg$FAILED) {
- s4 = peg$parsews();
- if (s4 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c106(s1, s3);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseblock() {
- var s0, s1, s2, s3, s4, s5, s6;
- var key = peg$currPos * 60 + 43,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 91) {
- s1 = peg$c107;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c108); }
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parseblockParamList();
- if (s2 === peg$FAILED) {
- s2 = peg$c41;
- }
- if (s2 !== peg$FAILED) {
- s3 = peg$parsews();
- if (s3 !== peg$FAILED) {
- s4 = peg$parsesequence();
- if (s4 === peg$FAILED) {
- s4 = peg$c41;
- }
- if (s4 !== peg$FAILED) {
- s5 = peg$parsews();
- if (s5 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 93) {
- s6 = peg$c109;
- peg$currPos++;
- } else {
- s6 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c110); }
- }
- if (s6 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c111(s2, s4);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseoperand() {
- var s0;
- var key = peg$currPos * 60 + 44,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$parseliteral();
- if (s0 === peg$FAILED) {
- s0 = peg$parsevariable();
- if (s0 === peg$FAILED) {
- s0 = peg$parsesubexpression();
- }
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseunaryMessage() {
- var s0, s1, s2, s3, s4;
- var key = peg$currPos * 60 + 45,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$parsews();
- if (s1 !== peg$FAILED) {
- s2 = peg$parseidentifier();
- if (s2 !== peg$FAILED) {
- s3 = peg$currPos;
- peg$silentFails++;
- if (input.charCodeAt(peg$currPos) === 58) {
- s4 = peg$c13;
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c14); }
- }
- peg$silentFails--;
- if (s4 === peg$FAILED) {
- s3 = peg$c112;
- } else {
- peg$currPos = s3;
- s3 = peg$c1;
- }
- if (s3 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c113(s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseunaryTail() {
- var s0, s1, s2, s3, s4;
- var key = peg$currPos * 60 + 46,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$parseunaryMessage();
- if (s1 !== peg$FAILED) {
- s2 = peg$parsews();
- if (s2 !== peg$FAILED) {
- s3 = peg$parseunaryTail();
- if (s3 === peg$FAILED) {
- s3 = peg$c41;
- }
- if (s3 !== peg$FAILED) {
- s4 = peg$parsews();
- if (s4 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c114(s1, s3);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseunarySend() {
- var s0, s1, s2, s3;
- var key = peg$currPos * 60 + 47,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$parseoperand();
- if (s1 !== peg$FAILED) {
- s2 = peg$parsews();
- if (s2 !== peg$FAILED) {
- s3 = peg$parseunaryTail();
- if (s3 === peg$FAILED) {
- s3 = peg$c41;
- }
- if (s3 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c115(s1, s3);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsebinaryMessage() {
- var s0, s1, s2, s3, s4;
- var key = peg$currPos * 60 + 48,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$parsews();
- if (s1 !== peg$FAILED) {
- s2 = peg$parsebinarySelector();
- if (s2 !== peg$FAILED) {
- s3 = peg$parsews();
- if (s3 !== peg$FAILED) {
- s4 = peg$parseunarySend();
- if (s4 === peg$FAILED) {
- s4 = peg$parseoperand();
- }
- if (s4 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c116(s2, s4);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsebinaryTail() {
- var s0, s1, s2;
- var key = peg$currPos * 60 + 49,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$parsebinaryMessage();
- if (s1 !== peg$FAILED) {
- s2 = peg$parsebinaryTail();
- if (s2 === peg$FAILED) {
- s2 = peg$c41;
- }
- if (s2 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c117(s1, s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsebinarySend() {
- var s0, s1, s2;
- var key = peg$currPos * 60 + 50,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$parseunarySend();
- if (s1 !== peg$FAILED) {
- s2 = peg$parsebinaryTail();
- if (s2 === peg$FAILED) {
- s2 = peg$c41;
- }
- if (s2 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c115(s1, s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsekeywordMessage() {
- var s0, s1, s2;
- var key = peg$currPos * 60 + 51,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = [];
- s2 = peg$parsekeywordPair();
- if (s2 !== peg$FAILED) {
- while (s2 !== peg$FAILED) {
- s1.push(s2);
- s2 = peg$parsekeywordPair();
- }
- } else {
- s1 = peg$c1;
- }
- if (s1 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c118(s1);
- }
- s0 = s1;
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsekeywordSend() {
- var s0, s1, s2;
- var key = peg$currPos * 60 + 52,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$parsebinarySend();
- if (s1 !== peg$FAILED) {
- s2 = peg$parsekeywordMessage();
- if (s2 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c119(s1, s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsemessage() {
- var s0;
- var key = peg$currPos * 60 + 53,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$parsebinaryMessage();
- if (s0 === peg$FAILED) {
- s0 = peg$parseunaryMessage();
- if (s0 === peg$FAILED) {
- s0 = peg$parsekeywordMessage();
- }
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsecascade() {
- var s0, s1, s2, s3, s4, s5, s6, s7, s8;
- var key = peg$currPos * 60 + 54,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$parsews();
- if (s1 !== peg$FAILED) {
- s2 = peg$parsekeywordSend();
- if (s2 === peg$FAILED) {
- s2 = peg$parsebinarySend();
- }
- if (s2 !== peg$FAILED) {
- s3 = [];
- s4 = peg$currPos;
- s5 = peg$parsews();
- if (s5 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 59) {
- s6 = peg$c120;
- peg$currPos++;
- } else {
- s6 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c121); }
- }
- if (s6 !== peg$FAILED) {
- s7 = peg$parsews();
- if (s7 !== peg$FAILED) {
- s8 = peg$parsemessage();
- if (s8 !== peg$FAILED) {
- peg$reportedPos = s4;
- s5 = peg$c122(s8);
- s4 = s5;
- } else {
- peg$currPos = s4;
- s4 = peg$c1;
- }
- } else {
- peg$currPos = s4;
- s4 = peg$c1;
- }
- } else {
- peg$currPos = s4;
- s4 = peg$c1;
- }
- } else {
- peg$currPos = s4;
- s4 = peg$c1;
- }
- if (s4 !== peg$FAILED) {
- while (s4 !== peg$FAILED) {
- s3.push(s4);
- s4 = peg$currPos;
- s5 = peg$parsews();
- if (s5 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 59) {
- s6 = peg$c120;
- peg$currPos++;
- } else {
- s6 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c121); }
- }
- if (s6 !== peg$FAILED) {
- s7 = peg$parsews();
- if (s7 !== peg$FAILED) {
- s8 = peg$parsemessage();
- if (s8 !== peg$FAILED) {
- peg$reportedPos = s4;
- s5 = peg$c122(s8);
- s4 = s5;
- } else {
- peg$currPos = s4;
- s4 = peg$c1;
- }
- } else {
- peg$currPos = s4;
- s4 = peg$c1;
- }
- } else {
- peg$currPos = s4;
- s4 = peg$c1;
- }
- } else {
- peg$currPos = s4;
- s4 = peg$c1;
- }
- }
- } else {
- s3 = peg$c1;
- }
- if (s3 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c123(s2, s3);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsejsStatement() {
- var s0, s1, s2, s3, s4;
- var key = peg$currPos * 60 + 55,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 60) {
- s1 = peg$c124;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c125); }
- }
- if (s1 !== peg$FAILED) {
- s2 = [];
- s3 = peg$currPos;
- if (input.substr(peg$currPos, 2) === peg$c126) {
- s4 = peg$c126;
- peg$currPos += 2;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c127); }
- }
- if (s4 !== peg$FAILED) {
- peg$reportedPos = s3;
- s4 = peg$c128();
- }
- s3 = s4;
- if (s3 === peg$FAILED) {
- if (peg$c129.test(input.charAt(peg$currPos))) {
- s3 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c130); }
- }
- }
- while (s3 !== peg$FAILED) {
- s2.push(s3);
- s3 = peg$currPos;
- if (input.substr(peg$currPos, 2) === peg$c126) {
- s4 = peg$c126;
- peg$currPos += 2;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c127); }
- }
- if (s4 !== peg$FAILED) {
- peg$reportedPos = s3;
- s4 = peg$c128();
- }
- s3 = s4;
- if (s3 === peg$FAILED) {
- if (peg$c129.test(input.charAt(peg$currPos))) {
- s3 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c130); }
- }
- }
- }
- if (s2 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 62) {
- s3 = peg$c131;
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c132); }
- }
- if (s3 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c133(s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parsemethod() {
- var s0, s1, s2, s3, s4;
- var key = peg$currPos * 60 + 56,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$parsekeywordPattern();
- if (s1 === peg$FAILED) {
- s1 = peg$parsebinaryPattern();
- if (s1 === peg$FAILED) {
- s1 = peg$parseunaryPattern();
- }
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parsews();
- if (s2 !== peg$FAILED) {
- s3 = peg$parsesequence();
- if (s3 === peg$FAILED) {
- s3 = peg$c41;
- }
- if (s3 !== peg$FAILED) {
- s4 = peg$parsews();
- if (s4 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c134(s1, s3);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseassociationSend() {
- var s0, s1, s2;
- var key = peg$currPos * 60 + 57,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$parsebinarySend();
- if (s1 !== peg$FAILED) {
- peg$reportedPos = peg$currPos;
- s2 = peg$c135(s1);
- if (s2) {
- s2 = peg$c112;
- } else {
- s2 = peg$c1;
- }
- if (s2 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c136(s1);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseassociationList() {
- var s0, s1, s2, s3, s4;
- var key = peg$currPos * 60 + 58,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$parsews();
- if (s1 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 46) {
- s2 = peg$c51;
- peg$currPos++;
- } else {
- s2 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c52); }
- }
- if (s2 !== peg$FAILED) {
- s3 = peg$parsews();
- if (s3 !== peg$FAILED) {
- s4 = peg$parseassociationSend();
- if (s4 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c89(s4);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- function peg$parseassociations() {
- var s0, s1, s2, s3;
- var key = peg$currPos * 60 + 59,
- cached = peg$cache[key];
- if (cached) {
- peg$currPos = cached.nextPos;
- return cached.result;
- }
- s0 = peg$currPos;
- s1 = peg$parseassociationSend();
- if (s1 !== peg$FAILED) {
- s2 = [];
- s3 = peg$parseassociationList();
- while (s3 !== peg$FAILED) {
- s2.push(s3);
- s3 = peg$parseassociationList();
- }
- if (s2 !== peg$FAILED) {
- peg$reportedPos = s0;
- s1 = peg$c137(s1, s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$c1;
- }
- peg$cache[key] = { nextPos: peg$currPos, result: s0 };
- return s0;
- }
- peg$result = peg$startRuleFunction();
- if (peg$result !== peg$FAILED && peg$currPos === input.length) {
- return peg$result;
- } else {
- if (peg$result !== peg$FAILED && peg$currPos < input.length) {
- peg$fail({ type: "end", description: "end of input" });
- }
- throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
- }
- }
- return {
- SyntaxError: SyntaxError,
- parse: parse
- };
- })();
- });
- 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";
- var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
- $core.addPackage('Platform-ImportExport');
- $core.packages["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
- $core.packages["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
- $core.addClass('AbstractExporter', $globals.Object, [], 'Platform-ImportExport');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "classNameFor:",
- protocol: 'convenience',
- fn: function (aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$4,$1;
- $2=$recv(aClass)._isMetaclass();
- if($core.assert($2)){
- $3=$recv($recv(aClass)._instanceClass())._name();
- $ctx1.sendIdx["name"]=1;
- $1=$recv($3).__comma(" class");
- } else {
- $4=$recv(aClass)._isNil();
- if($core.assert($4)){
- $1="nil";
- } else {
- $1=$recv(aClass)._name();
- };
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractExporter)});
- },
- args: ["aClass"],
- 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 ] ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"]
- }),
- $globals.AbstractExporter);
- $core.addMethod(
- $core.method({
- selector: "exportPackage:on:",
- protocol: 'output',
- fn: function (aPackage,aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
- },
- args: ["aPackage", "aStream"],
- source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.AbstractExporter);
- $core.addMethod(
- $core.method({
- selector: "extensionMethodsOfPackage:",
- protocol: 'accessing',
- fn: function (aPackage){
- var self=this;
- var result;
- function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
- return $core.withContext(function($ctx1) {
- var $1;
- result=$recv($OrderedCollection())._new();
- $recv(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(result)._addAll_($recv(each)._methods());
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $1=result;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
- },
- args: ["aPackage"],
- 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",
- referencedClasses: ["OrderedCollection"],
- messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "methods"]
- }),
- $globals.AbstractExporter);
- $core.addMethod(
- $core.method({
- selector: "extensionProtocolsOfPackage:",
- protocol: 'accessing',
- fn: function (aPackage){
- var self=this;
- var extensionName,result;
- function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- function $ExportMethodProtocol(){return $globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- $1=$recv(aPackage)._name();
- $ctx1.sendIdx["name"]=1;
- extensionName="*".__comma($1);
- result=$recv($OrderedCollection())._new();
- $recv($recv($recv($recv($Smalltalk())._classes())._asArray())._sorted_((function(a,b){
- return $core.withContext(function($ctx2) {
- $2=$recv(a)._name();
- $ctx2.sendIdx["name"]=2;
- return $recv($2).__lt($recv(b)._name());
- }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
- })))._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv([each,$recv(each)._class()])._do_((function(behavior){
- return $core.withContext(function($ctx3) {
- $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
- if($core.assert($3)){
- return $recv(result)._add_($recv($ExportMethodProtocol())._name_theClass_(extensionName,behavior));
- };
- }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
- }));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- $ctx1.sendIdx["do:"]=1;
- $4=result;
- return $4;
- }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
- },
- args: ["aPackage"],
- 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",
- referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
- messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "class", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
- }),
- $globals.AbstractExporter);
- $core.addClass('ChunkExporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "chunkEscape:",
- protocol: 'convenience',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
- },
- args: ["aString"],
- source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
- referencedClasses: [],
- messageSends: ["trimBoth", "replace:with:"]
- }),
- $globals.ChunkExporter);
- $core.addMethod(
- $core.method({
- selector: "exportCategoryEpilogueOf:on:",
- protocol: 'output',
- fn: function (aCategory,aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $recv(aStream)._nextPutAll_(" !");
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=1;
- $1=$recv(aStream)._lf();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
- },
- args: ["aCategory", "aStream"],
- source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "lf"]
- }),
- $globals.ChunkExporter);
- $core.addMethod(
- $core.method({
- selector: "exportCategoryPrologueOf:on:",
- protocol: 'output',
- fn: function (aCategory,aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$3,$2;
- $1="!".__comma(self._classNameFor_($recv(aCategory)._theClass()));
- $ctx1.sendIdx[","]=1;
- $recv(aStream)._nextPutAll_($1);
- $ctx1.sendIdx["nextPutAll:"]=1;
- $3=$recv(" methodsFor: '".__comma($recv(aCategory)._name())).__comma("'!");
- $ctx1.sendIdx[","]=2;
- $2=$recv(aStream)._nextPutAll_($3);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
- },
- args: ["aCategory", "aStream"],
- source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aCategory theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aCategory name, '''!'",
- referencedClasses: [],
- messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
- }),
- $globals.ChunkExporter);
- $core.addMethod(
- $core.method({
- selector: "exportDefinitionOf:on:",
- protocol: 'output',
- fn: function (aClass,aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$3,$2,$4,$6,$5,$7,$9,$8,$11,$10,$12;
- $1=self._classNameFor_($recv(aClass)._superclass());
- $ctx1.sendIdx["classNameFor:"]=1;
- $recv(aStream)._nextPutAll_($1);
- $ctx1.sendIdx["nextPutAll:"]=1;
- $3=self._classNameFor_(aClass);
- $ctx1.sendIdx["classNameFor:"]=2;
- $2=" subclass: #".__comma($3);
- $ctx1.sendIdx[","]=1;
- $recv(aStream)._nextPutAll_($2);
- $ctx1.sendIdx["nextPutAll:"]=2;
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=1;
- $recv(aStream)._tab();
- $ctx1.sendIdx["tab"]=1;
- $4=$recv(aStream)._nextPutAll_("instanceVariableNames: '");
- $ctx1.sendIdx["nextPutAll:"]=3;
- $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(aStream)._nextPutAll_(each);
- $ctx2.sendIdx["nextPutAll:"]=4;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- return $recv(aStream)._nextPutAll_(" ");
- $ctx2.sendIdx["nextPutAll:"]=5;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- $recv(aStream)._nextPutAll_("'");
- $ctx1.sendIdx["nextPutAll:"]=6;
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=2;
- $recv(aStream)._tab();
- $6="package: '".__comma($recv(aClass)._category());
- $ctx1.sendIdx[","]=3;
- $5=$recv($6).__comma("'!");
- $ctx1.sendIdx[","]=2;
- $recv(aStream)._nextPutAll_($5);
- $ctx1.sendIdx["nextPutAll:"]=7;
- $7=$recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=3;
- $9=$recv(aClass)._comment();
- $ctx1.sendIdx["comment"]=1;
- $8=$recv($9)._notEmpty();
- if($core.assert($8)){
- $11="!".__comma(self._classNameFor_(aClass));
- $ctx1.sendIdx[","]=5;
- $10=$recv($11).__comma(" commentStamp!");
- $ctx1.sendIdx[","]=4;
- $recv(aStream)._nextPutAll_($10);
- $ctx1.sendIdx["nextPutAll:"]=8;
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=4;
- $recv(aStream)._nextPutAll_($recv(self._chunkEscape_($recv(aClass)._comment())).__comma("!"));
- $12=$recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=5;
- $12;
- };
- $recv(aStream)._lf();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
- },
- args: ["aClass", "aStream"],
- 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",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "chunkEscape:"]
- }),
- $globals.ChunkExporter);
- $core.addMethod(
- $core.method({
- selector: "exportMetaDefinitionOf:on:",
- protocol: 'output',
- fn: function (aClass,aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $3,$2,$1,$5,$4,$6,$7;
- $3=$recv(aClass)._class();
- $ctx1.sendIdx["class"]=1;
- $2=$recv($3)._instanceVariableNames();
- $ctx1.sendIdx["instanceVariableNames"]=1;
- $1=$recv($2)._isEmpty();
- if(!$core.assert($1)){
- $5=$recv(aClass)._class();
- $ctx1.sendIdx["class"]=2;
- $4=self._classNameFor_($5);
- $recv(aStream)._nextPutAll_($4);
- $ctx1.sendIdx["nextPutAll:"]=1;
- $6=$recv(aStream)._nextPutAll_(" instanceVariableNames: '");
- $ctx1.sendIdx["nextPutAll:"]=2;
- $6;
- $recv($recv($recv(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(aStream)._nextPutAll_(each);
- $ctx2.sendIdx["nextPutAll:"]=3;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- return $recv(aStream)._nextPutAll_(" ");
- $ctx2.sendIdx["nextPutAll:"]=4;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }));
- $recv(aStream)._nextPutAll_("'!");
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=1;
- $7=$recv(aStream)._lf();
- $7;
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
- },
- args: ["aClass", "aStream"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "classNameFor:", "do:separatedBy:", "lf"]
- }),
- $globals.ChunkExporter);
- $core.addMethod(
- $core.method({
- selector: "exportMethod:on:",
- protocol: 'output',
- fn: function (aMethod,aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=1;
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=2;
- $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aMethod)._source()));
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv(aStream)._lf();
- $1=$recv(aStream)._nextPutAll_("!");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
- },
- args: ["aMethod", "aStream"],
- source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
- referencedClasses: [],
- messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"]
- }),
- $globals.ChunkExporter);
- $core.addMethod(
- $core.method({
- selector: "exportPackage:on:",
- protocol: 'output',
- fn: function (aPackage,aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- self._exportPackageDefinitionOf_on_(aPackage,aStream);
- $1=self._exportPackageImportsOf_on_(aPackage,aStream);
- $recv($recv(aPackage)._sortedClasses())._do_((function(each){
- return $core.withContext(function($ctx2) {
- self._exportDefinitionOf_on_(each,aStream);
- $2=self._ownMethodProtocolsOfClass_(each);
- $ctx2.sendIdx["ownMethodProtocolsOfClass:"]=1;
- self._exportProtocols_on_($2,aStream);
- $ctx2.sendIdx["exportProtocols:on:"]=1;
- self._exportMetaDefinitionOf_on_(each,aStream);
- return self._exportProtocols_on_(self._ownMethodProtocolsOfClass_($recv(each)._class()),aStream);
- $ctx2.sendIdx["exportProtocols:on:"]=2;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
- },
- args: ["aPackage", "aStream"],
- 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",
- referencedClasses: [],
- messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "exportProtocols:on:", "ownMethodProtocolsOfClass:", "exportMetaDefinitionOf:on:", "class", "extensionProtocolsOfPackage:"]
- }),
- $globals.ChunkExporter);
- $core.addMethod(
- $core.method({
- selector: "exportPackageDefinitionOf:on:",
- protocol: 'output',
- fn: function (aPackage,aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=$recv("Smalltalk createPackage: '".__comma($recv(aPackage)._name())).__comma("'!");
- $ctx1.sendIdx[","]=1;
- $recv(aStream)._nextPutAll_($1);
- $2=$recv(aStream)._lf();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
- },
- args: ["aPackage", "aStream"],
- source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf",
- referencedClasses: [],
- messageSends: ["nextPutAll:", ",", "name", "lf"]
- }),
- $globals.ChunkExporter);
- $core.addMethod(
- $core.method({
- selector: "exportPackageImportsOf:on:",
- protocol: 'output',
- fn: function (aPackage,aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
- return $core.withContext(function($ctx2) {
- $recv(aStream)._nextPutAll_("(Smalltalk packageAt: '");
- $ctx2.sendIdx["nextPutAll:"]=1;
- $recv(aStream)._nextPutAll_($recv(aPackage)._name());
- $ctx2.sendIdx["nextPutAll:"]=2;
- $recv(aStream)._nextPutAll_("') imports: ");
- $ctx2.sendIdx["nextPutAll:"]=3;
- $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aPackage)._importsDefinition()));
- $ctx2.sendIdx["nextPutAll:"]=4;
- $recv(aStream)._nextPutAll_("!");
- $1=$recv(aStream)._lf();
- return $1;
- }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
- },
- args: ["aPackage", "aStream"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["ifNotEmpty:", "imports", "nextPutAll:", "name", "chunkEscape:", "importsDefinition", "lf"]
- }),
- $globals.ChunkExporter);
- $core.addMethod(
- $core.method({
- selector: "exportProtocol:on:",
- protocol: 'output',
- fn: function (aProtocol,aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._exportProtocolPrologueOf_on_(aProtocol,aStream);
- $recv($recv(aProtocol)._methods())._do_((function(method){
- return $core.withContext(function($ctx2) {
- return self._exportMethod_on_(method,aStream);
- }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
- }));
- self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
- },
- args: ["aProtocol", "aStream"],
- 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",
- referencedClasses: [],
- messageSends: ["exportProtocolPrologueOf:on:", "do:", "methods", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
- }),
- $globals.ChunkExporter);
- $core.addMethod(
- $core.method({
- selector: "exportProtocolEpilogueOf:on:",
- protocol: 'output',
- fn: function (aProtocol,aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $recv(aStream)._nextPutAll_(" !");
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=1;
- $1=$recv(aStream)._lf();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
- },
- args: ["aProtocol", "aStream"],
- source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "lf"]
- }),
- $globals.ChunkExporter);
- $core.addMethod(
- $core.method({
- selector: "exportProtocolPrologueOf:on:",
- protocol: 'output',
- fn: function (aProtocol,aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$3,$2;
- $1="!".__comma(self._classNameFor_($recv(aProtocol)._theClass()));
- $ctx1.sendIdx[","]=1;
- $recv(aStream)._nextPutAll_($1);
- $ctx1.sendIdx["nextPutAll:"]=1;
- $3=$recv(" methodsFor: '".__comma($recv(aProtocol)._name())).__comma("'!");
- $ctx1.sendIdx[","]=2;
- $2=$recv(aStream)._nextPutAll_($3);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
- },
- args: ["aProtocol", "aStream"],
- source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aProtocol theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aProtocol name, '''!'",
- referencedClasses: [],
- messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
- }),
- $globals.ChunkExporter);
- $core.addMethod(
- $core.method({
- selector: "exportProtocols:on:",
- protocol: 'output',
- fn: function (aCollection,aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aCollection)._do_((function(each){
- return $core.withContext(function($ctx2) {
- return self._exportProtocol_on_(each,aStream);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
- },
- args: ["aCollection", "aStream"],
- source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
- referencedClasses: [],
- messageSends: ["do:", "exportProtocol:on:"]
- }),
- $globals.ChunkExporter);
- $core.addMethod(
- $core.method({
- selector: "extensionCategoriesOfPackage:",
- protocol: 'accessing',
- fn: function (aPackage){
- var self=this;
- var name,map,result;
- function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
- function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- function $MethodCategory(){return $globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- name=$recv(aPackage)._name();
- result=$recv($OrderedCollection())._new();
- $ctx1.sendIdx["new"]=1;
- $recv($recv($Package())._sortedClasses_($recv($Smalltalk())._classes()))._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv([each,$recv(each)._class()])._do_((function(aClass){
- return $core.withContext(function($ctx3) {
- map=$recv($Dictionary())._new();
- map;
- $recv(aClass)._protocolsDo_((function(category,methods){
- return $core.withContext(function($ctx4) {
- $1=$recv(category).__eq("*".__comma(name));
- if($core.assert($1)){
- return $recv(map)._at_put_(category,methods);
- };
- }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
- }));
- return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
- return $core.withContext(function($ctx4) {
- return $recv(a).__lt_eq(b);
- }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
- })))._collect_((function(category){
- return $core.withContext(function($ctx4) {
- return $recv($MethodCategory())._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
- }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
- })));
- }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
- }));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $ctx1.sendIdx["do:"]=1;
- $2=result;
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
- },
- args: ["aPackage"],
- 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",
- referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
- messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "class", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
- }),
- $globals.ChunkExporter);
- $core.addMethod(
- $core.method({
- selector: "ownCategoriesOfClass:",
- protocol: 'accessing',
- fn: function (aClass){
- var self=this;
- var map;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- function $MethodCategory(){return $globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- map=$recv($Dictionary())._new();
- $recv(aClass)._protocolsDo_((function(each,methods){
- return $core.withContext(function($ctx2) {
- $1=$recv(each)._match_("^\x5c*");
- if(!$core.assert($1)){
- return $recv(map)._at_put_(each,methods);
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
- }));
- $2=$recv($recv($recv(map)._keys())._sorted_((function(a,b){
- return $core.withContext(function($ctx2) {
- return $recv(a).__lt_eq(b);
- }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
- })))._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv($MethodCategory())._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
- }));
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
- },
- args: ["aClass"],
- 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) ]",
- referencedClasses: ["Dictionary", "MethodCategory"],
- messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
- }),
- $globals.ChunkExporter);
- $core.addMethod(
- $core.method({
- selector: "ownCategoriesOfMetaClass:",
- protocol: 'accessing',
- fn: function (aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._ownCategoriesOfClass_($recv(aClass)._class());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
- },
- args: ["aClass"],
- source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass class",
- referencedClasses: [],
- messageSends: ["ownCategoriesOfClass:", "class"]
- }),
- $globals.ChunkExporter);
- $core.addMethod(
- $core.method({
- selector: "ownMethodProtocolsOfClass:",
- protocol: 'accessing',
- fn: function (aClass){
- var self=this;
- function $ExportMethodProtocol(){return $globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv(aClass)._ownProtocols())._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv($ExportMethodProtocol())._name_theClass_(each,aClass);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
- },
- args: ["aClass"],
- 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 ]",
- referencedClasses: ["ExportMethodProtocol"],
- messageSends: ["collect:", "ownProtocols", "name:theClass:"]
- }),
- $globals.ChunkExporter);
- $core.addClass('Exporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
- $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.).";
- $core.addMethod(
- $core.method({
- selector: "exportDefinitionOf:on:",
- protocol: 'output',
- fn: function (aClass,aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$3,$4,$6,$5,$7,$9,$8,$10;
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=1;
- $recv(aStream)._nextPutAll_("$core.addClass(");
- $ctx1.sendIdx["nextPutAll:"]=1;
- $2="'".__comma(self._classNameFor_(aClass));
- $ctx1.sendIdx[","]=2;
- $1=$recv($2).__comma("', ");
- $ctx1.sendIdx[","]=1;
- $recv(aStream)._nextPutAll_($1);
- $ctx1.sendIdx["nextPutAll:"]=2;
- $3=self._jsClassNameFor_($recv(aClass)._superclass());
- $ctx1.sendIdx["jsClassNameFor:"]=1;
- $recv(aStream)._nextPutAll_($3);
- $ctx1.sendIdx["nextPutAll:"]=3;
- $4=$recv(aStream)._nextPutAll_(", [");
- $ctx1.sendIdx["nextPutAll:"]=4;
- $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
- return $core.withContext(function($ctx2) {
- $6="'".__comma(each);
- $ctx2.sendIdx[","]=4;
- $5=$recv($6).__comma("'");
- $ctx2.sendIdx[","]=3;
- return $recv(aStream)._nextPutAll_($5);
- $ctx2.sendIdx["nextPutAll:"]=5;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- return $recv(aStream)._nextPutAll_(", ");
- $ctx2.sendIdx["nextPutAll:"]=6;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- $recv(aStream)._nextPutAll_("], '");
- $ctx1.sendIdx["nextPutAll:"]=7;
- $recv(aStream)._nextPutAll_($recv($recv(aClass)._category()).__comma("'"));
- $ctx1.sendIdx["nextPutAll:"]=8;
- $7=$recv(aStream)._nextPutAll_(");");
- $ctx1.sendIdx["nextPutAll:"]=9;
- $9=$recv(aClass)._comment();
- $ctx1.sendIdx["comment"]=1;
- $8=$recv($9)._notEmpty();
- if($core.assert($8)){
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=2;
- $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
- $ctx1.sendIdx["nextPutAll:"]=10;
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=3;
- $recv(aStream)._nextPutAll_(self._jsClassNameFor_(aClass));
- $ctx1.sendIdx["nextPutAll:"]=11;
- $recv(aStream)._nextPutAll_(".comment=");
- $ctx1.sendIdx["nextPutAll:"]=12;
- $recv(aStream)._nextPutAll_($recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavascript());
- $ctx1.sendIdx["nextPutAll:"]=13;
- $recv(aStream)._nextPutAll_(";");
- $ctx1.sendIdx["nextPutAll:"]=14;
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=4;
- $10=$recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
- $10;
- };
- $recv(aStream)._lf();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
- },
- args: ["aClass", "aStream"],
- 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",
- referencedClasses: [],
- messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "jsClassNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "asJavascript", "crlfSanitized"]
- }),
- $globals.Exporter);
- $core.addMethod(
- $core.method({
- selector: "exportMetaDefinitionOf:on:",
- protocol: 'output',
- fn: function (aClass,aStream){
- var self=this;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $core.withContext(function($ctx1) {
- var $3,$2,$1,$5,$4,$6,$8,$7;
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=1;
- $3=$recv(aClass)._class();
- $ctx1.sendIdx["class"]=1;
- $2=$recv($3)._instanceVariableNames();
- $ctx1.sendIdx["instanceVariableNames"]=1;
- $1=$recv($2)._isEmpty();
- if(!$core.assert($1)){
- $5=$recv(aClass)._class();
- $ctx1.sendIdx["class"]=2;
- $4=self._jsClassNameFor_($5);
- $recv(aStream)._nextPutAll_($4);
- $ctx1.sendIdx["nextPutAll:"]=1;
- $6=$recv(aStream)._nextPutAll_(".iVarNames = [");
- $ctx1.sendIdx["nextPutAll:"]=2;
- $6;
- $recv($recv($recv(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
- return $core.withContext(function($ctx2) {
- $8="'".__comma(each);
- $ctx2.sendIdx[","]=2;
- $7=$recv($8).__comma("'");
- $ctx2.sendIdx[","]=1;
- return $recv(aStream)._nextPutAll_($7);
- $ctx2.sendIdx["nextPutAll:"]=3;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- return $recv(aStream)._nextPutAll_(",");
- $ctx2.sendIdx["nextPutAll:"]=4;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }));
- $recv(aStream)._nextPutAll_("];".__comma($recv($String())._lf()));
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
- },
- args: ["aClass", "aStream"],
- 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 ]",
- referencedClasses: ["String"],
- messageSends: ["lf", "ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "jsClassNameFor:", "do:separatedBy:", ","]
- }),
- $globals.Exporter);
- $core.addMethod(
- $core.method({
- selector: "exportMethod:on:",
- protocol: 'output',
- fn: function (aMethod,aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $3,$2,$1,$5,$4,$7,$6,$10,$9,$8,$13,$12,$11,$16,$15,$14,$17;
- $recv(aStream)._nextPutAll_("$core.addMethod(");
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=1;
- $recv(aStream)._nextPutAll_("$core.method({");
- $ctx1.sendIdx["nextPutAll:"]=2;
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=2;
- $3=$recv($recv(aMethod)._selector())._asJavascript();
- $ctx1.sendIdx["asJavascript"]=1;
- $2="selector: ".__comma($3);
- $ctx1.sendIdx[","]=2;
- $1=$recv($2).__comma(",");
- $ctx1.sendIdx[","]=1;
- $recv(aStream)._nextPutAll_($1);
- $ctx1.sendIdx["nextPutAll:"]=3;
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=3;
- $5="protocol: '".__comma($recv(aMethod)._protocol());
- $ctx1.sendIdx[","]=4;
- $4=$recv($5).__comma("',");
- $ctx1.sendIdx[","]=3;
- $recv(aStream)._nextPutAll_($4);
- $ctx1.sendIdx["nextPutAll:"]=4;
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=4;
- $7="fn: ".__comma($recv($recv(aMethod)._fn())._compiledSource());
- $ctx1.sendIdx[","]=6;
- $6=$recv($7).__comma(",");
- $ctx1.sendIdx[","]=5;
- $recv(aStream)._nextPutAll_($6);
- $ctx1.sendIdx["nextPutAll:"]=5;
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=5;
- $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
- $ctx1.sendIdx["nextPutAll:"]=6;
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=6;
- $10=$recv($recv(aMethod)._arguments())._asJavascript();
- $ctx1.sendIdx["asJavascript"]=2;
- $9="args: ".__comma($10);
- $ctx1.sendIdx[","]=8;
- $8=$recv($9).__comma(",");
- $ctx1.sendIdx[","]=7;
- $recv(aStream)._nextPutAll_($8);
- $ctx1.sendIdx["nextPutAll:"]=7;
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=7;
- $13=$recv($recv(aMethod)._source())._asJavascript();
- $ctx1.sendIdx["asJavascript"]=3;
- $12="source: ".__comma($13);
- $ctx1.sendIdx[","]=10;
- $11=$recv($12).__comma(",");
- $ctx1.sendIdx[","]=9;
- $recv(aStream)._nextPutAll_($11);
- $ctx1.sendIdx["nextPutAll:"]=8;
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=8;
- $16=$recv($recv(aMethod)._referencedClasses())._asJavascript();
- $ctx1.sendIdx["asJavascript"]=4;
- $15="referencedClasses: ".__comma($16);
- $ctx1.sendIdx[","]=12;
- $14=$recv($15).__comma(",");
- $ctx1.sendIdx[","]=11;
- $recv(aStream)._nextPutAll_($14);
- $ctx1.sendIdx["nextPutAll:"]=9;
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=9;
- $recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
- $ctx1.sendIdx["nextPutAll:"]=10;
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=10;
- $recv(aStream)._nextPutAll_("messageSends: ".__comma($recv($recv(aMethod)._messageSends())._asJavascript()));
- $ctx1.sendIdx["nextPutAll:"]=11;
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=11;
- $recv(aStream)._nextPutAll_("}),");
- $ctx1.sendIdx["nextPutAll:"]=12;
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=12;
- $recv(aStream)._nextPutAll_(self._jsClassNameFor_($recv(aMethod)._methodClass()));
- $ctx1.sendIdx["nextPutAll:"]=13;
- $recv(aStream)._nextPutAll_(");");
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=13;
- $17=$recv(aStream)._lf();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
- },
- args: ["aMethod", "aStream"],
- 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",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "jsClassNameFor:", "methodClass"]
- }),
- $globals.Exporter);
- $core.addMethod(
- $core.method({
- selector: "exportPackage:on:",
- protocol: 'output',
- fn: function (aPackage,aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- self._exportPackagePrologueOf_on_(aPackage,aStream);
- self._exportPackageDefinitionOf_on_(aPackage,aStream);
- self._exportPackageContextOf_on_(aPackage,aStream);
- self._exportPackageImportsOf_on_(aPackage,aStream);
- $1=self._exportPackageTransportOf_on_(aPackage,aStream);
- $recv($recv(aPackage)._sortedClasses())._do_((function(each){
- return $core.withContext(function($ctx2) {
- self._exportDefinitionOf_on_(each,aStream);
- $2=$recv(each)._ownMethods();
- $ctx2.sendIdx["ownMethods"]=1;
- $recv($2)._do_((function(method){
- return $core.withContext(function($ctx3) {
- return self._exportMethod_on_(method,aStream);
- $ctx3.sendIdx["exportMethod:on:"]=1;
- }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
- }));
- $ctx2.sendIdx["do:"]=2;
- self._exportMetaDefinitionOf_on_(each,aStream);
- return $recv($recv($recv(each)._class())._ownMethods())._do_((function(method){
- return $core.withContext(function($ctx3) {
- return self._exportMethod_on_(method,aStream);
- $ctx3.sendIdx["exportMethod:on:"]=2;
- }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,3)});
- }));
- $ctx2.sendIdx["do:"]=3;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $ctx1.sendIdx["do:"]=1;
- $recv(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
- return $core.withContext(function($ctx2) {
- return self._exportMethod_on_(each,aStream);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
- }));
- self._exportPackageEpilogueOf_on_(aPackage,aStream);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
- },
- args: ["aPackage", "aStream"],
- 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",
- referencedClasses: [],
- messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "ownMethods", "exportMethod:on:", "exportMetaDefinitionOf:on:", "class", "extensionMethodsOfPackage:", "exportPackageEpilogueOf:on:"]
- }),
- $globals.Exporter);
- $core.addMethod(
- $core.method({
- selector: "exportPackageContextOf:on:",
- protocol: 'output',
- fn: function (aPackage,aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $recv(aStream)._nextPutAll_("$core.packages[");
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
- $ctx1.sendIdx["nextPutAll:"]=2;
- $recv(aStream)._nextPutAll_("].innerEval = ");
- $ctx1.sendIdx["nextPutAll:"]=3;
- $recv(aStream)._nextPutAll_("function (expr) { return eval(expr); }");
- $ctx1.sendIdx["nextPutAll:"]=4;
- $recv(aStream)._nextPutAll_(";");
- $1=$recv(aStream)._lf();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
- },
- args: ["aPackage", "aStream"],
- 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",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "asJavascript", "name", "lf"]
- }),
- $globals.Exporter);
- $core.addMethod(
- $core.method({
- selector: "exportPackageDefinitionOf:on:",
- protocol: 'output',
- fn: function (aPackage,aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $recv(aStream)._nextPutAll_("$core.addPackage(");
- $ctx1.sendIdx["nextPutAll:"]=1;
- $1=$recv("'".__comma($recv(aPackage)._name())).__comma("');");
- $ctx1.sendIdx[","]=1;
- $recv(aStream)._nextPutAll_($1);
- $2=$recv(aStream)._lf();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
- },
- args: ["aPackage", "aStream"],
- source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.addPackage(';\x0a\x09\x09nextPutAll: '''', aPackage name, ''');';\x0a\x09\x09lf",
- referencedClasses: [],
- messageSends: ["nextPutAll:", ",", "name", "lf"]
- }),
- $globals.Exporter);
- $core.addMethod(
- $core.method({
- selector: "exportPackageEpilogueOf:on:",
- protocol: 'output',
- fn: function (aPackage,aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
- },
- args: ["aPackage", "aStream"],
- source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.Exporter);
- $core.addMethod(
- $core.method({
- selector: "exportPackageImportsOf:on:",
- protocol: 'output',
- fn: function (aPackage,aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
- return $core.withContext(function($ctx2) {
- $recv(aStream)._nextPutAll_("$core.packages[");
- $ctx2.sendIdx["nextPutAll:"]=1;
- $1=$recv($recv(aPackage)._name())._asJavascript();
- $ctx2.sendIdx["asJavascript"]=1;
- $recv(aStream)._nextPutAll_($1);
- $ctx2.sendIdx["nextPutAll:"]=2;
- $recv(aStream)._nextPutAll_("].imports = ");
- $ctx2.sendIdx["nextPutAll:"]=3;
- $recv(aStream)._nextPutAll_($recv(imports)._asJavascript());
- $ctx2.sendIdx["nextPutAll:"]=4;
- $recv(aStream)._nextPutAll_(";");
- $2=$recv(aStream)._lf();
- return $2;
- }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
- },
- args: ["aPackage", "aStream"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["ifNotEmpty:", "importsAsJson", "nextPutAll:", "asJavascript", "name", "lf"]
- }),
- $globals.Exporter);
- $core.addMethod(
- $core.method({
- selector: "exportPackagePrologueOf:on:",
- protocol: 'output',
- fn: function (aPackage,aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
- },
- args: ["aPackage", "aStream"],
- source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.Exporter);
- $core.addMethod(
- $core.method({
- selector: "exportPackageTransportOf:on:",
- protocol: 'output',
- fn: function (aPackage,aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $recv(aStream)._nextPutAll_("$core.packages[");
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
- $ctx1.sendIdx["nextPutAll:"]=2;
- $recv(aStream)._nextPutAll_("].transport = ");
- $ctx1.sendIdx["nextPutAll:"]=3;
- $recv(aStream)._nextPutAll_($recv($recv(aPackage)._transport())._asJSONString());
- $ctx1.sendIdx["nextPutAll:"]=4;
- $recv(aStream)._nextPutAll_(";");
- $1=$recv(aStream)._lf();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
- },
- args: ["aPackage", "aStream"],
- 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",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "asJavascript", "name", "asJSONString", "transport", "lf"]
- }),
- $globals.Exporter);
- $core.addMethod(
- $core.method({
- selector: "jsClassNameFor:",
- protocol: 'convenience',
- fn: function (aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=$recv(aClass)._isMetaclass();
- if($core.assert($2)){
- $1=$recv(self._jsClassNameFor_($recv(aClass)._instanceClass())).__comma(".klass");
- $ctx1.sendIdx[","]=1;
- } else {
- if(($receiver = aClass) == null || $receiver.isNil){
- $1="null";
- } else {
- $1="$globals.".__comma($recv(aClass)._name());
- };
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"jsClassNameFor:",{aClass:aClass},$globals.Exporter)});
- },
- args: ["aClass"],
- 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 ] ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "jsClassNameFor:", "instanceClass", "ifNil:ifNotNil:", "name"]
- }),
- $globals.Exporter);
- $core.addMethod(
- $core.method({
- selector: "ownMethodsOfClass:",
- protocol: 'accessing',
- fn: function (aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $1=$recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
- return $core.withContext(function($ctx2) {
- $2=$recv(a)._selector();
- $ctx2.sendIdx["selector"]=1;
- return $recv($2).__lt_eq($recv(b)._selector());
- }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
- })))._reject_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv($recv(each)._protocol())._match_("^\x5c*");
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
- },
- args: ["aClass"],
- 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*') ]",
- referencedClasses: [],
- messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
- }),
- $globals.Exporter);
- $core.addMethod(
- $core.method({
- selector: "ownMethodsOfMetaClass:",
- protocol: 'accessing',
- fn: function (aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._ownMethodsOfClass_($recv(aClass)._class());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
- },
- args: ["aClass"],
- source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass class",
- referencedClasses: [],
- messageSends: ["ownMethodsOfClass:", "class"]
- }),
- $globals.Exporter);
- $core.addClass('AmdExporter', $globals.Exporter, ['namespace'], 'Platform-ImportExport');
- $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
- $core.addMethod(
- $core.method({
- selector: "amdNamesOfPackages:",
- protocol: 'private',
- fn: function (anArray){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $1=$recv($recv(anArray)._select_((function(each){
- return $core.withContext(function($ctx2) {
- $2=self._amdNamespaceOfPackage_(each);
- $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
- return $recv($2)._notNil();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- })))._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv($recv(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
- $ctx2.sendIdx[","]=1;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
- },
- args: ["anArray"],
- source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
- referencedClasses: [],
- messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
- }),
- $globals.AmdExporter);
- $core.addMethod(
- $core.method({
- selector: "amdNamespaceOfPackage:",
- protocol: 'private',
- fn: function (aPackage){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $4,$3,$2,$1;
- $4=$recv(aPackage)._transport();
- $ctx1.sendIdx["transport"]=1;
- $3=$recv($4)._type();
- $2=$recv($3).__eq("amd");
- if($core.assert($2)){
- $1=$recv($recv(aPackage)._transport())._namespace();
- } else {
- $1=nil;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
- },
- args: ["aPackage"],
- source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
- }),
- $globals.AmdExporter);
- $core.addMethod(
- $core.method({
- selector: "exportPackageEpilogueOf:on:",
- protocol: 'output',
- fn: function (aPackage,aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $recv(aStream)._nextPutAll_("});");
- $1=$recv(aStream)._lf();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
- },
- args: ["aPackage", "aStream"],
- source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "lf"]
- }),
- $globals.AmdExporter);
- $core.addMethod(
- $core.method({
- selector: "exportPackagePrologueOf:on:",
- protocol: 'output',
- fn: function (aPackage,aStream){
- var self=this;
- var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $core.withContext(function($ctx1) {
- var $1,$3,$2,$4,$6,$5,$7,$13,$12,$11,$10,$9,$8,$17,$16,$15,$14,$18;
- pragmaStart="";
- pragmaEnd="";
- importsForOutput=self._importsForOutput_(aPackage);
- loadDependencies=self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
- $1=$recv(importsForOutput)._value();
- $ctx1.sendIdx["value"]=1;
- $recv($1)._ifNotEmpty_((function(){
- return $core.withContext(function($ctx2) {
- $3=$recv($String())._lf();
- $ctx2.sendIdx["lf"]=1;
- $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
- $ctx2.sendIdx[","]=2;
- $4=$recv($String())._lf();
- $ctx2.sendIdx["lf"]=2;
- pragmaStart=$recv($2).__comma($4);
- $ctx2.sendIdx[","]=1;
- pragmaStart;
- $6=$recv($String())._lf();
- $ctx2.sendIdx["lf"]=3;
- $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
- $ctx2.sendIdx[","]=4;
- $7=$recv($String())._lf();
- $ctx2.sendIdx["lf"]=4;
- pragmaEnd=$recv($5).__comma($7);
- $ctx2.sendIdx[","]=3;
- return pragmaEnd;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $recv(aStream)._nextPutAll_("define(\x22");
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv(aStream)._nextPutAll_(self._amdNamespaceOfPackage_(aPackage));
- $ctx1.sendIdx["nextPutAll:"]=2;
- $recv(aStream)._nextPutAll_("/");
- $ctx1.sendIdx["nextPutAll:"]=3;
- $recv(aStream)._nextPutAll_($recv(aPackage)._name());
- $ctx1.sendIdx["nextPutAll:"]=4;
- $recv(aStream)._nextPutAll_("\x22, ");
- $ctx1.sendIdx["nextPutAll:"]=5;
- $13=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
- $ctx1.sendIdx[","]=7;
- $12=$recv($13).__comma([":2:"]);
- $ctx1.sendIdx[","]=6;
- $11=$recv($12).__comma(loadDependencies);
- $ctx1.sendIdx[","]=5;
- $10=$recv($11)._asJavascript();
- $9=$recv($10)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
- $ctx1.sendIdx["replace:with:"]=2;
- $8=$recv($9)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
- $ctx1.sendIdx["replace:with:"]=1;
- $recv(aStream)._nextPutAll_($8);
- $ctx1.sendIdx["nextPutAll:"]=6;
- $recv(aStream)._nextPutAll_(", function(");
- $ctx1.sendIdx["nextPutAll:"]=7;
- $17=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
- $ctx1.sendIdx[","]=8;
- $16=$recv($17)._join_(",");
- $15=$recv($16)._replace_with_(",\x5cs*:1:",pragmaStart);
- $14=$recv($15)._replace_with_(",\x5cs*:2:",pragmaEnd);
- $ctx1.sendIdx["replace:with:"]=3;
- $recv(aStream)._nextPutAll_($14);
- $ctx1.sendIdx["nextPutAll:"]=8;
- $recv(aStream)._nextPutAll_("){\x22use strict\x22;");
- $ctx1.sendIdx["nextPutAll:"]=9;
- $recv(aStream)._lf();
- $ctx1.sendIdx["lf"]=5;
- $recv(aStream)._nextPutAll_("var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;");
- $18=$recv(aStream)._lf();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
- },
- args: ["aPackage", "aStream"],
- 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",
- referencedClasses: ["String"],
- messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "nextPutAll:", "amdNamespaceOfPackage:", "name", "replace:with:", "asJavascript", "join:", "key"]
- }),
- $globals.AmdExporter);
- $core.addMethod(
- $core.method({
- selector: "importsForOutput:",
- protocol: 'private',
- fn: function (aPackage){
- var self=this;
- var namedImports,anonImports,importVarNames;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- namedImports=[];
- anonImports=[];
- importVarNames=[];
- $recv($recv(aPackage)._imports())._do_((function(each){
- return $core.withContext(function($ctx2) {
- $1=$recv(each)._isString();
- if($core.assert($1)){
- return $recv(anonImports)._add_(each);
- $ctx2.sendIdx["add:"]=1;
- } else {
- $recv(namedImports)._add_($recv(each)._value());
- $ctx2.sendIdx["add:"]=2;
- return $recv(importVarNames)._add_($recv(each)._key());
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $2=$recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
- },
- args: ["aPackage"],
- 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)",
- referencedClasses: [],
- messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
- }),
- $globals.AmdExporter);
- $core.addClass('ChunkParser', $globals.Object, ['stream', 'last'], 'Platform-ImportExport');
- $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";
- $core.addMethod(
- $core.method({
- selector: "last",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@last"];
- return $1;
- },
- args: [],
- source: "last\x0a\x09^ last",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ChunkParser);
- $core.addMethod(
- $core.method({
- selector: "nextChunk",
- protocol: 'reading',
- fn: function (){
- var self=this;
- var char,result,chunk;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- var $early={};
- try {
- result=""._writeStream();
- $recv((function(){
- return $core.withContext(function($ctx2) {
- char=$recv(self["@stream"])._next();
- $ctx2.sendIdx["next"]=1;
- char;
- return $recv(char)._notNil();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._whileTrue_((function(){
- return $core.withContext(function($ctx2) {
- $1=$recv(char).__eq("!");
- $ctx2.sendIdx["="]=1;
- if($core.assert($1)){
- $2=$recv($recv(self["@stream"])._peek()).__eq("!");
- if($core.assert($2)){
- $recv(self["@stream"])._next();
- } else {
- self["@last"]=$recv($recv(result)._contents())._trimBoth();
- $3=self["@last"];
- throw $early=[$3];
- };
- };
- return $recv(result)._nextPut_(char);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- self["@last"]=nil;
- $4=self["@last"];
- return $4;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
- }),
- $globals.ChunkParser);
- $core.addMethod(
- $core.method({
- selector: "stream:",
- protocol: 'accessing',
- fn: function (aStream){
- var self=this;
- self["@stream"]=aStream;
- return self;
- },
- args: ["aStream"],
- source: "stream: aStream\x0a\x09stream := aStream",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ChunkParser);
- $core.addMethod(
- $core.method({
- selector: "on:",
- protocol: 'instance creation',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._new())._stream_(aStream);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.klass)});
- },
- args: ["aStream"],
- source: "on: aStream\x0a\x09^ self new stream: aStream",
- referencedClasses: [],
- messageSends: ["stream:", "new"]
- }),
- $globals.ChunkParser.klass);
- $core.addClass('ClassCommentReader', $globals.Object, ['class'], 'Platform-ImportExport');
- $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
- $core.addMethod(
- $core.method({
- selector: "class:",
- protocol: 'accessing',
- fn: function (aClass){
- var self=this;
- self["@class"]=aClass;
- return self;
- },
- args: ["aClass"],
- source: "class: aClass\x0a\x09class := aClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ClassCommentReader);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.ClassCommentReader.superclass.fn.prototype._initialize.apply($recv(self), []));
- $ctx1.supercall = false;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
- },
- args: [],
- source: "initialize\x0a\x09super initialize.",
- referencedClasses: [],
- messageSends: ["initialize"]
- }),
- $globals.ClassCommentReader);
- $core.addMethod(
- $core.method({
- selector: "scanFrom:",
- protocol: 'fileIn',
- fn: function (aChunkParser){
- var self=this;
- var chunk;
- return $core.withContext(function($ctx1) {
- var $1;
- chunk=$recv(aChunkParser)._nextChunk();
- $1=$recv(chunk)._isEmpty();
- if(!$core.assert($1)){
- self._setComment_(chunk);
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
- },
- args: ["aChunkParser"],
- source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk ].",
- referencedClasses: [],
- messageSends: ["nextChunk", "ifFalse:", "isEmpty", "setComment:"]
- }),
- $globals.ClassCommentReader);
- $core.addMethod(
- $core.method({
- selector: "setComment:",
- protocol: 'private',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self["@class"])._comment_(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
- },
- args: ["aString"],
- source: "setComment: aString\x0a\x09class comment: aString",
- referencedClasses: [],
- messageSends: ["comment:"]
- }),
- $globals.ClassCommentReader);
- $core.addClass('ClassProtocolReader', $globals.Object, ['class', 'category'], 'Platform-ImportExport');
- $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
- $core.addMethod(
- $core.method({
- selector: "class:category:",
- protocol: 'accessing',
- fn: function (aClass,aString){
- var self=this;
- self["@class"]=aClass;
- self["@category"]=aString;
- return self;
- },
- args: ["aClass", "aString"],
- source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ClassProtocolReader);
- $core.addMethod(
- $core.method({
- selector: "compileMethod:",
- protocol: 'private',
- fn: function (aString){
- var self=this;
- function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
- return $core.withContext(function($ctx1) {
- $recv($recv($Compiler())._new())._install_forClass_protocol_(aString,self["@class"],self["@category"]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
- },
- args: ["aString"],
- source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
- referencedClasses: ["Compiler"],
- messageSends: ["install:forClass:protocol:", "new"]
- }),
- $globals.ClassProtocolReader);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.ClassProtocolReader.superclass.fn.prototype._initialize.apply($recv(self), []));
- $ctx1.supercall = false;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
- },
- args: [],
- source: "initialize\x0a\x09super initialize.",
- referencedClasses: [],
- messageSends: ["initialize"]
- }),
- $globals.ClassProtocolReader);
- $core.addMethod(
- $core.method({
- selector: "scanFrom:",
- protocol: 'fileIn',
- fn: function (aChunkParser){
- var self=this;
- var chunk;
- function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
- return $core.withContext(function($ctx1) {
- $recv((function(){
- return $core.withContext(function($ctx2) {
- chunk=$recv(aChunkParser)._nextChunk();
- chunk;
- return $recv(chunk)._isEmpty();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._whileFalse_((function(){
- return $core.withContext(function($ctx2) {
- return self._compileMethod_(chunk);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- $recv($recv($ClassBuilder())._new())._setupClass_(self["@class"]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
- },
- args: ["aChunkParser"],
- 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",
- referencedClasses: ["ClassBuilder"],
- messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:", "setupClass:", "new"]
- }),
- $globals.ClassProtocolReader);
- $core.addClass('ExportMethodProtocol', $globals.Object, ['name', 'theClass'], 'Platform-ImportExport');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "methods",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $1=$recv($recv(self._theClass())._methodsInProtocol_(self._name()))._sorted_((function(a,b){
- return $core.withContext(function($ctx2) {
- $2=$recv(a)._selector();
- $ctx2.sendIdx["selector"]=1;
- return $recv($2).__lt_eq($recv(b)._selector());
- }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
- },
- args: [],
- source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
- referencedClasses: [],
- messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
- }),
- $globals.ExportMethodProtocol);
- $core.addMethod(
- $core.method({
- selector: "name",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@name"];
- return $1;
- },
- args: [],
- source: "name\x0a\x09^ name",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ExportMethodProtocol);
- $core.addMethod(
- $core.method({
- selector: "name:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@name"]=aString;
- return self;
- },
- args: ["aString"],
- source: "name: aString\x0a\x09name := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ExportMethodProtocol);
- $core.addMethod(
- $core.method({
- selector: "theClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@theClass"];
- return $1;
- },
- args: [],
- source: "theClass\x0a\x09^ theClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ExportMethodProtocol);
- $core.addMethod(
- $core.method({
- selector: "theClass:",
- protocol: 'accessing',
- fn: function (aClass){
- var self=this;
- self["@theClass"]=aClass;
- return self;
- },
- args: ["aClass"],
- source: "theClass: aClass\x0a\x09theClass := aClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ExportMethodProtocol);
- $core.addMethod(
- $core.method({
- selector: "name:theClass:",
- protocol: 'instance creation',
- fn: function (aString,aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- $recv($2)._name_(aString);
- $recv($2)._theClass_(aClass);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.klass)});
- },
- args: ["aString", "aClass"],
- source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["name:", "new", "theClass:", "yourself"]
- }),
- $globals.ExportMethodProtocol.klass);
- $core.addClass('Importer', $globals.Object, ['lastSection', 'lastChunk'], 'Platform-ImportExport');
- $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
- $core.addMethod(
- $core.method({
- selector: "import:",
- protocol: 'fileIn',
- fn: function (aStream){
- var self=this;
- var chunk,result,parser,lastEmpty;
- function $ChunkParser(){return $globals.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)}
- function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- parser=$recv($ChunkParser())._on_(aStream);
- lastEmpty=false;
- self["@lastSection"]="n/a, not started";
- self["@lastChunk"]=nil;
- $recv((function(){
- return $core.withContext(function($ctx2) {
- $recv((function(){
- return $core.withContext(function($ctx3) {
- chunk=$recv(parser)._nextChunk();
- chunk;
- return $recv(chunk)._isNil();
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }))._whileFalse_((function(){
- return $core.withContext(function($ctx3) {
- $1=$recv(chunk)._isEmpty();
- if($core.assert($1)){
- lastEmpty=true;
- return lastEmpty;
- } else {
- self["@lastSection"]=chunk;
- self["@lastSection"];
- result=$recv($recv($Compiler())._new())._evaluateExpression_(chunk);
- result;
- $2=lastEmpty;
- if($core.assert($2)){
- lastEmpty=false;
- lastEmpty;
- return $recv(result)._scanFrom_(parser);
- };
- };
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
- }));
- self["@lastSection"]="n/a, finished";
- return self["@lastSection"];
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._on_do_($Error(),(function(e){
- return $core.withContext(function($ctx2) {
- self["@lastChunk"]=$recv(parser)._last();
- self["@lastChunk"];
- return $recv(e)._resignal();
- }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
- },
- args: ["aStream"],
- 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 ].",
- referencedClasses: ["ChunkParser", "Compiler", "Error"],
- messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifTrue:ifFalse:", "isEmpty", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "resignal"]
- }),
- $globals.Importer);
- $core.addMethod(
- $core.method({
- selector: "lastChunk",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@lastChunk"];
- return $1;
- },
- args: [],
- source: "lastChunk\x0a\x09^ lastChunk",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Importer);
- $core.addMethod(
- $core.method({
- selector: "lastSection",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@lastSection"];
- return $1;
- },
- args: [],
- source: "lastSection\x0a\x09^ lastSection",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Importer);
- $core.addClass('PackageCommitError', $globals.Error, [], 'Platform-ImportExport');
- $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
- $core.addClass('PackageHandler', $globals.InterfacingObject, [], 'Platform-ImportExport');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "ajaxPutAt:data:onSuccess:onError:",
- protocol: 'private',
- fn: function (aURL,aString,aBlock,anotherBlock){
- var self=this;
- var xhr;
- function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
- return $core.withContext(function($ctx1) {
- var $1,$4,$3,$2;
- xhr=$recv($Platform())._newXhr();
- $recv(xhr)._open_url_async_("PUT",aURL,true);
- $recv(xhr)._onreadystatechange_((function(){
- return $core.withContext(function($ctx2) {
- $1=$recv($recv(xhr)._readyState()).__eq((4));
- if($core.assert($1)){
- $4=$recv(xhr)._status();
- $ctx2.sendIdx["status"]=1;
- $3=$recv($4).__gt_eq((200));
- $2=$recv($3)._and_((function(){
- return $core.withContext(function($ctx3) {
- return $recv($recv(xhr)._status()).__lt((300));
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
- }));
- return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
- };
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $recv(xhr)._send_(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
- },
- args: ["aURL", "aString", "aBlock", "anotherBlock"],
- 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",
- referencedClasses: ["Platform"],
- messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
- }),
- $globals.PackageHandler);
- $core.addMethod(
- $core.method({
- selector: "chunkContentsFor:",
- protocol: 'accessing',
- fn: function (aPackage){
- var self=this;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($String())._streamContents_((function(str){
- return $core.withContext(function($ctx2) {
- return $recv(self._chunkExporter())._exportPackage_on_(aPackage,str);
- }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
- },
- args: ["aPackage"],
- source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
- referencedClasses: ["String"],
- messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
- }),
- $globals.PackageHandler);
- $core.addMethod(
- $core.method({
- selector: "chunkExporter",
- protocol: 'factory',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._chunkExporterClass())._new();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
- },
- args: [],
- source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
- referencedClasses: [],
- messageSends: ["new", "chunkExporterClass"]
- }),
- $globals.PackageHandler);
- $core.addMethod(
- $core.method({
- selector: "chunkExporterClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $ChunkExporter(){return $globals.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
- return $ChunkExporter();
- },
- args: [],
- source: "chunkExporterClass\x0a\x09^ ChunkExporter",
- referencedClasses: ["ChunkExporter"],
- messageSends: []
- }),
- $globals.PackageHandler);
- $core.addMethod(
- $core.method({
- selector: "commit:",
- protocol: 'committing',
- fn: function (aPackage){
- var self=this;
- function $PackageCommitError(){return $globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- self._commit_onSuccess_onError_(aPackage,(function(){
- }),(function(error){
- return $core.withContext(function($ctx2) {
- $1=$recv($PackageCommitError())._new();
- $2=$1;
- $3=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
- $ctx2.sendIdx[","]=1;
- $recv($2)._messageText_($3);
- $4=$recv($1)._signal();
- return $4;
- }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
- },
- args: ["aPackage"],
- 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 ]",
- referencedClasses: ["PackageCommitError"],
- messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
- }),
- $globals.PackageHandler);
- $core.addMethod(
- $core.method({
- selector: "commit:onSuccess:onError:",
- protocol: 'committing',
- fn: function (aPackage,aBlock,anotherBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
- return $core.withContext(function($ctx2) {
- return self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
- return $core.withContext(function($ctx3) {
- $recv(aPackage)._beClean();
- return $recv(aBlock)._value();
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }),anotherBlock);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),anotherBlock);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
- },
- args: ["aPackage", "aBlock", "anotherBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
- }),
- $globals.PackageHandler);
- $core.addMethod(
- $core.method({
- selector: "commitJsFileFor:onSuccess:onError:",
- protocol: 'committing',
- fn: function (aPackage,aBlock,anotherBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=$recv($recv(self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
- $ctx1.sendIdx[","]=2;
- $1=$recv($2).__comma(".js");
- $ctx1.sendIdx[","]=1;
- self._ajaxPutAt_data_onSuccess_onError_($1,self._contentsFor_(aPackage),aBlock,anotherBlock);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
- },
- args: ["aPackage", "aBlock", "anotherBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
- }),
- $globals.PackageHandler);
- $core.addMethod(
- $core.method({
- selector: "commitPathJsFor:",
- protocol: 'accessing',
- fn: function (aPackage){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
- },
- args: ["aPackage"],
- source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.PackageHandler);
- $core.addMethod(
- $core.method({
- selector: "commitPathStFor:",
- protocol: 'accessing',
- fn: function (aPackage){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
- },
- args: ["aPackage"],
- source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.PackageHandler);
- $core.addMethod(
- $core.method({
- selector: "commitStFileFor:onSuccess:onError:",
- protocol: 'committing',
- fn: function (aPackage,aBlock,anotherBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=$recv($recv(self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
- $ctx1.sendIdx[","]=2;
- $1=$recv($2).__comma(".st");
- $ctx1.sendIdx[","]=1;
- self._ajaxPutAt_data_onSuccess_onError_($1,self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
- },
- args: ["aPackage", "aBlock", "anotherBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
- }),
- $globals.PackageHandler);
- $core.addMethod(
- $core.method({
- selector: "contentsFor:",
- protocol: 'accessing',
- fn: function (aPackage){
- var self=this;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($String())._streamContents_((function(str){
- return $core.withContext(function($ctx2) {
- return $recv(self._exporter())._exportPackage_on_(aPackage,str);
- }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
- },
- args: ["aPackage"],
- source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
- referencedClasses: ["String"],
- messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
- }),
- $globals.PackageHandler);
- $core.addMethod(
- $core.method({
- selector: "exporter",
- protocol: 'factory',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._exporterClass())._new();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
- },
- args: [],
- source: "exporter\x0a\x09^ self exporterClass new",
- referencedClasses: [],
- messageSends: ["new", "exporterClass"]
- }),
- $globals.PackageHandler);
- $core.addMethod(
- $core.method({
- selector: "exporterClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
- },
- args: [],
- source: "exporterClass\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.PackageHandler);
- $core.addMethod(
- $core.method({
- selector: "load:",
- protocol: 'loading',
- fn: function (aPackage){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
- },
- args: ["aPackage"],
- source: "load: aPackage\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.PackageHandler);
- $core.addMethod(
- $core.method({
- selector: "onCommitError:",
- protocol: 'error handling',
- fn: function (anError){
- var self=this;
- function $PackageCommitError(){return $globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- $1=$recv($PackageCommitError())._new();
- $2=$1;
- $3=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
- $ctx1.sendIdx[","]=1;
- $recv($2)._messageText_($3);
- $4=$recv($1)._signal();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
- },
- args: ["anError"],
- source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
- referencedClasses: ["PackageCommitError"],
- messageSends: ["messageText:", "new", ",", "responseText", "signal"]
- }),
- $globals.PackageHandler);
- $core.addClass('AmdPackageHandler', $globals.PackageHandler, [], 'Platform-ImportExport');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "commitPathJsFor:",
- protocol: 'accessing',
- fn: function (aPackage){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._toUrl_(self._namespaceFor_(aPackage));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
- },
- args: ["aPackage"],
- source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
- referencedClasses: [],
- messageSends: ["toUrl:", "namespaceFor:"]
- }),
- $globals.AmdPackageHandler);
- $core.addMethod(
- $core.method({
- selector: "commitPathStFor:",
- protocol: 'accessing',
- fn: function (aPackage){
- var self=this;
- var path,pathWithout;
- return $core.withContext(function($ctx1) {
- var $1,$3,$2;
- $1=$recv(self._namespaceFor_(aPackage)).__comma("/_source");
- $ctx1.sendIdx[","]=1;
- path=self._toUrl_($1);
- pathWithout=self._commitPathJsFor_(aPackage);
- $3=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
- if($core.assert($3)){
- $2=pathWithout;
- } else {
- $2=path;
- };
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
- },
- args: ["aPackage"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
- }),
- $globals.AmdPackageHandler);
- $core.addMethod(
- $core.method({
- selector: "exporterClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $AmdExporter(){return $globals.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)}
- return $AmdExporter();
- },
- args: [],
- source: "exporterClass\x0a\x09^ AmdExporter",
- referencedClasses: ["AmdExporter"],
- messageSends: []
- }),
- $globals.AmdPackageHandler);
- $core.addMethod(
- $core.method({
- selector: "load:",
- protocol: 'loading',
- fn: function (aPackage){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
- return $core.withContext(function($ctx1) {
- var $1,$3,$2,$receiver;
- $1=$recv($Smalltalk())._amdRequire();
- if(($receiver = $1) == null || $receiver.isNil){
- self._error_("AMD loader not present");
- } else {
- var require;
- require=$receiver;
- $3=$recv($recv(self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
- $ctx1.sendIdx[","]=1;
- $2=$recv($Array())._with_($3);
- $recv(require)._value_($2);
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
- },
- args: ["aPackage"],
- 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 ) ]",
- referencedClasses: ["Smalltalk", "Array"],
- messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "with:", ",", "namespaceFor:", "name"]
- }),
- $globals.AmdPackageHandler);
- $core.addMethod(
- $core.method({
- selector: "namespaceFor:",
- protocol: 'committing',
- fn: function (aPackage){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv(aPackage)._transport())._namespace();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
- },
- args: ["aPackage"],
- source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
- referencedClasses: [],
- messageSends: ["namespace", "transport"]
- }),
- $globals.AmdPackageHandler);
- $core.addMethod(
- $core.method({
- selector: "toUrl:",
- protocol: 'private',
- fn: function (aString){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=$recv($Smalltalk())._amdRequire();
- if(($receiver = $2) == null || $receiver.isNil){
- $1=self._error_("AMD loader not present");
- } else {
- var require;
- require=$receiver;
- $1=$recv($recv(require)._basicAt_("toUrl"))._value_(aString);
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
- },
- args: ["aString"],
- 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 ]",
- referencedClasses: ["Smalltalk"],
- messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"]
- }),
- $globals.AmdPackageHandler);
- $core.addMethod(
- $core.method({
- selector: "defaultNamespace",
- protocol: 'commit paths',
- fn: function (){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Smalltalk())._defaultAmdNamespace();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.klass)});
- },
- args: [],
- source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
- referencedClasses: ["Smalltalk"],
- messageSends: ["defaultAmdNamespace"]
- }),
- $globals.AmdPackageHandler.klass);
- $core.addMethod(
- $core.method({
- selector: "defaultNamespace:",
- protocol: 'commit paths',
- fn: function (aString){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- $recv($Smalltalk())._defaultAmdNamespace_(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.klass)});
- },
- args: ["aString"],
- source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
- referencedClasses: ["Smalltalk"],
- messageSends: ["defaultAmdNamespace:"]
- }),
- $globals.AmdPackageHandler.klass);
- $core.addClass('PackageTransport', $globals.Object, ['package'], 'Platform-ImportExport');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "asJSON",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$globals.HashedCollection._newFromPairs_(["type",self._type()]);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.PackageTransport)});
- },
- args: [],
- source: "asJSON\x0a\x09^ #{ 'type' -> self type }",
- referencedClasses: [],
- messageSends: ["type"]
- }),
- $globals.PackageTransport);
- $core.addMethod(
- $core.method({
- selector: "commit",
- protocol: 'committing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._commitHandler())._commit_(self._package());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
- },
- args: [],
- source: "commit\x0a\x09self commitHandler commit: self package",
- referencedClasses: [],
- messageSends: ["commit:", "commitHandler", "package"]
- }),
- $globals.PackageTransport);
- $core.addMethod(
- $core.method({
- selector: "commitHandler",
- protocol: 'factory',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._commitHandlerClass())._new();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
- },
- args: [],
- source: "commitHandler\x0a\x09^ self commitHandlerClass new",
- referencedClasses: [],
- messageSends: ["new", "commitHandlerClass"]
- }),
- $globals.PackageTransport);
- $core.addMethod(
- $core.method({
- selector: "commitHandlerClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
- },
- args: [],
- source: "commitHandlerClass\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.PackageTransport);
- $core.addMethod(
- $core.method({
- selector: "commitOnSuccess:onError:",
- protocol: 'committing',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._commitHandler())._commit_onSuccess_onError_(self._package(),aBlock,anotherBlock);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
- },
- args: ["aBlock", "anotherBlock"],
- source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
- referencedClasses: [],
- messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
- }),
- $globals.PackageTransport);
- $core.addMethod(
- $core.method({
- selector: "definition",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return "";
- },
- args: [],
- source: "definition\x0a\x09^ ''",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.PackageTransport);
- $core.addMethod(
- $core.method({
- selector: "load",
- protocol: 'loading',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._commitHandler())._load_(self._package());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
- },
- args: [],
- source: "load\x0a\x09self commitHandler load: self package",
- referencedClasses: [],
- messageSends: ["load:", "commitHandler", "package"]
- }),
- $globals.PackageTransport);
- $core.addMethod(
- $core.method({
- selector: "package",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@package"];
- return $1;
- },
- args: [],
- source: "package\x0a\x09^ package",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.PackageTransport);
- $core.addMethod(
- $core.method({
- selector: "package:",
- protocol: 'accessing',
- fn: function (aPackage){
- var self=this;
- self["@package"]=aPackage;
- return self;
- },
- args: ["aPackage"],
- source: "package: aPackage\x0a\x09package := aPackage",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.PackageTransport);
- $core.addMethod(
- $core.method({
- selector: "setupFromJson:",
- protocol: 'initialization',
- fn: function (anObject){
- var self=this;
- return self;
- },
- args: ["anObject"],
- source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.PackageTransport);
- $core.addMethod(
- $core.method({
- selector: "type",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._class())._type();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
- },
- args: [],
- source: "type\x0a\x09^ self class type",
- referencedClasses: [],
- messageSends: ["type", "class"]
- }),
- $globals.PackageTransport);
- $globals.PackageTransport.klass.iVarNames = ['registry'];
- $core.addMethod(
- $core.method({
- selector: "classRegisteredFor:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self["@registry"])._at_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.klass)});
- },
- args: ["aString"],
- source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
- referencedClasses: [],
- messageSends: ["at:"]
- }),
- $globals.PackageTransport.klass);
- $core.addMethod(
- $core.method({
- selector: "defaultType",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $AmdPackageTransport(){return $globals.AmdPackageTransport||(typeof AmdPackageTransport=="undefined"?nil:AmdPackageTransport)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($AmdPackageTransport())._type();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.klass)});
- },
- args: [],
- source: "defaultType\x0a\x09^ AmdPackageTransport type",
- referencedClasses: ["AmdPackageTransport"],
- messageSends: ["type"]
- }),
- $globals.PackageTransport.klass);
- $core.addMethod(
- $core.method({
- selector: "for:",
- protocol: 'instance creation',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._classRegisteredFor_(aString))._new();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.klass)});
- },
- args: ["aString"],
- source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
- referencedClasses: [],
- messageSends: ["new", "classRegisteredFor:"]
- }),
- $globals.PackageTransport.klass);
- $core.addMethod(
- $core.method({
- selector: "fromJson:",
- protocol: 'instance creation',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$3,$4,$2,$receiver;
- if(($receiver = anObject) == null || $receiver.isNil){
- $1=self._for_(self._defaultType());
- $ctx1.sendIdx["for:"]=1;
- return $1;
- } else {
- anObject;
- };
- $3=self._for_($recv(anObject)._type());
- $recv($3)._setupFromJson_(anObject);
- $4=$recv($3)._yourself();
- $2=$4;
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.klass)});
- },
- args: ["anObject"],
- 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",
- referencedClasses: [],
- messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
- }),
- $globals.PackageTransport.klass);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
- return $core.withContext(function($ctx1) {
- var $1;
- (
- $ctx1.supercall = true,
- $globals.PackageTransport.klass.superclass.fn.prototype._initialize.apply($recv(self), []));
- $ctx1.supercall = false;
- $1=self.__eq_eq($PackageTransport());
- if($core.assert($1)){
- self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
- self["@registry"];
- } else {
- self._register();
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.klass)});
- },
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
- referencedClasses: ["PackageTransport"],
- messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
- }),
- $globals.PackageTransport.klass);
- $core.addMethod(
- $core.method({
- selector: "register",
- protocol: 'registration',
- fn: function (){
- var self=this;
- function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
- return $core.withContext(function($ctx1) {
- $recv($PackageTransport())._register_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.klass)});
- },
- args: [],
- source: "register\x0a\x09PackageTransport register: self",
- referencedClasses: ["PackageTransport"],
- messageSends: ["register:"]
- }),
- $globals.PackageTransport.klass);
- $core.addMethod(
- $core.method({
- selector: "register:",
- protocol: 'registration',
- fn: function (aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$receiver;
- $1=$recv(aClass)._type();
- $ctx1.sendIdx["type"]=1;
- if(($receiver = $1) == null || $receiver.isNil){
- $1;
- } else {
- $recv(self["@registry"])._at_put_($recv(aClass)._type(),aClass);
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.klass)});
- },
- args: ["aClass"],
- source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
- referencedClasses: [],
- messageSends: ["ifNotNil:", "type", "at:put:"]
- }),
- $globals.PackageTransport.klass);
- $core.addMethod(
- $core.method({
- selector: "type",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return nil;
- },
- args: [],
- source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.PackageTransport.klass);
- $core.addClass('AmdPackageTransport', $globals.PackageTransport, ['namespace'], 'Platform-ImportExport');
- $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
- $core.addMethod(
- $core.method({
- selector: "asJSON",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=(
- $ctx1.supercall = true,
- $globals.AmdPackageTransport.superclass.fn.prototype._asJSON.apply($recv(self), []));
- $ctx1.supercall = false;
- $recv($2)._at_put_("amdNamespace",self._namespace());
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.AmdPackageTransport)});
- },
- args: [],
- source: "asJSON\x0a\x09^ super asJSON\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["at:put:", "asJSON", "namespace", "yourself"]
- }),
- $globals.AmdPackageTransport);
- $core.addMethod(
- $core.method({
- selector: "commitHandlerClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $AmdPackageHandler(){return $globals.AmdPackageHandler||(typeof AmdPackageHandler=="undefined"?nil:AmdPackageHandler)}
- return $AmdPackageHandler();
- },
- args: [],
- source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
- referencedClasses: ["AmdPackageHandler"],
- messageSends: []
- }),
- $globals.AmdPackageTransport);
- $core.addMethod(
- $core.method({
- selector: "defaultNamespace",
- protocol: 'defaults',
- fn: function (){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Smalltalk())._defaultAmdNamespace();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
- },
- args: [],
- source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
- referencedClasses: ["Smalltalk"],
- messageSends: ["defaultAmdNamespace"]
- }),
- $globals.AmdPackageTransport);
- $core.addMethod(
- $core.method({
- selector: "definition",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $core.withContext(function($ctx1) {
- var $3,$2,$1;
- $1=$recv($String())._streamContents_((function(stream){
- return $core.withContext(function($ctx2) {
- $recv(stream)._nextPutAll_($recv(self._class())._name());
- $ctx2.sendIdx["nextPutAll:"]=1;
- $recv(stream)._nextPutAll_(" namespace: ");
- $ctx2.sendIdx["nextPutAll:"]=2;
- $3=$recv("'".__comma(self._namespace())).__comma("'");
- $ctx2.sendIdx[","]=1;
- $2=$recv(stream)._nextPutAll_($3);
- return $2;
- }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
- },
- args: [],
- 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, '''' ]",
- referencedClasses: ["String"],
- messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "namespace"]
- }),
- $globals.AmdPackageTransport);
- $core.addMethod(
- $core.method({
- selector: "namespace",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@namespace"];
- if(($receiver = $2) == null || $receiver.isNil){
- $1=self._defaultNamespace();
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
- },
- args: [],
- source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
- referencedClasses: [],
- messageSends: ["ifNil:", "defaultNamespace"]
- }),
- $globals.AmdPackageTransport);
- $core.addMethod(
- $core.method({
- selector: "namespace:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@namespace"]=aString;
- return self;
- },
- args: ["aString"],
- source: "namespace: aString\x0a\x09namespace := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AmdPackageTransport);
- $core.addMethod(
- $core.method({
- selector: "printOn:",
- protocol: 'printing',
- fn: function (aStream){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- (
- $ctx1.supercall = true,
- $globals.AmdPackageTransport.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
- $ctx1.supercall = false;
- $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv(aStream)._nextPutAll_(self._namespace());
- $ctx1.sendIdx["nextPutAll:"]=2;
- $1=$recv(aStream)._nextPutAll_(")");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
- },
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
- referencedClasses: [],
- messageSends: ["printOn:", "nextPutAll:", "namespace"]
- }),
- $globals.AmdPackageTransport);
- $core.addMethod(
- $core.method({
- selector: "setPath:",
- protocol: 'actions',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv($recv(require)._basicAt_("config"))._value_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([self._namespace(),aString])]));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
- },
- args: ["aString"],
- 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}.",
- referencedClasses: [],
- messageSends: ["value:", "basicAt:", "namespace"]
- }),
- $globals.AmdPackageTransport);
- $core.addMethod(
- $core.method({
- selector: "setupFromJson:",
- protocol: 'initialization',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._namespace_($recv(anObject)._at_("amdNamespace"));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
- },
- args: ["anObject"],
- source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
- referencedClasses: [],
- messageSends: ["namespace:", "at:"]
- }),
- $globals.AmdPackageTransport);
- $core.addMethod(
- $core.method({
- selector: "namespace:",
- protocol: 'instance creation',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- $recv($2)._namespace_(aString);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.klass)});
- },
- args: ["aString"],
- source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["namespace:", "new", "yourself"]
- }),
- $globals.AmdPackageTransport.klass);
- $core.addMethod(
- $core.method({
- selector: "type",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return "amd";
- },
- args: [],
- source: "type\x0a\x09^ 'amd'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AmdPackageTransport.klass);
- $core.addMethod(
- $core.method({
- selector: "commentStamp",
- protocol: '*Platform-ImportExport',
- fn: function (){
- var self=this;
- function $ClassCommentReader(){return $globals.ClassCommentReader||(typeof ClassCommentReader=="undefined"?nil:ClassCommentReader)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($ClassCommentReader())._new();
- $recv($2)._class_(self);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.Behavior)});
- },
- args: [],
- source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
- referencedClasses: ["ClassCommentReader"],
- messageSends: ["class:", "new", "yourself"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "commentStamp:prior:",
- protocol: '*Platform-ImportExport',
- fn: function (aStamp,prior){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._commentStamp();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.Behavior)});
- },
- args: ["aStamp", "prior"],
- source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
- referencedClasses: [],
- messageSends: ["commentStamp"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "methodsFor:",
- protocol: '*Platform-ImportExport',
- fn: function (aString){
- var self=this;
- function $ClassProtocolReader(){return $globals.ClassProtocolReader||(typeof ClassProtocolReader=="undefined"?nil:ClassProtocolReader)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($ClassProtocolReader())._new();
- $recv($2)._class_category_(self,aString);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.Behavior)});
- },
- args: ["aString"],
- source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
- referencedClasses: ["ClassProtocolReader"],
- messageSends: ["class:category:", "new", "yourself"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "methodsFor:stamp:",
- protocol: '*Platform-ImportExport',
- fn: function (aString,aStamp){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._methodsFor_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.Behavior)});
- },
- args: ["aString", "aStamp"],
- source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
- referencedClasses: [],
- messageSends: ["methodsFor:"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "commit",
- protocol: '*Platform-ImportExport',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._transport())._commit();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
- },
- args: [],
- source: "commit\x0a\x09^ self transport commit",
- referencedClasses: [],
- messageSends: ["commit", "transport"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "load",
- protocol: '*Platform-ImportExport',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._transport())._load();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
- },
- args: [],
- source: "load\x0a\x09^ self transport load",
- referencedClasses: [],
- messageSends: ["load", "transport"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "loadFromNamespace:",
- protocol: '*Platform-ImportExport',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._transport();
- $recv($2)._namespace_(aString);
- $3=$recv($2)._load();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
- },
- args: ["aString"],
- source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
- referencedClasses: [],
- messageSends: ["namespace:", "transport", "load"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "load:",
- protocol: '*Platform-ImportExport',
- fn: function (aPackageName){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._named_(aPackageName))._load();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.klass)});
- },
- args: ["aPackageName"],
- source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
- referencedClasses: [],
- messageSends: ["load", "named:"]
- }),
- $globals.Package.klass);
- $core.addMethod(
- $core.method({
- selector: "load:fromNamespace:",
- protocol: '*Platform-ImportExport',
- fn: function (aPackageName,aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._named_(aPackageName))._loadFromNamespace_(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.klass)});
- },
- args: ["aPackageName", "aString"],
- source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
- referencedClasses: [],
- messageSends: ["loadFromNamespace:", "named:"]
- }),
- $globals.Package.klass);
- });
- 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";
- var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
- $core.addPackage('Compiler-Core');
- $core.packages["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
- $core.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
- $core.addClass('AbstractCodeGenerator', $globals.Object, ['currentClass', 'currentPackage', 'source'], 'Compiler-Core');
- $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
- $core.addMethod(
- $core.method({
- selector: "classNameFor:",
- protocol: 'accessing',
- fn: function (aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$4,$1;
- $2=$recv(aClass)._isMetaclass();
- if($core.assert($2)){
- $3=$recv($recv(aClass)._instanceClass())._name();
- $ctx1.sendIdx["name"]=1;
- $1=$recv($3).__comma(".klass");
- } else {
- $4=$recv(aClass)._isNil();
- if($core.assert($4)){
- $1="nil";
- } else {
- $1=$recv(aClass)._name();
- };
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractCodeGenerator)});
- },
- args: ["aClass"],
- 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 ]]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"]
- }),
- $globals.AbstractCodeGenerator);
- $core.addMethod(
- $core.method({
- selector: "compileNode:",
- protocol: 'compiling',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
- },
- args: ["aNode"],
- source: "compileNode: aNode\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.AbstractCodeGenerator);
- $core.addMethod(
- $core.method({
- selector: "currentClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@currentClass"];
- return $1;
- },
- args: [],
- source: "currentClass\x0a\x09^ currentClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AbstractCodeGenerator);
- $core.addMethod(
- $core.method({
- selector: "currentClass:",
- protocol: 'accessing',
- fn: function (aClass){
- var self=this;
- self["@currentClass"]=aClass;
- return self;
- },
- args: ["aClass"],
- source: "currentClass: aClass\x0a\x09currentClass := aClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AbstractCodeGenerator);
- $core.addMethod(
- $core.method({
- selector: "currentPackage",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@currentPackage"];
- return $1;
- },
- args: [],
- source: "currentPackage\x0a\x09^ currentPackage",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AbstractCodeGenerator);
- $core.addMethod(
- $core.method({
- selector: "currentPackage:",
- protocol: 'accessing',
- fn: function (anObject){
- var self=this;
- self["@currentPackage"]=anObject;
- return self;
- },
- args: ["anObject"],
- source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AbstractCodeGenerator);
- $core.addMethod(
- $core.method({
- selector: "pseudoVariables",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Smalltalk())._pseudoVariableNames();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
- },
- args: [],
- source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
- referencedClasses: ["Smalltalk"],
- messageSends: ["pseudoVariableNames"]
- }),
- $globals.AbstractCodeGenerator);
- $core.addMethod(
- $core.method({
- selector: "source",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@source"];
- if(($receiver = $2) == null || $receiver.isNil){
- $1="";
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
- },
- args: [],
- source: "source\x0a\x09^ source ifNil: [ '' ]",
- referencedClasses: [],
- messageSends: ["ifNil:"]
- }),
- $globals.AbstractCodeGenerator);
- $core.addMethod(
- $core.method({
- selector: "source:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@source"]=aString;
- return self;
- },
- args: ["aString"],
- source: "source: aString\x0a\x09source := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AbstractCodeGenerator);
- $core.addClass('CodeGenerator', $globals.AbstractCodeGenerator, [], 'Compiler-Core');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "compileNode:",
- protocol: 'compiling',
- fn: function (aNode){
- var self=this;
- var ir,stream;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $recv(self._semanticAnalyzer())._visit_(aNode);
- $ctx1.sendIdx["visit:"]=1;
- ir=$recv(self._translator())._visit_(aNode);
- $ctx1.sendIdx["visit:"]=2;
- $2=self._irTranslator();
- $recv($2)._currentClass_(self._currentClass());
- $recv($2)._visit_(ir);
- $3=$recv($2)._contents();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.CodeGenerator)});
- },
- args: ["aNode"],
- 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",
- referencedClasses: [],
- messageSends: ["visit:", "semanticAnalyzer", "translator", "currentClass:", "irTranslator", "currentClass", "contents"]
- }),
- $globals.CodeGenerator);
- $core.addMethod(
- $core.method({
- selector: "irTranslator",
- protocol: 'compiling',
- fn: function (){
- var self=this;
- function $IRJSTranslator(){return $globals.IRJSTranslator||(typeof IRJSTranslator=="undefined"?nil:IRJSTranslator)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($IRJSTranslator())._new();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
- },
- args: [],
- source: "irTranslator\x0a\x09^ IRJSTranslator new",
- referencedClasses: ["IRJSTranslator"],
- messageSends: ["new"]
- }),
- $globals.CodeGenerator);
- $core.addMethod(
- $core.method({
- selector: "semanticAnalyzer",
- protocol: 'compiling',
- fn: function (){
- var self=this;
- function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($SemanticAnalyzer())._on_(self._currentClass());
- $recv($2)._thePackage_(self._currentPackage());
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
- },
- args: [],
- source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
- referencedClasses: ["SemanticAnalyzer"],
- messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
- }),
- $globals.CodeGenerator);
- $core.addMethod(
- $core.method({
- selector: "translator",
- protocol: 'compiling',
- fn: function (){
- var self=this;
- function $IRASTTranslator(){return $globals.IRASTTranslator||(typeof IRASTTranslator=="undefined"?nil:IRASTTranslator)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($IRASTTranslator())._new();
- $recv($2)._source_(self._source());
- $recv($2)._theClass_(self._currentClass());
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
- },
- args: [],
- source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
- referencedClasses: ["IRASTTranslator"],
- messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
- }),
- $globals.CodeGenerator);
- $core.addClass('Compiler', $globals.Object, ['currentClass', 'currentPackage', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
- $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`";
- $core.addMethod(
- $core.method({
- selector: "codeGeneratorClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $InliningCodeGenerator(){return $globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@codeGeneratorClass"];
- if(($receiver = $2) == null || $receiver.isNil){
- $1=$InliningCodeGenerator();
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
- },
- args: [],
- source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
- referencedClasses: ["InliningCodeGenerator"],
- messageSends: ["ifNil:"]
- }),
- $globals.Compiler);
- $core.addMethod(
- $core.method({
- selector: "codeGeneratorClass:",
- protocol: 'accessing',
- fn: function (aClass){
- var self=this;
- self["@codeGeneratorClass"]=aClass;
- return self;
- },
- args: ["aClass"],
- source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Compiler);
- $core.addMethod(
- $core.method({
- selector: "compile:forClass:protocol:",
- protocol: 'compiling',
- fn: function (aString,aClass,anotherString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- self._source_(aString);
- $2=self._compileNode_forClass_package_(self._parse_(aString),aClass,$recv(aClass)._packageOfProtocol_(anotherString));
- $1=$2;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
- },
- args: ["aString", "aClass", "anotherString"],
- 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)",
- referencedClasses: [],
- messageSends: ["source:", "compileNode:forClass:package:", "parse:", "packageOfProtocol:"]
- }),
- $globals.Compiler);
- $core.addMethod(
- $core.method({
- selector: "compileExpression:on:",
- protocol: 'compiling',
- fn: function (aString,anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
- $ctx1.sendIdx[","]=1;
- $1=self._compile_forClass_protocol_($2,$recv(anObject)._class(),"**xxxDoIt");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
- },
- args: ["aString", "anObject"],
- source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
- referencedClasses: [],
- messageSends: ["compile:forClass:protocol:", ",", "class"]
- }),
- $globals.Compiler);
- $core.addMethod(
- $core.method({
- selector: "compileNode:",
- protocol: 'compiling',
- fn: function (aNode){
- var self=this;
- var generator,result;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3;
- generator=$recv(self._codeGeneratorClass())._new();
- $1=generator;
- $recv($1)._source_(self._source());
- $recv($1)._currentClass_(self._currentClass());
- $2=$recv($1)._currentPackage_(self._currentPackage());
- result=$recv(generator)._compileNode_(aNode);
- self._unknownVariables_([]);
- $3=result;
- return $3;
- }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},$globals.Compiler)});
- },
- args: ["aNode"],
- 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",
- referencedClasses: [],
- messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "compileNode:", "unknownVariables:"]
- }),
- $globals.Compiler);
- $core.addMethod(
- $core.method({
- selector: "compileNode:forClass:package:",
- protocol: 'compiling',
- fn: function (aNode,aClass,aPackage){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- self._currentClass_(aClass);
- self._currentPackage_(aPackage);
- $2=self._compileNode_(aNode);
- $1=$2;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"compileNode:forClass:package:",{aNode:aNode,aClass:aClass,aPackage:aPackage},$globals.Compiler)});
- },
- args: ["aNode", "aClass", "aPackage"],
- source: "compileNode: aNode forClass: aClass package: aPackage\x0a\x09^ self\x0a\x09\x09currentClass: aClass;\x0a\x09\x09currentPackage: aPackage;\x0a\x09\x09compileNode: aNode",
- referencedClasses: [],
- messageSends: ["currentClass:", "currentPackage:", "compileNode:"]
- }),
- $globals.Compiler);
- $core.addMethod(
- $core.method({
- selector: "currentClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@currentClass"];
- return $1;
- },
- args: [],
- source: "currentClass\x0a\x09^ currentClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Compiler);
- $core.addMethod(
- $core.method({
- selector: "currentClass:",
- protocol: 'accessing',
- fn: function (aClass){
- var self=this;
- self["@currentClass"]=aClass;
- return self;
- },
- args: ["aClass"],
- source: "currentClass: aClass\x0a\x09currentClass := aClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Compiler);
- $core.addMethod(
- $core.method({
- selector: "currentPackage",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@currentPackage"];
- return $1;
- },
- args: [],
- source: "currentPackage\x0a\x09^ currentPackage",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Compiler);
- $core.addMethod(
- $core.method({
- selector: "currentPackage:",
- protocol: 'accessing',
- fn: function (anObject){
- var self=this;
- self["@currentPackage"]=anObject;
- return self;
- },
- args: ["anObject"],
- source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Compiler);
- $core.addMethod(
- $core.method({
- selector: "eval:",
- protocol: 'compiling',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- return eval(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
- },
- args: ["aString"],
- source: "eval: aString\x0a\x09<return eval(aString)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Compiler);
- $core.addMethod(
- $core.method({
- selector: "eval:forPackage:",
- protocol: 'compiling',
- fn: function (aString,aPackage){
- var self=this;
- return $core.withContext(function($ctx1) {
- return aPackage && aPackage.innerEval
- ? aPackage.innerEval(aString)
- : eval(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
- },
- args: ["aString", "aPackage"],
- source: "eval: aString forPackage: aPackage\x0a\x09<return aPackage && aPackage.innerEval\x0a\x09\x09? aPackage.innerEval(aString)\x0a\x09\x09: eval(aString)>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Compiler);
- $core.addMethod(
- $core.method({
- selector: "evaluateExpression:",
- protocol: 'compiling',
- fn: function (aString){
- var self=this;
- function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._evaluateExpression_on_(aString,$recv($DoIt())._new());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
- },
- args: ["aString"],
- 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",
- referencedClasses: ["DoIt"],
- messageSends: ["evaluateExpression:on:", "new"]
- }),
- $globals.Compiler);
- $core.addMethod(
- $core.method({
- selector: "evaluateExpression:on:",
- protocol: 'compiling',
- fn: function (aString,anObject){
- var self=this;
- var result,method;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- method=self._eval_(self._compileExpression_on_(aString,anObject));
- $recv(method)._protocol_("**xxxDoIt");
- $1=$recv(anObject)._class();
- $ctx1.sendIdx["class"]=1;
- $recv($1)._addCompiledMethod_(method);
- result=$recv(anObject)._xxxDoIt();
- $recv($recv(anObject)._class())._removeCompiledMethod_(method);
- $2=result;
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
- },
- args: ["aString", "anObject"],
- 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",
- referencedClasses: [],
- messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
- }),
- $globals.Compiler);
- $core.addMethod(
- $core.method({
- selector: "install:forClass:protocol:",
- protocol: 'compiling',
- fn: function (aString,aBehavior,anotherString){
- var self=this;
- var compiledMethod;
- function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
- return $core.withContext(function($ctx1) {
- var $1;
- compiledMethod=self._eval_forPackage_(self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
- $1=$recv($recv($ClassBuilder())._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
- },
- args: ["aString", "aBehavior", "anotherString"],
- 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",
- referencedClasses: ["ClassBuilder"],
- messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
- }),
- $globals.Compiler);
- $core.addMethod(
- $core.method({
- selector: "parse:",
- protocol: 'compiling',
- fn: function (aString){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Smalltalk())._parse_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
- },
- args: ["aString"],
- source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
- referencedClasses: ["Smalltalk"],
- messageSends: ["parse:"]
- }),
- $globals.Compiler);
- $core.addMethod(
- $core.method({
- selector: "parseExpression:",
- protocol: 'compiling',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
- $ctx1.sendIdx[","]=1;
- $1=self._parse_($2);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
- },
- args: ["aString"],
- source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
- referencedClasses: [],
- messageSends: ["parse:", ","]
- }),
- $globals.Compiler);
- $core.addMethod(
- $core.method({
- selector: "recompile:",
- protocol: 'compiling',
- fn: function (aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
- return $core.withContext(function($ctx2) {
- return self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }),"Recompiling ".__comma($recv(aClass)._name()));
- $1=$recv(aClass)._isMetaclass();
- if(!$core.assert($1)){
- self._recompile_($recv(aClass)._class());
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
- },
- args: ["aClass"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["do:displayingProgress:", "values", "methodDictionary", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifFalse:", "isMetaclass", "recompile:", "class"]
- }),
- $globals.Compiler);
- $core.addMethod(
- $core.method({
- selector: "recompileAll",
- protocol: 'compiling',
- fn: function (){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- $recv($recv($Smalltalk())._classes())._do_displayingProgress_((function(each){
- return $core.withContext(function($ctx2) {
- return self._recompile_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }),"Compiling all classes...");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
- },
- args: [],
- source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
- referencedClasses: ["Smalltalk"],
- messageSends: ["do:displayingProgress:", "classes", "recompile:"]
- }),
- $globals.Compiler);
- $core.addMethod(
- $core.method({
- selector: "source",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@source"];
- if(($receiver = $2) == null || $receiver.isNil){
- $1="";
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
- },
- args: [],
- source: "source\x0a\x09^ source ifNil: [ '' ]",
- referencedClasses: [],
- messageSends: ["ifNil:"]
- }),
- $globals.Compiler);
- $core.addMethod(
- $core.method({
- selector: "source:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@source"]=aString;
- return self;
- },
- args: ["aString"],
- source: "source: aString\x0a\x09source := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Compiler);
- $core.addMethod(
- $core.method({
- selector: "unknownVariables",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@unknownVariables"];
- return $1;
- },
- args: [],
- source: "unknownVariables\x0a\x09^ unknownVariables",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Compiler);
- $core.addMethod(
- $core.method({
- selector: "unknownVariables:",
- protocol: 'accessing',
- fn: function (aCollection){
- var self=this;
- self["@unknownVariables"]=aCollection;
- return self;
- },
- args: ["aCollection"],
- source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Compiler);
- $core.addMethod(
- $core.method({
- selector: "recompile:",
- protocol: 'compiling',
- fn: function (aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._new())._recompile_(aClass);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.klass)});
- },
- args: ["aClass"],
- source: "recompile: aClass\x0a\x09self new recompile: aClass",
- referencedClasses: [],
- messageSends: ["recompile:", "new"]
- }),
- $globals.Compiler.klass);
- $core.addMethod(
- $core.method({
- selector: "recompileAll",
- protocol: 'compiling',
- fn: function (){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- $recv($recv($Smalltalk())._classes())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return self._recompile_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.klass)});
- },
- args: [],
- source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
- referencedClasses: ["Smalltalk"],
- messageSends: ["do:", "classes", "recompile:"]
- }),
- $globals.Compiler.klass);
- $core.addClass('CompilerError', $globals.Error, [], 'Compiler-Core');
- $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
- $core.addClass('DoIt', $globals.Object, [], 'Compiler-Core');
- $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
- $core.addClass('Evaluator', $globals.InterfacingObject, [], 'Compiler-Core');
- $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
- $core.addMethod(
- $core.method({
- selector: "evaluate:context:",
- protocol: 'evaluating',
- fn: function (aString,aContext){
- var self=this;
- var compiler,ast;
- function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- function $AISemanticAnalyzer(){return $globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- var $early={};
- try {
- compiler=$recv($Compiler())._new();
- $recv((function(){
- return $core.withContext(function($ctx2) {
- ast=$recv(compiler)._parseExpression_(aString);
- return ast;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._on_do_($Error(),(function(ex){
- return $core.withContext(function($ctx2) {
- $1=self._alert_($recv(ex)._messageText());
- throw $early=[$1];
- }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
- }));
- $2=$recv($AISemanticAnalyzer())._on_($recv($recv(aContext)._receiver())._class());
- $recv($2)._context_(aContext);
- $3=$recv($2)._visit_(ast);
- $4=$recv(aContext)._evaluateNode_(ast);
- return $4;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
- },
- args: ["aString", "aContext"],
- 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",
- referencedClasses: ["Compiler", "Error", "AISemanticAnalyzer"],
- messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
- }),
- $globals.Evaluator);
- $core.addMethod(
- $core.method({
- selector: "evaluate:for:",
- protocol: 'evaluating',
- fn: function (aString,anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(anObject)._evaluate_on_(aString,self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
- },
- args: ["aString", "anObject"],
- source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
- referencedClasses: [],
- messageSends: ["evaluate:on:"]
- }),
- $globals.Evaluator);
- $core.addMethod(
- $core.method({
- selector: "evaluate:receiver:",
- protocol: 'evaluating',
- fn: function (aString,anObject){
- var self=this;
- var compiler;
- function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- var $early={};
- try {
- compiler=$recv($Compiler())._new();
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return $recv(compiler)._parseExpression_(aString);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._on_do_($Error(),(function(ex){
- return $core.withContext(function($ctx2) {
- $1=self._alert_($recv(ex)._messageText());
- throw $early=[$1];
- }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
- }));
- $2=$recv(compiler)._evaluateExpression_on_(aString,anObject);
- return $2;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
- },
- args: ["aString", "anObject"],
- 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",
- referencedClasses: ["Compiler", "Error"],
- messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
- }),
- $globals.Evaluator);
- $core.addMethod(
- $core.method({
- selector: "evaluate:for:",
- protocol: 'instance creation',
- fn: function (aString,anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._new())._evaluate_for_(aString,anObject);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.klass)});
- },
- args: ["aString", "anObject"],
- source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
- referencedClasses: [],
- messageSends: ["evaluate:for:", "new"]
- }),
- $globals.Evaluator.klass);
- $core.addMethod(
- $core.method({
- selector: "asVariableName",
- protocol: '*Compiler-Core',
- fn: function (){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=$recv($recv($Smalltalk())._reservedWords())._includes_(self);
- if($core.assert($2)){
- $1=self.__comma("_");
- } else {
- $1=self;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
- },
- args: [],
- source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
- referencedClasses: ["Smalltalk"],
- messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
- }),
- $globals.String);
- });
- define("amber_core/Compiler-AST", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){"use strict";
- var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
- $core.addPackage('Compiler-AST');
- $core.packages["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
- $core.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
- $core.addClass('Node', $globals.Object, ['parent', 'position', 'source', 'nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitNode_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.Node)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitNode: self",
- referencedClasses: [],
- messageSends: ["visitNode:"]
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "addNode:",
- protocol: 'accessing',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._nodes())._add_(aNode);
- $recv(aNode)._parent_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"addNode:",{aNode:aNode},$globals.Node)});
- },
- args: ["aNode"],
- source: "addNode: aNode\x0a\x09self nodes add: aNode.\x0a\x09aNode parent: self",
- referencedClasses: [],
- messageSends: ["add:", "nodes", "parent:"]
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "allNodes",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var allNodes;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=self._nodes();
- $ctx1.sendIdx["nodes"]=1;
- allNodes=$recv($1)._asSet();
- $recv(self._nodes())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(allNodes)._addAll_($recv(each)._allNodes());
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $2=allNodes;
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"allNodes",{allNodes:allNodes},$globals.Node)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["asSet", "nodes", "do:", "addAll:", "allNodes"]
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "inPosition:",
- protocol: 'testing',
- fn: function (aPoint){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv(self._positionStart()).__lt_eq(aPoint))._and_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self._positionEnd()).__gt_eq(aPoint);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.Node)});
- },
- args: ["aPoint"],
- source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
- referencedClasses: [],
- messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "isAssignmentNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isAssignmentNode\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "isBlockNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isBlockNode\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "isBlockSequenceNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isBlockSequenceNode\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "isCascadeNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isCascadeNode\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "isImmutable",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isImmutable\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "isJSStatementNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isJSStatementNode\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "isLastChild",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv($recv(self._parent())._nodes())._last()).__eq(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.Node)});
- },
- args: [],
- source: "isLastChild\x0a\x09^ self parent nodes last = self",
- referencedClasses: [],
- messageSends: ["=", "last", "nodes", "parent"]
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "isNavigationNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "isNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isNode\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "isReferenced",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $4,$3,$2,$1;
- $4=self._parent();
- $ctx1.sendIdx["parent"]=1;
- $3=$recv($4)._isSequenceNode();
- $2=$recv($3)._or_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self._parent())._isAssignmentNode();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $1=$recv($2)._not();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.Node)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "isReturnNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isReturnNode\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "isSendNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isSendNode\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "isSequenceNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isSequenceNode\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "isValueNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isValueNode\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "isVariableNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isVariableNode\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "method",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self._parent();
- if(($receiver = $2) == null || $receiver.isNil){
- $1=$2;
- } else {
- var node;
- node=$receiver;
- $1=$recv(node)._method();
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.Node)});
- },
- args: [],
- source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
- referencedClasses: [],
- messageSends: ["ifNotNil:", "parent", "method"]
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "navigationNodeAt:ifAbsent:",
- protocol: 'accessing',
- fn: function (aPoint,aBlock){
- var self=this;
- var children;
- return $core.withContext(function($ctx1) {
- var $1,$4,$3,$2;
- var $early={};
- try {
- children=$recv(self._allNodes())._select_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv($recv(each)._isNavigationNode())._and_((function(){
- return $core.withContext(function($ctx3) {
- return $recv(each)._inPosition_(aPoint);
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $recv(children)._ifEmpty_((function(){
- return $core.withContext(function($ctx2) {
- $1=$recv(aBlock)._value();
- throw $early=[$1];
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }));
- $2=$recv($recv($recv(children)._asArray())._sort_((function(a,b){
- return $core.withContext(function($ctx2) {
- $4=$recv(a)._positionStart();
- $ctx2.sendIdx["positionStart"]=1;
- $3=$recv($4)._dist_(aPoint);
- $ctx2.sendIdx["dist:"]=1;
- return $recv($3).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
- }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
- })))._first();
- return $2;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.Node)});
- },
- args: ["aPoint", "aBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["select:", "allNodes", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "nodes",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@nodes"];
- if(($receiver = $2) == null || $receiver.isNil){
- self["@nodes"]=$recv($Array())._new();
- $1=self["@nodes"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.Node)});
- },
- args: [],
- source: "nodes\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
- referencedClasses: ["Array"],
- messageSends: ["ifNil:", "new"]
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "nodes:",
- protocol: 'building',
- fn: function (aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- self["@nodes"]=aCollection;
- $recv(aCollection)._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._parent_(self);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nodes:",{aCollection:aCollection},$globals.Node)});
- },
- args: ["aCollection"],
- source: "nodes: aCollection\x0a\x09nodes := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
- referencedClasses: [],
- messageSends: ["do:", "parent:"]
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "parent",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@parent"];
- return $1;
- },
- args: [],
- source: "parent\x0a\x09^ parent",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "parent:",
- protocol: 'accessing',
- fn: function (aNode){
- var self=this;
- self["@parent"]=aNode;
- return self;
- },
- args: ["aNode"],
- source: "parent: aNode\x0a\x09parent := aNode",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "position",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1,$receiver;
- $2=self["@position"];
- if(($receiver = $2) == null || $receiver.isNil){
- $3=self._parent();
- if(($receiver = $3) == null || $receiver.isNil){
- $1=$3;
- } else {
- var node;
- node=$receiver;
- $1=$recv(node)._position();
- };
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Node)});
- },
- args: [],
- 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 ] ]",
- referencedClasses: [],
- messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "position:",
- protocol: 'accessing',
- fn: function (aPosition){
- var self=this;
- self["@position"]=aPosition;
- return self;
- },
- args: ["aPosition"],
- source: "position: aPosition\x0a\x09position := aPosition",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "positionEnd",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$7,$6,$5,$4,$3,$1;
- $2=self._positionStart();
- $7=self._source();
- $ctx1.sendIdx["source"]=1;
- $6=$recv($7)._lines();
- $ctx1.sendIdx["lines"]=1;
- $5=$recv($6)._size();
- $ctx1.sendIdx["size"]=1;
- $4=$recv($5).__minus((1));
- $ctx1.sendIdx["-"]=1;
- $3=$recv($4).__at($recv($recv($recv($recv(self._source())._lines())._last())._size()).__minus((1)));
- $1=$recv($2).__plus($3);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.Node)});
- },
- args: [],
- source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
- referencedClasses: [],
- messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "positionStart",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._position();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.Node)});
- },
- args: [],
- source: "positionStart\x0a\x09^ self position",
- referencedClasses: [],
- messageSends: ["position"]
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "postCopy",
- protocol: 'copying',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.Node.superclass.fn.prototype._postCopy.apply($recv(self), []));
- $ctx1.supercall = false;
- $recv(self._nodes())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._parent_(self);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.Node)});
- },
- args: [],
- source: "postCopy\x0a\x09super postCopy.\x0a\x09self nodes do: [ :each | each parent: self ]",
- referencedClasses: [],
- messageSends: ["postCopy", "do:", "nodes", "parent:"]
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "requiresSmalltalkContext",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv(self._nodes())._detect_ifNone_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._requiresSmalltalkContext();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }),(function(){
- return nil;
- })))._notNil();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.Node)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["notNil", "detect:ifNone:", "nodes", "requiresSmalltalkContext"]
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "shouldBeAliased",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@shouldBeAliased"];
- if(($receiver = $2) == null || $receiver.isNil){
- $1=false;
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.Node)});
- },
- args: [],
- source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
- referencedClasses: [],
- messageSends: ["ifNil:"]
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "shouldBeAliased:",
- protocol: 'accessing',
- fn: function (aBoolean){
- var self=this;
- self["@shouldBeAliased"]=aBoolean;
- return self;
- },
- args: ["aBoolean"],
- source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "shouldBeInlined",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@shouldBeInlined"];
- if(($receiver = $2) == null || $receiver.isNil){
- $1=false;
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.Node)});
- },
- args: [],
- source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
- referencedClasses: [],
- messageSends: ["ifNil:"]
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "shouldBeInlined:",
- protocol: 'accessing',
- fn: function (aBoolean){
- var self=this;
- self["@shouldBeInlined"]=aBoolean;
- return self;
- },
- args: ["aBoolean"],
- source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "size",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._source())._size();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Node)});
- },
- args: [],
- source: "size\x0a\x09^ self source size",
- referencedClasses: [],
- messageSends: ["size", "source"]
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "source",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@source"];
- if(($receiver = $2) == null || $receiver.isNil){
- $1="";
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Node)});
- },
- args: [],
- source: "source\x0a\x09^ source ifNil: [ '' ]",
- referencedClasses: [],
- messageSends: ["ifNil:"]
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "source:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@source"]=aString;
- return self;
- },
- args: ["aString"],
- source: "source: aString\x0a\x09source := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "subtreeNeedsAliasing",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv(self._shouldBeAliased())._or_((function(){
- return $core.withContext(function($ctx2) {
- return self._shouldBeInlined();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- })))._or_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self._nodes())._anySatisfy_((function(each){
- return $core.withContext(function($ctx3) {
- return $recv(each)._subtreeNeedsAliasing();
- }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
- }));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- $ctx1.sendIdx["or:"]=1;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.Node)});
- },
- args: [],
- source: "subtreeNeedsAliasing\x0a\x09^ (self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a\x09\x09self nodes anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
- referencedClasses: [],
- messageSends: ["or:", "shouldBeAliased", "shouldBeInlined", "anySatisfy:", "nodes", "subtreeNeedsAliasing"]
- }),
- $globals.Node);
- $core.addClass('AssignmentNode', $globals.Node, ['left', 'right'], 'Compiler-AST');
- $globals.AssignmentNode.comment="I represent an assignment node.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitAssignmentNode_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.AssignmentNode)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
- referencedClasses: [],
- messageSends: ["visitAssignmentNode:"]
- }),
- $globals.AssignmentNode);
- $core.addMethod(
- $core.method({
- selector: "isAssignmentNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isAssignmentNode\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AssignmentNode);
- $core.addMethod(
- $core.method({
- selector: "left",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@left"];
- return $1;
- },
- args: [],
- source: "left\x0a\x09^ left",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AssignmentNode);
- $core.addMethod(
- $core.method({
- selector: "left:",
- protocol: 'accessing',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- self["@left"]=aNode;
- $recv(aNode)._parent_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"left:",{aNode:aNode},$globals.AssignmentNode)});
- },
- args: ["aNode"],
- source: "left: aNode\x0a\x09left := aNode.\x0a\x09aNode parent: self",
- referencedClasses: [],
- messageSends: ["parent:"]
- }),
- $globals.AssignmentNode);
- $core.addMethod(
- $core.method({
- selector: "nodes",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Array())._with_with_(self._left(),self._right());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.AssignmentNode)});
- },
- args: [],
- source: "nodes\x0a\x09^ Array with: self left with: self right",
- referencedClasses: ["Array"],
- messageSends: ["with:with:", "left", "right"]
- }),
- $globals.AssignmentNode);
- $core.addMethod(
- $core.method({
- selector: "right",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@right"];
- return $1;
- },
- args: [],
- source: "right\x0a\x09^ right",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AssignmentNode);
- $core.addMethod(
- $core.method({
- selector: "right:",
- protocol: 'accessing',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- self["@right"]=aNode;
- $recv(aNode)._parent_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"right:",{aNode:aNode},$globals.AssignmentNode)});
- },
- args: ["aNode"],
- source: "right: aNode\x0a\x09right := aNode.\x0a\x09aNode parent: self",
- referencedClasses: [],
- messageSends: ["parent:"]
- }),
- $globals.AssignmentNode);
- $core.addMethod(
- $core.method({
- selector: "shouldBeAliased",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=(
- $ctx1.supercall = true,
- $globals.AssignmentNode.superclass.fn.prototype._shouldBeAliased.apply($recv(self), []));
- $ctx1.supercall = false;
- $1=$recv($2)._or_((function(){
- return $core.withContext(function($ctx2) {
- return self._isReferenced();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
- },
- args: [],
- source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
- referencedClasses: [],
- messageSends: ["or:", "shouldBeAliased", "isReferenced"]
- }),
- $globals.AssignmentNode);
- $core.addClass('BlockNode', $globals.Node, ['parameters', 'scope'], 'Compiler-AST');
- $globals.BlockNode.comment="I represent an block closure node.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitBlockNode_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockNode)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
- referencedClasses: [],
- messageSends: ["visitBlockNode:"]
- }),
- $globals.BlockNode);
- $core.addMethod(
- $core.method({
- selector: "isBlockNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isBlockNode\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockNode);
- $core.addMethod(
- $core.method({
- selector: "parameters",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@parameters"];
- if(($receiver = $2) == null || $receiver.isNil){
- self["@parameters"]=$recv($Array())._new();
- $1=self["@parameters"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
- },
- args: [],
- source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
- referencedClasses: ["Array"],
- messageSends: ["ifNil:", "new"]
- }),
- $globals.BlockNode);
- $core.addMethod(
- $core.method({
- selector: "parameters:",
- protocol: 'accessing',
- fn: function (aCollection){
- var self=this;
- self["@parameters"]=aCollection;
- return self;
- },
- args: ["aCollection"],
- source: "parameters: aCollection\x0a\x09parameters := aCollection",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockNode);
- $core.addMethod(
- $core.method({
- selector: "scope",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@scope"];
- return $1;
- },
- args: [],
- source: "scope\x0a\x09^ scope",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockNode);
- $core.addMethod(
- $core.method({
- selector: "scope:",
- protocol: 'accessing',
- fn: function (aLexicalScope){
- var self=this;
- self["@scope"]=aLexicalScope;
- return self;
- },
- args: ["aLexicalScope"],
- source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockNode);
- $core.addMethod(
- $core.method({
- selector: "subtreeNeedsAliasing",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._shouldBeAliased())._or_((function(){
- return $core.withContext(function($ctx2) {
- return self._shouldBeInlined();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
- },
- args: [],
- source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [ self shouldBeInlined ]",
- referencedClasses: [],
- messageSends: ["or:", "shouldBeAliased", "shouldBeInlined"]
- }),
- $globals.BlockNode);
- $core.addClass('CascadeNode', $globals.Node, ['receiver'], 'Compiler-AST');
- $globals.CascadeNode.comment="I represent an cascade node.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitCascadeNode_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.CascadeNode)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
- referencedClasses: [],
- messageSends: ["visitCascadeNode:"]
- }),
- $globals.CascadeNode);
- $core.addMethod(
- $core.method({
- selector: "isCascadeNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isCascadeNode\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.CascadeNode);
- $core.addMethod(
- $core.method({
- selector: "receiver",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@receiver"];
- return $1;
- },
- args: [],
- source: "receiver\x0a\x09^ receiver",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.CascadeNode);
- $core.addMethod(
- $core.method({
- selector: "receiver:",
- protocol: 'accessing',
- fn: function (aNode){
- var self=this;
- self["@receiver"]=aNode;
- return self;
- },
- args: ["aNode"],
- source: "receiver: aNode\x0a\x09receiver := aNode",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.CascadeNode);
- $core.addClass('DynamicArrayNode', $globals.Node, [], 'Compiler-AST');
- $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitDynamicArrayNode_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
- referencedClasses: [],
- messageSends: ["visitDynamicArrayNode:"]
- }),
- $globals.DynamicArrayNode);
- $core.addClass('DynamicDictionaryNode', $globals.Node, [], 'Compiler-AST');
- $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitDynamicDictionaryNode_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
- referencedClasses: [],
- messageSends: ["visitDynamicDictionaryNode:"]
- }),
- $globals.DynamicDictionaryNode);
- $core.addClass('JSStatementNode', $globals.Node, [], 'Compiler-AST');
- $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitJSStatementNode_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.JSStatementNode)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
- referencedClasses: [],
- messageSends: ["visitJSStatementNode:"]
- }),
- $globals.JSStatementNode);
- $core.addMethod(
- $core.method({
- selector: "isJSStatementNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isJSStatementNode\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JSStatementNode);
- $core.addMethod(
- $core.method({
- selector: "requiresSmalltalkContext",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "requiresSmalltalkContext\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JSStatementNode);
- $core.addClass('MethodNode', $globals.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'sendIndexes', 'superSends'], 'Compiler-AST');
- $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitMethodNode_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.MethodNode)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
- referencedClasses: [],
- messageSends: ["visitMethodNode:"]
- }),
- $globals.MethodNode);
- $core.addMethod(
- $core.method({
- selector: "arguments",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@arguments"];
- if(($receiver = $2) == null || $receiver.isNil){
- $1=[];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
- },
- args: [],
- source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
- referencedClasses: [],
- messageSends: ["ifNil:"]
- }),
- $globals.MethodNode);
- $core.addMethod(
- $core.method({
- selector: "arguments:",
- protocol: 'accessing',
- fn: function (aCollection){
- var self=this;
- self["@arguments"]=aCollection;
- return self;
- },
- args: ["aCollection"],
- source: "arguments: aCollection\x0a\x09arguments := aCollection",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodNode);
- $core.addMethod(
- $core.method({
- selector: "classReferences",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@classReferences"];
- return $1;
- },
- args: [],
- source: "classReferences\x0a\x09^ classReferences",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodNode);
- $core.addMethod(
- $core.method({
- selector: "classReferences:",
- protocol: 'accessing',
- fn: function (aCollection){
- var self=this;
- self["@classReferences"]=aCollection;
- return self;
- },
- args: ["aCollection"],
- source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodNode);
- $core.addMethod(
- $core.method({
- selector: "messageSends",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._sendIndexes())._keys();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
- },
- args: [],
- source: "messageSends\x0a\x09^ self sendIndexes keys",
- referencedClasses: [],
- messageSends: ["keys", "sendIndexes"]
- }),
- $globals.MethodNode);
- $core.addMethod(
- $core.method({
- selector: "method",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "method\x0a\x09^ self",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodNode);
- $core.addMethod(
- $core.method({
- selector: "scope",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@scope"];
- return $1;
- },
- args: [],
- source: "scope\x0a\x09^ scope",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodNode);
- $core.addMethod(
- $core.method({
- selector: "scope:",
- protocol: 'accessing',
- fn: function (aMethodScope){
- var self=this;
- self["@scope"]=aMethodScope;
- return self;
- },
- args: ["aMethodScope"],
- source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodNode);
- $core.addMethod(
- $core.method({
- selector: "selector",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@selector"];
- return $1;
- },
- args: [],
- source: "selector\x0a\x09^ selector",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodNode);
- $core.addMethod(
- $core.method({
- selector: "selector:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@selector"]=aString;
- return self;
- },
- args: ["aString"],
- source: "selector: aString\x0a\x09selector := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodNode);
- $core.addMethod(
- $core.method({
- selector: "sendIndexes",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@sendIndexes"];
- return $1;
- },
- args: [],
- source: "sendIndexes\x0a\x09^ sendIndexes",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodNode);
- $core.addMethod(
- $core.method({
- selector: "sendIndexes:",
- protocol: 'accessing',
- fn: function (aDictionary){
- var self=this;
- self["@sendIndexes"]=aDictionary;
- return self;
- },
- args: ["aDictionary"],
- source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodNode);
- $core.addMethod(
- $core.method({
- selector: "sequenceNode",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- var $early={};
- try {
- $recv(self._nodes())._do_((function(each){
- return $core.withContext(function($ctx2) {
- $1=$recv(each)._isSequenceNode();
- if($core.assert($1)){
- throw $early=[each];
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return nil;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
- },
- args: [],
- source: "sequenceNode\x0a\x09self nodes do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
- referencedClasses: [],
- messageSends: ["do:", "nodes", "ifTrue:", "isSequenceNode"]
- }),
- $globals.MethodNode);
- $core.addMethod(
- $core.method({
- selector: "source",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@source"];
- return $1;
- },
- args: [],
- source: "source\x0a\x09^ source",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodNode);
- $core.addMethod(
- $core.method({
- selector: "source:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@source"]=aString;
- return self;
- },
- args: ["aString"],
- source: "source: aString\x0a\x09source := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodNode);
- $core.addMethod(
- $core.method({
- selector: "superSends",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@superSends"];
- return $1;
- },
- args: [],
- source: "superSends\x0a\x09^ superSends",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodNode);
- $core.addMethod(
- $core.method({
- selector: "superSends:",
- protocol: 'accessing',
- fn: function (aCollection){
- var self=this;
- self["@superSends"]=aCollection;
- return self;
- },
- args: ["aCollection"],
- source: "superSends: aCollection\x0a\x09superSends := aCollection",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodNode);
- $core.addClass('ReturnNode', $globals.Node, ['scope'], 'Compiler-AST');
- $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitReturnNode_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ReturnNode)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
- referencedClasses: [],
- messageSends: ["visitReturnNode:"]
- }),
- $globals.ReturnNode);
- $core.addMethod(
- $core.method({
- selector: "isReturnNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isReturnNode\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ReturnNode);
- $core.addMethod(
- $core.method({
- selector: "nonLocalReturn",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv(self._scope())._isMethodScope())._not();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
- },
- args: [],
- source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
- referencedClasses: [],
- messageSends: ["not", "isMethodScope", "scope"]
- }),
- $globals.ReturnNode);
- $core.addMethod(
- $core.method({
- selector: "scope",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@scope"];
- return $1;
- },
- args: [],
- source: "scope\x0a\x09^ scope",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ReturnNode);
- $core.addMethod(
- $core.method({
- selector: "scope:",
- protocol: 'accessing',
- fn: function (aLexicalScope){
- var self=this;
- self["@scope"]=aLexicalScope;
- return self;
- },
- args: ["aLexicalScope"],
- source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ReturnNode);
- $core.addClass('SendNode', $globals.Node, ['selector', 'arguments', 'receiver', 'superSend', 'index'], 'Compiler-AST');
- $globals.SendNode.comment="I represent an message send node.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitSendNode_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SendNode)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
- referencedClasses: [],
- messageSends: ["visitSendNode:"]
- }),
- $globals.SendNode);
- $core.addMethod(
- $core.method({
- selector: "arguments",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@arguments"];
- if(($receiver = $2) == null || $receiver.isNil){
- self["@arguments"]=[];
- $1=self["@arguments"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
- },
- args: [],
- source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
- referencedClasses: [],
- messageSends: ["ifNil:"]
- }),
- $globals.SendNode);
- $core.addMethod(
- $core.method({
- selector: "arguments:",
- protocol: 'accessing',
- fn: function (aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- self["@arguments"]=aCollection;
- $recv(aCollection)._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._parent_(self);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.SendNode)});
- },
- args: ["aCollection"],
- source: "arguments: aCollection\x0a\x09arguments := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
- referencedClasses: [],
- messageSends: ["do:", "parent:"]
- }),
- $globals.SendNode);
- $core.addMethod(
- $core.method({
- selector: "cascadeNodeWithMessages:",
- protocol: 'accessing',
- fn: function (aCollection){
- var self=this;
- var first;
- function $SendNode(){return $globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
- function $CascadeNode(){return $globals.CascadeNode||(typeof CascadeNode=="undefined"?nil:CascadeNode)}
- function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$4,$5,$3;
- $1=$recv($SendNode())._new();
- $ctx1.sendIdx["new"]=1;
- $recv($1)._selector_(self._selector());
- $recv($1)._arguments_(self._arguments());
- $2=$recv($1)._yourself();
- $ctx1.sendIdx["yourself"]=1;
- first=$2;
- $4=$recv($CascadeNode())._new();
- $recv($4)._receiver_(self._receiver());
- $recv($4)._nodes_($recv($recv($Array())._with_(first)).__comma(aCollection));
- $5=$recv($4)._yourself();
- $3=$5;
- return $3;
- }, function($ctx1) {$ctx1.fill(self,"cascadeNodeWithMessages:",{aCollection:aCollection,first:first},$globals.SendNode)});
- },
- args: ["aCollection"],
- 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",
- referencedClasses: ["SendNode", "CascadeNode", "Array"],
- messageSends: ["selector:", "new", "selector", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"]
- }),
- $globals.SendNode);
- $core.addMethod(
- $core.method({
- selector: "index",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@index"];
- return $1;
- },
- args: [],
- source: "index\x0a\x09^ index",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SendNode);
- $core.addMethod(
- $core.method({
- selector: "index:",
- protocol: 'accessing',
- fn: function (anInteger){
- var self=this;
- self["@index"]=anInteger;
- return self;
- },
- args: ["anInteger"],
- source: "index: anInteger\x0a\x09index := anInteger",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SendNode);
- $core.addMethod(
- $core.method({
- selector: "isCascadeSendNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._parent())._isCascadeNode();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
- },
- args: [],
- source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
- referencedClasses: [],
- messageSends: ["isCascadeNode", "parent"]
- }),
- $globals.SendNode);
- $core.addMethod(
- $core.method({
- selector: "isNavigationNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isNavigationNode\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SendNode);
- $core.addMethod(
- $core.method({
- selector: "isSendNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isSendNode\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SendNode);
- $core.addMethod(
- $core.method({
- selector: "navigationLink",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._selector();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
- },
- args: [],
- source: "navigationLink\x0a\x09^ self selector",
- referencedClasses: [],
- messageSends: ["selector"]
- }),
- $globals.SendNode);
- $core.addMethod(
- $core.method({
- selector: "nodes",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
- return $core.withContext(function($ctx1) {
- var $1,$3,$2,$5,$6,$4,$receiver;
- $1=self._receiver();
- $ctx1.sendIdx["receiver"]=1;
- if(($receiver = $1) == null || $receiver.isNil){
- $3=self._arguments();
- $ctx1.sendIdx["arguments"]=1;
- $2=$recv($3)._copy();
- return $2;
- } else {
- $1;
- };
- $5=$recv($Array())._with_(self._receiver());
- $recv($5)._addAll_(self._arguments());
- $6=$recv($5)._yourself();
- $4=$6;
- return $4;
- }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.SendNode)});
- },
- args: [],
- 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",
- referencedClasses: ["Array"],
- messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
- }),
- $globals.SendNode);
- $core.addMethod(
- $core.method({
- selector: "receiver",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@receiver"];
- return $1;
- },
- args: [],
- source: "receiver\x0a\x09^ receiver",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SendNode);
- $core.addMethod(
- $core.method({
- selector: "receiver:",
- protocol: 'accessing',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- self["@receiver"]=aNode;
- $1=$recv(aNode)._isNode();
- if($core.assert($1)){
- $recv(aNode)._parent_(self);
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},$globals.SendNode)});
- },
- args: ["aNode"],
- source: "receiver: aNode\x0a\x09receiver := aNode.\x0a\x09aNode isNode ifTrue: [\x0a\x09\x09aNode parent: self ]",
- referencedClasses: [],
- messageSends: ["ifTrue:", "isNode", "parent:"]
- }),
- $globals.SendNode);
- $core.addMethod(
- $core.method({
- selector: "requiresSmalltalkContext",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "requiresSmalltalkContext\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SendNode);
- $core.addMethod(
- $core.method({
- selector: "selector",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@selector"];
- return $1;
- },
- args: [],
- source: "selector\x0a\x09^ selector",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SendNode);
- $core.addMethod(
- $core.method({
- selector: "selector:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@selector"]=aString;
- return self;
- },
- args: ["aString"],
- source: "selector: aString\x0a\x09selector := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SendNode);
- $core.addMethod(
- $core.method({
- selector: "shouldBeAliased",
- protocol: 'testing',
- fn: function (){
- var self=this;
- var sends;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- sends=$recv($recv($recv(self._method())._sendIndexes())._at_(self._selector()))._size();
- $2=(
- $ctx1.supercall = true,
- $globals.SendNode.superclass.fn.prototype._shouldBeAliased.apply($recv(self), []));
- $ctx1.supercall = false;
- $1=$recv($2)._or_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self._isReferenced())._and_((function(){
- return $core.withContext(function($ctx3) {
- return $recv($recv($recv(sends).__gt((1)))._and_((function(){
- return $core.withContext(function($ctx4) {
- return $recv(self._index()).__lt(sends);
- }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
- })))._or_((function(){
- return $core.withContext(function($ctx4) {
- return self._superSend();
- }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
- }));
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }));
- $ctx2.sendIdx["and:"]=1;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $ctx1.sendIdx["or:"]=1;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
- },
- args: [],
- 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 ] ] ])",
- referencedClasses: [],
- messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", ">", "<", "index", "superSend"]
- }),
- $globals.SendNode);
- $core.addMethod(
- $core.method({
- selector: "superSend",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@superSend"];
- if(($receiver = $2) == null || $receiver.isNil){
- $1=false;
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
- },
- args: [],
- source: "superSend\x0a\x09^ superSend ifNil: [ false ]",
- referencedClasses: [],
- messageSends: ["ifNil:"]
- }),
- $globals.SendNode);
- $core.addMethod(
- $core.method({
- selector: "superSend:",
- protocol: 'accessing',
- fn: function (aBoolean){
- var self=this;
- self["@superSend"]=aBoolean;
- return self;
- },
- args: ["aBoolean"],
- source: "superSend: aBoolean\x0a\x09superSend := aBoolean",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SendNode);
- $core.addMethod(
- $core.method({
- selector: "valueForReceiver:",
- protocol: 'building',
- fn: function (anObject){
- var self=this;
- function $SendNode(){return $globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$5,$4,$6,$1,$receiver;
- $2=$recv($SendNode())._new();
- $recv($2)._position_(self._position());
- $recv($2)._source_(self._source());
- $3=$2;
- $5=self._receiver();
- $ctx1.sendIdx["receiver"]=1;
- if(($receiver = $5) == null || $receiver.isNil){
- $4=anObject;
- } else {
- $4=$recv(self._receiver())._valueForReceiver_(anObject);
- };
- $recv($3)._receiver_($4);
- $recv($2)._selector_(self._selector());
- $recv($2)._arguments_(self._arguments());
- $6=$recv($2)._yourself();
- $1=$6;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},$globals.SendNode)});
- },
- args: ["anObject"],
- 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",
- referencedClasses: ["SendNode"],
- messageSends: ["position:", "new", "position", "source:", "source", "receiver:", "ifNil:ifNotNil:", "receiver", "valueForReceiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
- }),
- $globals.SendNode);
- $core.addClass('SequenceNode', $globals.Node, ['temps', 'scope'], 'Compiler-AST');
- $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).";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitSequenceNode_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SequenceNode)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
- referencedClasses: [],
- messageSends: ["visitSequenceNode:"]
- }),
- $globals.SequenceNode);
- $core.addMethod(
- $core.method({
- selector: "asBlockSequenceNode",
- protocol: 'building',
- fn: function (){
- var self=this;
- function $BlockSequenceNode(){return $globals.BlockSequenceNode||(typeof BlockSequenceNode=="undefined"?nil:BlockSequenceNode)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($BlockSequenceNode())._new();
- $recv($2)._position_(self._position());
- $recv($2)._source_(self._source());
- $recv($2)._nodes_(self._nodes());
- $recv($2)._temps_(self._temps());
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
- },
- args: [],
- 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",
- referencedClasses: ["BlockSequenceNode"],
- messageSends: ["position:", "new", "position", "source:", "source", "nodes:", "nodes", "temps:", "temps", "yourself"]
- }),
- $globals.SequenceNode);
- $core.addMethod(
- $core.method({
- selector: "isSequenceNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isSequenceNode\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SequenceNode);
- $core.addMethod(
- $core.method({
- selector: "scope",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@scope"];
- return $1;
- },
- args: [],
- source: "scope\x0a\x09^ scope",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SequenceNode);
- $core.addMethod(
- $core.method({
- selector: "scope:",
- protocol: 'accessing',
- fn: function (aLexicalScope){
- var self=this;
- self["@scope"]=aLexicalScope;
- return self;
- },
- args: ["aLexicalScope"],
- source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SequenceNode);
- $core.addMethod(
- $core.method({
- selector: "temps",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@temps"];
- if(($receiver = $2) == null || $receiver.isNil){
- $1=[];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
- },
- args: [],
- source: "temps\x0a\x09^ temps ifNil: [ #() ]",
- referencedClasses: [],
- messageSends: ["ifNil:"]
- }),
- $globals.SequenceNode);
- $core.addMethod(
- $core.method({
- selector: "temps:",
- protocol: 'accessing',
- fn: function (aCollection){
- var self=this;
- self["@temps"]=aCollection;
- return self;
- },
- args: ["aCollection"],
- source: "temps: aCollection\x0a\x09temps := aCollection",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SequenceNode);
- $core.addClass('BlockSequenceNode', $globals.SequenceNode, [], 'Compiler-AST');
- $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitBlockSequenceNode_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
- referencedClasses: [],
- messageSends: ["visitBlockSequenceNode:"]
- }),
- $globals.BlockSequenceNode);
- $core.addMethod(
- $core.method({
- selector: "isBlockSequenceNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isBlockSequenceNode\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockSequenceNode);
- $core.addClass('ValueNode', $globals.Node, ['value'], 'Compiler-AST');
- $globals.ValueNode.comment="I represent a value node.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitValueNode_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ValueNode)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
- referencedClasses: [],
- messageSends: ["visitValueNode:"]
- }),
- $globals.ValueNode);
- $core.addMethod(
- $core.method({
- selector: "isImmutable",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._value())._isImmutable();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
- },
- args: [],
- source: "isImmutable\x0a\x09^ self value isImmutable",
- referencedClasses: [],
- messageSends: ["isImmutable", "value"]
- }),
- $globals.ValueNode);
- $core.addMethod(
- $core.method({
- selector: "isValueNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isValueNode\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ValueNode);
- $core.addMethod(
- $core.method({
- selector: "value",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@value"];
- return $1;
- },
- args: [],
- source: "value\x0a\x09^ value",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ValueNode);
- $core.addMethod(
- $core.method({
- selector: "value:",
- protocol: 'accessing',
- fn: function (anObject){
- var self=this;
- self["@value"]=anObject;
- return self;
- },
- args: ["anObject"],
- source: "value: anObject\x0a\x09value := anObject",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ValueNode);
- $core.addClass('VariableNode', $globals.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
- $globals.VariableNode.comment="I represent an variable node.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitVariableNode_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.VariableNode)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
- referencedClasses: [],
- messageSends: ["visitVariableNode:"]
- }),
- $globals.VariableNode);
- $core.addMethod(
- $core.method({
- selector: "alias",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._binding())._alias();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
- },
- args: [],
- source: "alias\x0a\x09^ self binding alias",
- referencedClasses: [],
- messageSends: ["alias", "binding"]
- }),
- $globals.VariableNode);
- $core.addMethod(
- $core.method({
- selector: "assigned",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@assigned"];
- if(($receiver = $2) == null || $receiver.isNil){
- $1=false;
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
- },
- args: [],
- source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
- referencedClasses: [],
- messageSends: ["ifNil:"]
- }),
- $globals.VariableNode);
- $core.addMethod(
- $core.method({
- selector: "assigned:",
- protocol: 'accessing',
- fn: function (aBoolean){
- var self=this;
- self["@assigned"]=aBoolean;
- return self;
- },
- args: ["aBoolean"],
- source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.VariableNode);
- $core.addMethod(
- $core.method({
- selector: "beAssigned",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._binding())._validateAssignment();
- self["@assigned"]=true;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
- },
- args: [],
- source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
- referencedClasses: [],
- messageSends: ["validateAssignment", "binding"]
- }),
- $globals.VariableNode);
- $core.addMethod(
- $core.method({
- selector: "binding",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@binding"];
- return $1;
- },
- args: [],
- source: "binding\x0a\x09^ binding",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.VariableNode);
- $core.addMethod(
- $core.method({
- selector: "binding:",
- protocol: 'accessing',
- fn: function (aScopeVar){
- var self=this;
- self["@binding"]=aScopeVar;
- return self;
- },
- args: ["aScopeVar"],
- source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.VariableNode);
- $core.addMethod(
- $core.method({
- selector: "isArgument",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._binding())._isArgVar();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
- },
- args: [],
- source: "isArgument\x0a\x09^ self binding isArgVar",
- referencedClasses: [],
- messageSends: ["isArgVar", "binding"]
- }),
- $globals.VariableNode);
- $core.addMethod(
- $core.method({
- selector: "isImmutable",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._binding())._isImmutable();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
- },
- args: [],
- source: "isImmutable\x0a\x09^ self binding isImmutable",
- referencedClasses: [],
- messageSends: ["isImmutable", "binding"]
- }),
- $globals.VariableNode);
- $core.addMethod(
- $core.method({
- selector: "isNavigationNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isNavigationNode\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.VariableNode);
- $core.addMethod(
- $core.method({
- selector: "isVariableNode",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isVariableNode\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.VariableNode);
- $core.addMethod(
- $core.method({
- selector: "navigationLink",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._value();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
- },
- args: [],
- source: "navigationLink\x0a\x09^ self value",
- referencedClasses: [],
- messageSends: ["value"]
- }),
- $globals.VariableNode);
- $core.addClass('NodeVisitor', $globals.Object, [], 'Compiler-AST');
- $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
- $core.addMethod(
- $core.method({
- selector: "visit:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aNode)._accept_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.NodeVisitor)});
- },
- args: ["aNode"],
- source: "visit: aNode\x0a\x09^ aNode accept: self",
- referencedClasses: [],
- messageSends: ["accept:"]
- }),
- $globals.NodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitAll:",
- protocol: 'visiting',
- fn: function (aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aCollection)._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return self._visit_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.NodeVisitor)});
- },
- args: ["aCollection"],
- source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
- referencedClasses: [],
- messageSends: ["collect:", "visit:"]
- }),
- $globals.NodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitAssignmentNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitNode_(aNode);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
- },
- args: ["aNode"],
- source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
- referencedClasses: [],
- messageSends: ["visitNode:"]
- }),
- $globals.NodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitBlockNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitNode_(aNode);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
- },
- args: ["aNode"],
- source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
- referencedClasses: [],
- messageSends: ["visitNode:"]
- }),
- $globals.NodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitBlockSequenceNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitSequenceNode_(aNode);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
- },
- args: ["aNode"],
- source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
- referencedClasses: [],
- messageSends: ["visitSequenceNode:"]
- }),
- $globals.NodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitCascadeNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitNode_(aNode);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
- },
- args: ["aNode"],
- source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
- referencedClasses: [],
- messageSends: ["visitNode:"]
- }),
- $globals.NodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitDynamicArrayNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitNode_(aNode);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
- },
- args: ["aNode"],
- source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
- referencedClasses: [],
- messageSends: ["visitNode:"]
- }),
- $globals.NodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitDynamicDictionaryNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitNode_(aNode);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
- },
- args: ["aNode"],
- source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
- referencedClasses: [],
- messageSends: ["visitNode:"]
- }),
- $globals.NodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitJSStatementNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitNode_(aNode);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
- },
- args: ["aNode"],
- source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
- referencedClasses: [],
- messageSends: ["visitNode:"]
- }),
- $globals.NodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitMethodNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitNode_(aNode);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
- },
- args: ["aNode"],
- source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
- referencedClasses: [],
- messageSends: ["visitNode:"]
- }),
- $globals.NodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitAll_($recv(aNode)._nodes());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},$globals.NodeVisitor)});
- },
- args: ["aNode"],
- source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
- referencedClasses: [],
- messageSends: ["visitAll:", "nodes"]
- }),
- $globals.NodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitReturnNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitNode_(aNode);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
- },
- args: ["aNode"],
- source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
- referencedClasses: [],
- messageSends: ["visitNode:"]
- }),
- $globals.NodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitSendNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitNode_(aNode);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
- },
- args: ["aNode"],
- source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
- referencedClasses: [],
- messageSends: ["visitNode:"]
- }),
- $globals.NodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitSequenceNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitNode_(aNode);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
- },
- args: ["aNode"],
- source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
- referencedClasses: [],
- messageSends: ["visitNode:"]
- }),
- $globals.NodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitValueNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitNode_(aNode);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
- },
- args: ["aNode"],
- source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
- referencedClasses: [],
- messageSends: ["visitNode:"]
- }),
- $globals.NodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitVariableNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitNode_(aNode);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
- },
- args: ["aNode"],
- source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
- referencedClasses: [],
- messageSends: ["visitNode:"]
- }),
- $globals.NodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "ast",
- protocol: '*Compiler-AST',
- fn: function (){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=self._source();
- $ctx1.sendIdx["source"]=1;
- $recv($1)._ifEmpty_((function(){
- return $core.withContext(function($ctx2) {
- return self._error_("Method source is empty");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $2=$recv($Smalltalk())._parse_(self._source());
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
- },
- args: [],
- source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
- referencedClasses: ["Smalltalk"],
- messageSends: ["ifEmpty:", "source", "error:", "parse:"]
- }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "isNode",
- protocol: '*Compiler-AST',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isNode\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Object);
- });
- define("amber_core/Compiler-Semantic", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Compiler-AST", "amber_core/Compiler-Core"], function($boot){"use strict";
- var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
- $core.addPackage('Compiler-Semantic');
- $core.packages["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
- $core.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
- $core.addClass('LexicalScope', $globals.Object, ['node', 'instruction', 'temps', 'args', 'outerScope', 'blockIndex'], 'Compiler-Semantic');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "addArg:",
- protocol: 'adding',
- fn: function (aString){
- var self=this;
- function $ArgVar(){return $globals.ArgVar||(typeof ArgVar=="undefined"?nil:ArgVar)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._args();
- $ctx1.sendIdx["args"]=1;
- $recv($1)._at_put_(aString,$recv($ArgVar())._on_(aString));
- $recv($recv(self._args())._at_(aString))._scope_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
- },
- args: ["aString"],
- source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
- referencedClasses: ["ArgVar"],
- messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
- }),
- $globals.LexicalScope);
- $core.addMethod(
- $core.method({
- selector: "addTemp:",
- protocol: 'adding',
- fn: function (aString){
- var self=this;
- function $TempVar(){return $globals.TempVar||(typeof TempVar=="undefined"?nil:TempVar)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._temps();
- $ctx1.sendIdx["temps"]=1;
- $recv($1)._at_put_(aString,$recv($TempVar())._on_(aString));
- $recv($recv(self._temps())._at_(aString))._scope_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
- },
- args: ["aString"],
- source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
- referencedClasses: ["TempVar"],
- messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
- }),
- $globals.LexicalScope);
- $core.addMethod(
- $core.method({
- selector: "alias",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1="$ctx".__comma($recv(self._scopeLevel())._asString());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
- },
- args: [],
- source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
- referencedClasses: [],
- messageSends: [",", "asString", "scopeLevel"]
- }),
- $globals.LexicalScope);
- $core.addMethod(
- $core.method({
- selector: "allVariableNames",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=$recv(self._args())._keys();
- $ctx1.sendIdx["keys"]=1;
- $1=$recv($2).__comma($recv(self._temps())._keys());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
- },
- args: [],
- source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
- referencedClasses: [],
- messageSends: [",", "keys", "args", "temps"]
- }),
- $globals.LexicalScope);
- $core.addMethod(
- $core.method({
- selector: "args",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@args"];
- if(($receiver = $2) == null || $receiver.isNil){
- self["@args"]=$recv($Dictionary())._new();
- $1=self["@args"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
- },
- args: [],
- source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
- referencedClasses: ["Dictionary"],
- messageSends: ["ifNil:", "new"]
- }),
- $globals.LexicalScope);
- $core.addMethod(
- $core.method({
- selector: "bindingFor:",
- protocol: 'accessing',
- fn: function (aStringOrNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$4,$5,$1;
- $2=self._pseudoVars();
- $3=$recv(aStringOrNode)._value();
- $ctx1.sendIdx["value"]=1;
- $1=$recv($2)._at_ifAbsent_($3,(function(){
- return $core.withContext(function($ctx2) {
- $4=self._args();
- $5=$recv(aStringOrNode)._value();
- $ctx2.sendIdx["value"]=2;
- return $recv($4)._at_ifAbsent_($5,(function(){
- return $core.withContext(function($ctx3) {
- return $recv(self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
- return nil;
- }));
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }));
- $ctx2.sendIdx["at:ifAbsent:"]=2;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $ctx1.sendIdx["at:ifAbsent:"]=1;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
- },
- args: ["aStringOrNode"],
- 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 ]]]",
- referencedClasses: [],
- messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
- }),
- $globals.LexicalScope);
- $core.addMethod(
- $core.method({
- selector: "blockIndex",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@blockIndex"];
- if(($receiver = $2) == null || $receiver.isNil){
- $1=(0);
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
- },
- args: [],
- source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
- referencedClasses: [],
- messageSends: ["ifNil:"]
- }),
- $globals.LexicalScope);
- $core.addMethod(
- $core.method({
- selector: "blockIndex:",
- protocol: 'accessing',
- fn: function (anInteger){
- var self=this;
- self["@blockIndex"]=anInteger;
- return self;
- },
- args: ["anInteger"],
- source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.LexicalScope);
- $core.addMethod(
- $core.method({
- selector: "canInlineNonLocalReturns",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._isInlined())._and_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self._outerScope())._canInlineNonLocalReturns();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
- },
- args: [],
- source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
- referencedClasses: [],
- messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
- }),
- $globals.LexicalScope);
- $core.addMethod(
- $core.method({
- selector: "instruction",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@instruction"];
- return $1;
- },
- args: [],
- source: "instruction\x0a\x09^ instruction",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.LexicalScope);
- $core.addMethod(
- $core.method({
- selector: "instruction:",
- protocol: 'accessing',
- fn: function (anIRInstruction){
- var self=this;
- self["@instruction"]=anIRInstruction;
- return self;
- },
- args: ["anIRInstruction"],
- source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.LexicalScope);
- $core.addMethod(
- $core.method({
- selector: "isBlockScope",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._isMethodScope())._not();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
- },
- args: [],
- source: "isBlockScope\x0a\x09^ self isMethodScope not",
- referencedClasses: [],
- messageSends: ["not", "isMethodScope"]
- }),
- $globals.LexicalScope);
- $core.addMethod(
- $core.method({
- selector: "isInlined",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $3,$2,$1;
- $3=self._instruction();
- $ctx1.sendIdx["instruction"]=1;
- $2=$recv($3)._notNil();
- $1=$recv($2)._and_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self._instruction())._isInlined();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
- },
- args: [],
- source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
- referencedClasses: [],
- messageSends: ["and:", "notNil", "instruction", "isInlined"]
- }),
- $globals.LexicalScope);
- $core.addMethod(
- $core.method({
- selector: "isMethodScope",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isMethodScope\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.LexicalScope);
- $core.addMethod(
- $core.method({
- selector: "lookupVariable:",
- protocol: 'accessing',
- fn: function (aNode){
- var self=this;
- var lookup;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$receiver;
- lookup=self._bindingFor_(aNode);
- $1=lookup;
- if(($receiver = $1) == null || $receiver.isNil){
- $2=self._outerScope();
- $ctx1.sendIdx["outerScope"]=1;
- if(($receiver = $2) == null || $receiver.isNil){
- lookup=$2;
- } else {
- lookup=$recv(self._outerScope())._lookupVariable_(aNode);
- };
- lookup;
- } else {
- $1;
- };
- $3=lookup;
- return $3;
- }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
- },
- args: ["aNode"],
- 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",
- referencedClasses: [],
- messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
- }),
- $globals.LexicalScope);
- $core.addMethod(
- $core.method({
- selector: "methodScope",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self._outerScope();
- $ctx1.sendIdx["outerScope"]=1;
- if(($receiver = $2) == null || $receiver.isNil){
- $1=$2;
- } else {
- $1=$recv(self._outerScope())._methodScope();
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
- },
- args: [],
- source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
- referencedClasses: [],
- messageSends: ["ifNotNil:", "outerScope", "methodScope"]
- }),
- $globals.LexicalScope);
- $core.addMethod(
- $core.method({
- selector: "node",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@node"];
- return $1;
- },
- args: [],
- source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.LexicalScope);
- $core.addMethod(
- $core.method({
- selector: "node:",
- protocol: 'accessing',
- fn: function (aNode){
- var self=this;
- self["@node"]=aNode;
- return self;
- },
- args: ["aNode"],
- source: "node: aNode\x0a\x09node := aNode",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.LexicalScope);
- $core.addMethod(
- $core.method({
- selector: "outerScope",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@outerScope"];
- return $1;
- },
- args: [],
- source: "outerScope\x0a\x09^ outerScope",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.LexicalScope);
- $core.addMethod(
- $core.method({
- selector: "outerScope:",
- protocol: 'accessing',
- fn: function (aLexicalScope){
- var self=this;
- self["@outerScope"]=aLexicalScope;
- return self;
- },
- args: ["aLexicalScope"],
- source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.LexicalScope);
- $core.addMethod(
- $core.method({
- selector: "pseudoVars",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._methodScope())._pseudoVars();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
- },
- args: [],
- source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
- referencedClasses: [],
- messageSends: ["pseudoVars", "methodScope"]
- }),
- $globals.LexicalScope);
- $core.addMethod(
- $core.method({
- selector: "scopeLevel",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$4,$3,$5,$receiver;
- $1=self._outerScope();
- $ctx1.sendIdx["outerScope"]=1;
- if(($receiver = $1) == null || $receiver.isNil){
- return (1);
- } else {
- $1;
- };
- $2=self._isInlined();
- if($core.assert($2)){
- $4=self._outerScope();
- $ctx1.sendIdx["outerScope"]=2;
- $3=$recv($4)._scopeLevel();
- $ctx1.sendIdx["scopeLevel"]=1;
- return $3;
- };
- $5=$recv($recv(self._outerScope())._scopeLevel()).__plus((1));
- return $5;
- }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
- },
- args: [],
- source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
- referencedClasses: [],
- messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
- }),
- $globals.LexicalScope);
- $core.addMethod(
- $core.method({
- selector: "temps",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@temps"];
- if(($receiver = $2) == null || $receiver.isNil){
- self["@temps"]=$recv($Dictionary())._new();
- $1=self["@temps"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
- },
- args: [],
- source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
- referencedClasses: ["Dictionary"],
- messageSends: ["ifNil:", "new"]
- }),
- $globals.LexicalScope);
- $core.addClass('MethodLexicalScope', $globals.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
- $globals.MethodLexicalScope.comment="I represent a method scope.";
- $core.addMethod(
- $core.method({
- selector: "addIVar:",
- protocol: 'adding',
- fn: function (aString){
- var self=this;
- function $InstanceVar(){return $globals.InstanceVar||(typeof InstanceVar=="undefined"?nil:InstanceVar)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._iVars();
- $ctx1.sendIdx["iVars"]=1;
- $recv($1)._at_put_(aString,$recv($InstanceVar())._on_(aString));
- $recv($recv(self._iVars())._at_(aString))._scope_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
- },
- args: ["aString"],
- source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
- referencedClasses: ["InstanceVar"],
- messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
- }),
- $globals.MethodLexicalScope);
- $core.addMethod(
- $core.method({
- selector: "addNonLocalReturn:",
- protocol: 'adding',
- fn: function (aScope){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._nonLocalReturns())._add_(aScope);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
- },
- args: ["aScope"],
- source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
- referencedClasses: [],
- messageSends: ["add:", "nonLocalReturns"]
- }),
- $globals.MethodLexicalScope);
- $core.addMethod(
- $core.method({
- selector: "allVariableNames",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=(
- $ctx1.supercall = true,
- $globals.MethodLexicalScope.superclass.fn.prototype._allVariableNames.apply($recv(self), []));
- $ctx1.supercall = false;
- $1=$recv($2).__comma($recv(self._iVars())._keys());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
- },
- args: [],
- source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
- referencedClasses: [],
- messageSends: [",", "allVariableNames", "keys", "iVars"]
- }),
- $globals.MethodLexicalScope);
- $core.addMethod(
- $core.method({
- selector: "bindingFor:",
- protocol: 'accessing',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=(
- $ctx1.supercall = true,
- $globals.MethodLexicalScope.superclass.fn.prototype._bindingFor_.apply($recv(self), [aNode]));
- $ctx1.supercall = false;
- if(($receiver = $2) == null || $receiver.isNil){
- $1=$recv(self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
- return nil;
- }));
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
- },
- args: ["aNode"],
- source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
- referencedClasses: [],
- messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
- }),
- $globals.MethodLexicalScope);
- $core.addMethod(
- $core.method({
- selector: "canInlineNonLocalReturns",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "canInlineNonLocalReturns\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodLexicalScope);
- $core.addMethod(
- $core.method({
- selector: "hasLocalReturn",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._localReturn();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
- },
- args: [],
- source: "hasLocalReturn\x0a\x09^ self localReturn",
- referencedClasses: [],
- messageSends: ["localReturn"]
- }),
- $globals.MethodLexicalScope);
- $core.addMethod(
- $core.method({
- selector: "hasNonLocalReturn",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._nonLocalReturns())._notEmpty();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
- },
- args: [],
- source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
- referencedClasses: [],
- messageSends: ["notEmpty", "nonLocalReturns"]
- }),
- $globals.MethodLexicalScope);
- $core.addMethod(
- $core.method({
- selector: "iVars",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@iVars"];
- if(($receiver = $2) == null || $receiver.isNil){
- self["@iVars"]=$recv($Dictionary())._new();
- $1=self["@iVars"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
- },
- args: [],
- source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
- referencedClasses: ["Dictionary"],
- messageSends: ["ifNil:", "new"]
- }),
- $globals.MethodLexicalScope);
- $core.addMethod(
- $core.method({
- selector: "isMethodScope",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isMethodScope\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodLexicalScope);
- $core.addMethod(
- $core.method({
- selector: "localReturn",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@localReturn"];
- if(($receiver = $2) == null || $receiver.isNil){
- $1=false;
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
- },
- args: [],
- source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
- referencedClasses: [],
- messageSends: ["ifNil:"]
- }),
- $globals.MethodLexicalScope);
- $core.addMethod(
- $core.method({
- selector: "localReturn:",
- protocol: 'accessing',
- fn: function (aBoolean){
- var self=this;
- self["@localReturn"]=aBoolean;
- return self;
- },
- args: ["aBoolean"],
- source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodLexicalScope);
- $core.addMethod(
- $core.method({
- selector: "methodScope",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "methodScope\x0a\x09^ self",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.MethodLexicalScope);
- $core.addMethod(
- $core.method({
- selector: "nonLocalReturns",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@nonLocalReturns"];
- if(($receiver = $2) == null || $receiver.isNil){
- self["@nonLocalReturns"]=$recv($OrderedCollection())._new();
- $1=self["@nonLocalReturns"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
- },
- args: [],
- source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
- referencedClasses: ["OrderedCollection"],
- messageSends: ["ifNil:", "new"]
- }),
- $globals.MethodLexicalScope);
- $core.addMethod(
- $core.method({
- selector: "pseudoVars",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- function $PseudoVar(){return $globals.PseudoVar||(typeof PseudoVar=="undefined"?nil:PseudoVar)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$receiver;
- $1=self["@pseudoVars"];
- if(($receiver = $1) == null || $receiver.isNil){
- self["@pseudoVars"]=$recv($Dictionary())._new();
- self["@pseudoVars"];
- $recv($recv($Smalltalk())._pseudoVariableNames())._do_((function(each){
- return $core.withContext(function($ctx2) {
- $2=$recv($PseudoVar())._on_(each);
- $recv($2)._scope_(self._methodScope());
- $3=$recv($2)._yourself();
- return $recv(self["@pseudoVars"])._at_put_(each,$3);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- } else {
- $1;
- };
- $4=self["@pseudoVars"];
- return $4;
- }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
- },
- args: [],
- 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",
- referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
- messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
- }),
- $globals.MethodLexicalScope);
- $core.addMethod(
- $core.method({
- selector: "removeNonLocalReturn:",
- protocol: 'adding',
- fn: function (aScope){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
- },
- args: ["aScope"],
- source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
- referencedClasses: [],
- messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
- }),
- $globals.MethodLexicalScope);
- $core.addMethod(
- $core.method({
- selector: "unknownVariables",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@unknownVariables"];
- if(($receiver = $2) == null || $receiver.isNil){
- self["@unknownVariables"]=$recv($OrderedCollection())._new();
- $1=self["@unknownVariables"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
- },
- args: [],
- source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
- referencedClasses: ["OrderedCollection"],
- messageSends: ["ifNil:", "new"]
- }),
- $globals.MethodLexicalScope);
- $core.addClass('ScopeVar', $globals.Object, ['scope', 'name'], 'Compiler-Semantic');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "alias",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._name())._asVariableName();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
- },
- args: [],
- source: "alias\x0a\x09^ self name asVariableName",
- referencedClasses: [],
- messageSends: ["asVariableName", "name"]
- }),
- $globals.ScopeVar);
- $core.addMethod(
- $core.method({
- selector: "isArgVar",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isArgVar\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ScopeVar);
- $core.addMethod(
- $core.method({
- selector: "isClassRefVar",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isClassRefVar\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ScopeVar);
- $core.addMethod(
- $core.method({
- selector: "isImmutable",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isImmutable\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ScopeVar);
- $core.addMethod(
- $core.method({
- selector: "isInstanceVar",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isInstanceVar\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ScopeVar);
- $core.addMethod(
- $core.method({
- selector: "isPseudoVar",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isPseudoVar\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ScopeVar);
- $core.addMethod(
- $core.method({
- selector: "isTempVar",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isTempVar\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ScopeVar);
- $core.addMethod(
- $core.method({
- selector: "isUnknownVar",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isUnknownVar\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ScopeVar);
- $core.addMethod(
- $core.method({
- selector: "name",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@name"];
- return $1;
- },
- args: [],
- source: "name\x0a\x09^ name",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ScopeVar);
- $core.addMethod(
- $core.method({
- selector: "name:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@name"]=aString;
- return self;
- },
- args: ["aString"],
- source: "name: aString\x0a\x09name := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ScopeVar);
- $core.addMethod(
- $core.method({
- selector: "scope",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@scope"];
- return $1;
- },
- args: [],
- source: "scope\x0a\x09^ scope",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ScopeVar);
- $core.addMethod(
- $core.method({
- selector: "scope:",
- protocol: 'accessing',
- fn: function (aScope){
- var self=this;
- self["@scope"]=aScope;
- return self;
- },
- args: ["aScope"],
- source: "scope: aScope\x0a\x09scope := aScope",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ScopeVar);
- $core.addMethod(
- $core.method({
- selector: "validateAssignment",
- protocol: 'testing',
- fn: function (){
- var self=this;
- function $InvalidAssignmentError(){return $globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3;
- $1=$recv(self._isArgVar())._or_((function(){
- return $core.withContext(function($ctx2) {
- return self._isPseudoVar();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- if($core.assert($1)){
- $2=$recv($InvalidAssignmentError())._new();
- $recv($2)._variableName_(self._name());
- $3=$recv($2)._signal();
- $3;
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
- },
- args: [],
- source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
- referencedClasses: ["InvalidAssignmentError"],
- messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
- }),
- $globals.ScopeVar);
- $core.addMethod(
- $core.method({
- selector: "on:",
- protocol: 'instance creation',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- $recv($2)._name_(aString);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.klass)});
- },
- args: ["aString"],
- source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["name:", "new", "yourself"]
- }),
- $globals.ScopeVar.klass);
- $core.addClass('AliasVar', $globals.ScopeVar, ['node'], 'Compiler-Semantic');
- $globals.AliasVar.comment="I am an internally defined variable by the compiler";
- $core.addMethod(
- $core.method({
- selector: "node",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@node"];
- return $1;
- },
- args: [],
- source: "node\x0a\x09^ node",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AliasVar);
- $core.addMethod(
- $core.method({
- selector: "node:",
- protocol: 'accessing',
- fn: function (aNode){
- var self=this;
- self["@node"]=aNode;
- return self;
- },
- args: ["aNode"],
- source: "node: aNode\x0a\x09node := aNode",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AliasVar);
- $core.addClass('ArgVar', $globals.ScopeVar, [], 'Compiler-Semantic');
- $globals.ArgVar.comment="I am an argument of a method or block.";
- $core.addMethod(
- $core.method({
- selector: "isArgVar",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isArgVar\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ArgVar);
- $core.addMethod(
- $core.method({
- selector: "isImmutable",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isImmutable\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ArgVar);
- $core.addClass('ClassRefVar', $globals.ScopeVar, [], 'Compiler-Semantic');
- $globals.ClassRefVar.comment="I am an class reference variable";
- $core.addMethod(
- $core.method({
- selector: "alias",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv("$".__comma(self._name())).__comma("()");
- $ctx1.sendIdx[","]=1;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
- },
- args: [],
- 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, '()'",
- referencedClasses: [],
- messageSends: [",", "name"]
- }),
- $globals.ClassRefVar);
- $core.addMethod(
- $core.method({
- selector: "isClassRefVar",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isClassRefVar\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ClassRefVar);
- $core.addMethod(
- $core.method({
- selector: "isImmutable",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isImmutable\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ClassRefVar);
- $core.addClass('InstanceVar', $globals.ScopeVar, [], 'Compiler-Semantic');
- $globals.InstanceVar.comment="I am an instance variable of a method or block.";
- $core.addMethod(
- $core.method({
- selector: "alias",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv("self[\x22@".__comma(self._name())).__comma("\x22]");
- $ctx1.sendIdx[","]=1;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
- },
- args: [],
- source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
- referencedClasses: [],
- messageSends: [",", "name"]
- }),
- $globals.InstanceVar);
- $core.addMethod(
- $core.method({
- selector: "isInstanceVar",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isInstanceVar\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.InstanceVar);
- $core.addClass('PseudoVar', $globals.ScopeVar, [], 'Compiler-Semantic');
- $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
- $core.addMethod(
- $core.method({
- selector: "alias",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._name();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
- },
- args: [],
- source: "alias\x0a\x09^ self name",
- referencedClasses: [],
- messageSends: ["name"]
- }),
- $globals.PseudoVar);
- $core.addMethod(
- $core.method({
- selector: "isImmutable",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isImmutable\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.PseudoVar);
- $core.addMethod(
- $core.method({
- selector: "isPseudoVar",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isPseudoVar\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.PseudoVar);
- $core.addClass('TempVar', $globals.ScopeVar, [], 'Compiler-Semantic');
- $globals.TempVar.comment="I am an temporary variable of a method or block.";
- $core.addMethod(
- $core.method({
- selector: "isTempVar",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isTempVar\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.TempVar);
- $core.addClass('UnknownVar', $globals.ScopeVar, [], 'Compiler-Semantic');
- $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
- $core.addMethod(
- $core.method({
- selector: "isUnknownVar",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isUnknownVar\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.UnknownVar);
- $core.addClass('SemanticAnalyzer', $globals.NodeVisitor, ['currentScope', 'blockIndex', 'thePackage', 'theClass', 'classReferences', 'messageSends', 'superSends'], 'Compiler-Semantic');
- $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
- $core.addMethod(
- $core.method({
- selector: "classReferences",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@classReferences"];
- if(($receiver = $2) == null || $receiver.isNil){
- self["@classReferences"]=$recv($Set())._new();
- $1=self["@classReferences"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
- },
- args: [],
- source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
- referencedClasses: ["Set"],
- messageSends: ["ifNil:", "new"]
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "errorShadowingVariable:",
- protocol: 'error handling',
- fn: function (aString){
- var self=this;
- function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=$recv($ShadowingVariableError())._new();
- $recv($1)._variableName_(aString);
- $2=$recv($1)._signal();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
- },
- args: ["aString"],
- source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
- referencedClasses: ["ShadowingVariableError"],
- messageSends: ["variableName:", "new", "signal"]
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "errorUnknownVariable:",
- protocol: 'error handling',
- fn: function (aNode){
- var self=this;
- var identifier;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5;
- identifier=$recv(aNode)._value();
- $ctx1.sendIdx["value"]=1;
- $1=$recv($recv($recv($recv($Smalltalk())._globalJsVariables())._includes_(identifier))._not())._and_((function(){
- return $core.withContext(function($ctx2) {
- return self._isVariableUndefined_inPackage_(identifier,self._thePackage());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- if($core.assert($1)){
- $2=$recv($UnknownVariableError())._new();
- $3=$2;
- $4=$recv(aNode)._value();
- $ctx1.sendIdx["value"]=2;
- $recv($3)._variableName_($4);
- $5=$recv($2)._signal();
- $5;
- } else {
- $recv($recv($recv(self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
- },
- args: ["aNode"],
- 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 ]",
- referencedClasses: ["Smalltalk", "UnknownVariableError"],
- messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "isVariableUndefined:inPackage:",
- protocol: 'testing',
- fn: function (aString,aPackage){
- var self=this;
- function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
- return $core.withContext(function($ctx1) {
- var $1,$3,$4,$2,$receiver;
- if(($receiver = aPackage) == null || $receiver.isNil){
- aPackage;
- } else {
- var packageKnownVars;
- packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
- packageKnownVars;
- $1=$recv(packageKnownVars)._includes_(aString);
- if($core.assert($1)){
- return false;
- };
- };
- $3=$recv($Compiler())._new();
- $4=$recv("typeof ".__comma(aString)).__comma(" == \x22undefined\x22");
- $ctx1.sendIdx[","]=1;
- $2=$recv($3)._eval_($4);
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
- },
- args: ["aString", "aPackage"],
- 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'",
- referencedClasses: ["Compiler"],
- messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", "new", ","]
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "messageSends",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@messageSends"];
- if(($receiver = $2) == null || $receiver.isNil){
- self["@messageSends"]=$recv($Dictionary())._new();
- $1=self["@messageSends"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
- },
- args: [],
- source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
- referencedClasses: ["Dictionary"],
- messageSends: ["ifNil:", "new"]
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "newBlockScope",
- protocol: 'factory',
- fn: function (){
- var self=this;
- function $LexicalScope(){return $globals.LexicalScope||(typeof LexicalScope=="undefined"?nil:LexicalScope)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._newScopeOfClass_($LexicalScope());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
- },
- args: [],
- source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
- referencedClasses: ["LexicalScope"],
- messageSends: ["newScopeOfClass:"]
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "newMethodScope",
- protocol: 'factory',
- fn: function (){
- var self=this;
- function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._newScopeOfClass_($MethodLexicalScope());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
- },
- args: [],
- source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
- referencedClasses: ["MethodLexicalScope"],
- messageSends: ["newScopeOfClass:"]
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "newScopeOfClass:",
- protocol: 'factory',
- fn: function (aLexicalScopeClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv(aLexicalScopeClass)._new();
- $recv($2)._outerScope_(self["@currentScope"]);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
- },
- args: ["aLexicalScopeClass"],
- source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["outerScope:", "new", "yourself"]
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "nextBlockIndex",
- protocol: 'private',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$receiver;
- $1=self["@blockIndex"];
- if(($receiver = $1) == null || $receiver.isNil){
- self["@blockIndex"]=(0);
- self["@blockIndex"];
- } else {
- $1;
- };
- self["@blockIndex"]=$recv(self["@blockIndex"]).__plus((1));
- $2=self["@blockIndex"];
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
- },
- args: [],
- source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
- referencedClasses: [],
- messageSends: ["ifNil:", "+"]
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "popScope",
- protocol: 'scope',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$receiver;
- $1=self["@currentScope"];
- if(($receiver = $1) == null || $receiver.isNil){
- $1;
- } else {
- self["@currentScope"]=$recv(self["@currentScope"])._outerScope();
- self["@currentScope"];
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
- },
- args: [],
- source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
- referencedClasses: [],
- messageSends: ["ifNotNil:", "outerScope"]
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "pushScope:",
- protocol: 'scope',
- fn: function (aScope){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aScope)._outerScope_(self["@currentScope"]);
- self["@currentScope"]=aScope;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
- },
- args: ["aScope"],
- source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
- referencedClasses: [],
- messageSends: ["outerScope:"]
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "superSends",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@superSends"];
- if(($receiver = $2) == null || $receiver.isNil){
- self["@superSends"]=$recv($Dictionary())._new();
- $1=self["@superSends"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"superSends",{},$globals.SemanticAnalyzer)});
- },
- args: [],
- source: "superSends\x0a\x09^ superSends ifNil: [ superSends := Dictionary new ]",
- referencedClasses: ["Dictionary"],
- messageSends: ["ifNil:", "new"]
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "theClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@theClass"];
- return $1;
- },
- args: [],
- source: "theClass\x0a\x09^ theClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "theClass:",
- protocol: 'accessing',
- fn: function (aClass){
- var self=this;
- self["@theClass"]=aClass;
- return self;
- },
- args: ["aClass"],
- source: "theClass: aClass\x0a\x09theClass := aClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "thePackage",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@thePackage"];
- return $1;
- },
- args: [],
- source: "thePackage\x0a\x09^ thePackage",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "thePackage:",
- protocol: 'accessing',
- fn: function (aPackage){
- var self=this;
- self["@thePackage"]=aPackage;
- return self;
- },
- args: ["aPackage"],
- source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "validateVariableScope:",
- protocol: 'scope',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$receiver;
- $1=$recv(self["@currentScope"])._lookupVariable_(aString);
- if(($receiver = $1) == null || $receiver.isNil){
- $1;
- } else {
- self._errorShadowingVariable_(aString);
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
- },
- args: ["aString"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "visitAssignmentNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.SemanticAnalyzer.superclass.fn.prototype._visitAssignmentNode_.apply($recv(self), [aNode]));
- $ctx1.supercall = false;
- $recv($recv(aNode)._left())._beAssigned();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
- },
- args: ["aNode"],
- source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
- referencedClasses: [],
- messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "visitBlockNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._pushScope_(self._newBlockScope());
- $recv(aNode)._scope_(self["@currentScope"]);
- $recv(self["@currentScope"])._node_(aNode);
- $recv(self["@currentScope"])._blockIndex_(self._nextBlockIndex());
- $recv($recv(aNode)._parameters())._do_((function(each){
- return $core.withContext(function($ctx2) {
- self._validateVariableScope_(each);
- return $recv(self["@currentScope"])._addArg_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- (
- $ctx1.supercall = true,
- $globals.SemanticAnalyzer.superclass.fn.prototype._visitBlockNode_.apply($recv(self), [aNode]));
- $ctx1.supercall = false;
- self._popScope();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
- },
- args: ["aNode"],
- 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",
- referencedClasses: [],
- messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "visitCascadeNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $3,$2,$1;
- (
- $ctx1.supercall = true,
- $globals.SemanticAnalyzer.superclass.fn.prototype._visitCascadeNode_.apply($recv(self), [aNode]));
- $ctx1.supercall = false;
- $3=$recv(aNode)._nodes();
- $ctx1.sendIdx["nodes"]=1;
- $2=$recv($3)._first();
- $1=$recv($2)._superSend();
- if($core.assert($1)){
- $recv($recv(aNode)._nodes())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._superSend_(true);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
- },
- args: ["aNode"],
- source: "visitCascadeNode: aNode\x0a\x09super visitCascadeNode: aNode.\x0a\x09aNode nodes first superSend ifTrue: [\x0a\x09\x09aNode nodes do: [ :each | each superSend: true ] ]",
- referencedClasses: [],
- messageSends: ["visitCascadeNode:", "ifTrue:", "superSend", "first", "nodes", "do:", "superSend:"]
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "visitMethodNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- self._pushScope_(self._newMethodScope());
- $recv(aNode)._scope_(self["@currentScope"]);
- $recv(self["@currentScope"])._node_(aNode);
- $recv($recv(self._theClass())._allInstanceVariableNames())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(self["@currentScope"])._addIVar_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $ctx1.sendIdx["do:"]=1;
- $recv($recv(aNode)._arguments())._do_((function(each){
- return $core.withContext(function($ctx2) {
- self._validateVariableScope_(each);
- return $recv(self["@currentScope"])._addArg_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- (
- $ctx1.supercall = true,
- $globals.SemanticAnalyzer.superclass.fn.prototype._visitMethodNode_.apply($recv(self), [aNode]));
- $ctx1.supercall = false;
- $recv(aNode)._classReferences_(self._classReferences());
- $recv(aNode)._sendIndexes_(self._messageSends());
- $1=$recv(aNode)._superSends_($recv(self._superSends())._keys());
- self._popScope();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
- },
- args: ["aNode"],
- 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",
- referencedClasses: [],
- messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "superSends:", "keys", "superSends", "popScope"]
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "visitReturnNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $recv(aNode)._scope_(self["@currentScope"]);
- $1=$recv(self["@currentScope"])._isMethodScope();
- if($core.assert($1)){
- $recv(self["@currentScope"])._localReturn_(true);
- } else {
- $recv($recv(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
- };
- (
- $ctx1.supercall = true,
- $globals.SemanticAnalyzer.superclass.fn.prototype._visitReturnNode_.apply($recv(self), [aNode]));
- $ctx1.supercall = false;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
- },
- args: ["aNode"],
- 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",
- referencedClasses: [],
- messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "visitSendNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
- function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
- return $core.withContext(function($ctx1) {
- var $3,$2,$1,$4,$5,$6,$8,$9,$7,$11,$12,$10,$13,$14,$15,$17,$18,$16,$receiver;
- $3=$recv(aNode)._receiver();
- $ctx1.sendIdx["receiver"]=1;
- $2=$recv($3)._value();
- $1=$recv($2).__eq("super");
- if($core.assert($1)){
- $recv(aNode)._superSend_(true);
- $4=$recv(aNode)._receiver();
- $ctx1.sendIdx["receiver"]=2;
- $recv($4)._value_("self");
- $5=self._superSends();
- $ctx1.sendIdx["superSends"]=1;
- $6=$recv(aNode)._selector();
- $ctx1.sendIdx["selector"]=1;
- $recv($5)._at_ifAbsentPut_($6,(function(){
- return $core.withContext(function($ctx2) {
- return $recv($Set())._new();
- $ctx2.sendIdx["new"]=1;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- $ctx1.sendIdx["at:ifAbsentPut:"]=1;
- $8=self._superSends();
- $9=$recv(aNode)._selector();
- $ctx1.sendIdx["selector"]=2;
- $7=$recv($8)._at_($9);
- $ctx1.sendIdx["at:"]=1;
- $recv($7)._add_(aNode);
- $ctx1.sendIdx["add:"]=1;
- } else {
- $11=$recv($IRSendInliner())._inlinedSelectors();
- $12=$recv(aNode)._selector();
- $ctx1.sendIdx["selector"]=3;
- $10=$recv($11)._includes_($12);
- if($core.assert($10)){
- $recv(aNode)._shouldBeInlined_(true);
- $13=$recv(aNode)._receiver();
- if(($receiver = $13) == null || $receiver.isNil){
- $13;
- } else {
- var receiver;
- receiver=$receiver;
- $recv(receiver)._shouldBeAliased_(true);
- };
- };
- };
- $14=self._messageSends();
- $ctx1.sendIdx["messageSends"]=1;
- $15=$recv(aNode)._selector();
- $ctx1.sendIdx["selector"]=4;
- $recv($14)._at_ifAbsentPut_($15,(function(){
- return $core.withContext(function($ctx2) {
- return $recv($Set())._new();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
- }));
- $17=self._messageSends();
- $ctx1.sendIdx["messageSends"]=2;
- $18=$recv(aNode)._selector();
- $ctx1.sendIdx["selector"]=5;
- $16=$recv($17)._at_($18);
- $ctx1.sendIdx["at:"]=2;
- $recv($16)._add_(aNode);
- $recv(aNode)._index_($recv($recv(self._messageSends())._at_($recv(aNode)._selector()))._size());
- (
- $ctx1.supercall = true,
- $globals.SemanticAnalyzer.superclass.fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
- $ctx1.supercall = false;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
- },
- args: ["aNode"],
- 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",
- referencedClasses: ["Set", "IRSendInliner"],
- messageSends: ["ifTrue:ifFalse:", "=", "value", "receiver", "superSend:", "value:", "at:ifAbsentPut:", "superSends", "selector", "new", "add:", "at:", "ifTrue:", "includes:", "inlinedSelectors", "shouldBeInlined:", "ifNotNil:", "shouldBeAliased:", "messageSends", "index:", "size", "visitSendNode:"]
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "visitSequenceNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv($recv(aNode)._temps())._do_((function(each){
- return $core.withContext(function($ctx2) {
- self._validateVariableScope_(each);
- return $recv(self["@currentScope"])._addTemp_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- (
- $ctx1.supercall = true,
- $globals.SemanticAnalyzer.superclass.fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
- $ctx1.supercall = false;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
- },
- args: ["aNode"],
- source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
- referencedClasses: [],
- messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "visitVariableNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- var binding;
- function $ClassRefVar(){return $globals.ClassRefVar||(typeof ClassRefVar=="undefined"?nil:ClassRefVar)}
- function $UnknownVar(){return $globals.UnknownVar||(typeof UnknownVar=="undefined"?nil:UnknownVar)}
- return $core.withContext(function($ctx1) {
- var $1,$3,$2,$4,$5,$6,$7,$8,$9,$10,$11,$receiver;
- binding=$recv(self["@currentScope"])._lookupVariable_(aNode);
- $1=binding;
- if(($receiver = $1) == null || $receiver.isNil){
- $3=$recv(aNode)._value();
- $ctx1.sendIdx["value"]=1;
- $2=$recv($3)._isCapitalized();
- if($core.assert($2)){
- $4=$recv($ClassRefVar())._new();
- $ctx1.sendIdx["new"]=1;
- $5=$4;
- $6=$recv(aNode)._value();
- $ctx1.sendIdx["value"]=2;
- $recv($5)._name_($6);
- $ctx1.sendIdx["name:"]=1;
- $7=$recv($4)._yourself();
- $ctx1.sendIdx["yourself"]=1;
- binding=$7;
- binding;
- $8=self._classReferences();
- $9=$recv(aNode)._value();
- $ctx1.sendIdx["value"]=3;
- $recv($8)._add_($9);
- } else {
- self._errorUnknownVariable_(aNode);
- $10=$recv($UnknownVar())._new();
- $recv($10)._name_($recv(aNode)._value());
- $11=$recv($10)._yourself();
- binding=$11;
- binding;
- };
- } else {
- $1;
- };
- $recv(aNode)._binding_(binding);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
- },
- args: ["aNode"],
- 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.",
- referencedClasses: ["ClassRefVar", "UnknownVar"],
- messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
- }),
- $globals.SemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "on:",
- protocol: 'instance creation',
- fn: function (aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- $recv($2)._theClass_(aClass);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.klass)});
- },
- args: ["aClass"],
- source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["theClass:", "new", "yourself"]
- }),
- $globals.SemanticAnalyzer.klass);
- $core.addClass('SemanticError', $globals.CompilerError, [], 'Compiler-Semantic');
- $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";
- $core.addClass('InvalidAssignmentError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
- $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
- $core.addMethod(
- $core.method({
- selector: "messageText",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=" Invalid assignment to variable: ".__comma(self._variableName());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
- },
- args: [],
- source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
- referencedClasses: [],
- messageSends: [",", "variableName"]
- }),
- $globals.InvalidAssignmentError);
- $core.addMethod(
- $core.method({
- selector: "variableName",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@variableName"];
- return $1;
- },
- args: [],
- source: "variableName\x0a\x09^ variableName",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.InvalidAssignmentError);
- $core.addMethod(
- $core.method({
- selector: "variableName:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@variableName"]=aString;
- return self;
- },
- args: ["aString"],
- source: "variableName: aString\x0a\x09variableName := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.InvalidAssignmentError);
- $core.addClass('ShadowingVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "messageText",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
- $ctx1.sendIdx[","]=1;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
- },
- args: [],
- source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
- referencedClasses: [],
- messageSends: [",", "variableName"]
- }),
- $globals.ShadowingVariableError);
- $core.addMethod(
- $core.method({
- selector: "variableName",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@variableName"];
- return $1;
- },
- args: [],
- source: "variableName\x0a\x09^ variableName",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ShadowingVariableError);
- $core.addMethod(
- $core.method({
- selector: "variableName:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@variableName"]=aString;
- return self;
- },
- args: ["aString"],
- source: "variableName: aString\x0a\x09variableName := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ShadowingVariableError);
- $core.addClass('UnknownVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "messageText",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
- $ctx1.sendIdx[","]=1;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
- },
- args: [],
- source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
- referencedClasses: [],
- messageSends: [",", "variableName"]
- }),
- $globals.UnknownVariableError);
- $core.addMethod(
- $core.method({
- selector: "variableName",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@variableName"];
- return $1;
- },
- args: [],
- source: "variableName\x0a\x09^ variableName",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.UnknownVariableError);
- $core.addMethod(
- $core.method({
- selector: "variableName:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@variableName"]=aString;
- return self;
- },
- args: ["aString"],
- source: "variableName: aString\x0a\x09variableName := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.UnknownVariableError);
- });
- define("amber_core/Compiler-IR", ["amber/boot", "amber_core/Compiler-AST", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){"use strict";
- var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
- $core.addPackage('Compiler-IR');
- $core.packages["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
- $core.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
- $core.addClass('IRASTTranslator', $globals.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
- $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
- $core.addMethod(
- $core.method({
- selector: "alias:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- var variable;
- function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
- function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
- function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$6,$5,$7,$8,$10,$11,$9,$12;
- $1=$recv(aNode)._isImmutable();
- if($core.assert($1)){
- $2=self._visit_(aNode);
- $ctx1.sendIdx["visit:"]=1;
- return $2;
- };
- $3=$recv($IRVariable())._new();
- $ctx1.sendIdx["new"]=1;
- $4=$3;
- $6=$recv($AliasVar())._new();
- $ctx1.sendIdx["new"]=2;
- $5=$recv($6)._name_("$".__comma(self._nextAlias()));
- $recv($4)._variable_($5);
- $7=$recv($3)._yourself();
- $ctx1.sendIdx["yourself"]=1;
- variable=$7;
- $8=self._sequence();
- $10=$recv($IRAssignment())._new();
- $recv($10)._add_(variable);
- $ctx1.sendIdx["add:"]=2;
- $recv($10)._add_(self._visit_(aNode));
- $ctx1.sendIdx["add:"]=3;
- $11=$recv($10)._yourself();
- $9=$11;
- $recv($8)._add_($9);
- $ctx1.sendIdx["add:"]=1;
- $recv($recv(self._method())._internalVariables())._add_(variable);
- $12=variable;
- return $12;
- }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
- },
- args: ["aNode"],
- 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",
- referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
- messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"]
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "aliasTemporally:",
- protocol: 'visiting',
- fn: function (aCollection){
- var self=this;
- var threshold,result;
- function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$4,$3,$5;
- threshold=(0);
- $recv(aCollection)._withIndexDo_((function(each,i){
- return $core.withContext(function($ctx2) {
- $1=$recv(each)._subtreeNeedsAliasing();
- if($core.assert($1)){
- threshold=i;
- return threshold;
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
- }));
- $ctx1.sendIdx["withIndexDo:"]=1;
- result=$recv($OrderedCollection())._new();
- $recv(aCollection)._withIndexDo_((function(each,i){
- return $core.withContext(function($ctx2) {
- $2=result;
- $4=$recv(i).__lt_eq(threshold);
- if($core.assert($4)){
- $3=self._alias_(each);
- } else {
- $3=self._visit_(each);
- };
- return $recv($2)._add_($3);
- }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
- }));
- $5=result;
- return $5;
- }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
- },
- args: ["aCollection"],
- 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",
- referencedClasses: ["OrderedCollection"],
- messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "method",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@method"];
- return $1;
- },
- args: [],
- source: "method\x0a\x09^ method",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "method:",
- protocol: 'accessing',
- fn: function (anIRMethod){
- var self=this;
- self["@method"]=anIRMethod;
- return self;
- },
- args: ["anIRMethod"],
- source: "method: anIRMethod\x0a\x09method := anIRMethod",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "nextAlias",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$receiver;
- $1=self["@nextAlias"];
- if(($receiver = $1) == null || $receiver.isNil){
- self["@nextAlias"]=(0);
- self["@nextAlias"];
- } else {
- $1;
- };
- self["@nextAlias"]=$recv(self["@nextAlias"]).__plus((1));
- $2=$recv(self["@nextAlias"])._asString();
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
- },
- args: [],
- source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
- referencedClasses: [],
- messageSends: ["ifNil:", "+", "asString"]
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "sequence",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@sequence"];
- return $1;
- },
- args: [],
- source: "sequence\x0a\x09^ sequence",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "sequence:",
- protocol: 'accessing',
- fn: function (anIRSequence){
- var self=this;
- self["@sequence"]=anIRSequence;
- return self;
- },
- args: ["anIRSequence"],
- source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "source",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@source"];
- return $1;
- },
- args: [],
- source: "source\x0a\x09^ source",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "source:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@source"]=aString;
- return self;
- },
- args: ["aString"],
- source: "source: aString\x0a\x09source := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "theClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@theClass"];
- return $1;
- },
- args: [],
- source: "theClass\x0a\x09^ theClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "theClass:",
- protocol: 'accessing',
- fn: function (aClass){
- var self=this;
- self["@theClass"]=aClass;
- return self;
- },
- args: ["aClass"],
- source: "theClass: aClass\x0a\x09theClass := aClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitAssignmentNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- var left,right,assignment;
- function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
- return $core.withContext(function($ctx1) {
- var $1,$3,$4,$2,$5;
- right=self._visit_($recv(aNode)._right());
- $ctx1.sendIdx["visit:"]=1;
- left=self._visit_($recv(aNode)._left());
- $1=self._sequence();
- $3=$recv($IRAssignment())._new();
- $recv($3)._add_(left);
- $ctx1.sendIdx["add:"]=2;
- $recv($3)._add_(right);
- $4=$recv($3)._yourself();
- $2=$4;
- $recv($1)._add_($2);
- $ctx1.sendIdx["add:"]=1;
- $5=left;
- return $5;
- }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
- },
- args: ["aNode"],
- 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",
- referencedClasses: ["IRAssignment"],
- messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"]
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitBlockNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- var closure;
- function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
- function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$6,$5,$7,$8,$9;
- $1=$recv($IRClosure())._new();
- $ctx1.sendIdx["new"]=1;
- $recv($1)._arguments_($recv(aNode)._parameters());
- $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
- $2=$1;
- $3=$recv(aNode)._scope();
- $ctx1.sendIdx["scope"]=1;
- $recv($2)._scope_($3);
- $ctx1.sendIdx["scope:"]=1;
- $4=$recv($1)._yourself();
- $ctx1.sendIdx["yourself"]=1;
- closure=$4;
- $6=$recv(aNode)._scope();
- $ctx1.sendIdx["scope"]=2;
- $5=$recv($6)._temps();
- $recv($5)._do_((function(each){
- return $core.withContext(function($ctx2) {
- $7=$recv($IRTempDeclaration())._new();
- $recv($7)._name_($recv(each)._name());
- $recv($7)._scope_($recv(aNode)._scope());
- $8=$recv($7)._yourself();
- return $recv(closure)._add_($8);
- $ctx2.sendIdx["add:"]=1;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $ctx1.sendIdx["do:"]=1;
- $recv($recv(aNode)._nodes())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(closure)._add_(self._visit_(each));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- $9=closure;
- return $9;
- }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
- },
- args: ["aNode"],
- 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",
- referencedClasses: ["IRClosure", "IRTempDeclaration"],
- messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"]
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitBlockSequenceNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
- function $IRBlockReturn(){return $globals.IRBlockReturn||(typeof IRBlockReturn=="undefined"?nil:IRBlockReturn)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$5,$4,$6,$7,$10,$9,$8,$11,$13,$14,$17,$16,$15,$18,$12,$1;
- $2=$recv($IRBlockSequence())._new();
- $ctx1.sendIdx["new"]=1;
- $1=self._withSequence_do_($2,(function(){
- return $core.withContext(function($ctx2) {
- $3=$recv(aNode)._nodes();
- $ctx2.sendIdx["nodes"]=1;
- return $recv($3)._ifNotEmpty_((function(){
- return $core.withContext(function($ctx3) {
- $5=$recv(aNode)._nodes();
- $ctx3.sendIdx["nodes"]=2;
- $4=$recv($5)._allButLast();
- $recv($4)._do_((function(each){
- return $core.withContext(function($ctx4) {
- $6=self._sequence();
- $ctx4.sendIdx["sequence"]=1;
- $7=self._visitOrAlias_(each);
- $ctx4.sendIdx["visitOrAlias:"]=1;
- return $recv($6)._add_($7);
- $ctx4.sendIdx["add:"]=1;
- }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
- }));
- $10=$recv(aNode)._nodes();
- $ctx3.sendIdx["nodes"]=3;
- $9=$recv($10)._last();
- $ctx3.sendIdx["last"]=1;
- $8=$recv($9)._isReturnNode();
- if($core.assert($8)){
- return $recv(self._sequence())._add_(self._visitOrAlias_($recv($recv(aNode)._nodes())._last()));
- } else {
- $11=self._sequence();
- $ctx3.sendIdx["sequence"]=2;
- $13=$recv($IRBlockReturn())._new();
- $14=$13;
- $17=$recv(aNode)._nodes();
- $ctx3.sendIdx["nodes"]=4;
- $16=$recv($17)._last();
- $ctx3.sendIdx["last"]=2;
- $15=self._visitOrAlias_($16);
- $ctx3.sendIdx["visitOrAlias:"]=2;
- $recv($14)._add_($15);
- $ctx3.sendIdx["add:"]=3;
- $18=$recv($13)._yourself();
- $12=$18;
- return $recv($11)._add_($12);
- $ctx3.sendIdx["add:"]=2;
- };
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
- },
- args: ["aNode"],
- 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) ] ]]",
- referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
- messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "nodes", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"]
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitCascadeNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- var alias,receiver;
- function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$3,$5,$4,$6;
- $2=$recv(aNode)._receiver();
- $ctx1.sendIdx["receiver"]=1;
- $1=$recv($2)._isImmutable();
- if($core.assert($1)){
- receiver=$recv(aNode)._receiver();
- $ctx1.sendIdx["receiver"]=2;
- receiver;
- } else {
- alias=self._alias_($recv(aNode)._receiver());
- $ctx1.sendIdx["alias:"]=1;
- alias;
- receiver=$recv($recv($VariableNode())._new())._binding_($recv(alias)._variable());
- receiver;
- };
- $3=$recv(aNode)._nodes();
- $ctx1.sendIdx["nodes"]=1;
- $recv($3)._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._receiver_(receiver);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
- }));
- $ctx1.sendIdx["do:"]=1;
- $5=$recv(aNode)._nodes();
- $ctx1.sendIdx["nodes"]=2;
- $4=$recv($5)._allButLast();
- $recv($4)._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(self._sequence())._add_(self._visit_(each));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
- }));
- $6=self._alias_($recv($recv(aNode)._nodes())._last());
- return $6;
- }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,alias:alias,receiver:receiver},$globals.IRASTTranslator)});
- },
- args: ["aNode"],
- 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",
- referencedClasses: ["VariableNode"],
- messageSends: ["ifTrue:ifFalse:", "isImmutable", "receiver", "alias:", "binding:", "new", "variable", "do:", "nodes", "receiver:", "allButLast", "add:", "sequence", "visit:", "last"]
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitDynamicArrayNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- var array;
- function $IRDynamicArray(){return $globals.IRDynamicArray||(typeof IRDynamicArray=="undefined"?nil:IRDynamicArray)}
- return $core.withContext(function($ctx1) {
- var $1;
- array=$recv($IRDynamicArray())._new();
- $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(array)._add_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $1=array;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
- },
- args: ["aNode"],
- source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | array add: each ].\x0a\x09^ array",
- referencedClasses: ["IRDynamicArray"],
- messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitDynamicDictionaryNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- var dictionary;
- function $IRDynamicDictionary(){return $globals.IRDynamicDictionary||(typeof IRDynamicDictionary=="undefined"?nil:IRDynamicDictionary)}
- return $core.withContext(function($ctx1) {
- var $1;
- dictionary=$recv($IRDynamicDictionary())._new();
- $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(dictionary)._add_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $1=dictionary;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
- },
- args: ["aNode"],
- source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
- referencedClasses: ["IRDynamicDictionary"],
- messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitJSStatementNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- function $IRVerbatim(){return $globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($IRVerbatim())._new();
- $recv($2)._source_($recv($recv(aNode)._source())._crlfSanitized());
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
- },
- args: ["aNode"],
- source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
- referencedClasses: ["IRVerbatim"],
- messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitMethodNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- function $IRMethod(){return $globals.IRMethod||(typeof IRMethod=="undefined"?nil:IRMethod)}
- function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
- function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
- function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
- function $IRVerbatim(){return $globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
- return $core.withContext(function($ctx1) {
- 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;
- $2=$recv($IRMethod())._new();
- $ctx1.sendIdx["new"]=1;
- $recv($2)._source_($recv(self._source())._crlfSanitized());
- $ctx1.sendIdx["source:"]=1;
- $recv($2)._theClass_(self._theClass());
- $recv($2)._arguments_($recv(aNode)._arguments());
- $recv($2)._selector_($recv(aNode)._selector());
- $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
- $recv($2)._superSends_($recv(aNode)._superSends());
- $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
- $recv($2)._classReferences_($recv(aNode)._classReferences());
- $3=$2;
- $4=$recv(aNode)._scope();
- $ctx1.sendIdx["scope"]=1;
- $recv($3)._scope_($4);
- $ctx1.sendIdx["scope:"]=1;
- $5=$recv($2)._yourself();
- $ctx1.sendIdx["yourself"]=1;
- $1=$5;
- self._method_($1);
- $7=$recv(aNode)._scope();
- $ctx1.sendIdx["scope"]=2;
- $6=$recv($7)._temps();
- $recv($6)._do_((function(each){
- return $core.withContext(function($ctx2) {
- $8=self._method();
- $ctx2.sendIdx["method"]=1;
- $10=$recv($IRTempDeclaration())._new();
- $ctx2.sendIdx["new"]=2;
- $recv($10)._name_($recv(each)._name());
- $11=$10;
- $12=$recv(aNode)._scope();
- $ctx2.sendIdx["scope"]=3;
- $recv($11)._scope_($12);
- $13=$recv($10)._yourself();
- $ctx2.sendIdx["yourself"]=2;
- $9=$13;
- return $recv($8)._add_($9);
- $ctx2.sendIdx["add:"]=1;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $ctx1.sendIdx["do:"]=1;
- $recv($recv(aNode)._nodes())._do_((function(each){
- return $core.withContext(function($ctx2) {
- $14=self._method();
- $ctx2.sendIdx["method"]=2;
- return $recv($14)._add_(self._visit_(each));
- $ctx2.sendIdx["add:"]=2;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- $16=$recv(aNode)._scope();
- $ctx1.sendIdx["scope"]=4;
- $15=$recv($16)._hasLocalReturn();
- if(!$core.assert($15)){
- $17=self._method();
- $ctx1.sendIdx["method"]=3;
- $18=$17;
- $20=$recv($IRReturn())._new();
- $ctx1.sendIdx["new"]=3;
- $21=$20;
- $23=$recv($IRVariable())._new();
- $ctx1.sendIdx["new"]=4;
- $recv($23)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
- $24=$recv($23)._yourself();
- $ctx1.sendIdx["yourself"]=3;
- $22=$24;
- $recv($21)._add_($22);
- $ctx1.sendIdx["add:"]=4;
- $25=$recv($20)._yourself();
- $ctx1.sendIdx["yourself"]=4;
- $19=$25;
- $recv($18)._add_($19);
- $ctx1.sendIdx["add:"]=3;
- $27=$recv($IRVerbatim())._new();
- $recv($27)._source_("");
- $28=$recv($27)._yourself();
- $26=$recv($17)._add_($28);
- $26;
- };
- $29=self._method();
- return $29;
- }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
- },
- args: ["aNode"],
- 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",
- referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"],
- 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"]
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitOrAlias:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=$recv(aNode)._shouldBeAliased();
- if($core.assert($2)){
- $1=self._alias_(aNode);
- } else {
- $1=self._visit_(aNode);
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
- },
- args: ["aNode"],
- source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitReturnNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- var return_;
- function $IRNonLocalReturn(){return $globals.IRNonLocalReturn||(typeof IRNonLocalReturn=="undefined"?nil:IRNonLocalReturn)}
- function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=$recv(aNode)._nonLocalReturn();
- if($core.assert($1)){
- return_=$recv($IRNonLocalReturn())._new();
- $ctx1.sendIdx["new"]=1;
- } else {
- return_=$recv($IRReturn())._new();
- };
- $recv(return_)._scope_($recv(aNode)._scope());
- $recv($recv(aNode)._nodes())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(return_)._add_(self._alias_(each));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
- }));
- $2=return_;
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
- },
- args: ["aNode"],
- 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",
- referencedClasses: ["IRNonLocalReturn", "IRReturn"],
- messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "nodes", "add:", "alias:"]
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitSendNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- var send,all,receiver,arguments_;
- function $IRSend(){return $globals.IRSend||(typeof IRSend=="undefined"?nil:IRSend)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- send=$recv($IRSend())._new();
- $1=send;
- $recv($1)._selector_($recv(aNode)._selector());
- $2=$recv($1)._index_($recv(aNode)._index());
- $3=$recv(aNode)._superSend();
- if($core.assert($3)){
- $recv(send)._classSend_($recv(self._theClass())._superclass());
- };
- all=self._aliasTemporally_($recv([$recv(aNode)._receiver()]).__comma($recv(aNode)._arguments()));
- receiver=$recv(all)._first();
- arguments_=$recv(all)._allButFirst();
- $recv(send)._add_(receiver);
- $ctx1.sendIdx["add:"]=1;
- $recv(arguments_)._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(send)._add_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- $4=send;
- return $4;
- }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send,all:all,receiver:receiver,arguments_:arguments_},$globals.IRASTTranslator)});
- },
- args: ["aNode"],
- 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",
- referencedClasses: ["IRSend"],
- messageSends: ["new", "selector:", "selector", "index:", "index", "ifTrue:", "superSend", "classSend:", "superclass", "theClass", "aliasTemporally:", ",", "receiver", "arguments", "first", "allButFirst", "add:", "do:"]
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitSequenceNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- function $IRSequence(){return $globals.IRSequence||(typeof IRSequence=="undefined"?nil:IRSequence)}
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $1=self._withSequence_do_($recv($IRSequence())._new(),(function(){
- return $core.withContext(function($ctx2) {
- return $recv($recv(aNode)._nodes())._do_((function(each){
- var instruction;
- return $core.withContext(function($ctx3) {
- instruction=self._visitOrAlias_(each);
- instruction;
- $2=$recv(instruction)._isVariable();
- if(!$core.assert($2)){
- return $recv(self._sequence())._add_(instruction);
- };
- }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)});
- }));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
- },
- args: ["aNode"],
- 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 ] ]]",
- referencedClasses: ["IRSequence"],
- messageSends: ["withSequence:do:", "new", "do:", "nodes", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"]
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitValueNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- function $IRValue(){return $globals.IRValue||(typeof IRValue=="undefined"?nil:IRValue)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($IRValue())._new();
- $recv($2)._value_($recv(aNode)._value());
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
- },
- args: ["aNode"],
- source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
- referencedClasses: ["IRValue"],
- messageSends: ["value:", "new", "value", "yourself"]
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitVariableNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($IRVariable())._new();
- $recv($2)._variable_($recv(aNode)._binding());
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
- },
- args: ["aNode"],
- source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
- referencedClasses: ["IRVariable"],
- messageSends: ["variable:", "new", "binding", "yourself"]
- }),
- $globals.IRASTTranslator);
- $core.addMethod(
- $core.method({
- selector: "withSequence:do:",
- protocol: 'accessing',
- fn: function (aSequence,aBlock){
- var self=this;
- var outerSequence;
- return $core.withContext(function($ctx1) {
- outerSequence=self._sequence();
- self._sequence_(aSequence);
- $ctx1.sendIdx["sequence:"]=1;
- $recv(aBlock)._value();
- self._sequence_(outerSequence);
- return aSequence;
- }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
- },
- args: ["aSequence", "aBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["sequence", "sequence:", "value"]
- }),
- $globals.IRASTTranslator);
- $core.addClass('IRInstruction', $globals.Object, ['parent', 'instructions'], 'Compiler-IR');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitIRInstruction_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInstruction)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
- referencedClasses: [],
- messageSends: ["visitIRInstruction:"]
- }),
- $globals.IRInstruction);
- $core.addMethod(
- $core.method({
- selector: "add:",
- protocol: 'building',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $recv(anObject)._parent_(self);
- $1=$recv(self._instructions())._add_(anObject);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
- },
- args: ["anObject"],
- source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
- referencedClasses: [],
- messageSends: ["parent:", "add:", "instructions"]
- }),
- $globals.IRInstruction);
- $core.addMethod(
- $core.method({
- selector: "canBeAssigned",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "canBeAssigned\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRInstruction);
- $core.addMethod(
- $core.method({
- selector: "instructions",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@instructions"];
- if(($receiver = $2) == null || $receiver.isNil){
- self["@instructions"]=$recv($OrderedCollection())._new();
- $1=self["@instructions"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"instructions",{},$globals.IRInstruction)});
- },
- args: [],
- source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
- referencedClasses: ["OrderedCollection"],
- messageSends: ["ifNil:", "new"]
- }),
- $globals.IRInstruction);
- $core.addMethod(
- $core.method({
- selector: "isClosure",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isClosure\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRInstruction);
- $core.addMethod(
- $core.method({
- selector: "isInlined",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isInlined\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRInstruction);
- $core.addMethod(
- $core.method({
- selector: "isLocalReturn",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isLocalReturn\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRInstruction);
- $core.addMethod(
- $core.method({
- selector: "isMethod",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isMethod\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRInstruction);
- $core.addMethod(
- $core.method({
- selector: "isReturn",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isReturn\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRInstruction);
- $core.addMethod(
- $core.method({
- selector: "isSend",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isSend\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRInstruction);
- $core.addMethod(
- $core.method({
- selector: "isSequence",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isSequence\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRInstruction);
- $core.addMethod(
- $core.method({
- selector: "isTempDeclaration",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isTempDeclaration\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRInstruction);
- $core.addMethod(
- $core.method({
- selector: "isVariable",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isVariable\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRInstruction);
- $core.addMethod(
- $core.method({
- selector: "method",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._parent())._method();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
- },
- args: [],
- source: "method\x0a\x09^ self parent method",
- referencedClasses: [],
- messageSends: ["method", "parent"]
- }),
- $globals.IRInstruction);
- $core.addMethod(
- $core.method({
- selector: "needsBoxingAsReceiver",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "needsBoxingAsReceiver\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRInstruction);
- $core.addMethod(
- $core.method({
- selector: "parent",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@parent"];
- return $1;
- },
- args: [],
- source: "parent\x0a\x09^ parent",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRInstruction);
- $core.addMethod(
- $core.method({
- selector: "parent:",
- protocol: 'accessing',
- fn: function (anIRInstruction){
- var self=this;
- self["@parent"]=anIRInstruction;
- return self;
- },
- args: ["anIRInstruction"],
- source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRInstruction);
- $core.addMethod(
- $core.method({
- selector: "remove",
- protocol: 'building',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._parent())._remove_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"remove",{},$globals.IRInstruction)});
- },
- args: [],
- source: "remove\x0a\x09self parent remove: self",
- referencedClasses: [],
- messageSends: ["remove:", "parent"]
- }),
- $globals.IRInstruction);
- $core.addMethod(
- $core.method({
- selector: "remove:",
- protocol: 'building',
- fn: function (anIRInstruction){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._instructions())._remove_(anIRInstruction);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
- },
- args: ["anIRInstruction"],
- source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
- referencedClasses: [],
- messageSends: ["remove:", "instructions"]
- }),
- $globals.IRInstruction);
- $core.addMethod(
- $core.method({
- selector: "replace:with:",
- protocol: 'building',
- fn: function (anIRInstruction,anotherIRInstruction){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $recv(anotherIRInstruction)._parent_(self);
- $1=self._instructions();
- $ctx1.sendIdx["instructions"]=1;
- $recv($1)._at_put_($recv(self._instructions())._indexOf_(anIRInstruction),anotherIRInstruction);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
- },
- args: ["anIRInstruction", "anotherIRInstruction"],
- source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions\x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
- referencedClasses: [],
- messageSends: ["parent:", "at:put:", "instructions", "indexOf:"]
- }),
- $globals.IRInstruction);
- $core.addMethod(
- $core.method({
- selector: "replaceWith:",
- protocol: 'building',
- fn: function (anIRInstruction){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._parent())._replace_with_(self,anIRInstruction);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
- },
- args: ["anIRInstruction"],
- source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
- referencedClasses: [],
- messageSends: ["replace:with:", "parent"]
- }),
- $globals.IRInstruction);
- $core.addMethod(
- $core.method({
- selector: "scope",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self._parent();
- if(($receiver = $2) == null || $receiver.isNil){
- $1=$2;
- } else {
- var node;
- node=$receiver;
- $1=$recv(node)._scope();
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
- },
- args: [],
- source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
- referencedClasses: [],
- messageSends: ["ifNotNil:", "parent", "scope"]
- }),
- $globals.IRInstruction);
- $core.addMethod(
- $core.method({
- selector: "on:",
- protocol: 'instance creation',
- fn: function (aBuilder){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- $recv($2)._builder_(aBuilder);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.klass)});
- },
- args: ["aBuilder"],
- source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["builder:", "new", "yourself"]
- }),
- $globals.IRInstruction.klass);
- $core.addClass('IRAssignment', $globals.IRInstruction, [], 'Compiler-IR');
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitIRAssignment_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRAssignment)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
- referencedClasses: [],
- messageSends: ["visitIRAssignment:"]
- }),
- $globals.IRAssignment);
- $core.addClass('IRDynamicArray', $globals.IRInstruction, [], 'Compiler-IR');
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitIRDynamicArray_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
- referencedClasses: [],
- messageSends: ["visitIRDynamicArray:"]
- }),
- $globals.IRDynamicArray);
- $core.addClass('IRDynamicDictionary', $globals.IRInstruction, [], 'Compiler-IR');
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitIRDynamicDictionary_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
- referencedClasses: [],
- messageSends: ["visitIRDynamicDictionary:"]
- }),
- $globals.IRDynamicDictionary);
- $core.addClass('IRScopedInstruction', $globals.IRInstruction, ['scope'], 'Compiler-IR');
- $core.addMethod(
- $core.method({
- selector: "scope",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@scope"];
- return $1;
- },
- args: [],
- source: "scope\x0a\x09^ scope",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRScopedInstruction);
- $core.addMethod(
- $core.method({
- selector: "scope:",
- protocol: 'accessing',
- fn: function (aScope){
- var self=this;
- self["@scope"]=aScope;
- return self;
- },
- args: ["aScope"],
- source: "scope: aScope\x0a\x09scope := aScope",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRScopedInstruction);
- $core.addClass('IRClosureInstruction', $globals.IRScopedInstruction, ['arguments', 'requiresSmalltalkContext'], 'Compiler-IR');
- $core.addMethod(
- $core.method({
- selector: "arguments",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@arguments"];
- if(($receiver = $2) == null || $receiver.isNil){
- $1=[];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
- },
- args: [],
- source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
- referencedClasses: [],
- messageSends: ["ifNil:"]
- }),
- $globals.IRClosureInstruction);
- $core.addMethod(
- $core.method({
- selector: "arguments:",
- protocol: 'accessing',
- fn: function (aCollection){
- var self=this;
- self["@arguments"]=aCollection;
- return self;
- },
- args: ["aCollection"],
- source: "arguments: aCollection\x0a\x09arguments := aCollection",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRClosureInstruction);
- $core.addMethod(
- $core.method({
- selector: "locals",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv(self._arguments())._copy();
- $recv($2)._addAll_($recv(self._tempDeclarations())._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._name();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- })));
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
- },
- args: [],
- source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
- }),
- $globals.IRClosureInstruction);
- $core.addMethod(
- $core.method({
- selector: "requiresSmalltalkContext",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@requiresSmalltalkContext"];
- if(($receiver = $2) == null || $receiver.isNil){
- $1=false;
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
- },
- args: [],
- source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
- referencedClasses: [],
- messageSends: ["ifNil:"]
- }),
- $globals.IRClosureInstruction);
- $core.addMethod(
- $core.method({
- selector: "requiresSmalltalkContext:",
- protocol: 'accessing',
- fn: function (anObject){
- var self=this;
- self["@requiresSmalltalkContext"]=anObject;
- return self;
- },
- args: ["anObject"],
- source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRClosureInstruction);
- $core.addMethod(
- $core.method({
- selector: "scope:",
- protocol: 'accessing',
- fn: function (aScope){
- var self=this;
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.IRClosureInstruction.superclass.fn.prototype._scope_.apply($recv(self), [aScope]));
- $ctx1.supercall = false;
- $recv(aScope)._instruction_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
- },
- args: ["aScope"],
- source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
- referencedClasses: [],
- messageSends: ["scope:", "instruction:"]
- }),
- $globals.IRClosureInstruction);
- $core.addMethod(
- $core.method({
- selector: "tempDeclarations",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._instructions())._select_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._isTempDeclaration();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
- },
- args: [],
- source: "tempDeclarations\x0a\x09^ self instructions select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
- referencedClasses: [],
- messageSends: ["select:", "instructions", "isTempDeclaration"]
- }),
- $globals.IRClosureInstruction);
- $core.addClass('IRClosure', $globals.IRClosureInstruction, [], 'Compiler-IR');
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitIRClosure_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRClosure)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
- referencedClasses: [],
- messageSends: ["visitIRClosure:"]
- }),
- $globals.IRClosure);
- $core.addMethod(
- $core.method({
- selector: "isClosure",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isClosure\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRClosure);
- $core.addMethod(
- $core.method({
- selector: "sequence",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._instructions())._last();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
- },
- args: [],
- source: "sequence\x0a\x09^ self instructions last",
- referencedClasses: [],
- messageSends: ["last", "instructions"]
- }),
- $globals.IRClosure);
- $core.addClass('IRMethod', $globals.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'sendIndexes', 'superSends', 'requiresSmalltalkContext', 'internalVariables'], 'Compiler-IR');
- $globals.IRMethod.comment="I am a method instruction";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitIRMethod_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRMethod)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
- referencedClasses: [],
- messageSends: ["visitIRMethod:"]
- }),
- $globals.IRMethod);
- $core.addMethod(
- $core.method({
- selector: "classReferences",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@classReferences"];
- return $1;
- },
- args: [],
- source: "classReferences\x0a\x09^ classReferences",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRMethod);
- $core.addMethod(
- $core.method({
- selector: "classReferences:",
- protocol: 'accessing',
- fn: function (aCollection){
- var self=this;
- self["@classReferences"]=aCollection;
- return self;
- },
- args: ["aCollection"],
- source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRMethod);
- $core.addMethod(
- $core.method({
- selector: "internalVariables",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@internalVariables"];
- if(($receiver = $2) == null || $receiver.isNil){
- self["@internalVariables"]=$recv($Set())._new();
- $1=self["@internalVariables"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
- },
- args: [],
- source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
- referencedClasses: ["Set"],
- messageSends: ["ifNil:", "new"]
- }),
- $globals.IRMethod);
- $core.addMethod(
- $core.method({
- selector: "isMethod",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isMethod\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRMethod);
- $core.addMethod(
- $core.method({
- selector: "messageSends",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._sendIndexes())._keys();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
- },
- args: [],
- source: "messageSends\x0a\x09^ self sendIndexes keys",
- referencedClasses: [],
- messageSends: ["keys", "sendIndexes"]
- }),
- $globals.IRMethod);
- $core.addMethod(
- $core.method({
- selector: "method",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "method\x0a\x09^ self",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRMethod);
- $core.addMethod(
- $core.method({
- selector: "selector",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@selector"];
- return $1;
- },
- args: [],
- source: "selector\x0a\x09^ selector",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRMethod);
- $core.addMethod(
- $core.method({
- selector: "selector:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@selector"]=aString;
- return self;
- },
- args: ["aString"],
- source: "selector: aString\x0a\x09selector := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRMethod);
- $core.addMethod(
- $core.method({
- selector: "sendIndexes",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@sendIndexes"];
- return $1;
- },
- args: [],
- source: "sendIndexes\x0a\x09^ sendIndexes",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRMethod);
- $core.addMethod(
- $core.method({
- selector: "sendIndexes:",
- protocol: 'accessing',
- fn: function (aDictionary){
- var self=this;
- self["@sendIndexes"]=aDictionary;
- return self;
- },
- args: ["aDictionary"],
- source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRMethod);
- $core.addMethod(
- $core.method({
- selector: "source",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@source"];
- return $1;
- },
- args: [],
- source: "source\x0a\x09^ source",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRMethod);
- $core.addMethod(
- $core.method({
- selector: "source:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@source"]=aString;
- return self;
- },
- args: ["aString"],
- source: "source: aString\x0a\x09source := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRMethod);
- $core.addMethod(
- $core.method({
- selector: "superSends",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@superSends"];
- return $1;
- },
- args: [],
- source: "superSends\x0a\x09^ superSends",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRMethod);
- $core.addMethod(
- $core.method({
- selector: "superSends:",
- protocol: 'accessing',
- fn: function (aCollection){
- var self=this;
- self["@superSends"]=aCollection;
- return self;
- },
- args: ["aCollection"],
- source: "superSends: aCollection\x0a\x09superSends := aCollection",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRMethod);
- $core.addMethod(
- $core.method({
- selector: "theClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@theClass"];
- return $1;
- },
- args: [],
- source: "theClass\x0a\x09^ theClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRMethod);
- $core.addMethod(
- $core.method({
- selector: "theClass:",
- protocol: 'accessing',
- fn: function (aClass){
- var self=this;
- self["@theClass"]=aClass;
- return self;
- },
- args: ["aClass"],
- source: "theClass: aClass\x0a\x09theClass := aClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRMethod);
- $core.addClass('IRReturn', $globals.IRScopedInstruction, [], 'Compiler-IR');
- $globals.IRReturn.comment="I am a local return instruction.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitIRReturn_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRReturn)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
- referencedClasses: [],
- messageSends: ["visitIRReturn:"]
- }),
- $globals.IRReturn);
- $core.addMethod(
- $core.method({
- selector: "canBeAssigned",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "canBeAssigned\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRReturn);
- $core.addMethod(
- $core.method({
- selector: "isBlockReturn",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isBlockReturn\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRReturn);
- $core.addMethod(
- $core.method({
- selector: "isLocalReturn",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isLocalReturn\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRReturn);
- $core.addMethod(
- $core.method({
- selector: "isNonLocalReturn",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._isLocalReturn())._not();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isNonLocalReturn",{},$globals.IRReturn)});
- },
- args: [],
- source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
- referencedClasses: [],
- messageSends: ["not", "isLocalReturn"]
- }),
- $globals.IRReturn);
- $core.addMethod(
- $core.method({
- selector: "isReturn",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isReturn\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRReturn);
- $core.addMethod(
- $core.method({
- selector: "scope",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@scope"];
- if(($receiver = $2) == null || $receiver.isNil){
- $1=$recv(self._parent())._scope();
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
- },
- args: [],
- source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
- referencedClasses: [],
- messageSends: ["ifNil:", "scope", "parent"]
- }),
- $globals.IRReturn);
- $core.addClass('IRBlockReturn', $globals.IRReturn, [], 'Compiler-IR');
- $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitIRBlockReturn_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
- referencedClasses: [],
- messageSends: ["visitIRBlockReturn:"]
- }),
- $globals.IRBlockReturn);
- $core.addMethod(
- $core.method({
- selector: "isBlockReturn",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isBlockReturn\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRBlockReturn);
- $core.addClass('IRNonLocalReturn', $globals.IRReturn, [], 'Compiler-IR');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitIRNonLocalReturn_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
- referencedClasses: [],
- messageSends: ["visitIRNonLocalReturn:"]
- }),
- $globals.IRNonLocalReturn);
- $core.addMethod(
- $core.method({
- selector: "isLocalReturn",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isLocalReturn\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRNonLocalReturn);
- $core.addClass('IRTempDeclaration', $globals.IRScopedInstruction, ['name'], 'Compiler-IR');
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitIRTempDeclaration_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
- referencedClasses: [],
- messageSends: ["visitIRTempDeclaration:"]
- }),
- $globals.IRTempDeclaration);
- $core.addMethod(
- $core.method({
- selector: "isTempDeclaration",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isTempDeclaration\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRTempDeclaration);
- $core.addMethod(
- $core.method({
- selector: "name",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@name"];
- return $1;
- },
- args: [],
- source: "name\x0a\x09^ name",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRTempDeclaration);
- $core.addMethod(
- $core.method({
- selector: "name:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@name"]=aString;
- return self;
- },
- args: ["aString"],
- source: "name: aString\x0a\x09name := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRTempDeclaration);
- $core.addClass('IRSend', $globals.IRInstruction, ['selector', 'classSend', 'index'], 'Compiler-IR');
- $globals.IRSend.comment="I am a message send instruction.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitIRSend_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSend)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
- referencedClasses: [],
- messageSends: ["visitIRSend:"]
- }),
- $globals.IRSend);
- $core.addMethod(
- $core.method({
- selector: "classSend",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@classSend"];
- return $1;
- },
- args: [],
- source: "classSend\x0a\x09^ classSend",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRSend);
- $core.addMethod(
- $core.method({
- selector: "classSend:",
- protocol: 'accessing',
- fn: function (aClass){
- var self=this;
- self["@classSend"]=aClass;
- return self;
- },
- args: ["aClass"],
- source: "classSend: aClass\x0a\x09classSend := aClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRSend);
- $core.addMethod(
- $core.method({
- selector: "index",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@index"];
- return $1;
- },
- args: [],
- source: "index\x0a\x09^ index",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRSend);
- $core.addMethod(
- $core.method({
- selector: "index:",
- protocol: 'accessing',
- fn: function (anInteger){
- var self=this;
- self["@index"]=anInteger;
- return self;
- },
- args: ["anInteger"],
- source: "index: anInteger\x0a\x09index := anInteger",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRSend);
- $core.addMethod(
- $core.method({
- selector: "isSend",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isSend\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRSend);
- $core.addMethod(
- $core.method({
- selector: "selector",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@selector"];
- return $1;
- },
- args: [],
- source: "selector\x0a\x09^ selector",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRSend);
- $core.addMethod(
- $core.method({
- selector: "selector:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@selector"]=aString;
- return self;
- },
- args: ["aString"],
- source: "selector: aString\x0a\x09selector := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRSend);
- $core.addClass('IRSequence', $globals.IRInstruction, [], 'Compiler-IR');
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitIRSequence_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSequence)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
- referencedClasses: [],
- messageSends: ["visitIRSequence:"]
- }),
- $globals.IRSequence);
- $core.addMethod(
- $core.method({
- selector: "isSequence",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isSequence\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRSequence);
- $core.addClass('IRBlockSequence', $globals.IRSequence, [], 'Compiler-IR');
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitIRBlockSequence_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
- referencedClasses: [],
- messageSends: ["visitIRBlockSequence:"]
- }),
- $globals.IRBlockSequence);
- $core.addClass('IRValue', $globals.IRInstruction, ['value'], 'Compiler-IR');
- $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitIRValue_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRValue)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
- referencedClasses: [],
- messageSends: ["visitIRValue:"]
- }),
- $globals.IRValue);
- $core.addMethod(
- $core.method({
- selector: "needsBoxingAsReceiver",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "needsBoxingAsReceiver\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRValue);
- $core.addMethod(
- $core.method({
- selector: "value",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@value"];
- return $1;
- },
- args: [],
- source: "value\x0a\x09^ value",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRValue);
- $core.addMethod(
- $core.method({
- selector: "value:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@value"]=aString;
- return self;
- },
- args: ["aString"],
- source: "value: aString\x0a\x09value := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRValue);
- $core.addClass('IRVariable', $globals.IRInstruction, ['variable'], 'Compiler-IR');
- $globals.IRVariable.comment="I am a variable instruction.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitIRVariable_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVariable)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
- referencedClasses: [],
- messageSends: ["visitIRVariable:"]
- }),
- $globals.IRVariable);
- $core.addMethod(
- $core.method({
- selector: "isVariable",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isVariable\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRVariable);
- $core.addMethod(
- $core.method({
- selector: "needsBoxingAsReceiver",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv(self._variable())._isPseudoVar())._not();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
- },
- args: [],
- source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
- referencedClasses: [],
- messageSends: ["not", "isPseudoVar", "variable"]
- }),
- $globals.IRVariable);
- $core.addMethod(
- $core.method({
- selector: "variable",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@variable"];
- return $1;
- },
- args: [],
- source: "variable\x0a\x09^ variable",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRVariable);
- $core.addMethod(
- $core.method({
- selector: "variable:",
- protocol: 'accessing',
- fn: function (aScopeVariable){
- var self=this;
- self["@variable"]=aScopeVariable;
- return self;
- },
- args: ["aScopeVariable"],
- source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRVariable);
- $core.addClass('IRVerbatim', $globals.IRInstruction, ['source'], 'Compiler-IR');
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitIRVerbatim_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVerbatim)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
- referencedClasses: [],
- messageSends: ["visitIRVerbatim:"]
- }),
- $globals.IRVerbatim);
- $core.addMethod(
- $core.method({
- selector: "source",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@source"];
- return $1;
- },
- args: [],
- source: "source\x0a\x09^ source",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRVerbatim);
- $core.addMethod(
- $core.method({
- selector: "source:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@source"]=aString;
- return self;
- },
- args: ["aString"],
- source: "source: aString\x0a\x09source := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRVerbatim);
- $core.addClass('IRVisitor', $globals.Object, [], 'Compiler-IR');
- $core.addMethod(
- $core.method({
- selector: "visit:",
- protocol: 'visiting',
- fn: function (anIRInstruction){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(anIRInstruction)._accept_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visit:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)});
- },
- args: ["anIRInstruction"],
- source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
- referencedClasses: [],
- messageSends: ["accept:"]
- }),
- $globals.IRVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitIRAssignment:",
- protocol: 'visiting',
- fn: function (anIRAssignment){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitIRInstruction_(anIRAssignment);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
- },
- args: ["anIRAssignment"],
- source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
- referencedClasses: [],
- messageSends: ["visitIRInstruction:"]
- }),
- $globals.IRVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitIRBlockReturn:",
- protocol: 'visiting',
- fn: function (anIRBlockReturn){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitIRReturn_(anIRBlockReturn);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
- },
- args: ["anIRBlockReturn"],
- source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
- referencedClasses: [],
- messageSends: ["visitIRReturn:"]
- }),
- $globals.IRVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitIRBlockSequence:",
- protocol: 'visiting',
- fn: function (anIRBlockSequence){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitIRSequence_(anIRBlockSequence);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
- },
- args: ["anIRBlockSequence"],
- source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
- referencedClasses: [],
- messageSends: ["visitIRSequence:"]
- }),
- $globals.IRVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitIRClosure:",
- protocol: 'visiting',
- fn: function (anIRClosure){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitIRInstruction_(anIRClosure);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
- },
- args: ["anIRClosure"],
- source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
- referencedClasses: [],
- messageSends: ["visitIRInstruction:"]
- }),
- $globals.IRVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitIRDynamicArray:",
- protocol: 'visiting',
- fn: function (anIRDynamicArray){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitIRInstruction_(anIRDynamicArray);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
- },
- args: ["anIRDynamicArray"],
- source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
- referencedClasses: [],
- messageSends: ["visitIRInstruction:"]
- }),
- $globals.IRVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitIRDynamicDictionary:",
- protocol: 'visiting',
- fn: function (anIRDynamicDictionary){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitIRInstruction_(anIRDynamicDictionary);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
- },
- args: ["anIRDynamicDictionary"],
- source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
- referencedClasses: [],
- messageSends: ["visitIRInstruction:"]
- }),
- $globals.IRVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitIRInlinedClosure:",
- protocol: 'visiting',
- fn: function (anIRInlinedClosure){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitIRClosure_(anIRInlinedClosure);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
- },
- args: ["anIRInlinedClosure"],
- source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
- referencedClasses: [],
- messageSends: ["visitIRClosure:"]
- }),
- $globals.IRVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitIRInlinedSequence:",
- protocol: 'visiting',
- fn: function (anIRInlinedSequence){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitIRSequence_(anIRInlinedSequence);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
- },
- args: ["anIRInlinedSequence"],
- source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
- referencedClasses: [],
- messageSends: ["visitIRSequence:"]
- }),
- $globals.IRVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitIRInstruction:",
- protocol: 'visiting',
- fn: function (anIRInstruction){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv($recv(anIRInstruction)._instructions())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return self._visit_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return anIRInstruction;
- }, function($ctx1) {$ctx1.fill(self,"visitIRInstruction:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)});
- },
- args: ["anIRInstruction"],
- source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
- referencedClasses: [],
- messageSends: ["do:", "instructions", "visit:"]
- }),
- $globals.IRVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitIRMethod:",
- protocol: 'visiting',
- fn: function (anIRMethod){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitIRInstruction_(anIRMethod);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
- },
- args: ["anIRMethod"],
- source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
- referencedClasses: [],
- messageSends: ["visitIRInstruction:"]
- }),
- $globals.IRVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitIRNonLocalReturn:",
- protocol: 'visiting',
- fn: function (anIRNonLocalReturn){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitIRInstruction_(anIRNonLocalReturn);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
- },
- args: ["anIRNonLocalReturn"],
- source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
- referencedClasses: [],
- messageSends: ["visitIRInstruction:"]
- }),
- $globals.IRVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitIRNonLocalReturnHandling:",
- protocol: 'visiting',
- fn: function (anIRNonLocalReturnHandling){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitIRInstruction_(anIRNonLocalReturnHandling);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
- },
- args: ["anIRNonLocalReturnHandling"],
- source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
- referencedClasses: [],
- messageSends: ["visitIRInstruction:"]
- }),
- $globals.IRVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitIRReturn:",
- protocol: 'visiting',
- fn: function (anIRReturn){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitIRInstruction_(anIRReturn);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
- },
- args: ["anIRReturn"],
- source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
- referencedClasses: [],
- messageSends: ["visitIRInstruction:"]
- }),
- $globals.IRVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitIRSend:",
- protocol: 'visiting',
- fn: function (anIRSend){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitIRInstruction_(anIRSend);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
- },
- args: ["anIRSend"],
- source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
- referencedClasses: [],
- messageSends: ["visitIRInstruction:"]
- }),
- $globals.IRVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitIRSequence:",
- protocol: 'visiting',
- fn: function (anIRSequence){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitIRInstruction_(anIRSequence);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
- },
- args: ["anIRSequence"],
- source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
- referencedClasses: [],
- messageSends: ["visitIRInstruction:"]
- }),
- $globals.IRVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitIRTempDeclaration:",
- protocol: 'visiting',
- fn: function (anIRTempDeclaration){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitIRInstruction_(anIRTempDeclaration);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
- },
- args: ["anIRTempDeclaration"],
- source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
- referencedClasses: [],
- messageSends: ["visitIRInstruction:"]
- }),
- $globals.IRVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitIRValue:",
- protocol: 'visiting',
- fn: function (anIRValue){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitIRInstruction_(anIRValue);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
- },
- args: ["anIRValue"],
- source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
- referencedClasses: [],
- messageSends: ["visitIRInstruction:"]
- }),
- $globals.IRVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitIRVariable:",
- protocol: 'visiting',
- fn: function (anIRVariable){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitIRInstruction_(anIRVariable);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
- },
- args: ["anIRVariable"],
- source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
- referencedClasses: [],
- messageSends: ["visitIRInstruction:"]
- }),
- $globals.IRVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitIRVerbatim:",
- protocol: 'visiting',
- fn: function (anIRVerbatim){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._visitIRInstruction_(anIRVerbatim);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
- },
- args: ["anIRVerbatim"],
- source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
- referencedClasses: [],
- messageSends: ["visitIRInstruction:"]
- }),
- $globals.IRVisitor);
- $core.addClass('IRJSTranslator', $globals.IRVisitor, ['stream', 'currentClass'], 'Compiler-IR');
- $core.addMethod(
- $core.method({
- selector: "contents",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._stream())._contents();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
- },
- args: [],
- source: "contents\x0a\x09^ self stream contents",
- referencedClasses: [],
- messageSends: ["contents", "stream"]
- }),
- $globals.IRJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "currentClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@currentClass"];
- return $1;
- },
- args: [],
- source: "currentClass\x0a\x09^ currentClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "currentClass:",
- protocol: 'accessing',
- fn: function (aClass){
- var self=this;
- self["@currentClass"]=aClass;
- return self;
- },
- args: ["aClass"],
- source: "currentClass: aClass\x0a\x09currentClass := aClass",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- function $JSStream(){return $globals.JSStream||(typeof JSStream=="undefined"?nil:JSStream)}
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.IRJSTranslator.superclass.fn.prototype._initialize.apply($recv(self), []));
- $ctx1.supercall = false;
- self["@stream"]=$recv($JSStream())._new();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
- },
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
- referencedClasses: ["JSStream"],
- messageSends: ["initialize", "new"]
- }),
- $globals.IRJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "stream",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@stream"];
- return $1;
- },
- args: [],
- source: "stream\x0a\x09^ stream",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "stream:",
- protocol: 'accessing',
- fn: function (aStream){
- var self=this;
- self["@stream"]=aStream;
- return self;
- },
- args: ["aStream"],
- source: "stream: aStream\x0a\x09stream := aStream",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitIRAssignment:",
- protocol: 'visiting',
- fn: function (anIRAssignment){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=$recv(anIRAssignment)._instructions();
- $ctx1.sendIdx["instructions"]=1;
- $1=$recv($2)._first();
- self._visit_($1);
- $ctx1.sendIdx["visit:"]=1;
- $recv(self._stream())._nextPutAssignment();
- self._visit_($recv($recv(anIRAssignment)._instructions())._last());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
- },
- args: ["anIRAssignment"],
- source: "visitIRAssignment: anIRAssignment\x0a\x09self visit: anIRAssignment instructions first.\x0a\x09self stream nextPutAssignment.\x0a\x09self visit: anIRAssignment instructions last.",
- referencedClasses: [],
- messageSends: ["visit:", "first", "instructions", "nextPutAssignment", "stream", "last"]
- }),
- $globals.IRJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitIRClosure:",
- protocol: 'visiting',
- fn: function (anIRClosure){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=self._stream();
- $ctx1.sendIdx["stream"]=1;
- $recv($1)._nextPutClosureWith_arguments_((function(){
- return $core.withContext(function($ctx2) {
- $2=self._stream();
- $ctx2.sendIdx["stream"]=2;
- $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
- return $core.withContext(function($ctx3) {
- return $recv($recv(each)._name())._asVariableName();
- }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
- })));
- return $recv(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
- return $core.withContext(function($ctx3) {
- return (
- $ctx3.supercall = true,
- $globals.IRJSTranslator.superclass.fn.prototype._visitIRClosure_.apply($recv(self), [anIRClosure]));
- $ctx3.supercall = false;
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
- }));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$recv(anIRClosure)._arguments());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
- },
- args: ["anIRClosure"],
- 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",
- referencedClasses: [],
- messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
- }),
- $globals.IRJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitIRDynamicArray:",
- protocol: 'visiting',
- fn: function (anIRDynamicArray){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._stream();
- $ctx1.sendIdx["stream"]=1;
- $recv($1)._nextPutAll_("[");
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv($recv(anIRDynamicArray)._instructions())._do_separatedBy_((function(each){
- return $core.withContext(function($ctx2) {
- return self._visit_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- return $recv(self._stream())._nextPutAll_(",");
- $ctx2.sendIdx["nextPutAll:"]=2;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- $recv(self["@stream"])._nextPutAll_("]");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
- },
- args: ["anIRDynamicArray"],
- 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: ']'",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"]
- }),
- $globals.IRJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitIRDynamicDictionary:",
- protocol: 'visiting',
- fn: function (anIRDynamicDictionary){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=self._stream();
- $ctx1.sendIdx["stream"]=1;
- $recv($1)._nextPutAll_("$globals.HashedCollection._newFromPairs_([");
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv($recv(anIRDynamicDictionary)._instructions())._do_separatedBy_((function(each){
- return $core.withContext(function($ctx2) {
- return self._visit_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- $2=self._stream();
- $ctx2.sendIdx["stream"]=2;
- return $recv($2)._nextPutAll_(",");
- $ctx2.sendIdx["nextPutAll:"]=2;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- $recv(self._stream())._nextPutAll_("])");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
- },
- args: ["anIRDynamicDictionary"],
- 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: '])'",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"]
- }),
- $globals.IRJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitIRMethod:",
- protocol: 'visiting',
- fn: function (anIRMethod){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5,$6,$8,$7,$9,$10;
- $1=self._stream();
- $ctx1.sendIdx["stream"]=1;
- $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
- return $core.withContext(function($ctx2) {
- $2=self._stream();
- $ctx2.sendIdx["stream"]=2;
- return $recv($2)._nextPutFunctionWith_arguments_((function(){
- return $core.withContext(function($ctx3) {
- $3=self._stream();
- $ctx3.sendIdx["stream"]=3;
- $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
- return $core.withContext(function($ctx4) {
- return $recv($recv(each)._name())._asVariableName();
- }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
- }));
- $ctx3.sendIdx["collect:"]=1;
- $recv($3)._nextPutVars_($4);
- $ctx3.sendIdx["nextPutVars:"]=1;
- $recv($recv(anIRMethod)._classReferences())._do_((function(each){
- return $core.withContext(function($ctx4) {
- $5=self._stream();
- $ctx4.sendIdx["stream"]=4;
- return $recv($5)._nextPutClassRefFunction_(each);
- }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,4)});
- }));
- $6=self._stream();
- $ctx3.sendIdx["stream"]=5;
- return $recv($6)._nextPutContextFor_during_(anIRMethod,(function(){
- return $core.withContext(function($ctx4) {
- $8=$recv(anIRMethod)._internalVariables();
- $ctx4.sendIdx["internalVariables"]=1;
- $7=$recv($8)._notEmpty();
- if($core.assert($7)){
- $9=self._stream();
- $ctx4.sendIdx["stream"]=6;
- $recv($9)._nextPutVars_($recv($recv($recv(anIRMethod)._internalVariables())._asSet())._collect_((function(each){
- return $core.withContext(function($ctx5) {
- return $recv($recv(each)._variable())._alias();
- }, function($ctx5) {$ctx5.fillBlock({each:each},$ctx4,7)});
- })));
- };
- $10=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
- if($core.assert($10)){
- return $recv(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
- return $core.withContext(function($ctx5) {
- return (
- $ctx5.supercall = true,
- $globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
- $ctx5.supercall = false;
- $ctx5.sendIdx["visitIRMethod:"]=1;
- }, function($ctx5) {$ctx5.fillBlock({},$ctx4,9)});
- }));
- } else {
- return (
- $ctx4.supercall = true,
- $globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
- $ctx4.supercall = false;
- };
- }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
- }));
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }),$recv(anIRMethod)._arguments());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
- },
- args: ["anIRMethod"],
- 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 ]",
- referencedClasses: [],
- 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"]
- }),
- $globals.IRJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitIRNonLocalReturn:",
- protocol: 'visiting',
- fn: function (anIRNonLocalReturn){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
- return $core.withContext(function($ctx2) {
- return (
- $ctx2.supercall = true,
- $globals.IRJSTranslator.superclass.fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
- $ctx2.supercall = false;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
- },
- args: ["anIRNonLocalReturn"],
- source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
- referencedClasses: [],
- messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
- }),
- $globals.IRJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitIRReturn:",
- protocol: 'visiting',
- fn: function (anIRReturn){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._stream())._nextPutReturnWith_((function(){
- return $core.withContext(function($ctx2) {
- return (
- $ctx2.supercall = true,
- $globals.IRJSTranslator.superclass.fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
- $ctx2.supercall = false;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
- },
- args: ["anIRReturn"],
- source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
- referencedClasses: [],
- messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
- }),
- $globals.IRJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitIRSend:",
- protocol: 'visiting',
- fn: function (anIRSend){
- var self=this;
- var sends;
- return $core.withContext(function($ctx1) {
- var $1,$2,$receiver;
- sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
- $1=$recv(anIRSend)._classSend();
- if(($receiver = $1) == null || $receiver.isNil){
- self._visitSend_(anIRSend);
- } else {
- self._visitSuperSend_(anIRSend);
- };
- $2=$recv($recv(sends).__gt((1)))._and_((function(){
- return $core.withContext(function($ctx2) {
- return $recv($recv(anIRSend)._index()).__lt(sends);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }));
- if($core.assert($2)){
- $recv(self._stream())._nextPutSendIndexFor_(anIRSend);
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends},$globals.IRJSTranslator)});
- },
- args: ["anIRSend"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifNil:ifNotNil:", "classSend", "visitSend:", "visitSuperSend:", "ifTrue:", "and:", ">", "<", "index", "nextPutSendIndexFor:", "stream"]
- }),
- $globals.IRJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitIRSequence:",
- protocol: 'visiting',
- fn: function (anIRSequence){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._stream();
- $ctx1.sendIdx["stream"]=1;
- $recv($1)._nextPutSequenceWith_((function(){
- return $core.withContext(function($ctx2) {
- return $recv($recv(anIRSequence)._instructions())._do_((function(each){
- return $core.withContext(function($ctx3) {
- return $recv(self._stream())._nextPutStatementWith_(self._visit_(each));
- }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
- }));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
- },
- args: ["anIRSequence"],
- source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ] ]",
- referencedClasses: [],
- messageSends: ["nextPutSequenceWith:", "stream", "do:", "instructions", "nextPutStatementWith:", "visit:"]
- }),
- $globals.IRJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitIRTempDeclaration:",
- protocol: 'visiting',
- fn: function (anIRTempDeclaration){
- var self=this;
- return self;
- },
- args: ["anIRTempDeclaration"],
- source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitIRValue:",
- protocol: 'visiting',
- fn: function (anIRValue){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavascript());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
- },
- args: ["anIRValue"],
- source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "stream", "asJavascript", "value"]
- }),
- $globals.IRJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitIRVariable:",
- protocol: 'visiting',
- fn: function (anIRVariable){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $3,$2,$1,$4;
- $3=$recv(anIRVariable)._variable();
- $ctx1.sendIdx["variable"]=1;
- $2=$recv($3)._name();
- $1=$recv($2).__eq("thisContext");
- if($core.assert($1)){
- $4=self._stream();
- $ctx1.sendIdx["stream"]=1;
- $recv($4)._nextPutAll_("$core.getThisContext()");
- $ctx1.sendIdx["nextPutAll:"]=1;
- } else {
- $recv(self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
- },
- args: ["anIRVariable"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
- }),
- $globals.IRJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitIRVerbatim:",
- protocol: 'visiting',
- fn: function (anIRVerbatim){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._stream();
- $ctx1.sendIdx["stream"]=1;
- $recv($1)._nextPutStatementWith_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
- },
- args: ["anIRVerbatim"],
- source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
- referencedClasses: [],
- messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"]
- }),
- $globals.IRJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitReceiver:",
- protocol: 'visiting',
- fn: function (anIRInstruction){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3;
- $1=$recv(anIRInstruction)._needsBoxingAsReceiver();
- if(!$core.assert($1)){
- $2=self._visit_(anIRInstruction);
- $ctx1.sendIdx["visit:"]=1;
- return $2;
- };
- $3=self._stream();
- $ctx1.sendIdx["stream"]=1;
- $recv($3)._nextPutAll_("$recv(");
- $ctx1.sendIdx["nextPutAll:"]=1;
- self._visit_(anIRInstruction);
- $recv(self._stream())._nextPutAll_(")");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},$globals.IRJSTranslator)});
- },
- args: ["anIRInstruction"],
- 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: ')'",
- referencedClasses: [],
- messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
- }),
- $globals.IRJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitSend:",
- protocol: 'visiting',
- fn: function (anIRSend){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$3,$4,$5;
- $2=$recv(anIRSend)._instructions();
- $ctx1.sendIdx["instructions"]=1;
- $1=$recv($2)._first();
- self._visitReceiver_($1);
- $3=self._stream();
- $ctx1.sendIdx["stream"]=1;
- $4=$recv(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName())).__comma("(");
- $ctx1.sendIdx[","]=1;
- $recv($3)._nextPutAll_($4);
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv($recv($recv(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
- return $core.withContext(function($ctx2) {
- return self._visit_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- $5=self._stream();
- $ctx2.sendIdx["stream"]=2;
- return $recv($5)._nextPutAll_(",");
- $ctx2.sendIdx["nextPutAll:"]=2;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- $recv(self._stream())._nextPutAll_(")");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
- },
- args: ["anIRSend"],
- 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: ')'",
- referencedClasses: [],
- messageSends: ["visitReceiver:", "first", "instructions", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "do:separatedBy:", "allButFirst", "visit:"]
- }),
- $globals.IRJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitSuperSend:",
- protocol: 'visiting',
- fn: function (anIRSend){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$5,$4,$3,$6,$7,$8,$10,$9,$11,$12,$13,$14;
- $1=self._stream();
- $ctx1.sendIdx["stream"]=1;
- $recv($1)._nextPutAll_("(");
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv($1)._lf();
- $ctx1.sendIdx["lf"]=1;
- $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
- $ctx1.sendIdx["nextPutAll:"]=2;
- $recv($1)._lf();
- $ctx1.sendIdx["lf"]=2;
- $2=$1;
- $5=$recv(anIRSend)._scope();
- $ctx1.sendIdx["scope"]=1;
- $4=$recv($5)._alias();
- $ctx1.sendIdx["alias"]=1;
- $3=$recv($4).__comma(".supercall = true, ");
- $ctx1.sendIdx[","]=1;
- $recv($2)._nextPutAll_($3);
- $ctx1.sendIdx["nextPutAll:"]=3;
- $recv($1)._lf();
- $ctx1.sendIdx["lf"]=3;
- $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
- $ctx1.sendIdx["nextPutAll:"]=4;
- $recv($1)._lf();
- $ctx1.sendIdx["lf"]=4;
- $recv($1)._nextPutAll_($recv(self._currentClass())._asJavascript());
- $ctx1.sendIdx["nextPutAll:"]=5;
- $recv($1)._nextPutAll_(".superclass.fn.prototype.");
- $ctx1.sendIdx["nextPutAll:"]=6;
- $6=$1;
- $7=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
- $ctx1.sendIdx[","]=2;
- $recv($6)._nextPutAll_($7);
- $ctx1.sendIdx["nextPutAll:"]=7;
- $8=$recv($1)._nextPutAll_("$recv(");
- $ctx1.sendIdx["nextPutAll:"]=8;
- $10=$recv(anIRSend)._instructions();
- $ctx1.sendIdx["instructions"]=1;
- $9=$recv($10)._first();
- self._visit_($9);
- $ctx1.sendIdx["visit:"]=1;
- $11=self._stream();
- $ctx1.sendIdx["stream"]=2;
- $recv($11)._nextPutAll_("), [");
- $ctx1.sendIdx["nextPutAll:"]=9;
- $recv($recv($recv(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
- return $core.withContext(function($ctx2) {
- return self._visit_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- $12=self._stream();
- $ctx2.sendIdx["stream"]=3;
- return $recv($12)._nextPutAll_(",");
- $ctx2.sendIdx["nextPutAll:"]=10;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- $13=self._stream();
- $recv($13)._nextPutAll_("]));");
- $ctx1.sendIdx["nextPutAll:"]=11;
- $recv($13)._lf();
- $ctx1.sendIdx["lf"]=5;
- $recv($13)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
- $ctx1.sendIdx["nextPutAll:"]=12;
- $recv($13)._lf();
- $ctx1.sendIdx["lf"]=6;
- $recv($13)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
- $ctx1.sendIdx["nextPutAll:"]=13;
- $recv($13)._lf();
- $14=$recv($13)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
- },
- args: ["anIRSend"],
- 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);'",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavascript", "currentClass", "asJavaScriptMethodName", "selector", "visit:", "first", "instructions", "do:separatedBy:", "allButFirst"]
- }),
- $globals.IRJSTranslator);
- $core.addClass('JSStream', $globals.Object, ['stream'], 'Compiler-IR');
- $core.addMethod(
- $core.method({
- selector: "contents",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self["@stream"])._contents();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
- },
- args: [],
- source: "contents\x0a\x09^ stream contents",
- referencedClasses: [],
- messageSends: ["contents"]
- }),
- $globals.JSStream);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.JSStream.superclass.fn.prototype._initialize.apply($recv(self), []));
- $ctx1.supercall = false;
- self["@stream"]=""._writeStream();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
- },
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
- referencedClasses: [],
- messageSends: ["initialize", "writeStream"]
- }),
- $globals.JSStream);
- $core.addMethod(
- $core.method({
- selector: "lf",
- protocol: 'streaming',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self["@stream"])._lf();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
- },
- args: [],
- source: "lf\x0a\x09stream lf",
- referencedClasses: [],
- messageSends: ["lf"]
- }),
- $globals.JSStream);
- $core.addMethod(
- $core.method({
- selector: "nextPut:",
- protocol: 'streaming',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self["@stream"])._nextPut_(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
- },
- args: ["aString"],
- source: "nextPut: aString\x0a\x09stream nextPut: aString",
- referencedClasses: [],
- messageSends: ["nextPut:"]
- }),
- $globals.JSStream);
- $core.addMethod(
- $core.method({
- selector: "nextPutAll:",
- protocol: 'streaming',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self["@stream"])._nextPutAll_(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
- },
- args: ["aString"],
- source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
- referencedClasses: [],
- messageSends: ["nextPutAll:"]
- }),
- $globals.JSStream);
- $core.addMethod(
- $core.method({
- selector: "nextPutAssignment",
- protocol: 'streaming',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self["@stream"])._nextPutAll_("=");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPutAssignment",{},$globals.JSStream)});
- },
- args: [],
- source: "nextPutAssignment\x0a\x09stream nextPutAll: '='",
- referencedClasses: [],
- messageSends: ["nextPutAll:"]
- }),
- $globals.JSStream);
- $core.addMethod(
- $core.method({
- selector: "nextPutBlockContextFor:during:",
- protocol: 'streaming',
- fn: function (anIRClosure,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- 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;
- $1=$recv(anIRClosure)._requiresSmalltalkContext();
- if(!$core.assert($1)){
- $2=$recv(aBlock)._value();
- $ctx1.sendIdx["value"]=1;
- return $2;
- };
- self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
- $ctx1.sendIdx["nextPutAll:"]=1;
- self._lf();
- $ctx1.sendIdx["lf"]=1;
- $6=$recv(anIRClosure)._scope();
- $ctx1.sendIdx["scope"]=1;
- $5=$recv($6)._alias();
- $ctx1.sendIdx["alias"]=1;
- $4="return $core.withContext(function(".__comma($5);
- $ctx1.sendIdx[","]=2;
- $3=$recv($4).__comma(") {");
- $ctx1.sendIdx[","]=1;
- self._nextPutAll_($3);
- $ctx1.sendIdx["nextPutAll:"]=2;
- self._lf();
- $ctx1.sendIdx["lf"]=2;
- self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
- $ctx1.sendIdx["nextPutAll:"]=3;
- $7=self._lf();
- $ctx1.sendIdx["lf"]=3;
- $recv(aBlock)._value();
- self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
- $ctx1.sendIdx["nextPutAll:"]=4;
- self._lf();
- $ctx1.sendIdx["lf"]=4;
- $11=$recv(anIRClosure)._scope();
- $ctx1.sendIdx["scope"]=2;
- $10=$recv($11)._alias();
- $ctx1.sendIdx["alias"]=2;
- $9="}, function(".__comma($10);
- $ctx1.sendIdx[","]=4;
- $8=$recv($9).__comma(") {");
- $ctx1.sendIdx[","]=3;
- self._nextPutAll_($8);
- $ctx1.sendIdx["nextPutAll:"]=5;
- $15=$recv(anIRClosure)._scope();
- $ctx1.sendIdx["scope"]=3;
- $14=$recv($15)._alias();
- $ctx1.sendIdx["alias"]=3;
- $13=$recv($14).__comma(".fillBlock({");
- $ctx1.sendIdx[","]=5;
- $12=self._nextPutAll_($13);
- $ctx1.sendIdx["nextPutAll:"]=6;
- $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
- return $core.withContext(function($ctx2) {
- $16=$recv(each)._asVariableName();
- $ctx2.sendIdx["asVariableName"]=1;
- self._nextPutAll_($16);
- $ctx2.sendIdx["nextPutAll:"]=7;
- self._nextPutAll_(":");
- $ctx2.sendIdx["nextPutAll:"]=8;
- $17=self._nextPutAll_($recv(each)._asVariableName());
- $ctx2.sendIdx["nextPutAll:"]=9;
- return $17;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- return self._nextPutAll_(",");
- $ctx2.sendIdx["nextPutAll:"]=10;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }));
- self._nextPutAll_("},");
- $ctx1.sendIdx["nextPutAll:"]=11;
- $23=$recv(anIRClosure)._scope();
- $ctx1.sendIdx["scope"]=4;
- $22=$recv($23)._outerScope();
- $21=$recv($22)._alias();
- $20=$recv($21).__comma(",");
- $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
- $ctx1.sendIdx[","]=7;
- $18=$recv($19).__comma(")});");
- $ctx1.sendIdx[","]=6;
- self._nextPutAll_($18);
- $ctx1.sendIdx["nextPutAll:"]=12;
- self._lf();
- $24=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
- },
- args: ["anIRClosure", "aBlock"],
- 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);'",
- referencedClasses: [],
- messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
- }),
- $globals.JSStream);
- $core.addMethod(
- $core.method({
- selector: "nextPutClassRefFunction:",
- protocol: 'streaming',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=self["@stream"];
- $recv($1)._nextPutAll_("function $");
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv($1)._nextPutAll_(aString);
- $ctx1.sendIdx["nextPutAll:"]=2;
- $recv($1)._nextPutAll_("(){return $globals.");
- $ctx1.sendIdx["nextPutAll:"]=3;
- $recv($1)._nextPutAll_(aString);
- $ctx1.sendIdx["nextPutAll:"]=4;
- $recv($1)._nextPutAll_("||(typeof ");
- $ctx1.sendIdx["nextPutAll:"]=5;
- $recv($1)._nextPutAll_(aString);
- $ctx1.sendIdx["nextPutAll:"]=6;
- $recv($1)._nextPutAll_("==\x22undefined\x22?nil:");
- $ctx1.sendIdx["nextPutAll:"]=7;
- $recv($1)._nextPutAll_(aString);
- $ctx1.sendIdx["nextPutAll:"]=8;
- $recv($1)._nextPutAll_(")}");
- $2=$recv($1)._lf();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPutClassRefFunction:",{aString:aString},$globals.JSStream)});
- },
- args: ["aString"],
- 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",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "lf"]
- }),
- $globals.JSStream);
- $core.addMethod(
- $core.method({
- selector: "nextPutClosureWith:arguments:",
- protocol: 'streaming',
- fn: function (aBlock,anArray){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- $recv(self["@stream"])._nextPutAll_("(function(");
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv(anArray)._do_separatedBy_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
- $ctx2.sendIdx["nextPutAll:"]=2;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- return $recv(self["@stream"])._nextPut_(",");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- $1=self["@stream"];
- $recv($1)._nextPutAll_("){");
- $ctx1.sendIdx["nextPutAll:"]=3;
- $2=$recv($1)._lf();
- $ctx1.sendIdx["lf"]=1;
- $recv(aBlock)._value();
- $3=self["@stream"];
- $recv($3)._lf();
- $4=$recv($3)._nextPutAll_("})");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
- },
- args: ["aBlock", "anArray"],
- 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: '})'",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
- }),
- $globals.JSStream);
- $core.addMethod(
- $core.method({
- selector: "nextPutContextFor:during:",
- protocol: 'streaming',
- fn: function (aMethod,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18,$19;
- $1=$recv(aMethod)._requiresSmalltalkContext();
- if(!$core.assert($1)){
- $2=$recv(aBlock)._value();
- $ctx1.sendIdx["value"]=1;
- return $2;
- };
- self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
- $ctx1.sendIdx["nextPutAll:"]=1;
- self._lf();
- $ctx1.sendIdx["lf"]=1;
- $6=$recv(aMethod)._scope();
- $ctx1.sendIdx["scope"]=1;
- $5=$recv($6)._alias();
- $ctx1.sendIdx["alias"]=1;
- $4="return $core.withContext(function(".__comma($5);
- $ctx1.sendIdx[","]=2;
- $3=$recv($4).__comma(") {");
- $ctx1.sendIdx[","]=1;
- self._nextPutAll_($3);
- $ctx1.sendIdx["nextPutAll:"]=2;
- self._lf();
- $ctx1.sendIdx["lf"]=2;
- self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
- $ctx1.sendIdx["nextPutAll:"]=3;
- $7=self._lf();
- $ctx1.sendIdx["lf"]=3;
- $recv(aBlock)._value();
- self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
- $ctx1.sendIdx["nextPutAll:"]=4;
- self._lf();
- $ctx1.sendIdx["lf"]=4;
- $12=$recv(aMethod)._scope();
- $ctx1.sendIdx["scope"]=2;
- $11=$recv($12)._alias();
- $ctx1.sendIdx["alias"]=2;
- $10="}, function(".__comma($11);
- $ctx1.sendIdx[","]=5;
- $9=$recv($10).__comma(") {");
- $ctx1.sendIdx[","]=4;
- $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
- $ctx1.sendIdx[","]=3;
- self._nextPutAll_($8);
- $ctx1.sendIdx["nextPutAll:"]=5;
- $16=$recv($recv(aMethod)._selector())._asJavascript();
- $ctx1.sendIdx["asJavascript"]=1;
- $15=".fill(self,".__comma($16);
- $14=$recv($15).__comma(",{");
- $ctx1.sendIdx[","]=6;
- $13=self._nextPutAll_($14);
- $ctx1.sendIdx["nextPutAll:"]=6;
- $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
- return $core.withContext(function($ctx2) {
- $17=$recv(each)._asVariableName();
- $ctx2.sendIdx["asVariableName"]=1;
- self._nextPutAll_($17);
- $ctx2.sendIdx["nextPutAll:"]=7;
- self._nextPutAll_(":");
- $ctx2.sendIdx["nextPutAll:"]=8;
- $18=self._nextPutAll_($recv(each)._asVariableName());
- $ctx2.sendIdx["nextPutAll:"]=9;
- return $18;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- return self._nextPutAll_(",");
- $ctx2.sendIdx["nextPutAll:"]=10;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }));
- self._nextPutAll_("},");
- $ctx1.sendIdx["nextPutAll:"]=11;
- self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavascript());
- $ctx1.sendIdx["nextPutAll:"]=12;
- self._nextPutAll_(")});");
- $ctx1.sendIdx["nextPutAll:"]=13;
- self._lf();
- $19=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
- },
- args: ["aMethod", "aBlock"],
- 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);'",
- referencedClasses: [],
- messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavascript", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
- }),
- $globals.JSStream);
- $core.addMethod(
- $core.method({
- selector: "nextPutFunctionWith:arguments:",
- protocol: 'streaming',
- fn: function (aBlock,anArray){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5,$6;
- $recv(self["@stream"])._nextPutAll_("fn: function(");
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv(anArray)._do_separatedBy_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
- $ctx2.sendIdx["nextPutAll:"]=2;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- return $recv(self["@stream"])._nextPut_(",");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- $1=self["@stream"];
- $recv($1)._nextPutAll_("){");
- $ctx1.sendIdx["nextPutAll:"]=3;
- $2=$recv($1)._lf();
- $ctx1.sendIdx["lf"]=1;
- $3=self["@stream"];
- $recv($3)._nextPutAll_("var self=this;");
- $ctx1.sendIdx["nextPutAll:"]=4;
- $4=$recv($3)._lf();
- $ctx1.sendIdx["lf"]=2;
- $recv(aBlock)._value();
- $5=self["@stream"];
- $recv($5)._lf();
- $6=$recv($5)._nextPutAll_("}");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
- },
- args: ["aBlock", "anArray"],
- 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: '}'",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
- }),
- $globals.JSStream);
- $core.addMethod(
- $core.method({
- selector: "nextPutIf:with:",
- protocol: 'streaming',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $recv(self["@stream"])._nextPutAll_("if(");
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv(aBlock)._value();
- $ctx1.sendIdx["value"]=1;
- $1=self["@stream"];
- $recv($1)._nextPutAll_("){");
- $ctx1.sendIdx["nextPutAll:"]=2;
- $2=$recv($1)._lf();
- $recv(anotherBlock)._value();
- $recv(self["@stream"])._nextPutAll_("}");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPutIf:with:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
- },
- args: ["aBlock", "anotherBlock"],
- source: "nextPutIf: aBlock with: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "value", "lf"]
- }),
- $globals.JSStream);
- $core.addMethod(
- $core.method({
- selector: "nextPutIfElse:with:with:",
- protocol: 'streaming',
- fn: function (aBlock,ifBlock,elseBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- $recv(self["@stream"])._nextPutAll_("if(");
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv(aBlock)._value();
- $ctx1.sendIdx["value"]=1;
- $1=self["@stream"];
- $recv($1)._nextPutAll_("){");
- $ctx1.sendIdx["nextPutAll:"]=2;
- $2=$recv($1)._lf();
- $ctx1.sendIdx["lf"]=1;
- $recv(ifBlock)._value();
- $ctx1.sendIdx["value"]=2;
- $3=self["@stream"];
- $recv($3)._nextPutAll_("} else {");
- $ctx1.sendIdx["nextPutAll:"]=3;
- $4=$recv($3)._lf();
- $recv(elseBlock)._value();
- $recv(self["@stream"])._nextPutAll_("}");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPutIfElse:with:with:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
- },
- args: ["aBlock", "ifBlock", "elseBlock"],
- 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: '}'",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "value", "lf"]
- }),
- $globals.JSStream);
- $core.addMethod(
- $core.method({
- selector: "nextPutMethodDeclaration:with:",
- protocol: 'streaming',
- fn: function (aMethod,aBlock){
- var self=this;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $core.withContext(function($ctx1) {
- 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;
- $1=self["@stream"];
- $recv($1)._nextPutAll_("$core.method({");
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv($1)._lf();
- $ctx1.sendIdx["lf"]=1;
- $2=$1;
- $5=$recv($recv(aMethod)._selector())._asJavascript();
- $ctx1.sendIdx["asJavascript"]=1;
- $4="selector: ".__comma($5);
- $ctx1.sendIdx[","]=2;
- $3=$recv($4).__comma(",");
- $ctx1.sendIdx[","]=1;
- $recv($2)._nextPutAll_($3);
- $ctx1.sendIdx["nextPutAll:"]=2;
- $recv($1)._lf();
- $ctx1.sendIdx["lf"]=2;
- $6=$1;
- $9=$recv($recv(aMethod)._source())._asJavascript();
- $ctx1.sendIdx["asJavascript"]=2;
- $8="source: ".__comma($9);
- $ctx1.sendIdx[","]=4;
- $7=$recv($8).__comma(",");
- $ctx1.sendIdx[","]=3;
- $recv($6)._nextPutAll_($7);
- $ctx1.sendIdx["nextPutAll:"]=3;
- $10=$recv($1)._lf();
- $ctx1.sendIdx["lf"]=3;
- $recv(aBlock)._value();
- $ctx1.sendIdx["value"]=1;
- $11=self["@stream"];
- $12=$11;
- $15=$recv($String())._lf();
- $ctx1.sendIdx["lf"]=4;
- $14=",".__comma($15);
- $ctx1.sendIdx[","]=6;
- $13=$recv($14).__comma("messageSends: ");
- $ctx1.sendIdx[","]=5;
- $recv($12)._nextPutAll_($13);
- $ctx1.sendIdx["nextPutAll:"]=4;
- $16=$11;
- $19=$recv($recv(aMethod)._messageSends())._asArray();
- $ctx1.sendIdx["asArray"]=1;
- $18=$recv($19)._asJavascript();
- $ctx1.sendIdx["asJavascript"]=3;
- $17=$recv($18).__comma(",");
- $ctx1.sendIdx[","]=7;
- $recv($16)._nextPutAll_($17);
- $ctx1.sendIdx["nextPutAll:"]=5;
- $recv($11)._lf();
- $ctx1.sendIdx["lf"]=5;
- $20=$11;
- $23=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._value();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- })))._asArray())._asJavascript();
- $ctx1.sendIdx["asJavascript"]=4;
- $22="args: ".__comma($23);
- $21=$recv($22).__comma(",");
- $ctx1.sendIdx[","]=8;
- $recv($20)._nextPutAll_($21);
- $ctx1.sendIdx["nextPutAll:"]=6;
- $recv($11)._lf();
- $24=$recv($11)._nextPutAll_("referencedClasses: [");
- $ctx1.sendIdx["nextPutAll:"]=7;
- $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(self["@stream"])._nextPutAll_($recv(each)._asJavascript());
- $ctx2.sendIdx["nextPutAll:"]=8;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- return $recv(self["@stream"])._nextPutAll_(",");
- $ctx2.sendIdx["nextPutAll:"]=9;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }));
- $25=self["@stream"];
- $recv($25)._nextPutAll_("]");
- $ctx1.sendIdx["nextPutAll:"]=10;
- $26=$recv($25)._nextPutAll_("})");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
- },
- args: ["aMethod", "aBlock"],
- 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: '})'",
- referencedClasses: ["String"],
- messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
- }),
- $globals.JSStream);
- $core.addMethod(
- $core.method({
- selector: "nextPutNonLocalReturnHandlingWith:",
- protocol: 'streaming',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- $1=self["@stream"];
- $recv($1)._nextPutAll_("var $early={};");
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv($1)._lf();
- $ctx1.sendIdx["lf"]=1;
- $recv($1)._nextPutAll_("try {");
- $ctx1.sendIdx["nextPutAll:"]=2;
- $2=$recv($1)._lf();
- $ctx1.sendIdx["lf"]=2;
- $recv(aBlock)._value();
- $3=self["@stream"];
- $recv($3)._nextPutAll_("}");
- $ctx1.sendIdx["nextPutAll:"]=3;
- $recv($3)._lf();
- $ctx1.sendIdx["lf"]=3;
- $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
- $4=$recv($3)._lf();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
- },
- args: ["aBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "lf", "value"]
- }),
- $globals.JSStream);
- $core.addMethod(
- $core.method({
- selector: "nextPutNonLocalReturnWith:",
- protocol: 'streaming',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self["@stream"])._nextPutAll_("throw $early=[");
- $ctx1.sendIdx["nextPutAll:"]=1;
- $recv(aBlock)._value();
- $recv(self["@stream"])._nextPutAll_("]");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
- },
- args: ["aBlock"],
- source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "value"]
- }),
- $globals.JSStream);
- $core.addMethod(
- $core.method({
- selector: "nextPutReturn",
- protocol: 'streaming',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self["@stream"])._nextPutAll_("return ");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPutReturn",{},$globals.JSStream)});
- },
- args: [],
- source: "nextPutReturn\x0a\x09stream nextPutAll: 'return '",
- referencedClasses: [],
- messageSends: ["nextPutAll:"]
- }),
- $globals.JSStream);
- $core.addMethod(
- $core.method({
- selector: "nextPutReturnWith:",
- protocol: 'streaming',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._nextPutReturn();
- $recv(aBlock)._value();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
- },
- args: ["aBlock"],
- source: "nextPutReturnWith: aBlock\x0a\x09self nextPutReturn.\x0a\x09aBlock value",
- referencedClasses: [],
- messageSends: ["nextPutReturn", "value"]
- }),
- $globals.JSStream);
- $core.addMethod(
- $core.method({
- selector: "nextPutSendIndexFor:",
- protocol: 'streaming',
- fn: function (anIRSend){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- self._nextPutAll_(";");
- $ctx1.sendIdx["nextPutAll:"]=1;
- self._lf();
- $ctx1.sendIdx["lf"]=1;
- self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
- $ctx1.sendIdx["nextPutAll:"]=2;
- self._lf();
- $ctx1.sendIdx["lf"]=2;
- self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
- $ctx1.sendIdx["nextPutAll:"]=3;
- self._nextPutAll_(".sendIdx[");
- $ctx1.sendIdx["nextPutAll:"]=4;
- self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavascript());
- $ctx1.sendIdx["nextPutAll:"]=5;
- self._nextPutAll_("]=");
- $ctx1.sendIdx["nextPutAll:"]=6;
- self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
- $ctx1.sendIdx["nextPutAll:"]=7;
- self._nextPutAll_(";");
- $ctx1.sendIdx["nextPutAll:"]=8;
- self._lf();
- $1=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
- },
- args: ["anIRSend"],
- 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)'",
- referencedClasses: [],
- messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavascript", "selector", "asString", "index"]
- }),
- $globals.JSStream);
- $core.addMethod(
- $core.method({
- selector: "nextPutSequenceWith:",
- protocol: 'streaming',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aBlock)._value();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPutSequenceWith:",{aBlock:aBlock},$globals.JSStream)});
- },
- args: ["aBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["value"]
- }),
- $globals.JSStream);
- $core.addMethod(
- $core.method({
- selector: "nextPutStatementWith:",
- protocol: 'streaming',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $recv(aBlock)._value();
- $1=self["@stream"];
- $recv($1)._nextPutAll_(";");
- $2=$recv($1)._lf();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
- },
- args: ["aBlock"],
- source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
- referencedClasses: [],
- messageSends: ["value", "nextPutAll:", "lf"]
- }),
- $globals.JSStream);
- $core.addMethod(
- $core.method({
- selector: "nextPutVars:",
- protocol: 'streaming',
- fn: function (aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $recv(aCollection)._ifNotEmpty_((function(){
- return $core.withContext(function($ctx2) {
- $recv(self["@stream"])._nextPutAll_("var ");
- $ctx2.sendIdx["nextPutAll:"]=1;
- $recv(aCollection)._do_separatedBy_((function(each){
- return $core.withContext(function($ctx3) {
- return $recv(self["@stream"])._nextPutAll_(each);
- $ctx3.sendIdx["nextPutAll:"]=2;
- }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
- }),(function(){
- return $core.withContext(function($ctx3) {
- return $recv(self["@stream"])._nextPutAll_(",");
- $ctx3.sendIdx["nextPutAll:"]=3;
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
- }));
- $1=self["@stream"];
- $recv($1)._nextPutAll_(";");
- $2=$recv($1)._lf();
- return $2;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
- },
- args: ["aCollection"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
- }),
- $globals.JSStream);
- $core.addMethod(
- $core.method({
- selector: "appendToInstruction:",
- protocol: '*Compiler-IR',
- fn: function (anIRInstruction){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(anIRInstruction)._appendBlock_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
- },
- args: ["anIRInstruction"],
- source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
- referencedClasses: [],
- messageSends: ["appendBlock:"]
- }),
- $globals.BlockClosure);
- });
- 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";
- var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
- $core.addPackage('Compiler-Inlining');
- $core.packages["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
- $core.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
- $core.addClass('IRInlinedAssignment', $globals.IRAssignment, [], 'Compiler-Inlining');
- $globals.IRInlinedAssignment.comment="I represent an inlined assignment instruction.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitIRInlinedAssignment_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedAssignment)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
- referencedClasses: [],
- messageSends: ["visitIRInlinedAssignment:"]
- }),
- $globals.IRInlinedAssignment);
- $core.addMethod(
- $core.method({
- selector: "isInlined",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isInlined\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRInlinedAssignment);
- $core.addClass('IRInlinedClosure', $globals.IRClosure, [], 'Compiler-Inlining');
- $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aVisitor)._visitIRInlinedClosure_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
- referencedClasses: [],
- messageSends: ["visitIRInlinedClosure:"]
- }),
- $globals.IRInlinedClosure);
- $core.addMethod(
- $core.method({
- selector: "isInlined",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isInlined\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRInlinedClosure);
- $core.addClass('IRInlinedReturn', $globals.IRReturn, [], 'Compiler-Inlining');
- $globals.IRInlinedReturn.comment="I represent an inlined local return instruction.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aVisitor)._visitIRInlinedReturn_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedReturn)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
- referencedClasses: [],
- messageSends: ["visitIRInlinedReturn:"]
- }),
- $globals.IRInlinedReturn);
- $core.addMethod(
- $core.method({
- selector: "isInlined",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isInlined\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRInlinedReturn);
- $core.addClass('IRInlinedSend', $globals.IRSend, [], 'Compiler-Inlining');
- $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aVisitor)._visitInlinedSend_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
- referencedClasses: [],
- messageSends: ["visitInlinedSend:"]
- }),
- $globals.IRInlinedSend);
- $core.addMethod(
- $core.method({
- selector: "internalVariables",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=[];
- return $1;
- },
- args: [],
- source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRInlinedSend);
- $core.addMethod(
- $core.method({
- selector: "isInlined",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isInlined\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRInlinedSend);
- $core.addClass('IRInlinedIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
- $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aVisitor)._visitIRInlinedIfFalse_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
- referencedClasses: [],
- messageSends: ["visitIRInlinedIfFalse:"]
- }),
- $globals.IRInlinedIfFalse);
- $core.addClass('IRInlinedIfNilIfNotNil', $globals.IRInlinedSend, [], 'Compiler-Inlining');
- $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
- referencedClasses: [],
- messageSends: ["visitIRInlinedIfNilIfNotNil:"]
- }),
- $globals.IRInlinedIfNilIfNotNil);
- $core.addMethod(
- $core.method({
- selector: "internalVariables",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Array())._with_(self._receiverInternalVariable());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
- },
- args: [],
- source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
- referencedClasses: ["Array"],
- messageSends: ["with:", "receiverInternalVariable"]
- }),
- $globals.IRInlinedIfNilIfNotNil);
- $core.addMethod(
- $core.method({
- selector: "receiverInternalVariable",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
- function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($IRVariable())._new();
- $ctx1.sendIdx["new"]=1;
- $recv($2)._variable_($recv($recv($AliasVar())._new())._name_(self._receiverInternalVariableName()));
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
- },
- args: [],
- source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
- referencedClasses: ["IRVariable", "AliasVar"],
- messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
- }),
- $globals.IRInlinedIfNilIfNotNil);
- $core.addMethod(
- $core.method({
- selector: "receiverInternalVariableName",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return "$receiver";
- },
- args: [],
- source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRInlinedIfNilIfNotNil);
- $core.addClass('IRInlinedIfTrue', $globals.IRInlinedSend, [], 'Compiler-Inlining');
- $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aVisitor)._visitIRInlinedIfTrue_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
- referencedClasses: [],
- messageSends: ["visitIRInlinedIfTrue:"]
- }),
- $globals.IRInlinedIfTrue);
- $core.addClass('IRInlinedIfTrueIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
- $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
- referencedClasses: [],
- messageSends: ["visitIRInlinedIfTrueIfFalse:"]
- }),
- $globals.IRInlinedIfTrueIfFalse);
- $core.addClass('IRInlinedSequence', $globals.IRBlockSequence, [], 'Compiler-Inlining');
- $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
- $core.addMethod(
- $core.method({
- selector: "accept:",
- protocol: 'visiting',
- fn: function (aVisitor){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aVisitor)._visitIRInlinedSequence_(self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
- },
- args: ["aVisitor"],
- source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
- referencedClasses: [],
- messageSends: ["visitIRInlinedSequence:"]
- }),
- $globals.IRInlinedSequence);
- $core.addMethod(
- $core.method({
- selector: "isInlined",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isInlined\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRInlinedSequence);
- $core.addClass('IRInliner', $globals.IRVisitor, [], 'Compiler-Inlining');
- $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`";
- $core.addMethod(
- $core.method({
- selector: "assignmentInliner",
- protocol: 'factory',
- fn: function (){
- var self=this;
- function $IRAssignmentInliner(){return $globals.IRAssignmentInliner||(typeof IRAssignmentInliner=="undefined"?nil:IRAssignmentInliner)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($IRAssignmentInliner())._new();
- $recv($2)._translator_(self);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
- },
- args: [],
- source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
- referencedClasses: ["IRAssignmentInliner"],
- messageSends: ["translator:", "new", "yourself"]
- }),
- $globals.IRInliner);
- $core.addMethod(
- $core.method({
- selector: "returnInliner",
- protocol: 'factory',
- fn: function (){
- var self=this;
- function $IRReturnInliner(){return $globals.IRReturnInliner||(typeof IRReturnInliner=="undefined"?nil:IRReturnInliner)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($IRReturnInliner())._new();
- $recv($2)._translator_(self);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
- },
- args: [],
- source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
- referencedClasses: ["IRReturnInliner"],
- messageSends: ["translator:", "new", "yourself"]
- }),
- $globals.IRInliner);
- $core.addMethod(
- $core.method({
- selector: "sendInliner",
- protocol: 'factory',
- fn: function (){
- var self=this;
- function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($IRSendInliner())._new();
- $recv($2)._translator_(self);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
- },
- args: [],
- source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
- referencedClasses: ["IRSendInliner"],
- messageSends: ["translator:", "new", "yourself"]
- }),
- $globals.IRInliner);
- $core.addMethod(
- $core.method({
- selector: "shouldInlineAssignment:",
- protocol: 'testing',
- fn: function (anIRAssignment){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $4,$3,$2,$1;
- $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
- return $core.withContext(function($ctx2) {
- $4=$recv(anIRAssignment)._instructions();
- $ctx2.sendIdx["instructions"]=1;
- $3=$recv($4)._last();
- $ctx2.sendIdx["last"]=1;
- $2=$recv($3)._isSend();
- return $recv($2)._and_((function(){
- return $core.withContext(function($ctx3) {
- return self._shouldInlineSend_($recv($recv(anIRAssignment)._instructions())._last());
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $ctx1.sendIdx["and:"]=1;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
- },
- args: ["anIRAssignment"],
- source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment instructions last isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRAssignment instructions last) ]]",
- referencedClasses: [],
- messageSends: ["and:", "not", "isInlined", "isSend", "last", "instructions", "shouldInlineSend:"]
- }),
- $globals.IRInliner);
- $core.addMethod(
- $core.method({
- selector: "shouldInlineReturn:",
- protocol: 'testing',
- fn: function (anIRReturn){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $4,$3,$2,$1;
- $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
- return $core.withContext(function($ctx2) {
- $4=$recv(anIRReturn)._instructions();
- $ctx2.sendIdx["instructions"]=1;
- $3=$recv($4)._first();
- $ctx2.sendIdx["first"]=1;
- $2=$recv($3)._isSend();
- return $recv($2)._and_((function(){
- return $core.withContext(function($ctx3) {
- return self._shouldInlineSend_($recv($recv(anIRReturn)._instructions())._first());
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $ctx1.sendIdx["and:"]=1;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
- },
- args: ["anIRReturn"],
- source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn instructions first isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRReturn instructions first) ]]",
- referencedClasses: [],
- messageSends: ["and:", "not", "isInlined", "isSend", "first", "instructions", "shouldInlineSend:"]
- }),
- $globals.IRInliner);
- $core.addMethod(
- $core.method({
- selector: "shouldInlineSend:",
- protocol: 'testing',
- fn: function (anIRSend){
- var self=this;
- function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
- return $core.withContext(function($ctx2) {
- return $recv($IRSendInliner())._shouldInline_(anIRSend);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
- },
- args: ["anIRSend"],
- source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
- referencedClasses: ["IRSendInliner"],
- messageSends: ["and:", "not", "isInlined", "shouldInline:"]
- }),
- $globals.IRInliner);
- $core.addMethod(
- $core.method({
- selector: "transformNonLocalReturn:",
- protocol: 'visiting',
- fn: function (anIRNonLocalReturn){
- var self=this;
- var localReturn;
- function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$4,$3,$5,$6,$7,$8,$9;
- $2=$recv(anIRNonLocalReturn)._scope();
- $ctx1.sendIdx["scope"]=1;
- $1=$recv($2)._canInlineNonLocalReturns();
- if($core.assert($1)){
- $4=$recv(anIRNonLocalReturn)._scope();
- $ctx1.sendIdx["scope"]=2;
- $3=$recv($4)._methodScope();
- $5=$recv(anIRNonLocalReturn)._scope();
- $ctx1.sendIdx["scope"]=3;
- $recv($3)._removeNonLocalReturn_($5);
- $6=$recv($IRReturn())._new();
- $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
- $7=$recv($6)._yourself();
- localReturn=$7;
- localReturn;
- $recv($recv(anIRNonLocalReturn)._instructions())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(localReturn)._add_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
- $8=localReturn;
- return $8;
- };
- $9=(
- $ctx1.supercall = true,
- $globals.IRInliner.superclass.fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
- $ctx1.supercall = false;
- return $9;
- }, function($ctx1) {$ctx1.fill(self,"transformNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
- },
- args: ["anIRNonLocalReturn"],
- 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",
- referencedClasses: ["IRReturn"],
- messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "instructions", "add:", "replaceWith:", "visitIRNonLocalReturn:"]
- }),
- $globals.IRInliner);
- $core.addMethod(
- $core.method({
- selector: "visitIRAssignment:",
- protocol: 'visiting',
- fn: function (anIRAssignment){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=self._shouldInlineAssignment_(anIRAssignment);
- if($core.assert($2)){
- $1=$recv(self._assignmentInliner())._inlineAssignment_(anIRAssignment);
- } else {
- $1=(
- $ctx1.supercall = true,
- $globals.IRInliner.superclass.fn.prototype._visitIRAssignment_.apply($recv(self), [anIRAssignment]));
- $ctx1.supercall = false;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
- },
- args: ["anIRAssignment"],
- source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
- }),
- $globals.IRInliner);
- $core.addMethod(
- $core.method({
- selector: "visitIRNonLocalReturn:",
- protocol: 'visiting',
- fn: function (anIRNonLocalReturn){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._transformNonLocalReturn_(anIRNonLocalReturn);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRInliner)});
- },
- args: ["anIRNonLocalReturn"],
- source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self transformNonLocalReturn: anIRNonLocalReturn",
- referencedClasses: [],
- messageSends: ["transformNonLocalReturn:"]
- }),
- $globals.IRInliner);
- $core.addMethod(
- $core.method({
- selector: "visitIRReturn:",
- protocol: 'visiting',
- fn: function (anIRReturn){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=self._shouldInlineReturn_(anIRReturn);
- if($core.assert($2)){
- $1=$recv(self._returnInliner())._inlineReturn_(anIRReturn);
- } else {
- $1=(
- $ctx1.supercall = true,
- $globals.IRInliner.superclass.fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
- $ctx1.supercall = false;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
- },
- args: ["anIRReturn"],
- source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
- }),
- $globals.IRInliner);
- $core.addMethod(
- $core.method({
- selector: "visitIRSend:",
- protocol: 'visiting',
- fn: function (anIRSend){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=self._shouldInlineSend_(anIRSend);
- if($core.assert($2)){
- $1=$recv(self._sendInliner())._inlineSend_(anIRSend);
- } else {
- $1=(
- $ctx1.supercall = true,
- $globals.IRInliner.superclass.fn.prototype._visitIRSend_.apply($recv(self), [anIRSend]));
- $ctx1.supercall = false;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
- },
- args: ["anIRSend"],
- source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
- }),
- $globals.IRInliner);
- $core.addClass('IRInliningJSTranslator', $globals.IRJSTranslator, [], 'Compiler-Inlining');
- $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
- $core.addMethod(
- $core.method({
- selector: "visitIRInlinedAssignment:",
- protocol: 'visiting',
- fn: function (anIRInlinedAssignment){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._visit_($recv($recv(anIRInlinedAssignment)._instructions())._last());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},$globals.IRInliningJSTranslator)});
- },
- args: ["anIRInlinedAssignment"],
- source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last",
- referencedClasses: [],
- messageSends: ["visit:", "last", "instructions"]
- }),
- $globals.IRInliningJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitIRInlinedClosure:",
- protocol: 'visiting',
- fn: function (anIRInlinedClosure){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv($recv(each)._name())._asVariableName();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- })));
- $recv($recv(anIRInlinedClosure)._instructions())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return self._visit_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
- },
- args: ["anIRInlinedClosure"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "instructions", "visit:"]
- }),
- $globals.IRInliningJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitIRInlinedIfFalse:",
- protocol: 'visiting',
- fn: function (anIRInlinedIfFalse){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$4,$3;
- $1=self._stream();
- $ctx1.sendIdx["stream"]=1;
- $recv($1)._nextPutIf_with_((function(){
- return $core.withContext(function($ctx2) {
- $2=self._stream();
- $ctx2.sendIdx["stream"]=2;
- $recv($2)._nextPutAll_("!$core.assert(");
- $ctx2.sendIdx["nextPutAll:"]=1;
- $4=$recv(anIRInlinedIfFalse)._instructions();
- $ctx2.sendIdx["instructions"]=1;
- $3=$recv($4)._first();
- self._visit_($3);
- $ctx2.sendIdx["visit:"]=1;
- return $recv(self._stream())._nextPutAll_(")");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- return self._visit_($recv($recv(anIRInlinedIfFalse)._instructions())._last());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
- },
- args: ["anIRInlinedIfFalse"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
- }),
- $globals.IRInliningJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitIRInlinedIfNilIfNotNil:",
- protocol: 'visiting',
- fn: function (anIRInlinedIfNilIfNotNil){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$5,$4,$7,$6;
- $1=self._stream();
- $ctx1.sendIdx["stream"]=1;
- $recv($1)._nextPutIfElse_with_with_((function(){
- return $core.withContext(function($ctx2) {
- $2=self._stream();
- $ctx2.sendIdx["stream"]=2;
- $3=$recv("(".__comma($recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName())).__comma(" = ");
- $ctx2.sendIdx[","]=1;
- $recv($2)._nextPutAll_($3);
- $ctx2.sendIdx["nextPutAll:"]=1;
- $5=$recv(anIRInlinedIfNilIfNotNil)._instructions();
- $ctx2.sendIdx["instructions"]=1;
- $4=$recv($5)._first();
- self._visit_($4);
- $ctx2.sendIdx["visit:"]=1;
- return $recv(self._stream())._nextPutAll_(") == null || $receiver.isNil");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- $7=$recv(anIRInlinedIfNilIfNotNil)._instructions();
- $ctx2.sendIdx["instructions"]=2;
- $6=$recv($7)._second();
- return self._visit_($6);
- $ctx2.sendIdx["visit:"]=2;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- return self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._instructions())._third());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
- },
- args: ["anIRInlinedIfNilIfNotNil"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", ",", "receiverInternalVariableName", "visit:", "first", "instructions", "second", "third"]
- }),
- $globals.IRInliningJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitIRInlinedIfTrue:",
- protocol: 'visiting',
- fn: function (anIRInlinedIfTrue){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$4,$3;
- $1=self._stream();
- $ctx1.sendIdx["stream"]=1;
- $recv($1)._nextPutIf_with_((function(){
- return $core.withContext(function($ctx2) {
- $2=self._stream();
- $ctx2.sendIdx["stream"]=2;
- $recv($2)._nextPutAll_("$core.assert(");
- $ctx2.sendIdx["nextPutAll:"]=1;
- $4=$recv(anIRInlinedIfTrue)._instructions();
- $ctx2.sendIdx["instructions"]=1;
- $3=$recv($4)._first();
- self._visit_($3);
- $ctx2.sendIdx["visit:"]=1;
- return $recv(self._stream())._nextPutAll_(")");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- return self._visit_($recv($recv(anIRInlinedIfTrue)._instructions())._last());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
- },
- args: ["anIRInlinedIfTrue"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
- }),
- $globals.IRInliningJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitIRInlinedIfTrueIfFalse:",
- protocol: 'visiting',
- fn: function (anIRInlinedIfTrueIfFalse){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$4,$3,$6,$5;
- $1=self._stream();
- $ctx1.sendIdx["stream"]=1;
- $recv($1)._nextPutIfElse_with_with_((function(){
- return $core.withContext(function($ctx2) {
- $2=self._stream();
- $ctx2.sendIdx["stream"]=2;
- $recv($2)._nextPutAll_("$core.assert(");
- $ctx2.sendIdx["nextPutAll:"]=1;
- $4=$recv(anIRInlinedIfTrueIfFalse)._instructions();
- $ctx2.sendIdx["instructions"]=1;
- $3=$recv($4)._first();
- self._visit_($3);
- $ctx2.sendIdx["visit:"]=1;
- return $recv(self._stream())._nextPutAll_(")");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- $6=$recv(anIRInlinedIfTrueIfFalse)._instructions();
- $ctx2.sendIdx["instructions"]=2;
- $5=$recv($6)._second();
- return self._visit_($5);
- $ctx2.sendIdx["visit:"]=2;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- return self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._instructions())._third());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
- },
- args: ["anIRInlinedIfTrueIfFalse"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "second", "third"]
- }),
- $globals.IRInliningJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitIRInlinedNonLocalReturn:",
- protocol: 'visiting',
- fn: function (anIRInlinedReturn){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._stream();
- $ctx1.sendIdx["stream"]=1;
- $recv($1)._nextPutStatementWith_((function(){
- return $core.withContext(function($ctx2) {
- return self._visit_($recv($recv(anIRInlinedReturn)._instructions())._last());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedNonLocalReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)});
- },
- args: ["anIRInlinedReturn"],
- source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]",
- referencedClasses: [],
- messageSends: ["nextPutStatementWith:", "stream", "visit:", "last", "instructions", "nextPutNonLocalReturnWith:"]
- }),
- $globals.IRInliningJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitIRInlinedReturn:",
- protocol: 'visiting',
- fn: function (anIRInlinedReturn){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._visit_($recv($recv(anIRInlinedReturn)._instructions())._last());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)});
- },
- args: ["anIRInlinedReturn"],
- source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last",
- referencedClasses: [],
- messageSends: ["visit:", "last", "instructions"]
- }),
- $globals.IRInliningJSTranslator);
- $core.addMethod(
- $core.method({
- selector: "visitIRInlinedSequence:",
- protocol: 'visiting',
- fn: function (anIRInlinedSequence){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv($recv(anIRInlinedSequence)._instructions())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(self._stream())._nextPutStatementWith_((function(){
- return $core.withContext(function($ctx3) {
- return self._visit_(each);
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRInliningJSTranslator)});
- },
- args: ["anIRInlinedSequence"],
- source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
- referencedClasses: [],
- messageSends: ["do:", "instructions", "nextPutStatementWith:", "stream", "visit:"]
- }),
- $globals.IRInliningJSTranslator);
- $core.addClass('IRSendInliner', $globals.Object, ['send', 'translator'], 'Compiler-Inlining');
- $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
- $core.addMethod(
- $core.method({
- selector: "ifFalse:",
- protocol: 'inlining',
- fn: function (anIRInstruction){
- var self=this;
- function $IRInlinedIfFalse(){return $globals.IRInlinedIfFalse||(typeof IRInlinedIfFalse=="undefined"?nil:IRInlinedIfFalse)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._inlinedSend_with_($recv($IRInlinedIfFalse())._new(),anIRInstruction);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
- },
- args: ["anIRInstruction"],
- source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new with: anIRInstruction",
- referencedClasses: ["IRInlinedIfFalse"],
- messageSends: ["inlinedSend:with:", "new"]
- }),
- $globals.IRSendInliner);
- $core.addMethod(
- $core.method({
- selector: "ifFalse:ifTrue:",
- protocol: 'inlining',
- fn: function (anIRInstruction,anotherIRInstruction){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
- },
- args: ["anIRInstruction", "anotherIRInstruction"],
- source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
- referencedClasses: [],
- messageSends: ["perform:withArguments:"]
- }),
- $globals.IRSendInliner);
- $core.addMethod(
- $core.method({
- selector: "ifNil:",
- protocol: 'inlining',
- fn: function (anIRInstruction){
- var self=this;
- function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
- function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
- function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
- return $core.withContext(function($ctx1) {
- var $2,$4,$5,$7,$8,$6,$9,$3,$1;
- $2=$recv($IRInlinedIfNilIfNotNil())._new();
- $ctx1.sendIdx["new"]=1;
- $4=$recv($IRClosure())._new();
- $ctx1.sendIdx["new"]=2;
- $recv($4)._scope_($recv($recv(anIRInstruction)._scope())._copy());
- $5=$4;
- $7=$recv($IRBlockSequence())._new();
- $recv($7)._add_($recv($recv(self._send())._instructions())._first());
- $8=$recv($7)._yourself();
- $ctx1.sendIdx["yourself"]=1;
- $6=$8;
- $recv($5)._add_($6);
- $ctx1.sendIdx["add:"]=1;
- $9=$recv($4)._yourself();
- $3=$9;
- $1=self._inlinedSend_with_with_($2,anIRInstruction,$3);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
- },
- args: ["anIRInstruction"],
- 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)",
- referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
- messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
- }),
- $globals.IRSendInliner);
- $core.addMethod(
- $core.method({
- selector: "ifNil:ifNotNil:",
- protocol: 'inlining',
- fn: function (anIRInstruction,anotherIRInstruction){
- var self=this;
- function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._inlinedSend_with_with_($recv($IRInlinedIfNilIfNotNil())._new(),anIRInstruction,anotherIRInstruction);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
- },
- args: ["anIRInstruction", "anotherIRInstruction"],
- source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anIRInstruction with: anotherIRInstruction",
- referencedClasses: ["IRInlinedIfNilIfNotNil"],
- messageSends: ["inlinedSend:with:with:", "new"]
- }),
- $globals.IRSendInliner);
- $core.addMethod(
- $core.method({
- selector: "ifNotNil:",
- protocol: 'inlining',
- fn: function (anIRInstruction){
- var self=this;
- function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
- function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
- function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
- return $core.withContext(function($ctx1) {
- var $2,$4,$5,$7,$8,$6,$9,$3,$1;
- $2=$recv($IRInlinedIfNilIfNotNil())._new();
- $ctx1.sendIdx["new"]=1;
- $4=$recv($IRClosure())._new();
- $ctx1.sendIdx["new"]=2;
- $recv($4)._scope_($recv($recv(anIRInstruction)._scope())._copy());
- $5=$4;
- $7=$recv($IRBlockSequence())._new();
- $recv($7)._add_($recv($recv(self._send())._instructions())._first());
- $8=$recv($7)._yourself();
- $ctx1.sendIdx["yourself"]=1;
- $6=$8;
- $recv($5)._add_($6);
- $ctx1.sendIdx["add:"]=1;
- $9=$recv($4)._yourself();
- $3=$9;
- $1=self._inlinedSend_with_with_($2,$3,anIRInstruction);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
- },
- args: ["anIRInstruction"],
- 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",
- referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
- messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
- }),
- $globals.IRSendInliner);
- $core.addMethod(
- $core.method({
- selector: "ifNotNil:ifNil:",
- protocol: 'inlining',
- fn: function (anIRInstruction,anotherIRInstruction){
- var self=this;
- function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._inlinedSend_with_with_($recv($IRInlinedIfNilIfNotNil())._new(),anotherIRInstruction,anIRInstruction);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
- },
- args: ["anIRInstruction", "anotherIRInstruction"],
- source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anotherIRInstruction with: anIRInstruction",
- referencedClasses: ["IRInlinedIfNilIfNotNil"],
- messageSends: ["inlinedSend:with:with:", "new"]
- }),
- $globals.IRSendInliner);
- $core.addMethod(
- $core.method({
- selector: "ifTrue:",
- protocol: 'inlining',
- fn: function (anIRInstruction){
- var self=this;
- function $IRInlinedIfTrue(){return $globals.IRInlinedIfTrue||(typeof IRInlinedIfTrue=="undefined"?nil:IRInlinedIfTrue)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._inlinedSend_with_($recv($IRInlinedIfTrue())._new(),anIRInstruction);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
- },
- args: ["anIRInstruction"],
- source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new with: anIRInstruction",
- referencedClasses: ["IRInlinedIfTrue"],
- messageSends: ["inlinedSend:with:", "new"]
- }),
- $globals.IRSendInliner);
- $core.addMethod(
- $core.method({
- selector: "ifTrue:ifFalse:",
- protocol: 'inlining',
- fn: function (anIRInstruction,anotherIRInstruction){
- var self=this;
- function $IRInlinedIfTrueIfFalse(){return $globals.IRInlinedIfTrueIfFalse||(typeof IRInlinedIfTrueIfFalse=="undefined"?nil:IRInlinedIfTrueIfFalse)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._inlinedSend_with_with_($recv($IRInlinedIfTrueIfFalse())._new(),anIRInstruction,anotherIRInstruction);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
- },
- args: ["anIRInstruction", "anotherIRInstruction"],
- source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new with: anIRInstruction with: anotherIRInstruction",
- referencedClasses: ["IRInlinedIfTrueIfFalse"],
- messageSends: ["inlinedSend:with:with:", "new"]
- }),
- $globals.IRSendInliner);
- $core.addMethod(
- $core.method({
- selector: "inlineClosure:",
- protocol: 'inlining',
- fn: function (anIRClosure){
- var self=this;
- var inlinedClosure,sequence,statements;
- function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
- function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
- function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
- function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
- return $core.withContext(function($ctx1) {
- 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;
- inlinedClosure=self._inlinedClosure();
- $1=inlinedClosure;
- $2=$1;
- $3=$recv(anIRClosure)._scope();
- $ctx1.sendIdx["scope"]=1;
- $recv($2)._scope_($3);
- $ctx1.sendIdx["scope:"]=1;
- $4=$recv($1)._parent_($recv(anIRClosure)._parent());
- $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(inlinedClosure)._add_(each);
- $ctx2.sendIdx["add:"]=1;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $ctx1.sendIdx["do:"]=1;
- sequence=self._inlinedSequence();
- $recv($recv(anIRClosure)._arguments())._do_((function(each){
- return $core.withContext(function($ctx2) {
- $5=inlinedClosure;
- $7=$recv($IRTempDeclaration())._new();
- $ctx2.sendIdx["new"]=1;
- $recv($7)._name_(each);
- $ctx2.sendIdx["name:"]=1;
- $8=$recv($7)._yourself();
- $ctx2.sendIdx["yourself"]=1;
- $6=$8;
- $recv($5)._add_($6);
- $ctx2.sendIdx["add:"]=2;
- $9=sequence;
- $11=$recv($IRAssignment())._new();
- $ctx2.sendIdx["new"]=2;
- $12=$11;
- $14=$recv($IRVariable())._new();
- $ctx2.sendIdx["new"]=3;
- $16=$recv($AliasVar())._new();
- $ctx2.sendIdx["new"]=4;
- $17=$16;
- $18=$recv(inlinedClosure)._scope();
- $ctx2.sendIdx["scope"]=2;
- $recv($17)._scope_($18);
- $ctx2.sendIdx["scope:"]=2;
- $recv($16)._name_(each);
- $ctx2.sendIdx["name:"]=2;
- $19=$recv($16)._yourself();
- $ctx2.sendIdx["yourself"]=2;
- $15=$19;
- $13=$recv($14)._variable_($15);
- $ctx2.sendIdx["variable:"]=1;
- $recv($12)._add_($13);
- $ctx2.sendIdx["add:"]=4;
- $20=$11;
- $22=$recv($IRVariable())._new();
- $ctx2.sendIdx["new"]=5;
- $24=$recv($AliasVar())._new();
- $recv($24)._scope_($recv(inlinedClosure)._scope());
- $recv($24)._name_("$receiver");
- $25=$recv($24)._yourself();
- $ctx2.sendIdx["yourself"]=3;
- $23=$25;
- $21=$recv($22)._variable_($23);
- $recv($20)._add_($21);
- $ctx2.sendIdx["add:"]=5;
- $26=$recv($11)._yourself();
- $10=$26;
- return $recv($9)._add_($10);
- $ctx2.sendIdx["add:"]=3;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- $ctx1.sendIdx["do:"]=2;
- $recv(inlinedClosure)._add_(sequence);
- $ctx1.sendIdx["add:"]=6;
- $28=$recv(anIRClosure)._instructions();
- $ctx1.sendIdx["instructions"]=2;
- $27=$recv($28)._last();
- $ctx1.sendIdx["last"]=1;
- statements=$recv($27)._instructions();
- $ctx1.sendIdx["instructions"]=1;
- $recv(statements)._ifNotEmpty_((function(){
- return $core.withContext(function($ctx2) {
- $recv($recv(statements)._allButLast())._do_((function(each){
- return $core.withContext(function($ctx3) {
- return $recv(sequence)._add_(each);
- $ctx3.sendIdx["add:"]=7;
- }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
- }));
- $31=$recv(statements)._last();
- $ctx2.sendIdx["last"]=2;
- $30=$recv($31)._isReturn();
- $29=$recv($30)._and_((function(){
- return $core.withContext(function($ctx3) {
- $32=$recv(statements)._last();
- $ctx3.sendIdx["last"]=3;
- return $recv($32)._isBlockReturn();
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
- }));
- if($core.assert($29)){
- $33=sequence;
- $36=$recv(statements)._last();
- $ctx2.sendIdx["last"]=4;
- $35=$recv($36)._instructions();
- $34=$recv($35)._first();
- return $recv($33)._add_($34);
- $ctx2.sendIdx["add:"]=8;
- } else {
- return $recv(sequence)._add_($recv(statements)._last());
- };
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }));
- $37=inlinedClosure;
- return $37;
- }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
- },
- args: ["anIRClosure"],
- 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",
- referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
- 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"]
- }),
- $globals.IRSendInliner);
- $core.addMethod(
- $core.method({
- selector: "inlineSend:",
- protocol: 'inlining',
- fn: function (anIRSend){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $3,$2,$1;
- self._send_(anIRSend);
- $3=self._send();
- $ctx1.sendIdx["send"]=1;
- $2=$recv($3)._selector();
- $1=self._perform_withArguments_($2,$recv($recv(self._send())._instructions())._allButFirst());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
- },
- args: ["anIRSend"],
- source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send instructions allButFirst",
- referencedClasses: [],
- messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"]
- }),
- $globals.IRSendInliner);
- $core.addMethod(
- $core.method({
- selector: "inlinedClosure",
- protocol: 'factory',
- fn: function (){
- var self=this;
- function $IRInlinedClosure(){return $globals.IRInlinedClosure||(typeof IRInlinedClosure=="undefined"?nil:IRInlinedClosure)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($IRInlinedClosure())._new();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
- },
- args: [],
- source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
- referencedClasses: ["IRInlinedClosure"],
- messageSends: ["new"]
- }),
- $globals.IRSendInliner);
- $core.addMethod(
- $core.method({
- selector: "inlinedSend:with:",
- protocol: 'inlining',
- fn: function (inlinedSend,anIRInstruction){
- var self=this;
- var inlinedClosure;
- return $core.withContext(function($ctx1) {
- var $1,$2,$5,$4,$3,$6,$7;
- $1=$recv(anIRInstruction)._isClosure();
- if(!$core.assert($1)){
- self._inliningError_("Message argument should be a block");
- $ctx1.sendIdx["inliningError:"]=1;
- };
- $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
- if(!$core.assert($2)){
- self._inliningError_("Inlined block should have zero argument");
- };
- inlinedClosure=$recv(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
- $5=self._send();
- $ctx1.sendIdx["send"]=1;
- $4=$recv($5)._instructions();
- $3=$recv($4)._first();
- $recv(inlinedSend)._add_($3);
- $ctx1.sendIdx["add:"]=1;
- $6=$recv(inlinedSend)._add_(inlinedClosure);
- $recv(self._send())._replaceWith_(inlinedSend);
- $7=$recv($recv(inlinedSend)._method())._internalVariables();
- $ctx1.sendIdx["internalVariables"]=1;
- $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
- return inlinedSend;
- }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
- },
- args: ["inlinedSend", "anIRInstruction"],
- 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",
- referencedClasses: [],
- messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
- }),
- $globals.IRSendInliner);
- $core.addMethod(
- $core.method({
- selector: "inlinedSend:with:with:",
- protocol: 'inlining',
- fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
- var self=this;
- var inlinedClosure1,inlinedClosure2;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$7,$6,$5,$8,$9;
- $1=$recv(anIRInstruction)._isClosure();
- $ctx1.sendIdx["isClosure"]=1;
- if(!$core.assert($1)){
- self._inliningError_("Message argument should be a block");
- $ctx1.sendIdx["inliningError:"]=1;
- };
- $2=$recv(anotherIRInstruction)._isClosure();
- if(!$core.assert($2)){
- self._inliningError_("Message argument should be a block");
- };
- $3=self._translator();
- $ctx1.sendIdx["translator"]=1;
- $4=self._inlineClosure_(anIRInstruction);
- $ctx1.sendIdx["inlineClosure:"]=1;
- inlinedClosure1=$recv($3)._visit_($4);
- $ctx1.sendIdx["visit:"]=1;
- inlinedClosure2=$recv(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
- $7=self._send();
- $ctx1.sendIdx["send"]=1;
- $6=$recv($7)._instructions();
- $5=$recv($6)._first();
- $recv(inlinedSend)._add_($5);
- $ctx1.sendIdx["add:"]=1;
- $recv(inlinedSend)._add_(inlinedClosure1);
- $ctx1.sendIdx["add:"]=2;
- $8=$recv(inlinedSend)._add_(inlinedClosure2);
- $recv(self._send())._replaceWith_(inlinedSend);
- $9=$recv($recv(inlinedSend)._method())._internalVariables();
- $ctx1.sendIdx["internalVariables"]=1;
- $recv($9)._addAll_($recv(inlinedSend)._internalVariables());
- return inlinedSend;
- }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
- },
- args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
- 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",
- referencedClasses: [],
- messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
- }),
- $globals.IRSendInliner);
- $core.addMethod(
- $core.method({
- selector: "inlinedSequence",
- protocol: 'factory',
- fn: function (){
- var self=this;
- function $IRInlinedSequence(){return $globals.IRInlinedSequence||(typeof IRInlinedSequence=="undefined"?nil:IRInlinedSequence)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($IRInlinedSequence())._new();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
- },
- args: [],
- source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
- referencedClasses: ["IRInlinedSequence"],
- messageSends: ["new"]
- }),
- $globals.IRSendInliner);
- $core.addMethod(
- $core.method({
- selector: "inliningError:",
- protocol: 'error handling',
- fn: function (aString){
- var self=this;
- function $InliningError(){return $globals.InliningError||(typeof InliningError=="undefined"?nil:InliningError)}
- return $core.withContext(function($ctx1) {
- $recv($InliningError())._signal_(aString);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
- },
- args: ["aString"],
- source: "inliningError: aString\x0a\x09InliningError signal: aString",
- referencedClasses: ["InliningError"],
- messageSends: ["signal:"]
- }),
- $globals.IRSendInliner);
- $core.addMethod(
- $core.method({
- selector: "send",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@send"];
- return $1;
- },
- args: [],
- source: "send\x0a\x09^ send",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRSendInliner);
- $core.addMethod(
- $core.method({
- selector: "send:",
- protocol: 'accessing',
- fn: function (anIRSend){
- var self=this;
- self["@send"]=anIRSend;
- return self;
- },
- args: ["anIRSend"],
- source: "send: anIRSend\x0a\x09send := anIRSend",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRSendInliner);
- $core.addMethod(
- $core.method({
- selector: "translator",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@translator"];
- return $1;
- },
- args: [],
- source: "translator\x0a\x09^ translator",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRSendInliner);
- $core.addMethod(
- $core.method({
- selector: "translator:",
- protocol: 'accessing',
- fn: function (anASTTranslator){
- var self=this;
- self["@translator"]=anASTTranslator;
- return self;
- },
- args: ["anASTTranslator"],
- source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRSendInliner);
- $core.addMethod(
- $core.method({
- selector: "inlinedSelectors",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
- return $1;
- },
- args: [],
- source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRSendInliner.klass);
- $core.addMethod(
- $core.method({
- selector: "shouldInline:",
- protocol: 'accessing',
- fn: function (anIRInstruction){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=$recv(self._inlinedSelectors())._includes_($recv(anIRInstruction)._selector());
- if(!$core.assert($1)){
- return false;
- };
- $2=$recv($recv($recv(anIRInstruction)._instructions())._allButFirst())._allSatisfy_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._isClosure();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner.klass)});
- },
- args: ["anIRInstruction"],
- source: "shouldInline: anIRInstruction\x0a\x09(self inlinedSelectors includes: anIRInstruction selector) ifFalse: [ ^ false ].\x0a\x09^ anIRInstruction instructions allButFirst allSatisfy: [ :each | each isClosure]",
- referencedClasses: [],
- messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "allButFirst", "instructions", "isClosure"]
- }),
- $globals.IRSendInliner.klass);
- $core.addClass('IRAssignmentInliner', $globals.IRSendInliner, ['assignment'], 'Compiler-Inlining');
- $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};";
- $core.addMethod(
- $core.method({
- selector: "assignment",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@assignment"];
- return $1;
- },
- args: [],
- source: "assignment\x0a\x09^ assignment",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRAssignmentInliner);
- $core.addMethod(
- $core.method({
- selector: "assignment:",
- protocol: 'accessing',
- fn: function (aNode){
- var self=this;
- self["@assignment"]=aNode;
- return self;
- },
- args: ["aNode"],
- source: "assignment: aNode\x0a\x09assignment := aNode",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.IRAssignmentInliner);
- $core.addMethod(
- $core.method({
- selector: "inlineAssignment:",
- protocol: 'inlining',
- fn: function (anIRAssignment){
- var self=this;
- var inlinedAssignment;
- function $IRInlinedAssignment(){return $globals.IRInlinedAssignment||(typeof IRInlinedAssignment=="undefined"?nil:IRInlinedAssignment)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- self._assignment_(anIRAssignment);
- inlinedAssignment=$recv($IRInlinedAssignment())._new();
- $1=$recv(anIRAssignment)._instructions();
- $ctx1.sendIdx["instructions"]=1;
- $recv($1)._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(inlinedAssignment)._add_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $recv(anIRAssignment)._replaceWith_(inlinedAssignment);
- self._inlineSend_($recv($recv(inlinedAssignment)._instructions())._last());
- $2=inlinedAssignment;
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},$globals.IRAssignmentInliner)});
- },
- args: ["anIRAssignment"],
- 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",
- referencedClasses: ["IRInlinedAssignment"],
- messageSends: ["assignment:", "new", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
- }),
- $globals.IRAssignmentInliner);
- $core.addMethod(
- $core.method({
- selector: "inlineClosure:",
- protocol: 'inlining',
- fn: function (anIRClosure){
- var self=this;
- var inlinedClosure,statements;
- function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$4,$3,$5,$7,$8,$6,$9;
- inlinedClosure=(
- $ctx1.supercall = true,
- $globals.IRAssignmentInliner.superclass.fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
- $ctx1.supercall = false;
- $2=$recv(inlinedClosure)._instructions();
- $ctx1.sendIdx["instructions"]=2;
- $1=$recv($2)._last();
- $ctx1.sendIdx["last"]=1;
- statements=$recv($1)._instructions();
- $ctx1.sendIdx["instructions"]=1;
- $recv(statements)._ifNotEmpty_((function(){
- return $core.withContext(function($ctx2) {
- $4=$recv(statements)._last();
- $ctx2.sendIdx["last"]=2;
- $3=$recv($4)._canBeAssigned();
- if($core.assert($3)){
- $5=$recv(statements)._last();
- $ctx2.sendIdx["last"]=3;
- $7=$recv($IRAssignment())._new();
- $recv($7)._add_($recv($recv(self._assignment())._instructions())._first());
- $ctx2.sendIdx["add:"]=1;
- $recv($7)._add_($recv($recv(statements)._last())._copy());
- $8=$recv($7)._yourself();
- $6=$8;
- return $recv($5)._replaceWith_($6);
- };
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $9=inlinedClosure;
- return $9;
- }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,statements:statements},$globals.IRAssignmentInliner)});
- },
- args: ["anIRClosure"],
- 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",
- referencedClasses: ["IRAssignment"],
- messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "canBeAssigned", "replaceWith:", "add:", "new", "first", "assignment", "copy", "yourself"]
- }),
- $globals.IRAssignmentInliner);
- $core.addClass('IRReturnInliner', $globals.IRSendInliner, [], 'Compiler-Inlining');
- $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
- $core.addMethod(
- $core.method({
- selector: "inlineClosure:",
- protocol: 'inlining',
- fn: function (anIRClosure){
- var self=this;
- var closure,statements;
- function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
- return $core.withContext(function($ctx1) {
- var $1,$3,$2,$4,$5,$6,$7;
- closure=(
- $ctx1.supercall = true,
- $globals.IRReturnInliner.superclass.fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
- $ctx1.supercall = false;
- $1=$recv($recv(closure)._instructions())._last();
- $ctx1.sendIdx["last"]=1;
- statements=$recv($1)._instructions();
- $ctx1.sendIdx["instructions"]=1;
- $recv(statements)._ifNotEmpty_((function(){
- return $core.withContext(function($ctx2) {
- $3=$recv(statements)._last();
- $ctx2.sendIdx["last"]=2;
- $2=$recv($3)._isReturn();
- if(!$core.assert($2)){
- $4=$recv(statements)._last();
- $ctx2.sendIdx["last"]=3;
- $5=$recv($IRReturn())._new();
- $recv($5)._add_($recv($recv(statements)._last())._copy());
- $6=$recv($5)._yourself();
- return $recv($4)._replaceWith_($6);
- };
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $7=closure;
- return $7;
- }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},$globals.IRReturnInliner)});
- },
- args: ["anIRClosure"],
- 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",
- referencedClasses: ["IRReturn"],
- messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "isReturn", "replaceWith:", "add:", "new", "copy", "yourself"]
- }),
- $globals.IRReturnInliner);
- $core.addMethod(
- $core.method({
- selector: "inlineReturn:",
- protocol: 'inlining',
- fn: function (anIRReturn){
- var self=this;
- var return_;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- return_=self._inlinedReturn();
- $1=$recv(anIRReturn)._instructions();
- $ctx1.sendIdx["instructions"]=1;
- $recv($1)._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(return_)._add_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $recv(anIRReturn)._replaceWith_(return_);
- self._inlineSend_($recv($recv(return_)._instructions())._last());
- $2=return_;
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_},$globals.IRReturnInliner)});
- },
- args: ["anIRReturn"],
- 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",
- referencedClasses: [],
- messageSends: ["inlinedReturn", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
- }),
- $globals.IRReturnInliner);
- $core.addMethod(
- $core.method({
- selector: "inlinedReturn",
- protocol: 'factory',
- fn: function (){
- var self=this;
- function $IRInlinedReturn(){return $globals.IRInlinedReturn||(typeof IRInlinedReturn=="undefined"?nil:IRInlinedReturn)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($IRInlinedReturn())._new();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{},$globals.IRReturnInliner)});
- },
- args: [],
- source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
- referencedClasses: ["IRInlinedReturn"],
- messageSends: ["new"]
- }),
- $globals.IRReturnInliner);
- $core.addClass('InliningCodeGenerator', $globals.CodeGenerator, [], 'Compiler-Inlining');
- $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
- $core.addMethod(
- $core.method({
- selector: "compileNode:",
- protocol: 'compiling',
- fn: function (aNode){
- var self=this;
- var ir,stream;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $recv(self._semanticAnalyzer())._visit_(aNode);
- $ctx1.sendIdx["visit:"]=1;
- ir=$recv(self._translator())._visit_(aNode);
- $ctx1.sendIdx["visit:"]=2;
- $recv(self._inliner())._visit_(ir);
- $ctx1.sendIdx["visit:"]=3;
- $2=self._irTranslator();
- $recv($2)._currentClass_(self._currentClass());
- $recv($2)._visit_(ir);
- $3=$recv($2)._contents();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.InliningCodeGenerator)});
- },
- args: ["aNode"],
- 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",
- referencedClasses: [],
- messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "currentClass:", "irTranslator", "currentClass", "contents"]
- }),
- $globals.InliningCodeGenerator);
- $core.addMethod(
- $core.method({
- selector: "inliner",
- protocol: 'compiling',
- fn: function (){
- var self=this;
- function $IRInliner(){return $globals.IRInliner||(typeof IRInliner=="undefined"?nil:IRInliner)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($IRInliner())._new();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
- },
- args: [],
- source: "inliner\x0a\x09^ IRInliner new",
- referencedClasses: ["IRInliner"],
- messageSends: ["new"]
- }),
- $globals.InliningCodeGenerator);
- $core.addMethod(
- $core.method({
- selector: "irTranslator",
- protocol: 'compiling',
- fn: function (){
- var self=this;
- function $IRInliningJSTranslator(){return $globals.IRInliningJSTranslator||(typeof IRInliningJSTranslator=="undefined"?nil:IRInliningJSTranslator)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($IRInliningJSTranslator())._new();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.InliningCodeGenerator)});
- },
- args: [],
- source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
- referencedClasses: ["IRInliningJSTranslator"],
- messageSends: ["new"]
- }),
- $globals.InliningCodeGenerator);
- $core.addClass('InliningError', $globals.SemanticError, [], 'Compiler-Inlining');
- $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
- });
- 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";
- var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
- $core.addPackage('Compiler-Interpreter');
- $core.packages["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
- $core.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
- $core.addClass('AIBlockClosure', $globals.BlockClosure, ['node', 'outerContext'], 'Compiler-Interpreter');
- $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`).";
- $core.addMethod(
- $core.method({
- selector: "applyTo:arguments:",
- protocol: 'evaluating',
- fn: function (anObject,aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._interpreterError();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
- },
- args: ["anObject", "aCollection"],
- source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
- referencedClasses: [],
- messageSends: ["interpreterError"]
- }),
- $globals.AIBlockClosure);
- $core.addMethod(
- $core.method({
- selector: "compiledSource",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return "[ AST Block closure ]";
- },
- args: [],
- source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AIBlockClosure);
- $core.addMethod(
- $core.method({
- selector: "currySelf",
- protocol: 'converting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._interpreterError();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
- },
- args: [],
- source: "currySelf\x0a\x09self interpreterError",
- referencedClasses: [],
- messageSends: ["interpreterError"]
- }),
- $globals.AIBlockClosure);
- $core.addMethod(
- $core.method({
- selector: "initializeWithContext:node:",
- protocol: 'initialization',
- fn: function (aContext,aNode){
- var self=this;
- self["@node"]=aNode;
- self["@outerContext"]=aContext;
- return self;
- },
- args: ["aContext", "aNode"],
- source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AIBlockClosure);
- $core.addMethod(
- $core.method({
- selector: "interpreterError",
- protocol: 'error handling',
- fn: function (){
- var self=this;
- function $ASTInterpreterError(){return $globals.ASTInterpreterError||(typeof ASTInterpreterError=="undefined"?nil:ASTInterpreterError)}
- return $core.withContext(function($ctx1) {
- $recv($ASTInterpreterError())._signal_("Method cannot be interpreted by the interpreter.");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
- },
- args: [],
- source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
- referencedClasses: ["ASTInterpreterError"],
- messageSends: ["signal:"]
- }),
- $globals.AIBlockClosure);
- $core.addMethod(
- $core.method({
- selector: "numArgs",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv(self["@node"])._temps())._size();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
- },
- args: [],
- source: "numArgs\x0a\x09^ node temps size",
- referencedClasses: [],
- messageSends: ["size", "temps"]
- }),
- $globals.AIBlockClosure);
- $core.addMethod(
- $core.method({
- selector: "value",
- protocol: 'evaluating',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._valueWithPossibleArguments_([]);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
- },
- args: [],
- source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
- referencedClasses: [],
- messageSends: ["valueWithPossibleArguments:"]
- }),
- $globals.AIBlockClosure);
- $core.addMethod(
- $core.method({
- selector: "value:",
- protocol: 'evaluating',
- fn: function (anArgument){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._valueWithPossibleArguments_([anArgument]);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
- },
- args: ["anArgument"],
- source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
- referencedClasses: [],
- messageSends: ["valueWithPossibleArguments:"]
- }),
- $globals.AIBlockClosure);
- $core.addMethod(
- $core.method({
- selector: "value:value:",
- protocol: 'evaluating',
- fn: function (firstArgument,secondArgument){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._valueWithPossibleArguments_([firstArgument,secondArgument]);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
- },
- args: ["firstArgument", "secondArgument"],
- source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
- referencedClasses: [],
- messageSends: ["valueWithPossibleArguments:"]
- }),
- $globals.AIBlockClosure);
- $core.addMethod(
- $core.method({
- selector: "value:value:value:",
- protocol: 'evaluating',
- fn: function (firstArgument,secondArgument,thirdArgument){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
- },
- args: ["firstArgument", "secondArgument", "thirdArgument"],
- source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
- referencedClasses: [],
- messageSends: ["valueWithPossibleArguments:"]
- }),
- $globals.AIBlockClosure);
- $core.addMethod(
- $core.method({
- selector: "valueWithPossibleArguments:",
- protocol: 'evaluating',
- fn: function (aCollection){
- var self=this;
- var context,sequenceNode;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5,$6;
- context=$recv(self["@outerContext"])._newInnerContext();
- $1=$recv($recv($recv(self["@node"])._nodes())._first())._copy();
- $recv($1)._parent_(nil);
- $2=$recv($1)._yourself();
- sequenceNode=$2;
- $recv($recv(sequenceNode)._temps())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(context)._defineLocal_(each);
- $ctx2.sendIdx["defineLocal:"]=1;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $recv($recv(self["@node"])._parameters())._withIndexDo_((function(each,index){
- return $core.withContext(function($ctx2) {
- $recv(context)._defineLocal_(each);
- return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
- return nil;
- })));
- }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
- }));
- $3=$recv(context)._interpreter();
- $ctx1.sendIdx["interpreter"]=1;
- $recv($3)._node_($recv(sequenceNode)._nextChild());
- $4=$recv($3)._proceed();
- $5=$recv(self["@outerContext"])._interpreter();
- $ctx1.sendIdx["interpreter"]=2;
- $recv($5)._setNonLocalReturnFromContext_(context);
- $6=$recv($recv(context)._interpreter())._pop();
- return $6;
- }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
- },
- args: ["aCollection"],
- 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",
- referencedClasses: [],
- messageSends: ["newInnerContext", "parent:", "copy", "first", "nodes", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "nextChild", "proceed", "setNonLocalReturnFromContext:", "pop"]
- }),
- $globals.AIBlockClosure);
- $core.addMethod(
- $core.method({
- selector: "forContext:node:",
- protocol: 'instance creation',
- fn: function (aContext,aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- $recv($2)._initializeWithContext_node_(aContext,aNode);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.klass)});
- },
- args: ["aContext", "aNode"],
- source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["initializeWithContext:node:", "new", "yourself"]
- }),
- $globals.AIBlockClosure.klass);
- $core.addClass('AIContext', $globals.MethodContext, ['outerContext', 'innerContext', 'pc', 'locals', 'selector', 'index', 'sendIndexes', 'evaluatedSelector', 'ast', 'interpreter', 'supercall'], 'Compiler-Interpreter');
- $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)";
- $core.addMethod(
- $core.method({
- selector: "arguments",
- protocol: 'interpreting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv(self._ast())._arguments())._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return self._localAt_ifAbsent_(each,(function(){
- return $core.withContext(function($ctx3) {
- return self._error_("Argument not in context");
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
- },
- args: [],
- source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
- referencedClasses: [],
- messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "ast",
- protocol: 'interpreting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$3,$2,$4,$5,$receiver;
- $1=self._isBlockContext();
- if($core.assert($1)){
- $3=self._outerContext();
- if(($receiver = $3) == null || $receiver.isNil){
- $2=$3;
- } else {
- var context;
- context=$receiver;
- $2=$recv(context)._ast();
- };
- return $2;
- };
- $4=self["@ast"];
- if(($receiver = $4) == null || $receiver.isNil){
- self._initializeAST();
- } else {
- $4;
- };
- $5=self["@ast"];
- return $5;
- }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
- },
- args: [],
- source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
- referencedClasses: [],
- messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "basicLocalAt:",
- protocol: 'private',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._locals())._at_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
- },
- args: ["aString"],
- source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
- referencedClasses: [],
- messageSends: ["at:", "locals"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "basicLocalAt:put:",
- protocol: 'private',
- fn: function (aString,anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._locals())._at_put_(aString,anObject);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
- },
- args: ["aString", "anObject"],
- source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
- referencedClasses: [],
- messageSends: ["at:put:", "locals"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "basicReceiver",
- protocol: 'interpreting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._localAt_("self");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
- },
- args: [],
- source: "basicReceiver\x0a\x09^ self localAt: 'self'",
- referencedClasses: [],
- messageSends: ["localAt:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "defineLocal:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._locals())._at_put_(aString,nil);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
- },
- args: ["aString"],
- source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
- referencedClasses: [],
- messageSends: ["at:put:", "locals"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "evaluate:on:",
- protocol: 'evaluating',
- fn: function (aString,anEvaluator){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(anEvaluator)._evaluate_context_(aString,self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
- },
- args: ["aString", "anEvaluator"],
- source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
- referencedClasses: [],
- messageSends: ["evaluate:context:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "evaluateNode:",
- protocol: 'evaluating',
- fn: function (aNode){
- var self=this;
- function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($ASTInterpreter())._new();
- $recv($2)._context_(self);
- $recv($2)._node_($recv(aNode)._nextChild());
- $recv($2)._proceed();
- $3=$recv($2)._result();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
- },
- args: ["aNode"],
- source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode nextChild;\x0a\x09\x09proceed;\x0a\x09\x09result",
- referencedClasses: ["ASTInterpreter"],
- messageSends: ["context:", "new", "node:", "nextChild", "proceed", "result"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "evaluatedSelector",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@evaluatedSelector"];
- return $1;
- },
- args: [],
- source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "evaluatedSelector:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@evaluatedSelector"]=aString;
- return self;
- },
- args: ["aString"],
- source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "index",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@index"];
- if(($receiver = $2) == null || $receiver.isNil){
- $1=(0);
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
- },
- args: [],
- source: "index\x0a\x09^ index ifNil: [ 0 ]",
- referencedClasses: [],
- messageSends: ["ifNil:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "index:",
- protocol: 'accessing',
- fn: function (anInteger){
- var self=this;
- self["@index"]=anInteger;
- return self;
- },
- args: ["anInteger"],
- source: "index: anInteger\x0a\x09index := anInteger",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "initializeAST",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._method();
- $ctx1.sendIdx["method"]=1;
- self["@ast"]=$recv($1)._ast();
- $recv($recv($SemanticAnalyzer())._on_($recv(self._method())._methodClass()))._visit_(self["@ast"]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
- },
- args: [],
- source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
- referencedClasses: ["SemanticAnalyzer"],
- messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "initializeFromMethodContext:",
- protocol: 'initialization',
- fn: function (aMethodContext){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$receiver;
- self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
- self._index_($recv(aMethodContext)._index());
- self._sendIndexes_($recv(aMethodContext)._sendIndexes());
- self._receiver_($recv(aMethodContext)._receiver());
- self._supercall_($recv(aMethodContext)._supercall());
- $1=self._selector_($recv(aMethodContext)._selector());
- $2=$recv(aMethodContext)._outerContext();
- $ctx1.sendIdx["outerContext"]=1;
- if(($receiver = $2) == null || $receiver.isNil){
- $2;
- } else {
- var outer;
- outer=$receiver;
- $3=$recv(outer)._methodContext();
- if(($receiver = $3) == null || $receiver.isNil){
- $3;
- } else {
- self._outerContext_($recv(self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
- };
- $4=$recv(aMethodContext)._locals();
- $ctx1.sendIdx["locals"]=1;
- $recv($4)._keysAndValuesDo_((function(key,value){
- return $core.withContext(function($ctx2) {
- return $recv(self._locals())._at_put_(key,value);
- }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
- }));
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
- },
- args: ["aMethodContext"],
- 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 ] ]",
- referencedClasses: [],
- messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "initializeInterpreter",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$receiver;
- $1=$recv($ASTInterpreter())._new();
- $recv($1)._context_(self);
- $2=$recv($1)._yourself();
- self["@interpreter"]=$2;
- $3=self._innerContext();
- if(($receiver = $3) == null || $receiver.isNil){
- $3;
- } else {
- self._setupInterpreter_(self["@interpreter"]);
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
- },
- args: [],
- source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
- referencedClasses: ["ASTInterpreter"],
- messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "initializeLocals",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return $core.withContext(function($ctx1) {
- self["@locals"]=$recv($Dictionary())._new();
- $recv(self["@locals"])._at_put_("thisContext",self);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
- },
- args: [],
- source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
- referencedClasses: ["Dictionary"],
- messageSends: ["new", "at:put:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "innerContext",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@innerContext"];
- return $1;
- },
- args: [],
- source: "innerContext\x0a\x09^ innerContext",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "innerContext:",
- protocol: 'accessing',
- fn: function (anAIContext){
- var self=this;
- self["@innerContext"]=anAIContext;
- return self;
- },
- args: ["anAIContext"],
- source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "interpreter",
- protocol: 'interpreting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$receiver;
- $1=self["@interpreter"];
- if(($receiver = $1) == null || $receiver.isNil){
- self._initializeInterpreter();
- } else {
- $1;
- };
- $2=self["@interpreter"];
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
- },
- args: [],
- source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
- referencedClasses: [],
- messageSends: ["ifNil:", "initializeInterpreter"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "interpreter:",
- protocol: 'interpreting',
- fn: function (anInterpreter){
- var self=this;
- self["@interpreter"]=anInterpreter;
- return self;
- },
- args: ["anInterpreter"],
- source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "isTopContext",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._innerContext())._isNil();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
- },
- args: [],
- source: "isTopContext\x0a\x09^ self innerContext isNil",
- referencedClasses: [],
- messageSends: ["isNil", "innerContext"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "localAt:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- var context;
- return $core.withContext(function($ctx1) {
- var $1;
- context=self._lookupContextForLocal_(aString);
- $1=$recv(context)._basicLocalAt_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
- },
- args: ["aString"],
- 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",
- referencedClasses: [],
- messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "localAt:ifAbsent:",
- protocol: 'accessing',
- fn: function (aString,aBlock){
- var self=this;
- var context;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- var $early={};
- try {
- context=self._lookupContextForLocal_ifNone_(aString,(function(){
- return $core.withContext(function($ctx2) {
- $1=$recv(aBlock)._value();
- throw $early=[$1];
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $2=$recv(context)._basicLocalAt_(aString);
- return $2;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
- },
- args: ["aString", "aBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "localAt:put:",
- protocol: 'accessing',
- fn: function (aString,anObject){
- var self=this;
- var context;
- return $core.withContext(function($ctx1) {
- context=self._lookupContextForLocal_(aString);
- $recv(context)._basicLocalAt_put_(aString,anObject);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
- },
- args: ["aString", "anObject"],
- source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
- referencedClasses: [],
- messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "locals",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$receiver;
- $1=self["@locals"];
- if(($receiver = $1) == null || $receiver.isNil){
- self._initializeLocals();
- } else {
- $1;
- };
- $2=self["@locals"];
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
- },
- args: [],
- source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
- referencedClasses: [],
- messageSends: ["ifNil:", "initializeLocals"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "lookupContextForLocal:",
- protocol: 'private',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._lookupContextForLocal_ifNone_(aString,(function(){
- return $core.withContext(function($ctx2) {
- return self._variableNotFound();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
- },
- args: ["aString"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "lookupContextForLocal:ifNone:",
- protocol: 'private',
- fn: function (aString,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $1=$recv(self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
- return self;
- }),(function(){
- return $core.withContext(function($ctx2) {
- $2=self._outerContext();
- return $recv($2)._ifNil_ifNotNil_(aBlock,(function(context){
- return $core.withContext(function($ctx3) {
- return $recv(context)._lookupContextForLocal_(aString);
- }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
- }));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
- },
- args: ["aString", "aBlock"],
- 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 ] ]",
- referencedClasses: [],
- messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "newInnerContext",
- protocol: 'factory',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv(self._class())._new();
- $recv($2)._outerContext_(self);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
- },
- args: [],
- source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["outerContext:", "new", "class", "yourself"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "outerContext",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@outerContext"];
- return $1;
- },
- args: [],
- source: "outerContext\x0a\x09^ outerContext",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "outerContext:",
- protocol: 'accessing',
- fn: function (anAIContext){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$receiver;
- self["@outerContext"]=anAIContext;
- $1=self["@outerContext"];
- if(($receiver = $1) == null || $receiver.isNil){
- $1;
- } else {
- var context;
- context=$receiver;
- $recv(context)._innerContext_(self);
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
- },
- args: ["anAIContext"],
- source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
- referencedClasses: [],
- messageSends: ["ifNotNil:", "innerContext:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "receiver:",
- protocol: 'interpreting',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._locals())._at_put_("self",anObject);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
- },
- args: ["anObject"],
- source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
- referencedClasses: [],
- messageSends: ["at:put:", "locals"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "selector",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@selector"];
- return $1;
- },
- args: [],
- source: "selector\x0a\x09^ selector",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "selector:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@selector"]=aString;
- return self;
- },
- args: ["aString"],
- source: "selector: aString\x0a\x09selector := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "sendIndexAt:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._sendIndexes())._at_ifAbsent_(aString,(function(){
- return (0);
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
- },
- args: ["aString"],
- source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
- referencedClasses: [],
- messageSends: ["at:ifAbsent:", "sendIndexes"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "sendIndexes",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@sendIndexes"];
- if(($receiver = $2) == null || $receiver.isNil){
- $1=$recv($Dictionary())._new();
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
- },
- args: [],
- source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
- referencedClasses: ["Dictionary"],
- messageSends: ["ifNil:", "new"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "sendIndexes:",
- protocol: 'accessing',
- fn: function (aDictionary){
- var self=this;
- self["@sendIndexes"]=aDictionary;
- return self;
- },
- args: ["aDictionary"],
- source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "setupInterpreter:",
- protocol: 'interpreting',
- fn: function (anInterpreter){
- var self=this;
- var currentNode;
- function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5,$8,$7,$6,$receiver;
- $1=$recv($ASTPCNodeVisitor())._new();
- $recv($1)._selector_(self._evaluatedSelector());
- $recv($1)._context_(self);
- $2=$1;
- $3=self._ast();
- $ctx1.sendIdx["ast"]=1;
- $recv($2)._visit_($3);
- $4=$recv($1)._currentNode();
- currentNode=$4;
- $5=$recv(self._ast())._sequenceNode();
- if(($receiver = $5) == null || $receiver.isNil){
- $5;
- } else {
- var sequence;
- sequence=$receiver;
- $recv($recv(sequence)._temps())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return self._defineLocal_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- $ctx1.sendIdx["do:"]=1;
- };
- $recv(anInterpreter)._node_(currentNode);
- $8=self._innerContext();
- $ctx1.sendIdx["innerContext"]=1;
- $7=$recv($8)._arguments();
- $6=$recv($7)._reversed();
- $recv($6)._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(anInterpreter)._push_(each);
- $ctx2.sendIdx["push:"]=1;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
- }));
- $recv(anInterpreter)._push_($recv(self._innerContext())._receiver());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
- },
- args: ["anInterpreter"],
- 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)",
- referencedClasses: ["ASTPCNodeVisitor"],
- messageSends: ["selector:", "new", "evaluatedSelector", "context:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "supercall",
- protocol: 'interpreting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@supercall"];
- if(($receiver = $2) == null || $receiver.isNil){
- $1=false;
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
- },
- args: [],
- source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
- referencedClasses: [],
- messageSends: ["ifNil:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "supercall:",
- protocol: 'interpreting',
- fn: function (aBoolean){
- var self=this;
- self["@supercall"]=aBoolean;
- return self;
- },
- args: ["aBoolean"],
- source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "variableNotFound",
- protocol: 'error handling',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._error_("Variable missing");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
- },
- args: [],
- source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
- referencedClasses: [],
- messageSends: ["error:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "fromMethodContext:",
- protocol: 'instance creation',
- fn: function (aMethodContext){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- $recv($2)._initializeFromMethodContext_(aMethodContext);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.klass)});
- },
- args: ["aMethodContext"],
- source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["initializeFromMethodContext:", "new", "yourself"]
- }),
- $globals.AIContext.klass);
- $core.addClass('AISemanticAnalyzer', $globals.SemanticAnalyzer, ['context'], 'Compiler-Interpreter');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "context",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@context"];
- return $1;
- },
- args: [],
- source: "context\x0a\x09^ context",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AISemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "context:",
- protocol: 'accessing',
- fn: function (anAIContext){
- var self=this;
- self["@context"]=anAIContext;
- return self;
- },
- args: ["anAIContext"],
- source: "context: anAIContext\x0a\x09context := anAIContext",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AISemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "visitVariableNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- function $ASTContextVar(){return $globals.ASTContextVar||(typeof ASTContextVar=="undefined"?nil:ASTContextVar)}
- return $core.withContext(function($ctx1) {
- var $1;
- var $early={};
- try {
- $recv(self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
- return $core.withContext(function($ctx2) {
- $1=(
- $ctx2.supercall = true,
- $globals.AISemanticAnalyzer.superclass.fn.prototype._visitVariableNode_.apply($recv(self), [aNode]));
- $ctx2.supercall = false;
- throw $early=[$1];
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $recv(aNode)._binding_($recv($ASTContextVar())._new());
- return self;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
- },
- args: ["aNode"],
- source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
- referencedClasses: ["ASTContextVar"],
- messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
- }),
- $globals.AISemanticAnalyzer);
- $core.addClass('ASTContextVar', $globals.ScopeVar, ['context'], 'Compiler-Interpreter');
- $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
- $core.addMethod(
- $core.method({
- selector: "context",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@context"];
- return $1;
- },
- args: [],
- source: "context\x0a\x09^ context",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ASTContextVar);
- $core.addMethod(
- $core.method({
- selector: "context:",
- protocol: 'accessing',
- fn: function (anObject){
- var self=this;
- self["@context"]=anObject;
- return self;
- },
- args: ["anObject"],
- source: "context: anObject\x0a\x09context := anObject",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ASTContextVar);
- $core.addClass('ASTDebugger', $globals.Object, ['interpreter', 'context', 'result'], 'Compiler-Interpreter');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "atEnd",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$receiver;
- $1=self._context();
- $ctx1.sendIdx["context"]=1;
- if(($receiver = $1) == null || $receiver.isNil){
- return true;
- } else {
- $1;
- };
- $2=$recv($recv(self._interpreter())._atEnd())._and_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self._context())._isTopContext();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
- },
- args: [],
- source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
- referencedClasses: [],
- messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "context",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@context"];
- return $1;
- },
- args: [],
- source: "context\x0a\x09^ context",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "context:",
- protocol: 'accessing',
- fn: function (aContext){
- var self=this;
- self["@context"]=aContext;
- return self;
- },
- args: ["aContext"],
- source: "context: aContext\x0a\x09context := aContext",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "flushInnerContexts",
- protocol: 'actions',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$receiver;
- $1=self._context();
- if(($receiver = $1) == null || $receiver.isNil){
- $1;
- } else {
- var cxt;
- cxt=$receiver;
- $recv(cxt)._innerContext_(nil);
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
- },
- args: [],
- 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 ]",
- referencedClasses: [],
- messageSends: ["ifNotNil:", "context", "innerContext:"]
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "interpreter",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self._context();
- if(($receiver = $2) == null || $receiver.isNil){
- $1=$2;
- } else {
- var ctx;
- ctx=$receiver;
- $1=$recv(ctx)._interpreter();
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
- },
- args: [],
- source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
- referencedClasses: [],
- messageSends: ["ifNotNil:", "context", "interpreter"]
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "method",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._context())._method();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
- },
- args: [],
- source: "method\x0a\x09^ self context method",
- referencedClasses: [],
- messageSends: ["method", "context"]
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "node",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self._interpreter();
- $ctx1.sendIdx["interpreter"]=1;
- if(($receiver = $2) == null || $receiver.isNil){
- $1=$2;
- } else {
- $1=$recv(self._interpreter())._node();
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
- },
- args: [],
- source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
- referencedClasses: [],
- messageSends: ["ifNotNil:", "interpreter", "node"]
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "onStep",
- protocol: 'private',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$3,$2,$4,$6,$5,$receiver;
- $1=self._interpreter();
- $ctx1.sendIdx["interpreter"]=1;
- self["@result"]=$recv($1)._result();
- $3=self._interpreter();
- $ctx1.sendIdx["interpreter"]=2;
- $2=$recv($3)._atEnd();
- $ctx1.sendIdx["atEnd"]=1;
- if($core.assert($2)){
- $4=$recv(self._context())._outerContext();
- if(($receiver = $4) == null || $receiver.isNil){
- $4;
- } else {
- var outerContext;
- outerContext=$receiver;
- self._context_(outerContext);
- };
- $6=self._interpreter();
- $ctx1.sendIdx["interpreter"]=3;
- $5=$recv($6)._atEnd();
- if(!$core.assert($5)){
- $recv(self._interpreter())._skip();
- };
- };
- self._flushInnerContexts();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "proceed",
- protocol: 'stepping',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return self._atEnd();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._whileFalse_((function(){
- return $core.withContext(function($ctx2) {
- return self._stepOver();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
- },
- args: [],
- source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
- referencedClasses: [],
- messageSends: ["whileFalse:", "atEnd", "stepOver"]
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "restart",
- protocol: 'stepping',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._interpreter())._restart();
- self._flushInnerContexts();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
- },
- args: [],
- source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
- referencedClasses: [],
- messageSends: ["restart", "interpreter", "flushInnerContexts"]
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "result",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@result"];
- return $1;
- },
- args: [],
- source: "result\x0a\x09^ result",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "stepInto",
- protocol: 'stepping',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._shouldBeImplemented();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
- },
- args: [],
- source: "stepInto\x0a\x09self shouldBeImplemented",
- referencedClasses: [],
- messageSends: ["shouldBeImplemented"]
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "stepOver",
- protocol: 'stepping',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=$recv(self._context())._isTopContext();
- if($core.assert($1)){
- $recv(self._interpreter())._stepOver();
- } else {
- $2=self._interpreter();
- $ctx1.sendIdx["interpreter"]=1;
- $recv($2)._skip();
- };
- self._onStep();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
- },
- args: [],
- source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
- referencedClasses: [],
- messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "context:",
- protocol: 'instance creation',
- fn: function (aContext){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- $recv($2)._context_(aContext);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.klass)});
- },
- args: ["aContext"],
- source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["context:", "new", "yourself"]
- }),
- $globals.ASTDebugger.klass);
- $core.addClass('ASTInterpreter', $globals.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned', 'forceAtEnd'], 'Compiler-Interpreter');
- $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";
- $core.addMethod(
- $core.method({
- selector: "assign:to:",
- protocol: 'private',
- fn: function (aNode,anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$3,$2,$4;
- $1=$recv($recv(aNode)._binding())._isInstanceVar();
- if($core.assert($1)){
- $3=self._context();
- $ctx1.sendIdx["context"]=1;
- $2=$recv($3)._receiver();
- $4=$recv(aNode)._value();
- $ctx1.sendIdx["value"]=1;
- $recv($2)._instVarAt_put_($4,anObject);
- } else {
- $recv(self._context())._localAt_put_($recv(aNode)._value(),anObject);
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
- },
- args: ["aNode", "anObject"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "atEnd",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=self["@forceAtEnd"];
- if($core.assert($1)){
- return true;
- };
- $2=$recv(self._hasReturned())._or_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self._node())._isNil();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
- },
- args: [],
- source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
- referencedClasses: [],
- messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "context",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@context"];
- return $1;
- },
- args: [],
- source: "context\x0a\x09^ context",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "context:",
- protocol: 'accessing',
- fn: function (aContext){
- var self=this;
- self["@context"]=aContext;
- return self;
- },
- args: ["aContext"],
- source: "context: aContext\x0a\x09context := aContext",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "eval:",
- protocol: 'private',
- fn: function (aString){
- var self=this;
- var source,function_;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
- return $core.withContext(function($ctx1) {
- var $3,$2,$1,$4,$5;
- source=$recv($String())._streamContents_((function(str){
- return $core.withContext(function($ctx2) {
- $recv(str)._nextPutAll_("0,(function(");
- $ctx2.sendIdx["nextPutAll:"]=1;
- $3=self._context();
- $ctx2.sendIdx["context"]=1;
- $2=$recv($3)._locals();
- $ctx2.sendIdx["locals"]=1;
- $1=$recv($2)._keys();
- $recv($1)._do_separatedBy_((function(each){
- return $core.withContext(function($ctx3) {
- return $recv(str)._nextPutAll_(each);
- $ctx3.sendIdx["nextPutAll:"]=2;
- }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
- }),(function(){
- return $core.withContext(function($ctx3) {
- return $recv(str)._nextPutAll_(",");
- $ctx3.sendIdx["nextPutAll:"]=3;
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
- }));
- $recv(str)._nextPutAll_("){ return (function() {");
- $ctx2.sendIdx["nextPutAll:"]=4;
- $recv(str)._nextPutAll_(aString);
- $ctx2.sendIdx["nextPutAll:"]=5;
- $4=$recv(str)._nextPutAll_("})()})");
- return $4;
- }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
- }));
- function_=$recv($recv($Compiler())._new())._eval_(source);
- $5=$recv(function_)._valueWithPossibleArguments_($recv($recv(self._context())._locals())._values());
- return $5;
- }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
- },
- args: ["aString"],
- 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",
- referencedClasses: ["String", "Compiler"],
- messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "hasReturned",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@returned"];
- if(($receiver = $2) == null || $receiver.isNil){
- $1=false;
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
- },
- args: [],
- source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
- referencedClasses: [],
- messageSends: ["ifNil:"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.ASTInterpreter.superclass.fn.prototype._initialize.apply($recv(self), []));
- $ctx1.supercall = false;
- self["@forceAtEnd"]=false;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
- },
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
- referencedClasses: [],
- messageSends: ["initialize"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "interpret",
- protocol: 'interpreting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._visit_(self._node());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
- },
- args: [],
- source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
- referencedClasses: [],
- messageSends: ["visit:", "node"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "interpret:",
- protocol: 'interpreting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._node_(aNode);
- self._interpret();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},$globals.ASTInterpreter)});
- },
- args: ["aNode"],
- source: "interpret: aNode\x0a\x09self node: aNode.\x0a\x09self interpret",
- referencedClasses: [],
- messageSends: ["node:", "interpret"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "messageFromSendNode:arguments:",
- protocol: 'private',
- fn: function (aSendNode,aCollection){
- var self=this;
- function $Message(){return $globals.Message||(typeof Message=="undefined"?nil:Message)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($Message())._new();
- $recv($2)._selector_($recv(aSendNode)._selector());
- $recv($2)._arguments_(aCollection);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
- },
- args: ["aSendNode", "aCollection"],
- source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
- referencedClasses: ["Message"],
- messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "messageNotUnderstood:receiver:",
- protocol: 'private',
- fn: function (aMessage,anObject){
- var self=this;
- function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=$recv($MessageNotUnderstood())._new();
- $recv($1)._meesage_(aMessage);
- $recv($1)._receiver_(anObject);
- $2=$recv($1)._signal();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
- },
- args: ["aMessage", "anObject"],
- source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09meesage: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
- referencedClasses: ["MessageNotUnderstood"],
- messageSends: ["meesage:", "new", "receiver:", "signal"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "next",
- protocol: 'interpreting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._node_($recv(self._node())._nextNode());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ASTInterpreter)});
- },
- args: [],
- source: "next\x0a\x09self node: self node nextNode",
- referencedClasses: [],
- messageSends: ["node:", "nextNode", "node"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "node",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@node"];
- return $1;
- },
- args: [],
- source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "node:",
- protocol: 'accessing',
- fn: function (aNode){
- var self=this;
- self["@node"]=aNode;
- return self;
- },
- args: ["aNode"],
- source: "node: aNode\x0a\x09node := aNode",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "peek",
- protocol: 'stack',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- var $early={};
- try {
- $1=self._stack();
- $ctx1.sendIdx["stack"]=1;
- $recv($1)._ifEmpty_((function(){
- throw $early=[nil];
- }));
- $2=$recv(self._stack())._last();
- return $2;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["ifEmpty:", "stack", "last"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "pop",
- protocol: 'stack',
- fn: function (){
- var self=this;
- var peekedValue;
- return $core.withContext(function($ctx1) {
- var $1;
- peekedValue=self._peek();
- $recv(self._stack())._removeLast();
- $1=peekedValue;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["peek", "removeLast", "stack"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "proceed",
- protocol: 'interpreting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return self._atEnd();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._whileFalse_((function(){
- return $core.withContext(function($ctx2) {
- return self._step();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
- },
- args: [],
- source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
- referencedClasses: [],
- messageSends: ["whileFalse:", "atEnd", "step"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "push:",
- protocol: 'stack',
- fn: function (anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._stack())._add_(anObject);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
- },
- args: ["anObject"],
- source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
- referencedClasses: [],
- messageSends: ["add:", "stack"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "restart",
- protocol: 'interpreting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._node_($recv($recv(self._context())._ast())._nextChild());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
- },
- args: [],
- source: "restart\x0a\x09self node: self context ast nextChild",
- referencedClasses: [],
- messageSends: ["node:", "nextChild", "ast", "context"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "result",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=self._hasReturned();
- if($core.assert($2)){
- $1=self._returnValue();
- } else {
- $1=$recv(self._context())._receiver();
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
- },
- args: [],
- source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "returnValue",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@returnValue"];
- return $1;
- },
- args: [],
- source: "returnValue\x0a\x09^ returnValue",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "returnValue:",
- protocol: 'accessing',
- fn: function (anObject){
- var self=this;
- self["@returnValue"]=anObject;
- return self;
- },
- args: ["anObject"],
- source: "returnValue: anObject\x0a\x09returnValue := anObject",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "sendMessage:to:superSend:",
- protocol: 'private',
- fn: function (aMessage,anObject,aBoolean){
- var self=this;
- var method;
- return $core.withContext(function($ctx1) {
- var $1,$3,$2,$4,$5,$6,$receiver;
- var $early={};
- try {
- if(!$core.assert(aBoolean)){
- $1=$recv(aMessage)._sendTo_(anObject);
- return $1;
- };
- $3=$recv(anObject)._class();
- $ctx1.sendIdx["class"]=1;
- $2=$recv($3)._superclass();
- $ctx1.sendIdx["superclass"]=1;
- if(($receiver = $2) == null || $receiver.isNil){
- $4=self._messageNotUnderstood_receiver_(aMessage,anObject);
- $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
- return $4;
- } else {
- $2;
- };
- method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
- return $core.withContext(function($ctx2) {
- $5=self._messageNotUnderstood_receiver_(aMessage,anObject);
- throw $early=[$5];
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }));
- $6=$recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
- return $6;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
- },
- args: ["aMessage", "anObject", "aBoolean"],
- 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",
- referencedClasses: [],
- messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "setNonLocalReturnFromContext:",
- protocol: 'interpreting',
- fn: function (aContext){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=$recv(aContext)._interpreter();
- $ctx1.sendIdx["interpreter"]=1;
- $1=$recv($2)._hasReturned();
- if($core.assert($1)){
- self["@returned"]=true;
- self["@returned"];
- self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
- },
- args: ["aContext"],
- source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
- referencedClasses: [],
- messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "skip",
- protocol: 'interpreting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._next();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
- },
- args: [],
- source: "skip\x0a\x09self next",
- referencedClasses: [],
- messageSends: ["next"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "stack",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@stack"];
- if(($receiver = $2) == null || $receiver.isNil){
- self["@stack"]=$recv($OrderedCollection())._new();
- $1=self["@stack"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
- },
- args: [],
- source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
- referencedClasses: ["OrderedCollection"],
- messageSends: ["ifNil:", "new"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "step",
- protocol: 'interpreting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- self._interpret();
- $1=self._next();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
- },
- args: [],
- source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
- referencedClasses: [],
- messageSends: ["interpret", "next"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "stepOver",
- protocol: 'interpreting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- self._step();
- $ctx1.sendIdx["step"]=1;
- $recv((function(){
- return $core.withContext(function($ctx2) {
- $2=self._node();
- $ctx2.sendIdx["node"]=1;
- $1=$recv($2)._isNil();
- return $recv($1)._or_((function(){
- return $core.withContext(function($ctx3) {
- return $recv(self._node())._isSteppingNode();
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._whileFalse_((function(){
- return $core.withContext(function($ctx2) {
- return self._step();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
- },
- args: [],
- source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
- referencedClasses: [],
- messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visit:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._hasReturned();
- if(!$core.assert($1)){
- (
- $ctx1.supercall = true,
- $globals.ASTInterpreter.superclass.fn.prototype._visit_.apply($recv(self), [aNode]));
- $ctx1.supercall = false;
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
- },
- args: ["aNode"],
- source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
- referencedClasses: [],
- messageSends: ["ifFalse:", "hasReturned", "visit:"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visitAssignmentNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- var poppedValue;
- return $core.withContext(function($ctx1) {
- poppedValue=self._pop();
- $ctx1.sendIdx["pop"]=1;
- self._pop();
- self._push_(poppedValue);
- self._assign_to_($recv(aNode)._left(),poppedValue);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
- },
- args: ["aNode"],
- 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",
- referencedClasses: [],
- messageSends: ["pop", "push:", "assign:to:", "left"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visitBlockNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- var block;
- function $AIBlockClosure(){return $globals.AIBlockClosure||(typeof AIBlockClosure=="undefined"?nil:AIBlockClosure)}
- return $core.withContext(function($ctx1) {
- block=$recv($AIBlockClosure())._forContext_node_(self._context(),aNode);
- self._push_(block);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
- },
- args: ["aNode"],
- 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",
- referencedClasses: ["AIBlockClosure"],
- messageSends: ["forContext:node:", "context", "push:"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visitBlockSequenceNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.ASTInterpreter.superclass.fn.prototype._visitBlockSequenceNode_.apply($recv(self), [aNode]));
- $ctx1.supercall = false;
- self["@forceAtEnd"]=true;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
- },
- args: ["aNode"],
- 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",
- referencedClasses: [],
- messageSends: ["visitBlockSequenceNode:"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visitDynamicArrayNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- var array;
- return $core.withContext(function($ctx1) {
- array=[];
- $recv($recv(aNode)._nodes())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(array)._addFirst_(self._pop());
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- self._push_(array);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
- },
- args: ["aNode"],
- 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",
- referencedClasses: [],
- messageSends: ["do:", "nodes", "addFirst:", "pop", "push:"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visitDynamicDictionaryNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- var keyValueList;
- function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
- function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
- return $core.withContext(function($ctx1) {
- keyValueList=$recv($OrderedCollection())._new();
- $recv($recv(aNode)._nodes())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(keyValueList)._add_(self._pop());
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- self._push_($recv($HashedCollection())._newFromPairs_($recv(keyValueList)._reversed()));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
- },
- args: ["aNode"],
- 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)",
- referencedClasses: ["OrderedCollection", "HashedCollection"],
- messageSends: ["new", "do:", "nodes", "add:", "pop", "push:", "newFromPairs:", "reversed"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visitJSStatementNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- self["@returned"]=true;
- self._returnValue_(self._eval_($recv(aNode)._source()));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
- },
- args: ["aNode"],
- source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
- referencedClasses: [],
- messageSends: ["returnValue:", "eval:", "source"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visitNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return self;
- },
- args: ["aNode"],
- source: "visitNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visitReturnNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- self["@returned"]=true;
- self._returnValue_(self._pop());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
- },
- args: ["aNode"],
- source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
- referencedClasses: [],
- messageSends: ["returnValue:", "pop"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visitSendNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- var receiver,args,message,result;
- return $core.withContext(function($ctx1) {
- var $1;
- args=$recv($recv(aNode)._arguments())._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return self._pop();
- $ctx2.sendIdx["pop"]=1;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- receiver=self._pop();
- message=self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
- result=self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
- $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
- return $core.withContext(function($ctx2) {
- return $recv($recv(aNode)._isLastChild())._not();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- if($core.assert($1)){
- self._push_(receiver);
- $ctx1.sendIdx["push:"]=1;
- } else {
- self._push_(result);
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
- },
- args: ["aNode"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["collect:", "arguments", "pop", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifTrue:ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visitSequenceNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv($recv(aNode)._temps())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(self._context())._defineLocal_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
- },
- args: ["aNode"],
- source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self context defineLocal: each ]",
- referencedClasses: [],
- messageSends: ["do:", "temps", "defineLocal:", "context"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visitValueNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._push_($recv(aNode)._value());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
- },
- args: ["aNode"],
- source: "visitValueNode: aNode\x0a\x09self push: aNode value",
- referencedClasses: [],
- messageSends: ["push:", "value"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visitVariableNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
- $2=$recv(aNode)._binding();
- $ctx1.sendIdx["binding"]=1;
- $1=$recv($2)._isUnknownVar();
- if($core.assert($1)){
- $5=$recv($Platform())._globals();
- $ctx1.sendIdx["globals"]=1;
- $6=$recv(aNode)._value();
- $ctx1.sendIdx["value"]=1;
- $4=$recv($5)._at_ifAbsent_($6,(function(){
- return $core.withContext(function($ctx2) {
- return self._error_("Unknown variable");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- $ctx1.sendIdx["at:ifAbsent:"]=1;
- $3=self._push_($4);
- $ctx1.sendIdx["push:"]=1;
- return $3;
- };
- $8=$recv($recv(aNode)._binding())._isInstanceVar();
- if($core.assert($8)){
- $10=self._context();
- $ctx1.sendIdx["context"]=1;
- $9=$recv($10)._receiver();
- $11=$recv(aNode)._value();
- $ctx1.sendIdx["value"]=2;
- $7=$recv($9)._instVarAt_($11);
- } else {
- $12=self._context();
- $13=$recv(aNode)._value();
- $ctx1.sendIdx["value"]=3;
- $7=$recv($12)._localAt_ifAbsent_($13,(function(){
- return $core.withContext(function($ctx2) {
- $15=$recv(aNode)._value();
- $ctx2.sendIdx["value"]=4;
- $14=$recv($15)._isCapitalized();
- if($core.assert($14)){
- $16=$recv($Smalltalk())._globals();
- $ctx2.sendIdx["globals"]=2;
- $17=$recv(aNode)._value();
- $ctx2.sendIdx["value"]=5;
- return $recv($16)._at_ifAbsent_($17,(function(){
- return $core.withContext(function($ctx3) {
- return $recv($recv($Platform())._globals())._at_($recv(aNode)._value());
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
- }));
- };
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
- }));
- };
- self._push_($7);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
- },
- args: ["aNode"],
- 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 ] ] ] ])",
- referencedClasses: ["Platform", "Smalltalk"],
- messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
- }),
- $globals.ASTInterpreter);
- $core.addClass('ASTInterpreterError', $globals.Error, [], 'Compiler-Interpreter');
- $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
- $core.addClass('ASTPCNodeVisitor', $globals.NodeVisitor, ['context', 'index', 'selector', 'currentNode'], 'Compiler-Interpreter');
- $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`";
- $core.addMethod(
- $core.method({
- selector: "context",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@context"];
- return $1;
- },
- args: [],
- source: "context\x0a\x09^ context",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ASTPCNodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "context:",
- protocol: 'accessing',
- fn: function (aContext){
- var self=this;
- self["@context"]=aContext;
- return self;
- },
- args: ["aContext"],
- source: "context: aContext\x0a\x09context := aContext",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ASTPCNodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "currentNode",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@currentNode"];
- return $1;
- },
- args: [],
- source: "currentNode\x0a\x09^ currentNode",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ASTPCNodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "increaseIndex",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self["@index"]=$recv(self._index()).__plus((1));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"increaseIndex",{},$globals.ASTPCNodeVisitor)});
- },
- args: [],
- source: "increaseIndex\x0a\x09index := self index + 1",
- referencedClasses: [],
- messageSends: ["+", "index"]
- }),
- $globals.ASTPCNodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "index",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@index"];
- if(($receiver = $2) == null || $receiver.isNil){
- self["@index"]=(0);
- $1=self["@index"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.ASTPCNodeVisitor)});
- },
- args: [],
- source: "index\x0a\x09^ index ifNil: [ index := 0 ]",
- referencedClasses: [],
- messageSends: ["ifNil:"]
- }),
- $globals.ASTPCNodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "selector",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@selector"];
- return $1;
- },
- args: [],
- source: "selector\x0a\x09^ selector",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ASTPCNodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "selector:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@selector"]=aString;
- return self;
- },
- args: ["aString"],
- source: "selector: aString\x0a\x09selector := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ASTPCNodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitJSStatementNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- self["@currentNode"]=aNode;
- return self;
- },
- args: ["aNode"],
- 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",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ASTPCNodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitSendNode:",
- protocol: 'visiting',
- fn: function (aNode){
- var self=this;
- var sendIndex;
- return $core.withContext(function($ctx1) {
- var $1,$2,$4,$3,$5;
- $1=self._context();
- $2=self._selector();
- $ctx1.sendIdx["selector"]=1;
- sendIndex=$recv($1)._sendIndexAt_($2);
- (
- $ctx1.supercall = true,
- $globals.ASTPCNodeVisitor.superclass.fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
- $ctx1.supercall = false;
- $4=self._selector();
- $ctx1.sendIdx["selector"]=2;
- $3=$recv($4).__eq($recv(aNode)._selector());
- $ctx1.sendIdx["="]=1;
- if($core.assert($3)){
- $5=$recv(self._index()).__eq(sendIndex);
- if($core.assert($5)){
- self["@currentNode"]=aNode;
- self["@currentNode"];
- };
- self._increaseIndex();
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sendIndex:sendIndex},$globals.ASTPCNodeVisitor)});
- },
- args: ["aNode"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["sendIndexAt:", "context", "selector", "visitSendNode:", "ifTrue:", "=", "index", "increaseIndex"]
- }),
- $globals.ASTPCNodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "isSteppingNode",
- protocol: '*Compiler-Interpreter',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isSteppingNode\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AssignmentNode);
- $core.addMethod(
- $core.method({
- selector: "isSteppingNode",
- protocol: '*Compiler-Interpreter',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isSteppingNode\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockNode);
- $core.addMethod(
- $core.method({
- selector: "nextChild",
- protocol: '*Compiler-Interpreter',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "nextChild\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockNode);
- $core.addMethod(
- $core.method({
- selector: "nextNode:",
- protocol: '*Compiler-Interpreter',
- fn: function (aNode){
- var self=this;
- return self;
- },
- args: ["aNode"],
- source: "nextNode: aNode\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockNode);
- $core.addMethod(
- $core.method({
- selector: "isSteppingNode",
- protocol: '*Compiler-Interpreter',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isSteppingNode\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.DynamicArrayNode);
- $core.addMethod(
- $core.method({
- selector: "isSteppingNode",
- protocol: '*Compiler-Interpreter',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isSteppingNode\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.DynamicDictionaryNode);
- $core.addMethod(
- $core.method({
- selector: "isSteppingNode",
- protocol: '*Compiler-Interpreter',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isSteppingNode\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JSStatementNode);
- $core.addMethod(
- $core.method({
- selector: "isSteppingNode",
- protocol: '*Compiler-Interpreter',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isSteppingNode\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "nextChild",
- protocol: '*Compiler-Interpreter',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $3,$2,$1;
- $3=self._nodes();
- $ctx1.sendIdx["nodes"]=1;
- $2=$recv($3)._isEmpty();
- if($core.assert($2)){
- $1=self;
- } else {
- $1=$recv($recv(self._nodes())._first())._nextChild();
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"nextChild",{},$globals.Node)});
- },
- args: [],
- 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 ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "isEmpty", "nodes", "nextChild", "first"]
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "nextNode",
- protocol: '*Compiler-Interpreter',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self._parent();
- if(($receiver = $2) == null || $receiver.isNil){
- $1=$2;
- } else {
- var node;
- node=$receiver;
- $1=$recv(node)._nextNode_(self);
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"nextNode",{},$globals.Node)});
- },
- args: [],
- source: "nextNode\x0a\x09^ self parent ifNotNil: [ :node |\x0a\x09\x09node nextNode: self ]",
- referencedClasses: [],
- messageSends: ["ifNotNil:", "parent", "nextNode:"]
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "nextNode:",
- protocol: '*Compiler-Interpreter',
- fn: function (aNode){
- var self=this;
- var next;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- var $early={};
- try {
- $1=self._nodes();
- $ctx1.sendIdx["nodes"]=1;
- next=$recv($1)._at_ifAbsent_($recv($recv(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){
- throw $early=[self];
- }));
- $2=$recv(next)._nextChild();
- return $2;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"nextNode:",{aNode:aNode,next:next},$globals.Node)});
- },
- args: ["aNode"],
- 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",
- referencedClasses: [],
- messageSends: ["at:ifAbsent:", "nodes", "+", "indexOf:", "nextChild"]
- }),
- $globals.Node);
- $core.addMethod(
- $core.method({
- selector: "isSteppingNode",
- protocol: '*Compiler-Interpreter',
- fn: function (){
- var self=this;
- return true;
- },
- args: [],
- source: "isSteppingNode\x0a\x09^ true",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SendNode);
- });
- define('amber/lang',[
- './helpers', // pre-fetch, dep of ./deploy
- './deploy',
- './parser',
- // --- packages for the Amber reflection begin here ---
- 'amber_core/Platform-ImportExport',
- 'amber_core/Compiler-Core',
- 'amber_core/Compiler-AST',
- 'amber_core/Compiler-Semantic',
- 'amber_core/Compiler-IR',
- 'amber_core/Compiler-Inlining',
- 'amber_core/Compiler-Interpreter'
- // --- packages for the Amber reflection end here ---
- ], function (amber) { return amber; });
- 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";
- var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
- $core.addPackage('SUnit');
- $core.packages["SUnit"].innerEval = function (expr) { return eval(expr); };
- $core.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
- $core.addClass('ResultAnnouncement', $globals.Object, ['result'], 'SUnit');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "result",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@result"];
- return $1;
- },
- args: [],
- source: "result\x0a\x09^ result",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ResultAnnouncement);
- $core.addMethod(
- $core.method({
- selector: "result:",
- protocol: 'accessing',
- fn: function (aTestResult){
- var self=this;
- self["@result"]=aTestResult;
- return self;
- },
- args: ["aTestResult"],
- source: "result: aTestResult\x0a\x09result := aTestResult",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ResultAnnouncement);
- $core.addClass('TestCase', $globals.Object, ['testSelector', 'asyncTimeout', 'context'], 'SUnit');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "assert:",
- protocol: 'testing',
- fn: function (aBoolean){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_description_(aBoolean,"Assertion failed");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
- },
- args: ["aBoolean"],
- source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
- referencedClasses: [],
- messageSends: ["assert:description:"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "assert:description:",
- protocol: 'testing',
- fn: function (aBoolean,aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- if(!$core.assert(aBoolean)){
- self._signalFailure_(aString);
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
- },
- args: ["aBoolean", "aString"],
- source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
- referencedClasses: [],
- messageSends: ["ifFalse:", "signalFailure:"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "assert:equals:",
- protocol: 'testing',
- fn: function (actual,expected){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$6,$5,$4,$3,$1;
- $2=$recv(actual).__eq(expected);
- $6=$recv(expected)._printString();
- $ctx1.sendIdx["printString"]=1;
- $5="Expected: ".__comma($6);
- $4=$recv($5).__comma(" but was: ");
- $ctx1.sendIdx[","]=2;
- $3=$recv($4).__comma($recv(actual)._printString());
- $ctx1.sendIdx[","]=1;
- $1=self._assert_description_($2,$3);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
- },
- args: ["actual", "expected"],
- source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
- referencedClasses: [],
- messageSends: ["assert:description:", "=", ",", "printString"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "async:",
- protocol: 'async',
- fn: function (aBlock){
- var self=this;
- var c;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- self._errorIfNotAsync_("#async");
- c=self["@context"];
- $1=(function(){
- return $core.withContext(function($ctx2) {
- $2=self._isAsync();
- if($core.assert($2)){
- return $recv(c)._execute_(aBlock);
- };
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- });
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
- },
- args: ["aBlock"],
- source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
- referencedClasses: [],
- messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "context:",
- protocol: 'accessing',
- fn: function (aRunningTestContext){
- var self=this;
- self["@context"]=aRunningTestContext;
- return self;
- },
- args: ["aRunningTestContext"],
- source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "deny:",
- protocol: 'testing',
- fn: function (aBoolean){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_($recv(aBoolean)._not());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
- },
- args: ["aBoolean"],
- source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
- referencedClasses: [],
- messageSends: ["assert:", "not"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "errorIfNotAsync:",
- protocol: 'error handling',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._isAsync();
- if(!$core.assert($1)){
- self._error_($recv(aString).__comma(" used without prior #timeout:"));
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
- },
- args: ["aString"],
- source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
- referencedClasses: [],
- messageSends: ["ifFalse:", "isAsync", "error:", ","]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "finished",
- protocol: 'async',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._errorIfNotAsync_("#finished");
- self["@asyncTimeout"]=nil;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
- },
- args: [],
- source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
- referencedClasses: [],
- messageSends: ["errorIfNotAsync:"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "isAsync",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self["@asyncTimeout"])._notNil();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
- },
- args: [],
- source: "isAsync\x0a\x09^ asyncTimeout notNil",
- referencedClasses: [],
- messageSends: ["notNil"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "performTest",
- protocol: 'running',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self["@asyncTimeout"]=nil;
- self._perform_(self._selector());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
- },
- args: [],
- source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
- referencedClasses: [],
- messageSends: ["perform:", "selector"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "runCase",
- protocol: 'running',
- fn: function (){
- var self=this;
- function $TestContext(){return $globals.TestContext||(typeof TestContext=="undefined"?nil:TestContext)}
- return $core.withContext(function($ctx1) {
- $recv($recv($TestContext())._testCase_(self))._start();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
- },
- args: [],
- source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
- referencedClasses: ["TestContext"],
- messageSends: ["start", "testCase:"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "selector",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@testSelector"];
- return $1;
- },
- args: [],
- source: "selector\x0a\x09^ testSelector",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "setTestSelector:",
- protocol: 'accessing',
- fn: function (aSelector){
- var self=this;
- self["@testSelector"]=aSelector;
- return self;
- },
- args: ["aSelector"],
- source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "setUp",
- protocol: 'running',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "setUp",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "should:",
- protocol: 'testing',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_($recv(aBlock)._value());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
- },
- args: ["aBlock"],
- source: "should: aBlock\x0a\x09self assert: aBlock value",
- referencedClasses: [],
- messageSends: ["assert:", "value"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "should:raise:",
- protocol: 'testing',
- fn: function (aBlock,anExceptionClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_($recv((function(){
- return $core.withContext(function($ctx2) {
- $recv(aBlock)._value();
- return false;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._on_do_(anExceptionClass,(function(ex){
- return true;
- })));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
- },
- args: ["aBlock", "anExceptionClass"],
- source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
- referencedClasses: [],
- messageSends: ["assert:", "on:do:", "value"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "shouldnt:raise:",
- protocol: 'testing',
- fn: function (aBlock,anExceptionClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_($recv((function(){
- return $core.withContext(function($ctx2) {
- $recv(aBlock)._value();
- return true;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._on_do_(anExceptionClass,(function(ex){
- return false;
- })));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
- },
- args: ["aBlock", "anExceptionClass"],
- source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
- referencedClasses: [],
- messageSends: ["assert:", "on:do:", "value"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "signalFailure:",
- protocol: 'private',
- fn: function (aString){
- var self=this;
- function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=$recv($TestFailure())._new();
- $recv($1)._messageText_(aString);
- $2=$recv($1)._signal();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
- },
- args: ["aString"],
- source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
- referencedClasses: ["TestFailure"],
- messageSends: ["messageText:", "new", "signal"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "tearDown",
- protocol: 'running',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "tearDown",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "timeout:",
- protocol: 'async',
- fn: function (aNumber){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$receiver;
- $1=self["@asyncTimeout"];
- if(($receiver = $1) == null || $receiver.isNil){
- $1;
- } else {
- $recv(self["@asyncTimeout"])._clearTimeout();
- };
- self["@asyncTimeout"]=(0);
- self["@asyncTimeout"]=$recv(self._async_((function(){
- return $core.withContext(function($ctx2) {
- return self._assert_description_(false,"SUnit grace time exhausted");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- })))._valueWithTimeout_(aNumber);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
- },
- args: ["aNumber"],
- 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",
- referencedClasses: [],
- messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "allTestSelectors",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var selectors;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- selectors=self._testSelectors();
- $1=self._shouldInheritSelectors();
- if($core.assert($1)){
- $recv(selectors)._addAll_($recv(self._superclass())._allTestSelectors());
- };
- $2=selectors;
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.klass)});
- },
- args: [],
- source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
- referencedClasses: [],
- messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
- }),
- $globals.TestCase.klass);
- $core.addMethod(
- $core.method({
- selector: "buildSuite",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._allTestSelectors())._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return self._selector_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.klass)});
- },
- args: [],
- source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
- referencedClasses: [],
- messageSends: ["collect:", "allTestSelectors", "selector:"]
- }),
- $globals.TestCase.klass);
- $core.addMethod(
- $core.method({
- selector: "classTag",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return "test";
- },
- args: [],
- 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'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.TestCase.klass);
- $core.addMethod(
- $core.method({
- selector: "isAbstract",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._name()).__eq("TestCase");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.klass)});
- },
- args: [],
- source: "isAbstract\x0a\x09^ self name = 'TestCase'",
- referencedClasses: [],
- messageSends: ["=", "name"]
- }),
- $globals.TestCase.klass);
- $core.addMethod(
- $core.method({
- selector: "lookupHierarchyRoot",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $TestCase(){return $globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)}
- return $TestCase();
- },
- args: [],
- source: "lookupHierarchyRoot\x0a\x09^ TestCase",
- referencedClasses: ["TestCase"],
- messageSends: []
- }),
- $globals.TestCase.klass);
- $core.addMethod(
- $core.method({
- selector: "selector:",
- protocol: 'accessing',
- fn: function (aSelector){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- $recv($2)._setTestSelector_(aSelector);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.klass)});
- },
- args: ["aSelector"],
- source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["setTestSelector:", "new", "yourself"]
- }),
- $globals.TestCase.klass);
- $core.addMethod(
- $core.method({
- selector: "shouldInheritSelectors",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self.__tild_eq(self._lookupHierarchyRoot());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.klass)});
- },
- args: [],
- source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
- referencedClasses: [],
- messageSends: ["~=", "lookupHierarchyRoot"]
- }),
- $globals.TestCase.klass);
- $core.addMethod(
- $core.method({
- selector: "testSelectors",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv(self._methodDictionary())._keys())._select_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._match_("^test");
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.klass)});
- },
- args: [],
- source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
- referencedClasses: [],
- messageSends: ["select:", "keys", "methodDictionary", "match:"]
- }),
- $globals.TestCase.klass);
- $core.addClass('TestContext', $globals.Object, ['testCase'], 'SUnit');
- $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).";
- $core.addMethod(
- $core.method({
- selector: "execute:",
- protocol: 'running',
- fn: function (aBlock){
- var self=this;
- var failed;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $recv(self["@testCase"])._context_(self);
- $ctx1.sendIdx["context:"]=1;
- $recv((function(){
- return $core.withContext(function($ctx2) {
- failed=true;
- failed;
- $recv(aBlock)._value();
- failed=false;
- return failed;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._ensure_((function(){
- return $core.withContext(function($ctx2) {
- $recv(self["@testCase"])._context_(nil);
- $1=$recv(failed)._and_((function(){
- return $core.withContext(function($ctx3) {
- return $recv(self["@testCase"])._isAsync();
- $ctx3.sendIdx["isAsync"]=1;
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
- }));
- if($core.assert($1)){
- $recv(self["@testCase"])._finished();
- };
- $2=$recv(self["@testCase"])._isAsync();
- if(!$core.assert($2)){
- return $recv(self["@testCase"])._tearDown();
- };
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
- },
- args: ["aBlock"],
- 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 ] ]",
- referencedClasses: [],
- messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
- }),
- $globals.TestContext);
- $core.addMethod(
- $core.method({
- selector: "start",
- protocol: 'running',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._execute_((function(){
- return $core.withContext(function($ctx2) {
- $recv(self["@testCase"])._setUp();
- return $recv(self["@testCase"])._performTest();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
- },
- args: [],
- source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
- referencedClasses: [],
- messageSends: ["execute:", "setUp", "performTest"]
- }),
- $globals.TestContext);
- $core.addMethod(
- $core.method({
- selector: "testCase:",
- protocol: 'accessing',
- fn: function (aTestCase){
- var self=this;
- self["@testCase"]=aTestCase;
- return self;
- },
- args: ["aTestCase"],
- source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.TestContext);
- $core.addMethod(
- $core.method({
- selector: "testCase:",
- protocol: 'instance creation',
- fn: function (aTestCase){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- $recv($2)._testCase_(aTestCase);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.klass)});
- },
- args: ["aTestCase"],
- source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["testCase:", "new", "yourself"]
- }),
- $globals.TestContext.klass);
- $core.addClass('ReportingTestContext', $globals.TestContext, ['finished', 'result'], 'SUnit');
- $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`.";
- $core.addMethod(
- $core.method({
- selector: "execute:",
- protocol: 'running',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return self._withErrorReporting_((function(){
- return $core.withContext(function($ctx3) {
- return (
- $ctx3.supercall = true,
- $globals.ReportingTestContext.superclass.fn.prototype._execute_.apply($recv(self), [aBlock]));
- $ctx3.supercall = false;
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._ensure_((function(){
- return $core.withContext(function($ctx2) {
- $1=$recv(self["@testCase"])._isAsync();
- if(!$core.assert($1)){
- $recv(self["@result"])._increaseRuns();
- return $recv(self["@finished"])._value();
- };
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
- },
- args: ["aBlock"],
- 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 ] ]",
- referencedClasses: [],
- messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
- }),
- $globals.ReportingTestContext);
- $core.addMethod(
- $core.method({
- selector: "finished:",
- protocol: 'accessing',
- fn: function (aBlock){
- var self=this;
- self["@finished"]=aBlock;
- return self;
- },
- args: ["aBlock"],
- source: "finished: aBlock\x0a\x09finished := aBlock",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ReportingTestContext);
- $core.addMethod(
- $core.method({
- selector: "result:",
- protocol: 'accessing',
- fn: function (aTestResult){
- var self=this;
- self["@result"]=aTestResult;
- return self;
- },
- args: ["aTestResult"],
- source: "result: aTestResult\x0a\x09result := aTestResult",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ReportingTestContext);
- $core.addMethod(
- $core.method({
- selector: "withErrorReporting:",
- protocol: 'private',
- fn: function (aBlock){
- var self=this;
- function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return $recv(aBlock)._on_do_($TestFailure(),(function(ex){
- return $core.withContext(function($ctx3) {
- return $recv(self["@result"])._addFailure_(self["@testCase"]);
- }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
- }));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._on_do_($Error(),(function(ex){
- return $core.withContext(function($ctx2) {
- return $recv(self["@result"])._addError_(self["@testCase"]);
- }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
- }));
- $ctx1.sendIdx["on:do:"]=1;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
- },
- args: ["aBlock"],
- 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 ]",
- referencedClasses: ["TestFailure", "Error"],
- messageSends: ["on:do:", "addFailure:", "addError:"]
- }),
- $globals.ReportingTestContext);
- $core.addMethod(
- $core.method({
- selector: "testCase:result:finished:",
- protocol: 'instance creation',
- fn: function (aTestCase,aTestResult,aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=(
- $ctx1.supercall = true,
- $globals.ReportingTestContext.klass.superclass.fn.prototype._testCase_.apply($recv(self), [aTestCase]));
- $ctx1.supercall = false;
- $recv($2)._result_(aTestResult);
- $recv($2)._finished_(aBlock);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.klass)});
- },
- args: ["aTestCase", "aTestResult", "aBlock"],
- source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
- referencedClasses: [],
- messageSends: ["result:", "testCase:", "finished:", "yourself"]
- }),
- $globals.ReportingTestContext.klass);
- $core.addClass('TestFailure', $globals.Error, [], 'SUnit');
- $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.";
- $core.addClass('TestResult', $globals.Object, ['timestamp', 'runs', 'errors', 'failures', 'total'], 'SUnit');
- $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";
- $core.addMethod(
- $core.method({
- selector: "addError:",
- protocol: 'accessing',
- fn: function (anError){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._errors())._add_(anError);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
- },
- args: ["anError"],
- source: "addError: anError\x0a\x09self errors add: anError",
- referencedClasses: [],
- messageSends: ["add:", "errors"]
- }),
- $globals.TestResult);
- $core.addMethod(
- $core.method({
- selector: "addFailure:",
- protocol: 'accessing',
- fn: function (aFailure){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._failures())._add_(aFailure);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
- },
- args: ["aFailure"],
- source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
- referencedClasses: [],
- messageSends: ["add:", "failures"]
- }),
- $globals.TestResult);
- $core.addMethod(
- $core.method({
- selector: "errors",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@errors"];
- return $1;
- },
- args: [],
- source: "errors\x0a\x09^ errors",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.TestResult);
- $core.addMethod(
- $core.method({
- selector: "failures",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@failures"];
- return $1;
- },
- args: [],
- source: "failures\x0a\x09^ failures",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.TestResult);
- $core.addMethod(
- $core.method({
- selector: "increaseRuns",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self["@runs"]=$recv(self["@runs"]).__plus((1));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
- },
- args: [],
- source: "increaseRuns\x0a\x09runs := runs + 1",
- referencedClasses: [],
- messageSends: ["+"]
- }),
- $globals.TestResult);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
- function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.TestResult.superclass.fn.prototype._initialize.apply($recv(self), []));
- $ctx1.supercall = false;
- self["@timestamp"]=$recv($Date())._now();
- self["@runs"]=(0);
- self["@errors"]=$recv($Array())._new();
- $ctx1.sendIdx["new"]=1;
- self["@failures"]=$recv($Array())._new();
- self["@total"]=(0);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
- },
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
- referencedClasses: ["Date", "Array"],
- messageSends: ["initialize", "now", "new"]
- }),
- $globals.TestResult);
- $core.addMethod(
- $core.method({
- selector: "nextRunDo:",
- protocol: 'running',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $3,$2,$1;
- $3=self._runs();
- $ctx1.sendIdx["runs"]=1;
- $2=$recv($3).__eq_eq(self._total());
- if(!$core.assert($2)){
- $1=$recv(aBlock)._value_($recv(self._runs()).__plus((1)));
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
- },
- args: ["aBlock"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
- }),
- $globals.TestResult);
- $core.addMethod(
- $core.method({
- selector: "runCase:",
- protocol: 'running',
- fn: function (aTestCase){
- var self=this;
- function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return $recv((function(){
- return $core.withContext(function($ctx3) {
- self._increaseRuns();
- return $recv(aTestCase)._runCase();
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }))._on_do_($TestFailure(),(function(ex){
- return $core.withContext(function($ctx3) {
- return self._addFailure_(aTestCase);
- }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
- }));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._on_do_($Error(),(function(ex){
- return $core.withContext(function($ctx2) {
- return self._addError_(aTestCase);
- }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
- }));
- $ctx1.sendIdx["on:do:"]=1;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
- },
- args: ["aTestCase"],
- 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 ]",
- referencedClasses: ["TestFailure", "Error"],
- messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
- }),
- $globals.TestResult);
- $core.addMethod(
- $core.method({
- selector: "runs",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@runs"];
- return $1;
- },
- args: [],
- source: "runs\x0a\x09^ runs",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.TestResult);
- $core.addMethod(
- $core.method({
- selector: "status",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv(self._errors())._isEmpty();
- $ctx1.sendIdx["isEmpty"]=1;
- if($core.assert($2)){
- $3=$recv(self._failures())._isEmpty();
- if($core.assert($3)){
- $1="success";
- } else {
- $1="failure";
- };
- } else {
- $1="error";
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
- },
- args: [],
- 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' ]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "isEmpty", "errors", "failures"]
- }),
- $globals.TestResult);
- $core.addMethod(
- $core.method({
- selector: "timestamp",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@timestamp"];
- return $1;
- },
- args: [],
- source: "timestamp\x0a\x09^ timestamp",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.TestResult);
- $core.addMethod(
- $core.method({
- selector: "total",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@total"];
- return $1;
- },
- args: [],
- source: "total\x0a\x09^ total",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.TestResult);
- $core.addMethod(
- $core.method({
- selector: "total:",
- protocol: 'accessing',
- fn: function (aNumber){
- var self=this;
- self["@total"]=aNumber;
- return self;
- },
- args: ["aNumber"],
- source: "total: aNumber\x0a\x09total := aNumber",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.TestResult);
- $core.addClass('TestSuiteRunner', $globals.Object, ['suite', 'result', 'announcer', 'runNextTest'], 'SUnit');
- $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`.";
- $core.addMethod(
- $core.method({
- selector: "announcer",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@announcer"];
- return $1;
- },
- args: [],
- source: "announcer\x0a\x09^ announcer",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.TestSuiteRunner);
- $core.addMethod(
- $core.method({
- selector: "contextOf:",
- protocol: 'private',
- fn: function (anInteger){
- var self=this;
- function $ReportingTestContext(){return $globals.ReportingTestContext||(typeof ReportingTestContext=="undefined"?nil:ReportingTestContext)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($ReportingTestContext())._testCase_result_finished_($recv(self["@suite"])._at_(anInteger),self["@result"],(function(){
- return $core.withContext(function($ctx2) {
- return self._resume();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
- },
- args: ["anInteger"],
- source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
- referencedClasses: ["ReportingTestContext"],
- messageSends: ["testCase:result:finished:", "at:", "resume"]
- }),
- $globals.TestSuiteRunner);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
- function $TestResult(){return $globals.TestResult||(typeof TestResult=="undefined"?nil:TestResult)}
- return $core.withContext(function($ctx1) {
- var $1;
- (
- $ctx1.supercall = true,
- $globals.TestSuiteRunner.superclass.fn.prototype._initialize.apply($recv(self), []));
- $ctx1.supercall = false;
- self["@announcer"]=$recv($Announcer())._new();
- $ctx1.sendIdx["new"]=1;
- self["@result"]=$recv($TestResult())._new();
- self["@runNextTest"]=(function(){
- var runs;
- return $core.withContext(function($ctx2) {
- runs=$recv(self["@result"])._runs();
- runs;
- $1=$recv(runs).__lt($recv(self["@result"])._total());
- if($core.assert($1)){
- return $recv(self._contextOf_($recv(runs).__plus((1))))._start();
- };
- }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
- });
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
- },
- args: [],
- 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 ] ].",
- referencedClasses: ["Announcer", "TestResult"],
- messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
- }),
- $globals.TestSuiteRunner);
- $core.addMethod(
- $core.method({
- selector: "result",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@result"];
- return $1;
- },
- args: [],
- source: "result\x0a\x09^ result",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.TestSuiteRunner);
- $core.addMethod(
- $core.method({
- selector: "resume",
- protocol: 'actions',
- fn: function (){
- var self=this;
- function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
- return $core.withContext(function($ctx1) {
- $recv(self["@runNextTest"])._fork();
- $recv(self["@announcer"])._announce_($recv($recv($ResultAnnouncement())._new())._result_(self["@result"]));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
- },
- args: [],
- source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
- referencedClasses: ["ResultAnnouncement"],
- messageSends: ["fork", "announce:", "result:", "new"]
- }),
- $globals.TestSuiteRunner);
- $core.addMethod(
- $core.method({
- selector: "run",
- protocol: 'actions',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self["@result"])._total_($recv(self["@suite"])._size());
- self._resume();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
- },
- args: [],
- source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
- referencedClasses: [],
- messageSends: ["total:", "size", "resume"]
- }),
- $globals.TestSuiteRunner);
- $core.addMethod(
- $core.method({
- selector: "suite:",
- protocol: 'accessing',
- fn: function (aCollection){
- var self=this;
- self["@suite"]=aCollection;
- return self;
- },
- args: ["aCollection"],
- source: "suite: aCollection\x0a\x09suite := aCollection",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.TestSuiteRunner);
- $core.addMethod(
- $core.method({
- selector: "new",
- protocol: 'instance creation',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._shouldNotImplement();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.klass)});
- },
- args: [],
- source: "new\x0a\x09self shouldNotImplement",
- referencedClasses: [],
- messageSends: ["shouldNotImplement"]
- }),
- $globals.TestSuiteRunner.klass);
- $core.addMethod(
- $core.method({
- selector: "on:",
- protocol: 'instance creation',
- fn: function (aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=(
- $ctx1.supercall = true,
- $globals.TestSuiteRunner.klass.superclass.fn.prototype._new.apply($recv(self), []));
- $ctx1.supercall = false;
- $1=$recv($2)._suite_(aCollection);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.klass)});
- },
- args: ["aCollection"],
- source: "on: aCollection\x0a\x09^ super new suite: aCollection",
- referencedClasses: [],
- messageSends: ["suite:", "new"]
- }),
- $globals.TestSuiteRunner.klass);
- $core.addMethod(
- $core.method({
- selector: "isTestClass",
- protocol: '*SUnit',
- fn: function (){
- var self=this;
- function $TestCase(){return $globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._includesBehavior_($TestCase()))._and_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self._isAbstract())._not();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.Behavior)});
- },
- args: [],
- source: "isTestClass\x0a\x09^(self includesBehavior: TestCase) and: [ \x0a\x09\x09\x09self isAbstract not ]",
- referencedClasses: ["TestCase"],
- messageSends: ["and:", "includesBehavior:", "not", "isAbstract"]
- }),
- $globals.Behavior);
- $core.addMethod(
- $core.method({
- selector: "isTestPackage",
- protocol: '*SUnit',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._classes())._anySatisfy_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._isTestClass();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
- },
- args: [],
- source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
- referencedClasses: [],
- messageSends: ["anySatisfy:", "classes", "isTestClass"]
- }),
- $globals.Package);
- });
- define("amber_core/Compiler-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
- var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
- $core.addPackage('Compiler-Tests');
- $core.packages["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
- $core.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
- $core.addClass('ASTParsingTest', $globals.TestCase, [], 'Compiler-Tests');
- $core.addMethod(
- $core.method({
- selector: "analyze:forClass:",
- protocol: 'convenience',
- fn: function (aNode,aClass){
- var self=this;
- function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
- return $core.withContext(function($ctx1) {
- $recv($recv($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
- return aNode;
- }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTParsingTest)});
- },
- args: ["aNode", "aClass"],
- source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
- referencedClasses: ["SemanticAnalyzer"],
- messageSends: ["visit:", "on:"]
- }),
- $globals.ASTParsingTest);
- $core.addMethod(
- $core.method({
- selector: "parse:",
- protocol: 'parsing',
- fn: function (aString){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Smalltalk())._parse_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTParsingTest)});
- },
- args: ["aString"],
- source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
- referencedClasses: ["Smalltalk"],
- messageSends: ["parse:"]
- }),
- $globals.ASTParsingTest);
- $core.addMethod(
- $core.method({
- selector: "parse:forClass:",
- protocol: 'parsing',
- fn: function (aString,aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._analyze_forClass_(self._parse_(aString),aClass);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
- },
- args: ["aString", "aClass"],
- source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
- referencedClasses: [],
- messageSends: ["analyze:forClass:", "parse:"]
- }),
- $globals.ASTParsingTest);
- $core.addClass('ASTPCNodeVisitorTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
- $core.addMethod(
- $core.method({
- selector: "astPCNodeVisitor",
- protocol: 'factory',
- fn: function (){
- var self=this;
- function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
- function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$4,$5,$1;
- $2=$recv($ASTPCNodeVisitor())._new();
- $ctx1.sendIdx["new"]=1;
- $3=$2;
- $4=$recv($recv($AIContext())._new())._yourself();
- $ctx1.sendIdx["yourself"]=1;
- $recv($3)._context_($4);
- $5=$recv($2)._yourself();
- $1=$5;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
- },
- args: [],
- source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
- referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
- messageSends: ["context:", "new", "yourself"]
- }),
- $globals.ASTPCNodeVisitorTest);
- $core.addMethod(
- $core.method({
- selector: "astPCNodeVisitorForSelector:",
- protocol: 'factory',
- fn: function (aString){
- var self=this;
- function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
- function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$4,$5,$1;
- $2=$recv($ASTPCNodeVisitor())._new();
- $ctx1.sendIdx["new"]=1;
- $recv($2)._selector_(aString);
- $3=$2;
- $4=$recv($recv($AIContext())._new())._yourself();
- $ctx1.sendIdx["yourself"]=1;
- $recv($3)._context_($4);
- $5=$recv($2)._yourself();
- $1=$5;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
- },
- args: ["aString"],
- source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
- referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
- messageSends: ["selector:", "new", "context:", "yourself"]
- }),
- $globals.ASTPCNodeVisitorTest);
- $core.addMethod(
- $core.method({
- selector: "testJSStatementNode",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var ast,visitor;
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- ast=self._parse_forClass_("foo <consolee.log(1)>",$Object());
- $1=self._astPCNodeVisitor();
- $recv($1)._visit_(ast);
- $2=$recv($1)._currentNode();
- self._assert_($recv($2)._isJSStatementNode());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Object"],
- messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
- }),
- $globals.ASTPCNodeVisitorTest);
- $core.addMethod(
- $core.method({
- selector: "testMessageSend",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var ast;
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- ast=self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$Object());
- $1=self._astPCNodeVisitorForSelector_("yourself");
- $recv($1)._visit_(ast);
- $2=$recv($1)._currentNode();
- self._assert_equals_($recv($2)._selector(),"yourself");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
- },
- args: [],
- 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'",
- referencedClasses: ["Object"],
- messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
- }),
- $globals.ASTPCNodeVisitorTest);
- $core.addMethod(
- $core.method({
- selector: "testMessageSendWithBlocks",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var ast;
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- ast=self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$Object());
- $1=self._astPCNodeVisitorForSelector_("yourself");
- $recv($1)._visit_(ast);
- $2=$recv($1)._currentNode();
- self._assert_equals_($recv($2)._selector(),"yourself");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
- },
- args: [],
- 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'",
- referencedClasses: ["Object"],
- messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
- }),
- $globals.ASTPCNodeVisitorTest);
- $core.addMethod(
- $core.method({
- selector: "testMessageSendWithInlining",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var ast;
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- return $core.withContext(function($ctx1) {
- var $3,$4,$2,$1,$5,$6;
- ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
- $ctx1.sendIdx["parse:forClass:"]=1;
- $3=self._astPCNodeVisitorForSelector_("yourself");
- $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
- $recv($3)._visit_(ast);
- $ctx1.sendIdx["visit:"]=1;
- $4=$recv($3)._currentNode();
- $ctx1.sendIdx["currentNode"]=1;
- $2=$4;
- $1=$recv($2)._selector();
- $ctx1.sendIdx["selector"]=1;
- self._assert_equals_($1,"yourself");
- $ctx1.sendIdx["assert:equals:"]=1;
- ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
- $5=self._astPCNodeVisitorForSelector_("asBoolean");
- $recv($5)._visit_(ast);
- $6=$recv($5)._currentNode();
- self._assert_equals_($recv($6)._selector(),"asBoolean");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
- },
- args: [],
- 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'",
- referencedClasses: ["Object"],
- messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
- }),
- $globals.ASTPCNodeVisitorTest);
- $core.addMethod(
- $core.method({
- selector: "testNoMessageSend",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var ast;
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- ast=self._parse_forClass_("foo ^ self",$Object());
- $1=self._astPCNodeVisitor();
- $recv($1)._visit_(ast);
- $2=$recv($1)._currentNode();
- self._assert_($recv($2)._isNil());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Object"],
- messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
- }),
- $globals.ASTPCNodeVisitorTest);
- $core.addMethod(
- $core.method({
- selector: "testPC",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var ast,visitor;
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- ast=self._parse_forClass_("foo <console.log(1)>",$Object());
- $1=self._astPCNodeVisitor();
- $recv($1)._visit_(ast);
- $2=$recv($1)._currentNode();
- self._assert_($recv($2)._isJSStatementNode());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testPC",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Object"],
- messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
- }),
- $globals.ASTPCNodeVisitorTest);
- $core.addClass('ASTPositionTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
- $core.addMethod(
- $core.method({
- selector: "testNodeAtPosition",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var node;
- return $core.withContext(function($ctx1) {
- var $3,$4,$2,$1,$7,$8,$6,$5;
- node=self._parse_("yourself\x0a\x09^ self");
- $ctx1.sendIdx["parse:"]=1;
- $3=node;
- $4=(2).__at((4));
- $ctx1.sendIdx["@"]=1;
- $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
- return nil;
- }));
- $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
- $1=$recv($2)._source();
- self._assert_equals_($1,"self");
- $ctx1.sendIdx["assert:equals:"]=1;
- node=self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
- $ctx1.sendIdx["parse:"]=2;
- $7=node;
- $8=(2).__at((7));
- $ctx1.sendIdx["@"]=2;
- $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
- return nil;
- }));
- $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
- $5=$recv($6)._selector();
- $ctx1.sendIdx["selector"]=1;
- self._assert_equals_($5,"ifTrue:");
- $ctx1.sendIdx["assert:equals:"]=2;
- node=self._parse_("foo\x0a\x09self foo; bar; baz");
- self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
- return nil;
- })))._selector(),"foo");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
- },
- args: [],
- 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'",
- referencedClasses: [],
- messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
- }),
- $globals.ASTPositionTest);
- $core.addClass('CodeGeneratorTest', $globals.ASTParsingTest, ['receiver'], 'Compiler-Tests');
- $core.addMethod(
- $core.method({
- selector: "codeGeneratorClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $CodeGenerator(){return $globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
- return $CodeGenerator();
- },
- args: [],
- source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
- referencedClasses: ["CodeGenerator"],
- messageSends: []
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "compiler",
- protocol: 'factory',
- fn: function (){
- var self=this;
- function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($Compiler())._new();
- $recv($2)._codeGeneratorClass_(self._codeGeneratorClass());
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
- referencedClasses: ["Compiler"],
- messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "setUp",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
- return $core.withContext(function($ctx1) {
- self["@receiver"]=$recv($DoIt())._new();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- source: "setUp\x0a\x09receiver := DoIt new",
- referencedClasses: ["DoIt"],
- messageSends: ["new"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "should:receiver:return:",
- protocol: 'testing',
- fn: function (aString,anObject,aResult){
- var self=this;
- var method,result;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- self["@receiver"]=anObject;
- $1=self._compiler();
- $2=$recv(anObject)._class();
- $ctx1.sendIdx["class"]=1;
- method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
- result=$recv(self["@receiver"])._perform_($recv(method)._selector());
- $recv($recv(anObject)._class())._removeCompiledMethod_(method);
- self._assert_equals_(aResult,result);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
- },
- args: ["aString", "anObject", "aResult"],
- 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",
- referencedClasses: [],
- messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "should:return:",
- protocol: 'testing',
- fn: function (aString,anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._should_receiver_return_(aString,self["@receiver"],anObject);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
- },
- args: ["aString", "anObject"],
- source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
- referencedClasses: [],
- messageSends: ["should:receiver:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "tearDown",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "tearDown\x0a\x09\x22receiver := nil\x22",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testAssignment",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
- $ctx1.sendIdx["should:return:"]=1;
- self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
- $ctx1.sendIdx["should:return:"]=2;
- self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testBackslashSelectors",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("\x5c arg ^ 4",(4));
- $ctx1.sendIdx["should:return:"]=1;
- self._should_return_("\x5c\x5c arg ^ 42",(42));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testBlockReturn",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
- $ctx1.sendIdx["should:return:"]=1;
- self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
- $ctx1.sendIdx["should:return:"]=2;
- self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- 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).",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testCascades",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testCascadesWithInlining",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
- $ctx1.sendIdx["should:return:"]=1;
- self._should_return_("foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testDynamicArrayElementsOrdered",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
- $ctx1.sendIdx["should:return:"]=1;
- self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- 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).",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testDynamicDictionaryElementsOrdered",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- 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)]));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- 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}.",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testDynamicDictionaryWithMoreArrows",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=$recv((1).__minus_gt((2))).__minus_gt((3));
- $ctx1.sendIdx["->"]=1;
- $1=$recv($HashedCollection())._with_($2);
- self._should_return_("foo ^ #{1->2->3}",$1);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
- referencedClasses: ["HashedCollection"],
- messageSends: ["should:return:", "with:", "->"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testGlobalVar",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $BlockClosure(){return $globals.BlockClosure||(typeof BlockClosure=="undefined"?nil:BlockClosure)}
- return $core.withContext(function($ctx1) {
- self._should_return_("foo ^ eval class",$BlockClosure());
- $ctx1.sendIdx["should:return:"]=1;
- self._should_return_("foo ^ Math cos: 0",(1));
- $ctx1.sendIdx["should:return:"]=2;
- self._should_return_("foo ^ NonExistingVar",nil);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- 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",
- referencedClasses: ["BlockClosure"],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testInnerTemporalDependentElementsOrdered",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
- $2="foo".__minus_gt($Array());
- $ctx1.sendIdx["->"]=1;
- $3="bar".__minus_gt((2));
- $ctx1.sendIdx["->"]=2;
- $1=[$2,$3];
- self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
- $ctx1.sendIdx["should:return:"]=1;
- $5="foo".__minus_gt($Array());
- $ctx1.sendIdx["->"]=3;
- $6="bar".__minus_gt((2));
- $ctx1.sendIdx["->"]=4;
- $4=[$5,$6];
- self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
- $ctx1.sendIdx["should:return:"]=2;
- $8="foo".__minus_gt((1));
- $ctx1.sendIdx["->"]=5;
- $9="bar".__minus_gt((2));
- $ctx1.sendIdx["->"]=6;
- $7=[$8,$9];
- self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
- $ctx1.sendIdx["should:return:"]=3;
- $11="foo".__minus_gt((1));
- $ctx1.sendIdx["->"]=7;
- $10=[$11,"bar".__minus_gt((2))];
- self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
- $ctx1.sendIdx["should:return:"]=4;
- 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)]));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- 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}.",
- referencedClasses: ["Array"],
- messageSends: ["should:return:", "->"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testJSStatement",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("foo <return 2+3>",(5));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testLexicalScope",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testLiterals",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("foo ^ 1",(1));
- $ctx1.sendIdx["should:return:"]=1;
- self._should_return_("foo ^ 'hello'","hello");
- $ctx1.sendIdx["should:return:"]=2;
- self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
- $ctx1.sendIdx["should:return:"]=3;
- self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
- $ctx1.sendIdx["should:return:"]=4;
- self._should_return_("foo ^ true",true);
- $ctx1.sendIdx["should:return:"]=5;
- self._should_return_("foo ^ false",false);
- $ctx1.sendIdx["should:return:"]=6;
- self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
- $ctx1.sendIdx["should:return:"]=7;
- self._should_return_("foo ^ #hello","hello");
- $ctx1.sendIdx["should:return:"]=8;
- self._should_return_("foo ^ $h","h");
- $ctx1.sendIdx["should:return:"]=9;
- self._should_return_("foo ^ -123.456",(-123.456));
- $ctx1.sendIdx["should:return:"]=10;
- self._should_return_("foo ^ -2.5e4",(-25000));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- 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.",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testLocalReturn",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("foo ^ 1",(1));
- $ctx1.sendIdx["should:return:"]=1;
- self._should_return_("foo ^ 1 + 1",(2));
- $ctx1.sendIdx["should:return:"]=2;
- self._should_return_("foo ",self["@receiver"]);
- $ctx1.sendIdx["should:return:"]=3;
- self._should_return_("foo self asString",self["@receiver"]);
- $ctx1.sendIdx["should:return:"]=4;
- self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testMessageSends",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("foo ^ 1 asString","1");
- $ctx1.sendIdx["should:return:"]=1;
- self._should_return_("foo ^ 1 + 1",(2));
- $ctx1.sendIdx["should:return:"]=2;
- self._should_return_("foo ^ 1 + 2 * 3",(9));
- $ctx1.sendIdx["should:return:"]=3;
- self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
- $ctx1.sendIdx["should:return:"]=4;
- self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- 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)",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testMultipleSequences",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testMutableLiterals",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- 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)",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testNestedIfTrue",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
- $ctx1.sendIdx["should:return:"]=1;
- self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
- $ctx1.sendIdx["should:return:"]=2;
- self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
- $ctx1.sendIdx["should:return:"]=3;
- self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- 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.",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testNestedSends",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
- return $core.withContext(function($ctx1) {
- self._should_return_("foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString",$recv($recv($Point())._x_y_((2).__at((3)),(4)))._asString());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
- referencedClasses: ["Point"],
- messageSends: ["should:return:", "asString", "x:y:", "@"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testNonLocalReturn",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("foo [ ^ 1 ] value",(1));
- $ctx1.sendIdx["should:return:"]=1;
- self._should_return_("foo [ ^ 1 + 1 ] value",(2));
- $ctx1.sendIdx["should:return:"]=2;
- self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
- $ctx1.sendIdx["should:return:"]=3;
- self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testPascalCaseGlobal",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- self._should_return_("foo ^Object",$recv($recv($Smalltalk())._globals())._at_("Object"));
- $ctx1.sendIdx["should:return:"]=1;
- self._should_return_("foo ^NonExistent",nil);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
- referencedClasses: ["Smalltalk"],
- messageSends: ["should:return:", "at:", "globals"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testSendReceiverAndArgumentsOrdered",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
- return $core.withContext(function($ctx1) {
- self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
- $ctx1.sendIdx["should:return:"]=1;
- self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$Array(),(2)]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- 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}.",
- referencedClasses: ["Array"],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testSuperSend",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_receiver_return_("foo ^ super isBoolean",true,false);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
- referencedClasses: [],
- messageSends: ["should:receiver:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testTempVariables",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("foo | a | ^ a",nil);
- $ctx1.sendIdx["should:return:"]=1;
- self._should_return_("foo | AVariable | ^ AVariable",nil);
- $ctx1.sendIdx["should:return:"]=2;
- self._should_return_("foo | a b c | ^ c",nil);
- $ctx1.sendIdx["should:return:"]=3;
- self._should_return_("foo | a | [ | d | ^ d ] value",nil);
- $ctx1.sendIdx["should:return:"]=4;
- self._should_return_("foo | a | a:= 1. ^ a",(1));
- $ctx1.sendIdx["should:return:"]=5;
- self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- 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.",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testThisContext",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testifFalse",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
- $ctx1.sendIdx["should:return:"]=1;
- self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
- $ctx1.sendIdx["should:return:"]=2;
- self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
- $ctx1.sendIdx["should:return:"]=3;
- self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- 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.",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testifFalseIfTrue",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
- $ctx1.sendIdx["should:return:"]=1;
- self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
- $ctx1.sendIdx["should:return:"]=2;
- self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
- $ctx1.sendIdx["should:return:"]=3;
- self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- 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.",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testifNil",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
- $ctx1.sendIdx["should:return:"]=1;
- self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
- $ctx1.sendIdx["should:return:"]=2;
- self._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]);
- $ctx1.sendIdx["should:return:"]=3;
- self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- 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.",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testifNilIfNotNil",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
- $ctx1.sendIdx["should:return:"]=1;
- self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
- $ctx1.sendIdx["should:return:"]=2;
- self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
- $ctx1.sendIdx["should:return:"]=3;
- self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- 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.",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testifNotNil",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
- $ctx1.sendIdx["should:return:"]=1;
- self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
- $ctx1.sendIdx["should:return:"]=2;
- self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
- $ctx1.sendIdx["should:return:"]=3;
- self._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- 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.",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testifNotNilWithArgument",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
- $ctx1.sendIdx["should:return:"]=1;
- self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
- $ctx1.sendIdx["should:return:"]=2;
- self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
- $ctx1.sendIdx["should:return:"]=3;
- self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
- $ctx1.sendIdx["should:return:"]=4;
- self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
- $ctx1.sendIdx["should:return:"]=5;
- self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testifTrue",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
- $ctx1.sendIdx["should:return:"]=1;
- self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
- $ctx1.sendIdx["should:return:"]=2;
- self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
- $ctx1.sendIdx["should:return:"]=3;
- self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- 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.",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addMethod(
- $core.method({
- selector: "testifTrueIfFalse",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
- $ctx1.sendIdx["should:return:"]=1;
- self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
- $ctx1.sendIdx["should:return:"]=2;
- self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
- $ctx1.sendIdx["should:return:"]=3;
- self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
- },
- args: [],
- 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.",
- referencedClasses: [],
- messageSends: ["should:return:"]
- }),
- $globals.CodeGeneratorTest);
- $core.addClass('ASTInterpreterTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
- $core.addMethod(
- $core.method({
- selector: "analyze:forClass:",
- protocol: 'parsing',
- fn: function (aNode,aClass){
- var self=this;
- function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
- return $core.withContext(function($ctx1) {
- $recv($recv($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
- return aNode;
- }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTInterpreterTest)});
- },
- args: ["aNode", "aClass"],
- source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
- referencedClasses: ["SemanticAnalyzer"],
- messageSends: ["visit:", "on:"]
- }),
- $globals.ASTInterpreterTest);
- $core.addMethod(
- $core.method({
- selector: "interpret:receiver:withArguments:",
- protocol: 'private',
- fn: function (aString,anObject,aDictionary){
- var self=this;
- var ctx,ast,interpreter;
- function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
- function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$5,$6,$4,$receiver;
- interpreter=$recv($ASTInterpreter())._new();
- $ctx1.sendIdx["new"]=1;
- ast=self._parse_forClass_(aString,$recv(anObject)._class());
- $1=$recv($AIContext())._new();
- $recv($1)._receiver_(anObject);
- $recv($1)._interpreter_(interpreter);
- $2=$recv($1)._yourself();
- ctx=$2;
- $3=$recv(ast)._sequenceNode();
- if(($receiver = $3) == null || $receiver.isNil){
- $3;
- } else {
- var sequence;
- sequence=$receiver;
- $recv($recv(sequence)._temps())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(ctx)._defineLocal_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- };
- $recv(aDictionary)._keysAndValuesDo_((function(key,value){
- return $core.withContext(function($ctx2) {
- return $recv(ctx)._localAt_put_(key,value);
- }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
- }));
- $5=interpreter;
- $recv($5)._context_(ctx);
- $recv($5)._interpret_($recv(ast)._nextChild());
- $recv($5)._proceed();
- $6=$recv($5)._result();
- $4=$6;
- return $4;
- }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
- },
- args: ["aString", "anObject", "aDictionary"],
- 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",
- referencedClasses: ["ASTInterpreter", "AIContext"],
- messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpret:", "nextChild", "proceed", "result"]
- }),
- $globals.ASTInterpreterTest);
- $core.addMethod(
- $core.method({
- selector: "parse:",
- protocol: 'parsing',
- fn: function (aString){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($Smalltalk())._parse_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTInterpreterTest)});
- },
- args: ["aString"],
- source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
- referencedClasses: ["Smalltalk"],
- messageSends: ["parse:"]
- }),
- $globals.ASTInterpreterTest);
- $core.addMethod(
- $core.method({
- selector: "parse:forClass:",
- protocol: 'parsing',
- fn: function (aString,aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._analyze_forClass_(self._parse_(aString),aClass);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTInterpreterTest)});
- },
- args: ["aString", "aClass"],
- source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
- referencedClasses: [],
- messageSends: ["analyze:forClass:", "parse:"]
- }),
- $globals.ASTInterpreterTest);
- $core.addMethod(
- $core.method({
- selector: "should:receiver:return:",
- protocol: 'testing',
- fn: function (aString,anObject,aResult){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- self["@receiver"]=anObject;
- $1=self._assert_equals_(self._interpret_receiver_withArguments_(aString,self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
- },
- args: ["aString", "anObject", "aResult"],
- 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",
- referencedClasses: [],
- messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
- }),
- $globals.ASTInterpreterTest);
- $core.addMethod(
- $core.method({
- selector: "should:return:",
- protocol: 'testing',
- fn: function (aString,anObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._should_receiver_return_(aString,self["@receiver"],anObject);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.ASTInterpreterTest)});
- },
- args: ["aString", "anObject"],
- source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString\x0a\x09\x09receiver: receiver\x0a\x09\x09return: anObject",
- referencedClasses: [],
- messageSends: ["should:receiver:return:"]
- }),
- $globals.ASTInterpreterTest);
- $core.addClass('ASTDebuggerTest', $globals.ASTInterpreterTest, [], 'Compiler-Tests');
- $core.addMethod(
- $core.method({
- selector: "interpret:receiver:withArguments:",
- protocol: 'private',
- fn: function (aString,anObject,aDictionary){
- var self=this;
- var ctx,ast,debugger_;
- function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
- function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
- function $ASTDebugger(){return $globals.ASTDebugger||(typeof ASTDebugger=="undefined"?nil:ASTDebugger)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$6,$7,$5,$receiver;
- $1=$recv($AIContext())._new();
- $ctx1.sendIdx["new"]=1;
- $recv($1)._receiver_(anObject);
- $recv($1)._interpreter_($recv($ASTInterpreter())._new());
- $2=$recv($1)._yourself();
- ctx=$2;
- ast=self._parse_forClass_(aString,$recv(anObject)._class());
- $3=$recv(ast)._sequenceNode();
- if(($receiver = $3) == null || $receiver.isNil){
- $3;
- } else {
- var sequence;
- sequence=$receiver;
- $recv($recv(sequence)._temps())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(ctx)._defineLocal_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- };
- $recv(aDictionary)._keysAndValuesDo_((function(key,value){
- return $core.withContext(function($ctx2) {
- return $recv(ctx)._localAt_put_(key,value);
- }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
- }));
- $4=$recv(ctx)._interpreter();
- $ctx1.sendIdx["interpreter"]=1;
- $recv($4)._context_(ctx);
- $ctx1.sendIdx["context:"]=1;
- $recv($recv(ctx)._interpreter())._node_($recv(ast)._nextChild());
- debugger_=$recv($ASTDebugger())._context_(ctx);
- $6=debugger_;
- $recv($6)._proceed();
- $7=$recv($6)._result();
- $5=$7;
- return $5;
- }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
- },
- args: ["aString", "anObject", "aDictionary"],
- 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",
- referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
- messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "nextChild", "proceed", "result"]
- }),
- $globals.ASTDebuggerTest);
- $core.addClass('InliningCodeGeneratorTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
- $core.addMethod(
- $core.method({
- selector: "codeGeneratorClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $InliningCodeGenerator(){return $globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
- return $InliningCodeGenerator();
- },
- args: [],
- source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
- referencedClasses: ["InliningCodeGenerator"],
- messageSends: []
- }),
- $globals.InliningCodeGeneratorTest);
- $core.addClass('ScopeVarTest', $globals.TestCase, [], 'Compiler-Tests');
- $core.addMethod(
- $core.method({
- selector: "testClassRefVar",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var node;
- function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
- function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
- function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- $1=$recv($VariableNode())._new();
- $ctx1.sendIdx["new"]=1;
- $recv($1)._value_("Object");
- $2=$recv($1)._yourself();
- node=$2;
- $3=$recv($SemanticAnalyzer())._new();
- $ctx1.sendIdx["new"]=2;
- $recv($3)._pushScope_($recv($MethodLexicalScope())._new());
- $4=$recv($3)._visit_(node);
- self._assert_($recv($recv(node)._binding())._isClassRefVar());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
- },
- args: [],
- 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",
- referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
- messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
- }),
- $globals.ScopeVarTest);
- $core.addMethod(
- $core.method({
- selector: "testInstanceVar",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var node,scope;
- function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
- function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=$recv($VariableNode())._new();
- $ctx1.sendIdx["new"]=1;
- $recv($1)._value_("bzzz");
- $2=$recv($1)._yourself();
- node=$2;
- scope=$recv($MethodLexicalScope())._new();
- $recv(scope)._addIVar_("bzzz");
- self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
- },
- args: [],
- 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",
- referencedClasses: ["VariableNode", "MethodLexicalScope"],
- messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
- }),
- $globals.ScopeVarTest);
- $core.addMethod(
- $core.method({
- selector: "testPseudoVar",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var node,pseudoVars;
- function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
- function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- pseudoVars=["self", "super", "true", "false", "nil"];
- $recv(pseudoVars)._do_((function(each){
- return $core.withContext(function($ctx2) {
- $1=$recv($VariableNode())._new();
- $ctx2.sendIdx["new"]=1;
- $recv($1)._value_(each);
- $2=$recv($1)._yourself();
- node=$2;
- node;
- return self._assert_($recv($recv($recv($MethodLexicalScope())._new())._bindingFor_(node))._isPseudoVar());
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
- },
- args: [],
- 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]",
- referencedClasses: ["VariableNode", "MethodLexicalScope"],
- messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
- }),
- $globals.ScopeVarTest);
- $core.addMethod(
- $core.method({
- selector: "testTempVar",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var node,scope;
- function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
- function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=$recv($VariableNode())._new();
- $ctx1.sendIdx["new"]=1;
- $recv($1)._value_("bzzz");
- $2=$recv($1)._yourself();
- node=$2;
- scope=$recv($MethodLexicalScope())._new();
- $recv(scope)._addTemp_("bzzz");
- self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
- },
- args: [],
- 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",
- referencedClasses: ["VariableNode", "MethodLexicalScope"],
- messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
- }),
- $globals.ScopeVarTest);
- $core.addMethod(
- $core.method({
- selector: "testUnknownVar",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var node;
- function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
- function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=$recv($VariableNode())._new();
- $ctx1.sendIdx["new"]=1;
- $recv($1)._value_("bzzz");
- $2=$recv($1)._yourself();
- node=$2;
- self._assert_($recv($recv($recv($MethodLexicalScope())._new())._bindingFor_(node))._isNil());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
- },
- args: [],
- source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
- referencedClasses: ["VariableNode", "MethodLexicalScope"],
- messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
- }),
- $globals.ScopeVarTest);
- $core.addClass('SemanticAnalyzerTest', $globals.TestCase, ['analyzer'], 'Compiler-Tests');
- $core.addMethod(
- $core.method({
- selector: "setUp",
- protocol: 'running',
- fn: function (){
- var self=this;
- function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- return $core.withContext(function($ctx1) {
- self["@analyzer"]=$recv($SemanticAnalyzer())._on_($Object());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
- },
- args: [],
- source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
- referencedClasses: ["SemanticAnalyzer", "Object"],
- messageSends: ["on:"]
- }),
- $globals.SemanticAnalyzerTest);
- $core.addMethod(
- $core.method({
- selector: "testAssignment",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var src,ast;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- function $InvalidAssignmentError(){return $globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
- return $core.withContext(function($ctx1) {
- src="foo self := 1";
- ast=$recv($Smalltalk())._parse_(src);
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self["@analyzer"])._visit_(ast);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$InvalidAssignmentError());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
- messageSends: ["parse:", "should:raise:", "visit:"]
- }),
- $globals.SemanticAnalyzerTest);
- $core.addMethod(
- $core.method({
- selector: "testNonLocalReturn",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var src,ast;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- src="foo | a | a + 1. ^ a";
- ast=$recv($Smalltalk())._parse_(src);
- $recv(self["@analyzer"])._visit_(ast);
- self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Smalltalk"],
- messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
- }),
- $globals.SemanticAnalyzerTest);
- $core.addMethod(
- $core.method({
- selector: "testNonLocalReturn2",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var src,ast;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- src="foo | a | a + 1. [ [ ^ a] ]";
- ast=$recv($Smalltalk())._parse_(src);
- $recv(self["@analyzer"])._visit_(ast);
- self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Smalltalk"],
- messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
- }),
- $globals.SemanticAnalyzerTest);
- $core.addMethod(
- $core.method({
- selector: "testScope",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var src,ast;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $4,$3,$2,$1;
- src="foo | a | a + 1. [ | b | b := a ]";
- ast=$recv($Smalltalk())._parse_(src);
- $recv(self["@analyzer"])._visit_(ast);
- $4=$recv($recv($recv(ast)._nodes())._first())._nodes();
- $ctx1.sendIdx["nodes"]=1;
- $3=$recv($4)._last();
- $2=$recv($3)._scope();
- $ctx1.sendIdx["scope"]=1;
- $1=$recv($2).__eq_eq($recv(ast)._scope());
- self._deny_($1);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
- },
- args: [],
- 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.",
- referencedClasses: ["Smalltalk"],
- messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "nodes", "first"]
- }),
- $globals.SemanticAnalyzerTest);
- $core.addMethod(
- $core.method({
- selector: "testScope2",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var src,ast;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $8,$7,$6,$5,$4,$3,$2,$1;
- src="foo | a | a + 1. [ [ | b | b := a ] ]";
- ast=$recv($Smalltalk())._parse_(src);
- $recv(self["@analyzer"])._visit_(ast);
- $8=$recv($recv($recv(ast)._nodes())._first())._nodes();
- $ctx1.sendIdx["nodes"]=3;
- $7=$recv($8)._last();
- $6=$recv($7)._nodes();
- $ctx1.sendIdx["nodes"]=2;
- $5=$recv($6)._first();
- $ctx1.sendIdx["first"]=2;
- $4=$recv($5)._nodes();
- $ctx1.sendIdx["nodes"]=1;
- $3=$recv($4)._first();
- $ctx1.sendIdx["first"]=1;
- $2=$recv($3)._scope();
- $ctx1.sendIdx["scope"]=1;
- $1=$recv($2).__eq_eq($recv(ast)._scope());
- self._deny_($1);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
- },
- args: [],
- 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.",
- referencedClasses: ["Smalltalk"],
- messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "nodes", "last"]
- }),
- $globals.SemanticAnalyzerTest);
- $core.addMethod(
- $core.method({
- selector: "testScopeLevel",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var src,ast;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
- src="foo | a | a + 1. [ [ | b | b := a ] ]";
- ast=$recv($Smalltalk())._parse_(src);
- $recv(self["@analyzer"])._visit_(ast);
- $2=$recv(ast)._scope();
- $ctx1.sendIdx["scope"]=1;
- $1=$recv($2)._scopeLevel();
- $ctx1.sendIdx["scopeLevel"]=1;
- self._assert_equals_($1,(1));
- $ctx1.sendIdx["assert:equals:"]=1;
- $10=$recv($recv($recv(ast)._nodes())._first())._nodes();
- $ctx1.sendIdx["nodes"]=3;
- $9=$recv($10)._last();
- $8=$recv($9)._nodes();
- $ctx1.sendIdx["nodes"]=2;
- $7=$recv($8)._first();
- $ctx1.sendIdx["first"]=2;
- $6=$recv($7)._nodes();
- $ctx1.sendIdx["nodes"]=1;
- $5=$recv($6)._first();
- $ctx1.sendIdx["first"]=1;
- $4=$recv($5)._scope();
- $3=$recv($4)._scopeLevel();
- self._assert_equals_($3,(3));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Smalltalk"],
- messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "nodes", "last"]
- }),
- $globals.SemanticAnalyzerTest);
- $core.addMethod(
- $core.method({
- selector: "testUnknownVariables",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var src,ast;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
- return $core.withContext(function($ctx1) {
- src="foo | a | b + a";
- ast=$recv($Smalltalk())._parse_(src);
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self["@analyzer"])._visit_(ast);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$UnknownVariableError());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Smalltalk", "UnknownVariableError"],
- messageSends: ["parse:", "should:raise:", "visit:"]
- }),
- $globals.SemanticAnalyzerTest);
- $core.addMethod(
- $core.method({
- selector: "testUnknownVariablesWithScope",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var src,ast;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
- return $core.withContext(function($ctx1) {
- src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
- ast=$recv($Smalltalk())._parse_(src);
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self["@analyzer"])._visit_(ast);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$UnknownVariableError());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Smalltalk", "UnknownVariableError"],
- messageSends: ["parse:", "should:raise:", "visit:"]
- }),
- $globals.SemanticAnalyzerTest);
- $core.addMethod(
- $core.method({
- selector: "testVariableShadowing",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var src,ast;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- src="foo | a | a + 1";
- ast=$recv($Smalltalk())._parse_(src);
- $recv(self["@analyzer"])._visit_(ast);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
- },
- args: [],
- source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
- referencedClasses: ["Smalltalk"],
- messageSends: ["parse:", "visit:"]
- }),
- $globals.SemanticAnalyzerTest);
- $core.addMethod(
- $core.method({
- selector: "testVariableShadowing2",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var src,ast;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
- return $core.withContext(function($ctx1) {
- src="foo | a | a + 1. [ | a | a := 2 ]";
- ast=$recv($Smalltalk())._parse_(src);
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self["@analyzer"])._visit_(ast);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$ShadowingVariableError());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Smalltalk", "ShadowingVariableError"],
- messageSends: ["parse:", "should:raise:", "visit:"]
- }),
- $globals.SemanticAnalyzerTest);
- $core.addMethod(
- $core.method({
- selector: "testVariableShadowing3",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var src,ast;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- src="foo | a | a + 1. [ | b | b := 2 ]";
- ast=$recv($Smalltalk())._parse_(src);
- $recv(self["@analyzer"])._visit_(ast);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
- },
- args: [],
- source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
- referencedClasses: ["Smalltalk"],
- messageSends: ["parse:", "visit:"]
- }),
- $globals.SemanticAnalyzerTest);
- $core.addMethod(
- $core.method({
- selector: "testVariableShadowing4",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var src,ast;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
- ast=$recv($Smalltalk())._parse_(src);
- $recv(self["@analyzer"])._visit_(ast);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
- },
- args: [],
- source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
- referencedClasses: ["Smalltalk"],
- messageSends: ["parse:", "visit:"]
- }),
- $globals.SemanticAnalyzerTest);
- $core.addMethod(
- $core.method({
- selector: "testVariableShadowing5",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var src,ast;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
- return $core.withContext(function($ctx1) {
- src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
- ast=$recv($Smalltalk())._parse_(src);
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self["@analyzer"])._visit_(ast);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$ShadowingVariableError());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Smalltalk", "ShadowingVariableError"],
- messageSends: ["parse:", "should:raise:", "visit:"]
- }),
- $globals.SemanticAnalyzerTest);
- $core.addMethod(
- $core.method({
- selector: "testVariablesLookup",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var src,ast;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- 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;
- src="foo | a | a + 1. [ | b | b := a ]";
- ast=$recv($Smalltalk())._parse_(src);
- $recv(self["@analyzer"])._visit_(ast);
- $7=$recv(ast)._nodes();
- $ctx1.sendIdx["nodes"]=2;
- $6=$recv($7)._first();
- $ctx1.sendIdx["first"]=2;
- $5=$recv($6)._nodes();
- $ctx1.sendIdx["nodes"]=1;
- $4=$recv($5)._first();
- $ctx1.sendIdx["first"]=1;
- $3=$recv($4)._receiver();
- $ctx1.sendIdx["receiver"]=1;
- $2=$recv($3)._binding();
- $ctx1.sendIdx["binding"]=1;
- $1=$recv($2)._isTempVar();
- $ctx1.sendIdx["isTempVar"]=1;
- self._assert_($1);
- $ctx1.sendIdx["assert:"]=1;
- $15=$recv(ast)._nodes();
- $ctx1.sendIdx["nodes"]=4;
- $14=$recv($15)._first();
- $ctx1.sendIdx["first"]=4;
- $13=$recv($14)._nodes();
- $ctx1.sendIdx["nodes"]=3;
- $12=$recv($13)._first();
- $ctx1.sendIdx["first"]=3;
- $11=$recv($12)._receiver();
- $10=$recv($11)._binding();
- $ctx1.sendIdx["binding"]=2;
- $9=$recv($10)._scope();
- $ctx1.sendIdx["scope"]=1;
- $16=$recv(ast)._scope();
- $ctx1.sendIdx["scope"]=2;
- $8=$recv($9).__eq_eq($16);
- $ctx1.sendIdx["=="]=1;
- self._assert_($8);
- $ctx1.sendIdx["assert:"]=2;
- $27=$recv(ast)._nodes();
- $ctx1.sendIdx["nodes"]=8;
- $26=$recv($27)._first();
- $ctx1.sendIdx["first"]=7;
- $25=$recv($26)._nodes();
- $ctx1.sendIdx["nodes"]=7;
- $24=$recv($25)._last();
- $ctx1.sendIdx["last"]=1;
- $23=$recv($24)._nodes();
- $ctx1.sendIdx["nodes"]=6;
- $22=$recv($23)._first();
- $ctx1.sendIdx["first"]=6;
- $21=$recv($22)._nodes();
- $ctx1.sendIdx["nodes"]=5;
- $20=$recv($21)._first();
- $ctx1.sendIdx["first"]=5;
- $19=$recv($20)._left();
- $ctx1.sendIdx["left"]=1;
- $18=$recv($19)._binding();
- $ctx1.sendIdx["binding"]=3;
- $17=$recv($18)._isTempVar();
- self._assert_($17);
- $ctx1.sendIdx["assert:"]=3;
- $39=$recv(ast)._nodes();
- $ctx1.sendIdx["nodes"]=12;
- $38=$recv($39)._first();
- $ctx1.sendIdx["first"]=10;
- $37=$recv($38)._nodes();
- $ctx1.sendIdx["nodes"]=11;
- $36=$recv($37)._last();
- $ctx1.sendIdx["last"]=2;
- $35=$recv($36)._nodes();
- $ctx1.sendIdx["nodes"]=10;
- $34=$recv($35)._first();
- $ctx1.sendIdx["first"]=9;
- $33=$recv($34)._nodes();
- $ctx1.sendIdx["nodes"]=9;
- $32=$recv($33)._first();
- $ctx1.sendIdx["first"]=8;
- $31=$recv($32)._left();
- $30=$recv($31)._binding();
- $29=$recv($30)._scope();
- $ctx1.sendIdx["scope"]=3;
- $42=$recv($recv($recv(ast)._nodes())._first())._nodes();
- $ctx1.sendIdx["nodes"]=13;
- $41=$recv($42)._last();
- $40=$recv($41)._scope();
- $28=$recv($29).__eq_eq($40);
- self._assert_($28);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
- },
- args: [],
- 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.",
- referencedClasses: ["Smalltalk"],
- messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "nodes", "==", "scope", "left", "last"]
- }),
- $globals.SemanticAnalyzerTest);
- $core.addClass('AISemanticAnalyzerTest', $globals.SemanticAnalyzerTest, [], 'Compiler-Tests');
- $core.addMethod(
- $core.method({
- selector: "setUp",
- protocol: 'running',
- fn: function (){
- var self=this;
- function $AISemanticAnalyzer(){return $globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)}
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$4,$5,$3,$6;
- $1=$recv($AISemanticAnalyzer())._on_($Object());
- $2=$1;
- $4=$recv($AIContext())._new();
- $recv($4)._defineLocal_("local");
- $recv($4)._localAt_put_("local",(3));
- $5=$recv($4)._yourself();
- $ctx1.sendIdx["yourself"]=1;
- $3=$5;
- $recv($2)._context_($3);
- $6=$recv($1)._yourself();
- self["@analyzer"]=$6;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
- },
- args: [],
- 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",
- referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
- messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
- }),
- $globals.AISemanticAnalyzerTest);
- $core.addMethod(
- $core.method({
- selector: "testContextVariables",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var src,ast;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
- return $core.withContext(function($ctx1) {
- src="foo | a | local + a";
- ast=$recv($Smalltalk())._parse_(src);
- self._shouldnt_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self["@analyzer"])._visit_(ast);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$UnknownVariableError());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Smalltalk", "UnknownVariableError"],
- messageSends: ["parse:", "shouldnt:raise:", "visit:"]
- }),
- $globals.AISemanticAnalyzerTest);
- });
- define("amber_core/Kernel-Tests", ["amber/boot", "amber_core/SUnit", "amber_core/Kernel-Objects"], function($boot){"use strict";
- var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
- $core.addPackage('Kernel-Tests');
- $core.packages["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
- $core.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
- $core.addClass('AnnouncementSubscriptionTest', $globals.TestCase, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "testAddExtensionMethod",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var method,dirty;
- return $core.withContext(function($ctx1) {
- var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
- $2=self._class();
- $ctx1.sendIdx["class"]=1;
- $1=$recv($2)._package();
- $ctx1.sendIdx["package"]=1;
- dirty=$recv($1)._isDirty();
- $ctx1.sendIdx["isDirty"]=1;
- $4=self._class();
- $ctx1.sendIdx["class"]=2;
- $3=$recv($4)._package();
- $ctx1.sendIdx["package"]=2;
- $recv($3)._beClean();
- $5=self._class();
- $ctx1.sendIdx["class"]=3;
- method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
- $8=self._class();
- $ctx1.sendIdx["class"]=4;
- $7=$recv($8)._package();
- $ctx1.sendIdx["package"]=3;
- $6=$recv($7)._isDirty();
- self._deny_($6);
- $9=self._class();
- $ctx1.sendIdx["class"]=5;
- $recv($9)._removeCompiledMethod_(method);
- $10=dirty;
- if($core.assert($10)){
- $recv($recv(self._class())._package())._beDirty();
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
- },
- args: [],
- 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 ]",
- referencedClasses: [],
- messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
- }),
- $globals.AnnouncementSubscriptionTest);
- $core.addMethod(
- $core.method({
- selector: "testHandlesAnnouncement",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var subscription,announcementClass1,announcementClass2,classBuilder;
- function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
- function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
- function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- classBuilder=$recv($ClassBuilder())._new();
- $ctx1.sendIdx["new"]=1;
- announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
- subscription=$recv($recv($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
- $1=$recv(subscription)._handlesAnnouncement_($SystemAnnouncement());
- $ctx1.sendIdx["handlesAnnouncement:"]=1;
- self._assert_equals_($1,true);
- $ctx1.sendIdx["assert:equals:"]=1;
- $2=$recv(subscription)._handlesAnnouncement_(announcementClass1);
- $ctx1.sendIdx["handlesAnnouncement:"]=2;
- self._assert_equals_($2,true);
- $ctx1.sendIdx["assert:equals:"]=2;
- self._assert_equals_($recv(subscription)._handlesAnnouncement_($Object()),false);
- $recv(classBuilder)._basicRemoveClass_(announcementClass1);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
- },
- args: [],
- 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.",
- referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
- messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
- }),
- $globals.AnnouncementSubscriptionTest);
- $core.addClass('AnnouncerTest', $globals.TestCase, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "testOnDo",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var counter,announcer;
- function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
- function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- counter=(0);
- announcer=$recv($Announcer())._new();
- $ctx1.sendIdx["new"]=1;
- $recv(announcer)._on_do_($SystemAnnouncement(),(function(){
- return $core.withContext(function($ctx2) {
- counter=$recv(counter).__plus((1));
- return counter;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $1=announcer;
- $2=$recv($SystemAnnouncement())._new();
- $ctx1.sendIdx["new"]=2;
- $recv($1)._announce_($2);
- $ctx1.sendIdx["announce:"]=1;
- self._assert_equals_(counter,(1));
- $ctx1.sendIdx["assert:equals:"]=1;
- $recv(announcer)._announce_($recv($SystemAnnouncement())._new());
- self._assert_equals_(counter,(2));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
- },
- args: [],
- 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.",
- referencedClasses: ["Announcer", "SystemAnnouncement"],
- messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
- }),
- $globals.AnnouncerTest);
- $core.addMethod(
- $core.method({
- selector: "testOnDoFor",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var counter,announcer;
- function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
- function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- counter=(0);
- announcer=$recv($Announcer())._new();
- $ctx1.sendIdx["new"]=1;
- $recv(announcer)._on_do_for_($SystemAnnouncement(),(function(){
- return $core.withContext(function($ctx2) {
- counter=$recv(counter).__plus((1));
- return counter;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),self);
- $1=announcer;
- $2=$recv($SystemAnnouncement())._new();
- $ctx1.sendIdx["new"]=2;
- $recv($1)._announce_($2);
- $ctx1.sendIdx["announce:"]=1;
- self._assert_equals_(counter,(1));
- $ctx1.sendIdx["assert:equals:"]=1;
- $3=announcer;
- $4=$recv($SystemAnnouncement())._new();
- $ctx1.sendIdx["new"]=3;
- $recv($3)._announce_($4);
- $ctx1.sendIdx["announce:"]=2;
- self._assert_equals_(counter,(2));
- $ctx1.sendIdx["assert:equals:"]=2;
- $recv(announcer)._unsubscribe_(self);
- $recv(announcer)._announce_($recv($SystemAnnouncement())._new());
- self._assert_equals_(counter,(2));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
- },
- args: [],
- 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.",
- referencedClasses: ["Announcer", "SystemAnnouncement"],
- messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
- }),
- $globals.AnnouncerTest);
- $core.addMethod(
- $core.method({
- selector: "testOnDoOnce",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var counter,announcer;
- function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
- function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- counter=(0);
- announcer=$recv($Announcer())._new();
- $ctx1.sendIdx["new"]=1;
- $recv(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
- return $core.withContext(function($ctx2) {
- counter=$recv(counter).__plus((1));
- return counter;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $1=announcer;
- $2=$recv($SystemAnnouncement())._new();
- $ctx1.sendIdx["new"]=2;
- $recv($1)._announce_($2);
- $ctx1.sendIdx["announce:"]=1;
- self._assert_equals_(counter,(1));
- $ctx1.sendIdx["assert:equals:"]=1;
- $recv(announcer)._announce_($recv($SystemAnnouncement())._new());
- self._assert_equals_(counter,(1));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
- },
- args: [],
- 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.",
- referencedClasses: ["Announcer", "SystemAnnouncement"],
- messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
- }),
- $globals.AnnouncerTest);
- $core.addClass('BlockClosureTest', $globals.TestCase, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "localReturnOnDoCatch",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- var $early={};
- try {
- $recv((function(){
- throw $early=[(2)];
- }))._on_do_($Error(),(function(){
- }));
- return (3);
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
- },
- args: [],
- source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
- referencedClasses: ["Error"],
- messageSends: ["on:do:"]
- }),
- $globals.BlockClosureTest);
- $core.addMethod(
- $core.method({
- selector: "localReturnOnDoMiss",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- function $Class(){return $globals.Class||(typeof Class=="undefined"?nil:Class)}
- return $core.withContext(function($ctx1) {
- var $early={};
- try {
- $recv((function(){
- throw $early=[(2)];
- }))._on_do_($Class(),(function(){
- }));
- return (3);
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
- },
- args: [],
- source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
- referencedClasses: ["Class"],
- messageSends: ["on:do:"]
- }),
- $globals.BlockClosureTest);
- $core.addMethod(
- $core.method({
- selector: "testCanClearInterval",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- self._shouldnt_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv($recv((function(){
- return $core.withContext(function($ctx3) {
- return $recv($recv($Error())._new())._signal();
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }))._valueWithInterval_((0)))._clearInterval();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$Error());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
- },
- args: [],
- source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
- referencedClasses: ["Error"],
- messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
- }),
- $globals.BlockClosureTest);
- $core.addMethod(
- $core.method({
- selector: "testCanClearTimeout",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- self._shouldnt_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv($recv((function(){
- return $core.withContext(function($ctx3) {
- return $recv($recv($Error())._new())._signal();
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }))._valueWithTimeout_((0)))._clearTimeout();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$Error());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
- },
- args: [],
- source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
- referencedClasses: ["Error"],
- messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
- }),
- $globals.BlockClosureTest);
- $core.addMethod(
- $core.method({
- selector: "testCompiledSource",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_($recv($recv((function(){
- return $core.withContext(function($ctx2) {
- return (1).__plus((1));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._compiledSource())._includesSubString_("function"));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
- },
- args: [],
- source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
- referencedClasses: [],
- messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
- }),
- $globals.BlockClosureTest);
- $core.addMethod(
- $core.method({
- selector: "testCurrySelf",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var curriedMethod,array;
- function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
- function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
- return $core.withContext(function($ctx1) {
- curriedMethod=$recv($recv((function(selfarg,x){
- return $core.withContext(function($ctx2) {
- return $recv(selfarg)._at_(x);
- }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
- }))._currySelf())._asCompiledMethod_("foo:");
- array=[(3), (1), (4)];
- $recv($recv($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return self._assert_equals_($recv(array)._foo_((2)),(1));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }))._ensure_((function(){
- return $core.withContext(function($ctx2) {
- return $recv($Array())._removeCompiledMethod_(curriedMethod);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
- },
- args: [],
- 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 ]",
- referencedClasses: ["ClassBuilder", "Array"],
- messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
- }),
- $globals.BlockClosureTest);
- $core.addMethod(
- $core.method({
- selector: "testEnsure",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_($recv((function(){
- return (3);
- }))._ensure_((function(){
- return (4);
- })),(3));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
- },
- args: [],
- source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
- referencedClasses: [],
- messageSends: ["assert:equals:", "ensure:"]
- }),
- $globals.BlockClosureTest);
- $core.addMethod(
- $core.method({
- selector: "testEnsureRaises",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv((function(){
- return $core.withContext(function($ctx3) {
- return $recv($recv($Error())._new())._signal();
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }))._ensure_((function(){
- return true;
- }));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$Error());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
- },
- args: [],
- source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
- referencedClasses: ["Error"],
- messageSends: ["should:raise:", "ensure:", "signal", "new"]
- }),
- $globals.BlockClosureTest);
- $core.addMethod(
- $core.method({
- selector: "testExceptionSemantics",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- self._timeout_((100));
- $recv(self._async_((function(){
- return $core.withContext(function($ctx2) {
- return $recv((function(){
- return $core.withContext(function($ctx3) {
- self._assert_(true);
- $recv($Error())._signal();
- self._deny_(true);
- return self._finished();
- $ctx3.sendIdx["finished"]=1;
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }))._on_do_($Error(),(function(ex){
- return $core.withContext(function($ctx3) {
- return self._finished();
- }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
- }));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- })))._valueWithTimeout_((0));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Error"],
- messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
- }),
- $globals.BlockClosureTest);
- $core.addMethod(
- $core.method({
- selector: "testLocalReturnOnDoCatch",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_(self._localReturnOnDoCatch(),(2));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
- },
- args: [],
- source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
- referencedClasses: [],
- messageSends: ["assert:equals:", "localReturnOnDoCatch"]
- }),
- $globals.BlockClosureTest);
- $core.addMethod(
- $core.method({
- selector: "testLocalReturnOnDoMiss",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_(self._localReturnOnDoMiss(),(2));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
- },
- args: [],
- source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
- referencedClasses: [],
- messageSends: ["assert:equals:", "localReturnOnDoMiss"]
- }),
- $globals.BlockClosureTest);
- $core.addMethod(
- $core.method({
- selector: "testNewWithValues",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- function TestConstructor(arg1, arg2, arg3) {}
- TestConstructor.prototype.name = 'theTestPrototype';
- var wrappedConstructor = $recv(TestConstructor);
- var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
- self._assert_(result instanceof TestConstructor);
- self._assert_equals_(result.name, 'theTestPrototype');
- "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
- self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, $globals.Error);;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
- },
- args: [],
- 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>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BlockClosureTest);
- $core.addMethod(
- $core.method({
- selector: "testNumArgs",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv((function(){
- }))._numArgs();
- $ctx1.sendIdx["numArgs"]=1;
- self._assert_equals_($1,(0));
- $ctx1.sendIdx["assert:equals:"]=1;
- self._assert_equals_($recv((function(a,b){
- }))._numArgs(),(2));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
- },
- args: [],
- source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
- referencedClasses: [],
- messageSends: ["assert:equals:", "numArgs"]
- }),
- $globals.BlockClosureTest);
- $core.addMethod(
- $core.method({
- selector: "testOnDo",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- self._assert_($recv((function(){
- return $core.withContext(function($ctx2) {
- return $recv($recv($Error())._new())._signal();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._on_do_($Error(),(function(ex){
- return true;
- })));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
- },
- args: [],
- source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
- referencedClasses: ["Error"],
- messageSends: ["assert:", "on:do:", "signal", "new"]
- }),
- $globals.BlockClosureTest);
- $core.addMethod(
- $core.method({
- selector: "testValue",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv((function(){
- return $core.withContext(function($ctx2) {
- return (1).__plus((1));
- $ctx2.sendIdx["+"]=1;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._value();
- $ctx1.sendIdx["value"]=1;
- self._assert_equals_($1,(2));
- $ctx1.sendIdx["assert:equals:"]=1;
- self._assert_equals_($recv((function(x){
- return $core.withContext(function($ctx2) {
- return $recv(x).__plus((1));
- }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
- }))._value_((2)),(3));
- $ctx1.sendIdx["assert:equals:"]=2;
- self._assert_equals_($recv((function(x,y){
- return $core.withContext(function($ctx2) {
- return $recv(x).__star(y);
- }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
- }))._value_value_((2),(4)),(8));
- $ctx1.sendIdx["assert:equals:"]=3;
- self._assert_equals_($recv((function(a,b,c){
- return (1);
- }))._value(),(1));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
- }),
- $globals.BlockClosureTest);
- $core.addMethod(
- $core.method({
- selector: "testValueWithPossibleArguments",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=$recv((function(){
- return (1);
- }))._valueWithPossibleArguments_([(3), (4)]);
- $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
- self._assert_equals_($1,(1));
- $ctx1.sendIdx["assert:equals:"]=1;
- $2=$recv((function(a){
- return $core.withContext(function($ctx2) {
- return $recv(a).__plus((4));
- $ctx2.sendIdx["+"]=1;
- }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
- }))._valueWithPossibleArguments_([(3), (4)]);
- $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
- self._assert_equals_($2,(7));
- $ctx1.sendIdx["assert:equals:"]=2;
- self._assert_equals_($recv((function(a,b){
- return $core.withContext(function($ctx2) {
- return $recv(a).__plus(b);
- }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
- }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
- },
- args: [],
- 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.",
- referencedClasses: [],
- messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
- }),
- $globals.BlockClosureTest);
- $core.addMethod(
- $core.method({
- selector: "testWhileFalse",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var i;
- return $core.withContext(function($ctx1) {
- i=(0);
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return $recv(i).__gt((5));
- $ctx2.sendIdx[">"]=1;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._whileFalse_((function(){
- return $core.withContext(function($ctx2) {
- i=$recv(i).__plus((1));
- $ctx2.sendIdx["+"]=1;
- return i;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- self._assert_equals_(i,(6));
- $ctx1.sendIdx["assert:equals:"]=1;
- i=(0);
- $recv((function(){
- return $core.withContext(function($ctx2) {
- i=$recv(i).__plus((1));
- i;
- return $recv(i).__gt((5));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }))._whileFalse();
- self._assert_equals_(i,(6));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
- }),
- $globals.BlockClosureTest);
- $core.addMethod(
- $core.method({
- selector: "testWhileTrue",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var i;
- return $core.withContext(function($ctx1) {
- i=(0);
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return $recv(i).__lt((5));
- $ctx2.sendIdx["<"]=1;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._whileTrue_((function(){
- return $core.withContext(function($ctx2) {
- i=$recv(i).__plus((1));
- $ctx2.sendIdx["+"]=1;
- return i;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- self._assert_equals_(i,(5));
- $ctx1.sendIdx["assert:equals:"]=1;
- i=(0);
- $recv((function(){
- return $core.withContext(function($ctx2) {
- i=$recv(i).__plus((1));
- i;
- return $recv(i).__lt((5));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }))._whileTrue();
- self._assert_equals_(i,(5));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
- }),
- $globals.BlockClosureTest);
- $core.addClass('BooleanTest', $globals.TestCase, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "testEquality",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
- $1=(0).__eq(false);
- $ctx1.sendIdx["="]=1;
- self._deny_($1);
- $ctx1.sendIdx["deny:"]=1;
- $2=false.__eq((0));
- $ctx1.sendIdx["="]=2;
- self._deny_($2);
- $ctx1.sendIdx["deny:"]=2;
- $3="".__eq(false);
- $ctx1.sendIdx["="]=3;
- self._deny_($3);
- $ctx1.sendIdx["deny:"]=3;
- $4=false.__eq("");
- $ctx1.sendIdx["="]=4;
- self._deny_($4);
- $ctx1.sendIdx["deny:"]=4;
- $5=true.__eq(true);
- $ctx1.sendIdx["="]=5;
- self._assert_($5);
- $ctx1.sendIdx["assert:"]=1;
- $6=false.__eq(true);
- $ctx1.sendIdx["="]=6;
- self._deny_($6);
- $ctx1.sendIdx["deny:"]=5;
- $7=true.__eq(false);
- $ctx1.sendIdx["="]=7;
- self._deny_($7);
- $8=false.__eq(false);
- $ctx1.sendIdx["="]=8;
- self._assert_($8);
- $ctx1.sendIdx["assert:"]=2;
- $10=true._yourself();
- $ctx1.sendIdx["yourself"]=1;
- $9=$recv($10).__eq(true);
- $ctx1.sendIdx["="]=9;
- self._assert_($9);
- $ctx1.sendIdx["assert:"]=3;
- $12=true._yourself();
- $ctx1.sendIdx["yourself"]=2;
- $11=$recv($12).__eq(true._yourself());
- self._assert_($11);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
- },
- args: [],
- 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)",
- referencedClasses: [],
- messageSends: ["deny:", "=", "assert:", "yourself"]
- }),
- $globals.BooleanTest);
- $core.addMethod(
- $core.method({
- selector: "testIdentity",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
- $1=(0).__eq_eq(false);
- $ctx1.sendIdx["=="]=1;
- self._deny_($1);
- $ctx1.sendIdx["deny:"]=1;
- $2=false.__eq_eq((0));
- $ctx1.sendIdx["=="]=2;
- self._deny_($2);
- $ctx1.sendIdx["deny:"]=2;
- $3="".__eq_eq(false);
- $ctx1.sendIdx["=="]=3;
- self._deny_($3);
- $ctx1.sendIdx["deny:"]=3;
- $4=false.__eq_eq("");
- $ctx1.sendIdx["=="]=4;
- self._deny_($4);
- $ctx1.sendIdx["deny:"]=4;
- $5=true.__eq_eq(true);
- $ctx1.sendIdx["=="]=5;
- self._assert_($5);
- $ctx1.sendIdx["assert:"]=1;
- $6=false.__eq_eq(true);
- $ctx1.sendIdx["=="]=6;
- self._deny_($6);
- $ctx1.sendIdx["deny:"]=5;
- $7=true.__eq_eq(false);
- $ctx1.sendIdx["=="]=7;
- self._deny_($7);
- $8=false.__eq_eq(false);
- $ctx1.sendIdx["=="]=8;
- self._assert_($8);
- $ctx1.sendIdx["assert:"]=2;
- $10=true._yourself();
- $ctx1.sendIdx["yourself"]=1;
- $9=$recv($10).__eq_eq(true);
- $ctx1.sendIdx["=="]=9;
- self._assert_($9);
- $ctx1.sendIdx["assert:"]=3;
- $12=true._yourself();
- $ctx1.sendIdx["yourself"]=2;
- $11=$recv($12).__eq_eq(true._yourself());
- self._assert_($11);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["deny:", "==", "assert:", "yourself"]
- }),
- $globals.BooleanTest);
- $core.addMethod(
- $core.method({
- selector: "testIfTrueIfFalse",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5,$6,$7,$8;
- if($core.assert(true)){
- $1="alternative block";
- };
- self._assert_equals_($1,"alternative block");
- $ctx1.sendIdx["assert:equals:"]=1;
- if(!$core.assert(true)){
- $2="alternative block";
- };
- self._assert_equals_($2,nil);
- $ctx1.sendIdx["assert:equals:"]=2;
- if($core.assert(false)){
- $3="alternative block";
- };
- self._assert_equals_($3,nil);
- $ctx1.sendIdx["assert:equals:"]=3;
- if(!$core.assert(false)){
- $4="alternative block";
- };
- self._assert_equals_($4,"alternative block");
- $ctx1.sendIdx["assert:equals:"]=4;
- if($core.assert(false)){
- $5="alternative block";
- } else {
- $5="alternative block2";
- };
- self._assert_equals_($5,"alternative block2");
- $ctx1.sendIdx["assert:equals:"]=5;
- if($core.assert(false)){
- $6="alternative block2";
- } else {
- $6="alternative block";
- };
- self._assert_equals_($6,"alternative block");
- $ctx1.sendIdx["assert:equals:"]=6;
- if($core.assert(true)){
- $7="alternative block";
- } else {
- $7="alternative block2";
- };
- self._assert_equals_($7,"alternative block");
- $ctx1.sendIdx["assert:equals:"]=7;
- if($core.assert(true)){
- $8="alternative block2";
- } else {
- $8="alternative block";
- };
- self._assert_equals_($8,"alternative block2");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
- },
- args: [],
- 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'.",
- referencedClasses: [],
- messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
- }),
- $globals.BooleanTest);
- $core.addMethod(
- $core.method({
- selector: "testIfTrueIfFalseWithBoxing",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
- $2=true._yourself();
- $ctx1.sendIdx["yourself"]=1;
- if($core.assert($2)){
- $1="alternative block";
- };
- self._assert_equals_($1,"alternative block");
- $ctx1.sendIdx["assert:equals:"]=1;
- $4=true._yourself();
- $ctx1.sendIdx["yourself"]=2;
- if(!$core.assert($4)){
- $3="alternative block";
- };
- self._assert_equals_($3,nil);
- $ctx1.sendIdx["assert:equals:"]=2;
- $6=false._yourself();
- $ctx1.sendIdx["yourself"]=3;
- if($core.assert($6)){
- $5="alternative block";
- };
- self._assert_equals_($5,nil);
- $ctx1.sendIdx["assert:equals:"]=3;
- $8=false._yourself();
- $ctx1.sendIdx["yourself"]=4;
- if(!$core.assert($8)){
- $7="alternative block";
- };
- self._assert_equals_($7,"alternative block");
- $ctx1.sendIdx["assert:equals:"]=4;
- $10=false._yourself();
- $ctx1.sendIdx["yourself"]=5;
- if($core.assert($10)){
- $9="alternative block";
- } else {
- $9="alternative block2";
- };
- self._assert_equals_($9,"alternative block2");
- $ctx1.sendIdx["assert:equals:"]=5;
- $12=false._yourself();
- $ctx1.sendIdx["yourself"]=6;
- if($core.assert($12)){
- $11="alternative block2";
- } else {
- $11="alternative block";
- };
- self._assert_equals_($11,"alternative block");
- $ctx1.sendIdx["assert:equals:"]=6;
- $14=true._yourself();
- $ctx1.sendIdx["yourself"]=7;
- if($core.assert($14)){
- $13="alternative block";
- } else {
- $13="alternative block2";
- };
- self._assert_equals_($13,"alternative block");
- $ctx1.sendIdx["assert:equals:"]=7;
- $16=true._yourself();
- if($core.assert($16)){
- $15="alternative block2";
- } else {
- $15="alternative block";
- };
- self._assert_equals_($15,"alternative block2");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
- },
- args: [],
- 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'.",
- referencedClasses: [],
- messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
- }),
- $globals.BooleanTest);
- $core.addMethod(
- $core.method({
- selector: "testLogic",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- 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;
- $1=true.__and(true);
- $ctx1.sendIdx["&"]=1;
- self._assert_($1);
- $ctx1.sendIdx["assert:"]=1;
- $2=true.__and(false);
- $ctx1.sendIdx["&"]=2;
- self._deny_($2);
- $ctx1.sendIdx["deny:"]=1;
- $3=false.__and(true);
- $ctx1.sendIdx["&"]=3;
- self._deny_($3);
- $ctx1.sendIdx["deny:"]=2;
- $5=false.__and(false);
- $ctx1.sendIdx["&"]=4;
- $4=self._deny_($5);
- $ctx1.sendIdx["deny:"]=3;
- $6=true.__or(true);
- $ctx1.sendIdx["|"]=1;
- self._assert_($6);
- $ctx1.sendIdx["assert:"]=2;
- $7=true.__or(false);
- $ctx1.sendIdx["|"]=2;
- self._assert_($7);
- $ctx1.sendIdx["assert:"]=3;
- $8=false.__or(true);
- $ctx1.sendIdx["|"]=3;
- self._assert_($8);
- $ctx1.sendIdx["assert:"]=4;
- $10=false.__or(false);
- $ctx1.sendIdx["|"]=4;
- $9=self._deny_($10);
- $ctx1.sendIdx["deny:"]=4;
- $12=(1).__gt((0));
- $ctx1.sendIdx[">"]=1;
- $11=true.__and($12);
- $ctx1.sendIdx["&"]=5;
- self._assert_($11);
- $ctx1.sendIdx["assert:"]=5;
- $14=(1).__gt((0));
- $ctx1.sendIdx[">"]=2;
- $13=$recv($14).__and(false);
- $ctx1.sendIdx["&"]=6;
- self._deny_($13);
- $ctx1.sendIdx["deny:"]=5;
- $17=(1).__gt((0));
- $ctx1.sendIdx[">"]=3;
- $18=(1).__gt((2));
- $ctx1.sendIdx[">"]=4;
- $16=$recv($17).__and($18);
- $15=self._deny_($16);
- $20=(1).__gt((0));
- $ctx1.sendIdx[">"]=5;
- $19=false.__or($20);
- $ctx1.sendIdx["|"]=5;
- self._assert_($19);
- $ctx1.sendIdx["assert:"]=6;
- $22=(1).__gt((0));
- $ctx1.sendIdx[">"]=6;
- $21=$recv($22).__or(false);
- $ctx1.sendIdx["|"]=6;
- self._assert_($21);
- $ctx1.sendIdx["assert:"]=7;
- $25=(1).__gt((0));
- $ctx1.sendIdx[">"]=7;
- $24=$recv($25).__or((1).__gt((2)));
- $23=self._assert_($24);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
- },
- args: [],
- 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))",
- referencedClasses: [],
- messageSends: ["assert:", "&", "deny:", "|", ">"]
- }),
- $globals.BooleanTest);
- $core.addMethod(
- $core.method({
- selector: "testLogicKeywords",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
- $1=true._and_((function(){
- return true;
- }));
- $ctx1.sendIdx["and:"]=1;
- self._assert_($1);
- $ctx1.sendIdx["assert:"]=1;
- $2=true._and_((function(){
- return false;
- }));
- $ctx1.sendIdx["and:"]=2;
- self._deny_($2);
- $ctx1.sendIdx["deny:"]=1;
- $3=false._and_((function(){
- return true;
- }));
- $ctx1.sendIdx["and:"]=3;
- self._deny_($3);
- $ctx1.sendIdx["deny:"]=2;
- $5=false._and_((function(){
- return false;
- }));
- $ctx1.sendIdx["and:"]=4;
- $4=self._deny_($5);
- $ctx1.sendIdx["deny:"]=3;
- $6=true._or_((function(){
- return true;
- }));
- $ctx1.sendIdx["or:"]=1;
- self._assert_($6);
- $ctx1.sendIdx["assert:"]=2;
- $7=true._or_((function(){
- return false;
- }));
- $ctx1.sendIdx["or:"]=2;
- self._assert_($7);
- $ctx1.sendIdx["assert:"]=3;
- $8=false._or_((function(){
- return true;
- }));
- $ctx1.sendIdx["or:"]=3;
- self._assert_($8);
- $ctx1.sendIdx["assert:"]=4;
- $10=false._or_((function(){
- return false;
- }));
- $ctx1.sendIdx["or:"]=4;
- $9=self._deny_($10);
- $ctx1.sendIdx["deny:"]=4;
- $11=true._and_((function(){
- return $core.withContext(function($ctx2) {
- return (1).__gt((0));
- $ctx2.sendIdx[">"]=1;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
- }));
- $ctx1.sendIdx["and:"]=5;
- self._assert_($11);
- $ctx1.sendIdx["assert:"]=5;
- $13=(1).__gt((0));
- $ctx1.sendIdx[">"]=2;
- $12=$recv($13)._and_((function(){
- return false;
- }));
- $ctx1.sendIdx["and:"]=6;
- self._deny_($12);
- $ctx1.sendIdx["deny:"]=5;
- $16=(1).__gt((0));
- $ctx1.sendIdx[">"]=3;
- $15=$recv($16)._and_((function(){
- return $core.withContext(function($ctx2) {
- return (1).__gt((2));
- $ctx2.sendIdx[">"]=4;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
- }));
- $14=self._deny_($15);
- $17=false._or_((function(){
- return $core.withContext(function($ctx2) {
- return (1).__gt((0));
- $ctx2.sendIdx[">"]=5;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
- }));
- $ctx1.sendIdx["or:"]=5;
- self._assert_($17);
- $ctx1.sendIdx["assert:"]=6;
- $19=(1).__gt((0));
- $ctx1.sendIdx[">"]=6;
- $18=$recv($19)._or_((function(){
- return false;
- }));
- $ctx1.sendIdx["or:"]=6;
- self._assert_($18);
- $ctx1.sendIdx["assert:"]=7;
- $22=(1).__gt((0));
- $ctx1.sendIdx[">"]=7;
- $21=$recv($22)._or_((function(){
- return $core.withContext(function($ctx2) {
- return (1).__gt((2));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
- }));
- $20=self._assert_($21);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
- },
- args: [],
- 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 ])",
- referencedClasses: [],
- messageSends: ["assert:", "and:", "deny:", "or:", ">"]
- }),
- $globals.BooleanTest);
- $core.addMethod(
- $core.method({
- selector: "testNonBooleanError",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $NonBooleanReceiver(){return $globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
- return $core.withContext(function($ctx1) {
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- if($core.assert("")){
- } else {
- };
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$NonBooleanReceiver());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
- },
- args: [],
- source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
- referencedClasses: ["NonBooleanReceiver"],
- messageSends: ["should:raise:", "ifTrue:ifFalse:"]
- }),
- $globals.BooleanTest);
- $core.addClass('ClassBuilderTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "setUp",
- protocol: 'running',
- fn: function (){
- var self=this;
- function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
- return $core.withContext(function($ctx1) {
- self["@builder"]=$recv($ClassBuilder())._new();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
- },
- args: [],
- source: "setUp\x0a\x09builder := ClassBuilder new",
- referencedClasses: ["ClassBuilder"],
- messageSends: ["new"]
- }),
- $globals.ClassBuilderTest);
- $core.addMethod(
- $core.method({
- selector: "tearDown",
- protocol: 'running',
- fn: function (){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $1,$receiver;
- $1=self["@theClass"];
- if(($receiver = $1) == null || $receiver.isNil){
- $1;
- } else {
- $recv($Smalltalk())._removeClass_(self["@theClass"]);
- self["@theClass"]=nil;
- self["@theClass"];
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
- },
- args: [],
- source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
- referencedClasses: ["Smalltalk"],
- messageSends: ["ifNotNil:", "removeClass:"]
- }),
- $globals.ClassBuilderTest);
- $core.addMethod(
- $core.method({
- selector: "testClassCopy",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$4,$3,$6,$5,$8,$7;
- self["@theClass"]=$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
- $2=$recv(self["@theClass"])._superclass();
- $ctx1.sendIdx["superclass"]=1;
- $1=$recv($2).__eq_eq($recv($ObjectMock())._superclass());
- $ctx1.sendIdx["=="]=1;
- self._assert_($1);
- $ctx1.sendIdx["assert:"]=1;
- $4=$recv(self["@theClass"])._instanceVariableNames();
- $ctx1.sendIdx["instanceVariableNames"]=1;
- $3=$recv($4).__eq_eq($recv($ObjectMock())._instanceVariableNames());
- $ctx1.sendIdx["=="]=2;
- self._assert_($3);
- $ctx1.sendIdx["assert:"]=2;
- self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
- $ctx1.sendIdx["assert:equals:"]=1;
- $6=$recv(self["@theClass"])._package();
- $ctx1.sendIdx["package"]=1;
- $5=$recv($6).__eq_eq($recv($ObjectMock())._package());
- self._assert_($5);
- $8=$recv(self["@theClass"])._methodDictionary();
- $ctx1.sendIdx["methodDictionary"]=1;
- $7=$recv($8)._keys();
- $ctx1.sendIdx["keys"]=1;
- self._assert_equals_($7,$recv($recv($ObjectMock())._methodDictionary())._keys());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
- },
- args: [],
- 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",
- referencedClasses: ["ObjectMock"],
- messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"]
- }),
- $globals.ClassBuilderTest);
- $core.addMethod(
- $core.method({
- selector: "testClassMigration",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var instance,oldClass;
- function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
- oldClass=$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
- $2=$recv($Smalltalk())._globals();
- $ctx1.sendIdx["globals"]=1;
- $1=$recv($2)._at_("ObjectMock2");
- $ctx1.sendIdx["at:"]=1;
- instance=$recv($1)._new();
- $4=$recv($Smalltalk())._globals();
- $ctx1.sendIdx["globals"]=2;
- $3=$recv($4)._at_("ObjectMock2");
- $ctx1.sendIdx["at:"]=2;
- $recv($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
- $5=$recv(oldClass).__eq_eq($ObjectMock2());
- $ctx1.sendIdx["=="]=1;
- self._deny_($5);
- $ctx1.sendIdx["deny:"]=1;
- $6=$recv($recv($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
- $ctx1.sendIdx["=="]=2;
- self._assert_($6);
- $ctx1.sendIdx["assert:"]=1;
- self._assert_($recv($recv($ObjectMock2())._instanceVariableNames())._isEmpty());
- $ctx1.sendIdx["assert:"]=2;
- $7=$recv($ObjectMock2())._selectors();
- $ctx1.sendIdx["selectors"]=1;
- self._assert_equals_($7,$recv(oldClass)._selectors());
- $ctx1.sendIdx["assert:equals:"]=1;
- $8=$recv($ObjectMock2())._comment();
- $ctx1.sendIdx["comment"]=1;
- self._assert_equals_($8,$recv(oldClass)._comment());
- $ctx1.sendIdx["assert:equals:"]=2;
- $9=$recv($recv($ObjectMock2())._package())._name();
- $ctx1.sendIdx["name"]=1;
- self._assert_equals_($9,"Kernel-Tests");
- $11=$recv(instance)._class();
- $ctx1.sendIdx["class"]=1;
- $10=$recv($11).__eq_eq($ObjectMock2());
- self._deny_($10);
- self._assert_($recv($recv($recv($Smalltalk())._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
- $recv($Smalltalk())._removeClass_($ObjectMock2());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
- },
- args: [],
- 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",
- referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
- messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"]
- }),
- $globals.ClassBuilderTest);
- $core.addMethod(
- $core.method({
- selector: "testClassMigrationWithClassInstanceVariables",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
- function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $1;
- $recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
- $1=$recv($ObjectMock2())._class();
- $ctx1.sendIdx["class"]=1;
- $recv($1)._instanceVariableNames_("foo bar");
- $recv($ObjectMock())._subclass_instanceVariableNames_package_($recv($recv($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
- self._assert_equals_($recv($recv($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
- $recv($Smalltalk())._removeClass_($ObjectMock2());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
- },
- args: [],
- 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",
- referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
- messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
- }),
- $globals.ClassBuilderTest);
- $core.addMethod(
- $core.method({
- selector: "testClassMigrationWithSubclasses",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
- function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
- function $ObjectMock3(){return $globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- function $ObjectMock4(){return $globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$4,$3;
- $recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
- $recv($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
- $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
- $recv($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
- $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
- $recv($ObjectMock())._subclass_instanceVariableNames_package_($recv($recv($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
- $2=$recv($ObjectMock())._subclasses();
- $ctx1.sendIdx["subclasses"]=1;
- $1=$recv($2)._includes_($ObjectMock2());
- $ctx1.sendIdx["includes:"]=1;
- self._assert_($1);
- $ctx1.sendIdx["assert:"]=1;
- $4=$recv($ObjectMock2())._subclasses();
- $ctx1.sendIdx["subclasses"]=2;
- $3=$recv($4)._includes_($ObjectMock3());
- $ctx1.sendIdx["includes:"]=2;
- self._assert_($3);
- $ctx1.sendIdx["assert:"]=2;
- self._assert_($recv($recv($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
- $recv($recv($ObjectMock())._allSubclasses())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv($Smalltalk())._removeClass_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
- },
- args: [],
- 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 ]",
- referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
- messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"]
- }),
- $globals.ClassBuilderTest);
- $core.addMethod(
- $core.method({
- selector: "testInstanceVariableNames",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_($recv(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
- },
- args: [],
- source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
- referencedClasses: [],
- messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
- }),
- $globals.ClassBuilderTest);
- $core.addClass('ClassTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "jsConstructor",
- protocol: 'running',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- function Foo(){}
- Foo.prototype.valueOf = function () {return 4;};
- return Foo;
- ;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
- },
- args: [],
- source: "jsConstructor\x0a\x09<\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ClassTest);
- $core.addMethod(
- $core.method({
- selector: "setUp",
- protocol: 'running',
- fn: function (){
- var self=this;
- function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
- return $core.withContext(function($ctx1) {
- self["@builder"]=$recv($ClassBuilder())._new();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
- },
- args: [],
- source: "setUp\x0a\x09builder := ClassBuilder new",
- referencedClasses: ["ClassBuilder"],
- messageSends: ["new"]
- }),
- $globals.ClassTest);
- $core.addMethod(
- $core.method({
- selector: "tearDown",
- protocol: 'running',
- fn: function (){
- var self=this;
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $1,$receiver;
- $1=self["@theClass"];
- if(($receiver = $1) == null || $receiver.isNil){
- $1;
- } else {
- $recv($Smalltalk())._removeClass_(self["@theClass"]);
- self["@theClass"]=nil;
- self["@theClass"];
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
- },
- args: [],
- source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
- referencedClasses: ["Smalltalk"],
- messageSends: ["ifNotNil:", "removeClass:"]
- }),
- $globals.ClassTest);
- $core.addMethod(
- $core.method({
- selector: "testSetJavaScriptConstructor",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var instance;
- function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$4,$3,$6,$5,$8,$7;
- self["@theClass"]=$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
- $recv(self["@theClass"])._javascriptConstructor_(self._jsConstructor());
- $2=$recv(self["@theClass"])._superclass();
- $ctx1.sendIdx["superclass"]=1;
- $1=$recv($2).__eq_eq($recv($ObjectMock())._superclass());
- $ctx1.sendIdx["=="]=1;
- self._assert_($1);
- $ctx1.sendIdx["assert:"]=1;
- $4=$recv(self["@theClass"])._instanceVariableNames();
- $ctx1.sendIdx["instanceVariableNames"]=1;
- $3=$recv($4).__eq_eq($recv($ObjectMock())._instanceVariableNames());
- $ctx1.sendIdx["=="]=2;
- self._assert_($3);
- $ctx1.sendIdx["assert:"]=2;
- self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
- $ctx1.sendIdx["assert:equals:"]=1;
- $6=$recv(self["@theClass"])._package();
- $ctx1.sendIdx["package"]=1;
- $5=$recv($6).__eq_eq($recv($ObjectMock())._package());
- $ctx1.sendIdx["=="]=3;
- self._assert_($5);
- $ctx1.sendIdx["assert:"]=3;
- $8=$recv(self["@theClass"])._methodDictionary();
- $ctx1.sendIdx["methodDictionary"]=1;
- $7=$recv($8)._keys();
- $ctx1.sendIdx["keys"]=1;
- self._assert_equals_($7,$recv($recv($ObjectMock())._methodDictionary())._keys());
- $ctx1.sendIdx["assert:equals:"]=2;
- instance=$recv(self["@theClass"])._new();
- self._assert_($recv($recv(instance)._class()).__eq_eq(self["@theClass"]));
- self._assert_equals_($recv(instance)._value(),(4));
- $ctx1.sendIdx["assert:equals:"]=3;
- self._shouldnt_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(instance)._foo_((9));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$Error());
- self._assert_equals_($recv(instance)._foo(),(9));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
- },
- args: [],
- 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",
- referencedClasses: ["ObjectMock", "Error"],
- messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
- }),
- $globals.ClassTest);
- $core.addClass('CollectionTest', $globals.TestCase, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "assertSameContents:as:",
- protocol: 'convenience',
- fn: function (aCollection,anotherCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$4,$3;
- $2=$recv(aCollection)._size();
- $ctx1.sendIdx["size"]=1;
- $1=$recv($2).__eq($recv(anotherCollection)._size());
- $ctx1.sendIdx["="]=1;
- self._assert_($1);
- $ctx1.sendIdx["assert:"]=1;
- $recv(aCollection)._do_((function(each){
- return $core.withContext(function($ctx2) {
- $4=$recv(aCollection)._occurrencesOf_(each);
- $ctx2.sendIdx["occurrencesOf:"]=1;
- $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
- return self._assert_($3);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
- },
- args: ["aCollection", "anotherCollection"],
- 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)) ]",
- referencedClasses: [],
- messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "collection",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
- },
- args: [],
- source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "collectionClass",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._class())._collectionClass();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
- },
- args: [],
- source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
- referencedClasses: [],
- messageSends: ["collectionClass", "class"]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "collectionOfPrintStrings",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
- },
- args: [],
- source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "collectionSize",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
- },
- args: [],
- source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "collectionWithDuplicates",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "collectionWithNewValue",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "isCollectionReadOnly",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return false;
- },
- args: [],
- source: "isCollectionReadOnly\x0a\x09^ false",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "sampleNewValue",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return "N";
- },
- args: [],
- 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'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "sampleNewValueAsCollection",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._collectionClass())._with_(self._sampleNewValue());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["with:", "collectionClass", "sampleNewValue"]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testAddAll",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- 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;
- $2=self._collection();
- $ctx1.sendIdx["collection"]=1;
- $3=$2;
- $5=self._collectionClass();
- $ctx1.sendIdx["collectionClass"]=1;
- $4=$recv($5)._new();
- $ctx1.sendIdx["new"]=1;
- $recv($3)._addAll_($4);
- $ctx1.sendIdx["addAll:"]=1;
- $6=$recv($2)._yourself();
- $ctx1.sendIdx["yourself"]=1;
- $1=$6;
- $7=self._collection();
- $ctx1.sendIdx["collection"]=2;
- self._assert_equals_($1,$7);
- $ctx1.sendIdx["assert:equals:"]=1;
- $10=self._collectionClass();
- $ctx1.sendIdx["collectionClass"]=2;
- $9=$recv($10)._new();
- $ctx1.sendIdx["new"]=2;
- $11=$9;
- $12=self._collection();
- $ctx1.sendIdx["collection"]=3;
- $recv($11)._addAll_($12);
- $ctx1.sendIdx["addAll:"]=2;
- $13=$recv($9)._yourself();
- $ctx1.sendIdx["yourself"]=2;
- $8=$13;
- $14=self._collection();
- $ctx1.sendIdx["collection"]=4;
- self._assert_equals_($8,$14);
- $ctx1.sendIdx["assert:equals:"]=2;
- $17=self._collectionClass();
- $ctx1.sendIdx["collectionClass"]=3;
- $16=$recv($17)._new();
- $ctx1.sendIdx["new"]=3;
- $18=$16;
- $20=self._collectionClass();
- $ctx1.sendIdx["collectionClass"]=4;
- $19=$recv($20)._new();
- $ctx1.sendIdx["new"]=4;
- $recv($18)._addAll_($19);
- $ctx1.sendIdx["addAll:"]=3;
- $21=$recv($16)._yourself();
- $ctx1.sendIdx["yourself"]=3;
- $15=$21;
- self._assert_equals_($15,$recv(self._collectionClass())._new());
- $ctx1.sendIdx["assert:equals:"]=3;
- $23=self._collection();
- $ctx1.sendIdx["collection"]=5;
- $24=$23;
- $25=self._sampleNewValueAsCollection();
- $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
- $recv($24)._addAll_($25);
- $ctx1.sendIdx["addAll:"]=4;
- $26=$recv($23)._yourself();
- $ctx1.sendIdx["yourself"]=4;
- $22=$26;
- $27=self._collectionWithNewValue();
- $ctx1.sendIdx["collectionWithNewValue"]=1;
- self._assert_equals_($22,$27);
- $28=self._sampleNewValueAsCollection();
- $recv($28)._addAll_(self._collection());
- $29=$recv($28)._yourself();
- self._assertSameContents_as_($29,self._collectionWithNewValue());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testAllSatisfy",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var collection,anyOne;
- return $core.withContext(function($ctx1) {
- var $1;
- collection=self._collection();
- anyOne=$recv(collection)._anyOne();
- $1=$recv(collection)._allSatisfy_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(collection)._includes_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $ctx1.sendIdx["allSatisfy:"]=1;
- self._assert_($1);
- self._deny_($recv(collection)._allSatisfy_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each).__tild_eq(anyOne);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- })));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
- },
- args: [],
- 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 ])",
- referencedClasses: [],
- messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testAnyOne",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- var $2,$1;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv($recv(self._collectionClass())._new())._anyOne();
- $ctx2.sendIdx["anyOne"]=1;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$Error());
- $2=self._collection();
- $ctx1.sendIdx["collection"]=1;
- $1=$recv($2)._includes_($recv(self._collection())._anyOne());
- self._assert_($1);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
- },
- args: [],
- source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
- referencedClasses: ["Error"],
- messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testAnySatisfy",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var anyOne;
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- return $core.withContext(function($ctx1) {
- var $1,$3,$2;
- $1=self._collection();
- $ctx1.sendIdx["collection"]=1;
- anyOne=$recv($1)._anyOne();
- $3=self._collection();
- $ctx1.sendIdx["collection"]=2;
- $2=$recv($3)._anySatisfy_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each).__eq(anyOne);
- $ctx2.sendIdx["="]=1;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $ctx1.sendIdx["anySatisfy:"]=1;
- self._assert_($2);
- self._deny_($recv(self._collection())._anySatisfy_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each).__eq($recv($Object())._new());
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- })));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
- },
- args: [],
- 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 ])",
- referencedClasses: ["Object"],
- messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testAsArray",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._collection();
- $ctx1.sendIdx["collection"]=1;
- self._assertSameContents_as_($1,$recv(self._collection())._asArray());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
- },
- args: [],
- source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
- referencedClasses: [],
- messageSends: ["assertSameContents:as:", "collection", "asArray"]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testAsOrderedCollection",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._collection();
- $ctx1.sendIdx["collection"]=1;
- self._assertSameContents_as_($1,$recv(self._collection())._asOrderedCollection());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
- },
- args: [],
- source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
- referencedClasses: [],
- messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testAsSet",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var c,set;
- return $core.withContext(function($ctx1) {
- c=self._collectionWithDuplicates();
- set=$recv(c)._asSet();
- self._assert_equals_($recv(set)._size(),(5));
- $recv(c)._do_((function(each){
- return $core.withContext(function($ctx2) {
- return self._assert_($recv(set)._includes_(each));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
- },
- args: [],
- 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) ]",
- referencedClasses: [],
- messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testCollect",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
- $2=self._collection();
- $ctx1.sendIdx["collection"]=1;
- $1=$recv($2)._collect_((function(each){
- return each;
- }));
- $ctx1.sendIdx["collect:"]=1;
- $3=self._collection();
- $ctx1.sendIdx["collection"]=2;
- self._assert_equals_($1,$3);
- $ctx1.sendIdx["assert:equals:"]=1;
- $5=self._collectionWithNewValue();
- $ctx1.sendIdx["collectionWithNewValue"]=1;
- $4=$recv($5)._collect_((function(each){
- return each;
- }));
- $ctx1.sendIdx["collect:"]=2;
- self._assert_equals_($4,self._collectionWithNewValue());
- $ctx1.sendIdx["assert:equals:"]=2;
- $8=self._collectionClass();
- $ctx1.sendIdx["collectionClass"]=1;
- $7=$recv($8)._new();
- $ctx1.sendIdx["new"]=1;
- $6=$recv($7)._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._printString();
- $ctx2.sendIdx["printString"]=1;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
- }));
- $ctx1.sendIdx["collect:"]=3;
- self._assert_equals_($6,$recv(self._collectionClass())._new());
- $ctx1.sendIdx["assert:equals:"]=3;
- $11=self._collection();
- $ctx1.sendIdx["collection"]=3;
- $10=$recv($11)._collect_((function(){
- return $core.withContext(function($ctx2) {
- return self._sampleNewValue();
- $ctx2.sendIdx["sampleNewValue"]=1;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
- }));
- $ctx1.sendIdx["collect:"]=4;
- $9=$recv($10)._detect_((function(){
- return true;
- }));
- self._assert_equals_($9,self._sampleNewValue());
- $ctx1.sendIdx["assert:equals:"]=4;
- self._assert_equals_($recv(self._collection())._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._printString();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
- })),self._collectionOfPrintStrings());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testComma",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
- $2=self._collection();
- $ctx1.sendIdx["collection"]=1;
- $4=self._collectionClass();
- $ctx1.sendIdx["collectionClass"]=1;
- $3=$recv($4)._new();
- $ctx1.sendIdx["new"]=1;
- $1=$recv($2).__comma($3);
- $ctx1.sendIdx[","]=1;
- $5=self._collection();
- $ctx1.sendIdx["collection"]=2;
- self._assert_equals_($1,$5);
- $ctx1.sendIdx["assert:equals:"]=1;
- $8=self._collectionClass();
- $ctx1.sendIdx["collectionClass"]=2;
- $7=$recv($8)._new();
- $ctx1.sendIdx["new"]=2;
- $9=self._collection();
- $ctx1.sendIdx["collection"]=3;
- $6=$recv($7).__comma($9);
- $ctx1.sendIdx[","]=2;
- $10=self._collection();
- $ctx1.sendIdx["collection"]=4;
- self._assert_equals_($6,$10);
- $ctx1.sendIdx["assert:equals:"]=2;
- $13=self._collectionClass();
- $ctx1.sendIdx["collectionClass"]=3;
- $12=$recv($13)._new();
- $ctx1.sendIdx["new"]=3;
- $15=self._collectionClass();
- $ctx1.sendIdx["collectionClass"]=4;
- $14=$recv($15)._new();
- $ctx1.sendIdx["new"]=4;
- $11=$recv($12).__comma($14);
- $ctx1.sendIdx[","]=3;
- self._assert_equals_($11,$recv(self._collectionClass())._new());
- $ctx1.sendIdx["assert:equals:"]=3;
- $17=self._collection();
- $ctx1.sendIdx["collection"]=5;
- $18=self._sampleNewValueAsCollection();
- $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
- $16=$recv($17).__comma($18);
- $ctx1.sendIdx[","]=4;
- $19=self._collectionWithNewValue();
- $ctx1.sendIdx["collectionWithNewValue"]=1;
- self._assert_equals_($16,$19);
- self._assertSameContents_as_($recv(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testCopy",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
- $3=self._collectionClass();
- $ctx1.sendIdx["collectionClass"]=1;
- $2=$recv($3)._new();
- $ctx1.sendIdx["new"]=1;
- $1=$recv($2)._copy();
- $ctx1.sendIdx["copy"]=1;
- $5=self._collectionClass();
- $ctx1.sendIdx["collectionClass"]=2;
- $4=$recv($5)._new();
- $ctx1.sendIdx["new"]=2;
- self._assert_equals_($1,$4);
- $ctx1.sendIdx["assert:equals:"]=1;
- $7=self._collection();
- $ctx1.sendIdx["collection"]=1;
- $6=$recv($7)._copy();
- $ctx1.sendIdx["copy"]=2;
- $8=self._collection();
- $ctx1.sendIdx["collection"]=2;
- self._assert_equals_($6,$8);
- $ctx1.sendIdx["assert:equals:"]=2;
- $10=self._collectionWithNewValue();
- $ctx1.sendIdx["collectionWithNewValue"]=1;
- $9=$recv($10)._copy();
- $ctx1.sendIdx["copy"]=3;
- $11=self._collectionWithNewValue();
- $ctx1.sendIdx["collectionWithNewValue"]=2;
- self._assert_equals_($9,$11);
- $15=self._collectionClass();
- $ctx1.sendIdx["collectionClass"]=3;
- $14=$recv($15)._new();
- $ctx1.sendIdx["new"]=3;
- $13=$recv($14)._copy();
- $ctx1.sendIdx["copy"]=4;
- $16=self._collection();
- $ctx1.sendIdx["collection"]=3;
- $12=$recv($13).__eq($16);
- $ctx1.sendIdx["="]=1;
- self._deny_($12);
- $ctx1.sendIdx["deny:"]=1;
- $19=self._collection();
- $ctx1.sendIdx["collection"]=4;
- $18=$recv($19)._copy();
- $ctx1.sendIdx["copy"]=5;
- $17=$recv($18).__eq($recv(self._collectionClass())._new());
- $ctx1.sendIdx["="]=2;
- self._deny_($17);
- $ctx1.sendIdx["deny:"]=2;
- self._deny_($recv($recv(self._collection())._copy()).__eq(self._collectionWithNewValue()));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testCopySeparates",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var original,copy;
- return $core.withContext(function($ctx1) {
- original=self._collection();
- $ctx1.sendIdx["collection"]=1;
- copy=$recv(original)._copy();
- $recv(copy)._addAll_(self._sampleNewValueAsCollection());
- self._assert_($recv(original).__eq(self._collection()));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testDetect",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$6,$5,$7;
- self._shouldnt_raise_((function(){
- return $core.withContext(function($ctx2) {
- $1=self._collection();
- $ctx2.sendIdx["collection"]=1;
- return $recv($1)._detect_((function(){
- return true;
- }));
- $ctx2.sendIdx["detect:"]=1;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$Error());
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- $2=self._collection();
- $ctx2.sendIdx["collection"]=2;
- return $recv($2)._detect_((function(){
- return false;
- }));
- $ctx2.sendIdx["detect:"]=2;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }),$Error());
- $ctx1.sendIdx["should:raise:"]=1;
- $3=$recv(self._sampleNewValueAsCollection())._detect_((function(){
- return true;
- }));
- $ctx1.sendIdx["detect:"]=3;
- $4=self._sampleNewValue();
- $ctx1.sendIdx["sampleNewValue"]=1;
- self._assert_equals_($3,$4);
- $ctx1.sendIdx["assert:equals:"]=1;
- $5=$recv(self._collectionWithNewValue())._detect_((function(each){
- return $core.withContext(function($ctx2) {
- $6=self._sampleNewValue();
- $ctx2.sendIdx["sampleNewValue"]=2;
- return $recv(each).__eq($6);
- $ctx2.sendIdx["="]=1;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
- }));
- $ctx1.sendIdx["detect:"]=4;
- $7=self._sampleNewValue();
- $ctx1.sendIdx["sampleNewValue"]=3;
- self._assert_equals_($5,$7);
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self._collection())._detect_((function(each){
- return $core.withContext(function($ctx3) {
- return $recv(each).__eq(self._sampleNewValue());
- }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
- }));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
- }),$Error());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Error"],
- messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testDetectIfNone",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var sentinel;
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- return $core.withContext(function($ctx1) {
- var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
- sentinel=$recv($Object())._new();
- $3=self._collection();
- $ctx1.sendIdx["collection"]=1;
- $2=$recv($3)._detect_ifNone_((function(){
- return true;
- }),(function(){
- return sentinel;
- }));
- $ctx1.sendIdx["detect:ifNone:"]=1;
- $1=$recv($2).__tild_eq(sentinel);
- self._assert_($1);
- $5=self._collection();
- $ctx1.sendIdx["collection"]=2;
- $4=$recv($5)._detect_ifNone_((function(){
- return false;
- }),(function(){
- return sentinel;
- }));
- $ctx1.sendIdx["detect:ifNone:"]=2;
- self._assert_equals_($4,sentinel);
- $ctx1.sendIdx["assert:equals:"]=1;
- $6=$recv(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
- return true;
- }),(function(){
- return sentinel;
- }));
- $ctx1.sendIdx["detect:ifNone:"]=3;
- $7=self._sampleNewValue();
- $ctx1.sendIdx["sampleNewValue"]=1;
- self._assert_equals_($6,$7);
- $ctx1.sendIdx["assert:equals:"]=2;
- $8=$recv(self._collectionWithNewValue())._detect_ifNone_((function(each){
- return $core.withContext(function($ctx2) {
- $9=self._sampleNewValue();
- $ctx2.sendIdx["sampleNewValue"]=2;
- return $recv(each).__eq($9);
- $ctx2.sendIdx["="]=1;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
- }),(function(){
- return sentinel;
- }));
- $ctx1.sendIdx["detect:ifNone:"]=4;
- $10=self._sampleNewValue();
- $ctx1.sendIdx["sampleNewValue"]=3;
- self._assert_equals_($8,$10);
- $ctx1.sendIdx["assert:equals:"]=3;
- self._assert_equals_($recv(self._collection())._detect_ifNone_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each).__eq(self._sampleNewValue());
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
- }),(function(){
- return sentinel;
- })),sentinel);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Object"],
- messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testDo",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var newCollection;
- function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- newCollection=$recv($OrderedCollection())._new();
- $ctx1.sendIdx["new"]=1;
- $1=self._collection();
- $ctx1.sendIdx["collection"]=1;
- $recv($1)._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(newCollection)._add_(each);
- $ctx2.sendIdx["add:"]=1;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $ctx1.sendIdx["do:"]=1;
- self._assertSameContents_as_(self._collection(),newCollection);
- $ctx1.sendIdx["assertSameContents:as:"]=1;
- newCollection=$recv($OrderedCollection())._new();
- $2=self._collectionWithDuplicates();
- $ctx1.sendIdx["collectionWithDuplicates"]=1;
- $recv($2)._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(newCollection)._add_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
- },
- args: [],
- 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",
- referencedClasses: ["OrderedCollection"],
- messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testEquality",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
- $2=self._collectionClass();
- $ctx1.sendIdx["collectionClass"]=1;
- $1=$recv($2)._new();
- $ctx1.sendIdx["new"]=1;
- $4=self._collectionClass();
- $ctx1.sendIdx["collectionClass"]=2;
- $3=$recv($4)._new();
- $ctx1.sendIdx["new"]=2;
- self._assert_equals_($1,$3);
- $ctx1.sendIdx["assert:equals:"]=1;
- $5=self._collection();
- $ctx1.sendIdx["collection"]=1;
- $6=self._collection();
- $ctx1.sendIdx["collection"]=2;
- self._assert_equals_($5,$6);
- $ctx1.sendIdx["assert:equals:"]=2;
- $7=self._collectionWithNewValue();
- $ctx1.sendIdx["collectionWithNewValue"]=1;
- $8=self._collectionWithNewValue();
- $ctx1.sendIdx["collectionWithNewValue"]=2;
- self._assert_equals_($7,$8);
- $11=self._collectionClass();
- $ctx1.sendIdx["collectionClass"]=3;
- $10=$recv($11)._new();
- $ctx1.sendIdx["new"]=3;
- $12=self._collection();
- $ctx1.sendIdx["collection"]=3;
- $9=$recv($10).__eq($12);
- $ctx1.sendIdx["="]=1;
- self._deny_($9);
- $ctx1.sendIdx["deny:"]=1;
- $14=self._collection();
- $ctx1.sendIdx["collection"]=4;
- $13=$recv($14).__eq($recv(self._collectionClass())._new());
- $ctx1.sendIdx["="]=2;
- self._deny_($13);
- $ctx1.sendIdx["deny:"]=2;
- self._deny_($recv(self._collection()).__eq(self._collectionWithNewValue()));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testIfEmptyFamily",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- 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;
- $3=self._collectionClass();
- $ctx1.sendIdx["collectionClass"]=1;
- $2=$recv($3)._new();
- $ctx1.sendIdx["new"]=1;
- $1=$recv($2)._ifEmpty_((function(){
- return (42);
- }));
- $ctx1.sendIdx["ifEmpty:"]=1;
- self._assert_equals_($1,(42));
- $ctx1.sendIdx["assert:equals:"]=1;
- $5=self._collection();
- $ctx1.sendIdx["collection"]=1;
- $4=$recv($5)._ifEmpty_((function(){
- return (42);
- }));
- $6=self._collection();
- $ctx1.sendIdx["collection"]=2;
- self._assert_equals_($4,$6);
- $ctx1.sendIdx["assert:equals:"]=2;
- $9=self._collectionClass();
- $ctx1.sendIdx["collectionClass"]=2;
- $8=$recv($9)._new();
- $ctx1.sendIdx["new"]=2;
- $7=$recv($8)._ifNotEmpty_((function(){
- return (42);
- }));
- $ctx1.sendIdx["ifNotEmpty:"]=1;
- $11=self._collectionClass();
- $ctx1.sendIdx["collectionClass"]=3;
- $10=$recv($11)._new();
- $ctx1.sendIdx["new"]=3;
- self._assert_equals_($7,$10);
- $ctx1.sendIdx["assert:equals:"]=3;
- $13=self._collection();
- $ctx1.sendIdx["collection"]=3;
- $12=$recv($13)._ifNotEmpty_((function(){
- return (42);
- }));
- $ctx1.sendIdx["ifNotEmpty:"]=2;
- self._assert_equals_($12,(42));
- $ctx1.sendIdx["assert:equals:"]=4;
- $15=self._collection();
- $ctx1.sendIdx["collection"]=4;
- $14=$recv($15)._ifNotEmpty_((function(col){
- return col;
- }));
- $16=self._collection();
- $ctx1.sendIdx["collection"]=5;
- self._assert_equals_($14,$16);
- $ctx1.sendIdx["assert:equals:"]=5;
- $19=self._collectionClass();
- $ctx1.sendIdx["collectionClass"]=4;
- $18=$recv($19)._new();
- $ctx1.sendIdx["new"]=4;
- $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
- return (42);
- }),(function(){
- return (999);
- }));
- $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
- self._assert_equals_($17,(42));
- $ctx1.sendIdx["assert:equals:"]=6;
- $21=self._collection();
- $ctx1.sendIdx["collection"]=6;
- $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
- return (42);
- }),(function(){
- return (999);
- }));
- $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
- self._assert_equals_($20,(999));
- $ctx1.sendIdx["assert:equals:"]=7;
- $23=self._collection();
- $ctx1.sendIdx["collection"]=7;
- $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
- return (42);
- }),(function(col){
- return col;
- }));
- $24=self._collection();
- $ctx1.sendIdx["collection"]=8;
- self._assert_equals_($22,$24);
- $ctx1.sendIdx["assert:equals:"]=8;
- $25=$recv($recv(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
- return (42);
- }),(function(){
- return (999);
- }));
- $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
- self._assert_equals_($25,(999));
- $ctx1.sendIdx["assert:equals:"]=9;
- $27=self._collection();
- $ctx1.sendIdx["collection"]=9;
- $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
- return (42);
- }),(function(){
- return (999);
- }));
- $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
- self._assert_equals_($26,(42));
- $ctx1.sendIdx["assert:equals:"]=10;
- $29=self._collection();
- $ctx1.sendIdx["collection"]=10;
- $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
- return col;
- }),(function(){
- return (999);
- }));
- self._assert_equals_($28,self._collection());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
- },
- args: [],
- 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.",
- referencedClasses: [],
- messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testIsEmpty",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv(self._collectionClass())._new())._isEmpty();
- $ctx1.sendIdx["isEmpty"]=1;
- self._assert_($1);
- self._deny_($recv(self._collection())._isEmpty());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
- },
- args: [],
- source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
- referencedClasses: [],
- messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testNoneSatisfy",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var anyOne;
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- return $core.withContext(function($ctx1) {
- var $1,$3,$2;
- $1=self._collection();
- $ctx1.sendIdx["collection"]=1;
- anyOne=$recv($1)._anyOne();
- $3=self._collection();
- $ctx1.sendIdx["collection"]=2;
- $2=$recv($3)._noneSatisfy_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each).__eq(anyOne);
- $ctx2.sendIdx["="]=1;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $ctx1.sendIdx["noneSatisfy:"]=1;
- self._deny_($2);
- self._assert_($recv(self._collection())._noneSatisfy_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each).__eq($recv($Object())._new());
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- })));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
- },
- args: [],
- 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 ])",
- referencedClasses: ["Object"],
- messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testRemoveAll",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=self._collection();
- $recv($1)._removeAll();
- $2=$recv($1)._yourself();
- self._assert_equals_($2,$recv(self._collectionClass())._new());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
- },
- args: [],
- source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
- referencedClasses: [],
- messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testSelect",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
- $2=self._collection();
- $ctx1.sendIdx["collection"]=1;
- $1=$recv($2)._select_((function(){
- return false;
- }));
- $ctx1.sendIdx["select:"]=1;
- $4=self._collectionClass();
- $ctx1.sendIdx["collectionClass"]=1;
- $3=$recv($4)._new();
- $ctx1.sendIdx["new"]=1;
- self._assert_equals_($1,$3);
- $ctx1.sendIdx["assert:equals:"]=1;
- $6=self._collection();
- $ctx1.sendIdx["collection"]=2;
- $5=$recv($6)._select_((function(){
- return true;
- }));
- $ctx1.sendIdx["select:"]=2;
- $7=self._collection();
- $ctx1.sendIdx["collection"]=3;
- self._assert_equals_($5,$7);
- $ctx1.sendIdx["assert:equals:"]=2;
- $9=self._collectionWithNewValue();
- $ctx1.sendIdx["collectionWithNewValue"]=1;
- $8=$recv($9)._select_((function(each){
- return $core.withContext(function($ctx2) {
- $10=self._sampleNewValue();
- $ctx2.sendIdx["sampleNewValue"]=1;
- return $recv(each).__eq($10);
- $ctx2.sendIdx["="]=1;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
- }));
- $ctx1.sendIdx["select:"]=3;
- self._assert_equals_($8,self._sampleNewValueAsCollection());
- $ctx1.sendIdx["assert:equals:"]=3;
- $12=self._collectionWithNewValue();
- $ctx1.sendIdx["collectionWithNewValue"]=2;
- $11=$recv($12)._select_((function(each){
- return $core.withContext(function($ctx2) {
- $13=self._sampleNewValue();
- $ctx2.sendIdx["sampleNewValue"]=2;
- return $recv(each).__tild_eq($13);
- $ctx2.sendIdx["~="]=1;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
- }));
- $ctx1.sendIdx["select:"]=4;
- $14=self._collection();
- $ctx1.sendIdx["collection"]=4;
- self._assert_equals_($11,$14);
- $ctx1.sendIdx["assert:equals:"]=4;
- $16=self._collection();
- $ctx1.sendIdx["collection"]=5;
- $15=$recv($16)._select_((function(each){
- return $core.withContext(function($ctx2) {
- $17=self._sampleNewValue();
- $ctx2.sendIdx["sampleNewValue"]=3;
- return $recv(each).__eq($17);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
- }));
- $ctx1.sendIdx["select:"]=5;
- self._assert_equals_($15,$recv(self._collectionClass())._new());
- $ctx1.sendIdx["assert:equals:"]=5;
- self._assert_equals_($recv(self._collectionWithNewValue())._select_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each).__tild_eq(self._sampleNewValue());
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
- })),self._collection());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testSize",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=$recv($recv(self._collectionClass())._new())._size();
- $ctx1.sendIdx["size"]=1;
- self._assert_equals_($1,(0));
- $ctx1.sendIdx["assert:equals:"]=1;
- $2=$recv(self._sampleNewValueAsCollection())._size();
- $ctx1.sendIdx["size"]=2;
- self._assert_equals_($2,(1));
- $ctx1.sendIdx["assert:equals:"]=2;
- self._assert_equals_($recv(self._collection())._size(),self._collectionSize());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
- }),
- $globals.CollectionTest);
- $core.addMethod(
- $core.method({
- selector: "collectionClass",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return nil;
- },
- args: [],
- source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.CollectionTest.klass);
- $core.addMethod(
- $core.method({
- selector: "isAbstract",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._collectionClass())._isNil();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.klass)});
- },
- args: [],
- source: "isAbstract\x0a\x09^ self collectionClass isNil",
- referencedClasses: [],
- messageSends: ["isNil", "collectionClass"]
- }),
- $globals.CollectionTest.klass);
- $core.addClass('IndexableCollectionTest', $globals.CollectionTest, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "collectionWithNewValue",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.IndexableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "sampleNewIndex",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.IndexableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "sampleNonIndexesDo:",
- protocol: 'fixture',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
- },
- args: ["aBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.IndexableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "samplesDo:",
- protocol: 'fixture',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
- },
- args: ["aBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.IndexableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testAt",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- var $1;
- self._nonIndexesDo_((function(each){
- return $core.withContext(function($ctx2) {
- return self._should_raise_((function(){
- return $core.withContext(function($ctx3) {
- $1=self._collection();
- $ctx3.sendIdx["collection"]=1;
- return $recv($1)._at_(each);
- $ctx3.sendIdx["at:"]=1;
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }),$Error());
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- self._samplesDo_((function(index,value){
- return $core.withContext(function($ctx2) {
- return self._assert_equals_($recv(self._collection())._at_(index),value);
- }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
- },
- args: [],
- 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 ]",
- referencedClasses: ["Error"],
- messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
- }),
- $globals.IndexableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testAtIfAbsent",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$3;
- self._nonIndexesDo_((function(each){
- return $core.withContext(function($ctx2) {
- $2=self._collection();
- $ctx2.sendIdx["collection"]=1;
- $1=$recv($2)._at_ifAbsent_(each,(function(){
- return $core.withContext(function($ctx3) {
- return self._sampleNewValue();
- $ctx3.sendIdx["sampleNewValue"]=1;
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }));
- $ctx2.sendIdx["at:ifAbsent:"]=1;
- $3=self._sampleNewValue();
- $ctx2.sendIdx["sampleNewValue"]=2;
- return self._assert_equals_($1,$3);
- $ctx2.sendIdx["assert:equals:"]=1;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- self._samplesDo_((function(index,value){
- return $core.withContext(function($ctx2) {
- return self._assert_equals_($recv(self._collection())._at_ifAbsent_(index,(function(){
- return $core.withContext(function($ctx3) {
- return self._sampleNewValue();
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
- })),value);
- }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
- },
- args: [],
- 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 ].",
- referencedClasses: [],
- messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
- }),
- $globals.IndexableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testAtIfAbsentPut",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var newCollection;
- return $core.withContext(function($ctx1) {
- var $1;
- newCollection=self._collection();
- $ctx1.sendIdx["collection"]=1;
- self._samplesDo_((function(index,value){
- return $core.withContext(function($ctx2) {
- $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
- return $core.withContext(function($ctx3) {
- return self._sampleNewValue();
- $ctx3.sendIdx["sampleNewValue"]=1;
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }));
- $ctx2.sendIdx["at:ifAbsentPut:"]=1;
- return self._assert_equals_($1,value);
- $ctx2.sendIdx["assert:equals:"]=1;
- }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
- }));
- self._assert_equals_(newCollection,self._collection());
- $ctx1.sendIdx["assert:equals:"]=2;
- self._assert_equals_($recv(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
- return $core.withContext(function($ctx2) {
- return self._sampleNewValue();
- $ctx2.sendIdx["sampleNewValue"]=2;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- })),self._sampleNewValue());
- $ctx1.sendIdx["assert:equals:"]=3;
- self._assert_equals_(newCollection,self._collectionWithNewValue());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
- }),
- $globals.IndexableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testAtIfPresent",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var visited,sentinel;
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$4,$3;
- sentinel=$recv($Object())._new();
- self._nonIndexesDo_((function(each){
- return $core.withContext(function($ctx2) {
- visited=nil;
- visited;
- $2=self._collection();
- $ctx2.sendIdx["collection"]=1;
- $1=$recv($2)._at_ifPresent_(each,(function(value1){
- visited=value1;
- visited;
- return sentinel;
- }));
- $ctx2.sendIdx["at:ifPresent:"]=1;
- self._assert_equals_($1,nil);
- $ctx2.sendIdx["assert:equals:"]=1;
- return self._assert_($recv(visited)._isNil());
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- self._samplesDo_((function(index,value){
- return $core.withContext(function($ctx2) {
- visited=nil;
- visited;
- $4=self._collection();
- $ctx2.sendIdx["collection"]=2;
- $3=$recv($4)._at_ifPresent_(index,(function(value2){
- visited=value2;
- visited;
- return sentinel;
- }));
- self._assert_equals_($3,sentinel);
- $ctx2.sendIdx["assert:equals:"]=2;
- return self._assert_equals_(visited,$recv(self._collection())._at_(index));
- }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
- },
- args: [],
- 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) ]",
- referencedClasses: ["Object"],
- messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
- }),
- $globals.IndexableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testAtIfPresentIfAbsent",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var visited,sentinel;
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$3,$5,$4;
- sentinel=$recv($Object())._new();
- self._nonIndexesDo_((function(each){
- return $core.withContext(function($ctx2) {
- visited=nil;
- visited;
- $2=self._collection();
- $ctx2.sendIdx["collection"]=1;
- $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
- visited=value1;
- visited;
- return sentinel;
- }),(function(){
- return $core.withContext(function($ctx3) {
- return self._sampleNewValue();
- $ctx3.sendIdx["sampleNewValue"]=1;
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
- }));
- $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
- $3=self._sampleNewValue();
- $ctx2.sendIdx["sampleNewValue"]=2;
- self._assert_equals_($1,$3);
- $ctx2.sendIdx["assert:equals:"]=1;
- return self._assert_($recv(visited)._isNil());
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- self._samplesDo_((function(index,value){
- return $core.withContext(function($ctx2) {
- visited=nil;
- visited;
- $5=self._collection();
- $ctx2.sendIdx["collection"]=2;
- $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
- visited=value2;
- visited;
- return sentinel;
- }),(function(){
- return $core.withContext(function($ctx3) {
- return self._sampleNewValue();
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
- }));
- self._assert_equals_($4,sentinel);
- $ctx2.sendIdx["assert:equals:"]=2;
- return self._assert_equals_(visited,$recv(self._collection())._at_(index));
- }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
- },
- args: [],
- 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) ]",
- referencedClasses: ["Object"],
- messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
- }),
- $globals.IndexableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testAtPut",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var newCollection;
- return $core.withContext(function($ctx1) {
- newCollection=self._collection();
- $ctx1.sendIdx["collection"]=1;
- self._samplesDo_((function(index,value){
- return $core.withContext(function($ctx2) {
- return $recv(newCollection)._at_put_(index,value);
- $ctx2.sendIdx["at:put:"]=1;
- }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
- }));
- self._assert_equals_(newCollection,self._collection());
- $ctx1.sendIdx["assert:equals:"]=1;
- $recv(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
- self._assert_equals_(newCollection,self._collectionWithNewValue());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
- }),
- $globals.IndexableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testIndexOf",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- var $1;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- $1=self._collection();
- $ctx2.sendIdx["collection"]=1;
- return $recv($1)._indexOf_(self._sampleNewValue());
- $ctx2.sendIdx["indexOf:"]=1;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$Error());
- self._samplesDo_((function(index,value){
- return $core.withContext(function($ctx2) {
- return self._assert_equals_($recv(self._collection())._indexOf_(value),index);
- }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
- },
- args: [],
- 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 ]",
- referencedClasses: ["Error"],
- messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
- }),
- $globals.IndexableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testIndexOfWithNull",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var jsNull;
- function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- jsNull=$recv($JSON())._parse_("null");
- self._samplesDo_((function(index,value){
- return $core.withContext(function($ctx2) {
- $1=self._collection();
- $recv($1)._at_put_(index,jsNull);
- $2=$recv($1)._indexOf_(jsNull);
- return self._assert_equals_($2,index);
- }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
- },
- args: [],
- 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 ]",
- referencedClasses: ["JSON"],
- messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
- }),
- $globals.IndexableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testWithIndexDo",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var collection;
- return $core.withContext(function($ctx1) {
- collection=self._collection();
- $ctx1.sendIdx["collection"]=1;
- $recv(self._collection())._withIndexDo_((function(each,index){
- return $core.withContext(function($ctx2) {
- return self._assert_equals_($recv(collection)._at_(index),each);
- }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
- },
- args: [],
- 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 ]",
- referencedClasses: [],
- messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
- }),
- $globals.IndexableCollectionTest);
- $core.addClass('AssociativeCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "collectionKeys",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
- },
- args: [],
- source: "collectionKeys\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.AssociativeCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "collectionValues",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
- },
- args: [],
- source: "collectionValues\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.AssociativeCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "nonIndexesDo:",
- protocol: 'fixture',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aBlock)._value_((5));
- $ctx1.sendIdx["value:"]=1;
- $recv(aBlock)._value_("z");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
- },
- args: ["aBlock"],
- source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
- referencedClasses: [],
- messageSends: ["value:"]
- }),
- $globals.AssociativeCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "sampleNewIndex",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return "new";
- },
- args: [],
- source: "sampleNewIndex\x0a\x09^ 'new'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AssociativeCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "samplesDo:",
- protocol: 'fixture',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aBlock)._value_value_("a",(2));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
- },
- args: ["aBlock"],
- source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
- referencedClasses: [],
- messageSends: ["value:value:"]
- }),
- $globals.AssociativeCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testAddAll",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
- (
- $ctx1.supercall = true,
- $globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply($recv(self), []));
- $ctx1.supercall = false;
- $2=self._collection();
- $ctx1.sendIdx["collection"]=1;
- $3=$2;
- $4=self._collection();
- $ctx1.sendIdx["collection"]=2;
- $recv($3)._addAll_($4);
- $ctx1.sendIdx["addAll:"]=1;
- $5=$recv($2)._yourself();
- $ctx1.sendIdx["yourself"]=1;
- $1=$5;
- $6=self._collection();
- $ctx1.sendIdx["collection"]=3;
- self._assert_equals_($1,$6);
- $ctx1.sendIdx["assert:equals:"]=1;
- $8=self._collection();
- $ctx1.sendIdx["collection"]=4;
- $9=$8;
- $10=self._collectionWithNewValue();
- $ctx1.sendIdx["collectionWithNewValue"]=1;
- $recv($9)._addAll_($10);
- $ctx1.sendIdx["addAll:"]=2;
- $11=$recv($8)._yourself();
- $ctx1.sendIdx["yourself"]=2;
- $7=$11;
- $12=self._collectionWithNewValue();
- $ctx1.sendIdx["collectionWithNewValue"]=2;
- self._assert_equals_($7,$12);
- $ctx1.sendIdx["assert:equals:"]=2;
- $14=self._collectionWithNewValue();
- $ctx1.sendIdx["collectionWithNewValue"]=3;
- $recv($14)._addAll_(self._collection());
- $15=$recv($14)._yourself();
- $13=$15;
- self._assert_equals_($13,self._collectionWithNewValue());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
- }),
- $globals.AssociativeCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testAsDictionary",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return $core.withContext(function($ctx1) {
- self._assert_($recv($recv($recv(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
- },
- args: [],
- source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
- referencedClasses: ["Dictionary"],
- messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
- }),
- $globals.AssociativeCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testAsHashedCollection",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
- return $core.withContext(function($ctx1) {
- self._assert_($recv($recv($recv(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
- },
- args: [],
- source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
- referencedClasses: ["HashedCollection"],
- messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
- }),
- $globals.AssociativeCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testComma",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
- (
- $ctx1.supercall = true,
- $globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply($recv(self), []));
- $ctx1.supercall = false;
- $2=self._collection();
- $ctx1.sendIdx["collection"]=1;
- $3=self._collection();
- $ctx1.sendIdx["collection"]=2;
- $1=$recv($2).__comma($3);
- $ctx1.sendIdx[","]=1;
- $4=self._collection();
- $ctx1.sendIdx["collection"]=3;
- self._assert_equals_($1,$4);
- $ctx1.sendIdx["assert:equals:"]=1;
- $6=self._collection();
- $ctx1.sendIdx["collection"]=4;
- $7=self._collectionWithNewValue();
- $ctx1.sendIdx["collectionWithNewValue"]=1;
- $5=$recv($6).__comma($7);
- $ctx1.sendIdx[","]=2;
- $8=self._collectionWithNewValue();
- $ctx1.sendIdx["collectionWithNewValue"]=2;
- self._assert_equals_($5,$8);
- $ctx1.sendIdx["assert:equals:"]=2;
- $10=self._collectionWithNewValue();
- $ctx1.sendIdx["collectionWithNewValue"]=3;
- $9=$recv($10).__comma(self._collection());
- self._assert_equals_($9,self._collectionWithNewValue());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
- }),
- $globals.AssociativeCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testFrom",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var associations;
- return $core.withContext(function($ctx1) {
- var $1;
- $1="a".__minus_gt((1));
- $ctx1.sendIdx["->"]=1;
- associations=[$1,"b".__minus_gt((2))];
- self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
- },
- args: [],
- 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 }.",
- referencedClasses: [],
- messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
- }),
- $globals.AssociativeCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testKeys",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$3,$4;
- $2=$recv($recv(self._collectionClass())._new())._keys();
- $ctx1.sendIdx["keys"]=1;
- $1=$recv($2)._isEmpty();
- self._assert_($1);
- $3=$recv(self._collection())._keys();
- $ctx1.sendIdx["keys"]=2;
- $4=self._collectionKeys();
- $ctx1.sendIdx["collectionKeys"]=1;
- self._assertSameContents_as_($3,$4);
- $ctx1.sendIdx["assertSameContents:as:"]=1;
- self._assertSameContents_as_($recv(self._collectionWithNewValue())._keys(),$recv(self._collectionKeys()).__comma([self._sampleNewIndex()]));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
- },
- args: [],
- 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 }",
- referencedClasses: [],
- messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
- }),
- $globals.AssociativeCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testNewFromPairs",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var flattenedAssociations;
- return $core.withContext(function($ctx1) {
- flattenedAssociations=["a",(1),"b",(2)];
- self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
- },
- args: [],
- 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 }.",
- referencedClasses: [],
- messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
- }),
- $globals.AssociativeCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testPrintString",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $3,$2,$4,$1,$5;
- $3=self._collectionClass();
- $ctx1.sendIdx["collectionClass"]=1;
- $2=$recv($3)._new();
- $recv($2)._at_put_("firstname","James");
- $ctx1.sendIdx["at:put:"]=1;
- $recv($2)._at_put_("lastname","Bond");
- $4=$recv($2)._printString();
- $1=$4;
- $5=$recv("a ".__comma($recv(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
- $ctx1.sendIdx[","]=1;
- self._assert_equals_($1,$5);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
- },
- args: [],
- 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'')'",
- referencedClasses: [],
- messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
- }),
- $globals.AssociativeCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testRemoveKey",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$5,$6,$4,$7,$8;
- self._nonIndexesDo_((function(each){
- var collection;
- return $core.withContext(function($ctx2) {
- collection=self._collection();
- $ctx2.sendIdx["collection"]=1;
- collection;
- self._should_raise_((function(){
- return $core.withContext(function($ctx3) {
- return $recv(collection)._removeKey_(each);
- $ctx3.sendIdx["removeKey:"]=1;
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }),$Error());
- $1=collection;
- $2=self._collection();
- $ctx2.sendIdx["collection"]=2;
- return self._assert_equals_($1,$2);
- $ctx2.sendIdx["assert:equals:"]=1;
- }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
- }));
- self._samplesDo_((function(index,value){
- var collection;
- return $core.withContext(function($ctx2) {
- collection=self._collection();
- $ctx2.sendIdx["collection"]=3;
- collection;
- $3=$recv(collection)._removeKey_(index);
- $ctx2.sendIdx["removeKey:"]=2;
- self._assert_equals_($3,value);
- $ctx2.sendIdx["assert:equals:"]=2;
- $5=collection;
- $6=self._collection();
- $ctx2.sendIdx["collection"]=4;
- $4=$recv($5).__eq($6);
- return self._deny_($4);
- }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
- }));
- $7=self._collectionWithNewValue();
- $recv($7)._removeKey_(self._sampleNewIndex());
- $8=$recv($7)._yourself();
- self._assert_equals_($8,self._collection());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Error"],
- messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
- }),
- $globals.AssociativeCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testRemoveKeyIfAbsent",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
- self._nonIndexesDo_((function(each){
- var collection;
- return $core.withContext(function($ctx2) {
- collection=self._collection();
- $ctx2.sendIdx["collection"]=1;
- collection;
- $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
- return $core.withContext(function($ctx3) {
- return self._sampleNewValue();
- $ctx3.sendIdx["sampleNewValue"]=1;
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- }));
- $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
- $2=self._sampleNewValue();
- $ctx2.sendIdx["sampleNewValue"]=2;
- self._assert_equals_($1,$2);
- $ctx2.sendIdx["assert:equals:"]=1;
- $3=collection;
- $4=self._collection();
- $ctx2.sendIdx["collection"]=2;
- return self._assert_equals_($3,$4);
- $ctx2.sendIdx["assert:equals:"]=2;
- }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
- }));
- self._samplesDo_((function(index,value){
- var collection;
- return $core.withContext(function($ctx2) {
- collection=self._collection();
- $ctx2.sendIdx["collection"]=3;
- collection;
- $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
- return $core.withContext(function($ctx3) {
- return self._sampleNewValue();
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
- }));
- $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
- self._assert_equals_($5,value);
- $ctx2.sendIdx["assert:equals:"]=3;
- $7=collection;
- $8=self._collection();
- $ctx2.sendIdx["collection"]=4;
- $6=$recv($7).__eq($8);
- return self._deny_($6);
- }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
- }));
- $9=self._collectionWithNewValue();
- $recv($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
- return $core.withContext(function($ctx2) {
- return self._assert_(false);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
- }));
- $10=$recv($9)._yourself();
- self._assert_equals_($10,self._collection());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
- }),
- $globals.AssociativeCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testValues",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$3,$4;
- $2=$recv($recv(self._collectionClass())._new())._values();
- $ctx1.sendIdx["values"]=1;
- $1=$recv($2)._isEmpty();
- self._assert_($1);
- $3=$recv(self._collection())._values();
- $ctx1.sendIdx["values"]=2;
- $4=self._collectionValues();
- $ctx1.sendIdx["collectionValues"]=1;
- self._assertSameContents_as_($3,$4);
- $ctx1.sendIdx["assertSameContents:as:"]=1;
- self._assertSameContents_as_($recv(self._collectionWithNewValue())._values(),$recv(self._collectionValues()).__comma([self._sampleNewValue()]));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
- },
- args: [],
- 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 }",
- referencedClasses: [],
- messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
- }),
- $globals.AssociativeCollectionTest);
- $core.addClass('DictionaryTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "collection",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($Dictionary())._new();
- $recv($2)._at_put_((1),(1));
- $ctx1.sendIdx["at:put:"]=1;
- $recv($2)._at_put_("a",(2));
- $ctx1.sendIdx["at:put:"]=2;
- $recv($2)._at_put_(true,(3));
- $ctx1.sendIdx["at:put:"]=3;
- $recv($2)._at_put_((1).__at((3)),(-4));
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Dictionary"],
- messageSends: ["at:put:", "new", "@", "yourself"]
- }),
- $globals.DictionaryTest);
- $core.addMethod(
- $core.method({
- selector: "collectionKeys",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=[(1),"a",true,(1).__at((3))];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
- },
- args: [],
- source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
- referencedClasses: [],
- messageSends: ["@"]
- }),
- $globals.DictionaryTest);
- $core.addMethod(
- $core.method({
- selector: "collectionOfPrintStrings",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($Dictionary())._new();
- $recv($2)._at_put_((1),"1");
- $ctx1.sendIdx["at:put:"]=1;
- $recv($2)._at_put_("a","2");
- $ctx1.sendIdx["at:put:"]=2;
- $recv($2)._at_put_(true,"3");
- $ctx1.sendIdx["at:put:"]=3;
- $recv($2)._at_put_((1).__at((3)),"-4");
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Dictionary"],
- messageSends: ["at:put:", "new", "@", "yourself"]
- }),
- $globals.DictionaryTest);
- $core.addMethod(
- $core.method({
- selector: "collectionSize",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return (4);
- },
- args: [],
- source: "collectionSize\x0a\x09^ 4",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.DictionaryTest);
- $core.addMethod(
- $core.method({
- selector: "collectionValues",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- var $1;
- $1=[(1),(2),(3),(-4)];
- return $1;
- },
- args: [],
- source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.DictionaryTest);
- $core.addMethod(
- $core.method({
- selector: "collectionWithDuplicates",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($Dictionary())._new();
- $recv($2)._at_put_((1),(1));
- $ctx1.sendIdx["at:put:"]=1;
- $recv($2)._at_put_("a",(2));
- $ctx1.sendIdx["at:put:"]=2;
- $recv($2)._at_put_(true,(3));
- $ctx1.sendIdx["at:put:"]=3;
- $recv($2)._at_put_((4),(-4));
- $ctx1.sendIdx["at:put:"]=4;
- $recv($2)._at_put_("b",(1));
- $ctx1.sendIdx["at:put:"]=5;
- $recv($2)._at_put_((3),(3));
- $ctx1.sendIdx["at:put:"]=6;
- $recv($2)._at_put_(false,(12));
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Dictionary"],
- messageSends: ["at:put:", "new", "yourself"]
- }),
- $globals.DictionaryTest);
- $core.addMethod(
- $core.method({
- selector: "collectionWithNewValue",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($Dictionary())._new();
- $recv($2)._at_put_((1),(1));
- $ctx1.sendIdx["at:put:"]=1;
- $recv($2)._at_put_("a",(2));
- $ctx1.sendIdx["at:put:"]=2;
- $recv($2)._at_put_(true,(3));
- $ctx1.sendIdx["at:put:"]=3;
- $recv($2)._at_put_((1).__at((3)),(-4));
- $ctx1.sendIdx["at:put:"]=4;
- $recv($2)._at_put_("new","N");
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Dictionary"],
- messageSends: ["at:put:", "new", "@", "yourself"]
- }),
- $globals.DictionaryTest);
- $core.addMethod(
- $core.method({
- selector: "sampleNewValueAsCollection",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($Dictionary())._new();
- $recv($2)._at_put_("new","N");
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
- },
- args: [],
- source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
- referencedClasses: ["Dictionary"],
- messageSends: ["at:put:", "new", "yourself"]
- }),
- $globals.DictionaryTest);
- $core.addMethod(
- $core.method({
- selector: "samplesDo:",
- protocol: 'fixture',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
- $ctx1.supercall = false;
- $recv(aBlock)._value_value_(true,(3));
- $ctx1.sendIdx["value:value:"]=1;
- $recv(aBlock)._value_value_((1).__at((3)),(-4));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
- },
- args: ["aBlock"],
- source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
- referencedClasses: [],
- messageSends: ["samplesDo:", "value:value:", "@"]
- }),
- $globals.DictionaryTest);
- $core.addMethod(
- $core.method({
- selector: "testAccessing",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var d;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
- d=$recv($Dictionary())._new();
- $recv(d)._at_put_("hello","world");
- $ctx1.sendIdx["at:put:"]=1;
- $1=$recv(d)._at_("hello");
- $ctx1.sendIdx["at:"]=1;
- self._assert_equals_($1,"world");
- $ctx1.sendIdx["assert:equals:"]=1;
- $2=$recv(d)._at_ifAbsent_("hello",(function(){
- return nil;
- }));
- $ctx1.sendIdx["at:ifAbsent:"]=1;
- self._assert_equals_($2,"world");
- $ctx1.sendIdx["assert:equals:"]=2;
- self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
- return nil;
- }))).__eq("world"));
- $ctx1.sendIdx["deny:"]=1;
- $3=$recv(d)._includesKey_("hello");
- $ctx1.sendIdx["includesKey:"]=1;
- self._assert_($3);
- $ctx1.sendIdx["assert:"]=1;
- $4=$recv(d)._includesKey_("foo");
- $ctx1.sendIdx["includesKey:"]=2;
- self._deny_($4);
- $ctx1.sendIdx["deny:"]=2;
- $recv(d)._at_put_((1),(2));
- $ctx1.sendIdx["at:put:"]=2;
- $5=$recv(d)._at_((1));
- $ctx1.sendIdx["at:"]=2;
- self._assert_equals_($5,(2));
- $ctx1.sendIdx["assert:equals:"]=3;
- $6=d;
- $7=(1).__at((3));
- $ctx1.sendIdx["@"]=1;
- $recv($6)._at_put_($7,(3));
- $9=d;
- $10=(1).__at((3));
- $ctx1.sendIdx["@"]=2;
- $8=$recv($9)._at_($10);
- self._assert_equals_($8,(3));
- $12=d;
- $13=(1).__at((3));
- $ctx1.sendIdx["@"]=3;
- $11=$recv($12)._includesKey_($13);
- $ctx1.sendIdx["includesKey:"]=3;
- self._assert_($11);
- self._deny_($recv(d)._includesKey_((3).__at((1))));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
- },
- args: [],
- 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)",
- referencedClasses: ["Dictionary"],
- messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
- }),
- $globals.DictionaryTest);
- $core.addMethod(
- $core.method({
- selector: "testDynamicDictionaries",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return $core.withContext(function($ctx1) {
- self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($Dictionary())._with_("hello".__minus_gt((1))));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
- },
- args: [],
- source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
- referencedClasses: ["Dictionary"],
- messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
- }),
- $globals.DictionaryTest);
- $core.addMethod(
- $core.method({
- selector: "collectionClass",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return $Dictionary();
- },
- args: [],
- source: "collectionClass\x0a\x09^ Dictionary",
- referencedClasses: ["Dictionary"],
- messageSends: []
- }),
- $globals.DictionaryTest.klass);
- $core.addClass('HashedCollectionTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "collection",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- var $1;
- $1=$globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
- return $1;
- },
- args: [],
- source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.HashedCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "collectionKeys",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- var $1;
- $1=["b","a","c","d"];
- return $1;
- },
- args: [],
- source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.HashedCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "collectionOfPrintStrings",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- var $1;
- $1=$globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
- return $1;
- },
- args: [],
- source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.HashedCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "collectionSize",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return (4);
- },
- args: [],
- source: "collectionSize\x0a\x09^ 4",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.HashedCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "collectionValues",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- var $1;
- $1=[(1),(2),(3),(-4)];
- return $1;
- },
- args: [],
- source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.HashedCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "collectionWithDuplicates",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- var $1;
- $1=$globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10)]);
- return $1;
- },
- args: [],
- source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.HashedCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "collectionWithNewValue",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- var $1;
- $1=$globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
- return $1;
- },
- args: [],
- source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.HashedCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "sampleNewValueAsCollection",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- var $1;
- $1=$globals.HashedCollection._newFromPairs_(["new","N"]);
- return $1;
- },
- args: [],
- source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.HashedCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testDynamicDictionaries",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
- return $core.withContext(function($ctx1) {
- self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($HashedCollection())._with_("hello".__minus_gt((1))));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
- },
- args: [],
- source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
- referencedClasses: ["HashedCollection"],
- messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
- }),
- $globals.HashedCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "collectionClass",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
- return $HashedCollection();
- },
- args: [],
- source: "collectionClass\x0a\x09^ HashedCollection",
- referencedClasses: ["HashedCollection"],
- messageSends: []
- }),
- $globals.HashedCollectionTest.klass);
- $core.addClass('SequenceableCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "collectionFirst",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
- },
- args: [],
- source: "collectionFirst\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.SequenceableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "collectionFirstTwo",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
- },
- args: [],
- source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.SequenceableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "collectionLast",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
- },
- args: [],
- source: "collectionLast\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.SequenceableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "collectionLastTwo",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
- },
- args: [],
- source: "collectionLastTwo\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- messageSends: ["subclassResponsibility"]
- }),
- $globals.SequenceableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "nonIndexesDo:",
- protocol: 'fixture',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aBlock)._value_((0));
- $ctx1.sendIdx["value:"]=1;
- $recv(aBlock)._value_($recv(self._collectionSize()).__plus((1)));
- $ctx1.sendIdx["value:"]=2;
- $recv(aBlock)._value_("z");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
- },
- args: ["aBlock"],
- source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
- referencedClasses: [],
- messageSends: ["value:", "+", "collectionSize"]
- }),
- $globals.SequenceableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "samplesDo:",
- protocol: 'fixture',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(aBlock)._value_value_((1),self._collectionFirst());
- $ctx1.sendIdx["value:value:"]=1;
- $recv(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
- },
- args: ["aBlock"],
- source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
- referencedClasses: [],
- messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
- }),
- $globals.SequenceableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testBeginsWith",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$4,$5,$3,$7,$6;
- $2=self._collection();
- $ctx1.sendIdx["collection"]=1;
- $1=$recv($2)._beginsWith_($recv(self._collectionClass())._new());
- $ctx1.sendIdx["beginsWith:"]=1;
- self._assert_($1);
- $ctx1.sendIdx["assert:"]=1;
- $4=self._collection();
- $ctx1.sendIdx["collection"]=2;
- $5=self._collection();
- $ctx1.sendIdx["collection"]=3;
- $3=$recv($4)._beginsWith_($5);
- $ctx1.sendIdx["beginsWith:"]=2;
- self._assert_($3);
- $ctx1.sendIdx["assert:"]=2;
- $7=self._collection();
- $ctx1.sendIdx["collection"]=4;
- $6=$recv($7)._beginsWith_(self._collectionFirstTwo());
- $ctx1.sendIdx["beginsWith:"]=3;
- self._assert_($6);
- self._deny_($recv(self._collection())._beginsWith_(self._collectionLastTwo()));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
- },
- args: [],
- 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)",
- referencedClasses: [],
- messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
- }),
- $globals.SequenceableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testEndsWith",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$4,$5,$3,$7,$6;
- $2=self._collection();
- $ctx1.sendIdx["collection"]=1;
- $1=$recv($2)._endsWith_($recv(self._collectionClass())._new());
- $ctx1.sendIdx["endsWith:"]=1;
- self._assert_($1);
- $ctx1.sendIdx["assert:"]=1;
- $4=self._collection();
- $ctx1.sendIdx["collection"]=2;
- $5=self._collection();
- $ctx1.sendIdx["collection"]=3;
- $3=$recv($4)._endsWith_($5);
- $ctx1.sendIdx["endsWith:"]=2;
- self._assert_($3);
- $ctx1.sendIdx["assert:"]=2;
- $7=self._collection();
- $ctx1.sendIdx["collection"]=4;
- $6=$recv($7)._endsWith_(self._collectionLastTwo());
- $ctx1.sendIdx["endsWith:"]=3;
- self._assert_($6);
- self._deny_($recv(self._collection())._endsWith_(self._collectionFirstTwo()));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
- },
- args: [],
- 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)",
- referencedClasses: [],
- messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
- }),
- $globals.SequenceableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testFirst",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_($recv(self._collection())._first(),self._collectionFirst());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
- },
- args: [],
- source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
- referencedClasses: [],
- messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
- }),
- $globals.SequenceableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testFirstN",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$4,$3,$6,$5,$7;
- $2=self._collection();
- $ctx1.sendIdx["collection"]=1;
- $1=$recv($2)._first_((2));
- $ctx1.sendIdx["first:"]=1;
- self._assert_equals_($1,self._collectionFirstTwo());
- $ctx1.sendIdx["assert:equals:"]=1;
- $4=self._collection();
- $ctx1.sendIdx["collection"]=2;
- $3=$recv($4)._first_((0));
- $ctx1.sendIdx["first:"]=2;
- self._assert_equals_($3,$recv(self._collectionClass())._new());
- $ctx1.sendIdx["assert:equals:"]=2;
- $6=self._collection();
- $ctx1.sendIdx["collection"]=3;
- $5=$recv($6)._first_(self._collectionSize());
- $ctx1.sendIdx["first:"]=3;
- $7=self._collection();
- $ctx1.sendIdx["collection"]=4;
- self._assert_equals_($5,$7);
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self._collection())._first_((33));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$Error());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Error"],
- messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
- }),
- $globals.SequenceableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testFourth",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=self._collection();
- $ctx1.sendIdx["collection"]=1;
- $1=$recv($2)._fourth();
- self._assert_equals_($1,$recv(self._collection())._at_((4)));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
- },
- args: [],
- source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
- referencedClasses: [],
- messageSends: ["assert:equals:", "fourth", "collection", "at:"]
- }),
- $globals.SequenceableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testIndexOfStartingAt",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var jsNull;
- function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$4,$3;
- jsNull=$recv($JSON())._parse_("null");
- self._samplesDo_((function(index,value){
- return $core.withContext(function($ctx2) {
- $2=self._collection();
- $ctx2.sendIdx["collection"]=1;
- $1=$recv($2)._indexOf_startingAt_(value,(1));
- $ctx2.sendIdx["indexOf:startingAt:"]=1;
- self._assert_equals_($1,index);
- $ctx2.sendIdx["assert:equals:"]=1;
- $4=self._collection();
- $ctx2.sendIdx["collection"]=2;
- $3=$recv($4)._indexOf_startingAt_(value,index);
- $ctx2.sendIdx["indexOf:startingAt:"]=2;
- self._assert_equals_($3,index);
- $ctx2.sendIdx["assert:equals:"]=2;
- return self._assert_equals_($recv(self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
- }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
- },
- args: [],
- 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 ]",
- referencedClasses: ["JSON"],
- messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
- }),
- $globals.SequenceableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testIndexOfStartingAtWithNull",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var jsNull;
- function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- jsNull=$recv($JSON())._parse_("null");
- self._samplesDo_((function(index,value){
- var collection;
- return $core.withContext(function($ctx2) {
- collection=self._collection();
- collection;
- $recv(collection)._at_put_(index,jsNull);
- $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
- $ctx2.sendIdx["indexOf:startingAt:"]=1;
- self._assert_equals_($1,index);
- $ctx2.sendIdx["assert:equals:"]=1;
- $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
- $ctx2.sendIdx["indexOf:startingAt:"]=2;
- self._assert_equals_($2,index);
- $ctx2.sendIdx["assert:equals:"]=2;
- return self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
- }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
- },
- args: [],
- 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 ]",
- referencedClasses: ["JSON"],
- messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
- }),
- $globals.SequenceableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testLast",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_($recv(self._collection())._last(),self._collectionLast());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
- },
- args: [],
- source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
- referencedClasses: [],
- messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
- }),
- $globals.SequenceableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testLastN",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$4,$3,$6,$5,$7;
- $2=self._collection();
- $ctx1.sendIdx["collection"]=1;
- $1=$recv($2)._last_((2));
- $ctx1.sendIdx["last:"]=1;
- self._assert_equals_($1,self._collectionLastTwo());
- $ctx1.sendIdx["assert:equals:"]=1;
- $4=self._collection();
- $ctx1.sendIdx["collection"]=2;
- $3=$recv($4)._last_((0));
- $ctx1.sendIdx["last:"]=2;
- self._assert_equals_($3,$recv(self._collectionClass())._new());
- $ctx1.sendIdx["assert:equals:"]=2;
- $6=self._collection();
- $ctx1.sendIdx["collection"]=3;
- $5=$recv($6)._last_(self._collectionSize());
- $ctx1.sendIdx["last:"]=3;
- $7=self._collection();
- $ctx1.sendIdx["collection"]=4;
- self._assert_equals_($5,$7);
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self._collection())._last_((33));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$Error());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Error"],
- messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
- }),
- $globals.SequenceableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testSecond",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=self._collection();
- $ctx1.sendIdx["collection"]=1;
- $1=$recv($2)._second();
- self._assert_equals_($1,$recv(self._collection())._at_((2)));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
- },
- args: [],
- source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
- referencedClasses: [],
- messageSends: ["assert:equals:", "second", "collection", "at:"]
- }),
- $globals.SequenceableCollectionTest);
- $core.addMethod(
- $core.method({
- selector: "testThird",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=self._collection();
- $ctx1.sendIdx["collection"]=1;
- $1=$recv($2)._third();
- self._assert_equals_($1,$recv(self._collection())._at_((3)));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
- },
- args: [],
- source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
- referencedClasses: [],
- messageSends: ["assert:equals:", "third", "collection", "at:"]
- }),
- $globals.SequenceableCollectionTest);
- $core.addClass('ArrayTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "collection",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- var $1;
- $1=[(1), (2), (3), (-4)];
- return $1;
- },
- args: [],
- source: "collection\x0a\x09^ #(1 2 3 -4)",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ArrayTest);
- $core.addMethod(
- $core.method({
- selector: "collectionFirst",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return (1);
- },
- args: [],
- source: "collectionFirst\x0a\x09^ 1",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ArrayTest);
- $core.addMethod(
- $core.method({
- selector: "collectionFirstTwo",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- var $1;
- $1=[(1), (2)];
- return $1;
- },
- args: [],
- source: "collectionFirstTwo\x0a\x09^ #(1 2)",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ArrayTest);
- $core.addMethod(
- $core.method({
- selector: "collectionLast",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return (-4);
- },
- args: [],
- source: "collectionLast\x0a\x09^ -4",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ArrayTest);
- $core.addMethod(
- $core.method({
- selector: "collectionLastTwo",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- var $1;
- $1=[(3), (-4)];
- return $1;
- },
- args: [],
- source: "collectionLastTwo\x0a\x09^ #(3 -4)",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ArrayTest);
- $core.addMethod(
- $core.method({
- selector: "collectionOfPrintStrings",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- var $1;
- $1=["1", "2", "3", "-4"];
- return $1;
- },
- args: [],
- source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ArrayTest);
- $core.addMethod(
- $core.method({
- selector: "collectionSize",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return (4);
- },
- args: [],
- source: "collectionSize\x0a\x09^ 4",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ArrayTest);
- $core.addMethod(
- $core.method({
- selector: "collectionWithDuplicates",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- var $1;
- $1=["a", "b", "c", (1), (2), (1), "a"];
- return $1;
- },
- args: [],
- source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ArrayTest);
- $core.addMethod(
- $core.method({
- selector: "collectionWithNewValue",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- var $1;
- $1=[(1), (2), (3), (-4), "N"];
- return $1;
- },
- args: [],
- source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ArrayTest);
- $core.addMethod(
- $core.method({
- selector: "sampleNewIndex",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return (5);
- },
- args: [],
- source: "sampleNewIndex\x0a\x09^ 5",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ArrayTest);
- $core.addMethod(
- $core.method({
- selector: "samplesDo:",
- protocol: 'fixture',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
- $ctx1.supercall = false;
- $recv(aBlock)._value_value_((3),(3));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
- },
- args: ["aBlock"],
- source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
- referencedClasses: [],
- messageSends: ["samplesDo:", "value:value:"]
- }),
- $globals.ArrayTest);
- $core.addMethod(
- $core.method({
- selector: "testAdd",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var array;
- return $core.withContext(function($ctx1) {
- array=self._collection();
- $recv(array)._add_((6));
- self._assert_equals_($recv(array)._last(),(6));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
- },
- args: [],
- source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
- referencedClasses: [],
- messageSends: ["collection", "add:", "assert:equals:", "last"]
- }),
- $globals.ArrayTest);
- $core.addMethod(
- $core.method({
- selector: "testAddFirst",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=self._collection();
- $recv($1)._addFirst_((0));
- $2=$recv($1)._yourself();
- self._assert_equals_($recv($2)._first(),(0));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
- },
- args: [],
- source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
- referencedClasses: [],
- messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
- }),
- $globals.ArrayTest);
- $core.addMethod(
- $core.method({
- selector: "testPrintString",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var array;
- function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5,$6,$7,$8,$9;
- array=$recv($Array())._new();
- $1=$recv(array)._printString();
- $ctx1.sendIdx["printString"]=1;
- self._assert_equals_($1,"an Array ()");
- $ctx1.sendIdx["assert:equals:"]=1;
- $2=array;
- $recv($2)._add_((1));
- $ctx1.sendIdx["add:"]=1;
- $3=$recv($2)._add_((3));
- $ctx1.sendIdx["add:"]=2;
- $4=$recv(array)._printString();
- $ctx1.sendIdx["printString"]=2;
- self._assert_equals_($4,"an Array (1 3)");
- $ctx1.sendIdx["assert:equals:"]=2;
- $recv(array)._add_("foo");
- $5=$recv(array)._printString();
- $ctx1.sendIdx["printString"]=3;
- self._assert_equals_($5,"an Array (1 3 'foo')");
- $ctx1.sendIdx["assert:equals:"]=3;
- $6=array;
- $recv($6)._remove_((1));
- $ctx1.sendIdx["remove:"]=1;
- $7=$recv($6)._remove_((3));
- $8=$recv(array)._printString();
- $ctx1.sendIdx["printString"]=4;
- self._assert_equals_($8,"an Array ('foo')");
- $ctx1.sendIdx["assert:equals:"]=4;
- $recv(array)._addLast_((3));
- $ctx1.sendIdx["addLast:"]=1;
- $9=$recv(array)._printString();
- $ctx1.sendIdx["printString"]=5;
- self._assert_equals_($9,"an Array ('foo' 3)");
- $ctx1.sendIdx["assert:equals:"]=5;
- $recv(array)._addLast_((3));
- self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
- },
- args: [],
- 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)'.",
- referencedClasses: ["Array"],
- messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
- }),
- $globals.ArrayTest);
- $core.addMethod(
- $core.method({
- selector: "testRemove",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var array;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- array=[(1), (2), (3), (4), (5)];
- $recv(array)._remove_((3));
- $ctx1.sendIdx["remove:"]=1;
- self._assert_equals_(array,[(1), (2), (4), (5)]);
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(array)._remove_((3));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$Error());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Error"],
- messageSends: ["remove:", "assert:equals:", "should:raise:"]
- }),
- $globals.ArrayTest);
- $core.addMethod(
- $core.method({
- selector: "testRemoveFromTo",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
- $ctx1.sendIdx["removeFrom:to:"]=1;
- self._assert_equals_($1,[(4)]);
- $ctx1.sendIdx["assert:equals:"]=1;
- $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
- $ctx1.sendIdx["removeFrom:to:"]=2;
- self._assert_equals_($2,[(1), (4)]);
- $ctx1.sendIdx["assert:equals:"]=2;
- self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
- },
- args: [],
- 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)",
- referencedClasses: [],
- messageSends: ["assert:equals:", "removeFrom:to:"]
- }),
- $globals.ArrayTest);
- $core.addMethod(
- $core.method({
- selector: "testRemoveIndex",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=[(1), (2), (3), (4)]._removeIndex_((2));
- $ctx1.sendIdx["removeIndex:"]=1;
- self._assert_equals_($1,[(1), (3), (4)]);
- $ctx1.sendIdx["assert:equals:"]=1;
- $2=[(1), (2), (3), (4)]._removeIndex_((1));
- $ctx1.sendIdx["removeIndex:"]=2;
- self._assert_equals_($2,[(2), (3), (4)]);
- $ctx1.sendIdx["assert:equals:"]=2;
- self._assert_equals_(["hello"]._removeIndex_((1)),[]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
- },
- args: [],
- 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: #()",
- referencedClasses: [],
- messageSends: ["assert:equals:", "removeIndex:"]
- }),
- $globals.ArrayTest);
- $core.addMethod(
- $core.method({
- selector: "testRemoveLast",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var array;
- return $core.withContext(function($ctx1) {
- array=[(1), (2)];
- $recv(array)._removeLast();
- self._assert_equals_($recv(array)._last(),(1));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
- },
- args: [],
- source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
- referencedClasses: [],
- messageSends: ["removeLast", "assert:equals:", "last"]
- }),
- $globals.ArrayTest);
- $core.addMethod(
- $core.method({
- selector: "testReversed",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var array;
- return $core.withContext(function($ctx1) {
- array=[(5), (4), (3), (2), (1)];
- self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
- },
- args: [],
- source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
- referencedClasses: [],
- messageSends: ["assert:equals:", "reversed"]
- }),
- $globals.ArrayTest);
- $core.addMethod(
- $core.method({
- selector: "testSort",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var array;
- return $core.withContext(function($ctx1) {
- array=[(10), (1), (5)];
- $recv(array)._sort();
- self._assert_equals_(array,[(1), (5), (10)]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
- },
- args: [],
- source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
- referencedClasses: [],
- messageSends: ["sort", "assert:equals:"]
- }),
- $globals.ArrayTest);
- $core.addMethod(
- $core.method({
- selector: "collectionClass",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
- return $Array();
- },
- args: [],
- source: "collectionClass\x0a\x09^ Array",
- referencedClasses: ["Array"],
- messageSends: []
- }),
- $globals.ArrayTest.klass);
- $core.addClass('StringTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "collection",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return "helLo";
- },
- args: [],
- source: "collection\x0a\x09^ 'helLo'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "collectionFirst",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return "h";
- },
- args: [],
- source: "collectionFirst\x0a\x09^ 'h'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "collectionFirstTwo",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return "he";
- },
- args: [],
- source: "collectionFirstTwo\x0a\x09^ 'he'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "collectionLast",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return "o";
- },
- args: [],
- source: "collectionLast\x0a\x09^ 'o'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "collectionLastTwo",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return "Lo";
- },
- args: [],
- source: "collectionLastTwo\x0a\x09^ 'Lo'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "collectionOfPrintStrings",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return "'h''e''l''L''o'";
- },
- args: [],
- source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "collectionSize",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return (5);
- },
- args: [],
- source: "collectionSize\x0a\x09^ 5",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "collectionWithDuplicates",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return "abbaerte";
- },
- args: [],
- source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "collectionWithNewValue",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return "helLoN";
- },
- args: [],
- source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "sampleNewValueAsCollection",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return "N";
- },
- args: [],
- source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "samplesDo:",
- protocol: 'fixture',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.StringTest.superclass.fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
- $ctx1.supercall = false;
- $recv(aBlock)._value_value_((3),"l");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
- },
- args: ["aBlock"],
- source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
- referencedClasses: [],
- messageSends: ["samplesDo:", "value:value:"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testAddAll",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- var $1;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- $1=self._collection();
- $ctx2.sendIdx["collection"]=1;
- return $recv($1)._addAll_(self._collection());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$Error());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
- },
- args: [],
- source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
- referencedClasses: ["Error"],
- messageSends: ["should:raise:", "addAll:", "collection"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testAddRemove",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return "hello"._add_("a");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$Error());
- $ctx1.sendIdx["should:raise:"]=1;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return "hello"._remove_("h");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }),$Error());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
- },
- args: [],
- source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
- referencedClasses: ["Error"],
- messageSends: ["should:raise:", "add:", "remove:"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testAsArray",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
- },
- args: [],
- source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
- referencedClasses: [],
- messageSends: ["assert:equals:", "asArray"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testAsLowerCase",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_("JACKIE"._asLowercase(),"jackie");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
- },
- args: [],
- source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
- referencedClasses: [],
- messageSends: ["assert:equals:", "asLowercase"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testAsNumber",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1="3"._asNumber();
- $ctx1.sendIdx["asNumber"]=1;
- self._assert_equals_($1,(3));
- $ctx1.sendIdx["assert:equals:"]=1;
- $2="-3"._asNumber();
- $ctx1.sendIdx["asNumber"]=2;
- self._assert_equals_($2,(-3));
- $ctx1.sendIdx["assert:equals:"]=2;
- self._assert_equals_("-1.5"._asNumber(),(-1.5));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
- },
- args: [],
- 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.",
- referencedClasses: [],
- messageSends: ["assert:equals:", "asNumber"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testAsUpperCase",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_("jackie"._asUppercase(),"JACKIE");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
- },
- args: [],
- source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
- referencedClasses: [],
- messageSends: ["assert:equals:", "asUppercase"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testAsciiValue",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var characterA,characterU;
- return $core.withContext(function($ctx1) {
- var $1;
- characterA="A";
- characterU="U";
- $1=$recv(characterA)._asciiValue();
- $ctx1.sendIdx["asciiValue"]=1;
- self._assert_equals_($1,(65));
- $ctx1.sendIdx["assert:equals:"]=1;
- self._assert_equals_($recv(characterU)._asciiValue(),(85));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["assert:equals:", "asciiValue"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testAtIfAbsentPut",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return "hello"._at_ifAbsentPut_((6),(function(){
- return "a";
- }));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$Error());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
- },
- args: [],
- source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
- referencedClasses: ["Error"],
- messageSends: ["should:raise:", "at:ifAbsentPut:"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testAtPut",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return "hello"._at_put_((1),"a");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$Error());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
- },
- args: [],
- source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
- referencedClasses: ["Error"],
- messageSends: ["should:raise:", "at:put:"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testCapitalized",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3;
- $1="test"._capitalized();
- $ctx1.sendIdx["capitalized"]=1;
- self._assert_equals_($1,"Test");
- $ctx1.sendIdx["assert:equals:"]=1;
- $2="Test"._capitalized();
- $ctx1.sendIdx["capitalized"]=2;
- self._assert_equals_($2,"Test");
- $ctx1.sendIdx["assert:equals:"]=2;
- self._assert_equals_(""._capitalized(),"");
- $ctx1.sendIdx["assert:equals:"]=3;
- $3="Test"._isCapitalized();
- $ctx1.sendIdx["isCapitalized"]=1;
- self._assert_equals_($3,true);
- $ctx1.sendIdx["assert:equals:"]=4;
- self._assert_equals_("test"._isCapitalized(),false);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
- },
- args: [],
- 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.",
- referencedClasses: [],
- messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testCharCodeAt",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5;
- $1="jackie"._charCodeAt_((1));
- $ctx1.sendIdx["charCodeAt:"]=1;
- self._assert_equals_($1,(106));
- $ctx1.sendIdx["assert:equals:"]=1;
- $2="jackie"._charCodeAt_((2));
- $ctx1.sendIdx["charCodeAt:"]=2;
- self._assert_equals_($2,(97));
- $ctx1.sendIdx["assert:equals:"]=2;
- $3="jackie"._charCodeAt_((3));
- $ctx1.sendIdx["charCodeAt:"]=3;
- self._assert_equals_($3,(99));
- $ctx1.sendIdx["assert:equals:"]=3;
- $4="jackie"._charCodeAt_((4));
- $ctx1.sendIdx["charCodeAt:"]=4;
- self._assert_equals_($4,(107));
- $ctx1.sendIdx["assert:equals:"]=4;
- $5="jackie"._charCodeAt_((5));
- $ctx1.sendIdx["charCodeAt:"]=5;
- self._assert_equals_($5,(105));
- $ctx1.sendIdx["assert:equals:"]=5;
- self._assert_equals_("jackie"._charCodeAt_((6)),(101));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["assert:equals:", "charCodeAt:"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testCopyFromTo",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1="jackie"._copyFrom_to_((1),(3));
- $ctx1.sendIdx["copyFrom:to:"]=1;
- self._assert_equals_($1,"jac");
- $ctx1.sendIdx["assert:equals:"]=1;
- self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
- },
- args: [],
- source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
- referencedClasses: [],
- messageSends: ["assert:equals:", "copyFrom:to:"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testCopySeparates",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $3,$2,$1;
- $3=self._collection();
- $ctx1.sendIdx["collection"]=1;
- $2=$recv($3)._copy();
- $1=$recv($2).__eq_eq(self._collection());
- self._assert_($1);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
- },
- args: [],
- source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
- referencedClasses: [],
- messageSends: ["assert:", "==", "copy", "collection"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testCopyWithoutAll",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
- },
- args: [],
- source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
- referencedClasses: [],
- messageSends: ["assert:equals:", "copyWithoutAll:"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testEquality",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3;
- self._assert_equals_("hello","hello");
- $ctx1.sendIdx["assert:equals:"]=1;
- $1="hello".__eq("world");
- $ctx1.sendIdx["="]=1;
- self._deny_($1);
- $ctx1.sendIdx["deny:"]=1;
- $2="hello".__eq([]._at_ifAbsent_((1),(function(){
- })));
- $ctx1.sendIdx["="]=2;
- self._deny_($2);
- $ctx1.sendIdx["deny:"]=2;
- $3="hello"._yourself();
- $ctx1.sendIdx["yourself"]=1;
- self._assert_equals_("hello",$3);
- $ctx1.sendIdx["assert:equals:"]=2;
- self._assert_equals_("hello"._yourself(),"hello");
- self._deny_("".__eq((0)));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testIdentity",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$4,$3,$5;
- $1="hello".__eq_eq("hello");
- $ctx1.sendIdx["=="]=1;
- self._assert_($1);
- $ctx1.sendIdx["assert:"]=1;
- $2="hello".__eq_eq("world");
- $ctx1.sendIdx["=="]=2;
- self._deny_($2);
- $ctx1.sendIdx["deny:"]=1;
- $4="hello"._yourself();
- $ctx1.sendIdx["yourself"]=1;
- $3="hello".__eq_eq($4);
- $ctx1.sendIdx["=="]=3;
- self._assert_($3);
- $ctx1.sendIdx["assert:"]=2;
- $5=$recv("hello"._yourself()).__eq_eq("hello");
- $ctx1.sendIdx["=="]=4;
- self._assert_($5);
- self._deny_("".__eq_eq((0)));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["assert:", "==", "deny:", "yourself"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testIncludesSubString",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1="amber"._includesSubString_("ber");
- $ctx1.sendIdx["includesSubString:"]=1;
- self._assert_($1);
- self._deny_("amber"._includesSubString_("zork"));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
- },
- args: [],
- source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
- referencedClasses: [],
- messageSends: ["assert:", "includesSubString:", "deny:"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testIndexOfStartingAtWithNull",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testIndexOfWithNull",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testIsVowel",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var vowel,consonant;
- return $core.withContext(function($ctx1) {
- var $1;
- vowel="u";
- consonant="z";
- $1=$recv(vowel)._isVowel();
- $ctx1.sendIdx["isVowel"]=1;
- self._assert_equals_($1,true);
- $ctx1.sendIdx["assert:equals:"]=1;
- self._assert_equals_($recv(consonant)._isVowel(),false);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["assert:equals:", "isVowel"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testJoin",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
- },
- args: [],
- source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
- referencedClasses: [],
- messageSends: ["assert:equals:", "join:"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testRemoveAll",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self._collection())._removeAll();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$Error());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
- },
- args: [],
- source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
- referencedClasses: ["Error"],
- messageSends: ["should:raise:", "removeAll", "collection"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testReversed",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
- },
- args: [],
- source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
- referencedClasses: [],
- messageSends: ["assert:equals:", "reversed"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testStreamContents",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $core.withContext(function($ctx1) {
- var $1;
- self._assert_equals_($recv($String())._streamContents_((function(aStream){
- return $core.withContext(function($ctx2) {
- $recv(aStream)._nextPutAll_("hello");
- $ctx2.sendIdx["nextPutAll:"]=1;
- $recv(aStream)._space();
- $1=$recv(aStream)._nextPutAll_("world");
- return $1;
- }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
- })),"hello world");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
- },
- args: [],
- 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'",
- referencedClasses: ["String"],
- messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testSubStrings",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
- },
- args: [],
- source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
- referencedClasses: [],
- messageSends: ["assert:equals:", "subStrings:"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testTrim",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_(" jackie"._trimLeft(),"jackie");
- $ctx1.sendIdx["assert:equals:"]=1;
- self._assert_equals_("jackie "._trimRight(),"jackie");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
- },
- args: [],
- source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
- referencedClasses: [],
- messageSends: ["assert:equals:", "trimLeft", "trimRight"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "testValue",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_("asString"._value_((1)),"1");
- $ctx1.sendIdx["assert:equals:"]=1;
- self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
- },
- args: [],
- 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')",
- referencedClasses: [],
- messageSends: ["assert:equals:", "value:", "collect:"]
- }),
- $globals.StringTest);
- $core.addMethod(
- $core.method({
- selector: "collectionClass",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $String();
- },
- args: [],
- source: "collectionClass\x0a\x09^ String",
- referencedClasses: ["String"],
- messageSends: []
- }),
- $globals.StringTest.klass);
- $core.addClass('SetTest', $globals.CollectionTest, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "collection",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($Set())._new();
- $recv($2)._add_($Smalltalk());
- $ctx1.sendIdx["add:"]=1;
- $recv($2)._add_(nil);
- $ctx1.sendIdx["add:"]=2;
- $recv($2)._add_((3).__at((3)));
- $ctx1.sendIdx["add:"]=3;
- $recv($2)._add_(false);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Set", "Smalltalk"],
- messageSends: ["add:", "new", "@", "yourself"]
- }),
- $globals.SetTest);
- $core.addMethod(
- $core.method({
- selector: "collectionOfPrintStrings",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($Set())._new();
- $recv($2)._add_("a SmalltalkImage");
- $ctx1.sendIdx["add:"]=1;
- $recv($2)._add_("nil");
- $ctx1.sendIdx["add:"]=2;
- $recv($2)._add_("3@3");
- $ctx1.sendIdx["add:"]=3;
- $recv($2)._add_("false");
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Set"],
- messageSends: ["add:", "new", "yourself"]
- }),
- $globals.SetTest);
- $core.addMethod(
- $core.method({
- selector: "collectionSize",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return (4);
- },
- args: [],
- source: "collectionSize\x0a\x09^ 4",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SetTest);
- $core.addMethod(
- $core.method({
- selector: "collectionWithDuplicates",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._collection();
- $recv($2)._add_((0));
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
- },
- args: [],
- source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
- referencedClasses: [],
- messageSends: ["add:", "collection", "yourself"]
- }),
- $globals.SetTest);
- $core.addMethod(
- $core.method({
- selector: "collectionWithNewValue",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($Set())._new();
- $recv($2)._add_($Smalltalk());
- $ctx1.sendIdx["add:"]=1;
- $recv($2)._add_(nil);
- $ctx1.sendIdx["add:"]=2;
- $recv($2)._add_((3).__at((3)));
- $ctx1.sendIdx["add:"]=3;
- $recv($2)._add_("N");
- $ctx1.sendIdx["add:"]=4;
- $recv($2)._add_(false);
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Set", "Smalltalk"],
- messageSends: ["add:", "new", "@", "yourself"]
- }),
- $globals.SetTest);
- $core.addMethod(
- $core.method({
- selector: "testAddAll",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
- (
- $ctx1.supercall = true,
- $globals.SetTest.superclass.fn.prototype._testAddAll.apply($recv(self), []));
- $ctx1.supercall = false;
- $2=self._collection();
- $ctx1.sendIdx["collection"]=1;
- $3=$2;
- $4=self._collection();
- $ctx1.sendIdx["collection"]=2;
- $recv($3)._addAll_($4);
- $ctx1.sendIdx["addAll:"]=1;
- $5=$recv($2)._yourself();
- $ctx1.sendIdx["yourself"]=1;
- $1=$5;
- $6=self._collection();
- $ctx1.sendIdx["collection"]=3;
- self._assert_equals_($1,$6);
- $ctx1.sendIdx["assert:equals:"]=1;
- $8=self._collection();
- $ctx1.sendIdx["collection"]=4;
- $9=$8;
- $10=self._collectionWithNewValue();
- $ctx1.sendIdx["collectionWithNewValue"]=1;
- $recv($9)._addAll_($10);
- $ctx1.sendIdx["addAll:"]=2;
- $11=$recv($8)._yourself();
- $ctx1.sendIdx["yourself"]=2;
- $7=$11;
- $12=self._collectionWithNewValue();
- $ctx1.sendIdx["collectionWithNewValue"]=2;
- self._assert_equals_($7,$12);
- $ctx1.sendIdx["assert:equals:"]=2;
- $14=self._collectionWithNewValue();
- $ctx1.sendIdx["collectionWithNewValue"]=3;
- $recv($14)._addAll_(self._collection());
- $15=$recv($14)._yourself();
- $13=$15;
- self._assert_equals_($13,self._collectionWithNewValue());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
- }),
- $globals.SetTest);
- $core.addMethod(
- $core.method({
- selector: "testAddRemove",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var set;
- function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- set=$recv($Set())._new();
- self._assert_($recv(set)._isEmpty());
- $ctx1.sendIdx["assert:"]=1;
- $recv(set)._add_((3));
- $ctx1.sendIdx["add:"]=1;
- $1=$recv(set)._includes_((3));
- $ctx1.sendIdx["includes:"]=1;
- self._assert_($1);
- $ctx1.sendIdx["assert:"]=2;
- $recv(set)._add_((5));
- $2=$recv(set)._includes_((5));
- $ctx1.sendIdx["includes:"]=2;
- self._assert_($2);
- $recv(set)._remove_((3));
- self._deny_($recv(set)._includes_((3)));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
- },
- args: [],
- 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)",
- referencedClasses: ["Set"],
- messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
- }),
- $globals.SetTest);
- $core.addMethod(
- $core.method({
- selector: "testAt",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv($recv($Set())._new())._at_put_((1),(2));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$Error());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
- },
- args: [],
- source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
- referencedClasses: ["Set", "Error"],
- messageSends: ["should:raise:", "at:put:", "new"]
- }),
- $globals.SetTest);
- $core.addMethod(
- $core.method({
- selector: "testCollect",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- (
- $ctx1.supercall = true,
- $globals.SetTest.superclass.fn.prototype._testCollect.apply($recv(self), []));
- $ctx1.supercall = false;
- $2=[(5), (6), (8)]._asSet();
- $ctx1.sendIdx["asSet"]=1;
- $1=$recv($2)._collect_((function(x){
- return $core.withContext(function($ctx2) {
- return $recv(x).__backslash_backslash((3));
- }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
- }));
- self._assert_equals_($1,[(0), (2)]._asSet());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
- },
- args: [],
- source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
- referencedClasses: [],
- messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
- }),
- $globals.SetTest);
- $core.addMethod(
- $core.method({
- selector: "testComma",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
- (
- $ctx1.supercall = true,
- $globals.SetTest.superclass.fn.prototype._testComma.apply($recv(self), []));
- $ctx1.supercall = false;
- $2=self._collection();
- $ctx1.sendIdx["collection"]=1;
- $3=self._collection();
- $ctx1.sendIdx["collection"]=2;
- $1=$recv($2).__comma($3);
- $ctx1.sendIdx[","]=1;
- $4=self._collection();
- $ctx1.sendIdx["collection"]=3;
- self._assert_equals_($1,$4);
- $ctx1.sendIdx["assert:equals:"]=1;
- $6=self._collection();
- $ctx1.sendIdx["collection"]=4;
- $7=self._collectionWithNewValue();
- $ctx1.sendIdx["collectionWithNewValue"]=1;
- $5=$recv($6).__comma($7);
- $ctx1.sendIdx[","]=2;
- $8=self._collectionWithNewValue();
- $ctx1.sendIdx["collectionWithNewValue"]=2;
- self._assert_equals_($5,$8);
- $ctx1.sendIdx["assert:equals:"]=2;
- $10=self._collectionWithNewValue();
- $ctx1.sendIdx["collectionWithNewValue"]=3;
- $9=$recv($10).__comma(self._collection());
- self._assert_equals_($9,self._collectionWithNewValue());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
- }),
- $globals.SetTest);
- $core.addMethod(
- $core.method({
- selector: "testComparing",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$6,$7,$5,$9,$8;
- $1=[(0), (2)]._asSet();
- $ctx1.sendIdx["asSet"]=1;
- $2=[(0), (2)]._asSet();
- $ctx1.sendIdx["asSet"]=2;
- self._assert_equals_($1,$2);
- $ctx1.sendIdx["assert:equals:"]=1;
- $3=[(2), (0)]._asSet();
- $ctx1.sendIdx["asSet"]=3;
- $4=[(0), (2)]._asSet();
- $ctx1.sendIdx["asSet"]=4;
- self._assert_equals_($3,$4);
- $6=[(0), (2), (3)]._asSet();
- $ctx1.sendIdx["asSet"]=5;
- $7=[(0), (2)]._asSet();
- $ctx1.sendIdx["asSet"]=6;
- $5=$recv($6).__eq($7);
- $ctx1.sendIdx["="]=1;
- self._deny_($5);
- $ctx1.sendIdx["deny:"]=1;
- $9=[(1), (2)]._asSet();
- $ctx1.sendIdx["asSet"]=7;
- $8=$recv($9).__eq([(0), (2)]._asSet());
- self._deny_($8);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["assert:equals:", "asSet", "deny:", "="]
- }),
- $globals.SetTest);
- $core.addMethod(
- $core.method({
- selector: "testPrintString",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var set;
- function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5,$6,$7,$8,$9;
- set=$recv($Set())._new();
- $1=$recv(set)._printString();
- $ctx1.sendIdx["printString"]=1;
- self._assert_equals_($1,"a Set ()");
- $ctx1.sendIdx["assert:equals:"]=1;
- $2=set;
- $recv($2)._add_((1));
- $ctx1.sendIdx["add:"]=1;
- $3=$recv($2)._add_((3));
- $ctx1.sendIdx["add:"]=2;
- $4=$recv(set)._printString();
- $ctx1.sendIdx["printString"]=2;
- self._assert_equals_($4,"a Set (1 3)");
- $ctx1.sendIdx["assert:equals:"]=2;
- $recv(set)._add_("foo");
- $ctx1.sendIdx["add:"]=3;
- $5=$recv(set)._printString();
- $ctx1.sendIdx["printString"]=3;
- self._assert_equals_($5,"a Set (1 3 'foo')");
- $ctx1.sendIdx["assert:equals:"]=3;
- $6=set;
- $recv($6)._remove_((1));
- $ctx1.sendIdx["remove:"]=1;
- $7=$recv($6)._remove_((3));
- $8=$recv(set)._printString();
- $ctx1.sendIdx["printString"]=4;
- self._assert_equals_($8,"a Set ('foo')");
- $ctx1.sendIdx["assert:equals:"]=4;
- $recv(set)._add_((3));
- $ctx1.sendIdx["add:"]=4;
- $9=$recv(set)._printString();
- $ctx1.sendIdx["printString"]=5;
- self._assert_equals_($9,"a Set (3 'foo')");
- $ctx1.sendIdx["assert:equals:"]=5;
- $recv(set)._add_((3));
- self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
- },
- args: [],
- 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'')'",
- referencedClasses: ["Set"],
- messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
- }),
- $globals.SetTest);
- $core.addMethod(
- $core.method({
- selector: "testUnboxedObjects",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $4,$3,$2,$1;
- $4="foo"._yourself();
- $ctx1.sendIdx["yourself"]=1;
- $3=[$4,"foo"._yourself()];
- $2=$recv($3)._asSet();
- $1=$recv($2)._asArray();
- self._assert_equals_($1,["foo"]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
- },
- args: [],
- source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
- referencedClasses: [],
- messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
- }),
- $globals.SetTest);
- $core.addMethod(
- $core.method({
- selector: "testUnicity",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var set;
- function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
- return $core.withContext(function($ctx1) {
- var $1;
- set=$recv($Set())._new();
- $recv(set)._add_((21));
- $ctx1.sendIdx["add:"]=1;
- $recv(set)._add_("hello");
- $ctx1.sendIdx["add:"]=2;
- $recv(set)._add_((21));
- $ctx1.sendIdx["add:"]=3;
- $1=$recv(set)._size();
- $ctx1.sendIdx["size"]=1;
- self._assert_equals_($1,(2));
- $ctx1.sendIdx["assert:equals:"]=1;
- $recv(set)._add_("hello");
- self._assert_equals_($recv(set)._size(),(2));
- $ctx1.sendIdx["assert:equals:"]=2;
- self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
- },
- args: [],
- 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')",
- referencedClasses: ["Set"],
- messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
- }),
- $globals.SetTest);
- $core.addMethod(
- $core.method({
- selector: "collectionClass",
- protocol: 'fixture',
- fn: function (){
- var self=this;
- function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
- return $Set();
- },
- args: [],
- source: "collectionClass\x0a\x09^ Set",
- referencedClasses: ["Set"],
- messageSends: []
- }),
- $globals.SetTest.klass);
- $core.addClass('ConsoleTranscriptTest', $globals.TestCase, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "testShow",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var originalTranscript;
- function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
- function $ConsoleTranscript(){return $globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- originalTranscript=$recv($Transcript())._current();
- $recv($Transcript())._register_($recv($ConsoleTranscript())._new());
- $ctx1.sendIdx["register:"]=1;
- self._shouldnt_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv($Transcript())._show_("Hello console!");
- $ctx2.sendIdx["show:"]=1;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$Error());
- $ctx1.sendIdx["shouldnt:raise:"]=1;
- self._shouldnt_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv($Transcript())._show_(console);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }),$Error());
- $recv($Transcript())._register_(originalTranscript);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
- },
- args: [],
- 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.",
- referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
- messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
- }),
- $globals.ConsoleTranscriptTest);
- $core.addClass('DateTest', $globals.TestCase, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "testEquality",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var now;
- function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
- return $core.withContext(function($ctx1) {
- var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
- now=$recv($Date())._new();
- $1=$recv(now).__eq(now);
- $ctx1.sendIdx["="]=1;
- self._assert_($1);
- $ctx1.sendIdx["assert:"]=1;
- $3=now;
- $4=$recv($Date())._fromMilliseconds_((0));
- $ctx1.sendIdx["fromMilliseconds:"]=1;
- $2=$recv($3).__eq($4);
- $ctx1.sendIdx["="]=2;
- self._deny_($2);
- $6=$recv($Date())._fromMilliseconds_((12345678));
- $ctx1.sendIdx["fromMilliseconds:"]=2;
- $7=$recv($Date())._fromMilliseconds_((12345678));
- $ctx1.sendIdx["fromMilliseconds:"]=3;
- $5=$recv($6).__eq($7);
- $ctx1.sendIdx["="]=3;
- self._assert_($5);
- $ctx1.sendIdx["assert:"]=2;
- $9=now;
- $11=$recv(now)._asMilliseconds();
- $ctx1.sendIdx["asMilliseconds"]=1;
- $10=$recv($Date())._fromMilliseconds_($11);
- $ctx1.sendIdx["fromMilliseconds:"]=4;
- $8=$recv($9).__eq($10);
- $ctx1.sendIdx["="]=4;
- self._assert_($8);
- $ctx1.sendIdx["assert:"]=3;
- self._assert_($recv($recv($Date())._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Date"],
- messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
- }),
- $globals.DateTest);
- $core.addMethod(
- $core.method({
- selector: "testIdentity",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var now;
- function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
- return $core.withContext(function($ctx1) {
- var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
- now=$recv($Date())._new();
- $1=$recv(now).__eq_eq(now);
- $ctx1.sendIdx["=="]=1;
- self._assert_($1);
- $3=now;
- $4=$recv($Date())._fromMilliseconds_((0));
- $ctx1.sendIdx["fromMilliseconds:"]=1;
- $2=$recv($3).__eq_eq($4);
- $ctx1.sendIdx["=="]=2;
- self._deny_($2);
- $ctx1.sendIdx["deny:"]=1;
- $6=$recv($Date())._fromMilliseconds_((12345678));
- $ctx1.sendIdx["fromMilliseconds:"]=2;
- $7=$recv($Date())._fromMilliseconds_((12345678));
- $ctx1.sendIdx["fromMilliseconds:"]=3;
- $5=$recv($6).__eq_eq($7);
- $ctx1.sendIdx["=="]=3;
- self._deny_($5);
- $ctx1.sendIdx["deny:"]=2;
- $9=now;
- $11=$recv(now)._asMilliseconds();
- $ctx1.sendIdx["asMilliseconds"]=1;
- $10=$recv($Date())._fromMilliseconds_($11);
- $ctx1.sendIdx["fromMilliseconds:"]=4;
- $8=$recv($9).__eq_eq($10);
- $ctx1.sendIdx["=="]=4;
- self._deny_($8);
- $ctx1.sendIdx["deny:"]=3;
- self._deny_($recv($recv($Date())._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Date"],
- messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
- }),
- $globals.DateTest);
- $core.addClass('JSObjectProxyTest', $globals.TestCase, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "jsNull",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return null;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"jsNull",{},$globals.JSObjectProxyTest)});
- },
- args: [],
- source: "jsNull\x0a\x09<return null>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JSObjectProxyTest);
- $core.addMethod(
- $core.method({
- selector: "jsObject",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
- return self;
- }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
- },
- args: [],
- source: "jsObject\x0a\x09<return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JSObjectProxyTest);
- $core.addMethod(
- $core.method({
- selector: "jsUndefined",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
- },
- args: [],
- source: "jsUndefined\x0a\x09<return>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JSObjectProxyTest);
- $core.addMethod(
- $core.method({
- selector: "testAtIfAbsent",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var testObject;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3;
- testObject=self._jsObject();
- $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
- return "Property does not exist";
- }));
- $ctx1.sendIdx["at:ifAbsent:"]=1;
- self._assert_equals_($1,"Property does not exist");
- $ctx1.sendIdx["assert:equals:"]=1;
- $2=$recv(testObject)._at_ifAbsent_("e",(function(){
- return "Property does not exist";
- }));
- $ctx1.sendIdx["at:ifAbsent:"]=2;
- self._assert_equals_($2,nil);
- $ctx1.sendIdx["assert:equals:"]=2;
- $3=$recv(testObject)._at_ifAbsent_("a",(function(){
- return "Property does not exist";
- }));
- $ctx1.sendIdx["at:ifAbsent:"]=3;
- self._assert_equals_($3,(1));
- $ctx1.sendIdx["assert:equals:"]=3;
- self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
- return "Property does not exist";
- })),nil);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
- },
- args: [],
- 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.",
- referencedClasses: [],
- messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
- }),
- $globals.JSObjectProxyTest);
- $core.addMethod(
- $core.method({
- selector: "testAtIfPresent",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var testObject;
- return $core.withContext(function($ctx1) {
- var $2,$1,$4,$3,$6,$5;
- testObject=self._jsObject();
- $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
- return $core.withContext(function($ctx2) {
- $2=$recv(x)._asString();
- $ctx2.sendIdx["asString"]=1;
- return "hello ".__comma($2);
- $ctx2.sendIdx[","]=1;
- }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
- }));
- $ctx1.sendIdx["at:ifPresent:"]=1;
- self._assert_equals_($1,nil);
- $ctx1.sendIdx["assert:equals:"]=1;
- $3=$recv(testObject)._at_ifPresent_("e",(function(x){
- return $core.withContext(function($ctx2) {
- $4=$recv(x)._asString();
- $ctx2.sendIdx["asString"]=2;
- return "hello ".__comma($4);
- $ctx2.sendIdx[","]=2;
- }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
- }));
- $ctx1.sendIdx["at:ifPresent:"]=2;
- self._assert_equals_($3,"hello nil");
- $ctx1.sendIdx["assert:equals:"]=2;
- $5=$recv(testObject)._at_ifPresent_("a",(function(x){
- return $core.withContext(function($ctx2) {
- $6=$recv(x)._asString();
- $ctx2.sendIdx["asString"]=3;
- return "hello ".__comma($6);
- $ctx2.sendIdx[","]=3;
- }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
- }));
- $ctx1.sendIdx["at:ifPresent:"]=3;
- self._assert_equals_($5,"hello 1");
- $ctx1.sendIdx["assert:equals:"]=3;
- self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
- return $core.withContext(function($ctx2) {
- return "hello ".__comma($recv(x)._asString());
- }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
- })),"hello nil");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
- },
- args: [],
- 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'.",
- referencedClasses: [],
- messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
- }),
- $globals.JSObjectProxyTest);
- $core.addMethod(
- $core.method({
- selector: "testAtIfPresentIfAbsent",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var testObject;
- return $core.withContext(function($ctx1) {
- var $2,$1,$4,$3,$6,$5;
- testObject=self._jsObject();
- $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
- return $core.withContext(function($ctx2) {
- $2=$recv(x)._asString();
- $ctx2.sendIdx["asString"]=1;
- return "hello ".__comma($2);
- $ctx2.sendIdx[","]=1;
- }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
- }),(function(){
- return "not present";
- }));
- $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
- self._assert_equals_($1,"not present");
- $ctx1.sendIdx["assert:equals:"]=1;
- $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
- return $core.withContext(function($ctx2) {
- $4=$recv(x)._asString();
- $ctx2.sendIdx["asString"]=2;
- return "hello ".__comma($4);
- $ctx2.sendIdx[","]=2;
- }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
- }),(function(){
- return "not present";
- }));
- $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
- self._assert_equals_($3,"hello nil");
- $ctx1.sendIdx["assert:equals:"]=2;
- $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
- return $core.withContext(function($ctx2) {
- $6=$recv(x)._asString();
- $ctx2.sendIdx["asString"]=3;
- return "hello ".__comma($6);
- $ctx2.sendIdx[","]=3;
- }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
- }),(function(){
- return "not present";
- }));
- $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
- self._assert_equals_($5,"hello 1");
- $ctx1.sendIdx["assert:equals:"]=3;
- self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
- return $core.withContext(function($ctx2) {
- return "hello ".__comma($recv(x)._asString());
- }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
- }),(function(){
- return "not present";
- })),"hello nil");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
- },
- args: [],
- 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'.",
- referencedClasses: [],
- messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
- }),
- $globals.JSObjectProxyTest);
- $core.addMethod(
- $core.method({
- selector: "testAtPut",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var testObject;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- testObject=self._jsObject();
- $2=$recv(testObject)._at_("abc");
- $ctx1.sendIdx["at:"]=1;
- $1=$recv($2).__tild_eq("xyz");
- self._assert_($1);
- self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
- $ctx1.sendIdx["assert:equals:"]=1;
- self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
- },
- args: [],
- 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'",
- referencedClasses: [],
- messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
- }),
- $globals.JSObjectProxyTest);
- $core.addMethod(
- $core.method({
- selector: "testComparison",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
- $1=$recv(console).__eq(console);
- $ctx1.sendIdx["="]=1;
- self._assert_($1);
- $2=$recv(console).__eq($recv($Object())._new());
- $ctx1.sendIdx["="]=2;
- self._deny_($2);
- $ctx1.sendIdx["deny:"]=1;
- self._deny_($recv(console).__eq(self._jsObject()));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Object"],
- messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
- }),
- $globals.JSObjectProxyTest);
- $core.addMethod(
- $core.method({
- selector: "testDNU",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
- return $core.withContext(function($ctx1) {
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self._jsObject())._foo();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$MessageNotUnderstood());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
- },
- args: [],
- source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
- referencedClasses: ["MessageNotUnderstood"],
- messageSends: ["should:raise:", "foo", "jsObject"]
- }),
- $globals.JSObjectProxyTest);
- $core.addMethod(
- $core.method({
- selector: "testDNURegression1057",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var jsObject;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- var $1;
- jsObject=[];
- $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
- $ctx1.sendIdx["basicAt:put:"]=1;
- $recv(jsObject)._basicAt_put_("foo",(3));
- self._shouldnt_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(jsObject)._foo();
- $ctx2.sendIdx["foo"]=1;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$Error());
- $ctx1.sendIdx["shouldnt:raise:"]=1;
- $1=$recv(jsObject)._foo();
- $ctx1.sendIdx["foo"]=2;
- self._assert_equals_($1,(3));
- $ctx1.sendIdx["assert:equals:"]=1;
- self._shouldnt_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(jsObject)._foo_((4));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }),$Error());
- self._assert_equals_($recv(jsObject)._foo(),(4));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testDNURegression1057",{jsObject:jsObject},$globals.JSObjectProxyTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Error"],
- messageSends: ["basicAt:put:", "shouldnt:raise:", "foo", "assert:equals:", "foo:"]
- }),
- $globals.JSObjectProxyTest);
- $core.addMethod(
- $core.method({
- selector: "testDNURegression1059",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var jsObject;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- jsObject=[];
- $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
- $ctx1.sendIdx["basicAt:put:"]=1;
- $recv(jsObject)._basicAt_put_("x",(3));
- $ctx1.sendIdx["basicAt:put:"]=2;
- $recv(jsObject)._basicAt_put_("x:",(function(){
- return $core.withContext(function($ctx2) {
- return self._error();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- self._shouldnt_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(jsObject)._x_((4));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }),$Error());
- self._assert_equals_($recv(jsObject)._x(),(4));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testDNURegression1059",{jsObject:jsObject},$globals.JSObjectProxyTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Error"],
- messageSends: ["basicAt:put:", "error", "shouldnt:raise:", "x:", "assert:equals:", "x"]
- }),
- $globals.JSObjectProxyTest);
- $core.addMethod(
- $core.method({
- selector: "testDNURegression1062",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var jsObject,stored;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- jsObject=[];
- $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
- $ctx1.sendIdx["basicAt:put:"]=1;
- $recv(jsObject)._basicAt_put_("x",(function(v){
- stored=v;
- return stored;
- }));
- self._shouldnt_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(jsObject)._x_((4));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }),$Error());
- self._assert_equals_(stored,(4));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testDNURegression1062",{jsObject:jsObject,stored:stored},$globals.JSObjectProxyTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Error"],
- messageSends: ["basicAt:put:", "shouldnt:raise:", "x:", "assert:equals:"]
- }),
- $globals.JSObjectProxyTest);
- $core.addMethod(
- $core.method({
- selector: "testDNUWithAllowJavaScriptCalls",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var jsObject;
- function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
- return $core.withContext(function($ctx1) {
- jsObject=[];
- $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(jsObject)._foo();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$MessageNotUnderstood());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
- },
- args: [],
- source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
- referencedClasses: ["MessageNotUnderstood"],
- messageSends: ["basicAt:put:", "should:raise:", "foo"]
- }),
- $globals.JSObjectProxyTest);
- $core.addMethod(
- $core.method({
- selector: "testMessageSend",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$4,$3;
- $2=self._jsObject();
- $ctx1.sendIdx["jsObject"]=1;
- $1=$recv($2)._a();
- self._assert_equals_($1,(1));
- $ctx1.sendIdx["assert:equals:"]=1;
- $4=self._jsObject();
- $ctx1.sendIdx["jsObject"]=2;
- $3=$recv($4)._b();
- self._assert_equals_($3,(2));
- $ctx1.sendIdx["assert:equals:"]=2;
- self._assert_equals_($recv(self._jsObject())._c_((3)),(3));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
- }),
- $globals.JSObjectProxyTest);
- $core.addMethod(
- $core.method({
- selector: "testMethodWithArguments",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_($recv(self._jsObject())._c_((1)),(1));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
- },
- args: [],
- source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
- referencedClasses: [],
- messageSends: ["assert:equals:", "c:", "jsObject"]
- }),
- $globals.JSObjectProxyTest);
- $core.addMethod(
- $core.method({
- selector: "testPrinting",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_($recv(self._jsObject())._printString(),"[object Object]");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
- },
- args: [],
- source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
- referencedClasses: [],
- messageSends: ["assert:equals:", "printString", "jsObject"]
- }),
- $globals.JSObjectProxyTest);
- $core.addMethod(
- $core.method({
- selector: "testPropertyThatReturnsEmptyString",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var object;
- return $core.withContext(function($ctx1) {
- var $1;
- object=self._jsObject();
- $1=$recv(object)._d();
- $ctx1.sendIdx["d"]=1;
- self._assert_equals_($1,"");
- $ctx1.sendIdx["assert:equals:"]=1;
- $recv(object)._d_("hello");
- self._assert_equals_($recv(object)._d(),"hello");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
- },
- args: [],
- 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'",
- referencedClasses: [],
- messageSends: ["jsObject", "assert:equals:", "d", "d:"]
- }),
- $globals.JSObjectProxyTest);
- $core.addMethod(
- $core.method({
- selector: "testPropertyThatReturnsUndefined",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var object;
- function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
- return $core.withContext(function($ctx1) {
- object=self._jsObject();
- self._shouldnt_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(object)._e();
- $ctx2.sendIdx["e"]=1;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$MessageNotUnderstood());
- self._assert_($recv($recv(object)._e())._isNil());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
- },
- args: [],
- source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
- referencedClasses: ["MessageNotUnderstood"],
- messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
- }),
- $globals.JSObjectProxyTest);
- $core.addMethod(
- $core.method({
- selector: "testSetPropertyWithFalsyValue",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var jsObject;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5;
- jsObject=self._jsObject();
- $1=$recv(jsObject)._a();
- $ctx1.sendIdx["a"]=1;
- self._assert_equals_($1,(1));
- $ctx1.sendIdx["assert:equals:"]=1;
- $recv(jsObject)._a_(self._jsNull());
- $ctx1.sendIdx["a:"]=1;
- $2=$recv(jsObject)._a();
- $ctx1.sendIdx["a"]=2;
- self._assert_equals_($2,nil);
- $ctx1.sendIdx["assert:equals:"]=2;
- $recv(jsObject)._a_((0));
- $ctx1.sendIdx["a:"]=2;
- $3=$recv(jsObject)._a();
- $ctx1.sendIdx["a"]=3;
- self._assert_equals_($3,(0));
- $ctx1.sendIdx["assert:equals:"]=3;
- $recv(jsObject)._a_(self._jsUndefined());
- $ctx1.sendIdx["a:"]=3;
- $4=$recv(jsObject)._a();
- $ctx1.sendIdx["a"]=4;
- self._assert_equals_($4,nil);
- $ctx1.sendIdx["assert:equals:"]=4;
- $recv(jsObject)._a_("");
- $ctx1.sendIdx["a:"]=4;
- $5=$recv(jsObject)._a();
- $ctx1.sendIdx["a"]=5;
- self._assert_equals_($5,"");
- $ctx1.sendIdx["assert:equals:"]=5;
- $recv(jsObject)._a_(false);
- self._assert_equals_($recv(jsObject)._a(),false);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"]
- }),
- $globals.JSObjectProxyTest);
- $core.addMethod(
- $core.method({
- selector: "testValue",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var testObject;
- return $core.withContext(function($ctx1) {
- testObject=self._jsObject();
- $recv(testObject)._at_put_("value","aValue");
- self._assert_equals_($recv(testObject)._value(),"aValue");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
- },
- args: [],
- source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
- referencedClasses: [],
- messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
- }),
- $globals.JSObjectProxyTest);
- $core.addMethod(
- $core.method({
- selector: "testYourself",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var object;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=self._jsObject();
- $recv($1)._d_("test");
- $2=$recv($1)._yourself();
- object=$2;
- self._assert_equals_($recv(object)._d(),"test");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
- },
- args: [],
- source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
- referencedClasses: [],
- messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
- }),
- $globals.JSObjectProxyTest);
- $core.addClass('JavaScriptExceptionTest', $globals.TestCase, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "testCatchingException",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return self._throwException();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._on_do_($Error(),(function(error){
- return $core.withContext(function($ctx2) {
- return self._assert_($recv($recv(error)._exception()).__eq("test"));
- }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
- },
- args: [],
- source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
- referencedClasses: ["Error"],
- messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
- }),
- $globals.JavaScriptExceptionTest);
- $core.addMethod(
- $core.method({
- selector: "testRaisingException",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
- return $core.withContext(function($ctx1) {
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return self._throwException();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$JavaScriptException());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
- },
- args: [],
- source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
- referencedClasses: ["JavaScriptException"],
- messageSends: ["should:raise:", "throwException"]
- }),
- $globals.JavaScriptExceptionTest);
- $core.addMethod(
- $core.method({
- selector: "throwException",
- protocol: 'helpers',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- throw 'test';
- return self;
- }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
- },
- args: [],
- source: "throwException\x0a\x09<throw 'test'>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.JavaScriptExceptionTest);
- $core.addClass('MessageSendTest', $globals.TestCase, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "testValue",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var messageSend;
- function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=$recv($MessageSend())._new();
- $ctx1.sendIdx["new"]=1;
- $recv($1)._receiver_($recv($Object())._new());
- $recv($1)._selector_("asString");
- $2=$recv($1)._yourself();
- messageSend=$2;
- self._assert_equals_($recv(messageSend)._value(),"an Object");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
- },
- args: [],
- 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'",
- referencedClasses: ["MessageSend", "Object"],
- messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
- }),
- $globals.MessageSendTest);
- $core.addMethod(
- $core.method({
- selector: "testValueWithArguments",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var messageSend;
- function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=$recv($MessageSend())._new();
- $recv($1)._receiver_((2));
- $recv($1)._selector_("+");
- $2=$recv($1)._yourself();
- messageSend=$2;
- self._assert_equals_($recv(messageSend)._value_((3)),(5));
- $ctx1.sendIdx["assert:equals:"]=1;
- self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
- },
- args: [],
- 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",
- referencedClasses: ["MessageSend"],
- messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
- }),
- $globals.MessageSendTest);
- $core.addClass('MethodInheritanceTest', $globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "codeGeneratorClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $CodeGenerator(){return $globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
- return $CodeGenerator();
- },
- args: [],
- source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
- referencedClasses: ["CodeGenerator"],
- messageSends: []
- }),
- $globals.MethodInheritanceTest);
- $core.addMethod(
- $core.method({
- selector: "compiler",
- protocol: 'factory',
- fn: function (){
- var self=this;
- function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=$recv($Compiler())._new();
- $recv($2)._codeGeneratorClass_(self._codeGeneratorClass());
- $3=$recv($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
- },
- args: [],
- source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
- referencedClasses: ["Compiler"],
- messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
- }),
- $globals.MethodInheritanceTest);
- $core.addMethod(
- $core.method({
- selector: "deinstallBottom",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
- },
- args: [],
- source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
- referencedClasses: [],
- messageSends: ["removeCompiledMethod:", "targetClassBottom"]
- }),
- $globals.MethodInheritanceTest);
- $core.addMethod(
- $core.method({
- selector: "deinstallMiddle",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
- },
- args: [],
- source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
- referencedClasses: [],
- messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
- }),
- $globals.MethodInheritanceTest);
- $core.addMethod(
- $core.method({
- selector: "deinstallTop",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
- },
- args: [],
- source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
- referencedClasses: [],
- messageSends: ["removeCompiledMethod:", "targetClassTop"]
- }),
- $globals.MethodInheritanceTest);
- $core.addMethod(
- $core.method({
- selector: "installBottom:",
- protocol: 'testing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
- },
- args: ["aString"],
- source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
- referencedClasses: [],
- messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
- }),
- $globals.MethodInheritanceTest);
- $core.addMethod(
- $core.method({
- selector: "installMiddle:",
- protocol: 'testing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
- },
- args: ["aString"],
- source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
- referencedClasses: [],
- messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
- }),
- $globals.MethodInheritanceTest);
- $core.addMethod(
- $core.method({
- selector: "installTop:",
- protocol: 'testing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
- },
- args: ["aString"],
- source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
- referencedClasses: [],
- messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
- }),
- $globals.MethodInheritanceTest);
- $core.addMethod(
- $core.method({
- selector: "setUp",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self["@receiverTop"]=$recv(self._targetClassTop())._new();
- $ctx1.sendIdx["new"]=1;
- self["@receiverMiddle"]=$recv(self._targetClassMiddle())._new();
- $ctx1.sendIdx["new"]=2;
- self["@receiverBottom"]=$recv(self._targetClassBottom())._new();
- self["@method"]=nil;
- self["@performBlock"]=(function(){
- return $core.withContext(function($ctx2) {
- return self._error_("performBlock not initialized");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- });
- return self;
- }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
- },
- args: [],
- 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' ]",
- referencedClasses: [],
- messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
- }),
- $globals.MethodInheritanceTest);
- $core.addMethod(
- $core.method({
- selector: "shouldMNU",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._shouldMNUTop();
- self._shouldMNUMiddle();
- self._shouldMNUBottom();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
- },
- args: [],
- source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
- referencedClasses: [],
- messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
- }),
- $globals.MethodInheritanceTest);
- $core.addMethod(
- $core.method({
- selector: "shouldMNUBottom",
- protocol: 'testing',
- fn: function (){
- var self=this;
- function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
- return $core.withContext(function($ctx1) {
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self["@performBlock"])._value_(self["@receiverBottom"]);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$MessageNotUnderstood());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
- },
- args: [],
- source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
- referencedClasses: ["MessageNotUnderstood"],
- messageSends: ["should:raise:", "value:"]
- }),
- $globals.MethodInheritanceTest);
- $core.addMethod(
- $core.method({
- selector: "shouldMNUMiddle",
- protocol: 'testing',
- fn: function (){
- var self=this;
- function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
- return $core.withContext(function($ctx1) {
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$MessageNotUnderstood());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
- },
- args: [],
- source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
- referencedClasses: ["MessageNotUnderstood"],
- messageSends: ["should:raise:", "value:"]
- }),
- $globals.MethodInheritanceTest);
- $core.addMethod(
- $core.method({
- selector: "shouldMNUTop",
- protocol: 'testing',
- fn: function (){
- var self=this;
- function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
- return $core.withContext(function($ctx1) {
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self["@performBlock"])._value_(self["@receiverTop"]);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$MessageNotUnderstood());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
- },
- args: [],
- source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
- referencedClasses: ["MessageNotUnderstood"],
- messageSends: ["should:raise:", "value:"]
- }),
- $globals.MethodInheritanceTest);
- $core.addMethod(
- $core.method({
- selector: "shouldReturn:",
- protocol: 'testing',
- fn: function (anObject){
- var self=this;
- var result;
- return $core.withContext(function($ctx1) {
- result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
- $ctx1.sendIdx["value:"]=1;
- self._assert_equals_(["top",anObject],["top",result]);
- $ctx1.sendIdx["assert:equals:"]=1;
- result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
- $ctx1.sendIdx["value:"]=2;
- self._assert_equals_(["middle",anObject],["middle",result]);
- $ctx1.sendIdx["assert:equals:"]=2;
- result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
- self._assert_equals_(["bottom",anObject],["bottom",result]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
- },
- args: ["anObject"],
- 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 }",
- referencedClasses: [],
- messageSends: ["value:", "assert:equals:"]
- }),
- $globals.MethodInheritanceTest);
- $core.addMethod(
- $core.method({
- selector: "shouldReturn:and:and:",
- protocol: 'testing',
- fn: function (anObject,anObject2,anObject3){
- var self=this;
- var result;
- return $core.withContext(function($ctx1) {
- result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
- $ctx1.sendIdx["value:"]=1;
- self._assert_equals_(["top",anObject],["top",result]);
- $ctx1.sendIdx["assert:equals:"]=1;
- result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
- $ctx1.sendIdx["value:"]=2;
- self._assert_equals_(["middle",anObject2],["middle",result]);
- $ctx1.sendIdx["assert:equals:"]=2;
- result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
- self._assert_equals_(["bottom",anObject3],["bottom",result]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
- },
- args: ["anObject", "anObject2", "anObject3"],
- 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 }",
- referencedClasses: [],
- messageSends: ["value:", "assert:equals:"]
- }),
- $globals.MethodInheritanceTest);
- $core.addMethod(
- $core.method({
- selector: "targetClassBottom",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
- return $JavaScriptException();
- },
- args: [],
- source: "targetClassBottom\x0a\x09^ JavaScriptException",
- referencedClasses: ["JavaScriptException"],
- messageSends: []
- }),
- $globals.MethodInheritanceTest);
- $core.addMethod(
- $core.method({
- selector: "targetClassMiddle",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $Error();
- },
- args: [],
- source: "targetClassMiddle\x0a\x09^ Error",
- referencedClasses: ["Error"],
- messageSends: []
- }),
- $globals.MethodInheritanceTest);
- $core.addMethod(
- $core.method({
- selector: "targetClassTop",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- return $Object();
- },
- args: [],
- source: "targetClassTop\x0a\x09^ Object",
- referencedClasses: ["Object"],
- messageSends: []
- }),
- $globals.MethodInheritanceTest);
- $core.addMethod(
- $core.method({
- selector: "tearDown",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return self._deinstallTop();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }))._on_do_($Error(),(function(){
- }));
- $ctx1.sendIdx["on:do:"]=1;
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return self._deinstallMiddle();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }))._on_do_($Error(),(function(){
- }));
- $ctx1.sendIdx["on:do:"]=2;
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return self._deinstallBottom();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
- }))._on_do_($Error(),(function(){
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
- },
- args: [],
- source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
- referencedClasses: ["Error"],
- messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
- }),
- $globals.MethodInheritanceTest);
- $core.addMethod(
- $core.method({
- selector: "testMNU11",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self["@performBlock"]=(function(x){
- return $core.withContext(function($ctx2) {
- return $recv(x)._foo();
- }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
- });
- self._shouldMNU();
- $ctx1.sendIdx["shouldMNU"]=1;
- self._installTop_("foo ^ false");
- $ctx1.sendIdx["installTop:"]=1;
- self._installTop_("foo ^ true");
- self._deinstallTop();
- self._shouldMNU();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
- }),
- $globals.MethodInheritanceTest);
- $core.addMethod(
- $core.method({
- selector: "testMNU22",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self["@performBlock"]=(function(x){
- return $core.withContext(function($ctx2) {
- return $recv(x)._foo();
- }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
- });
- self._shouldMNU();
- $ctx1.sendIdx["shouldMNU"]=1;
- self._installMiddle_("foo ^ false");
- $ctx1.sendIdx["installMiddle:"]=1;
- self._installMiddle_("foo ^ true");
- self._deinstallMiddle();
- self._shouldMNU();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
- }),
- $globals.MethodInheritanceTest);
- $core.addMethod(
- $core.method({
- selector: "testReturns1",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self["@performBlock"]=(function(x){
- return $core.withContext(function($ctx2) {
- return $recv(x)._foo();
- }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
- });
- self._installTop_("foo ^ false");
- $ctx1.sendIdx["installTop:"]=1;
- self._shouldReturn_(false);
- $ctx1.sendIdx["shouldReturn:"]=1;
- self._installTop_("foo ^ true");
- self._shouldReturn_(true);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["foo", "installTop:", "shouldReturn:"]
- }),
- $globals.MethodInheritanceTest);
- $core.addClass('NumberTest', $globals.TestCase, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "testAbs",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=(4)._abs();
- $ctx1.sendIdx["abs"]=1;
- self._assert_equals_($1,(4));
- $ctx1.sendIdx["assert:equals:"]=1;
- self._assert_equals_((-4)._abs(),(4));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
- },
- args: [],
- source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
- referencedClasses: [],
- messageSends: ["assert:equals:", "abs"]
- }),
- $globals.NumberTest);
- $core.addMethod(
- $core.method({
- selector: "testArithmetic",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$5,$4;
- $1=(1.5).__plus((1));
- $ctx1.sendIdx["+"]=1;
- self._assert_equals_($1,(2.5));
- $ctx1.sendIdx["assert:equals:"]=1;
- $2=(2).__minus((1));
- $ctx1.sendIdx["-"]=1;
- self._assert_equals_($2,(1));
- $ctx1.sendIdx["assert:equals:"]=2;
- self._assert_equals_((-2).__minus((1)),(-3));
- $ctx1.sendIdx["assert:equals:"]=3;
- self._assert_equals_((12).__slash((2)),(6));
- $ctx1.sendIdx["assert:equals:"]=4;
- $3=(3).__star((4));
- $ctx1.sendIdx["*"]=1;
- self._assert_equals_($3,(12));
- $ctx1.sendIdx["assert:equals:"]=5;
- self._assert_equals_((7).__slash_slash((2)),(3));
- $ctx1.sendIdx["assert:equals:"]=6;
- self._assert_equals_((7).__backslash_backslash((2)),(1));
- $ctx1.sendIdx["assert:equals:"]=7;
- $5=(1).__plus((2));
- $ctx1.sendIdx["+"]=2;
- $4=$recv($5).__star((3));
- $ctx1.sendIdx["*"]=2;
- self._assert_equals_($4,(9));
- $ctx1.sendIdx["assert:equals:"]=8;
- self._assert_equals_((1).__plus((2).__star((3))),(7));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
- }),
- $globals.NumberTest);
- $core.addMethod(
- $core.method({
- selector: "testAsNumber",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_((3)._asNumber(),(3));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
- },
- args: [],
- source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
- referencedClasses: [],
- messageSends: ["assert:equals:", "asNumber"]
- }),
- $globals.NumberTest);
- $core.addMethod(
- $core.method({
- selector: "testCeiling",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=(1.2)._ceiling();
- $ctx1.sendIdx["ceiling"]=1;
- self._assert_equals_($1,(2));
- $ctx1.sendIdx["assert:equals:"]=1;
- $2=(-1.2)._ceiling();
- $ctx1.sendIdx["ceiling"]=2;
- self._assert_equals_($2,(-1));
- $ctx1.sendIdx["assert:equals:"]=2;
- self._assert_equals_((1)._ceiling(),(1));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
- },
- args: [],
- 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.",
- referencedClasses: [],
- messageSends: ["assert:equals:", "ceiling"]
- }),
- $globals.NumberTest);
- $core.addMethod(
- $core.method({
- selector: "testComparison",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- $1=(3).__gt((2));
- $ctx1.sendIdx[">"]=1;
- self._assert_($1);
- $ctx1.sendIdx["assert:"]=1;
- $2=(2).__lt((3));
- $ctx1.sendIdx["<"]=1;
- self._assert_($2);
- $ctx1.sendIdx["assert:"]=2;
- self._deny_((3).__lt((2)));
- $ctx1.sendIdx["deny:"]=1;
- self._deny_((2).__gt((3)));
- $3=(3).__gt_eq((3));
- $ctx1.sendIdx[">="]=1;
- self._assert_($3);
- $ctx1.sendIdx["assert:"]=3;
- self._assert_((3.1).__gt_eq((3)));
- $ctx1.sendIdx["assert:"]=4;
- $4=(3).__lt_eq((3));
- $ctx1.sendIdx["<="]=1;
- self._assert_($4);
- $ctx1.sendIdx["assert:"]=5;
- self._assert_((3).__lt_eq((3.1)));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
- }),
- $globals.NumberTest);
- $core.addMethod(
- $core.method({
- selector: "testCopying",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv((1)._copy()).__eq_eq((1));
- $ctx1.sendIdx["=="]=1;
- self._assert_($1);
- $ctx1.sendIdx["assert:"]=1;
- self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
- },
- args: [],
- source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
- referencedClasses: [],
- messageSends: ["assert:", "==", "copy", "deepCopy"]
- }),
- $globals.NumberTest);
- $core.addMethod(
- $core.method({
- selector: "testEquality",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
- $1=(1).__eq((1));
- $ctx1.sendIdx["="]=1;
- self._assert_($1);
- $ctx1.sendIdx["assert:"]=1;
- $2=(0).__eq((0));
- $ctx1.sendIdx["="]=2;
- self._assert_($2);
- $ctx1.sendIdx["assert:"]=2;
- $3=(1).__eq((0));
- $ctx1.sendIdx["="]=3;
- self._deny_($3);
- $ctx1.sendIdx["deny:"]=1;
- $5=(1)._yourself();
- $ctx1.sendIdx["yourself"]=1;
- $4=$recv($5).__eq((1));
- $ctx1.sendIdx["="]=4;
- self._assert_($4);
- $ctx1.sendIdx["assert:"]=3;
- $7=(1)._yourself();
- $ctx1.sendIdx["yourself"]=2;
- $6=(1).__eq($7);
- $ctx1.sendIdx["="]=5;
- self._assert_($6);
- $ctx1.sendIdx["assert:"]=4;
- $9=(1)._yourself();
- $ctx1.sendIdx["yourself"]=3;
- $8=$recv($9).__eq((1)._yourself());
- $ctx1.sendIdx["="]=6;
- self._assert_($8);
- $10=(0).__eq(false);
- $ctx1.sendIdx["="]=7;
- self._deny_($10);
- $ctx1.sendIdx["deny:"]=2;
- $11=false.__eq((0));
- $ctx1.sendIdx["="]=8;
- self._deny_($11);
- $ctx1.sendIdx["deny:"]=3;
- $12="".__eq((0));
- $ctx1.sendIdx["="]=9;
- self._deny_($12);
- $ctx1.sendIdx["deny:"]=4;
- self._deny_((0).__eq(""));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
- },
- args: [],
- 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 = ''",
- referencedClasses: [],
- messageSends: ["assert:", "=", "deny:", "yourself"]
- }),
- $globals.NumberTest);
- $core.addMethod(
- $core.method({
- selector: "testFloor",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=(1.2)._floor();
- $ctx1.sendIdx["floor"]=1;
- self._assert_equals_($1,(1));
- $ctx1.sendIdx["assert:equals:"]=1;
- $2=(-1.2)._floor();
- $ctx1.sendIdx["floor"]=2;
- self._assert_equals_($2,(-2));
- $ctx1.sendIdx["assert:equals:"]=2;
- self._assert_equals_((1)._floor(),(1));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
- },
- args: [],
- 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.",
- referencedClasses: [],
- messageSends: ["assert:equals:", "floor"]
- }),
- $globals.NumberTest);
- $core.addMethod(
- $core.method({
- selector: "testHexNumbers",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5;
- self._assert_equals_((9),(9));
- $ctx1.sendIdx["assert:equals:"]=1;
- $1=(10)._truncated();
- $ctx1.sendIdx["truncated"]=1;
- self._assert_equals_($1,(10));
- $ctx1.sendIdx["assert:equals:"]=2;
- $2=(11)._truncated();
- $ctx1.sendIdx["truncated"]=2;
- self._assert_equals_($2,(11));
- $ctx1.sendIdx["assert:equals:"]=3;
- $3=(12)._truncated();
- $ctx1.sendIdx["truncated"]=3;
- self._assert_equals_($3,(12));
- $ctx1.sendIdx["assert:equals:"]=4;
- $4=(13)._truncated();
- $ctx1.sendIdx["truncated"]=4;
- self._assert_equals_($4,(13));
- $ctx1.sendIdx["assert:equals:"]=5;
- $5=(14)._truncated();
- $ctx1.sendIdx["truncated"]=5;
- self._assert_equals_($5,(14));
- $ctx1.sendIdx["assert:equals:"]=6;
- self._assert_equals_((15)._truncated(),(15));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["assert:equals:", "truncated"]
- }),
- $globals.NumberTest);
- $core.addMethod(
- $core.method({
- selector: "testIdentity",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$5,$4,$7,$6,$9,$8;
- $1=(1).__eq_eq((1));
- $ctx1.sendIdx["=="]=1;
- self._assert_($1);
- $ctx1.sendIdx["assert:"]=1;
- $2=(0).__eq_eq((0));
- $ctx1.sendIdx["=="]=2;
- self._assert_($2);
- $ctx1.sendIdx["assert:"]=2;
- $3=(1).__eq_eq((0));
- $ctx1.sendIdx["=="]=3;
- self._deny_($3);
- $ctx1.sendIdx["deny:"]=1;
- $5=(1)._yourself();
- $ctx1.sendIdx["yourself"]=1;
- $4=$recv($5).__eq_eq((1));
- $ctx1.sendIdx["=="]=4;
- self._assert_($4);
- $ctx1.sendIdx["assert:"]=3;
- $7=(1)._yourself();
- $ctx1.sendIdx["yourself"]=2;
- $6=(1).__eq_eq($7);
- $ctx1.sendIdx["=="]=5;
- self._assert_($6);
- $ctx1.sendIdx["assert:"]=4;
- $9=(1)._yourself();
- $ctx1.sendIdx["yourself"]=3;
- $8=$recv($9).__eq_eq((1)._yourself());
- $ctx1.sendIdx["=="]=6;
- self._assert_($8);
- self._deny_((1).__eq_eq((2)));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["assert:", "==", "deny:", "yourself"]
- }),
- $globals.NumberTest);
- $core.addMethod(
- $core.method({
- selector: "testInvalidHexNumbers",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
- return $core.withContext(function($ctx1) {
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rG();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=1;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rg();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=2;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rH();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=3;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rh();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=4;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rI();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=5;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._ri();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=6;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rJ();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=7;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rj();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=8;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rK();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=9;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rk();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=10;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rL();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=11;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rl();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=12;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rM();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=13;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rm();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=14;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rN();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=15;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rn();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=16;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rO();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=17;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._ro();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=18;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rP();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=19;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rp();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=20;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rQ();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=21;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rq();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=22;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rR();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=23;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rr();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=24;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rS();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=25;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rs();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=26;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rT();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=27;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rt();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=28;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rU();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=29;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._ru();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=30;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rV();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=31;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rv();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=32;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rW();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=33;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rw();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=34;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rX();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=35;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rx();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=36;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rY();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=37;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._ry();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=38;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rZ();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=39;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (16)._rz();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
- }),$MessageNotUnderstood());
- $ctx1.sendIdx["should:raise:"]=40;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (11259375)._Z();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
- }),$MessageNotUnderstood());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
- },
- args: [],
- 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.",
- referencedClasses: ["MessageNotUnderstood"],
- 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"]
- }),
- $globals.NumberTest);
- $core.addMethod(
- $core.method({
- selector: "testLog",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Number(){return $globals.Number||(typeof Number=="undefined"?nil:Number)}
- return $core.withContext(function($ctx1) {
- self._assert_equals_((10000)._log(),(4));
- $ctx1.sendIdx["assert:equals:"]=1;
- self._assert_equals_((512)._log_((2)),(9));
- $ctx1.sendIdx["assert:equals:"]=2;
- self._assert_equals_($recv($recv($Number())._e())._ln(),(1));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
- },
- args: [],
- 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.",
- referencedClasses: ["Number"],
- messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
- }),
- $globals.NumberTest);
- $core.addMethod(
- $core.method({
- selector: "testMinMax",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_((2)._max_((5)),(5));
- $ctx1.sendIdx["assert:equals:"]=1;
- self._assert_equals_((2)._min_((5)),(2));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
- },
- args: [],
- source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
- referencedClasses: [],
- messageSends: ["assert:equals:", "max:", "min:"]
- }),
- $globals.NumberTest);
- $core.addMethod(
- $core.method({
- selector: "testNegated",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=(3)._negated();
- $ctx1.sendIdx["negated"]=1;
- self._assert_equals_($1,(-3));
- $ctx1.sendIdx["assert:equals:"]=1;
- self._assert_equals_((-3)._negated(),(3));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
- },
- args: [],
- source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
- referencedClasses: [],
- messageSends: ["assert:equals:", "negated"]
- }),
- $globals.NumberTest);
- $core.addMethod(
- $core.method({
- selector: "testPrintShowingDecimalPlaces",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
- $1=(23)._printShowingDecimalPlaces_((2));
- $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
- self._assert_equals_($1,"23.00");
- $ctx1.sendIdx["assert:equals:"]=1;
- $2=(23.5698)._printShowingDecimalPlaces_((2));
- $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
- self._assert_equals_($2,"23.57");
- $ctx1.sendIdx["assert:equals:"]=2;
- $4=(234.567)._negated();
- $ctx1.sendIdx["negated"]=1;
- $3=$recv($4)._printShowingDecimalPlaces_((5));
- $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
- self._assert_equals_($3,"-234.56700");
- $ctx1.sendIdx["assert:equals:"]=3;
- $5=(23.4567)._printShowingDecimalPlaces_((0));
- $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
- self._assert_equals_($5,"23");
- $ctx1.sendIdx["assert:equals:"]=4;
- $6=(23.5567)._printShowingDecimalPlaces_((0));
- $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
- self._assert_equals_($6,"24");
- $ctx1.sendIdx["assert:equals:"]=5;
- $8=(23.4567)._negated();
- $ctx1.sendIdx["negated"]=2;
- $7=$recv($8)._printShowingDecimalPlaces_((0));
- $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
- self._assert_equals_($7,"-23");
- $ctx1.sendIdx["assert:equals:"]=6;
- $10=(23.5567)._negated();
- $ctx1.sendIdx["negated"]=3;
- $9=$recv($10)._printShowingDecimalPlaces_((0));
- $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
- self._assert_equals_($9,"-24");
- $ctx1.sendIdx["assert:equals:"]=7;
- $11=(100000000)._printShowingDecimalPlaces_((1));
- $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
- self._assert_equals_($11,"100000000.0");
- $ctx1.sendIdx["assert:equals:"]=8;
- $12=(0.98)._printShowingDecimalPlaces_((5));
- $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
- self._assert_equals_($12,"0.98000");
- $ctx1.sendIdx["assert:equals:"]=9;
- $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
- $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
- self._assert_equals_($13,"-0.98");
- $ctx1.sendIdx["assert:equals:"]=10;
- $14=(2.567)._printShowingDecimalPlaces_((2));
- $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
- self._assert_equals_($14,"2.57");
- $ctx1.sendIdx["assert:equals:"]=11;
- $15=(-2.567)._printShowingDecimalPlaces_((2));
- $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
- self._assert_equals_($15,"-2.57");
- $ctx1.sendIdx["assert:equals:"]=12;
- self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
- },
- args: [],
- 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'.",
- referencedClasses: [],
- messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
- }),
- $globals.NumberTest);
- $core.addMethod(
- $core.method({
- selector: "testRaisedTo",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3;
- $1=(2)._raisedTo_((4));
- $ctx1.sendIdx["raisedTo:"]=1;
- self._assert_equals_($1,(16));
- $ctx1.sendIdx["assert:equals:"]=1;
- $2=(2)._raisedTo_((0));
- $ctx1.sendIdx["raisedTo:"]=2;
- self._assert_equals_($2,(1));
- $ctx1.sendIdx["assert:equals:"]=2;
- $3=(2)._raisedTo_((-3));
- $ctx1.sendIdx["raisedTo:"]=3;
- self._assert_equals_($3,(0.125));
- $ctx1.sendIdx["assert:equals:"]=3;
- self._assert_equals_((4)._raisedTo_((0.5)),(2));
- $ctx1.sendIdx["assert:equals:"]=4;
- self._assert_equals_((2).__star_star((4)),(16));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
- },
- args: [],
- 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.",
- referencedClasses: [],
- messageSends: ["assert:equals:", "raisedTo:", "**"]
- }),
- $globals.NumberTest);
- $core.addMethod(
- $core.method({
- selector: "testRounded",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=(3)._rounded();
- $ctx1.sendIdx["rounded"]=1;
- self._assert_equals_($1,(3));
- $ctx1.sendIdx["assert:equals:"]=1;
- $2=(3.212)._rounded();
- $ctx1.sendIdx["rounded"]=2;
- self._assert_equals_($2,(3));
- $ctx1.sendIdx["assert:equals:"]=2;
- self._assert_equals_((3.51)._rounded(),(4));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["assert:equals:", "rounded"]
- }),
- $globals.NumberTest);
- $core.addMethod(
- $core.method({
- selector: "testSign",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=(5)._sign();
- $ctx1.sendIdx["sign"]=1;
- self._assert_equals_($1,(1));
- $ctx1.sendIdx["assert:equals:"]=1;
- $2=(0)._sign();
- $ctx1.sendIdx["sign"]=2;
- self._assert_equals_($2,(0));
- $ctx1.sendIdx["assert:equals:"]=2;
- self._assert_equals_((-1.4)._sign(),(-1));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
- },
- args: [],
- source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
- referencedClasses: [],
- messageSends: ["assert:equals:", "sign"]
- }),
- $globals.NumberTest);
- $core.addMethod(
- $core.method({
- selector: "testSqrt",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=(4)._sqrt();
- $ctx1.sendIdx["sqrt"]=1;
- self._assert_equals_($1,(2));
- $ctx1.sendIdx["assert:equals:"]=1;
- self._assert_equals_((16)._sqrt(),(4));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
- },
- args: [],
- source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
- referencedClasses: [],
- messageSends: ["assert:equals:", "sqrt"]
- }),
- $globals.NumberTest);
- $core.addMethod(
- $core.method({
- selector: "testSquared",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_((4)._squared(),(16));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
- },
- args: [],
- source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
- referencedClasses: [],
- messageSends: ["assert:equals:", "squared"]
- }),
- $globals.NumberTest);
- $core.addMethod(
- $core.method({
- selector: "testTimesRepeat",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var i;
- return $core.withContext(function($ctx1) {
- i=(0);
- (0)._timesRepeat_((function(){
- return $core.withContext(function($ctx2) {
- i=$recv(i).__plus((1));
- $ctx2.sendIdx["+"]=1;
- return i;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $ctx1.sendIdx["timesRepeat:"]=1;
- self._assert_equals_(i,(0));
- $ctx1.sendIdx["assert:equals:"]=1;
- (5)._timesRepeat_((function(){
- return $core.withContext(function($ctx2) {
- i=$recv(i).__plus((1));
- return i;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- self._assert_equals_(i,(5));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["timesRepeat:", "+", "assert:equals:"]
- }),
- $globals.NumberTest);
- $core.addMethod(
- $core.method({
- selector: "testTo",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
- },
- args: [],
- source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
- referencedClasses: [],
- messageSends: ["assert:equals:", "to:"]
- }),
- $globals.NumberTest);
- $core.addMethod(
- $core.method({
- selector: "testToBy",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=(0)._to_by_((6),(2));
- $ctx1.sendIdx["to:by:"]=1;
- self._assert_equals_($1,[(0), (2), (4), (6)]);
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return (1)._to_by_((4),(0));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$Error());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Error"],
- messageSends: ["assert:equals:", "to:by:", "should:raise:"]
- }),
- $globals.NumberTest);
- $core.addMethod(
- $core.method({
- selector: "testTrigonometry",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_((0)._cos(),(1));
- $ctx1.sendIdx["assert:equals:"]=1;
- self._assert_equals_((0)._sin(),(0));
- $ctx1.sendIdx["assert:equals:"]=2;
- self._assert_equals_((0)._tan(),(0));
- $ctx1.sendIdx["assert:equals:"]=3;
- self._assert_equals_((1)._arcCos(),(0));
- $ctx1.sendIdx["assert:equals:"]=4;
- self._assert_equals_((0)._arcSin(),(0));
- $ctx1.sendIdx["assert:equals:"]=5;
- self._assert_equals_((0)._arcTan(),(0));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
- },
- args: [],
- 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.",
- referencedClasses: [],
- messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"]
- }),
- $globals.NumberTest);
- $core.addMethod(
- $core.method({
- selector: "testTruncated",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=(3)._truncated();
- $ctx1.sendIdx["truncated"]=1;
- self._assert_equals_($1,(3));
- $ctx1.sendIdx["assert:equals:"]=1;
- $2=(3.212)._truncated();
- $ctx1.sendIdx["truncated"]=2;
- self._assert_equals_($2,(3));
- $ctx1.sendIdx["assert:equals:"]=2;
- self._assert_equals_((3.51)._truncated(),(3));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["assert:equals:", "truncated"]
- }),
- $globals.NumberTest);
- $core.addClass('ObjectMock', $globals.Object, ['foo', 'bar'], 'Kernel-Tests');
- $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
- $core.addMethod(
- $core.method({
- selector: "foo",
- protocol: 'not yet classified',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@foo"];
- return $1;
- },
- args: [],
- source: "foo\x0a\x09^ foo",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ObjectMock);
- $core.addMethod(
- $core.method({
- selector: "foo:",
- protocol: 'not yet classified',
- fn: function (anObject){
- var self=this;
- self["@foo"]=anObject;
- return self;
- },
- args: ["anObject"],
- source: "foo: anObject\x0a\x09foo := anObject",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ObjectMock);
- $core.addClass('ObjectTest', $globals.TestCase, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "notDefined",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return void 0;;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
- },
- args: [],
- source: "notDefined\x0a\x09<return void 0;>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.ObjectTest);
- $core.addMethod(
- $core.method({
- selector: "testBasicAccess",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var o;
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- return $core.withContext(function($ctx1) {
- var $1;
- o=$recv($Object())._new();
- $recv(o)._basicAt_put_("a",(1));
- $1=$recv(o)._basicAt_("a");
- $ctx1.sendIdx["basicAt:"]=1;
- self._assert_equals_($1,(1));
- $ctx1.sendIdx["assert:equals:"]=1;
- self._assert_equals_($recv(o)._basicAt_("b"),nil);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Object"],
- messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
- }),
- $globals.ObjectTest);
- $core.addMethod(
- $core.method({
- selector: "testBasicPerform",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var o;
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- return $core.withContext(function($ctx1) {
- o=$recv($Object())._new();
- $recv(o)._basicAt_put_("func",(function(){
- return "hello";
- }));
- $ctx1.sendIdx["basicAt:put:"]=1;
- $recv(o)._basicAt_put_("func2",(function(a){
- return $core.withContext(function($ctx2) {
- return $recv(a).__plus((1));
- }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
- }));
- self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
- $ctx1.sendIdx["assert:equals:"]=1;
- self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Object"],
- messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
- }),
- $globals.ObjectTest);
- $core.addMethod(
- $core.method({
- selector: "testDNU",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
- return $core.withContext(function($ctx1) {
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv($recv($Object())._new())._foo();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$MessageNotUnderstood());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
- },
- args: [],
- source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
- referencedClasses: ["Object", "MessageNotUnderstood"],
- messageSends: ["should:raise:", "foo", "new"]
- }),
- $globals.ObjectTest);
- $core.addMethod(
- $core.method({
- selector: "testEquality",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var o;
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$4,$3;
- o=$recv($Object())._new();
- $ctx1.sendIdx["new"]=1;
- $1=$recv(o).__eq($recv($Object())._new());
- $ctx1.sendIdx["="]=1;
- self._deny_($1);
- $2=$recv(o).__eq(o);
- $ctx1.sendIdx["="]=2;
- self._assert_($2);
- $ctx1.sendIdx["assert:"]=1;
- $4=$recv(o)._yourself();
- $ctx1.sendIdx["yourself"]=1;
- $3=$recv($4).__eq(o);
- $ctx1.sendIdx["="]=3;
- self._assert_($3);
- $ctx1.sendIdx["assert:"]=2;
- self._assert_($recv(o).__eq($recv(o)._yourself()));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
- },
- args: [],
- 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)",
- referencedClasses: ["Object"],
- messageSends: ["new", "deny:", "=", "assert:", "yourself"]
- }),
- $globals.ObjectTest);
- $core.addMethod(
- $core.method({
- selector: "testHalt",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv($recv($Object())._new())._halt();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$Error());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
- },
- args: [],
- source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
- referencedClasses: ["Object", "Error"],
- messageSends: ["should:raise:", "halt", "new"]
- }),
- $globals.ObjectTest);
- $core.addMethod(
- $core.method({
- selector: "testIdentity",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var o;
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$4,$3;
- o=$recv($Object())._new();
- $ctx1.sendIdx["new"]=1;
- $1=$recv(o).__eq_eq($recv($Object())._new());
- $ctx1.sendIdx["=="]=1;
- self._deny_($1);
- $2=$recv(o).__eq_eq(o);
- $ctx1.sendIdx["=="]=2;
- self._assert_($2);
- $ctx1.sendIdx["assert:"]=1;
- $4=$recv(o)._yourself();
- $ctx1.sendIdx["yourself"]=1;
- $3=$recv($4).__eq_eq(o);
- $ctx1.sendIdx["=="]=3;
- self._assert_($3);
- $ctx1.sendIdx["assert:"]=2;
- self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Object"],
- messageSends: ["new", "deny:", "==", "assert:", "yourself"]
- }),
- $globals.ObjectTest);
- $core.addMethod(
- $core.method({
- selector: "testIfNil",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
- $2=$recv($Object())._new();
- $ctx1.sendIdx["new"]=1;
- $1=$recv($2)._isNil();
- self._deny_($1);
- $ctx1.sendIdx["deny:"]=1;
- $5=$recv($Object())._new();
- $ctx1.sendIdx["new"]=2;
- if(($receiver = $5) == null || $receiver.isNil){
- $4=true;
- } else {
- $4=$5;
- };
- $3=$recv($4).__eq(true);
- self._deny_($3);
- $7=$recv($Object())._new();
- $ctx1.sendIdx["new"]=3;
- if(($receiver = $7) == null || $receiver.isNil){
- $6=$7;
- } else {
- $6=true;
- };
- self._assert_equals_($6,true);
- $ctx1.sendIdx["assert:equals:"]=1;
- $9=$recv($Object())._new();
- $ctx1.sendIdx["new"]=4;
- if(($receiver = $9) == null || $receiver.isNil){
- $8=false;
- } else {
- $8=true;
- };
- self._assert_equals_($8,true);
- $ctx1.sendIdx["assert:equals:"]=2;
- $11=$recv($Object())._new();
- if(($receiver = $11) == null || $receiver.isNil){
- $10=false;
- } else {
- $10=true;
- };
- self._assert_equals_($10,true);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Object"],
- messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
- }),
- $globals.ObjectTest);
- $core.addMethod(
- $core.method({
- selector: "testInstVars",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var o;
- function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- o=$recv($ObjectMock())._new();
- $1=$recv(o)._instVarAt_("foo");
- $ctx1.sendIdx["instVarAt:"]=1;
- self._assert_equals_($1,nil);
- $ctx1.sendIdx["assert:equals:"]=1;
- $recv(o)._instVarAt_put_("foo",(1));
- $2=$recv(o)._instVarAt_("foo");
- $ctx1.sendIdx["instVarAt:"]=2;
- self._assert_equals_($2,(1));
- $ctx1.sendIdx["assert:equals:"]=2;
- self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
- },
- args: [],
- 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",
- referencedClasses: ["ObjectMock"],
- messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
- }),
- $globals.ObjectTest);
- $core.addMethod(
- $core.method({
- selector: "testNilUndefined",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_(self._notDefined(),nil);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
- },
- args: [],
- source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
- referencedClasses: [],
- messageSends: ["assert:equals:", "notDefined"]
- }),
- $globals.ObjectTest);
- $core.addMethod(
- $core.method({
- selector: "testYourself",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var o;
- function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
- return $core.withContext(function($ctx1) {
- o=$recv($ObjectMock())._new();
- self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
- },
- args: [],
- source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
- referencedClasses: ["ObjectMock"],
- messageSends: ["new", "assert:", "==", "yourself"]
- }),
- $globals.ObjectTest);
- $core.addMethod(
- $core.method({
- selector: "testidentityHash",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var o1,o2;
- function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1,$5,$4;
- o1=$recv($Object())._new();
- $ctx1.sendIdx["new"]=1;
- o2=$recv($Object())._new();
- $2=$recv(o1)._identityHash();
- $ctx1.sendIdx["identityHash"]=1;
- $3=$recv(o1)._identityHash();
- $ctx1.sendIdx["identityHash"]=2;
- $1=$recv($2).__eq_eq($3);
- $ctx1.sendIdx["=="]=1;
- self._assert_($1);
- $5=$recv(o1)._identityHash();
- $ctx1.sendIdx["identityHash"]=3;
- $4=$recv($5).__eq_eq($recv(o2)._identityHash());
- self._deny_($4);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},$globals.ObjectTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Object"],
- messageSends: ["new", "assert:", "==", "identityHash", "deny:"]
- }),
- $globals.ObjectTest);
- $core.addClass('PointTest', $globals.TestCase, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "testAccessing",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
- return $core.withContext(function($ctx1) {
- var $2,$1,$3,$6,$5,$4;
- $2=$recv($Point())._x_y_((3),(4));
- $ctx1.sendIdx["x:y:"]=1;
- $1=$recv($2)._x();
- $ctx1.sendIdx["x"]=1;
- self._assert_equals_($1,(3));
- $ctx1.sendIdx["assert:equals:"]=1;
- $3=$recv($recv($Point())._x_y_((3),(4)))._y();
- $ctx1.sendIdx["y"]=1;
- self._assert_equals_($3,(4));
- $ctx1.sendIdx["assert:equals:"]=2;
- $6=$recv($Point())._new();
- $ctx1.sendIdx["new"]=1;
- $5=$recv($6)._x_((3));
- $4=$recv($5)._x();
- self._assert_equals_($4,(3));
- $ctx1.sendIdx["assert:equals:"]=3;
- self._assert_equals_($recv($recv($recv($Point())._new())._y_((4)))._y(),(4));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Point"],
- messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
- }),
- $globals.PointTest);
- $core.addMethod(
- $core.method({
- selector: "testArithmetic",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
- return $core.withContext(function($ctx1) {
- var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
- $2=(3).__at((4));
- $ctx1.sendIdx["@"]=1;
- $3=(3).__at((4));
- $ctx1.sendIdx["@"]=2;
- $1=$recv($2).__star($3);
- $4=$recv($Point())._x_y_((9),(16));
- $ctx1.sendIdx["x:y:"]=1;
- self._assert_equals_($1,$4);
- $ctx1.sendIdx["assert:equals:"]=1;
- $6=(3).__at((4));
- $ctx1.sendIdx["@"]=3;
- $7=(3).__at((4));
- $ctx1.sendIdx["@"]=4;
- $5=$recv($6).__plus($7);
- $8=$recv($Point())._x_y_((6),(8));
- $ctx1.sendIdx["x:y:"]=2;
- self._assert_equals_($5,$8);
- $ctx1.sendIdx["assert:equals:"]=2;
- $10=(3).__at((4));
- $ctx1.sendIdx["@"]=5;
- $11=(3).__at((4));
- $ctx1.sendIdx["@"]=6;
- $9=$recv($10).__minus($11);
- $12=$recv($Point())._x_y_((0),(0));
- $ctx1.sendIdx["x:y:"]=3;
- self._assert_equals_($9,$12);
- $ctx1.sendIdx["assert:equals:"]=3;
- $14=(6).__at((8));
- $ctx1.sendIdx["@"]=7;
- $13=$recv($14).__slash((3).__at((4)));
- self._assert_equals_($13,$recv($Point())._x_y_((2),(2)));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
- },
- args: [],
- 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)",
- referencedClasses: ["Point"],
- messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
- }),
- $globals.PointTest);
- $core.addMethod(
- $core.method({
- selector: "testAt",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
- return $core.withContext(function($ctx1) {
- self._assert_equals_((3).__at((4)),$recv($Point())._x_y_((3),(4)));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
- },
- args: [],
- source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
- referencedClasses: ["Point"],
- messageSends: ["assert:equals:", "@", "x:y:"]
- }),
- $globals.PointTest);
- $core.addMethod(
- $core.method({
- selector: "testComparison",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
- $2=(3).__at((4));
- $ctx1.sendIdx["@"]=1;
- $3=(4).__at((5));
- $ctx1.sendIdx["@"]=2;
- $1=$recv($2).__lt($3);
- $ctx1.sendIdx["<"]=1;
- self._assert_($1);
- $ctx1.sendIdx["assert:"]=1;
- $5=(3).__at((4));
- $ctx1.sendIdx["@"]=3;
- $6=(4).__at((4));
- $ctx1.sendIdx["@"]=4;
- $4=$recv($5).__lt($6);
- self._deny_($4);
- $ctx1.sendIdx["deny:"]=1;
- $8=(4).__at((5));
- $ctx1.sendIdx["@"]=5;
- $9=(4).__at((5));
- $ctx1.sendIdx["@"]=6;
- $7=$recv($8).__lt_eq($9);
- $ctx1.sendIdx["<="]=1;
- self._assert_($7);
- $ctx1.sendIdx["assert:"]=2;
- $11=(4).__at((5));
- $ctx1.sendIdx["@"]=7;
- $12=(3).__at((5));
- $ctx1.sendIdx["@"]=8;
- $10=$recv($11).__lt_eq($12);
- self._deny_($10);
- $ctx1.sendIdx["deny:"]=2;
- $14=(5).__at((6));
- $ctx1.sendIdx["@"]=9;
- $15=(4).__at((5));
- $ctx1.sendIdx["@"]=10;
- $13=$recv($14).__gt($15);
- $ctx1.sendIdx[">"]=1;
- self._assert_($13);
- $ctx1.sendIdx["assert:"]=3;
- $17=(5).__at((6));
- $ctx1.sendIdx["@"]=11;
- $18=(6).__at((6));
- $ctx1.sendIdx["@"]=12;
- $16=$recv($17).__gt($18);
- self._deny_($16);
- $ctx1.sendIdx["deny:"]=3;
- $20=(4).__at((5));
- $ctx1.sendIdx["@"]=13;
- $21=(4).__at((5));
- $ctx1.sendIdx["@"]=14;
- $19=$recv($20).__gt_eq($21);
- $ctx1.sendIdx[">="]=1;
- self._assert_($19);
- $23=(4).__at((5));
- $ctx1.sendIdx["@"]=15;
- $22=$recv($23).__gt_eq((5).__at((5)));
- self._deny_($22);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
- },
- args: [],
- 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)",
- referencedClasses: [],
- messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
- }),
- $globals.PointTest);
- $core.addMethod(
- $core.method({
- selector: "testEgality",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1,$5,$4;
- $2=(3).__at((4));
- $ctx1.sendIdx["@"]=1;
- $3=(3).__at((4));
- $ctx1.sendIdx["@"]=2;
- $1=$recv($2).__eq($3);
- $ctx1.sendIdx["="]=1;
- self._assert_($1);
- $5=(3).__at((5));
- $ctx1.sendIdx["@"]=3;
- $4=$recv($5).__eq((3).__at((6)));
- self._deny_($4);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
- },
- args: [],
- source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
- referencedClasses: [],
- messageSends: ["assert:", "=", "@", "deny:"]
- }),
- $globals.PointTest);
- $core.addMethod(
- $core.method({
- selector: "testNew",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
- return $core.withContext(function($ctx1) {
- var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
- $3=$recv($Point())._new();
- $ctx1.sendIdx["new"]=1;
- $2=$recv($3)._x_((3));
- $ctx1.sendIdx["x:"]=1;
- $1=$recv($2)._y();
- $ctx1.sendIdx["y"]=1;
- self._assert_equals_($1,nil);
- $ctx1.sendIdx["assert:equals:"]=1;
- $7=$recv($Point())._new();
- $ctx1.sendIdx["new"]=2;
- $6=$recv($7)._x_((3));
- $5=$recv($6)._x();
- $ctx1.sendIdx["x"]=1;
- $4=$recv($5).__eq((0));
- $ctx1.sendIdx["="]=1;
- self._deny_($4);
- $ctx1.sendIdx["deny:"]=1;
- $10=$recv($Point())._new();
- $ctx1.sendIdx["new"]=3;
- $9=$recv($10)._y_((4));
- $ctx1.sendIdx["y:"]=1;
- $8=$recv($9)._x();
- self._assert_equals_($8,nil);
- self._deny_($recv($recv($recv($recv($Point())._new())._y_((4)))._y()).__eq((0)));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Point"],
- messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
- }),
- $globals.PointTest);
- $core.addMethod(
- $core.method({
- selector: "testTranslateBy",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
- $2=(3).__at((3));
- $ctx1.sendIdx["@"]=1;
- $3=(0).__at((1));
- $ctx1.sendIdx["@"]=2;
- $1=$recv($2)._translateBy_($3);
- $ctx1.sendIdx["translateBy:"]=1;
- $4=(3).__at((4));
- $ctx1.sendIdx["@"]=3;
- self._assert_equals_($1,$4);
- $ctx1.sendIdx["assert:equals:"]=1;
- $6=(3).__at((3));
- $ctx1.sendIdx["@"]=4;
- $8=(1)._negated();
- $ctx1.sendIdx["negated"]=1;
- $7=(0).__at($8);
- $ctx1.sendIdx["@"]=5;
- $5=$recv($6)._translateBy_($7);
- $ctx1.sendIdx["translateBy:"]=2;
- $9=(3).__at((2));
- $ctx1.sendIdx["@"]=6;
- self._assert_equals_($5,$9);
- $ctx1.sendIdx["assert:equals:"]=2;
- $11=(3).__at((3));
- $ctx1.sendIdx["@"]=7;
- $12=(2).__at((3));
- $ctx1.sendIdx["@"]=8;
- $10=$recv($11)._translateBy_($12);
- $ctx1.sendIdx["translateBy:"]=3;
- $13=(5).__at((6));
- $ctx1.sendIdx["@"]=9;
- self._assert_equals_($10,$13);
- $ctx1.sendIdx["assert:equals:"]=3;
- $15=(3).__at((3));
- $ctx1.sendIdx["@"]=10;
- $16=$recv((3)._negated()).__at((0));
- $ctx1.sendIdx["@"]=11;
- $14=$recv($15)._translateBy_($16);
- self._assert_equals_($14,(0).__at((3)));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
- },
- args: [],
- 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.",
- referencedClasses: [],
- messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
- }),
- $globals.PointTest);
- $core.addClass('QueueTest', $globals.TestCase, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "testNextIfAbsent",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var queue;
- function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
- return $core.withContext(function($ctx1) {
- var $2,$1;
- queue=$recv($Queue())._new();
- $recv(queue)._nextPut_("index1");
- $2=$recv(queue)._nextIfAbsent_("empty");
- $ctx1.sendIdx["nextIfAbsent:"]=1;
- $1=$recv($2).__eq("index1");
- $ctx1.sendIdx["="]=1;
- self._assert_($1);
- self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
- },
- args: [],
- 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'",
- referencedClasses: ["Queue"],
- messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
- }),
- $globals.QueueTest);
- $core.addMethod(
- $core.method({
- selector: "testQueueNext",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var queue;
- function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$4,$3,$6,$5;
- queue=$recv($Queue())._new();
- $1=queue;
- $recv($1)._nextPut_("index1");
- $ctx1.sendIdx["nextPut:"]=1;
- $2=$recv($1)._nextPut_("index2");
- $4=$recv(queue)._next();
- $ctx1.sendIdx["next"]=1;
- $3=$recv($4).__eq("index1");
- $ctx1.sendIdx["="]=1;
- self._assert_($3);
- $6=$recv(queue)._next();
- $ctx1.sendIdx["next"]=2;
- $5=$recv($6).__eq("index");
- self._deny_($5);
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(queue)._next();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$Error());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Queue", "Error"],
- messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
- }),
- $globals.QueueTest);
- $core.addClass('RandomTest', $globals.TestCase, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "testAtRandomNumber",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var val;
- return $core.withContext(function($ctx1) {
- (100)._timesRepeat_((function(){
- return $core.withContext(function($ctx2) {
- val=(10)._atRandom();
- val;
- self._assert_($recv(val).__gt((0)));
- $ctx2.sendIdx["assert:"]=1;
- return self._assert_($recv(val).__lt((11)));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
- },
- args: [],
- 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]",
- referencedClasses: [],
- messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
- }),
- $globals.RandomTest);
- $core.addMethod(
- $core.method({
- selector: "testAtRandomSequenceableCollection",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var val;
- return $core.withContext(function($ctx1) {
- var $3,$4,$2,$1;
- (100)._timesRepeat_((function(){
- return $core.withContext(function($ctx2) {
- val="abc"._atRandom();
- val;
- $3=$recv(val).__eq("a");
- $ctx2.sendIdx["="]=1;
- $4=$recv(val).__eq("b");
- $ctx2.sendIdx["="]=2;
- $2=$recv($3).__or($4);
- $1=$recv($2).__or($recv(val).__eq("c"));
- $ctx2.sendIdx["|"]=1;
- return self._assert_($1);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
- },
- args: [],
- 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].",
- referencedClasses: [],
- messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
- }),
- $globals.RandomTest);
- $core.addMethod(
- $core.method({
- selector: "textNext",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Random(){return $globals.Random||(typeof Random=="undefined"?nil:Random)}
- return $core.withContext(function($ctx1) {
- var $1;
- (10000)._timesRepeat_((function(){
- var current,next;
- return $core.withContext(function($ctx2) {
- next=$recv($recv($Random())._new())._next();
- next;
- self._assert_($recv(next).__gt_eq((0)));
- $ctx2.sendIdx["assert:"]=1;
- self._assert_($recv(next).__lt((1)));
- $1=$recv(current).__eq(next);
- $ctx2.sendIdx["="]=1;
- self._deny_($1);
- return $recv(next).__eq(current);
- }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
- },
- args: [],
- 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 ]",
- referencedClasses: ["Random"],
- messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
- }),
- $globals.RandomTest);
- $core.addClass('StreamTest', $globals.TestCase, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "collectionClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._class())._collectionClass();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
- },
- args: [],
- source: "collectionClass\x0a\x09^ self class collectionClass",
- referencedClasses: [],
- messageSends: ["collectionClass", "class"]
- }),
- $globals.StreamTest);
- $core.addMethod(
- $core.method({
- selector: "newCollection",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._collectionClass())._new();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
- },
- args: [],
- source: "newCollection\x0a\x09^ self collectionClass new",
- referencedClasses: [],
- messageSends: ["new", "collectionClass"]
- }),
- $globals.StreamTest);
- $core.addMethod(
- $core.method({
- selector: "newStream",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv(self._collectionClass())._new())._stream();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
- },
- args: [],
- source: "newStream\x0a\x09^ self collectionClass new stream",
- referencedClasses: [],
- messageSends: ["stream", "new", "collectionClass"]
- }),
- $globals.StreamTest);
- $core.addMethod(
- $core.method({
- selector: "testAtStartAtEnd",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var stream;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- stream=self._newStream();
- $1=$recv(stream)._atStart();
- $ctx1.sendIdx["atStart"]=1;
- self._assert_($1);
- $ctx1.sendIdx["assert:"]=1;
- $2=$recv(stream)._atEnd();
- $ctx1.sendIdx["atEnd"]=1;
- self._assert_($2);
- $ctx1.sendIdx["assert:"]=2;
- $recv(stream)._nextPutAll_(self._newCollection());
- $3=$recv(stream)._atEnd();
- $ctx1.sendIdx["atEnd"]=2;
- self._assert_($3);
- $4=$recv(stream)._atStart();
- $ctx1.sendIdx["atStart"]=2;
- self._deny_($4);
- $ctx1.sendIdx["deny:"]=1;
- $recv(stream)._position_((1));
- self._deny_($recv(stream)._atEnd());
- $ctx1.sendIdx["deny:"]=2;
- self._deny_($recv(stream)._atStart());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
- }),
- $globals.StreamTest);
- $core.addMethod(
- $core.method({
- selector: "testContents",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var stream;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- stream=self._newStream();
- $1=stream;
- $2=self._newCollection();
- $ctx1.sendIdx["newCollection"]=1;
- $recv($1)._nextPutAll_($2);
- self._assert_equals_($recv(stream)._contents(),self._newCollection());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
- }),
- $globals.StreamTest);
- $core.addMethod(
- $core.method({
- selector: "testIsEmpty",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var stream;
- return $core.withContext(function($ctx1) {
- var $1;
- stream=self._newStream();
- $1=$recv(stream)._isEmpty();
- $ctx1.sendIdx["isEmpty"]=1;
- self._assert_($1);
- $recv(stream)._nextPutAll_(self._newCollection());
- self._deny_($recv(stream)._isEmpty());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
- }),
- $globals.StreamTest);
- $core.addMethod(
- $core.method({
- selector: "testPosition",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var collection,stream;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3;
- collection=self._newCollection();
- stream=self._newStream();
- $recv(stream)._nextPutAll_(collection);
- $1=$recv(stream)._position();
- $ctx1.sendIdx["position"]=1;
- self._assert_equals_($1,$recv(collection)._size());
- $ctx1.sendIdx["assert:equals:"]=1;
- $recv(stream)._position_((0));
- $2=$recv(stream)._position();
- $ctx1.sendIdx["position"]=2;
- self._assert_equals_($2,(0));
- $ctx1.sendIdx["assert:equals:"]=2;
- $recv(stream)._next();
- $ctx1.sendIdx["next"]=1;
- $3=$recv(stream)._position();
- $ctx1.sendIdx["position"]=3;
- self._assert_equals_($3,(1));
- $ctx1.sendIdx["assert:equals:"]=3;
- $recv(stream)._next();
- self._assert_equals_($recv(stream)._position(),(2));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
- }),
- $globals.StreamTest);
- $core.addMethod(
- $core.method({
- selector: "testReading",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var stream,collection;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3;
- collection=self._newCollection();
- stream=self._newStream();
- $1=stream;
- $recv($1)._nextPutAll_(collection);
- $2=$recv($1)._position_((0));
- $recv(collection)._do_((function(each){
- return $core.withContext(function($ctx2) {
- $3=$recv(stream)._next();
- $ctx2.sendIdx["next"]=1;
- return self._assert_equals_($3,each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- self._assert_($recv($recv(stream)._next())._isNil());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
- }),
- $globals.StreamTest);
- $core.addMethod(
- $core.method({
- selector: "testStreamContents",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return self;
- },
- args: [],
- source: "testStreamContents",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.StreamTest);
- $core.addMethod(
- $core.method({
- selector: "testWrite",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var stream,collection;
- return $core.withContext(function($ctx1) {
- collection=self._newCollection();
- stream=self._newStream();
- $recv(collection)._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(stream).__lt_lt(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- self._assert_equals_($recv(stream)._contents(),collection);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
- }),
- $globals.StreamTest);
- $core.addMethod(
- $core.method({
- selector: "testWriting",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var stream,collection;
- return $core.withContext(function($ctx1) {
- var $1;
- collection=self._newCollection();
- stream=self._newStream();
- $ctx1.sendIdx["newStream"]=1;
- $recv(collection)._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(stream)._nextPut_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $1=$recv(stream)._contents();
- $ctx1.sendIdx["contents"]=1;
- self._assert_equals_($1,collection);
- $ctx1.sendIdx["assert:equals:"]=1;
- stream=self._newStream();
- $recv(stream)._nextPutAll_(collection);
- self._assert_equals_($recv(stream)._contents(),collection);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
- }),
- $globals.StreamTest);
- $core.addMethod(
- $core.method({
- selector: "collectionClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return nil;
- },
- args: [],
- source: "collectionClass\x0a\x09^ nil",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.StreamTest.klass);
- $core.addMethod(
- $core.method({
- selector: "isAbstract",
- protocol: 'testing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._collectionClass())._isNil();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.klass)});
- },
- args: [],
- source: "isAbstract\x0a\x09^ self collectionClass isNil",
- referencedClasses: [],
- messageSends: ["isNil", "collectionClass"]
- }),
- $globals.StreamTest.klass);
- $core.addClass('ArrayStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "newCollection",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=[true,(1),(3).__at((4)),"foo"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
- },
- args: [],
- source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
- referencedClasses: [],
- messageSends: ["@"]
- }),
- $globals.ArrayStreamTest);
- $core.addMethod(
- $core.method({
- selector: "collectionClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
- return $Array();
- },
- args: [],
- source: "collectionClass\x0a\x09^ Array",
- referencedClasses: ["Array"],
- messageSends: []
- }),
- $globals.ArrayStreamTest.klass);
- $core.addClass('StringStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "newCollection",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return "hello world";
- },
- args: [],
- source: "newCollection\x0a\x09^ 'hello world'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.StringStreamTest);
- $core.addMethod(
- $core.method({
- selector: "collectionClass",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $String();
- },
- args: [],
- source: "collectionClass\x0a\x09^ String",
- referencedClasses: ["String"],
- messageSends: []
- }),
- $globals.StringStreamTest.klass);
- $core.addClass('UndefinedTest', $globals.TestCase, [], 'Kernel-Tests');
- $core.addMethod(
- $core.method({
- selector: "testCopying",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_(nil._copy(),nil);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
- },
- args: [],
- source: "testCopying\x0a\x09self assert: nil copy equals: nil",
- referencedClasses: [],
- messageSends: ["assert:equals:", "copy"]
- }),
- $globals.UndefinedTest);
- $core.addMethod(
- $core.method({
- selector: "testDeepCopy",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_($recv(nil._deepCopy()).__eq(nil));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
- },
- args: [],
- source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
- referencedClasses: [],
- messageSends: ["assert:", "=", "deepCopy"]
- }),
- $globals.UndefinedTest);
- $core.addMethod(
- $core.method({
- selector: "testIfNil",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$3,$2,$4,$6,$5,$receiver;
- if(($receiver = nil) == null || $receiver.isNil){
- $1=true;
- } else {
- $1=nil;
- };
- self._assert_equals_($1,true);
- $ctx1.sendIdx["assert:equals:"]=1;
- if(($receiver = nil) == null || $receiver.isNil){
- $3=nil;
- } else {
- $3=true;
- };
- $2=$recv($3).__eq(true);
- $ctx1.sendIdx["="]=1;
- self._deny_($2);
- $ctx1.sendIdx["deny:"]=1;
- if(($receiver = nil) == null || $receiver.isNil){
- $4=true;
- } else {
- $4=false;
- };
- self._assert_equals_($4,true);
- if(($receiver = nil) == null || $receiver.isNil){
- $6=false;
- } else {
- $6=true;
- };
- $5=$recv($6).__eq(true);
- self._deny_($5);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
- }),
- $globals.UndefinedTest);
- $core.addMethod(
- $core.method({
- selector: "testIsNil",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_(nil._isNil());
- self._deny_(nil._notNil());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
- },
- args: [],
- source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
- referencedClasses: [],
- messageSends: ["assert:", "isNil", "deny:", "notNil"]
- }),
- $globals.UndefinedTest);
- });
- define("amber_core/SUnit-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
- var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
- $core.addPackage('SUnit-Tests');
- $core.packages["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
- $core.packages["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
- $core.addClass('ExampleSetTest', $globals.TestCase, ['empty', 'full'], 'SUnit-Tests');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "setUp",
- protocol: 'running',
- fn: function (){
- var self=this;
- function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
- return $core.withContext(function($ctx1) {
- self["@empty"]=$recv($Set())._new();
- self["@full"]=$recv($Set())._with_with_((5),"abc");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
- },
- args: [],
- source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
- referencedClasses: ["Set"],
- messageSends: ["new", "with:with:"]
- }),
- $globals.ExampleSetTest);
- $core.addMethod(
- $core.method({
- selector: "testAdd",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self["@empty"])._add_((5));
- self._assert_($recv(self["@empty"])._includes_((5)));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
- },
- args: [],
- source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
- referencedClasses: [],
- messageSends: ["add:", "assert:", "includes:"]
- }),
- $globals.ExampleSetTest);
- $core.addMethod(
- $core.method({
- selector: "testGrow",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self["@empty"])._addAll_((1)._to_((100)));
- self._assert_equals_($recv(self["@empty"])._size(),(100));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
- },
- args: [],
- source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
- referencedClasses: [],
- messageSends: ["addAll:", "to:", "assert:equals:", "size"]
- }),
- $globals.ExampleSetTest);
- $core.addMethod(
- $core.method({
- selector: "testIllegal",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self["@empty"])._at_((5));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$Error());
- $ctx1.sendIdx["should:raise:"]=1;
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self["@empty"])._at_put_((5),"abc");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }),$Error());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
- },
- args: [],
- 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",
- referencedClasses: ["Error"],
- messageSends: ["should:raise:", "at:", "at:put:"]
- }),
- $globals.ExampleSetTest);
- $core.addMethod(
- $core.method({
- selector: "testIncludes",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self["@full"])._includes_((5));
- $ctx1.sendIdx["includes:"]=1;
- self._assert_($1);
- $ctx1.sendIdx["assert:"]=1;
- self._assert_($recv(self["@full"])._includes_("abc"));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
- },
- args: [],
- source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
- referencedClasses: [],
- messageSends: ["assert:", "includes:"]
- }),
- $globals.ExampleSetTest);
- $core.addMethod(
- $core.method({
- selector: "testOccurrences",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=$recv(self["@empty"])._occurrencesOf_((0));
- $ctx1.sendIdx["occurrencesOf:"]=1;
- self._assert_equals_($1,(0));
- $ctx1.sendIdx["assert:equals:"]=1;
- $2=$recv(self["@full"])._occurrencesOf_((5));
- $ctx1.sendIdx["occurrencesOf:"]=2;
- self._assert_equals_($2,(1));
- $ctx1.sendIdx["assert:equals:"]=2;
- $recv(self["@full"])._add_((5));
- self._assert_equals_($recv(self["@full"])._occurrencesOf_((5)),(1));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
- }),
- $globals.ExampleSetTest);
- $core.addMethod(
- $core.method({
- selector: "testRemove",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $recv(self["@full"])._remove_((5));
- $1=$recv(self["@full"])._includes_("abc");
- $ctx1.sendIdx["includes:"]=1;
- self._assert_($1);
- self._deny_($recv(self["@full"])._includes_((5)));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
- },
- args: [],
- source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
- referencedClasses: [],
- messageSends: ["remove:", "assert:", "includes:", "deny:"]
- }),
- $globals.ExampleSetTest);
- $core.addClass('SUnitAsyncTest', $globals.TestCase, ['flag'], 'SUnit-Tests');
- $core.addMethod(
- $core.method({
- selector: "fakeError",
- protocol: 'helpers',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self["@flag"]="bad";
- self._timeout_((30));
- self["@flag"]=$recv(self._async_((function(){
- return $core.withContext(function($ctx2) {
- self["@flag"]="ok";
- self["@flag"];
- return self._error_("Intentional");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- })))._valueWithTimeout_((20));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
- },
- args: [],
- source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
- referencedClasses: [],
- messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
- }),
- $globals.SUnitAsyncTest);
- $core.addMethod(
- $core.method({
- selector: "fakeErrorFailingInTearDown",
- protocol: 'helpers',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self["@flag"]="bad";
- self._timeout_((30));
- self["@flag"]=$recv(self._async_((function(){
- return $core.withContext(function($ctx2) {
- return self._error_("Intentional");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- })))._valueWithTimeout_((20));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
- },
- args: [],
- source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
- referencedClasses: [],
- messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
- }),
- $globals.SUnitAsyncTest);
- $core.addMethod(
- $core.method({
- selector: "fakeFailure",
- protocol: 'helpers',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self["@flag"]="bad";
- self._timeout_((30));
- self["@flag"]=$recv(self._async_((function(){
- return $core.withContext(function($ctx2) {
- self["@flag"]="ok";
- self["@flag"];
- return self._assert_(false);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- })))._valueWithTimeout_((20));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
- },
- args: [],
- source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
- referencedClasses: [],
- messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
- }),
- $globals.SUnitAsyncTest);
- $core.addMethod(
- $core.method({
- selector: "fakeMultipleTimeoutFailing",
- protocol: 'helpers',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- self._timeout_((100));
- $ctx1.sendIdx["timeout:"]=1;
- $1=self._async_((function(){
- return $core.withContext(function($ctx2) {
- self._timeout_((20));
- return $recv(self._async_((function(){
- return $core.withContext(function($ctx3) {
- return self._finished();
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- })))._valueWithTimeout_((30));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $ctx1.sendIdx["async:"]=1;
- $recv($1)._valueWithTimeout_((20));
- $ctx1.sendIdx["valueWithTimeout:"]=1;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
- }),
- $globals.SUnitAsyncTest);
- $core.addMethod(
- $core.method({
- selector: "fakeMultipleTimeoutPassing",
- protocol: 'helpers',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- self._timeout_((20));
- $ctx1.sendIdx["timeout:"]=1;
- $1=self._async_((function(){
- return $core.withContext(function($ctx2) {
- self._timeout_((40));
- return $recv(self._async_((function(){
- return $core.withContext(function($ctx3) {
- return self._finished();
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- })))._valueWithTimeout_((20));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $ctx1.sendIdx["async:"]=1;
- $recv($1)._valueWithTimeout_((10));
- $ctx1.sendIdx["valueWithTimeout:"]=1;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
- }),
- $globals.SUnitAsyncTest);
- $core.addMethod(
- $core.method({
- selector: "fakeTimeout",
- protocol: 'helpers',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._timeout_((10));
- $recv(self._async_((function(){
- return $core.withContext(function($ctx2) {
- return self._finished();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- })))._valueWithTimeout_((20));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
- },
- args: [],
- source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
- referencedClasses: [],
- messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
- }),
- $globals.SUnitAsyncTest);
- $core.addMethod(
- $core.method({
- selector: "selectorSetOf:",
- protocol: 'private',
- fn: function (aCollection){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv(aCollection)._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._selector();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- })))._asSet();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
- },
- args: ["aCollection"],
- source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
- referencedClasses: [],
- messageSends: ["asSet", "collect:", "selector"]
- }),
- $globals.SUnitAsyncTest);
- $core.addMethod(
- $core.method({
- selector: "setUp",
- protocol: 'running',
- fn: function (){
- var self=this;
- self["@flag"]="ok";
- return self;
- },
- args: [],
- source: "setUp\x0a\x09flag := 'ok'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.SUnitAsyncTest);
- $core.addMethod(
- $core.method({
- selector: "tearDown",
- protocol: 'running',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._assert_equals_("ok",self["@flag"]);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
- },
- args: [],
- source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
- referencedClasses: [],
- messageSends: ["assert:equals:"]
- }),
- $globals.SUnitAsyncTest);
- $core.addMethod(
- $core.method({
- selector: "testAsyncErrorsAndFailures",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var suite,runner,result,assertBlock;
- function $TestSuiteRunner(){return $globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)}
- function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(self._class())._selector_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- runner=$recv($TestSuiteRunner())._on_(suite);
- self._timeout_((200));
- result=$recv(runner)._result();
- $ctx1.sendIdx["result"]=1;
- assertBlock=self._async_((function(){
- return $core.withContext(function($ctx2) {
- $1=self._selectorSetOf_($recv(result)._errors());
- $ctx2.sendIdx["selectorSetOf:"]=1;
- $2=["fakeError"]._asSet();
- $ctx2.sendIdx["asSet"]=1;
- self._assert_equals_($1,$2);
- $ctx2.sendIdx["assert:equals:"]=1;
- self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
- return self._finished();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- $recv($recv(runner)._announcer())._on_do_($ResultAnnouncement(),(function(ann){
- return $core.withContext(function($ctx2) {
- $3=$recv($recv(ann)._result()).__eq_eq(result);
- if($core.assert($3)){
- $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
- return $recv($4)._ifTrue_(assertBlock);
- };
- }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
- }));
- $recv(runner)._run();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
- },
- args: [],
- 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",
- referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
- messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
- }),
- $globals.SUnitAsyncTest);
- $core.addMethod(
- $core.method({
- selector: "testAsyncNeedsTimeout",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return self._async_((function(){
- }));
- $ctx2.sendIdx["async:"]=1;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$Error());
- self._timeout_((0));
- self._shouldnt_raise_((function(){
- return $core.withContext(function($ctx2) {
- return self._async_((function(){
- }));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }),$Error());
- self._finished();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
- },
- args: [],
- source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
- referencedClasses: ["Error"],
- messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
- }),
- $globals.SUnitAsyncTest);
- $core.addMethod(
- $core.method({
- selector: "testFinishedNeedsTimeout",
- protocol: 'tests',
- fn: function (){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- return $core.withContext(function($ctx1) {
- self._should_raise_((function(){
- return $core.withContext(function($ctx2) {
- return self._finished();
- $ctx2.sendIdx["finished"]=1;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }),$Error());
- self._timeout_((0));
- self._shouldnt_raise_((function(){
- return $core.withContext(function($ctx2) {
- return self._finished();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }),$Error());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
- },
- args: [],
- source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
- referencedClasses: ["Error"],
- messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
- }),
- $globals.SUnitAsyncTest);
- $core.addMethod(
- $core.method({
- selector: "testIsAsyncReturnsCorrectValues",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=self._isAsync();
- $ctx1.sendIdx["isAsync"]=1;
- self._deny_($1);
- $ctx1.sendIdx["deny:"]=1;
- self._timeout_((0));
- $2=self._isAsync();
- $ctx1.sendIdx["isAsync"]=2;
- self._assert_($2);
- self._finished();
- self._deny_(self._isAsync());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
- },
- args: [],
- source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
- referencedClasses: [],
- messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
- }),
- $globals.SUnitAsyncTest);
- $core.addMethod(
- $core.method({
- selector: "testPass",
- protocol: 'tests',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- self["@flag"]="bad";
- self._timeout_((10));
- self["@flag"]=$recv(self._async_((function(){
- return $core.withContext(function($ctx2) {
- self._assert_(true);
- self._finished();
- self["@flag"]="ok";
- return self["@flag"];
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- })))._valueWithTimeout_((5));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
- },
- args: [],
- source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
- referencedClasses: [],
- messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
- }),
- $globals.SUnitAsyncTest);
- $core.addMethod(
- $core.method({
- selector: "testTimeouts",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var suite,runner,result,assertBlock;
- function $TestSuiteRunner(){return $globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)}
- function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
- function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3;
- suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(self._class())._selector_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- runner=$recv($TestSuiteRunner())._on_(suite);
- self._timeout_((200));
- result=$recv(runner)._result();
- $ctx1.sendIdx["result"]=1;
- assertBlock=self._async_((function(){
- return $core.withContext(function($ctx2) {
- $1=self._selectorSetOf_($recv(result)._errors());
- $ctx2.sendIdx["selectorSetOf:"]=1;
- self._assert_equals_($1,$recv($Set())._new());
- $ctx2.sendIdx["assert:equals:"]=1;
- self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
- return self._finished();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- $recv($recv(runner)._announcer())._on_do_($ResultAnnouncement(),(function(ann){
- return $core.withContext(function($ctx2) {
- $2=$recv($recv(ann)._result()).__eq_eq(result);
- if($core.assert($2)){
- $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
- return $recv($3)._ifTrue_(assertBlock);
- };
- }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
- }));
- $recv(runner)._run();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
- },
- args: [],
- 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",
- referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
- messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
- }),
- $globals.SUnitAsyncTest);
- $core.addMethod(
- $core.method({
- selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
- protocol: 'tests',
- fn: function (){
- var self=this;
- var x;
- return $core.withContext(function($ctx1) {
- var $1;
- self["@flag"]="bad";
- self._timeout_((10));
- x=(0);
- $1=self._async_((function(){
- return $core.withContext(function($ctx2) {
- self._finished();
- $ctx2.sendIdx["finished"]=1;
- self["@flag"]="ok";
- self["@flag"];
- x=$recv(x).__plus((1));
- $ctx2.sendIdx["+"]=1;
- x;
- return self._assert_equals_(x,(1));
- $ctx2.sendIdx["assert:equals:"]=1;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $ctx1.sendIdx["async:"]=1;
- self["@flag"]=$recv($1)._valueWithTimeout_((0));
- $ctx1.sendIdx["valueWithTimeout:"]=1;
- self["@flag"]=$recv(self._async_((function(){
- return $core.withContext(function($ctx2) {
- self._finished();
- self["@flag"]="ok";
- self["@flag"];
- x=$recv(x).__plus((1));
- x;
- return self._assert_equals_(x,(1));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- })))._valueWithTimeout_((0));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
- },
- args: [],
- 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.",
- referencedClasses: [],
- messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
- }),
- $globals.SUnitAsyncTest);
- });
- define('amber/devel',[
- './helpers', // pre-fetch, dep of ./deploy
- './deploy', // pre-fetch, dep of ./lang
- './lang',
- // --- packages of the development only Amber begin here ---
- 'amber_core/SUnit',
- 'amber_core/Compiler-Tests',
- 'amber_core/Kernel-Tests',
- 'amber_core/SUnit-Tests'
- // --- packages of the development only Amber end here ---
- ], function (amber) { return amber; });
- define("amber_cli/AmberCli", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
- var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
- $core.addPackage('AmberCli');
- $core.packages["AmberCli"].innerEval = function (expr) { return eval(expr); };
- $core.packages["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
- $core.addClass('AmberCli', $globals.Object, [], 'AmberCli');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "commandLineSwitches",
- protocol: 'commandline',
- fn: function (){
- var self=this;
- var switches;
- return $core.withContext(function($ctx1) {
- var $1;
- switches=$recv($recv(self._class())._methodsInProtocol_("commands"))._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._selector();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $ctx1.sendIdx["collect:"]=1;
- switches=$recv(switches)._select_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._match_("^[^:]*:$");
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- switches=$recv(switches)._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
- }));
- $1=switches;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.klass)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
- }),
- $globals.AmberCli.klass);
- $core.addMethod(
- $core.method({
- selector: "config:",
- protocol: 'commands',
- fn: function (args){
- var self=this;
- function $Configurator(){return $globals.Configurator||(typeof Configurator=="undefined"?nil:Configurator)}
- return $core.withContext(function($ctx1) {
- $recv($recv($Configurator())._new())._start();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.klass)});
- },
- args: ["args"],
- source: "config: args\x0a\x09Configurator new start",
- referencedClasses: ["Configurator"],
- messageSends: ["start", "new"]
- }),
- $globals.AmberCli.klass);
- $core.addMethod(
- $core.method({
- selector: "handleArguments:",
- protocol: 'commandline',
- fn: function (args){
- var self=this;
- var selector;
- function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(args)._first();
- $ctx1.sendIdx["first"]=1;
- selector=self._selectorForCommandLineSwitch_($1);
- $recv(args)._remove_($recv(args)._first());
- self._perform_withArguments_(selector,$recv($Array())._with_(args));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.klass)});
- },
- args: ["args"],
- 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)",
- referencedClasses: ["Array"],
- messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
- }),
- $globals.AmberCli.klass);
- $core.addMethod(
- $core.method({
- selector: "help:",
- protocol: 'commands',
- fn: function (args){
- var self=this;
- function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
- return $core.withContext(function($ctx1) {
- $recv($Transcript())._show_("Available commands");
- $recv(self._commandLineSwitches())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(console)._log_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.klass)});
- },
- args: ["args"],
- source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
- referencedClasses: ["Transcript"],
- messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
- }),
- $globals.AmberCli.klass);
- $core.addMethod(
- $core.method({
- selector: "init:",
- protocol: 'commands',
- fn: function (args){
- var self=this;
- function $Initer(){return $globals.Initer||(typeof Initer=="undefined"?nil:Initer)}
- return $core.withContext(function($ctx1) {
- $recv($recv($Initer())._new())._start();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.klass)});
- },
- args: ["args"],
- source: "init: args\x0a\x09Initer new start",
- referencedClasses: ["Initer"],
- messageSends: ["start", "new"]
- }),
- $globals.AmberCli.klass);
- $core.addMethod(
- $core.method({
- selector: "main",
- protocol: 'startup',
- fn: function (){
- var self=this;
- var args;
- function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $3,$2,$1,$4,$5;
- $3=$recv("Welcome to Amber version ".__comma($recv($Smalltalk())._version())).__comma(" (NodeJS ");
- $ctx1.sendIdx[","]=3;
- $2=$recv($3).__comma($recv($recv(process)._versions())._node());
- $ctx1.sendIdx[","]=2;
- $1=$recv($2).__comma(").");
- $ctx1.sendIdx[","]=1;
- $recv($Transcript())._show_($1);
- args=$recv(process)._argv();
- $recv(args)._removeFrom_to_((1),(2));
- $4=$recv(args)._isEmpty();
- if($core.assert($4)){
- self._help_(nil);
- } else {
- $5=self._handleArguments_(args);
- return $5;
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"main",{args:args},$globals.AmberCli.klass)});
- },
- args: [],
- 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]",
- referencedClasses: ["Transcript", "Smalltalk"],
- messageSends: ["show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifTrue:ifFalse:", "isEmpty", "help:", "handleArguments:"]
- }),
- $globals.AmberCli.klass);
- $core.addMethod(
- $core.method({
- selector: "repl:",
- protocol: 'commands',
- fn: function (args){
- var self=this;
- function $Repl(){return $globals.Repl||(typeof Repl=="undefined"?nil:Repl)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv($Repl())._new())._createInterface();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.klass)});
- },
- args: ["args"],
- source: "repl: args\x0a\x09^ Repl new createInterface",
- referencedClasses: ["Repl"],
- messageSends: ["createInterface", "new"]
- }),
- $globals.AmberCli.klass);
- $core.addMethod(
- $core.method({
- selector: "selectorForCommandLineSwitch:",
- protocol: 'commandline',
- fn: function (aSwitch){
- var self=this;
- var command,selector;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- $1=$recv(self._commandLineSwitches())._includes_(aSwitch);
- if($core.assert($1)){
- selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
- return $core.withContext(function($ctx2) {
- return $recv($recv(each)._second())._asUppercase();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }))).__comma(":");
- selector;
- } else {
- selector="help:";
- selector;
- };
- $2=selector;
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.klass)});
- },
- args: ["aSwitch"],
- 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",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
- }),
- $globals.AmberCli.klass);
- $core.addMethod(
- $core.method({
- selector: "serve:",
- protocol: 'commands',
- fn: function (args){
- var self=this;
- function $FileServer(){return $globals.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv($FileServer())._createServerWithArguments_(args))._start();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.klass)});
- },
- args: ["args"],
- source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
- referencedClasses: ["FileServer"],
- messageSends: ["start", "createServerWithArguments:"]
- }),
- $globals.AmberCli.klass);
- $core.addMethod(
- $core.method({
- selector: "version:",
- protocol: 'commands',
- fn: function (arguments_){
- var self=this;
- return self;
- },
- args: ["arguments"],
- source: "version: arguments",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.AmberCli.klass);
- $core.addClass('BaseFileManipulator', $globals.Object, ['path', 'fs'], 'AmberCli');
- $core.addMethod(
- $core.method({
- selector: "dirname",
- protocol: 'private',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- return __dirname;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
- },
- args: [],
- source: "dirname\x0a\x09<return __dirname>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.BaseFileManipulator);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.BaseFileManipulator.superclass.fn.prototype._initialize.apply($recv(self), []));
- $ctx1.supercall = false;
- self["@path"]=$recv(require)._value_("path");
- $ctx1.sendIdx["value:"]=1;
- self["@fs"]=$recv(require)._value_("fs");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
- },
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
- referencedClasses: [],
- messageSends: ["initialize", "value:"]
- }),
- $globals.BaseFileManipulator);
- $core.addMethod(
- $core.method({
- selector: "rootDirname",
- protocol: 'private',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self["@path"])._join_with_(self._dirname(),"..");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
- },
- args: [],
- source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
- referencedClasses: [],
- messageSends: ["join:with:", "dirname"]
- }),
- $globals.BaseFileManipulator);
- $core.addClass('Configurator', $globals.BaseFileManipulator, [], 'AmberCli');
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.Configurator.superclass.fn.prototype._initialize.apply($recv(self), []));
- $ctx1.supercall = false;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
- },
- args: [],
- source: "initialize\x0a\x09super initialize",
- referencedClasses: [],
- messageSends: ["initialize"]
- }),
- $globals.Configurator);
- $core.addMethod(
- $core.method({
- selector: "start",
- protocol: 'action',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $receiver;
- self._writeConfigThenDo_((function(err){
- return $core.withContext(function($ctx2) {
- if(($receiver = err) == null || $receiver.isNil){
- return $recv(process)._exit();
- } else {
- return $recv(process)._exit_((111));
- };
- }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
- },
- args: [],
- source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
- referencedClasses: [],
- messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
- }),
- $globals.Configurator);
- $core.addMethod(
- $core.method({
- selector: "writeConfigThenDo:",
- protocol: 'action',
- fn: function (aBlock){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv($recv(require)._value_("amber-dev/lib/config"))._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
- },
- args: ["aBlock"],
- 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",
- referencedClasses: [],
- messageSends: ["writeConfig:toFile:thenDo:", "value:", "cwd"]
- }),
- $globals.Configurator);
- $core.addClass('FileServer', $globals.BaseFileManipulator, ['http', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "base64Decode:",
- protocol: 'private',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- return (new Buffer(aString, 'base64').toString());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
- },
- args: ["aString"],
- source: "base64Decode: aString\x0a\x09<return (new Buffer(aString, 'base64').toString())>",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "basePath",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@basePath"];
- if(($receiver = $2) == null || $receiver.isNil){
- $1=$recv(self._class())._defaultBasePath();
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
- },
- args: [],
- source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
- referencedClasses: [],
- messageSends: ["ifNil:", "defaultBasePath", "class"]
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "basePath:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- self["@basePath"]=aString;
- self._validateBasePath();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
- },
- args: ["aString"],
- source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
- referencedClasses: [],
- messageSends: ["validateBasePath"]
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "checkDirectoryLayout",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self["@fs"])._existsSync_(self._withBasePath_("index.html"));
- if(!$core.assert($1)){
- $recv(console)._warn_("Warning: project directory does not contain index.html.");
- $ctx1.sendIdx["warn:"]=1;
- $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
- $ctx1.sendIdx["warn:"]=2;
- $recv(console)._warn_(" You can also specify a page to be served by default,");
- $ctx1.sendIdx["warn:"]=3;
- $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
- },
- args: [],
- 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.'].",
- referencedClasses: [],
- messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "fallbackPage",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@fallbackPage"];
- return $1;
- },
- args: [],
- source: "fallbackPage\x0a\x09^ fallbackPage",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "fallbackPage:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- self["@fallbackPage"]=aString;
- return self;
- },
- args: ["aString"],
- source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "handleGETRequest:respondTo:",
- protocol: 'request handling',
- fn: function (aRequest,aResponse){
- var self=this;
- var uri,filename;
- return $core.withContext(function($ctx1) {
- var $1;
- uri=$recv(self["@url"])._parse_($recv(aRequest)._url());
- filename=$recv(self["@path"])._join_with_(self._basePath(),$recv(uri)._pathname());
- $recv(self["@fs"])._exists_do_(filename,(function(aBoolean){
- return $core.withContext(function($ctx2) {
- if($core.assert(aBoolean)){
- $1=$recv($recv(self["@fs"])._statSync_(filename))._isDirectory();
- if($core.assert($1)){
- return self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
- } else {
- return self._respondFileNamed_to_(filename,aResponse);
- };
- } else {
- return self._respondNotFoundTo_(aResponse);
- };
- }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
- },
- args: ["aRequest", "aResponse"],
- 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]]]",
- referencedClasses: [],
- messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "handleOPTIONSRequest:respondTo:",
- protocol: 'request handling',
- fn: function (aRequest,aResponse){
- var self=this;
- return $core.withContext(function($ctx1) {
- $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)]));
- $recv(aResponse)._end();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
- },
- args: ["aRequest", "aResponse"],
- 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",
- referencedClasses: [],
- messageSends: ["writeHead:options:", "end"]
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "handlePUTRequest:respondTo:",
- protocol: 'request handling',
- fn: function (aRequest,aResponse){
- var self=this;
- var file,stream;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- $1=self._isAuthenticated_(aRequest);
- if(!$core.assert($1)){
- self._respondAuthenticationRequiredTo_(aResponse);
- return nil;
- };
- file=".".__comma($recv(aRequest)._url());
- $ctx1.sendIdx[","]=1;
- stream=$recv(self["@fs"])._createWriteStream_(file);
- $recv(stream)._on_do_("error",(function(error){
- return $core.withContext(function($ctx2) {
- $2=console;
- $3="Error creating WriteStream for file ".__comma(file);
- $ctx2.sendIdx[","]=2;
- $recv($2)._warn_($3);
- $ctx2.sendIdx["warn:"]=1;
- $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
- $ctx2.sendIdx["warn:"]=2;
- $recv(console)._warn_(" The exact error is: ".__comma(error));
- return self._respondNotCreatedTo_(aResponse);
- }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
- }));
- $ctx1.sendIdx["on:do:"]=1;
- $recv(stream)._on_do_("close",(function(){
- return $core.withContext(function($ctx2) {
- return self._respondCreatedTo_(aResponse);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }));
- $ctx1.sendIdx["on:do:"]=2;
- $recv(aRequest)._setEncoding_("utf8");
- $recv(aRequest)._on_do_("data",(function(data){
- return $core.withContext(function($ctx2) {
- return $recv(stream)._write_(data);
- }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
- }));
- $ctx1.sendIdx["on:do:"]=3;
- $recv(aRequest)._on_do_("end",(function(){
- return $core.withContext(function($ctx2) {
- $4=$recv(stream)._writable();
- if($core.assert($4)){
- return $recv(stream)._end();
- };
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
- },
- args: ["aRequest", "aResponse"],
- 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]]",
- referencedClasses: [],
- messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "handleRequest:respondTo:",
- protocol: 'request handling',
- fn: function (aRequest,aResponse){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$4,$3,$5;
- $2=$recv(aRequest)._method();
- $ctx1.sendIdx["method"]=1;
- $1=$recv($2).__eq("PUT");
- $ctx1.sendIdx["="]=1;
- if($core.assert($1)){
- self._handlePUTRequest_respondTo_(aRequest,aResponse);
- };
- $4=$recv(aRequest)._method();
- $ctx1.sendIdx["method"]=2;
- $3=$recv($4).__eq("GET");
- $ctx1.sendIdx["="]=2;
- if($core.assert($3)){
- self._handleGETRequest_respondTo_(aRequest,aResponse);
- };
- $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
- if($core.assert($5)){
- self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
- },
- args: ["aRequest", "aResponse"],
- 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]",
- referencedClasses: [],
- messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "host",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@host"];
- return $1;
- },
- args: [],
- source: "host\x0a\x09^ host",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "host:",
- protocol: 'accessing',
- fn: function (hostname){
- var self=this;
- self["@host"]=hostname;
- return self;
- },
- args: ["hostname"],
- source: "host: hostname\x0a\x09host := hostname",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- (
- $ctx1.supercall = true,
- $globals.FileServer.superclass.fn.prototype._initialize.apply($recv(self), []));
- $ctx1.supercall = false;
- self["@http"]=self._require_("http");
- $ctx1.sendIdx["require:"]=1;
- self["@util"]=self._require_("util");
- $ctx1.sendIdx["require:"]=2;
- self["@url"]=self._require_("url");
- $1=self._class();
- $ctx1.sendIdx["class"]=1;
- self["@host"]=$recv($1)._defaultHost();
- self["@port"]=$recv(self._class())._defaultPort();
- self["@username"]=nil;
- self["@password"]=nil;
- self["@fallbackPage"]=nil;
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
- },
- args: [],
- 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.",
- referencedClasses: [],
- messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "isAuthenticated:",
- protocol: 'private',
- fn: function (aRequest){
- var self=this;
- var header,token,auth,parts;
- return $core.withContext(function($ctx1) {
- var $2,$1,$3,$4,$5,$6,$9,$10,$8,$7,$receiver;
- $2=$recv(self["@username"])._isNil();
- $ctx1.sendIdx["isNil"]=1;
- $1=$recv($2)._and_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self["@password"])._isNil();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $ctx1.sendIdx["and:"]=1;
- if($core.assert($1)){
- return true;
- };
- $3=$recv($recv(aRequest)._headers())._at_("authorization");
- $ctx1.sendIdx["at:"]=1;
- if(($receiver = $3) == null || $receiver.isNil){
- header="";
- } else {
- header=$3;
- };
- $4=$recv(header)._isEmpty();
- if($core.assert($4)){
- return false;
- } else {
- $5=$recv(header)._tokenize_(" ");
- $ctx1.sendIdx["tokenize:"]=1;
- if(($receiver = $5) == null || $receiver.isNil){
- token="";
- } else {
- token=$5;
- };
- token;
- $6=$recv(token)._at_((2));
- $ctx1.sendIdx["at:"]=2;
- auth=self._base64Decode_($6);
- auth;
- parts=$recv(auth)._tokenize_(":");
- parts;
- $9=self["@username"];
- $10=$recv(parts)._at_((1));
- $ctx1.sendIdx["at:"]=3;
- $8=$recv($9).__eq($10);
- $ctx1.sendIdx["="]=1;
- $7=$recv($8)._and_((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self["@password"]).__eq($recv(parts)._at_((2)));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
- }));
- if($core.assert($7)){
- return true;
- } else {
- return false;
- };
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
- },
- args: ["aRequest"],
- 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].",
- referencedClasses: [],
- messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "isEmpty", "tokenize:", "base64Decode:", "="]
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "password:",
- protocol: 'accessing',
- fn: function (aPassword){
- var self=this;
- self["@password"]=aPassword;
- return self;
- },
- args: ["aPassword"],
- source: "password: aPassword\x0a\x09password := aPassword.",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "port",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@port"];
- return $1;
- },
- args: [],
- source: "port\x0a\x09^ port",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "port:",
- protocol: 'accessing',
- fn: function (aNumber){
- var self=this;
- self["@port"]=aNumber;
- return self;
- },
- args: ["aNumber"],
- source: "port: aNumber\x0a\x09port := aNumber",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "require:",
- protocol: 'private',
- fn: function (aModuleString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(require)._value_(aModuleString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
- },
- args: ["aModuleString"],
- source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
- referencedClasses: [],
- messageSends: ["value:"]
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "respondAuthenticationRequiredTo:",
- protocol: 'request handling',
- fn: function (aResponse){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
- $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
- $1=$recv(aResponse)._end();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
- },
- args: ["aResponse"],
- 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.",
- referencedClasses: [],
- messageSends: ["writeHead:options:", "write:", "end"]
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "respondCreatedTo:",
- protocol: 'request handling',
- fn: function (aResponse){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
- $1=$recv(aResponse)._end();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
- },
- args: ["aResponse"],
- source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
- referencedClasses: [],
- messageSends: ["writeHead:options:", "end"]
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "respondDirectoryNamed:from:to:",
- protocol: 'request handling',
- fn: function (aDirname,aUrl,aResponse){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$3,$5,$7,$6,$4,$receiver;
- $2=$recv(aUrl)._pathname();
- $ctx1.sendIdx["pathname"]=1;
- $1=$recv($2)._endsWith_("/");
- if($core.assert($1)){
- $3=$recv(aDirname).__comma("index.html");
- $ctx1.sendIdx[","]=1;
- self._respondFileNamed_to_($3,aResponse);
- } else {
- $5=$recv($recv(aUrl)._pathname()).__comma("/");
- $7=$recv(aUrl)._search();
- if(($receiver = $7) == null || $receiver.isNil){
- $6="";
- } else {
- $6=$7;
- };
- $4=$recv($5).__comma($6);
- $ctx1.sendIdx[","]=2;
- self._respondRedirect_to_($4,aResponse);
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
- },
- args: ["aDirname", "aUrl", "aResponse"],
- 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]",
- referencedClasses: [],
- messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "respondFileNamed:to:",
- protocol: 'request handling',
- fn: function (aFilename,aResponse){
- var self=this;
- var type,filename;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5;
- filename=aFilename;
- $recv(self["@fs"])._readFile_do_(filename,(function(ex,file){
- return $core.withContext(function($ctx2) {
- $1=$recv(ex)._notNil();
- if($core.assert($1)){
- $2=console;
- $3=$recv(filename).__comma(" does not exist");
- $ctx2.sendIdx[","]=1;
- $recv($2)._log_($3);
- return self._respondNotFoundTo_(aResponse);
- } else {
- type=$recv(self._class())._mimeTypeFor_(filename);
- type;
- $4=$recv(type).__eq("application/javascript");
- if($core.assert($4)){
- type=$recv(type).__comma(";charset=utf-8");
- type;
- };
- $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
- $recv(aResponse)._write_encoding_(file,"binary");
- $5=$recv(aResponse)._end();
- return $5;
- };
- }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
- },
- args: ["aFilename", "aResponse"],
- 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]]",
- referencedClasses: [],
- messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "respondInternalErrorTo:",
- protocol: 'request handling',
- fn: function (aResponse){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
- $recv(aResponse)._write_("500 Internal server error");
- $1=$recv(aResponse)._end();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
- },
- args: ["aResponse"],
- source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
- referencedClasses: [],
- messageSends: ["writeHead:options:", "write:", "end"]
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "respondNotCreatedTo:",
- protocol: 'request handling',
- fn: function (aResponse){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
- $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
- $1=$recv(aResponse)._end();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
- },
- args: ["aResponse"],
- 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.",
- referencedClasses: [],
- messageSends: ["writeHead:options:", "write:", "end"]
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "respondNotFoundTo:",
- protocol: 'request handling',
- fn: function (aResponse){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$3,$4;
- $2=self._fallbackPage();
- $ctx1.sendIdx["fallbackPage"]=1;
- $1=$recv($2)._isNil();
- if(!$core.assert($1)){
- $3=self._respondFileNamed_to_(self._fallbackPage(),aResponse);
- return $3;
- };
- $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
- $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
- $ctx1.sendIdx["write:"]=1;
- $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>");
- $ctx1.sendIdx["write:"]=2;
- $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
- $ctx1.sendIdx["write:"]=3;
- $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>");
- $ctx1.sendIdx["write:"]=4;
- $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
- $ctx1.sendIdx["write:"]=5;
- $recv(aResponse)._write_("</ul></p></body></html>");
- $4=$recv(aResponse)._end();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
- },
- args: ["aResponse"],
- 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",
- referencedClasses: [],
- messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "respondOKTo:",
- protocol: 'request handling',
- fn: function (aResponse){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
- $1=$recv(aResponse)._end();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
- },
- args: ["aResponse"],
- source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
- referencedClasses: [],
- messageSends: ["writeHead:options:", "end"]
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "respondRedirect:to:",
- protocol: 'request handling',
- fn: function (aString,aResponse){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
- $1=$recv(aResponse)._end();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
- },
- args: ["aString", "aResponse"],
- source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
- referencedClasses: [],
- messageSends: ["writeHead:options:", "end"]
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "start",
- protocol: 'starting',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5,$11;
- self._checkDirectoryLayout();
- $1=$recv(self["@http"])._createServer_((function(request,response){
- return $core.withContext(function($ctx2) {
- return self._handleRequest_respondTo_(request,response);
- }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
- }));
- $recv($1)._on_do_("error",(function(error){
- return $core.withContext(function($ctx2) {
- $2=console;
- $3="Error starting server: ".__comma(error);
- $ctx2.sendIdx[","]=1;
- return $recv($2)._log_($3);
- $ctx2.sendIdx["log:"]=1;
- }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
- }));
- $ctx1.sendIdx["on:do:"]=1;
- $recv($1)._on_do_("listening",(function(){
- return $core.withContext(function($ctx2) {
- $4=console;
- $8=self._host();
- $ctx2.sendIdx["host"]=1;
- $7="Starting file server on http://".__comma($8);
- $6=$recv($7).__comma(":");
- $ctx2.sendIdx[","]=3;
- $10=self._port();
- $ctx2.sendIdx["port"]=1;
- $9=$recv($10)._asString();
- $5=$recv($6).__comma($9);
- $ctx2.sendIdx[","]=2;
- return $recv($4)._log_($5);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }));
- $11=$recv($1)._listen_host_(self._port(),self._host());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
- },
- args: [],
- 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.",
- referencedClasses: [],
- messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "startOn:",
- protocol: 'starting',
- fn: function (aPort){
- var self=this;
- return $core.withContext(function($ctx1) {
- self._port_(aPort);
- self._start();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
- },
- args: ["aPort"],
- source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
- referencedClasses: [],
- messageSends: ["port:", "start"]
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "username:",
- protocol: 'accessing',
- fn: function (aUsername){
- var self=this;
- self["@username"]=aUsername;
- return self;
- },
- args: ["aUsername"],
- source: "username: aUsername\x0a\x09username := aUsername.",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "validateBasePath",
- protocol: 'private',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
- $1=self["@fs"];
- $2=self._basePath();
- $ctx1.sendIdx["basePath"]=1;
- $recv($1)._stat_then_($2,(function(err,stat){
- return $core.withContext(function($ctx2) {
- if(($receiver = err) == null || $receiver.isNil){
- $3=$recv(stat)._isDirectory();
- if(!$core.assert($3)){
- $4=console;
- $7=self._basePath();
- $ctx2.sendIdx["basePath"]=2;
- $6="Warning: --base-path parameter ".__comma($7);
- $ctx2.sendIdx[","]=2;
- $5=$recv($6).__comma(" is not a directory.");
- $ctx2.sendIdx[","]=1;
- return $recv($4)._warn_($5);
- $ctx2.sendIdx["warn:"]=1;
- };
- } else {
- $8=console;
- $9=$recv("Warning: path at --base-path parameter ".__comma(self._basePath())).__comma(" does not exist.");
- $ctx2.sendIdx[","]=3;
- return $recv($8)._warn_($9);
- };
- }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
- },
- args: [],
- 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.' ]].",
- referencedClasses: [],
- messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "withBasePath:",
- protocol: 'private',
- fn: function (aBaseRelativePath){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self["@path"])._join_with_(self._basePath(),aBaseRelativePath);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
- },
- args: ["aBaseRelativePath"],
- source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
- referencedClasses: [],
- messageSends: ["join:with:", "basePath"]
- }),
- $globals.FileServer);
- $core.addMethod(
- $core.method({
- selector: "writeData:toFileNamed:",
- protocol: 'private',
- fn: function (data,aFilename){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(console)._log_(aFilename);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
- },
- args: ["data", "aFilename"],
- source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
- referencedClasses: [],
- messageSends: ["log:"]
- }),
- $globals.FileServer);
- $globals.FileServer.klass.iVarNames = ['mimeTypes'];
- $core.addMethod(
- $core.method({
- selector: "commandLineSwitches",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var switches;
- return $core.withContext(function($ctx1) {
- var $1;
- switches=$recv(self._methodsInProtocol_("accessing"))._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._selector();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $ctx1.sendIdx["collect:"]=1;
- switches=$recv(switches)._select_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(each)._match_("^[^:]*:$");
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- }));
- switches=$recv(switches)._collect_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
- $ctx2.sendIdx["replace:with:"]=1;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
- }));
- $1=switches;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.klass)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
- }),
- $globals.FileServer.klass);
- $core.addMethod(
- $core.method({
- selector: "createServerWithArguments:",
- protocol: 'initialization',
- fn: function (options){
- var self=this;
- var server,popFront,front,optionName,optionValue,switches;
- function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11;
- var $early={};
- try {
- switches=self._commandLineSwitches();
- server=self._new();
- $recv(options)._ifEmpty_((function(){
- $1=server;
- throw $early=[$1];
- }));
- $2=$recv($recv(options)._size())._even();
- if(!$core.assert($2)){
- $recv(console)._log_("Using default parameters.");
- $ctx1.sendIdx["log:"]=1;
- $3=console;
- $4="Wrong commandline options or not enough arguments for: ".__comma(options);
- $ctx1.sendIdx[","]=1;
- $recv($3)._log_($4);
- $ctx1.sendIdx["log:"]=2;
- $5=console;
- $6="Use any of the following ones: ".__comma(switches);
- $ctx1.sendIdx[","]=2;
- $recv($5)._log_($6);
- $ctx1.sendIdx["log:"]=3;
- $7=server;
- return $7;
- };
- popFront=(function(args){
- return $core.withContext(function($ctx2) {
- front=$recv(args)._first();
- front;
- $recv(args)._remove_(front);
- return front;
- }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
- });
- $recv((function(){
- return $core.withContext(function($ctx2) {
- return $recv(options)._notEmpty();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
- }))._whileTrue_((function(){
- return $core.withContext(function($ctx2) {
- optionName=$recv(popFront)._value_(options);
- $ctx2.sendIdx["value:"]=1;
- optionName;
- optionValue=$recv(popFront)._value_(options);
- optionValue;
- $8=$recv(switches)._includes_(optionName);
- if($core.assert($8)){
- optionName=self._selectorForCommandLineSwitch_(optionName);
- optionName;
- return $recv(server)._perform_withArguments_(optionName,$recv($Array())._with_(optionValue));
- } else {
- $9=console;
- $10=$recv(optionName).__comma(" is not a valid commandline option");
- $ctx2.sendIdx[","]=3;
- $recv($9)._log_($10);
- $ctx2.sendIdx["log:"]=4;
- return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
- };
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
- }));
- $11=server;
- return $11;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.klass)});
- },
- args: ["options"],
- 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.",
- referencedClasses: ["Array"],
- messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
- }),
- $globals.FileServer.klass);
- $core.addMethod(
- $core.method({
- selector: "defaultBasePath",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return "./";
- },
- args: [],
- source: "defaultBasePath\x0a\x09^ './'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.FileServer.klass);
- $core.addMethod(
- $core.method({
- selector: "defaultHost",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return "127.0.0.1";
- },
- args: [],
- source: "defaultHost\x0a\x09^ '127.0.0.1'",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.FileServer.klass);
- $core.addMethod(
- $core.method({
- selector: "defaultMimeTypes",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $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"]);
- return $1;
- },
- args: [],
- 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}",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.FileServer.klass);
- $core.addMethod(
- $core.method({
- selector: "defaultPort",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return (4000);
- },
- args: [],
- source: "defaultPort\x0a\x09^ 4000",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.FileServer.klass);
- $core.addMethod(
- $core.method({
- selector: "main",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- var fileServer,args;
- function $FileServer(){return $globals.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
- return $core.withContext(function($ctx1) {
- var $1,$2;
- var $early={};
- try {
- args=$recv(process)._argv();
- $recv(args)._removeFrom_to_((1),(3));
- $recv(args)._detect_ifNone_((function(each){
- return $core.withContext(function($ctx2) {
- $1=$recv(each).__eq("--help");
- if($core.assert($1)){
- return $recv($FileServer())._printHelp();
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }),(function(){
- return $core.withContext(function($ctx2) {
- fileServer=$recv($FileServer())._createServerWithArguments_(args);
- fileServer;
- $2=$recv(fileServer)._start();
- throw $early=[$2];
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- }));
- return self;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.klass)});
- },
- args: [],
- 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]",
- referencedClasses: ["FileServer"],
- messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
- }),
- $globals.FileServer.klass);
- $core.addMethod(
- $core.method({
- selector: "mimeTypeFor:",
- protocol: 'accessing',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
- return "text/plain";
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.klass)});
- },
- args: ["aString"],
- source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
- referencedClasses: [],
- messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
- }),
- $globals.FileServer.klass);
- $core.addMethod(
- $core.method({
- selector: "mimeTypes",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1,$receiver;
- $2=self["@mimeTypes"];
- if(($receiver = $2) == null || $receiver.isNil){
- self["@mimeTypes"]=self._defaultMimeTypes();
- $1=self["@mimeTypes"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.klass)});
- },
- args: [],
- source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
- referencedClasses: [],
- messageSends: ["ifNil:", "defaultMimeTypes"]
- }),
- $globals.FileServer.klass);
- $core.addMethod(
- $core.method({
- selector: "printHelp",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(console)._log_("Available commandline options are:");
- $ctx1.sendIdx["log:"]=1;
- $recv(console)._log_("--help");
- $ctx1.sendIdx["log:"]=2;
- $recv(self._commandLineSwitches())._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(console)._log_($recv(each).__comma(" <parameter>"));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.klass)});
- },
- args: [],
- source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
- referencedClasses: [],
- messageSends: ["log:", "do:", "commandLineSwitches", ","]
- }),
- $globals.FileServer.klass);
- $core.addMethod(
- $core.method({
- selector: "selectorForCommandLineSwitch:",
- protocol: 'accessing',
- fn: function (aSwitch){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
- return $core.withContext(function($ctx2) {
- return $recv($recv(each)._second())._asUppercase();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- $ctx1.sendIdx["replace:with:"]=1;
- $1=$recv($2).__comma(":");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.klass)});
- },
- args: ["aSwitch"],
- 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 ]), ':'",
- referencedClasses: [],
- messageSends: [",", "replace:with:", "asUppercase", "second"]
- }),
- $globals.FileServer.klass);
- $core.addClass('Initer', $globals.BaseFileManipulator, ['childProcess', 'nmPath'], 'AmberCli');
- $core.addMethod(
- $core.method({
- selector: "bowerInstallThenDo:",
- protocol: 'action',
- fn: function (aBlock){
- var self=this;
- var child;
- return $core.withContext(function($ctx1) {
- var $1,$4,$3,$2;
- child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("bower","bower"),["install"]);
- $1=child;
- $recv($1)._on_do_("error",aBlock);
- $ctx1.sendIdx["on:do:"]=1;
- $2=$recv($1)._on_do_("close",(function(code){
- return $core.withContext(function($ctx2) {
- $4=$recv(code).__eq((0));
- if($core.assert($4)){
- $3=nil;
- } else {
- $3=code;
- };
- return $recv(aBlock)._value_($3);
- }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
- },
- args: ["aBlock"],
- 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 ]) ]",
- referencedClasses: [],
- messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
- }),
- $globals.Initer);
- $core.addMethod(
- $core.method({
- selector: "finishMessage",
- protocol: 'action',
- fn: function (){
- var self=this;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $core.withContext(function($ctx1) {
- $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($String())._lf()));
- $recv((function(){
- }))._valueWithTimeout_((600));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
- },
- args: [],
- 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",
- referencedClasses: ["String"],
- messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
- }),
- $globals.Initer);
- $core.addMethod(
- $core.method({
- selector: "gruntInitThenDo:",
- protocol: 'action',
- fn: function (aBlock){
- var self=this;
- var child,sanitizedTemplatePath;
- return $core.withContext(function($ctx1) {
- var $1,$4,$3,$2;
- sanitizedTemplatePath=$recv($recv($recv(self["@path"])._join_with_(self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
- $ctx1.sendIdx["replace:with:"]=1;
- child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
- $1=child;
- $recv($1)._on_do_("error",aBlock);
- $ctx1.sendIdx["on:do:"]=1;
- $2=$recv($1)._on_do_("close",(function(code){
- return $core.withContext(function($ctx2) {
- $4=$recv(code).__eq((0));
- if($core.assert($4)){
- $3=nil;
- } else {
- $3=code;
- };
- return $recv(aBlock)._value_($3);
- }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
- },
- args: ["aBlock"],
- 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 ]) ]",
- referencedClasses: [],
- messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
- }),
- $globals.Initer);
- $core.addMethod(
- $core.method({
- selector: "gruntThenDo:",
- protocol: 'action',
- fn: function (aBlock){
- var self=this;
- var child;
- return $core.withContext(function($ctx1) {
- var $1,$4,$3,$2;
- child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
- $1=child;
- $recv($1)._on_do_("error",aBlock);
- $ctx1.sendIdx["on:do:"]=1;
- $2=$recv($1)._on_do_("close",(function(code){
- return $core.withContext(function($ctx2) {
- $4=$recv(code).__eq((0));
- if($core.assert($4)){
- $3=nil;
- } else {
- $3=code;
- };
- return $recv(aBlock)._value_($3);
- }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
- },
- args: ["aBlock"],
- 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 ]) ]",
- referencedClasses: [],
- messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
- }),
- $globals.Initer);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.Initer.superclass.fn.prototype._initialize.apply($recv(self), []));
- $ctx1.supercall = false;
- self["@childProcess"]=$recv(require)._value_("child_process");
- self["@nmPath"]=$recv(self["@path"])._join_with_(self._rootDirname(),"node_modules");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
- },
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
- referencedClasses: [],
- messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
- }),
- $globals.Initer);
- $core.addMethod(
- $core.method({
- selector: "npmInstallThenDo:",
- protocol: 'action',
- fn: function (aBlock){
- var self=this;
- var child;
- return $core.withContext(function($ctx1) {
- var $1;
- child=$recv(self["@childProcess"])._exec_thenDo_("npm install",aBlock);
- $1=$recv(child)._stdout();
- $ctx1.sendIdx["stdout"]=1;
- $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
- },
- args: ["aBlock"],
- 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 }",
- referencedClasses: [],
- messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
- }),
- $globals.Initer);
- $core.addMethod(
- $core.method({
- selector: "npmScriptForModule:named:",
- protocol: 'npm',
- fn: function (aString,anotherString){
- var self=this;
- var modulePath,packageJson,binSection,scriptPath;
- function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
- function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return $core.withContext(function($ctx1) {
- var $1,$3,$4,$2,$5,$6;
- $1=self["@path"];
- $3=$recv($JSObjectProxy())._on_(require);
- $4=$recv(aString).__comma("/package.json");
- $ctx1.sendIdx[","]=1;
- $2=$recv($3)._resolve_($4);
- modulePath=$recv($1)._dirname_($2);
- packageJson=$recv($Smalltalk())._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
- binSection=$recv(packageJson)._at_("bin");
- $ctx1.sendIdx["at:"]=1;
- $5=$recv(binSection)._isString();
- if($core.assert($5)){
- scriptPath=binSection;
- } else {
- scriptPath=$recv(binSection)._at_(anotherString);
- };
- $6=$recv(self["@path"])._join_with_(modulePath,scriptPath);
- return $6;
- }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
- },
- args: ["aString", "anotherString"],
- 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",
- referencedClasses: ["JSObjectProxy", "Smalltalk"],
- messageSends: ["dirname:", "resolve:", "on:", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
- }),
- $globals.Initer);
- $core.addMethod(
- $core.method({
- selector: "start",
- protocol: 'action',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5,$6,$7,$8,$receiver;
- self._gruntInitThenDo_((function(error){
- return $core.withContext(function($ctx2) {
- if(($receiver = error) == null || $receiver.isNil){
- return self._bowerInstallThenDo_((function(error2){
- return $core.withContext(function($ctx3) {
- if(($receiver = error2) == null || $receiver.isNil){
- return self._npmInstallThenDo_((function(error3){
- return $core.withContext(function($ctx4) {
- if(($receiver = error3) == null || $receiver.isNil){
- return self._gruntThenDo_((function(error4){
- return $core.withContext(function($ctx5) {
- if(($receiver = error4) == null || $receiver.isNil){
- self._finishMessage();
- return $recv(process)._exit();
- } else {
- $7=console;
- $recv($7)._log_("grunt exec error:");
- $ctx5.sendIdx["log:"]=7;
- $8=$recv($7)._log_(error4);
- $8;
- return $recv(process)._exit_((104));
- };
- }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
- }));
- } else {
- $5=console;
- $recv($5)._log_("npm install exec error:");
- $ctx4.sendIdx["log:"]=5;
- $6=$recv($5)._log_(error3);
- $ctx4.sendIdx["log:"]=6;
- $6;
- return $recv(process)._exit_((103));
- $ctx4.sendIdx["exit:"]=3;
- };
- }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
- }));
- } else {
- $3=console;
- $recv($3)._log_("bower install exec error:");
- $ctx3.sendIdx["log:"]=3;
- $4=$recv($3)._log_(error2);
- $ctx3.sendIdx["log:"]=4;
- $4;
- return $recv(process)._exit_((102));
- $ctx3.sendIdx["exit:"]=2;
- };
- }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
- }));
- } else {
- $1=console;
- $recv($1)._log_("grunt-init exec error:");
- $ctx2.sendIdx["log:"]=1;
- $2=$recv($1)._log_(error);
- $ctx2.sendIdx["log:"]=2;
- $2;
- return $recv(process)._exit_((101));
- $ctx2.sendIdx["exit:"]=1;
- };
- }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
- },
- args: [],
- 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 ]]]]]]]]",
- referencedClasses: [],
- messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
- }),
- $globals.Initer);
- $core.addClass('Repl', $globals.Object, ['readline', 'interface', 'util', 'session', 'resultCount', 'commands'], 'AmberCli');
- $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.";
- $core.addMethod(
- $core.method({
- selector: "addVariableNamed:to:",
- protocol: 'private',
- fn: function (aString,anObject){
- var self=this;
- var newClass,newObject;
- return $core.withContext(function($ctx1) {
- var $1;
- newClass=self._subclass_withVariable_($recv(anObject)._class(),aString);
- self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
- newObject=$recv(newClass)._new();
- self._setPreviousVariablesFor_from_(newObject,anObject);
- $1=newObject;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
- },
- args: ["aString", "anObject"],
- 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",
- referencedClasses: [],
- messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "assignNewVariable:do:",
- protocol: 'private',
- fn: function (buffer,aBlock){
- var self=this;
- function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
- function $ConsoleErrorHandler(){return $globals.ConsoleErrorHandler||(typeof ConsoleErrorHandler=="undefined"?nil:ConsoleErrorHandler)}
- return $core.withContext(function($ctx1) {
- var $3,$4,$2,$1,$receiver;
- $1=self._parseAssignment_do_(buffer,(function(name,expr){
- var varName,value;
- return $core.withContext(function($ctx2) {
- if(($receiver = name) == null || $receiver.isNil){
- varName=self._nextResultName();
- } else {
- varName=name;
- };
- varName;
- self["@session"]=self._addVariableNamed_to_(varName,self["@session"]);
- self["@session"];
- $recv((function(){
- return $core.withContext(function($ctx3) {
- $3=$recv(varName).__comma(" := ");
- if(($receiver = expr) == null || $receiver.isNil){
- $4=buffer;
- } else {
- $4=expr;
- };
- $2=$recv($3).__comma($4);
- $ctx3.sendIdx[","]=1;
- value=self._eval_on_($2,self["@session"]);
- return value;
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
- }))._on_do_($Error(),(function(e){
- return $core.withContext(function($ctx3) {
- $recv($recv($ConsoleErrorHandler())._new())._logError_(e);
- value=nil;
- return value;
- }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
- }));
- return $recv(aBlock)._value_value_(varName,value);
- }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
- }));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
- },
- args: ["buffer", "aBlock"],
- 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]",
- referencedClasses: ["Error", "ConsoleErrorHandler"],
- messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "clearScreen",
- protocol: 'actions',
- fn: function (){
- var self=this;
- var esc,cls;
- function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
- return $core.withContext(function($ctx1) {
- var $1;
- esc=$recv($String())._fromCharCode_((27));
- $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
- $ctx1.sendIdx[","]=2;
- cls=$recv($1).__comma("[0;0f");
- $ctx1.sendIdx[","]=1;
- $recv($recv(process)._stdout())._write_(cls);
- $recv(self["@interface"])._prompt();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
- },
- args: [],
- 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",
- referencedClasses: ["String"],
- messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "close",
- protocol: 'actions',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv($recv(process)._stdin())._destroy();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
- },
- args: [],
- source: "close\x0a\x09process stdin destroy",
- referencedClasses: [],
- messageSends: ["destroy", "stdin"]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "commands",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- var $1;
- $1=self["@commands"];
- return $1;
- },
- args: [],
- source: "commands\x0a\x09^ commands",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "createInterface",
- protocol: 'actions',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- self["@interface"]=$recv(self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
- $recv(self["@interface"])._on_do_("line",(function(buffer){
- return $core.withContext(function($ctx2) {
- return self._processLine_(buffer);
- }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
- }));
- $ctx1.sendIdx["on:do:"]=1;
- $recv(self["@interface"])._on_do_("close",(function(){
- return $core.withContext(function($ctx2) {
- return self._close();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- self._printWelcome();
- self._setupHotkeys();
- $1=self._setPrompt();
- $recv(self["@interface"])._prompt();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
- },
- args: [],
- 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",
- referencedClasses: [],
- messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "encapsulateVariable:withValue:in:",
- protocol: 'private',
- fn: function (aString,anObject,aClass){
- var self=this;
- var compiler;
- function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
- return $core.withContext(function($ctx1) {
- var $1,$4,$3,$2,$5,$6;
- compiler=$recv($Compiler())._new();
- $1=compiler;
- $4=$recv(aString).__comma(": anObject ^ ");
- $ctx1.sendIdx[","]=3;
- $3=$recv($4).__comma(aString);
- $ctx1.sendIdx[","]=2;
- $2=$recv($3).__comma(" := anObject");
- $ctx1.sendIdx[","]=1;
- $recv($1)._install_forClass_protocol_($2,aClass,"session");
- $ctx1.sendIdx["install:forClass:protocol:"]=1;
- $5=compiler;
- $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
- $ctx1.sendIdx[","]=4;
- $recv($5)._install_forClass_protocol_($6,aClass,"session");
- return self;
- }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
- },
- args: ["aString", "anObject", "aClass"],
- 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'.",
- referencedClasses: ["Compiler"],
- messageSends: ["new", "install:forClass:protocol:", ","]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "eval:",
- protocol: 'actions',
- fn: function (buffer){
- var self=this;
- function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=self._eval_on_(buffer,$recv($DoIt())._new());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
- },
- args: ["buffer"],
- source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
- referencedClasses: ["DoIt"],
- messageSends: ["eval:on:", "new"]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "eval:on:",
- protocol: 'actions',
- fn: function (buffer,anObject){
- var self=this;
- var result;
- function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
- return $core.withContext(function($ctx1) {
- var $1,$2,$3;
- $1=$recv(buffer)._isEmpty();
- if(!$core.assert($1)){
- $recv((function(){
- return $core.withContext(function($ctx2) {
- result=$recv($recv($Compiler())._new())._evaluateExpression_on_(buffer,anObject);
- return result;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }))._tryCatch_((function(e){
- return $core.withContext(function($ctx2) {
- $2=$recv(e)._isSmalltalkError();
- if($core.assert($2)){
- return $recv(e)._resignal();
- } else {
- return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
- };
- }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,3)});
- }));
- };
- $3=result;
- return $3;
- }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
- },
- args: ["buffer", "anObject"],
- 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",
- referencedClasses: ["Compiler"],
- messageSends: ["ifFalse:", "isEmpty", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "executeCommand:",
- protocol: 'private',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- var $early={};
- try {
- $recv(self._commands())._keysAndValuesDo_((function(names,cmd){
- return $core.withContext(function($ctx2) {
- $1=$recv(names)._includes_(aString);
- if($core.assert($1)){
- $recv(cmd)._value();
- throw $early=[true];
- };
- }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
- }));
- return false;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
- },
- args: ["aString"],
- 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",
- referencedClasses: [],
- messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
- return $core.withContext(function($ctx1) {
- (
- $ctx1.supercall = true,
- $globals.Repl.superclass.fn.prototype._initialize.apply($recv(self), []));
- $ctx1.supercall = false;
- self["@session"]=$recv($DoIt())._new();
- self["@readline"]=$recv(require)._value_("readline");
- $ctx1.sendIdx["value:"]=1;
- self["@util"]=$recv(require)._value_("util");
- self._setupCommands();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
- },
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
- referencedClasses: ["DoIt"],
- messageSends: ["initialize", "new", "value:", "setupCommands"]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "instanceVariableNamesFor:",
- protocol: 'private',
- fn: function (aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $2,$3,$1,$receiver;
- $2=$recv(aClass)._superclass();
- $ctx1.sendIdx["superclass"]=1;
- if(($receiver = $2) == null || $receiver.isNil){
- $1=$recv(aClass)._instanceVariableNames();
- } else {
- $3=$recv(aClass)._instanceVariableNames();
- $ctx1.sendIdx["instanceVariableNames"]=1;
- $1=$recv($3)._copyWithAll_(self._instanceVariableNamesFor_($recv(aClass)._superclass()));
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
- },
- args: ["aClass"],
- 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]",
- referencedClasses: [],
- messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "isIdentifier:",
- protocol: 'private',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
- },
- args: ["aString"],
- source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
- referencedClasses: [],
- messageSends: ["match:", "asRegexp"]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "isVariableDefined:",
- protocol: 'private',
- fn: function (aString){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv(self._instanceVariableNamesFor_($recv(self["@session"])._class()))._includes_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
- },
- args: ["aString"],
- source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
- referencedClasses: [],
- messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "nextResultName",
- protocol: 'private',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1,$2,$receiver;
- $1=self["@resultCount"];
- if(($receiver = $1) == null || $receiver.isNil){
- self["@resultCount"]=(1);
- } else {
- self["@resultCount"]=$recv(self["@resultCount"]).__plus((1));
- };
- $2="res".__comma($recv(self["@resultCount"])._asString());
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
- },
- args: [],
- source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
- referencedClasses: [],
- messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "onKeyPress:",
- protocol: 'private',
- fn: function (key){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv(key)._ctrl())._and_((function(){
- return $core.withContext(function($ctx2) {
- return $recv($recv(key)._name()).__eq("l");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- if($core.assert($1)){
- self._clearScreen();
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
- },
- args: ["key"],
- source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
- referencedClasses: [],
- messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "parseAssignment:do:",
- protocol: 'private',
- fn: function (aString,aBlock){
- var self=this;
- var assignment;
- return $core.withContext(function($ctx1) {
- var $3,$2,$1;
- assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
- return $core.withContext(function($ctx2) {
- return $recv(s)._trimBoth();
- }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
- }));
- $2=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
- return $core.withContext(function($ctx2) {
- $3=$recv(assignment)._first();
- $ctx2.sendIdx["first"]=1;
- return self._isIdentifier_($3);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }));
- if($core.assert($2)){
- $1=$recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
- $ctx1.sendIdx["value:value:"]=1;
- } else {
- $1=$recv(aBlock)._value_value_(nil,nil);
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
- },
- args: ["aString", "aBlock"],
- 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 ]",
- referencedClasses: [],
- messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "presentResultNamed:withValue:",
- protocol: 'private',
- fn: function (varName,value){
- var self=this;
- function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
- return $core.withContext(function($ctx1) {
- var $3,$2,$1,$4;
- $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
- $ctx1.sendIdx[","]=3;
- $2=$recv($3).__comma(" = ");
- $ctx1.sendIdx[","]=2;
- $1=$recv($2).__comma($recv(value)._asString());
- $ctx1.sendIdx[","]=1;
- $recv($Transcript())._show_($1);
- $4=$recv($Transcript())._cr();
- $recv(self["@interface"])._prompt();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
- },
- args: ["varName", "value"],
- source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
- referencedClasses: ["Transcript"],
- messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "printWelcome",
- protocol: 'actions',
- fn: function (){
- var self=this;
- function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
- return $core.withContext(function($ctx1) {
- var $1;
- $recv($Transcript())._show_("Type :q to exit.");
- $1=$recv($Transcript())._cr();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
- },
- args: [],
- source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
- referencedClasses: ["Transcript"],
- messageSends: ["show:", "cr"]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "processLine:",
- protocol: 'private',
- fn: function (buffer){
- var self=this;
- var show;
- return $core.withContext(function($ctx1) {
- var $1,$2;
- show=(function(varName,value){
- return $core.withContext(function($ctx2) {
- return self._presentResultNamed_withValue_(varName,value);
- }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
- });
- $1=self._executeCommand_(buffer);
- if(!$core.assert($1)){
- $2=self._isVariableDefined_(buffer);
- if($core.assert($2)){
- $recv(show)._value_value_(buffer,$recv(self["@session"])._perform_(buffer));
- } else {
- self._assignNewVariable_do_(buffer,show);
- };
- };
- return self;
- }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
- },
- args: ["buffer"],
- 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]]",
- referencedClasses: [],
- messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "prompt",
- protocol: 'accessing',
- fn: function (){
- var self=this;
- return "amber >> ";
- },
- args: [],
- source: "prompt\x0a\x09^ 'amber >> '",
- referencedClasses: [],
- messageSends: []
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "setPreviousVariablesFor:from:",
- protocol: 'private',
- fn: function (newObject,oldObject){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
- return $core.withContext(function($ctx2) {
- return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
- },
- args: ["newObject", "oldObject"],
- source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
- referencedClasses: [],
- messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "setPrompt",
- protocol: 'actions',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self["@interface"])._setPrompt_(self._prompt());
- return self;
- }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
- },
- args: [],
- source: "setPrompt\x0a\x09interface setPrompt: self prompt",
- referencedClasses: [],
- messageSends: ["setPrompt:", "prompt"]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "setupCommands",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return $core.withContext(function($ctx1) {
- var $2,$1;
- $2=$recv([":q"]).__minus_gt((function(){
- return $core.withContext(function($ctx2) {
- return $recv(process)._exit();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- }));
- $ctx1.sendIdx["->"]=1;
- $1=[$2,$recv([""]).__minus_gt((function(){
- return $core.withContext(function($ctx2) {
- return $recv(self["@interface"])._prompt();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- }))];
- self["@commands"]=$recv($Dictionary())._from_($1);
- return self;
- }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
- },
- args: [],
- source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
- referencedClasses: ["Dictionary"],
- messageSends: ["from:", "->", "exit", "prompt"]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "setupHotkeys",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $receiver;
- $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
- return $core.withContext(function($ctx2) {
- if(($receiver = key) == null || $receiver.isNil){
- return key;
- } else {
- return self._onKeyPress_(key);
- };
- }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
- }));
- return self;
- }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
- },
- args: [],
- source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
- referencedClasses: [],
- messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "subclass:withVariable:",
- protocol: 'private',
- fn: function (aClass,varName){
- var self=this;
- function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
- return $core.withContext(function($ctx1) {
- var $1;
- $1=$recv($recv($ClassBuilder())._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv(self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
- },
- args: ["aClass", "varName"],
- 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'",
- referencedClasses: ["ClassBuilder"],
- messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "subclassNameFor:",
- protocol: 'private',
- fn: function (aClass){
- var self=this;
- return $core.withContext(function($ctx1) {
- var $3,$2,$7,$6,$5,$4,$8,$1,$receiver;
- $3=$recv(aClass)._name();
- $ctx1.sendIdx["name"]=1;
- $2=$recv($3)._matchesOf_("\x5cd+$");
- $ctx1.sendIdx["matchesOf:"]=1;
- if(($receiver = $2) == null || $receiver.isNil){
- $1=$recv($recv(aClass)._name()).__comma("2");
- } else {
- var counter;
- $7=$recv(aClass)._name();
- $ctx1.sendIdx["name"]=2;
- $6=$recv($7)._matchesOf_("\x5cd+$");
- $5=$recv($6)._first();
- $4=$recv($5)._asNumber();
- counter=$recv($4).__plus((1));
- counter;
- $8=$recv(aClass)._name();
- $ctx1.sendIdx["name"]=3;
- $1=$recv($8)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
- },
- args: ["aClass"],
- 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'].",
- referencedClasses: [],
- messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
- }),
- $globals.Repl);
- $core.addMethod(
- $core.method({
- selector: "main",
- protocol: 'initialization',
- fn: function (){
- var self=this;
- return $core.withContext(function($ctx1) {
- $recv(self._new())._createInterface();
- return self;
- }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.klass)});
- },
- args: [],
- source: "main\x0a\x09self new createInterface",
- referencedClasses: [],
- messageSends: ["createInterface", "new"]
- }),
- $globals.Repl.klass);
- });
- (function () {
- define('app',["amber/devel", "amber_cli/AmberCli"], function (amber) {
- amber.initialize();
- amber.globals.AmberCli._main();
- });
- }());
- require(["app"]);
- });
- define.require('__wrap__');
- }((function amdefine(module, requireFn) {
- 'use strict';
- var defineCache = {},
- loaderCache = {},
- alreadyCalled = false,
- path = require('path'),
- makeRequire, stringRequire;
- /**
- * Trims the . and .. from an array of path segments.
- * It will keep a leading path segment if a .. will become
- * the first path segment, to help with module name lookups,
- * which act like paths, but can be remapped. But the end result,
- * all paths that use this function should look normalized.
- * NOTE: this method MODIFIES the input array.
- * @param {Array} ary the array of path segments.
- */
- function trimDots(ary) {
- var i, part;
- for (i = 0; ary[i]; i+= 1) {
- part = ary[i];
- if (part === '.') {
- ary.splice(i, 1);
- i -= 1;
- } else if (part === '..') {
- if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
- //End of the line. Keep at least one non-dot
- //path segment at the front so it can be mapped
- //correctly to disk. Otherwise, there is likely
- //no path mapping for a path starting with '..'.
- //This can still fail, but catches the most reasonable
- //uses of ..
- break;
- } else if (i > 0) {
- ary.splice(i - 1, 2);
- i -= 2;
- }
- }
- }
- }
- function normalize(name, baseName) {
- var baseParts;
- //Adjust any relative paths.
- if (name && name.charAt(0) === '.') {
- //If have a base name, try to normalize against it,
- //otherwise, assume it is a top-level require that will
- //be relative to baseUrl in the end.
- if (baseName) {
- baseParts = baseName.split('/');
- baseParts = baseParts.slice(0, baseParts.length - 1);
- baseParts = baseParts.concat(name.split('/'));
- trimDots(baseParts);
- name = baseParts.join('/');
- }
- }
- return name;
- }
- /**
- * Create the normalize() function passed to a loader plugin's
- * normalize method.
- */
- function makeNormalize(relName) {
- return function (name) {
- return normalize(name, relName);
- };
- }
- function makeLoad(id) {
- function load(value) {
- loaderCache[id] = value;
- }
- load.fromText = function (id, text) {
- //This one is difficult because the text can/probably uses
- //define, and any relative paths and requires should be relative
- //to that id was it would be found on disk. But this would require
- //bootstrapping a module/require fairly deeply from node core.
- //Not sure how best to go about that yet.
- throw new Error('amdefine does not implement load.fromText');
- };
- return load;
- }
- makeRequire = function (systemRequire, exports, module, relId) {
- function amdRequire(deps, callback) {
- if (typeof deps === 'string') {
- //Synchronous, single module require('')
- return stringRequire(systemRequire, exports, module, deps, relId);
- } else {
- //Array of dependencies with a callback.
- //Convert the dependencies to modules.
- deps = deps.map(function (depName) {
- return stringRequire(systemRequire, exports, module, depName, relId);
- });
- //Wait for next tick to call back the require call.
- if (callback) {
- process.nextTick(function () {
- callback.apply(null, deps);
- });
- }
- }
- }
- amdRequire.toUrl = function (filePath) {
- if (filePath.indexOf('.') === 0) {
- return normalize(filePath, path.dirname(module.filename));
- } else {
- return filePath;
- }
- };
- return amdRequire;
- };
- //Favor explicit value, passed in if the module wants to support Node 0.4.
- requireFn = requireFn || function req() {
- return module.require.apply(module, arguments);
- };
- function runFactory(id, deps, factory) {
- var r, e, m, result;
- if (id) {
- e = loaderCache[id] = {};
- m = {
- id: id,
- uri: __filename,
- exports: e
- };
- r = makeRequire(requireFn, e, m, id);
- } else {
- //Only support one define call per file
- if (alreadyCalled) {
- throw new Error('amdefine with no module ID cannot be called more than once per file.');
- }
- alreadyCalled = true;
- //Use the real variables from node
- //Use module.exports for exports, since
- //the exports in here is amdefine exports.
- e = module.exports;
- m = module;
- r = makeRequire(requireFn, e, m, module.id);
- }
- //If there are dependencies, they are strings, so need
- //to convert them to dependency values.
- if (deps) {
- deps = deps.map(function (depName) {
- return r(depName);
- });
- }
- //Call the factory with the right dependencies.
- if (typeof factory === 'function') {
- result = factory.apply(m.exports, deps);
- } else {
- result = factory;
- }
- if (result !== undefined) {
- m.exports = result;
- if (id) {
- loaderCache[id] = m.exports;
- }
- }
- }
- stringRequire = function (systemRequire, exports, module, id, relId) {
- //Split the ID by a ! so that
- var index = id.indexOf('!'),
- originalId = id,
- prefix, plugin;
- if (index === -1) {
- id = normalize(id, relId);
- //Straight module lookup. If it is one of the special dependencies,
- //deal with it, otherwise, delegate to node.
- if (id === 'require') {
- return makeRequire(systemRequire, exports, module, relId);
- } else if (id === 'exports') {
- return exports;
- } else if (id === 'module') {
- return module;
- } else if (loaderCache.hasOwnProperty(id)) {
- return loaderCache[id];
- } else if (defineCache[id]) {
- runFactory.apply(null, defineCache[id]);
- return loaderCache[id];
- } else {
- if(systemRequire) {
- return systemRequire(originalId);
- } else {
- throw new Error('No module with ID: ' + id);
- }
- }
- } else {
- //There is a plugin in play.
- prefix = id.substring(0, index);
- id = id.substring(index + 1, id.length);
- plugin = stringRequire(systemRequire, exports, module, prefix, relId);
- if (plugin.normalize) {
- id = plugin.normalize(id, makeNormalize(relId));
- } else {
- //Normalize the ID normally.
- id = normalize(id, relId);
- }
- if (loaderCache[id]) {
- return loaderCache[id];
- } else {
- plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
- return loaderCache[id];
- }
- }
- };
- //Create a define function specific to the module asking for amdefine.
- function define(id, deps, factory) {
- if (Array.isArray(id)) {
- factory = deps;
- deps = id;
- id = undefined;
- } else if (typeof id !== 'string') {
- factory = id;
- id = deps = undefined;
- }
- if (deps && !Array.isArray(deps)) {
- factory = deps;
- deps = undefined;
- }
- if (!deps) {
- deps = ['require', 'exports', 'module'];
- }
- //Set up properties for this module. If an ID, then use
- //internal cache. If no ID, then use the external variables
- //for this node module.
- if (id) {
- //Put the module in deep freeze until there is a
- //require call for it.
- defineCache[id] = [id, deps, factory];
- } else {
- runFactory(id, deps, factory);
- }
- }
- //define.require, which has access to all the values in the
- //cache. Useful for AMD modules that all have IDs in the file,
- //but need to finally export a value to node based on one of those
- //IDs.
- define.require = function (id) {
- if (loaderCache[id]) {
- return loaderCache[id];
- }
- if (defineCache[id]) {
- runFactory.apply(null, defineCache[id]);
- return loaderCache[id];
- }
- };
- define.amd = {};
- return define;
- }(module)), require));
|