12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076 |
- /* ====================================================================
- |
- | Amber Smalltalk
- | http://amber-lang.net
- |
- ======================================================================
- ======================================================================
- |
- | Copyright (c) 2010-2011
- | Nicolas Petton <petton.nicolas@gmail.com>
- |
- | 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.
- |
- ==================================================================== */
- /* Make sure that console is defined */
- if(typeof console === "undefined") {
- this.console = {
- log: function() {},
- warn: function() {},
- info: function() {},
- debug: function() {},
- error: function() {}
- };
- }
- /* 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); }
- };
- /* Smalltalk constructors definition */
- function SmalltalkObject() {}
- function SmalltalkBehavior() {}
- function SmalltalkClass() {}
- function SmalltalkMetaclass() {
- this.meta = true;
- }
- function SmalltalkPackage() {}
- function SmalltalkMethod() {}
- function SmalltalkNil() {}
- function SmalltalkOrganizer() {
- }
- function SmalltalkPackageOrganizer() {
- this.elements = [];
- }
- function SmalltalkClassOrganizer() {
- this.elements = [];
- }
- function inherits(child, parent) {
- child.prototype = Object.create(parent.prototype, {
- constructor: { value: child,
- enumerable: false, configurable: true, writable: true }
- });
- }
- inherits(SmalltalkBehavior, SmalltalkObject);
- inherits(SmalltalkClass, SmalltalkBehavior);
- inherits(SmalltalkMetaclass, SmalltalkBehavior);
- inherits(SmalltalkNil, SmalltalkObject);
- inherits(SmalltalkMethod, SmalltalkObject);
- inherits(SmalltalkPackage, SmalltalkObject);
- inherits(SmalltalkOrganizer, SmalltalkObject);
- inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer);
- inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
- function Smalltalk() {
- var st = this;
- /* 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 */
- st.thisContext = undefined;
- /* 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',
- // 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'];
- var initialized = false;
- /* Smalltalk classes */
- var classes = [];
- var wrappedClasses = [];
- /* Method not implemented handlers */
- var dnu = {
- methods: [],
- selectors: [],
- get: function (string) {
- var index = this.selectors.indexOf(string);
- if(index !== -1) {
- return this.methods[index];
- }
- this.selectors.push(string);
- var selector = st.selector(string);
- var method = {jsSelector: selector, fn: this.createHandler(selector)};
- this.methods.push(method);
- return method;
- },
- /* Dnu handler method */
- createHandler: function (selector) {
- return function () {
- var args = Array.prototype.slice.call(arguments);
- return messageNotUnderstood(this, selector, args);
- };
- }
- };
- /* Answer all method selectors based on dnu handlers */
- st.allSelectors = function() {
- return dnu.selectors;
- };
- /* Unique ID number generator */
- var oid = 0;
- st.nextId = function() {
- oid += 1;
- return oid;
- };
- /* We hold all Packages in a separate Object */
- st.packages = {};
- /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
- function pkg(spec) {
- var that = new SmalltalkPackage();
- that.pkgName = spec.pkgName;
- that.organization = new SmalltalkPackageOrganizer();
- that.properties = spec.properties || {};
- return that;
- }
- /* 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 meta = metaclass(spec);
- var that = meta.instanceClass;
- that.fn = spec.fn || function() {};
- setupClass(that, spec);
- that.className = spec.className;
- that.wrapped = spec.wrapped || false;
- meta.className = spec.className + ' class';
- if(spec.superclass) {
- that.superclass = spec.superclass;
- meta.superclass = spec.superclass.klass;
- }
- return that;
- }
- function metaclass(spec) {
- spec = spec || {};
- var that = new SmalltalkMetaclass();
- inherits(
- that.fn = function() {},
- spec.superclass ? spec.superclass.klass.fn : SmalltalkClass
- );
- that.instanceClass = new that.fn();
- setupClass(that);
- return that;
- }
- function setupClass(klass, spec) {
- spec = spec || {};
- klass.iVarNames = spec.iVarNames || [];
- klass.pkg = spec.pkg;
- Object.defineProperty(klass, "toString", {
- value: function() { return 'Smalltalk ' + this.className; },
- enumerable:false, configurable: true, writable: false
- });
- klass.organization = new SmalltalkClassOrganizer();
- klass.organization.theClass = klass;
- Object.defineProperty(klass, "methods", {
- value: {},
- enumerable: false, configurable: true, writable: true
- });
- wireKlass(klass);
- }
- /* 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.category = spec.category;
- that.source = spec.source;
- that.messageSends = spec.messageSends || [];
- that.referencedClasses = spec.referencedClasses || [];
- that.fn = spec.fn;
- return that;
- };
- /* Initialize a class in its class hierarchy. Handle both classes and
- metaclasses. */
- st.init = function(klass) {
- st.initClass(klass);
- if(klass.klass && !klass.meta) {
- st.initClass(klass.klass);
- }
- };
- st.initClass = function(klass) {
- if(klass.wrapped) {
- copySuperclass(klass);
- }
- else {
- installSuperclass(klass);
- }
- if(klass === st.Object || klass.wrapped) {
- installDnuHandlers(klass);
- }
- };
- function wireKlass(klass) {
- Object.defineProperty(klass.fn.prototype, "klass", {
- value: klass,
- enumerable: false, configurable: true, writable: true
- });
- }
- function installSuperclass(klass) {
- // only if the klass has not been initialized yet.
- if(klass.fn.prototype._yourself) { return; }
- if(klass.superclass && klass.superclass !== nil) {
- inherits(klass.fn, klass.superclass.fn);
- wireKlass(klass);
- reinstallMethods(klass);
- }
- }
- function copySuperclass(klass, superclass) {
- for (superclass = superclass || klass.superclass;
- superclass && superclass !== nil;
- superclass = superclass.superclass) {
- for (var keys = Object.keys(superclass.methods), i = 0; i < keys.length; i++) {
- installMethodIfAbsent(superclass.methods[keys[i]], klass);
- }
- }
- }
- function installMethod(method, klass) {
- Object.defineProperty(klass.fn.prototype, method.jsSelector, {
- value: method.fn,
- enumerable: false, configurable: true, writable: true
- });
- }
- function installMethodIfAbsent(method, klass) {
- if(!klass.fn.prototype[method.jsSelector]) {
- installMethod(method, klass);
- }
- }
- function reinstallMethods(klass) {
- for(var keys = Object.keys(klass.methods), i=0; i<keys.length; i++) {
- installMethod(klass.methods[keys[i]], klass);
- }
- }
- function installDnuHandlers(klass) {
- var m = dnu.methods;
- for(var i=0; i<m.length; i++) {
- installMethodIfAbsent(m[i], klass);
- }
- }
- function installNewDnuHandler(newHandler) {
- installMethodIfAbsent(newHandler, st.Object);
- for(var i = 0; i < wrappedClasses.length; i++) {
- installMethodIfAbsent(newHandler, wrappedClasses[i]);
- }
- }
- /* Answer all registered Packages as Array */
- // TODO: Remove this hack
- st.packages.all = function() {
- var packages = [];
- for(var i in st.packages) {
- if(!st.packages.hasOwnProperty(i) || typeof(st.packages[i]) === "function") continue;
- packages.push(st.packages[i]);
- }
- return packages
- };
- /* 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;
- };
- /* Answer the direct subclasses of klass. */
- st.subclasses = function(klass) {
- var subclasses = [];
- var classes = st.classes();
- for(var i=0; i < classes.length; i++) {
- var c = classes[i];
- if(c.fn) {
- //Classes
- if(c.superclass === klass) {
- subclasses.push(c);
- }
- c = c.klass;
- //Metaclasses
- if(c && c.superclass === klass) {
- subclasses.push(c);
- }
- }
- }
- return subclasses;
- };
- /* 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) {
- if(wrapped !== false) {
- wrapped = true;
- }
- var pkg = st.addPackage(pkgName);
- st[className] = klass({
- className: className,
- superclass: superclass,
- pkg: pkg,
- fn: fn,
- wrapped: wrapped
- });
- classes.addElement(st[className]);
- if(wrapped) {wrappedClasses.addElement(st[className])}
- pkg.organization.elements.addElement(st[className]);
- };
- /* Create an alias for an existing class */
- st.alias = function(klass, alias) {
- st[alias] = klass;
- };
- /* 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];
- };
- /* 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) {
- var pkg = st.addPackage(pkgName);
- if (superclass == nil) { superclass = null; }
- if(st[className] && st[className].superclass == superclass) {
- st[className].superclass = superclass;
- st[className].iVarNames = iVarNames;
- st[className].pkg = pkg || st[className].pkg;
- } else {
- if(st[className]) {
- st.removeClass(st[className]);
- }
- st[className] = klass({
- className: className,
- superclass: superclass,
- pkg: pkg,
- iVarNames: iVarNames
- });
- }
- classes.addElement(st[className]);
- pkg.organization.elements.addElement(st[className]);
- };
- st.removeClass = function(klass) {
- klass.pkg.organization.elements.removeElement(klass);
- classes.removeElement(klass);
- delete st[klass.className];
- };
- /*
- * Add/remove a method to/from a class
- */
- /* This is a temporary version of addMethod() for backward compatibility */
- st.addMethod = function(method_exJsSelector, klass_exMethod, exKlass) {
- if (typeof method_exJsSelector === "string") { //legacy
- if (method_exJsSelector !== st.selector(klass_exMethod.selector)) {
- console.log("DISCREPANCY: arg, in_method");
- console.log(method_exJsSelector);
- console.log(st.selector(klass_exMethod.selector));
- klass_exMethod.jsSelector = method_exJsSelector;
- }
- return new_addMethod(klass_exMethod, exKlass);
- }
- return new_addMethod(method_exJsSelector, klass_exMethod);
- }
- // later, st.addMethod can be this:
- function new_addMethod(method, klass) {
- if (!(method.jsSelector)) {
- method.jsSelector = st.selector(method.selector);
- }
- 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
- klass.organization.elements.addElement(method.category);
- for(var i=0; i<method.messageSends.length; i++) {
- var dnuHandler = dnu.get(method.messageSends[i]);
- if(initialized) {
- installNewDnuHandler(dnuHandler);
- }
- }
- };
- st.removeMethod = function(method) {
- var protocol = method.category;
- var klass = method.methodClass;
- delete klass.fn.prototype[st.selector(method.selector)];
- delete klass.methods[method.selector];
- var selectors = Object.keys(klass.methods);
- // Do *not* delete protocols from here.
- // This is handled by #removeCompiledMethod
- };
- /* Handles unhandled errors during message sends */
- // simply send the message and handle #dnu:
- st.send = function(receiver, selector, args, klass) {
- var method;
- if(receiver == null) {
- receiver = nil;
- }
- method = klass ? klass.fn.prototype[selector] : receiver.klass && receiver[selector];
- if(method) {
- return method.apply(receiver, args);
- } else {
- return messageNotUnderstood(receiver, selector, args);
- }
- }
- st.withContext = function(worker, setup) {
- if(st.thisContext) {
- st.thisContext.pc++;
- return inContext(worker, setup);
- } else {
- try {return inContext(worker, setup)}
- catch(error) {
- if(error.smalltalkError) {
- handleError(error);
- } else {
- var errorWrapper = st.JavaScriptException._on_(error);
- try {errorWrapper._signal()} catch(ex) {}
- errorWrapper._context_(st.getThisContext());
- handleError(errorWrapper);
- }
- // Reset the context stack in any case
- st.thisContext = undefined;
- // Throw the exception anyway, as we want to stop
- // the execution to avoid infinite loops
- throw error;
- }
- }
- };
- function inContext(worker, setup) {
- var context = pushContext(setup);
- var result = worker(context);
- popContext(context);
- return result;
- }
- /* Handles Smalltalk errors. Triggers the registered ErrorHandler
- (See the Smalltalk class ErrorHandler and its subclasses */
- function handleError(error) {
- st.ErrorHandler._current()._handleError_(error);
- }
- /* 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, selector, args) {
- /* Handles JS method calls. */
- if(receiver.klass === undefined || receiver.allowJavaScriptCalls) {
- return callJavaScriptMethod(receiver, selector, args);
- }
- /* Handles not understood messages. Also see the Amber counter-part
- Object>>doesNotUnderstand: */
- return receiver._doesNotUnderstand_(
- st.Message._new()
- ._selector_(st.convertSelector(selector))
- ._arguments_(args)
- );
- }
- /* Call a method of a JS object, or answer a property if it exists.
- Else try wrapping a JSObjectProxy around the receiver.
- 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 callJavaScriptMethod(receiver, selector, args) {
- var jsSelector = selector._asJavaScriptSelector();
- var jsProperty = receiver[jsSelector];
- if(typeof jsProperty === "function" && !/^[A-Z]/.test(jsSelector)) {
- return jsProperty.apply(receiver, args);
- } else if(jsProperty !== undefined) {
- if(args[0]) {
- receiver[jsSelector] = args[0];
- return nil;
- } else {
- return jsProperty;
- }
- }
- return st.send(st.JSObjectProxy._on_(receiver), selector, args);
- }
- /* Handle thisContext pseudo variable */
- st.getThisContext = function() {
- if(st.thisContext) {
- st.thisContext.init();
- return st.thisContext;
- } else {
- return nil;
- }
- };
- function pushContext(setup) {
- return st.thisContext = new SmalltalkMethodContext(smalltalk.thisContext, setup);
- }
- function popContext(context) {
- st.thisContext = context.homeContext;
- }
- /* Convert a Smalltalk selector into a JS selector */
- st.selector = 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 String>>asSelector
- accordingly */
- st.convertSelector = function(selector) {
- if(selector.match(/__/)) {
- return convertBinarySelector(selector);
- } else {
- return convertKeywordSelector(selector);
- }
- };
- function convertKeywordSelector(selector) {
- return selector.replace(/^_/, '').replace(/_/g, ':');
- }
- function convertBinarySelector(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, '@')
- }
- /* Converts a JavaScript object to valid Smalltalk Object */
- st.readJSObject = function(js) {
- var object = js;
- var readObject = (js.constructor === Object);
- var readArray = (js.constructor === Array);
- if(readObject) {
- object = st.Dictionary._new();
- }
- 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 ((undefined !== shouldBeBoolean) && (shouldBeBoolean.klass === smalltalk.Boolean)) {
- return shouldBeBoolean == true;
- } else {
- smalltalk.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
- }
- };
- /* Backward compatibility with Amber 0.9.1 */
- st.symbolFor = function(aString) { return aString; }
- /* Smalltalk initialization. Called on page load */
- st.initialize = function() {
- if(initialized) { return; }
- classes.forEach(function(klass) {
- st.init(klass);
- });
- classes.forEach(function(klass) {
- klass._initialize();
- });
- initialized = true;
- };
- }
- inherits(Smalltalk, SmalltalkObject);
- function SmalltalkMethodContext(home, setup) {
- this.homeContext = home;
- this.setup = setup || function() {};
- this.pc = 0;
- }
- // Fallbacks
- SmalltalkMethodContext.prototype.locals = {};
- SmalltalkMethodContext.prototype.receiver = null;
- SmalltalkMethodContext.prototype.selector = null;
- SmalltalkMethodContext.prototype.lookupClass = null;
- inherits(SmalltalkMethodContext, SmalltalkObject);
- SmalltalkMethodContext.prototype.fill = function(receiver, selector, locals, lookupClass) {
- this.receiver = receiver;
- this.selector = selector;
- this.locals = locals || {};
- this.lookupClass = lookupClass;
- };
- SmalltalkMethodContext.prototype.fillBlock = function(locals, ctx) {
- this.locals = locals || {};
- this.methodContext = ctx;
- };
- SmalltalkMethodContext.prototype.init = function() {
- var home = this.homeContext;
- if(home) {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[smalltalk.convertSelector(this.selector)];
- lookup = lookup.superclass
- }
- return method;
- };
- // TODO: this is just wrong :)
- SmalltalkMethodContext.prototype.resume = function() {
- //Brutally set the receiver as thisContext, then re-enter the function
- smalltalk.thisContext = this;
- return this.method.apply(receiver, temps);
- };
- /* Global Smalltalk objects. */
- var nil = new SmalltalkNil();
- var smalltalk = new Smalltalk();
- if(this.jQuery) {
- this.jQuery.allowJavaScriptCalls = true;
- }
- /*
- * Answer the smalltalk representation of o.
- * Used in message sends
- */
- var _st = function(o) {
- if(o == null) {return nil}
- if(o.klass) {return o}
- return smalltalk.JSObjectProxy._on_(o);
- };
- /***************************************** BOOTSTRAP ******************************************/
- smalltalk.wrapClassName("Object", "Kernel-Objects", SmalltalkObject, undefined, false);
- smalltalk.wrapClassName("Behavior", "Kernel-Classes", SmalltalkBehavior, smalltalk.Object, false);
- smalltalk.wrapClassName("Metaclass", "Kernel-Classes", SmalltalkMetaclass, smalltalk.Behavior, false);
- smalltalk.wrapClassName("Class", "Kernel-Classes", SmalltalkClass, smalltalk.Behavior, false);
- smalltalk.Object.klass.superclass = smalltalk.Class;
- smalltalk.wrapClassName("Smalltalk", "Kernel-Objects", Smalltalk, smalltalk.Object, false);
- smalltalk.wrapClassName("Package", "Kernel-Objects", SmalltalkPackage, smalltalk.Object, false);
- smalltalk.wrapClassName("CompiledMethod", "Kernel-Methods", SmalltalkMethod, smalltalk.Object, false);
- smalltalk.wrapClassName("Organizer", "Kernel-Objects", SmalltalkOrganizer, smalltalk.Object, false);
- smalltalk.wrapClassName("PackageOrganizer", "Kernel-Objects", SmalltalkPackageOrganizer, smalltalk.Organizer, false);
- smalltalk.wrapClassName("ClassOrganizer", "Kernel-Objects", SmalltalkClassOrganizer, smalltalk.Organizer, false);
- smalltalk.wrapClassName("Number", "Kernel-Objects", Number, smalltalk.Object);
- smalltalk.wrapClassName("BlockClosure", "Kernel-Methods", Function, smalltalk.Object);
- smalltalk.wrapClassName("Boolean", "Kernel-Objects", Boolean, smalltalk.Object);
- smalltalk.wrapClassName("Date", "Kernel-Objects", Date, smalltalk.Object);
- smalltalk.wrapClassName("UndefinedObject", "Kernel-Objects", SmalltalkNil, smalltalk.Object, false);
- smalltalk.addClass("Collection", smalltalk.Object, null, "Kernel-Collections");
- smalltalk.addClass("IndexableCollection", smalltalk.Collection, null, "Kernel-Collections");
- smalltalk.addClass("SequenceableCollection", smalltalk.IndexableCollection, null, "Kernel-Collections");
- smalltalk.addClass("CharacterArray", smalltalk.SequenceableCollection, null, "Kernel-Collections");
- smalltalk.wrapClassName("String", "Kernel-Collections", String, smalltalk.CharacterArray);
- smalltalk.wrapClassName("Array", "Kernel-Collections", Array, smalltalk.SequenceableCollection);
- smalltalk.wrapClassName("RegularExpression", "Kernel-Collections", RegExp, smalltalk.Object);
- smalltalk.wrapClassName("Error", "Kernel-Exceptions", Error, smalltalk.Object);
- smalltalk.wrapClassName("MethodContext", "Kernel-Methods", SmalltalkMethodContext, smalltalk.Object, false);
- /* Alias definitions */
- smalltalk.alias(smalltalk.Array, "OrderedCollection");
- smalltalk.alias(smalltalk.Date, "Time");
- smalltalk.addPackage('Kernel-Objects');
- smalltalk.addClass('Object', smalltalk.nil, [], 'Kernel-Objects');
- smalltalk.Object.comment="*Object is the root of the Smalltalk class system*. All classes in the system are subclasses of Object.\x0a\x0aObject provides default behavior common to all normal objects, such as:\x0a\x0a- access\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\x0aObject has no instance variable.\x0a\x0a##Access\x0a\x0aInstance variables can be accessed with `#instVarAt:` and `#instVarAt:put:`. `Object >> 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\x0aObjects 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."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "->",
- category: 'converting',
- fn: function (anObject){
- var self=this;
- function $Association(){return smalltalk.Association||(typeof Association=="undefined"?nil:Association)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st($Association())._key_value_(self,anObject);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},smalltalk.Object)})},
- args: ["anObject"],
- source: "-> anObject\x0a\x09^Association key: self value: anObject",
- messageSends: ["key:value:"],
- referencedClasses: ["Association"]
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "=",
- category: 'comparing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self).__eq_eq(anObject);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},smalltalk.Object)})},
- args: ["anObject"],
- source: "= anObject\x0a\x09^self == anObject",
- messageSends: ["=="],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "==",
- category: 'comparing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._identityHash()).__eq(_st(anObject)._identityHash());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},smalltalk.Object)})},
- args: ["anObject"],
- source: "== anObject\x0a\x09^self identityHash = anObject identityHash",
- messageSends: ["=", "identityHash"],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asJSON",
- category: 'converting',
- fn: function (){
- var self=this;
- var variables;
- function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- variables=_st($HashedCollection())._new();
- _st(_st(_st(self)._class())._allInstanceVariableNames())._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(variables)._at_put_(each,_st(_st(self)._instVarAt_(each))._asJSON());
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- $1=variables;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},smalltalk.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",
- messageSends: ["new", "do:", "at:put:", "asJSON", "instVarAt:", "allInstanceVariableNames", "class"],
- referencedClasses: ["HashedCollection"]
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asJSONString",
- category: 'converting',
- fn: function (){
- var self=this;
- function $JSON(){return smalltalk.JSON||(typeof JSON=="undefined"?nil:JSON)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st($JSON())._stringify_(_st(self)._asJSON());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},smalltalk.Object)})},
- args: [],
- source: "asJSONString\x0a\x09^JSON stringify: self asJSON",
- messageSends: ["stringify:", "asJSON"],
- referencedClasses: ["JSON"]
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asJavascript",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._asString();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Object)})},
- args: [],
- source: "asJavascript\x0a\x09^self asString",
- messageSends: ["asString"],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asString",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._printString();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Object)})},
- args: [],
- source: "asString\x0a\x09^self printString",
- messageSends: ["printString"],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "basicAt:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self[aString];
- return self}, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},smalltalk.Object)})},
- args: ["aString"],
- source: "basicAt: aString\x0a\x09<return self[aString]>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "basicAt:put:",
- category: 'accessing',
- fn: function (aString,anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self[aString] = anObject;
- return self}, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},smalltalk.Object)})},
- args: ["aString", "anObject"],
- source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "basicDelete:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- delete self[aString]; return aString;
- return self}, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},smalltalk.Object)})},
- args: ["aString"],
- source: "basicDelete: aString\x0a\x09<delete self[aString]; return aString>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "basicPerform:",
- category: 'message handling',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._basicPerform_withArguments_(aString,[]);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},smalltalk.Object)})},
- args: ["aString"],
- source: "basicPerform: aString\x0a\x09^self basicPerform: aString withArguments: #()",
- messageSends: ["basicPerform:withArguments:"],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "basicPerform:withArguments:",
- category: 'message handling',
- fn: function (aString,aCollection){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self[aString].apply(self, aCollection);;
- return self}, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},smalltalk.Object)})},
- args: ["aString", "aCollection"],
- source: "basicPerform: aString withArguments: aCollection\x0a\x09<return self[aString].apply(self, aCollection);>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "class",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.klass;
- return self}, function($ctx1) {$ctx1.fill(self,"class",{},smalltalk.Object)})},
- args: [],
- source: "class\x0a\x09<return self.klass>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "copy",
- category: 'copying',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._shallowCopy())._postCopy();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"copy",{},smalltalk.Object)})},
- args: [],
- source: "copy\x0a\x09^self shallowCopy postCopy",
- messageSends: ["postCopy", "shallowCopy"],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "deepCopy",
- category: 'copying',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var copy = self.klass._new();
- for(var i in self) {
- if(/^@.+/.test(i)) {
- copy[i] = self[i]._deepCopy();
- }
- }
- return copy;
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.Object)})},
- args: [],
- source: "deepCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09for(var i in self) {\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>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "deprecatedAPI",
- category: 'error handling',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(console)._warn_(_st(_st(_st(_st(_st(smalltalk.getThisContext())._home())._asString()).__comma(" is deprecated! (in ")).__comma(_st(_st(_st(smalltalk.getThisContext())._home())._home())._asString())).__comma(")"));
- return self}, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},smalltalk.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, ')'",
- messageSends: ["warn:", ",", "asString", "home"],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "doesNotUnderstand:",
- category: 'error handling',
- fn: function (aMessage){
- var self=this;
- function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=_st($MessageNotUnderstood())._new();
- _st($1)._receiver_(self);
- _st($1)._message_(aMessage);
- $2=_st($1)._signal();
- return self}, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},smalltalk.Object)})},
- args: ["aMessage"],
- source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
- messageSends: ["receiver:", "new", "message:", "signal"],
- referencedClasses: ["MessageNotUnderstood"]
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "error:",
- category: 'error handling',
- fn: function (aString){
- var self=this;
- function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
- return smalltalk.withContext(function($ctx1) {
- _st($Error())._signal_(aString);
- return self}, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},smalltalk.Object)})},
- args: ["aString"],
- source: "error: aString\x0a\x09Error signal: aString",
- messageSends: ["signal:"],
- referencedClasses: ["Error"]
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "halt",
- category: 'error handling',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._error_("Halt encountered");
- return self}, function($ctx1) {$ctx1.fill(self,"halt",{},smalltalk.Object)})},
- args: [],
- source: "halt\x0a\x09self error: 'Halt encountered'",
- messageSends: ["error:"],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "identityHash",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var hash=self.identityHash;
- if (hash) return hash;
- hash=smalltalk.nextId();
- Object.defineProperty(self, 'identityHash', {value:hash});
- return hash;
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"identityHash",{},smalltalk.Object)})},
- args: [],
- source: "identityHash\x0a\x09<\x0a\x09var hash=self.identityHash;\x0a\x09if (hash) return hash;\x0a\x09hash=smalltalk.nextId();\x0a\x09Object.defineProperty(self, 'identityHash', {value:hash});\x0a\x09return hash;\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "ifNil:",
- category: 'testing',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},smalltalk.Object)})},
- args: ["aBlock"],
- source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "ifNil:ifNotNil:",
- category: 'testing',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(anotherBlock)._value_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Object)})},
- args: ["aBlock", "anotherBlock"],
- source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value: self",
- messageSends: ["value:"],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "ifNotNil:",
- category: 'testing',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(aBlock)._value_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},smalltalk.Object)})},
- args: ["aBlock"],
- source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value: self",
- messageSends: ["value:"],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "ifNotNil:ifNil:",
- category: 'testing',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(aBlock)._value_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Object)})},
- args: ["aBlock", "anotherBlock"],
- source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value: self",
- messageSends: ["value:"],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "initialize",
- category: 'initialization',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Object)})},
- args: [],
- source: "initialize",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "instVarAt:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self['@'+aString] ;
- return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},smalltalk.Object)})},
- args: ["aString"],
- source: "instVarAt: aString\x0a\x09< return self['@'+aString] >",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "instVarAt:put:",
- category: 'accessing',
- fn: function (aString,anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self['@' + aString] = anObject ;
- return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},smalltalk.Object)})},
- args: ["aString", "anObject"],
- source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isBehavior",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return false;
- }, function($ctx1) {$ctx1.fill(self,"isBehavior",{},smalltalk.Object)})},
- args: [],
- source: "isBehavior\x0a\x09^ false",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isBoolean",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return false;
- }, function($ctx1) {$ctx1.fill(self,"isBoolean",{},smalltalk.Object)})},
- args: [],
- source: "isBoolean\x0a\x09^ false",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isClass",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return false;
- }, function($ctx1) {$ctx1.fill(self,"isClass",{},smalltalk.Object)})},
- args: [],
- source: "isClass\x0a\x09^false",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isCompiledMethod",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return false;
- }, function($ctx1) {$ctx1.fill(self,"isCompiledMethod",{},smalltalk.Object)})},
- args: [],
- source: "isCompiledMethod\x0a\x09^ false",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isImmutable",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return false;
- }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.Object)})},
- args: [],
- source: "isImmutable\x0a\x09^ false",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isKindOf:",
- category: 'testing',
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=_st(self)._isMemberOf_(aClass);
- if(smalltalk.assert($2)){
- $1=true;
- } else {
- $1=_st(_st(self)._class())._inheritsFrom_(aClass);
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},smalltalk.Object)})},
- args: ["aClass"],
- source: "isKindOf: aClass\x0a\x09^(self isMemberOf: aClass)\x0a\x09\x09ifTrue: [true]\x0a\x09\x09ifFalse: [self class inheritsFrom: aClass]",
- messageSends: ["ifTrue:ifFalse:", "inheritsFrom:", "class", "isMemberOf:"],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isMemberOf:",
- category: 'testing',
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._class()).__eq(aClass);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},smalltalk.Object)})},
- args: ["aClass"],
- source: "isMemberOf: aClass\x0a\x09^self class = aClass",
- messageSends: ["=", "class"],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isMetaclass",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return false;
- }, function($ctx1) {$ctx1.fill(self,"isMetaclass",{},smalltalk.Object)})},
- args: [],
- source: "isMetaclass\x0a\x09^false",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isNil",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return false;
- }, function($ctx1) {$ctx1.fill(self,"isNil",{},smalltalk.Object)})},
- args: [],
- source: "isNil\x0a\x09^false",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isNumber",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return false;
- }, function($ctx1) {$ctx1.fill(self,"isNumber",{},smalltalk.Object)})},
- args: [],
- source: "isNumber\x0a\x09^false",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isPackage",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return false;
- }, function($ctx1) {$ctx1.fill(self,"isPackage",{},smalltalk.Object)})},
- args: [],
- source: "isPackage\x0a\x09^ false",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isParseFailure",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return false;
- }, function($ctx1) {$ctx1.fill(self,"isParseFailure",{},smalltalk.Object)})},
- args: [],
- source: "isParseFailure\x0a\x09^false",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isString",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return false;
- }, function($ctx1) {$ctx1.fill(self,"isString",{},smalltalk.Object)})},
- args: [],
- source: "isString\x0a\x09^false",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isSymbol",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return false;
- }, function($ctx1) {$ctx1.fill(self,"isSymbol",{},smalltalk.Object)})},
- args: [],
- source: "isSymbol\x0a\x09^false",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "notNil",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._isNil())._not();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"notNil",{},smalltalk.Object)})},
- args: [],
- source: "notNil\x0a\x09^self isNil not",
- messageSends: ["not", "isNil"],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "perform:",
- category: 'message handling',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._perform_withArguments_(aString,[]);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},smalltalk.Object)})},
- args: ["aString"],
- source: "perform: aString\x0a\x09^self perform: aString withArguments: #()",
- messageSends: ["perform:withArguments:"],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "perform:withArguments:",
- category: 'message handling',
- fn: function (aString,aCollection){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return smalltalk.send(self, aString._asSelector(), aCollection);
- return self}, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},smalltalk.Object)})},
- args: ["aString", "aCollection"],
- source: "perform: aString withArguments: aCollection\x0a\x09<return smalltalk.send(self, aString._asSelector(), aCollection)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "postCopy",
- category: 'copying',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self}, function($ctx1) {$ctx1.fill(self,"postCopy",{},smalltalk.Object)})},
- args: [],
- source: "postCopy",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "printOn:",
- category: 'printing',
- fn: function (aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$3,$2;
- $1=aStream;
- $3=_st(_st(_st(_st(self)._class())._name())._first())._isVowel();
- if(smalltalk.assert($3)){
- $2="an ";
- } else {
- $2="a ";
- };
- _st($1)._nextPutAll_($2);
- _st(aStream)._nextPutAll_(_st(_st(self)._class())._name());
- return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Object)})},
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09\x22Append to the aStream, a string representing the receiver.\x22\x0a\x09\x0a\x09aStream nextPutAll: (self class name first isVowel\x0a\x09\x09ifTrue: [ 'an ' ]\x0a\x09\x09ifFalse: [ 'a ' ]).\x0a\x09aStream nextPutAll: self class name",
- messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "printString",
- category: 'printing',
- fn: function (){
- var self=this;
- function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st($String())._streamContents_((function(stream){
- return smalltalk.withContext(function($ctx2) {
- return _st(self)._printOn_(stream);
- }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"printString",{},smalltalk.Object)})},
- args: [],
- source: "printString\x0a\x09\x22Answer a String representation of the receiver.\x22\x0a\x0a\x09^ String streamContents: [ :stream | self printOn: stream ]",
- messageSends: ["streamContents:", "printOn:"],
- referencedClasses: ["String"]
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "putOn:",
- category: 'streaming',
- fn: function (aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(aStream)._nextPut_(self);
- return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},smalltalk.Object)})},
- args: ["aStream"],
- source: "putOn: aStream\x0a\x09aStream nextPut: self",
- messageSends: ["nextPut:"],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "respondsTo:",
- category: 'testing',
- fn: function (aSelector){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._class())._canUnderstand_(aSelector);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},smalltalk.Object)})},
- args: ["aSelector"],
- source: "respondsTo: aSelector\x0a\x09^self class canUnderstand: aSelector",
- messageSends: ["canUnderstand:", "class"],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "shallowCopy",
- category: 'copying',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var copy = self.klass._new();
- for(var i in self) {
- if(/^@.+/.test(i)) {
- copy[i] = self[i];
- }
- }
- return copy;
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.Object)})},
- args: [],
- source: "shallowCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09for(var i in self) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09}\x0a\x09\x09}\x0a\x09\x09return copy;\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "shouldNotImplement",
- category: 'error handling',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._error_(_st("This method should not be implemented in ").__comma(_st(_st(self)._class())._name()));
- return self}, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},smalltalk.Object)})},
- args: [],
- source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
- messageSends: ["error:", ",", "name", "class"],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "size",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._error_("Object not indexable");
- return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Object)})},
- args: [],
- source: "size\x0a\x09self error: 'Object not indexable'",
- messageSends: ["error:"],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "subclassResponsibility",
- category: 'error handling',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._error_("This method is a responsibility of a subclass");
- return self}, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},smalltalk.Object)})},
- args: [],
- source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
- messageSends: ["error:"],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "test",
- category: 'converting',
- fn: function (){
- var self=this;
- var a;
- return smalltalk.withContext(function($ctx1) {
- a=(1);
- _st(self)._halt();
- return self}, function($ctx1) {$ctx1.fill(self,"test",{a:a},smalltalk.Object)})},
- args: [],
- source: "test\x0a\x09| a |\x0a\x09a := 1.\x0a\x09self halt",
- messageSends: ["halt"],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "throw:",
- category: 'error handling',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- throw anObject ;
- return self}, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},smalltalk.Object)})},
- args: ["anObject"],
- source: "throw: anObject\x0a\x09< throw anObject >",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "try:catch:",
- category: 'error handling',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- try{return aBlock()} catch(e) {return anotherBlock(e)};
- return self}, function($ctx1) {$ctx1.fill(self,"try:catch:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Object)})},
- args: ["aBlock", "anotherBlock"],
- source: "try: aBlock catch: anotherBlock\x0a\x09<try{return aBlock()} catch(e) {return anotherBlock(e)}>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "value",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.valueOf();
- return self}, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.Object)})},
- args: [],
- source: "value\x0a\x09<return self.valueOf()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "yourself",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"yourself",{},smalltalk.Object)})},
- args: [],
- source: "yourself\x0a\x09^self",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "~=",
- category: 'comparing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self).__eq(anObject)).__eq(false);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},smalltalk.Object)})},
- args: ["anObject"],
- source: "~= anObject\x0a\x09^(self = anObject) = false",
- messageSends: ["="],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "~~",
- category: 'comparing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self).__eq_eq(anObject)).__eq(false);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},smalltalk.Object)})},
- args: ["anObject"],
- source: "~~ anObject\x0a\x09^(self == anObject) = false",
- messageSends: ["=", "=="],
- referencedClasses: []
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "initialize",
- category: 'initialization',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Object.klass)})},
- args: [],
- source: "initialize\x0a\x09\x22no op\x22",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object.klass);
- smalltalk.addClass('Boolean', smalltalk.Object, [], 'Kernel-Objects');
- smalltalk.Boolean.comment="Boolean wraps the JavaScript `Boolean()` constructor. The `true` and `false` objects are the JavaScript boolean objects.\x0a\x0aBoolean defines the protocol for logic testing operations and conditional control structures for the logical values.\x0aBoolean instances are weither `true` or `false`."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "&",
- category: 'controlling',
- fn: function (aBoolean){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- if(self == true) {
- return aBoolean;
- } else {
- return false;
- }
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},smalltalk.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>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Boolean);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "=",
- category: 'comparing',
- fn: function (aBoolean){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- if(! aBoolean._isBoolean || ! aBoolean._isBoolean()) {
- return false;
- }
- return Boolean(self == true) == aBoolean
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"=",{aBoolean:aBoolean},smalltalk.Boolean)})},
- args: ["aBoolean"],
- source: "= aBoolean\x0a\x09<\x0a\x09\x09if(! aBoolean._isBoolean || ! aBoolean._isBoolean()) {\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09return Boolean(self == true) == aBoolean\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Boolean);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "==",
- category: 'comparing',
- fn: function (aBoolean){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self).__eq(aBoolean);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},smalltalk.Boolean)})},
- args: ["aBoolean"],
- source: "== aBoolean\x0a\x09^self = aBoolean",
- messageSends: ["="],
- referencedClasses: []
- }),
- smalltalk.Boolean);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "and:",
- category: 'controlling',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=_st(self).__eq(true);
- $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
- return smalltalk.withContext(function($ctx2) {
- return false;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},smalltalk.Boolean)})},
- args: ["aBlock"],
- source: "and: aBlock\x0a\x09^self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [false]",
- messageSends: ["ifTrue:ifFalse:", "="],
- referencedClasses: []
- }),
- smalltalk.Boolean);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asJSON",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Boolean)})},
- args: [],
- source: "asJSON\x0a\x09^self",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Boolean);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asString",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.toString() ;
- return self}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Boolean)})},
- args: [],
- source: "asString\x0a\x09< return self.toString() >",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Boolean);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "deepCopy",
- category: 'copying',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.Boolean)})},
- args: [],
- source: "deepCopy\x0a\x09^self",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Boolean);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "ifFalse:",
- category: 'controlling',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self;
- $1=_st($2)._ifTrue_ifFalse_((function(){
- return smalltalk.withContext(function($ctx2) {
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},smalltalk.Boolean)})},
- args: ["aBlock"],
- source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: [] ifFalse: aBlock",
- messageSends: ["ifTrue:ifFalse:"],
- referencedClasses: []
- }),
- smalltalk.Boolean);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "ifFalse:ifTrue:",
- category: 'controlling',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self;
- $1=_st($2)._ifTrue_ifFalse_(anotherBlock,aBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Boolean)})},
- args: ["aBlock", "anotherBlock"],
- source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: anotherBlock ifFalse: aBlock",
- messageSends: ["ifTrue:ifFalse:"],
- referencedClasses: []
- }),
- smalltalk.Boolean);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "ifTrue:",
- category: 'controlling',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self;
- $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
- return smalltalk.withContext(function($ctx2) {
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},smalltalk.Boolean)})},
- args: ["aBlock"],
- source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: aBlock ifFalse: []",
- messageSends: ["ifTrue:ifFalse:"],
- referencedClasses: []
- }),
- smalltalk.Boolean);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "ifTrue:ifFalse:",
- category: 'controlling',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- if(self == true) {
- return aBlock();
- } else {
- return anotherBlock();
- }
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.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();\x0a\x09\x09} else {\x0a\x09\x09return anotherBlock();\x0a\x09\x09}\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Boolean);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isBoolean",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return true;
- }, function($ctx1) {$ctx1.fill(self,"isBoolean",{},smalltalk.Boolean)})},
- args: [],
- source: "isBoolean\x0a\x09^ true",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Boolean);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isImmutable",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return true;
- }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.Boolean)})},
- args: [],
- source: "isImmutable\x0a\x09^ true",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Boolean);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "not",
- category: 'controlling',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self).__eq(false);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"not",{},smalltalk.Boolean)})},
- args: [],
- source: "not\x0a\x09^self = false",
- messageSends: ["="],
- referencedClasses: []
- }),
- smalltalk.Boolean);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "or:",
- category: 'controlling',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=_st(self).__eq(true);
- $1=_st($2)._ifTrue_ifFalse_((function(){
- return smalltalk.withContext(function($ctx2) {
- return true;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},smalltalk.Boolean)})},
- args: ["aBlock"],
- source: "or: aBlock\x0a\x09^self = true\x0a\x09\x09ifTrue: [true]\x0a\x09\x09ifFalse: aBlock",
- messageSends: ["ifTrue:ifFalse:", "="],
- referencedClasses: []
- }),
- smalltalk.Boolean);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "printOn:",
- category: 'printing',
- fn: function (aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(aStream)._nextPutAll_(_st(self)._asString());
- return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Boolean)})},
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
- messageSends: ["nextPutAll:", "asString"],
- referencedClasses: []
- }),
- smalltalk.Boolean);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "shallowCopy",
- category: 'copying',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.Boolean)})},
- args: [],
- source: "shallowCopy\x0a\x09^self",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Boolean);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "|",
- category: 'controlling',
- fn: function (aBoolean){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- if(self == true) {
- return true;
- } else {
- return aBoolean;
- }
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},smalltalk.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>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Boolean);
- smalltalk.addClass('Date', smalltalk.Object, [], 'Kernel-Objects');
- smalltalk.Date.comment="The Date class is used to work with dates and times. Therefore `Date today` and `Date now` are both valid in\x0aAmber and answer the same date object.\x0a\x0aDate wraps the `Date()` JavaScript constructor, and Smalltalk date objects are JavaScript date objects."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "+",
- category: 'arithmetic',
- fn: function (aDate){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self + aDate;
- return self}, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},smalltalk.Date)})},
- args: ["aDate"],
- source: "+ aDate\x0a\x09<return self + aDate>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "-",
- category: 'arithmetic',
- fn: function (aDate){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self - aDate;
- return self}, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},smalltalk.Date)})},
- args: ["aDate"],
- source: "- aDate\x0a\x09<return self - aDate>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "<",
- category: 'comparing',
- fn: function (aDate){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self < aDate;
- return self}, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},smalltalk.Date)})},
- args: ["aDate"],
- source: "< aDate\x0a\x09<return self < aDate>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "<=",
- category: 'comparing',
- fn: function (aDate){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self <= aDate;
- return self}, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},smalltalk.Date)})},
- args: ["aDate"],
- source: "<= aDate\x0a\x09<return self <= aDate>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: ">",
- category: 'comparing',
- fn: function (aDate){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self > aDate;
- return self}, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},smalltalk.Date)})},
- args: ["aDate"],
- source: "> aDate\x0a\x09<return self >> aDate>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: ">=",
- category: 'comparing',
- fn: function (aDate){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self >= aDate;
- return self}, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},smalltalk.Date)})},
- args: ["aDate"],
- source: ">= aDate\x0a\x09<return self >>= aDate>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asDateString",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.toDateString();
- return self}, function($ctx1) {$ctx1.fill(self,"asDateString",{},smalltalk.Date)})},
- args: [],
- source: "asDateString\x0a\x09<return self.toDateString()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asLocaleString",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.toLocaleString();
- return self}, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},smalltalk.Date)})},
- args: [],
- source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asMilliseconds",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._time();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},smalltalk.Date)})},
- args: [],
- source: "asMilliseconds\x0a\x09^self time",
- messageSends: ["time"],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asNumber",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._asMilliseconds();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asNumber",{},smalltalk.Date)})},
- args: [],
- source: "asNumber\x0a\x09^self asMilliseconds",
- messageSends: ["asMilliseconds"],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asString",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.toString();
- return self}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Date)})},
- args: [],
- source: "asString\x0a\x09<return self.toString()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asTimeString",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.toTimeString();
- return self}, function($ctx1) {$ctx1.fill(self,"asTimeString",{},smalltalk.Date)})},
- args: [],
- source: "asTimeString\x0a\x09<return self.toTimeString()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "day",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._dayOfWeek();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"day",{},smalltalk.Date)})},
- args: [],
- source: "day\x0a\x09^self dayOfWeek",
- messageSends: ["dayOfWeek"],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "day:",
- category: 'accessing',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._dayOfWeek_(aNumber);
- return self}, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},smalltalk.Date)})},
- args: ["aNumber"],
- source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
- messageSends: ["dayOfWeek:"],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "dayOfMonth",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.getDate();
- return self}, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},smalltalk.Date)})},
- args: [],
- source: "dayOfMonth\x0a\x09<return self.getDate()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "dayOfMonth:",
- category: 'accessing',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self.setDate(aNumber);
- return self}, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},smalltalk.Date)})},
- args: ["aNumber"],
- source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "dayOfWeek",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.getDay() + 1;
- return self}, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},smalltalk.Date)})},
- args: [],
- source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "dayOfWeek:",
- category: 'accessing',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.setDay(aNumber - 1);
- return self}, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},smalltalk.Date)})},
- args: ["aNumber"],
- source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "hours",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.getHours();
- return self}, function($ctx1) {$ctx1.fill(self,"hours",{},smalltalk.Date)})},
- args: [],
- source: "hours\x0a\x09<return self.getHours()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "hours:",
- category: 'accessing',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self.setHours(aNumber);
- return self}, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},smalltalk.Date)})},
- args: ["aNumber"],
- source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "milliseconds",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.getMilliseconds();
- return self}, function($ctx1) {$ctx1.fill(self,"milliseconds",{},smalltalk.Date)})},
- args: [],
- source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "milliseconds:",
- category: 'accessing',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self.setMilliseconds(aNumber);
- return self}, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},smalltalk.Date)})},
- args: ["aNumber"],
- source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "minutes",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.getMinutes();
- return self}, function($ctx1) {$ctx1.fill(self,"minutes",{},smalltalk.Date)})},
- args: [],
- source: "minutes\x0a\x09<return self.getMinutes()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "minutes:",
- category: 'accessing',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self.setMinutes(aNumber);
- return self}, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},smalltalk.Date)})},
- args: ["aNumber"],
- source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "month",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.getMonth() + 1;
- return self}, function($ctx1) {$ctx1.fill(self,"month",{},smalltalk.Date)})},
- args: [],
- source: "month\x0a\x09<return self.getMonth() + 1>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "month:",
- category: 'accessing',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self.setMonth(aNumber - 1);
- return self}, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},smalltalk.Date)})},
- args: ["aNumber"],
- source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "printOn:",
- category: 'printing',
- fn: function (aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(aStream)._nextPutAll_(_st(self)._asString());
- return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Date)})},
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
- messageSends: ["nextPutAll:", "asString"],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "seconds",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.getSeconds();
- return self}, function($ctx1) {$ctx1.fill(self,"seconds",{},smalltalk.Date)})},
- args: [],
- source: "seconds\x0a\x09<return self.getSeconds()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "seconds:",
- category: 'accessing',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self.setSeconds(aNumber);
- return self}, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},smalltalk.Date)})},
- args: ["aNumber"],
- source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "time",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.getTime();
- return self}, function($ctx1) {$ctx1.fill(self,"time",{},smalltalk.Date)})},
- args: [],
- source: "time\x0a\x09<return self.getTime()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "time:",
- category: 'accessing',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self.setTime(aNumber);
- return self}, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},smalltalk.Date)})},
- args: ["aNumber"],
- source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "year",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.getFullYear();
- return self}, function($ctx1) {$ctx1.fill(self,"year",{},smalltalk.Date)})},
- args: [],
- source: "year\x0a\x09<return self.getFullYear()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "year:",
- category: 'accessing',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self.setFullYear(aNumber);
- return self}, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},smalltalk.Date)})},
- args: ["aNumber"],
- source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "fromMilliseconds:",
- category: 'instance creation',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._new_(aNumber);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},smalltalk.Date.klass)})},
- args: ["aNumber"],
- source: "fromMilliseconds: aNumber\x0a\x09^self new: aNumber",
- messageSends: ["new:"],
- referencedClasses: []
- }),
- smalltalk.Date.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "fromSeconds:",
- category: 'instance creation',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._fromMilliseconds_(_st(aNumber).__star((1000)));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},smalltalk.Date.klass)})},
- args: ["aNumber"],
- source: "fromSeconds: aNumber\x0a\x09^self fromMilliseconds: aNumber * 1000",
- messageSends: ["fromMilliseconds:", "*"],
- referencedClasses: []
- }),
- smalltalk.Date.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "fromString:",
- category: 'instance creation',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._new_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.Date.klass)})},
- args: ["aString"],
- source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^self new: aString",
- messageSends: ["new:"],
- referencedClasses: []
- }),
- smalltalk.Date.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "millisecondsToRun:",
- category: 'instance creation',
- fn: function (aBlock){
- var self=this;
- var t;
- function $Date(){return smalltalk.Date||(typeof Date=="undefined"?nil:Date)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- t=_st($Date())._now();
- _st(aBlock)._value();
- $1=_st(_st($Date())._now()).__minus(t);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},smalltalk.Date.klass)})},
- args: ["aBlock"],
- source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^Date now - t",
- messageSends: ["now", "value", "-"],
- referencedClasses: ["Date"]
- }),
- smalltalk.Date.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "new:",
- category: 'instance creation',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return new Date(anObject);
- return self}, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},smalltalk.Date.klass)})},
- args: ["anObject"],
- source: "new: anObject\x0a\x09<return new Date(anObject)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Date.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "now",
- category: 'instance creation',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._today();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"now",{},smalltalk.Date.klass)})},
- args: [],
- source: "now\x0a\x09^self today",
- messageSends: ["today"],
- referencedClasses: []
- }),
- smalltalk.Date.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "today",
- category: 'instance creation',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._new();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"today",{},smalltalk.Date.klass)})},
- args: [],
- source: "today\x0a\x09^self new",
- messageSends: ["new"],
- referencedClasses: []
- }),
- smalltalk.Date.klass);
- smalltalk.addClass('Environment', smalltalk.Object, [], 'Kernel-Objects');
- smalltalk.Environment.comment="Abstract class defining common behavior for local and remote environments"
- smalltalk.addMethod(
- smalltalk.method({
- selector: "addInstVarNamed:to:",
- category: 'compiling',
- fn: function (aString,aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=_st(_st(aClass)._instanceVariableNames())._copy();
- _st($1)._add_(aString);
- $2=_st($1)._yourself();
- _st(_st(self)._classBuilder())._addSubclassOf_named_instanceVariableNames_package_(_st(aClass)._superclass(),_st(aClass)._name(),$2,_st(_st(aClass)._package())._name());
- return self}, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},smalltalk.HLEnvironment)})},
- 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",
- messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package", "classBuilder"],
- referencedClasses: []
- }),
- smalltalk.Environment);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "allSelectors",
- category: 'accessing',
- fn: function (){
- var self=this;
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(_st($Smalltalk())._current())._at_("allSelectors"))._value();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},smalltalk.Environment)})},
- args: [],
- source: "allSelectors\x0a\x09^ (Smalltalk current at: 'allSelectors') value",
- messageSends: ["value", "at:", "current"],
- referencedClasses: ["Smalltalk"]
- }),
- smalltalk.Environment);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "availableClassNames",
- category: 'accessing',
- fn: function (){
- var self=this;
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(_st($Smalltalk())._current())._classes())._collect_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(each)._name();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},smalltalk.HLEnvironment)})},
- args: [],
- source: "availableClassNames\x0a\x09^ Smalltalk current classes \x0a\x09\x09collect: [ :each | each name ]",
- messageSends: ["collect:", "name", "classes", "current"],
- referencedClasses: ["Smalltalk"]
- }),
- smalltalk.Environment);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "availablePackageNames",
- category: 'accessing',
- fn: function (){
- var self=this;
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(_st($Smalltalk())._current())._packages())._collect_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(each)._name();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},smalltalk.HLEnvironment)})},
- args: [],
- source: "availablePackageNames\x0a\x09^ Smalltalk current packages \x0a\x09\x09collect: [ :each | each name ]",
- messageSends: ["collect:", "name", "packages", "current"],
- referencedClasses: ["Smalltalk"]
- }),
- smalltalk.Environment);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "availableProtocolsFor:",
- category: 'accessing',
- fn: function (aClass){
- var self=this;
- var protocols;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- protocols=_st(aClass)._protocols();
- $1=_st(aClass)._superclass();
- if(($receiver = $1) == nil || $receiver == undefined){
- $1;
- } else {
- _st(protocols)._addAll_(_st(self)._availableProtocolsFor_(_st(aClass)._superclass()));
- };
- $2=_st(_st(protocols)._asSet())._asArray();
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},smalltalk.HLEnvironment)})},
- 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",
- messageSends: ["protocols", "ifNotNil:", "addAll:", "availableProtocolsFor:", "superclass", "asArray", "asSet"],
- referencedClasses: []
- }),
- smalltalk.Environment);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "classBuilder",
- category: 'accessing',
- fn: function (){
- var self=this;
- function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st($ClassBuilder())._new();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},smalltalk.HLEnvironment)})},
- args: [],
- source: "classBuilder\x0a\x09^ ClassBuilder new",
- messageSends: ["new"],
- referencedClasses: ["ClassBuilder"]
- }),
- smalltalk.Environment);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "classNamed:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=_st(_st($Smalltalk())._current())._at_(_st(aString)._asSymbol());
- if(($receiver = $2) == nil || $receiver == undefined){
- $1=_st(self)._error_("Invalid class name");
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},smalltalk.HLEnvironment)})},
- args: ["aString"],
- source: "classNamed: aString\x0a\x09^ (Smalltalk current at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
- messageSends: ["ifNil:", "error:", "at:", "asSymbol", "current"],
- referencedClasses: ["Smalltalk"]
- }),
- smalltalk.Environment);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "classes",
- category: 'accessing',
- fn: function (){
- var self=this;
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st($Smalltalk())._current())._classes();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Environment)})},
- args: [],
- source: "classes\x0a\x09^ Smalltalk current classes",
- messageSends: ["classes", "current"],
- referencedClasses: ["Smalltalk"]
- }),
- smalltalk.Environment);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commitPackage:",
- category: 'actions',
- fn: function (aPackage){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(aPackage)._commit();
- return self}, function($ctx1) {$ctx1.fill(self,"commitPackage:",{aPackage:aPackage},smalltalk.HLEnvironment)})},
- args: ["aPackage"],
- source: "commitPackage: aPackage\x0a\x09aPackage commit",
- messageSends: ["commit"],
- referencedClasses: []
- }),
- smalltalk.Environment);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "compileClassComment:for:",
- category: 'compiling',
- fn: function (aString,aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(aClass)._comment_(aString);
- return self}, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},smalltalk.HLEnvironment)})},
- args: ["aString", "aClass"],
- source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
- messageSends: ["comment:"],
- referencedClasses: []
- }),
- smalltalk.Environment);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "compileClassDefinition:",
- category: 'compiling',
- fn: function (aString){
- var self=this;
- function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
- return smalltalk.withContext(function($ctx1) {
- _st(self)._eval_on_(aString,_st($DoIt())._new());
- return self}, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},smalltalk.HLEnvironment)})},
- args: ["aString"],
- source: "compileClassDefinition: aString\x0a\x09self eval: aString on: DoIt new",
- messageSends: ["eval:on:", "new"],
- referencedClasses: ["DoIt"]
- }),
- smalltalk.Environment);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "compileMethod:for:protocol:",
- category: 'compiling',
- fn: function (sourceCode,class_,protocol){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(class_)._compile_category_(sourceCode,protocol);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},smalltalk.HLEnvironment)})},
- args: ["sourceCode", "class", "protocol"],
- source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09category: protocol",
- messageSends: ["compile:category:"],
- referencedClasses: []
- }),
- smalltalk.Environment);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "copyClass:to:",
- category: 'actions',
- fn: function (aClass,aClassName){
- var self=this;
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st($Smalltalk())._current())._at_(aClassName);
- if(($receiver = $1) == nil || $receiver == undefined){
- $1;
- } else {
- _st(self)._error_(_st(_st("A class named ").__comma(aClassName)).__comma(" already exists"));
- };
- _st(_st($ClassBuilder())._new())._copyClass_named_(aClass,aClassName);
- return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},smalltalk.HLEnvironment)})},
- args: ["aClass", "aClassName"],
- source: "copyClass: aClass to: aClassName\x0a\x09(Smalltalk current at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new copyClass: aClass named: aClassName\x0a\x09\x09\x0a\x09",
- messageSends: ["ifNotNil:", "error:", ",", "at:", "current", "copyClass:named:", "new"],
- referencedClasses: ["Smalltalk", "ClassBuilder"]
- }),
- smalltalk.Environment);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "eval:on:",
- category: 'actions',
- fn: function (aString,aReceiver){
- var self=this;
- var compiler;
- function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
- function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- var $early={};
- try {
- compiler=_st($Compiler())._new();
- _st((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(compiler)._parseExpression_(aString);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(ex){
- return smalltalk.withContext(function($ctx2) {
- $1=_st(window)._alert_(_st(ex)._messageText());
- throw $early=[$1];
- }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})}));
- $2=_st(compiler)._evaluateExpression_on_(aString,aReceiver);
- return $2;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"eval:on:",{aString:aString,aReceiver:aReceiver,compiler:compiler},smalltalk.HLEnvironment)})},
- args: ["aString", "aReceiver"],
- source: "eval: aString on: aReceiver\x0a\x09| compiler |\x0a\x09compiler := Compiler new.\x0a\x09[ compiler parseExpression: aString ] on: Error do: [ :ex |\x0a\x09\x09^ window alert: ex messageText ].\x0a\x09^ compiler evaluateExpression: aString on: aReceiver",
- messageSends: ["new", "on:do:", "alert:", "messageText", "parseExpression:", "evaluateExpression:on:"],
- referencedClasses: ["Compiler", "Error"]
- }),
- smalltalk.Environment);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "moveClass:toPackage:",
- category: 'actions',
- fn: function (aClass,aPackageName){
- var self=this;
- var package_;
- function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3;
- package_=_st($Package())._named_(aPackageName);
- $1=package_;
- if(($receiver = $1) == nil || $receiver == undefined){
- _st(self)._error_("Invalid package name");
- } else {
- $1;
- };
- $2=_st(package_).__eq_eq(_st(aClass)._package());
- if(smalltalk.assert($2)){
- $3=self;
- return $3;
- };
- _st(aClass)._package_(package_);
- return self}, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},smalltalk.HLEnvironment)})},
- 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",
- messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"],
- referencedClasses: ["Package"]
- }),
- smalltalk.Environment);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "moveMethod:toClass:",
- category: 'actions',
- fn: function (aMethod,aClassName){
- var self=this;
- var destinationClass;
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3;
- destinationClass=_st(_st($Smalltalk())._current())._at_(_st(aClassName)._asSymbol());
- $1=destinationClass;
- if(($receiver = $1) == nil || $receiver == undefined){
- _st(self)._error_("Invalid class name");
- } else {
- $1;
- };
- $2=_st(destinationClass).__eq_eq(_st(aMethod)._methodClass());
- if(smalltalk.assert($2)){
- $3=self;
- return $3;
- };
- _st(destinationClass)._compile_category_(_st(aMethod)._source(),_st(aMethod)._protocol());
- _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
- return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},smalltalk.Environment)})},
- args: ["aMethod", "aClassName"],
- source: "moveMethod: aMethod toClass: aClassName\x0a\x09| destinationClass |\x0a\x09\x0a\x09destinationClass := Smalltalk current at: aClassName asSymbol.\x0a\x09destinationClass ifNil: [ self error: 'Invalid class name' ].\x0a\x09destinationClass == aMethod methodClass ifTrue: [ ^ self ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09category: aMethod protocol.\x0a\x09aMethod methodClass \x0a\x09\x09removeCompiledMethod: aMethod\x0a\x09",
- messageSends: ["at:", "asSymbol", "current", "ifNil:", "error:", "ifTrue:", "==", "methodClass", "compile:category:", "source", "protocol", "removeCompiledMethod:"],
- referencedClasses: ["Smalltalk"]
- }),
- smalltalk.Environment);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "moveMethod:toProtocol:",
- category: 'actions',
- fn: function (aMethod,aProtocol){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(aMethod)._category_(aProtocol);
- return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},smalltalk.HLEnvironment)})},
- args: ["aMethod", "aProtocol"],
- source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod category: aProtocol",
- messageSends: ["category:"],
- referencedClasses: []
- }),
- smalltalk.Environment);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "packages",
- category: 'accessing',
- fn: function (){
- var self=this;
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st($Smalltalk())._current())._packages();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"packages",{},smalltalk.HLEnvironment)})},
- args: [],
- source: "packages\x0a\x09^ Smalltalk current packages",
- messageSends: ["packages", "current"],
- referencedClasses: ["Smalltalk"]
- }),
- smalltalk.Environment);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "removeClass:",
- category: 'actions',
- fn: function (aClass){
- var self=this;
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return smalltalk.withContext(function($ctx1) {
- _st(_st($Smalltalk())._current())._removeClass_(aClass);
- return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},smalltalk.HLEnvironment)})},
- args: ["aClass"],
- source: "removeClass: aClass\x0a\x09Smalltalk current removeClass: aClass",
- messageSends: ["removeClass:", "current"],
- referencedClasses: ["Smalltalk"]
- }),
- smalltalk.Environment);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "removeMethod:",
- category: 'actions',
- fn: function (aMethod){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
- return self}, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},smalltalk.Environment)})},
- args: ["aMethod"],
- source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
- messageSends: ["removeCompiledMethod:", "methodClass"],
- referencedClasses: []
- }),
- smalltalk.Environment);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "removeProtocol:from:",
- category: 'actions',
- fn: function (aString,aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(_st(_st(aClass)._methods())._select_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(each)._protocol()).__eq(aString);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(aClass)._removeCompiledMethod_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},smalltalk.Environment)})},
- args: ["aString", "aClass"],
- source: "removeProtocol: aString from: aClass\x0a\x09(aClass methods\x0a\x09\x09select: [ :each | each protocol = aString ])\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
- messageSends: ["do:", "removeCompiledMethod:", "select:", "=", "protocol", "methods"],
- referencedClasses: []
- }),
- smalltalk.Environment);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "renameClass:to:",
- category: 'actions',
- fn: function (aClass,aClassName){
- var self=this;
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st($Smalltalk())._current())._at_(aClassName);
- if(($receiver = $1) == nil || $receiver == undefined){
- $1;
- } else {
- _st(self)._error_(_st(_st("A class named ").__comma(aClassName)).__comma(" already exists"));
- };
- _st(_st($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
- return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},smalltalk.HLEnvironment)})},
- args: ["aClass", "aClassName"],
- source: "renameClass: aClass to: aClassName\x0a\x09(Smalltalk current at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new renameClass: aClass to: aClassName\x09\x0a\x09",
- messageSends: ["ifNotNil:", "error:", ",", "at:", "current", "renameClass:to:", "new"],
- referencedClasses: ["Smalltalk", "ClassBuilder"]
- }),
- smalltalk.Environment);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "renameProtocol:to:in:",
- category: 'actions',
- fn: function (aString,anotherString,aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(_st(_st(aClass)._methods())._select_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(each)._protocol()).__eq(aString);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(each)._protocol_(anotherString);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},smalltalk.Environment)})},
- args: ["aString", "anotherString", "aClass"],
- source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methods\x0a\x09\x09select: [ :each | each protocol = aString ])\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
- messageSends: ["do:", "protocol:", "select:", "=", "protocol", "methods"],
- referencedClasses: []
- }),
- smalltalk.Environment);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "systemAnnouncer",
- category: 'accessing',
- fn: function (){
- var self=this;
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(_st($Smalltalk())._current())._at_("SystemAnnouncer"))._current();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},smalltalk.Environment)})},
- args: [],
- source: "systemAnnouncer\x0a\x09^ (Smalltalk current at: #SystemAnnouncer) current",
- messageSends: ["current", "at:"],
- referencedClasses: ["Smalltalk"]
- }),
- smalltalk.Environment);
- smalltalk.addClass('JSObjectProxy', smalltalk.Object, ['jsObject'], 'Kernel-Objects');
- smalltalk.JSObjectProxy.comment="JSObjectProxy handles sending messages to JavaScript object, therefore accessing JavaScript objects from Amber is transparent.\x0aJSOjbectProxy makes intensive use of `#doesNotUnderstand:`.\x0a\x0a## 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\x0aSmalltalk 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`."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "addObjectVariablesTo:",
- category: 'proxy',
- fn: function (aDictionary){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- for(var i in self['@jsObject']) {
- aDictionary._at_put_(i, self['@jsObject'][i]);
- }
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:",{aDictionary:aDictionary},smalltalk.JSObjectProxy)})},
- args: ["aDictionary"],
- source: "addObjectVariablesTo: aDictionary\x0a\x09<\x0a\x09\x09for(var i in self['@jsObject']) {\x0a\x09\x09\x09aDictionary._at_put_(i, self['@jsObject'][i]);\x0a\x09\x09}\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.JSObjectProxy);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "at:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self['@jsObject'][aString];
- return self}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.JSObjectProxy)})},
- args: ["aString"],
- source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.JSObjectProxy);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "at:ifAbsent:",
- category: 'accessing',
- fn: function (aString,aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var obj = self['@jsObject'];
- return aString in obj ? obj[aString] : aBlock();
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},smalltalk.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();\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.JSObjectProxy);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "at:ifPresent:",
- category: 'accessing',
- fn: function (aString,aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var obj = self['@jsObject'];
- return aString in obj ? aBlock(obj[aString]) : nil;
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},smalltalk.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(obj[aString]) : nil;\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.JSObjectProxy);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "at:ifPresent:ifAbsent:",
- category: 'accessing',
- fn: function (aString,aBlock,anotherBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var obj = self['@jsObject'];
- return aString in obj ? aBlock(obj[aString]) : anotherBlock();
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.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(obj[aString]) : anotherBlock();\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.JSObjectProxy);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "at:put:",
- category: 'accessing',
- fn: function (aString,anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self['@jsObject'][aString] = anObject;
- return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},smalltalk.JSObjectProxy)})},
- args: ["aString", "anObject"],
- source: "at: aString put: anObject\x0a\x09<self['@jsObject'][aString] = anObject>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.JSObjectProxy);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "doesNotUnderstand:",
- category: 'proxy',
- fn: function (aMessage){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=_st(self)._lookupProperty_(_st(_st(aMessage)._selector())._asJavaScriptSelector());
- if(($receiver = $2) == nil || $receiver == undefined){
- $1=smalltalk.Object.fn.prototype._doesNotUnderstand_.apply(_st(self), [aMessage]);
- } else {
- var jsSelector;
- jsSelector=$receiver;
- $1=_st(self)._forwardMessage_withArguments_(jsSelector,_st(aMessage)._arguments());
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},smalltalk.JSObjectProxy)})},
- args: ["aMessage"],
- source: "doesNotUnderstand: aMessage\x0a\x09^ (self lookupProperty: aMessage selector asJavaScriptSelector)\x0a\x09\x09ifNil: [ super doesNotUnderstand: aMessage ]\x0a\x09\x09ifNotNil: [ :jsSelector | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09forwardMessage: jsSelector \x0a\x09\x09\x09\x09withArguments: aMessage arguments ]",
- messageSends: ["ifNil:ifNotNil:", "doesNotUnderstand:", "forwardMessage:withArguments:", "arguments", "lookupProperty:", "asJavaScriptSelector", "selector"],
- referencedClasses: []
- }),
- smalltalk.JSObjectProxy);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "forwardMessage:withArguments:",
- category: 'proxy',
- fn: function (aString,anArray){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return smalltalk.send(self._jsObject(), aString, anArray);
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:",{aString:aString,anArray:anArray},smalltalk.JSObjectProxy)})},
- args: ["aString", "anArray"],
- source: "forwardMessage: aString withArguments: anArray\x0a\x09<\x0a\x09\x09return smalltalk.send(self._jsObject(), aString, anArray);\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.JSObjectProxy);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "inspectOn:",
- category: 'proxy',
- fn: function (anInspector){
- var self=this;
- var variables;
- function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return smalltalk.withContext(function($ctx1) {
- variables=_st($Dictionary())._new();
- _st(variables)._at_put_("#self",_st(self)._jsObject());
- _st(anInspector)._setLabel_(_st(self)._printString());
- _st(self)._addObjectVariablesTo_(variables);
- _st(anInspector)._setVariables_(variables);
- return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},smalltalk.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\x09self addObjectVariablesTo: variables.\x0a\x09anInspector setVariables: variables",
- messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:", "setVariables:"],
- referencedClasses: ["Dictionary"]
- }),
- smalltalk.JSObjectProxy);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "jsObject",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@jsObject"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxy)})},
- args: [],
- source: "jsObject\x0a\x09^jsObject",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.JSObjectProxy);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "jsObject:",
- category: 'accessing',
- fn: function (aJSObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@jsObject"]=aJSObject;
- return self}, function($ctx1) {$ctx1.fill(self,"jsObject:",{aJSObject:aJSObject},smalltalk.JSObjectProxy)})},
- args: ["aJSObject"],
- source: "jsObject: aJSObject\x0a\x09jsObject := aJSObject",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.JSObjectProxy);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "keysAndValuesDo:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var o = self['@jsObject'];
- for(var i in o) {
- aBlock(i, o[i]);
- }
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},smalltalk.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(i, o[i]);\x0a\x09\x09}\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.JSObjectProxy);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "lookupProperty:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return aString in self._jsObject() ? aString : nil;
- return self}, function($ctx1) {$ctx1.fill(self,"lookupProperty:",{aString:aString},smalltalk.JSObjectProxy)})},
- args: ["aString"],
- source: "lookupProperty: aString\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 self._jsObject() ? aString : nil>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.JSObjectProxy);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "printOn:",
- category: 'printing',
- fn: function (aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(aStream)._nextPutAll_(_st(_st(self)._jsObject())._toString());
- return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.JSObjectProxy)})},
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09aStream nextPutAll: self jsObject toString",
- messageSends: ["nextPutAll:", "toString", "jsObject"],
- referencedClasses: []
- }),
- smalltalk.JSObjectProxy);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "value",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._at_ifAbsent_("value",(function(){
- return smalltalk.withContext(function($ctx2) {
- return smalltalk.Object.fn.prototype._value.apply(_st(self), []);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.JSObjectProxy)})},
- args: [],
- source: "value\x0a\x09\x22if attribute 'value' exists on the JS object return it,\x0a\x09otherwise return the result of Object>>value.\x22\x0a\x09\x0a\x09^ self \x0a\x09\x09at: 'value' \x0a\x09\x09ifAbsent: [ super value ]",
- messageSends: ["at:ifAbsent:", "value"],
- referencedClasses: []
- }),
- smalltalk.JSObjectProxy);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "on:",
- category: 'instance creation',
- fn: function (aJSObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st(self)._new();
- _st($2)._jsObject_(aJSObject);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject},smalltalk.JSObjectProxy.klass)})},
- args: ["aJSObject"],
- source: "on: aJSObject\x0a\x09^self new\x0a\x09\x09jsObject: aJSObject;\x0a\x09\x09yourself",
- messageSends: ["jsObject:", "new", "yourself"],
- referencedClasses: []
- }),
- smalltalk.JSObjectProxy.klass);
- smalltalk.addClass('Number', smalltalk.Object, [], 'Kernel-Objects');
- smalltalk.Number.comment="Number holds the most general methods for dealing with numbers.\x0aNumber is directly mapped to JavaScript Number.\x0a\x0aMost arithmetic methods like `#+` `#/` `#-` `#max:` are directly inlined into javascript.\x0a\x0a##Enumerating\x0aA Number can 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]."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "&",
- category: 'converting',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self & aNumber;
- return self}, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},smalltalk.Number)})},
- args: ["aNumber"],
- source: "& aNumber\x0a\x09<return self & aNumber>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "*",
- category: 'arithmetic',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self * aNumber;
- return self}, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},smalltalk.Number)})},
- args: ["aNumber"],
- source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "+",
- category: 'arithmetic',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self + aNumber;
- return self}, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},smalltalk.Number)})},
- args: ["aNumber"],
- source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "-",
- category: 'arithmetic',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self - aNumber;
- return self}, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},smalltalk.Number)})},
- args: ["aNumber"],
- source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "/",
- category: 'arithmetic',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self / aNumber;
- return self}, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},smalltalk.Number)})},
- args: ["aNumber"],
- source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "<",
- category: 'comparing',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self < aNumber;
- return self}, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},smalltalk.Number)})},
- args: ["aNumber"],
- source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "<=",
- category: 'comparing',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self <= aNumber;
- return self}, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},smalltalk.Number)})},
- args: ["aNumber"],
- source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "=",
- category: 'comparing',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- if(! aNumber._isNumber || ! aNumber._isNumber()) {
- return false;
- }
- return Number(self) == aNumber
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"=",{aNumber:aNumber},smalltalk.Number)})},
- args: ["aNumber"],
- source: "= aNumber\x0a\x09<\x0a\x09\x09if(! aNumber._isNumber || ! aNumber._isNumber()) {\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09return Number(self) == aNumber\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: ">",
- category: 'comparing',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self > aNumber;
- return self}, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},smalltalk.Number)})},
- args: ["aNumber"],
- source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: ">=",
- category: 'comparing',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self >= aNumber;
- return self}, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},smalltalk.Number)})},
- args: ["aNumber"],
- source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "@",
- category: 'converting',
- fn: function (aNumber){
- var self=this;
- function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st($Point())._x_y_(self,aNumber);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},smalltalk.Number)})},
- args: ["aNumber"],
- source: "@ aNumber\x0a\x09^Point x: self y: aNumber",
- messageSends: ["x:y:"],
- referencedClasses: ["Point"]
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "IsImmutable",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return true;
- }, function($ctx1) {$ctx1.fill(self,"IsImmutable",{},smalltalk.Number)})},
- args: [],
- source: "IsImmutable\x0a\x09^ true",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "\x5c\x5c",
- category: 'arithmetic',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self % aNumber;
- return self}, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},smalltalk.Number)})},
- args: ["aNumber"],
- source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "abs",
- category: 'arithmetic',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return Math.abs(self);;
- return self}, function($ctx1) {$ctx1.fill(self,"abs",{},smalltalk.Number)})},
- args: [],
- source: "abs\x0a\x09<return Math.abs(self);>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asJSON",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Number)})},
- args: [],
- source: "asJSON\x0a\x09^self",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asJavascript",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st("(").__comma(_st(self)._printString())).__comma(")");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Number)})},
- args: [],
- source: "asJavascript\x0a\x09^'(', self printString, ')'",
- messageSends: [",", "printString"],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asPoint",
- category: 'converting',
- fn: function (){
- var self=this;
- function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st($Point())._x_y_(self,self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asPoint",{},smalltalk.Number)})},
- args: [],
- source: "asPoint\x0a\x09^Point x: self y: self",
- messageSends: ["x:y:"],
- referencedClasses: ["Point"]
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asString",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return String(self) ;
- return self}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Number)})},
- args: [],
- source: "asString\x0a\x09< return String(self) >",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "atRandom",
- category: 'converting',
- fn: function (){
- var self=this;
- function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(_st(_st(_st($Random())._new())._next()).__star(self))._truncated()).__plus((1));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"atRandom",{},smalltalk.Number)})},
- args: [],
- source: "atRandom\x0a\x09^(Random new next * self) truncated + 1",
- messageSends: ["+", "truncated", "*", "next", "new"],
- referencedClasses: ["Random"]
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "copy",
- category: 'copying',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"copy",{},smalltalk.Number)})},
- args: [],
- source: "copy\x0a\x09^self",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "deepCopy",
- category: 'copying',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._copy();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.Number)})},
- args: [],
- source: "deepCopy\x0a\x09^self copy",
- messageSends: ["copy"],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "even",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st((0)).__eq(_st(self).__backslash_backslash((2)));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"even",{},smalltalk.Number)})},
- args: [],
- source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
- messageSends: ["=", "\x5c\x5c"],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "identityHash",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._asString()).__comma("n");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"identityHash",{},smalltalk.Number)})},
- args: [],
- source: "identityHash\x0a\x09^self asString, 'n'",
- messageSends: [",", "asString"],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isNumber",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return true;
- }, function($ctx1) {$ctx1.fill(self,"isNumber",{},smalltalk.Number)})},
- args: [],
- source: "isNumber\x0a\x09^true",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isZero",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self).__eq((0));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isZero",{},smalltalk.Number)})},
- args: [],
- source: "isZero\x0a\x09^self = 0",
- messageSends: ["="],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "max:",
- category: 'arithmetic',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return Math.max(self, aNumber);;
- return self}, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},smalltalk.Number)})},
- args: ["aNumber"],
- source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "min:",
- category: 'arithmetic',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return Math.min(self, aNumber);;
- return self}, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},smalltalk.Number)})},
- args: ["aNumber"],
- source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "negated",
- category: 'arithmetic',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st((0)).__minus(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"negated",{},smalltalk.Number)})},
- args: [],
- source: "negated\x0a\x09^0 - self",
- messageSends: ["-"],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "negative",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self).__lt((0));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"negative",{},smalltalk.Number)})},
- args: [],
- source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
- messageSends: ["<"],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "odd",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._even())._not();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"odd",{},smalltalk.Number)})},
- args: [],
- source: "odd\x0a\x09^ self even not",
- messageSends: ["not", "even"],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "positive",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self).__gt_eq((0));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"positive",{},smalltalk.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",
- messageSends: [">="],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "printOn:",
- category: 'printing',
- fn: function (aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(aStream)._nextPutAll_(_st(self)._asString());
- return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Number)})},
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
- messageSends: ["nextPutAll:", "asString"],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "printShowingDecimalPlaces:",
- category: 'printing',
- fn: function (placesDesired){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.toFixed(placesDesired);
- return self}, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},smalltalk.Number)})},
- args: ["placesDesired"],
- source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "rounded",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return Math.round(self);;
- return self}, function($ctx1) {$ctx1.fill(self,"rounded",{},smalltalk.Number)})},
- args: [],
- source: "rounded\x0a\x09<return Math.round(self);>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "sqrt",
- category: 'arithmetic',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return Math.sqrt(self);
- return self}, function($ctx1) {$ctx1.fill(self,"sqrt",{},smalltalk.Number)})},
- args: [],
- source: "sqrt\x0a\x09<return Math.sqrt(self)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "squared",
- category: 'arithmetic',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self).__star(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"squared",{},smalltalk.Number)})},
- args: [],
- source: "squared\x0a\x09^self * self",
- messageSends: ["*"],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "timesRepeat:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- var count;
- return smalltalk.withContext(function($ctx1) {
- count=(1);
- _st((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(count).__gt(self);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
- return smalltalk.withContext(function($ctx2) {
- _st(aBlock)._value();
- count=_st(count).__plus((1));
- return count;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},smalltalk.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]",
- messageSends: ["whileFalse:", "value", "+", ">"],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "to:",
- category: 'converting',
- fn: function (aNumber){
- var self=this;
- var array,first,last,count;
- function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- first=_st(self)._truncated();
- last=_st(_st(aNumber)._truncated()).__plus((1));
- count=(1);
- array=_st($Array())._new();
- _st(_st(last).__minus(first))._timesRepeat_((function(){
- return smalltalk.withContext(function($ctx2) {
- _st(array)._at_put_(count,first);
- count=_st(count).__plus((1));
- count;
- first=_st(first).__plus((1));
- return first;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- $1=array;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},smalltalk.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",
- messageSends: ["truncated", "+", "new", "timesRepeat:", "at:put:", "-"],
- referencedClasses: ["Array"]
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "to:by:",
- category: 'converting',
- fn: function (stop,step){
- var self=this;
- var array,value,pos;
- function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3;
- value=self;
- array=_st($Array())._new();
- pos=(1);
- $1=_st(step).__eq((0));
- if(smalltalk.assert($1)){
- _st(self)._error_("step must be non-zero");
- };
- $2=_st(step).__lt((0));
- if(smalltalk.assert($2)){
- _st((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(value).__gt_eq(stop);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
- return smalltalk.withContext(function($ctx2) {
- _st(array)._at_put_(pos,value);
- pos=_st(pos).__plus((1));
- pos;
- value=_st(value).__plus(step);
- return value;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- } else {
- _st((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(value).__lt_eq(stop);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
- return smalltalk.withContext(function($ctx2) {
- _st(array)._at_put_(pos,value);
- pos=_st(pos).__plus((1));
- pos;
- value=_st(value).__plus(step);
- return value;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- };
- $3=array;
- return $3;
- }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},smalltalk.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",
- messageSends: ["new", "ifTrue:", "error:", "=", "ifTrue:ifFalse:", "whileTrue:", "at:put:", "+", ">=", "<=", "<"],
- referencedClasses: ["Array"]
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "to:by:do:",
- category: 'enumerating',
- fn: function (stop,step,aBlock){
- var self=this;
- var value;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- value=self;
- $1=_st(step).__eq((0));
- if(smalltalk.assert($1)){
- _st(self)._error_("step must be non-zero");
- };
- $2=_st(step).__lt((0));
- if(smalltalk.assert($2)){
- _st((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(value).__gt_eq(stop);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
- return smalltalk.withContext(function($ctx2) {
- _st(aBlock)._value_(value);
- value=_st(value).__plus(step);
- return value;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- } else {
- _st((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(value).__lt_eq(stop);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
- return smalltalk.withContext(function($ctx2) {
- _st(aBlock)._value_(value);
- value=_st(value).__plus(step);
- return value;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- };
- return self}, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},smalltalk.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]]",
- messageSends: ["ifTrue:", "error:", "=", "ifTrue:ifFalse:", "whileTrue:", "value:", "+", ">=", "<=", "<"],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "to:do:",
- category: 'enumerating',
- fn: function (stop,aBlock){
- var self=this;
- var nextValue;
- return smalltalk.withContext(function($ctx1) {
- nextValue=self;
- _st((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(nextValue).__lt_eq(stop);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
- return smalltalk.withContext(function($ctx2) {
- _st(aBlock)._value_(nextValue);
- nextValue=_st(nextValue).__plus((1));
- return nextValue;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},smalltalk.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]",
- messageSends: ["whileTrue:", "value:", "+", "<="],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "truncated",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.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",{},smalltalk.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>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "|",
- category: 'converting',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self | aNumber;
- return self}, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},smalltalk.Number)})},
- args: ["aNumber"],
- source: "| aNumber\x0a\x09<return self | aNumber>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "pi",
- category: 'instance creation',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return Math.PI;
- return self}, function($ctx1) {$ctx1.fill(self,"pi",{},smalltalk.Number.klass)})},
- args: [],
- source: "pi\x0a\x09<return Math.PI>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Number.klass);
- smalltalk.addClass('Organizer', smalltalk.Object, [], 'Kernel-Objects');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "addElement:",
- category: 'accessing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self.elements.addElement(anObject);
- return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},smalltalk.Organizer)})},
- args: ["anObject"],
- source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Organizer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "elements",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._basicAt_("elements"))._copy();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"elements",{},smalltalk.Organizer)})},
- args: [],
- source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
- messageSends: ["copy", "basicAt:"],
- referencedClasses: []
- }),
- smalltalk.Organizer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "removeElement:",
- category: 'accessing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self.elements.removeElement(anObject);
- return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},smalltalk.Organizer)})},
- args: ["anObject"],
- source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Organizer);
- smalltalk.addClass('ClassOrganizer', smalltalk.Organizer, [], 'Kernel-Objects');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "addElement:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- function $ProtocolAdded(){return smalltalk.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)}
- function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- smalltalk.Organizer.fn.prototype._addElement_.apply(_st(self), [aString]);
- $1=_st($ProtocolAdded())._new();
- _st($1)._protocol_(aString);
- _st($1)._theClass_(_st(self)._theClass());
- $2=_st($1)._yourself();
- _st(_st($SystemAnnouncer())._current())._announce_($2);
- return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},smalltalk.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)",
- messageSends: ["addElement:", "announce:", "protocol:", "new", "theClass:", "theClass", "yourself", "current"],
- referencedClasses: ["ProtocolAdded", "SystemAnnouncer"]
- }),
- smalltalk.ClassOrganizer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "removeElement:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- function $ProtocolRemoved(){return smalltalk.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)}
- function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- smalltalk.Organizer.fn.prototype._removeElement_.apply(_st(self), [aString]);
- $1=_st($ProtocolRemoved())._new();
- _st($1)._protocol_(aString);
- _st($1)._theClass_(_st(self)._theClass());
- $2=_st($1)._yourself();
- _st(_st($SystemAnnouncer())._current())._announce_($2);
- return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},smalltalk.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)",
- messageSends: ["removeElement:", "announce:", "protocol:", "new", "theClass:", "theClass", "yourself", "current"],
- referencedClasses: ["ProtocolRemoved", "SystemAnnouncer"]
- }),
- smalltalk.ClassOrganizer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "theClass",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.theClass ;
- return self}, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ClassOrganizer)})},
- args: [],
- source: "theClass\x0a\x09< return self.theClass >",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ClassOrganizer);
- smalltalk.addClass('PackageOrganizer', smalltalk.Organizer, [], 'Kernel-Objects');
- smalltalk.addClass('Package', smalltalk.Object, ['commitPathJs', 'commitPathSt'], 'Kernel-Objects');
- smalltalk.Package.comment="A Package is 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\x0aA Package has a name, an Array of \x22requires\x22, a comment and a Dictionary with other optional key value attributes. A Package can also be queried for its classes, but it will then resort to a reverse scan of all classes to find them.\x0aPackages are manipulated through \x22Smalltalk current\x22, like for example finding one based on a name:\x0a\x0a\x09Smalltalk current packageAt: 'Kernel'\x0a\x0a...but you can also use:\x0a\x0a\x09Package 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\x0acan 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. This can easily be seen in for example class\x0aString where the method category \x22*IDE\x22 defines #inspectOn: which thus is a method belonging to the IDE package.\x0a\x0aYou can fetch a package from the server:\x0a\x0a\x09Package fetch: 'Additional-Examples'"
- smalltalk.addMethod(
- smalltalk.method({
- selector: "classes",
- category: 'classes',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._organization())._elements();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Package)})},
- args: [],
- source: "classes\x0a\x09^ self organization elements",
- messageSends: ["elements", "organization"],
- referencedClasses: []
- }),
- smalltalk.Package);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commitPathJs",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@commitPathJs"];
- if(($receiver = $2) == nil || $receiver == undefined){
- $1=_st(_st(self)._class())._defaultCommitPathJs();
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"commitPathJs",{},smalltalk.Package)})},
- args: [],
- source: "commitPathJs\x0a\x09^ commitPathJs ifNil: [self class defaultCommitPathJs]",
- messageSends: ["ifNil:", "defaultCommitPathJs", "class"],
- referencedClasses: []
- }),
- smalltalk.Package);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commitPathJs:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@commitPathJs"]=aString;
- return self}, function($ctx1) {$ctx1.fill(self,"commitPathJs:",{aString:aString},smalltalk.Package)})},
- args: ["aString"],
- source: "commitPathJs: aString\x0a\x09commitPathJs := aString",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Package);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commitPathSt",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@commitPathSt"];
- if(($receiver = $2) == nil || $receiver == undefined){
- $1=_st(_st(self)._class())._defaultCommitPathSt();
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"commitPathSt",{},smalltalk.Package)})},
- args: [],
- source: "commitPathSt\x0a\x09^ commitPathSt ifNil: [self class defaultCommitPathSt]",
- messageSends: ["ifNil:", "defaultCommitPathSt", "class"],
- referencedClasses: []
- }),
- smalltalk.Package);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commitPathSt:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@commitPathSt"]=aString;
- return self}, function($ctx1) {$ctx1.fill(self,"commitPathSt:",{aString:aString},smalltalk.Package)})},
- args: ["aString"],
- source: "commitPathSt: aString\x0a\x09commitPathSt := aString",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Package);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isPackage",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return true;
- }, function($ctx1) {$ctx1.fill(self,"isPackage",{},smalltalk.Package)})},
- args: [],
- source: "isPackage\x0a\x09^ true",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Package);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "name",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.pkgName;
- return self}, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.Package)})},
- args: [],
- source: "name\x0a\x09<return self.pkgName>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Package);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "name:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self.pkgName = aString;
- return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.Package)})},
- args: ["aString"],
- source: "name: aString\x0a\x09<self.pkgName = aString>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Package);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "organization",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._basicAt_("organization");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"organization",{},smalltalk.Package)})},
- args: [],
- source: "organization\x0a\x09^ self basicAt: 'organization'",
- messageSends: ["basicAt:"],
- referencedClasses: []
- }),
- smalltalk.Package);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "printOn:",
- category: 'printing',
- fn: function (aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- smalltalk.Object.fn.prototype._printOn_.apply(_st(self), [aStream]);
- $1=aStream;
- _st($1)._nextPutAll_(" (");
- _st($1)._nextPutAll_(_st(self)._name());
- $2=_st($1)._nextPutAll_(")");
- return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Package)})},
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
- messageSends: ["printOn:", "nextPutAll:", "name"],
- referencedClasses: []
- }),
- smalltalk.Package);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "setupClasses",
- category: 'classes',
- fn: function (){
- var self=this;
- function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=_st(self)._classes();
- _st($1)._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st($ClassBuilder())._new())._setupClass_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- $2=_st($1)._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(each)._initialize();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"setupClasses",{},smalltalk.Package)})},
- args: [],
- source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
- messageSends: ["do:", "setupClass:", "new", "classes", "initialize"],
- referencedClasses: ["ClassBuilder"]
- }),
- smalltalk.Package);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "sortedClasses",
- category: 'classes',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._class())._sortedClasses_(_st(self)._classes());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},smalltalk.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",
- messageSends: ["sortedClasses:", "classes", "class"],
- referencedClasses: []
- }),
- smalltalk.Package);
- smalltalk.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commitPathsFromLoader",
- category: 'commit paths',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var commitPath = typeof amber !== 'undefined' && amber.commitPath;
- if (!commitPath) return;
- if (commitPath.js) self._defaultCommitPathJs_(commitPath.js);
- if (commitPath.st) self._defaultCommitPathSt_(commitPath.st);
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"commitPathsFromLoader",{},smalltalk.Package.klass)})},
- args: [],
- source: "commitPathsFromLoader\x0a\x09<\x0a\x09\x09var commitPath = typeof amber !== 'undefined' && amber.commitPath;\x0a\x09\x09if (!commitPath) return;\x0a\x09\x09if (commitPath.js) self._defaultCommitPathJs_(commitPath.js);\x0a\x09\x09if (commitPath.st) self._defaultCommitPathSt_(commitPath.st);\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Package.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "defaultCommitPathJs",
- category: 'commit paths',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@defaultCommitPathJs"];
- if(($receiver = $2) == nil || $receiver == undefined){
- self["@defaultCommitPathJs"]="js";
- $1=self["@defaultCommitPathJs"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs",{},smalltalk.Package.klass)})},
- args: [],
- source: "defaultCommitPathJs\x0a\x09^ defaultCommitPathJs ifNil: [ defaultCommitPathJs := 'js']",
- messageSends: ["ifNil:"],
- referencedClasses: []
- }),
- smalltalk.Package.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "defaultCommitPathJs:",
- category: 'commit paths',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@defaultCommitPathJs"]=aString;
- return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs:",{aString:aString},smalltalk.Package.klass)})},
- args: ["aString"],
- source: "defaultCommitPathJs: aString\x0a\x09defaultCommitPathJs := aString",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Package.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "defaultCommitPathSt",
- category: 'commit paths',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@defaultCommitPathSt"];
- if(($receiver = $2) == nil || $receiver == undefined){
- self["@defaultCommitPathSt"]="st";
- $1=self["@defaultCommitPathSt"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt",{},smalltalk.Package.klass)})},
- args: [],
- source: "defaultCommitPathSt\x0a\x09^ defaultCommitPathSt ifNil: [ defaultCommitPathSt := 'st']",
- messageSends: ["ifNil:"],
- referencedClasses: []
- }),
- smalltalk.Package.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "defaultCommitPathSt:",
- category: 'commit paths',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@defaultCommitPathSt"]=aString;
- return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt:",{aString:aString},smalltalk.Package.klass)})},
- args: ["aString"],
- source: "defaultCommitPathSt: aString\x0a\x09defaultCommitPathSt := aString",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Package.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "initialize",
- category: 'initialization',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- smalltalk.Object.klass.fn.prototype._initialize.apply(_st(self), []);
- _st(self)._commitPathsFromLoader();
- return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Package.klass)})},
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09self commitPathsFromLoader",
- messageSends: ["initialize", "commitPathsFromLoader"],
- referencedClasses: []
- }),
- smalltalk.Package.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "load:",
- category: 'loading-storing',
- fn: function (aPackageName){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._load_prefix_(aPackageName,_st(_st(self)._defaultCommitPathJs()).__comma("/"));
- return self}, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},smalltalk.Package.klass)})},
- args: ["aPackageName"],
- source: "load: aPackageName\x0a\x09self load: aPackageName prefix: self defaultCommitPathJs, '/'",
- messageSends: ["load:prefix:", ",", "defaultCommitPathJs"],
- referencedClasses: []
- }),
- smalltalk.Package.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "load:prefix:",
- category: 'loading-storing',
- fn: function (aPackageName,aPrefix){
- var self=this;
- function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
- return smalltalk.withContext(function($ctx1) {
- _st(jQuery)._getScript_onSuccess_(_st(_st(aPrefix).__comma(aPackageName)).__comma(".js"),(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st($Package())._named_(aPackageName))._setupClasses();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"load:prefix:",{aPackageName:aPackageName,aPrefix:aPrefix},smalltalk.Package.klass)})},
- args: ["aPackageName", "aPrefix"],
- source: "load: aPackageName prefix: aPrefix\x0a\x09jQuery\x0a\x09\x09getScript: (aPrefix , aPackageName , '.js')\x0a\x09\x09onSuccess: [\x0a\x09\x09\x09(Package named: aPackageName) setupClasses ]",
- messageSends: ["getScript:onSuccess:", ",", "setupClasses", "named:"],
- referencedClasses: ["Package"]
- }),
- smalltalk.Package.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "named:",
- category: 'accessing',
- fn: function (aPackageName){
- var self=this;
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st($Smalltalk())._current())._packageAt_(aPackageName);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},smalltalk.Package.klass)})},
- args: ["aPackageName"],
- source: "named: aPackageName\x0a\x0a\x09^Smalltalk current packageAt: aPackageName",
- messageSends: ["packageAt:", "current"],
- referencedClasses: ["Smalltalk"]
- }),
- smalltalk.Package.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "named:ifAbsent:",
- category: 'accessing',
- fn: function (aPackageName,aBlock){
- var self=this;
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st($Smalltalk())._current())._packageAt_ifAbsent_(aPackageName,aBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},smalltalk.Package.klass)})},
- args: ["aPackageName", "aBlock"],
- source: "named: aPackageName ifAbsent: aBlock\x0a\x0a\x09^Smalltalk current packageAt: aPackageName ifAbsent: aBlock",
- messageSends: ["packageAt:ifAbsent:", "current"],
- referencedClasses: ["Smalltalk"]
- }),
- smalltalk.Package.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "resetCommitPaths",
- category: 'commit paths',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@defaultCommitPathJs"]=nil;
- self["@defaultCommitPathSt"]=nil;
- return self}, function($ctx1) {$ctx1.fill(self,"resetCommitPaths",{},smalltalk.Package.klass)})},
- args: [],
- source: "resetCommitPaths\x0a\x09\x09defaultCommitPathJs := nil.\x0a\x09\x09defaultCommitPathSt := nil.",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Package.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "sortedClasses:",
- category: 'sorting',
- fn: function (classes){
- var self=this;
- var children,others,nodes,expandedClasses;
- function $ClassSorterNode(){return smalltalk.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
- function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- children=[];
- others=[];
- _st(classes)._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- $1=_st(classes)._includes_(_st(each)._superclass());
- if(smalltalk.assert($1)){
- return _st(others)._add_(each);
- } else {
- return _st(children)._add_(each);
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- nodes=_st(children)._collect_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st($ClassSorterNode())._on_classes_level_(each,others,(0));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- nodes=_st(nodes)._sorted_((function(a,b){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(_st(a)._theClass())._name()).__lt_eq(_st(_st(b)._theClass())._name());
- }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}));
- expandedClasses=_st($Array())._new();
- _st(nodes)._do_((function(aNode){
- return smalltalk.withContext(function($ctx2) {
- return _st(aNode)._traverseClassesWith_(expandedClasses);
- }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1)})}));
- $2=expandedClasses;
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},smalltalk.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",
- messageSends: ["do:", "ifFalse:ifTrue:", "add:", "includes:", "superclass", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"],
- referencedClasses: ["ClassSorterNode", "Array"]
- }),
- smalltalk.Package.klass);
- smalltalk.addClass('Point', smalltalk.Object, ['x', 'y'], 'Kernel-Objects');
- smalltalk.Point.comment="A `Point` represents an x-y pair of numbers usually designating a geometric coordinate.\x0aPoints 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\x0a\x0aAmber does not have much behavior in this class out-of-the-box."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "*",
- category: 'arithmetic',
- fn: function (aPoint){
- var self=this;
- function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st($Point())._x_y_(_st(_st(self)._x()).__star(_st(_st(aPoint)._asPoint())._x()),_st(_st(self)._y()).__star(_st(_st(aPoint)._asPoint())._y()));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},smalltalk.Point)})},
- args: ["aPoint"],
- source: "* aPoint\x0a\x09^Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
- messageSends: ["x:y:", "*", "x", "asPoint", "y"],
- referencedClasses: ["Point"]
- }),
- smalltalk.Point);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "+",
- category: 'arithmetic',
- fn: function (aPoint){
- var self=this;
- function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st($Point())._x_y_(_st(_st(self)._x()).__plus(_st(_st(aPoint)._asPoint())._x()),_st(_st(self)._y()).__plus(_st(_st(aPoint)._asPoint())._y()));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},smalltalk.Point)})},
- args: ["aPoint"],
- source: "+ aPoint\x0a\x09^Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
- messageSends: ["x:y:", "+", "x", "asPoint", "y"],
- referencedClasses: ["Point"]
- }),
- smalltalk.Point);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "-",
- category: 'arithmetic',
- fn: function (aPoint){
- var self=this;
- function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st($Point())._x_y_(_st(_st(self)._x()).__minus(_st(_st(aPoint)._asPoint())._x()),_st(_st(self)._y()).__minus(_st(_st(aPoint)._asPoint())._y()));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},smalltalk.Point)})},
- args: ["aPoint"],
- source: "- aPoint\x0a\x09^Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
- messageSends: ["x:y:", "-", "x", "asPoint", "y"],
- referencedClasses: ["Point"]
- }),
- smalltalk.Point);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "/",
- category: 'arithmetic',
- fn: function (aPoint){
- var self=this;
- function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st($Point())._x_y_(_st(_st(self)._x()).__slash(_st(_st(aPoint)._asPoint())._x()),_st(_st(self)._y()).__slash(_st(_st(aPoint)._asPoint())._y()));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},smalltalk.Point)})},
- args: ["aPoint"],
- source: "/ aPoint\x0a\x09^Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
- messageSends: ["x:y:", "/", "x", "asPoint", "y"],
- referencedClasses: ["Point"]
- }),
- smalltalk.Point);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "=",
- category: 'arithmetic',
- fn: function (aPoint){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(_st(aPoint)._class()).__eq(_st(self)._class()))._and_((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(_st(aPoint)._x()).__eq(_st(self)._x())).__and(_st(_st(aPoint)._y()).__eq(_st(self)._y()));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},smalltalk.Point)})},
- args: ["aPoint"],
- source: "= aPoint\x0a\x09^aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y)]",
- messageSends: ["and:", "&", "=", "y", "x", "class"],
- referencedClasses: []
- }),
- smalltalk.Point);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asPoint",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asPoint",{},smalltalk.Point)})},
- args: [],
- source: "asPoint\x0a\x09^self",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Point);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "printOn:",
- category: 'printing',
- fn: function (aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- _st(self["@x"])._printOn_(aStream);
- _st(aStream)._nextPutAll_("@");
- $1=_st(_st(self["@y"])._notNil())._and_((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(self["@y"])._negative();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- if(smalltalk.assert($1)){
- _st(aStream)._space();
- };
- _st(self["@y"])._printOn_(aStream);
- return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.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",
- messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "space", "and:", "negative", "notNil"],
- referencedClasses: []
- }),
- smalltalk.Point);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "translateBy:",
- category: 'transforming',
- fn: function (delta){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(_st(delta)._x()).__plus(self["@x"])).__at(_st(_st(delta)._y()).__plus(self["@y"]));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},smalltalk.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)",
- messageSends: ["@", "+", "y", "x"],
- referencedClasses: []
- }),
- smalltalk.Point);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "x",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@x"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"x",{},smalltalk.Point)})},
- args: [],
- source: "x\x0a\x09^x",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Point);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "x:",
- category: 'accessing',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@x"]=aNumber;
- return self}, function($ctx1) {$ctx1.fill(self,"x:",{aNumber:aNumber},smalltalk.Point)})},
- args: ["aNumber"],
- source: "x: aNumber\x0a\x09x := aNumber",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Point);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "y",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@y"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"y",{},smalltalk.Point)})},
- args: [],
- source: "y\x0a\x09^y",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Point);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "y:",
- category: 'accessing',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@y"]=aNumber;
- return self}, function($ctx1) {$ctx1.fill(self,"y:",{aNumber:aNumber},smalltalk.Point)})},
- args: ["aNumber"],
- source: "y: aNumber\x0a\x09y := aNumber",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Point);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "x:y:",
- category: 'instance creation',
- fn: function (aNumber,anotherNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st(self)._new();
- _st($2)._x_(aNumber);
- _st($2)._y_(anotherNumber);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},smalltalk.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",
- messageSends: ["x:", "new", "y:", "yourself"],
- referencedClasses: []
- }),
- smalltalk.Point.klass);
- smalltalk.addClass('Random', smalltalk.Object, [], 'Kernel-Objects');
- smalltalk.Random.comment="`Random` is a random number generator and is implemented as a trivial wrapper around javascript `Math.random()` and is used like this:\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\x0a...and if you want a random number in a specific interval this also works:\x0a\x0a\x09(3 to: 7) atRandom\x0a\x0a...but be 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\x0a...or perhaps a 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'`."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "next",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return Math.random();
- return self}, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.Random)})},
- args: [],
- source: "next\x0a\x09<return Math.random()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Random);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "next:",
- category: 'accessing',
- fn: function (anInteger){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st((1))._to_(anInteger))._collect_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(self)._next();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},smalltalk.Random)})},
- args: ["anInteger"],
- source: "next: anInteger\x0a\x09^(1 to: anInteger) collect: [:each | self next]",
- messageSends: ["collect:", "next", "to:"],
- referencedClasses: []
- }),
- smalltalk.Random);
- smalltalk.addClass('Smalltalk', smalltalk.Object, [], 'Kernel-Objects');
- smalltalk.Smalltalk.comment="Smalltalk has only one instance, accessed with `Smalltalk current`.\x0aIt represents the global JavaScript variable `smalltalk` declared in `js/boot.js`.\x0a\x0aThe `smalltalk` object holds all class and packages defined in the system.\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- `#at:` answers a specific class of `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 class of `nil`\x0a\x0a__note:__ classes and packages are accessed using strings, not symbols\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Smalltalk source code.\x0aIt requires the `Compiler` package and the `js/parser.js` parser file in order to work"
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asSmalltalkException:",
- category: 'error handling',
- fn: function (anObject){
- var self=this;
- function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
- function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=_st(_st(self)._isSmalltalkObject_(anObject))._and_((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(anObject)._isKindOf_($Error());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- if(smalltalk.assert($2)){
- $1=anObject;
- } else {
- $1=_st($JavaScriptException())._on_(anObject);
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},smalltalk.Smalltalk)})},
- 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 ]",
- messageSends: ["ifTrue:ifFalse:", "on:", "and:", "isKindOf:", "isSmalltalkObject:"],
- referencedClasses: ["JavaScriptException", "Error"]
- }),
- smalltalk.Smalltalk);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "at:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self[aString];
- return self}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.Smalltalk)})},
- args: ["aString"],
- source: "at: aString\x0a\x09<return self[aString]>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Smalltalk);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "basicParse:",
- category: 'private',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return smalltalk.parser.parse(aString);
- return self}, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},smalltalk.Smalltalk)})},
- args: ["aString"],
- source: "basicParse: aString\x0a\x09<return smalltalk.parser.parse(aString)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Smalltalk);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "classes",
- category: 'classes',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.classes();
- return self}, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Smalltalk)})},
- args: [],
- source: "classes\x0a\x09<return self.classes()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Smalltalk);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "createPackage:",
- category: 'packages',
- fn: function (packageName){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return smalltalk.addPackage(packageName);
- return self}, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName},smalltalk.Smalltalk)})},
- args: ["packageName"],
- source: "createPackage: packageName\x0a\x09\x22Create and bind a new package with given name and return it.\x22\x0a\x09<return smalltalk.addPackage(packageName)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Smalltalk);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "createPackage:properties:",
- category: 'private',
- fn: function (packageName,aDict){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- _st(self)._deprecatedAPI();
- $1=_st(aDict)._isEmpty();
- if(! smalltalk.assert($1)){
- _st(self)._error_("createPackage:properties: called with nonempty properties");
- };
- $2=_st(self)._createPackage_(packageName);
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"createPackage:properties:",{packageName:packageName,aDict:aDict},smalltalk.Smalltalk)})},
- args: ["packageName", "aDict"],
- source: "createPackage: packageName properties: aDict\x0a\x09\x22Needed to import .st files: they begin with this call.\x22\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09aDict isEmpty ifFalse: [ self error: 'createPackage:properties: called with nonempty properties' ].\x0a\x09^ self createPackage: packageName",
- messageSends: ["deprecatedAPI", "ifFalse:", "error:", "isEmpty", "createPackage:"],
- referencedClasses: []
- }),
- smalltalk.Smalltalk);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "deleteClass:",
- category: 'classes',
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self.removeClass(aClass);
- return self}, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},smalltalk.Smalltalk)})},
- args: ["aClass"],
- source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<self.removeClass(aClass)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Smalltalk);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "deletePackage:",
- category: 'packages',
- fn: function (packageName){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- delete smalltalk.packages[packageName];
- return self}, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},smalltalk.Smalltalk)})},
- 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 smalltalk.packages[packageName]>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Smalltalk);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isSmalltalkObject:",
- category: 'testing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return typeof anObject.klass !== 'undefined';
- return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},smalltalk.Smalltalk)})},
- 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 typeof anObject.klass !== 'undefined'>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Smalltalk);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "packageAt:",
- category: 'packages',
- fn: function (packageName){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.packages[packageName];
- return self}, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},smalltalk.Smalltalk)})},
- args: ["packageName"],
- source: "packageAt: packageName\x0a\x09<return self.packages[packageName]>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Smalltalk);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "packageAt:ifAbsent:",
- category: 'packages',
- fn: function (packageName,aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=_st(self)._packageAt_(packageName);
- $1=_st($2)._ifNil_(aBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},smalltalk.Smalltalk)})},
- args: ["packageName", "aBlock"],
- source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^(self packageAt: packageName) ifNil: aBlock",
- messageSends: ["ifNil:", "packageAt:"],
- referencedClasses: []
- }),
- smalltalk.Smalltalk);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "packages",
- category: 'packages',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.packages.all();
- return self}, function($ctx1) {$ctx1.fill(self,"packages",{},smalltalk.Smalltalk)})},
- args: [],
- source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<return self.packages.all()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Smalltalk);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "parse:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- var result;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- _st(self)._try_catch_((function(){
- return smalltalk.withContext(function($ctx2) {
- result=_st(self)._basicParse_(aString);
- return result;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(ex){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(self)._parseError_parsing_(ex,aString))._signal();
- }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})}));
- $1=result;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},smalltalk.Smalltalk)})},
- args: ["aString"],
- source: "parse: aString\x0a\x09| result |\x0a\x09self try: [result := self basicParse: aString] catch: [:ex | (self parseError: ex parsing: aString) signal].\x0a\x09^result",
- messageSends: ["try:catch:", "basicParse:", "signal", "parseError:parsing:"],
- referencedClasses: []
- }),
- smalltalk.Smalltalk);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "parseError:parsing:",
- category: 'error handling',
- fn: function (anException,aString){
- var self=this;
- function $ParseError(){return smalltalk.ParseError||(typeof ParseError=="undefined"?nil:ParseError)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st($ParseError())._new())._messageText_(_st(_st(_st(_st(_st("Parse error on line ").__comma(_st(anException)._basicAt_("line"))).__comma(" column ")).__comma(_st(anException)._basicAt_("column"))).__comma(" : Unexpected character ")).__comma(_st(anException)._basicAt_("found")));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},smalltalk.Smalltalk)})},
- 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')",
- messageSends: ["messageText:", ",", "basicAt:", "new"],
- referencedClasses: ["ParseError"]
- }),
- smalltalk.Smalltalk);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "pseudoVariableNames",
- category: 'packages',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=["self", "super", "nil", "true", "false", "thisContext"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"pseudoVariableNames",{},smalltalk.Smalltalk)})},
- args: [],
- source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Smalltalk);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "readJSObject:",
- category: 'accessing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.readJSObject(anObject);
- return self}, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},smalltalk.Smalltalk)})},
- args: ["anObject"],
- source: "readJSObject: anObject\x0a\x09<return self.readJSObject(anObject)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Smalltalk);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "removeClass:",
- category: 'classes',
- fn: function (aClass){
- var self=this;
- function $ClassRemoved(){return smalltalk.ClassRemoved||(typeof ClassRemoved=="undefined"?nil:ClassRemoved)}
- function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3;
- $1=_st(aClass)._isMetaclass();
- if(smalltalk.assert($1)){
- _st(self)._error_(_st(_st(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
- };
- _st(self)._deleteClass_(aClass);
- $2=_st($ClassRemoved())._new();
- _st($2)._theClass_(aClass);
- $3=_st($2)._yourself();
- _st(_st($SystemAnnouncer())._current())._announce_($3);
- return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},smalltalk.Smalltalk)})},
- 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)",
- messageSends: ["ifTrue:", "error:", ",", "asString", "isMetaclass", "deleteClass:", "announce:", "theClass:", "new", "yourself", "current"],
- referencedClasses: ["ClassRemoved", "SystemAnnouncer"]
- }),
- smalltalk.Smalltalk);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "removePackage:",
- category: 'packages',
- fn: function (packageName){
- var self=this;
- var pkg;
- return smalltalk.withContext(function($ctx1) {
- pkg=_st(self)._packageAt_ifAbsent_(packageName,(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(self)._error_(_st("Missing package: ").__comma(packageName));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- _st(_st(pkg)._classes())._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(self)._removeClass_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- _st(self)._deletePackage_(packageName);
- return self}, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},smalltalk.Smalltalk)})},
- 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",
- messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "removeClass:", "classes", "deletePackage:"],
- referencedClasses: []
- }),
- smalltalk.Smalltalk);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "renamePackage:to:",
- category: 'packages',
- fn: function (packageName,newName){
- var self=this;
- var pkg;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- pkg=_st(self)._packageAt_ifAbsent_(packageName,(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(self)._error_(_st("Missing package: ").__comma(packageName));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- $1=_st(self)._packageAt_(newName);
- if(($receiver = $1) == nil || $receiver == undefined){
- $1;
- } else {
- _st(self)._error_(_st("Already exists a package called: ").__comma(newName));
- };
- _st(_st(self)._basicAt_("packages"))._at_put_(newName,pkg);
- _st(pkg)._name_(newName);
- _st(self)._deletePackage_(packageName);
- return self}, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},smalltalk.Smalltalk)})},
- 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\x09(self basicAt: 'packages') at: newName put: pkg.\x0a\x09pkg name: newName.\x0a\x09self deletePackage: packageName.",
- messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "at:put:", "basicAt:", "name:", "deletePackage:"],
- referencedClasses: []
- }),
- smalltalk.Smalltalk);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "reservedWords",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.reservedWords;
- return self}, function($ctx1) {$ctx1.fill(self,"reservedWords",{},smalltalk.Smalltalk)})},
- args: [],
- source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return self.reservedWords>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Smalltalk);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "version",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return "0.10";
- }, function($ctx1) {$ctx1.fill(self,"version",{},smalltalk.Smalltalk)})},
- args: [],
- source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.10'",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Smalltalk);
- smalltalk.Smalltalk.klass.iVarNames = ['current'];
- smalltalk.addMethod(
- smalltalk.method({
- selector: "current",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return smalltalk;
- return self}, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.Smalltalk.klass)})},
- args: [],
- source: "current\x0a\x09<return smalltalk>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Smalltalk.klass);
- smalltalk.addClass('Timeout', smalltalk.Object, ['rawTimeout'], 'Kernel-Objects');
- smalltalk.Timeout.comment="I am wrapping the returns from set{Timeout,Interval}.\x0a\x0aNumber suffices in browsers, but node.js returns an object."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "clearInterval",
- category: 'timeout/interval',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var interval = self["@rawTimeout"];
- clearInterval(interval);
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"clearInterval",{},smalltalk.Timeout)})},
- args: [],
- source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Timeout);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "clearTimeout",
- category: 'timeout/interval',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var timeout = self["@rawTimeout"];
- clearTimeout(timeout);
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},smalltalk.Timeout)})},
- args: [],
- source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Timeout);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "rawTimeout:",
- category: 'accessing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@rawTimeout"]=anObject;
- return self}, function($ctx1) {$ctx1.fill(self,"rawTimeout:",{anObject:anObject},smalltalk.Timeout)})},
- args: ["anObject"],
- source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Timeout);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "on:",
- category: 'instance creation',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st(self)._new();
- _st($2)._rawTimeout_(anObject);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},smalltalk.Timeout.klass)})},
- args: ["anObject"],
- source: "on: anObject\x0a\x09^self new rawTimeout: anObject; yourself",
- messageSends: ["rawTimeout:", "new", "yourself"],
- referencedClasses: []
- }),
- smalltalk.Timeout.klass);
- smalltalk.addClass('UndefinedObject', smalltalk.Object, [], 'Kernel-Objects');
- smalltalk.UndefinedObject.comment="UndefinedObject describes the behavior of its 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 representation of the `undefined` JavaScript object."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asJSON",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=null;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.UndefinedObject)})},
- args: [],
- source: "asJSON\x0a\x09^null",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.UndefinedObject);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "deepCopy",
- category: 'copying',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.UndefinedObject)})},
- args: [],
- source: "deepCopy\x0a\x09^self",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.UndefinedObject);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "ifNil:",
- category: 'testing',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self;
- $1=_st($2)._ifNil_ifNotNil_(aBlock,(function(){
- return smalltalk.withContext(function($ctx2) {
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},smalltalk.UndefinedObject)})},
- args: ["aBlock"],
- source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifNil: aBlock ifNotNil: []",
- messageSends: ["ifNil:ifNotNil:"],
- referencedClasses: []
- }),
- smalltalk.UndefinedObject);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "ifNil:ifNotNil:",
- category: 'testing',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(aBlock)._value();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.UndefinedObject)})},
- args: ["aBlock", "anotherBlock"],
- source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
- messageSends: ["value"],
- referencedClasses: []
- }),
- smalltalk.UndefinedObject);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "ifNotNil:",
- category: 'testing',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},smalltalk.UndefinedObject)})},
- args: ["aBlock"],
- source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.UndefinedObject);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "ifNotNil:ifNil:",
- category: 'testing',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(anotherBlock)._value();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.UndefinedObject)})},
- args: ["aBlock", "anotherBlock"],
- source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value",
- messageSends: ["value"],
- referencedClasses: []
- }),
- smalltalk.UndefinedObject);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isImmutable",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return true;
- }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.UndefinedObject)})},
- args: [],
- source: "isImmutable\x0a\x09^ true",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.UndefinedObject);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isNil",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return true;
- }, function($ctx1) {$ctx1.fill(self,"isNil",{},smalltalk.UndefinedObject)})},
- args: [],
- source: "isNil\x0a\x09^true",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.UndefinedObject);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "notNil",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return false;
- }, function($ctx1) {$ctx1.fill(self,"notNil",{},smalltalk.UndefinedObject)})},
- args: [],
- source: "notNil\x0a\x09^false",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.UndefinedObject);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "printOn:",
- category: 'printing',
- fn: function (aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(aStream)._nextPutAll_("nil");
- return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.UndefinedObject)})},
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
- messageSends: ["nextPutAll:"],
- referencedClasses: []
- }),
- smalltalk.UndefinedObject);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "shallowCopy",
- category: 'copying',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.UndefinedObject)})},
- args: [],
- source: "shallowCopy\x0a\x09^self",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.UndefinedObject);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "subclass:instanceVariableNames:",
- category: 'class creation',
- fn: function (aString,anotherString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._subclass_instanceVariableNames_package_(aString,anotherString,nil);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},smalltalk.UndefinedObject)})},
- args: ["aString", "anotherString"],
- source: "subclass: aString instanceVariableNames: anotherString\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
- messageSends: ["subclass:instanceVariableNames:package:"],
- referencedClasses: []
- }),
- smalltalk.UndefinedObject);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "subclass:instanceVariableNames:category:",
- category: 'class creation',
- fn: function (aString,aString2,aString3){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- _st(self)._deprecatedAPI();
- $1=_st(self)._subclass_instanceVariableNames_package_(aString,aString2,aString3);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.UndefinedObject)})},
- args: ["aString", "aString2", "aString3"],
- source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for compatibility.\x22\x0a\x09self deprecatedAPI.\x0a\x09^self subclass: aString instanceVariableNames: aString2 package: aString3",
- messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
- referencedClasses: []
- }),
- smalltalk.UndefinedObject);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "subclass:instanceVariableNames:package:",
- category: 'class creation',
- fn: function (aString,aString2,aString3){
- var self=this;
- function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.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",
- messageSends: ["superclass:subclass:instanceVariableNames:package:", "asString", "new"],
- referencedClasses: ["ClassBuilder"]
- }),
- smalltalk.UndefinedObject);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "new",
- category: 'instance creation',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._error_("You cannot create new instances of UndefinedObject. Use nil");
- return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.UndefinedObject.klass)})},
- args: [],
- source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
- messageSends: ["error:"],
- referencedClasses: []
- }),
- smalltalk.UndefinedObject.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asJavaScriptSelector",
- category: '*Kernel-Objects',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._replace_with_("^([a-zA-Z0-9]*).*$","$1");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSelector",{},smalltalk.String)})},
- args: [],
- source: "asJavaScriptSelector\x0a\x09\x22Return first keyword of the selector, without trailing colon.\x22\x0a\x09^self replace: '^([a-zA-Z0-9]*).*$' with: '$1'",
- messageSends: ["replace:with:"],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addPackage('Kernel-Classes');
- smalltalk.addClass('Behavior', smalltalk.Object, [], 'Kernel-Classes');
- smalltalk.Behavior.comment="Behavior is the superclass of all class objects.\x0a\x0aIt defines the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0aInstances 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\x0aBehavior also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "addCompiledMethod:",
- category: 'compiling',
- fn: function (aMethod){
- var self=this;
- var oldMethod,announcement;
- function $MethodAdded(){return smalltalk.MethodAdded||(typeof MethodAdded=="undefined"?nil:MethodAdded)}
- function $MethodModified(){return smalltalk.MethodModified||(typeof MethodModified=="undefined"?nil:MethodModified)}
- function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5,$6;
- oldMethod=_st(_st(self)._methodDictionary())._at_ifAbsent_(_st(aMethod)._selector(),(function(){
- return smalltalk.withContext(function($ctx2) {
- return nil;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- $1=_st(_st(self)._protocols())._includes_(_st(aMethod)._protocol());
- if(! smalltalk.assert($1)){
- _st(_st(self)._organization())._addElement_(_st(aMethod)._protocol());
- };
- _st(self)._basicAddCompiledMethod_(aMethod);
- $2=oldMethod;
- if(($receiver = $2) == nil || $receiver == undefined){
- $3=_st($MethodAdded())._new();
- _st($3)._method_(aMethod);
- $4=_st($3)._yourself();
- announcement=$4;
- } else {
- $5=_st($MethodModified())._new();
- _st($5)._oldMethod_(oldMethod);
- _st($5)._method_(aMethod);
- $6=_st($5)._yourself();
- announcement=$6;
- };
- _st(_st($SystemAnnouncer())._current())._announce_(announcement);
- return self}, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},smalltalk.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\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",
- messageSends: ["at:ifAbsent:", "selector", "methodDictionary", "ifFalse:", "addElement:", "protocol", "organization", "includes:", "protocols", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"],
- referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"]
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "allInstanceVariableNames",
- category: 'accessing',
- fn: function (){
- var self=this;
- var result;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- result=_st(_st(self)._instanceVariableNames())._copy();
- $1=_st(self)._superclass();
- if(($receiver = $1) == nil || $receiver == undefined){
- $1;
- } else {
- _st(result)._addAll_(_st(_st(self)._superclass())._allInstanceVariableNames());
- };
- $2=result;
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},smalltalk.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",
- messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "addAll:", "allInstanceVariableNames", "superclass"],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "allSelectors",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $1=_st(_st(self)._allSuperclasses())._inject_into_(_st(self)._selectors(),(function(soFar,aBehavior){
- return smalltalk.withContext(function($ctx2) {
- $2=soFar;
- _st($2)._addAll_(_st(aBehavior)._selectors());
- $3=_st($2)._yourself();
- return $3;
- }, function($ctx2) {$ctx2.fillBlock({soFar:soFar,aBehavior:aBehavior},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},smalltalk.Behavior)})},
- args: [],
- source: "allSelectors\x0a\x09^self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :soFar :aBehavior | soFar addAll: aBehavior selectors; yourself ]",
- messageSends: ["inject:into:", "selectors", "addAll:", "yourself", "allSuperclasses"],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "allSubclasses",
- category: 'accessing',
- fn: function (){
- var self=this;
- var result;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- result=_st(self)._subclasses();
- _st(_st(self)._subclasses())._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(result)._addAll_(_st(each)._allSubclasses());
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- $1=result;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{result:result},smalltalk.Behavior)})},
- args: [],
- source: "allSubclasses\x0a\x09| result |\x0a\x09result := self subclasses.\x0a\x09self subclasses do: [:each |\x0a\x09\x09result addAll: each allSubclasses].\x0a\x09^result",
- messageSends: ["subclasses", "do:", "addAll:", "allSubclasses"],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "allSubclassesDo:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(_st(self)._subclasses())._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- _st(aBlock)._value_(each);
- return _st(each)._allSubclassesDo_(aBlock);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},smalltalk.Behavior)})},
- args: ["aBlock"],
- source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a\x09self subclasses do: [ :each |\x0a \x09aBlock value: each.\x0a each allSubclassesDo: aBlock ].",
- messageSends: ["do:", "value:", "allSubclassesDo:", "subclasses"],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "allSuperclasses",
- category: 'accessing',
- fn: function (){
- var self=this;
- function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$4,$5,$3;
- $1=_st(self)._superclass();
- if(($receiver = $1) == nil || $receiver == undefined){
- $2=[];
- return $2;
- } else {
- $1;
- };
- $4=_st($OrderedCollection())._with_(_st(self)._superclass());
- _st($4)._addAll_(_st(_st(self)._superclass())._allSuperclasses());
- $5=_st($4)._yourself();
- $3=$5;
- return $3;
- }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},smalltalk.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",
- messageSends: ["ifNil:", "superclass", "addAll:", "allSuperclasses", "with:", "yourself"],
- referencedClasses: ["OrderedCollection"]
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "basicAddCompiledMethod:",
- category: 'private',
- fn: function (aMethod){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- smalltalk.addMethod(aMethod, self);
- return self}, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},smalltalk.Behavior)})},
- args: ["aMethod"],
- source: "basicAddCompiledMethod: aMethod\x0a\x09<smalltalk.addMethod(aMethod, self)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "basicNew",
- category: 'instance creation',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return new self.fn();
- return self}, function($ctx1) {$ctx1.fill(self,"basicNew",{},smalltalk.Behavior)})},
- args: [],
- source: "basicNew\x0a\x09<return new self.fn()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "basicRemoveCompiledMethod:",
- category: 'private',
- fn: function (aMethod){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- smalltalk.removeMethod(aMethod)
- smalltalk.init(self);
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},smalltalk.Behavior)})},
- args: ["aMethod"],
- source: "basicRemoveCompiledMethod: aMethod\x0a\x09<\x0a\x09\x09smalltalk.removeMethod(aMethod)\x0a\x09\x09smalltalk.init(self);\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "canUnderstand:",
- category: 'testing',
- fn: function (aSelector){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(_st(_st(self)._methodDictionary())._keys())._includes_(_st(aSelector)._asString()))._or_((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(_st(self)._superclass())._notNil())._and_((function(){
- return smalltalk.withContext(function($ctx3) {
- return _st(_st(self)._superclass())._canUnderstand_(aSelector);
- }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},smalltalk.Behavior)})},
- args: ["aSelector"],
- source: "canUnderstand: aSelector\x0a\x09^(self methodDictionary keys includes: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [self superclass canUnderstand: aSelector]]",
- messageSends: ["or:", "and:", "canUnderstand:", "superclass", "notNil", "includes:", "asString", "keys", "methodDictionary"],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "comment",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=_st(self)._basicAt_("comment");
- if(($receiver = $2) == nil || $receiver == undefined){
- $1="";
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"comment",{},smalltalk.Behavior)})},
- args: [],
- source: "comment\x0a\x09^(self basicAt: 'comment') ifNil: ['']",
- messageSends: ["ifNil:", "basicAt:"],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "comment:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- function $ClassCommentChanged(){return smalltalk.ClassCommentChanged||(typeof ClassCommentChanged=="undefined"?nil:ClassCommentChanged)}
- function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- _st(self)._basicAt_put_("comment",aString);
- $1=_st($ClassCommentChanged())._new();
- _st($1)._theClass_(self);
- $2=_st($1)._yourself();
- _st(_st($SystemAnnouncer())._current())._announce_($2);
- return self}, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},smalltalk.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)",
- messageSends: ["basicAt:put:", "announce:", "theClass:", "new", "yourself", "current"],
- referencedClasses: ["ClassCommentChanged", "SystemAnnouncer"]
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commentStamp",
- category: 'accessing',
- fn: function (){
- var self=this;
- function $ClassCommentReader(){return smalltalk.ClassCommentReader||(typeof ClassCommentReader=="undefined"?nil:ClassCommentReader)}
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st($ClassCommentReader())._new();
- _st($2)._class_(self);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},smalltalk.Behavior)})},
- args: [],
- source: "commentStamp\x0a\x09^ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
- messageSends: ["class:", "new", "yourself"],
- referencedClasses: ["ClassCommentReader"]
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commentStamp:prior:",
- category: 'accessing',
- fn: function (aStamp,prior){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._commentStamp();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},smalltalk.Behavior)})},
- args: ["aStamp", "prior"],
- source: "commentStamp: aStamp prior: prior\x0a\x09\x09^self commentStamp",
- messageSends: ["commentStamp"],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "compile:",
- category: 'compiling',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._compile_category_(aString,"");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},smalltalk.Behavior)})},
- args: ["aString"],
- source: "compile: aString\x0a\x09^ self compile: aString category: ''",
- messageSends: ["compile:category:"],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "compile:category:",
- category: 'compiling',
- fn: function (aString,anotherString){
- var self=this;
- function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st($Compiler())._new())._install_forClass_category_(aString,self,anotherString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"compile:category:",{aString:aString,anotherString:anotherString},smalltalk.Behavior)})},
- args: ["aString", "anotherString"],
- source: "compile: aString category: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09category: anotherString",
- messageSends: ["install:forClass:category:", "new"],
- referencedClasses: ["Compiler"]
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "definition",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return "";
- }, function($ctx1) {$ctx1.fill(self,"definition",{},smalltalk.Behavior)})},
- args: [],
- source: "definition\x0a\x09^ ''",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "includesBehavior:",
- category: 'testing',
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self).__eq_eq(aClass))._or_((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(self)._inheritsFrom_(aClass);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},smalltalk.Behavior)})},
- args: ["aClass"],
- source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
- messageSends: ["or:", "inheritsFrom:", "=="],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "includesSelector:",
- category: 'testing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._methodDictionary())._includesKey_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},smalltalk.Behavior)})},
- args: ["aString"],
- source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
- messageSends: ["includesKey:", "methodDictionary"],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "inheritsFrom:",
- category: 'testing',
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(aClass)._allSubclasses())._includes_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},smalltalk.Behavior)})},
- args: ["aClass"],
- source: "inheritsFrom: aClass\x0a\x09^aClass allSubclasses includes: self",
- messageSends: ["includes:", "allSubclasses"],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "instanceVariableNames",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.iVarNames;
- return self}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},smalltalk.Behavior)})},
- args: [],
- source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isBehavior",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return true;
- }, function($ctx1) {$ctx1.fill(self,"isBehavior",{},smalltalk.Behavior)})},
- args: [],
- source: "isBehavior\x0a\x09^ true",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "lookupSelector:",
- category: 'accessing',
- fn: function (selector){
- var self=this;
- var lookupClass;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- var $early={};
- try {
- lookupClass=self;
- _st((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(lookupClass).__eq(nil);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
- return smalltalk.withContext(function($ctx2) {
- $1=_st(lookupClass)._includesSelector_(selector);
- if(smalltalk.assert($1)){
- $2=_st(lookupClass)._methodAt_(selector);
- throw $early=[$2];
- };
- lookupClass=_st(lookupClass)._superclass();
- return lookupClass;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return nil;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},smalltalk.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",
- messageSends: ["whileFalse:", "ifTrue:", "methodAt:", "includesSelector:", "superclass", "="],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "methodAt:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._methodDictionary())._at_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},smalltalk.Behavior)})},
- args: ["aString"],
- source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
- messageSends: ["at:", "methodDictionary"],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "methodDictionary",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var dict = smalltalk.HashedCollection._new();
- var methods = self.methods;
- for(var i in methods) {
- if(methods[i].selector) {
- dict._at_put_(methods[i].selector, methods[i]);
- }
- };
- return dict;
- return self}, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},smalltalk.Behavior)})},
- args: [],
- source: "methodDictionary\x0a\x09<var dict = smalltalk.HashedCollection._new();\x0a\x09var methods = self.methods;\x0a\x09for(var i in methods) {\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>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "methods",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._methodDictionary())._values();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"methods",{},smalltalk.Behavior)})},
- args: [],
- source: "methods\x0a\x09^ self methodDictionary values",
- messageSends: ["values", "methodDictionary"],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "methodsFor:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- function $ClassCategoryReader(){return smalltalk.ClassCategoryReader||(typeof ClassCategoryReader=="undefined"?nil:ClassCategoryReader)}
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st($ClassCategoryReader())._new();
- _st($2)._class_category_(self,aString);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},smalltalk.Behavior)})},
- args: ["aString"],
- source: "methodsFor: aString\x0a\x09^ClassCategoryReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
- messageSends: ["class:category:", "new", "yourself"],
- referencedClasses: ["ClassCategoryReader"]
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "methodsFor:stamp:",
- category: 'accessing',
- fn: function (aString,aStamp){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._methodsFor_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},smalltalk.Behavior)})},
- args: ["aString", "aStamp"],
- source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for compatibility, right now ignores stamp.\x22\x0a\x09^self methodsFor: aString",
- messageSends: ["methodsFor:"],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "methodsInProtocol:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(_st(self)._methodDictionary())._values())._select_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(each)._protocol()).__eq(aString);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},smalltalk.Behavior)})},
- args: ["aString"],
- source: "methodsInProtocol: aString\x0a\x09^ self methodDictionary values select: [ :each | each protocol = aString ]",
- messageSends: ["select:", "=", "protocol", "values", "methodDictionary"],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "name",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.className || nil;
- return self}, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.Behavior)})},
- args: [],
- source: "name\x0a\x09<return self.className || nil>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "new",
- category: 'instance creation',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._basicNew())._initialize();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.Behavior)})},
- args: [],
- source: "new\x0a\x09^self basicNew initialize",
- messageSends: ["initialize", "basicNew"],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "organization",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._basicAt_("organization");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"organization",{},smalltalk.Behavior)})},
- args: [],
- source: "organization\x0a\x09^ self basicAt: 'organization'",
- messageSends: ["basicAt:"],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "protocols",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(_st(self)._organization())._elements())._sorted();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"protocols",{},smalltalk.Behavior)})},
- args: [],
- source: "protocols\x0a\x09^ self organization elements sorted",
- messageSends: ["sorted", "elements", "organization"],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "protocolsDo:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- var methodsByCategory;
- function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
- function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
- return smalltalk.withContext(function($ctx1) {
- methodsByCategory=_st($HashedCollection())._new();
- _st(_st(_st(self)._methodDictionary())._values())._do_((function(m){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(methodsByCategory)._at_ifAbsentPut_(_st(m)._category(),(function(){
- return smalltalk.withContext(function($ctx3) {
- return _st($Array())._new();
- }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})})))._add_(m);
- }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1)})}));
- _st(_st(self)._protocols())._do_((function(category){
- return smalltalk.withContext(function($ctx2) {
- return _st(aBlock)._value_value_(category,_st(methodsByCategory)._at_(category));
- }, function($ctx2) {$ctx2.fillBlock({category:category},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByCategory:methodsByCategory},smalltalk.Behavior)})},
- args: ["aBlock"],
- source: "protocolsDo: aBlock\x0a\x09\x22Execute aBlock for each method category with\x0a\x09its collection of methods in the sort order of category name.\x22\x0a\x0a\x09| methodsByCategory |\x0a\x09methodsByCategory := HashedCollection new.\x0a\x09self methodDictionary values do: [:m |\x0a\x09\x09(methodsByCategory at: m category ifAbsentPut: [Array new])\x0a\x09\x09\x09add: m].\x0a\x09self protocols do: [:category |\x0a\x09\x09aBlock value: category value: (methodsByCategory at: category)]",
- messageSends: ["new", "do:", "add:", "at:ifAbsentPut:", "category", "values", "methodDictionary", "value:value:", "at:", "protocols"],
- referencedClasses: ["HashedCollection", "Array"]
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "prototype",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.fn.prototype;
- return self}, function($ctx1) {$ctx1.fill(self,"prototype",{},smalltalk.Behavior)})},
- args: [],
- source: "prototype\x0a\x09<return self.fn.prototype>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "removeCompiledMethod:",
- category: 'compiling',
- fn: function (aMethod){
- var self=this;
- function $MethodRemoved(){return smalltalk.MethodRemoved||(typeof MethodRemoved=="undefined"?nil:MethodRemoved)}
- function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- _st(self)._basicRemoveCompiledMethod_(aMethod);
- _st(_st(self)._methods())._detect_ifNone_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(each)._protocol()).__eq(_st(aMethod)._protocol());
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(self)._organization())._removeElement_(_st(aMethod)._protocol());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- $1=_st($MethodRemoved())._new();
- _st($1)._method_(aMethod);
- $2=_st($1)._yourself();
- _st(_st($SystemAnnouncer())._current())._announce_($2);
- return self}, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},smalltalk.Behavior)})},
- args: ["aMethod"],
- source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aMethod protocol ]\x0a\x09\x09ifNone: [ self organization removeElement: aMethod protocol ].\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)",
- messageSends: ["basicRemoveCompiledMethod:", "detect:ifNone:", "=", "protocol", "removeElement:", "organization", "methods", "announce:", "method:", "new", "yourself", "current"],
- referencedClasses: ["MethodRemoved", "SystemAnnouncer"]
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "selectors",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._methodDictionary())._keys();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"selectors",{},smalltalk.Behavior)})},
- args: [],
- source: "selectors\x0a\x09^ self methodDictionary keys",
- messageSends: ["keys", "methodDictionary"],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "subclasses",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return smalltalk.subclasses(self);
- return self}, function($ctx1) {$ctx1.fill(self,"subclasses",{},smalltalk.Behavior)})},
- args: [],
- source: "subclasses\x0a\x09<return smalltalk.subclasses(self)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "superclass",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.superclass || nil;
- return self}, function($ctx1) {$ctx1.fill(self,"superclass",{},smalltalk.Behavior)})},
- args: [],
- source: "superclass\x0a\x09<return self.superclass || nil>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "theMetaClass",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._class();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},smalltalk.Behavior)})},
- args: [],
- source: "theMetaClass\x0a\x09^ self class",
- messageSends: ["class"],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "theNonMetaClass",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},smalltalk.Behavior)})},
- args: [],
- source: "theNonMetaClass\x0a\x09^ self",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "withAllSubclasses",
- category: 'accessing',
- fn: function (){
- var self=this;
- function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st($Array())._with_(self);
- _st($2)._addAll_(_st(self)._allSubclasses());
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},smalltalk.Behavior)})},
- args: [],
- source: "withAllSubclasses\x0a\x09^(Array with: self) addAll: self allSubclasses; yourself",
- messageSends: ["addAll:", "allSubclasses", "with:", "yourself"],
- referencedClasses: ["Array"]
- }),
- smalltalk.Behavior);
- smalltalk.addClass('Class', smalltalk.Behavior, [], 'Kernel-Classes');
- smalltalk.Class.comment="Class is __the__ class object.\x0a\x0aInstances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder`"
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asJavascript",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st("smalltalk.").__comma(_st(self)._name());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Class)})},
- args: [],
- source: "asJavascript\x0a\x09^ 'smalltalk.', self name",
- messageSends: [",", "name"],
- referencedClasses: []
- }),
- smalltalk.Class);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "category",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=_st(self)._package();
- if(($receiver = $2) == nil || $receiver == undefined){
- $1="Unclassified";
- } else {
- $1=_st(_st(self)._package())._name();
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"category",{},smalltalk.Class)})},
- args: [],
- source: "category\x0a\x09^self package ifNil: ['Unclassified'] ifNotNil: [self package name]",
- messageSends: ["ifNil:ifNotNil:", "name", "package"],
- referencedClasses: []
- }),
- smalltalk.Class);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "definition",
- category: 'accessing',
- fn: function (){
- var self=this;
- function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$4,$5,$1;
- $1=_st($String())._streamContents_((function(stream){
- return smalltalk.withContext(function($ctx2) {
- $2=stream;
- _st($2)._nextPutAll_(_st(_st(self)._superclass())._asString());
- _st($2)._nextPutAll_(" subclass: #");
- _st($2)._nextPutAll_(_st(self)._name());
- _st($2)._nextPutAll_(_st(_st($String())._lf()).__comma(_st($String())._tab()));
- $3=_st($2)._nextPutAll_("instanceVariableNames: '");
- $3;
- _st(_st(self)._instanceVariableNames())._do_separatedBy_((function(each){
- return smalltalk.withContext(function($ctx3) {
- return _st(stream)._nextPutAll_(each);
- }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
- return smalltalk.withContext(function($ctx3) {
- return _st(stream)._nextPutAll_(" ");
- }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
- $4=stream;
- _st($4)._nextPutAll_(_st(_st("'").__comma(_st($String())._lf())).__comma(_st($String())._tab()));
- _st($4)._nextPutAll_("package: '");
- _st($4)._nextPutAll_(_st(self)._category());
- $5=_st($4)._nextPutAll_("'");
- return $5;
- }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"definition",{},smalltalk.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: '''' ]",
- messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "tab", "lf", "do:separatedBy:", "instanceVariableNames", "category"],
- referencedClasses: ["String"]
- }),
- smalltalk.Class);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isClass",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return true;
- }, function($ctx1) {$ctx1.fill(self,"isClass",{},smalltalk.Class)})},
- args: [],
- source: "isClass\x0a\x09^true",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Class);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "package",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._basicAt_("pkg");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"package",{},smalltalk.Class)})},
- args: [],
- source: "package\x0a\x09^ self basicAt: 'pkg'",
- messageSends: ["basicAt:"],
- referencedClasses: []
- }),
- smalltalk.Class);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "package:",
- category: 'accessing',
- fn: function (aPackage){
- var self=this;
- var oldPackage;
- function $ClassMoved(){return smalltalk.ClassMoved||(typeof ClassMoved=="undefined"?nil:ClassMoved)}
- function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- oldPackage=_st(self)._package();
- _st(self)._basicAt_put_("pkg",aPackage);
- _st(_st(oldPackage)._organization())._removeElement_(self);
- _st(_st(aPackage)._organization())._addElement_(self);
- $1=_st($ClassMoved())._new();
- _st($1)._theClass_(self);
- _st($1)._oldPackage_(oldPackage);
- $2=_st($1)._yourself();
- _st(_st($SystemAnnouncer())._current())._announce_($2);
- return self}, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},smalltalk.Class)})},
- args: ["aPackage"],
- source: "package: aPackage\x0a\x09| oldPackage |\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)",
- messageSends: ["package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "theClass:", "new", "oldPackage:", "yourself", "current"],
- referencedClasses: ["ClassMoved", "SystemAnnouncer"]
- }),
- smalltalk.Class);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "printOn:",
- category: 'printing',
- fn: function (aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(aStream)._nextPutAll_(_st(self)._name());
- return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Class)})},
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
- messageSends: ["nextPutAll:", "name"],
- referencedClasses: []
- }),
- smalltalk.Class);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "rename:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
- return smalltalk.withContext(function($ctx1) {
- _st(_st($ClassBuilder())._new())._renameClass_to_(self,aString);
- return self}, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},smalltalk.Class)})},
- args: ["aString"],
- source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
- messageSends: ["renameClass:to:", "new"],
- referencedClasses: ["ClassBuilder"]
- }),
- smalltalk.Class);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "subclass:instanceVariableNames:",
- category: 'class creation',
- fn: function (aString,anotherString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._subclass_instanceVariableNames_package_(aString,anotherString,nil);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},smalltalk.Class)})},
- args: ["aString", "anotherString"],
- source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for compatibility.\x22\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
- messageSends: ["subclass:instanceVariableNames:package:"],
- referencedClasses: []
- }),
- smalltalk.Class);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "subclass:instanceVariableNames:category:",
- category: 'class creation',
- fn: function (aString,aString2,aString3){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- _st(self)._deprecatedAPI();
- $1=_st(self)._subclass_instanceVariableNames_package_(aString,aString2,aString3);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.Class)})},
- args: ["aString", "aString2", "aString3"],
- source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for compatibility.\x22\x0a\x09self deprecatedAPI.\x0a\x09^self subclass: aString instanceVariableNames: aString2 package: aString3",
- messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
- referencedClasses: []
- }),
- smalltalk.Class);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
- category: 'class creation',
- fn: function (aString,aString2,classVars,pools,aString3){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(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},smalltalk.Class)})},
- args: ["aString", "aString2", "classVars", "pools", "aString3"],
- source: "subclass: aString instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Just ignore class variables and pools. Added for compatibility.\x22\x0a\x09^self subclass: aString instanceVariableNames: aString2 package: aString3",
- messageSends: ["subclass:instanceVariableNames:package:"],
- referencedClasses: []
- }),
- smalltalk.Class);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "subclass:instanceVariableNames:package:",
- category: 'class creation',
- fn: function (aString,aString2,aString3){
- var self=this;
- function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.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",
- messageSends: ["superclass:subclass:instanceVariableNames:package:", "asString", "new"],
- referencedClasses: ["ClassBuilder"]
- }),
- smalltalk.Class);
- smalltalk.addClass('Metaclass', smalltalk.Behavior, [], 'Kernel-Classes');
- smalltalk.Metaclass.comment="Metaclass is the root of the class hierarchy.\x0a\x0aMetaclass instances are metaclasses, one for each real class.\x0aMetaclass instances have a single instance, which they hold onto, which is the class that they are the metaclass of."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asJavascript",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st("smalltalk.").__comma(_st(_st(self)._instanceClass())._name())).__comma(".klass");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Metaclass)})},
- args: [],
- source: "asJavascript\x0a\x09^ 'smalltalk.', self instanceClass name, '.klass'",
- messageSends: [",", "name", "instanceClass"],
- referencedClasses: []
- }),
- smalltalk.Metaclass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "definition",
- category: 'accessing',
- fn: function (){
- var self=this;
- function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $1=_st($String())._streamContents_((function(stream){
- return smalltalk.withContext(function($ctx2) {
- $2=stream;
- _st($2)._nextPutAll_(_st(self)._asString());
- $3=_st($2)._nextPutAll_(" instanceVariableNames: '");
- $3;
- _st(_st(self)._instanceVariableNames())._do_separatedBy_((function(each){
- return smalltalk.withContext(function($ctx3) {
- return _st(stream)._nextPutAll_(each);
- }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
- return smalltalk.withContext(function($ctx3) {
- return _st(stream)._nextPutAll_(" ");
- }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
- return _st(stream)._nextPutAll_("'");
- }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"definition",{},smalltalk.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: '''' ]",
- messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"],
- referencedClasses: ["String"]
- }),
- smalltalk.Metaclass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "instanceClass",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.instanceClass;
- return self}, function($ctx1) {$ctx1.fill(self,"instanceClass",{},smalltalk.Metaclass)})},
- args: [],
- source: "instanceClass\x0a\x09<return self.instanceClass>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Metaclass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "instanceVariableNames:",
- category: 'accessing',
- fn: function (aCollection){
- var self=this;
- function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
- return smalltalk.withContext(function($ctx1) {
- _st(_st($ClassBuilder())._new())._class_instanceVariableNames_(self,aCollection);
- return self}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},smalltalk.Metaclass)})},
- args: ["aCollection"],
- source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
- messageSends: ["class:instanceVariableNames:", "new"],
- referencedClasses: ["ClassBuilder"]
- }),
- smalltalk.Metaclass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isMetaclass",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return true;
- }, function($ctx1) {$ctx1.fill(self,"isMetaclass",{},smalltalk.Metaclass)})},
- args: [],
- source: "isMetaclass\x0a\x09^true",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Metaclass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "printOn:",
- category: 'printing',
- fn: function (aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=aStream;
- _st($1)._nextPutAll_(_st(_st(self)._instanceClass())._name());
- $2=_st($1)._nextPutAll_(" class");
- return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Metaclass)})},
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
- messageSends: ["nextPutAll:", "name", "instanceClass"],
- referencedClasses: []
- }),
- smalltalk.Metaclass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "theMetaClass",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},smalltalk.Metaclass)})},
- args: [],
- source: "theMetaClass\x0a\x09^ self",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Metaclass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "theNonMetaClass",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._instanceClass();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},smalltalk.Metaclass)})},
- args: [],
- source: "theNonMetaClass\x0a\x09^ self instanceClass",
- messageSends: ["instanceClass"],
- referencedClasses: []
- }),
- smalltalk.Metaclass);
- smalltalk.addClass('ClassBuilder', smalltalk.Object, [], 'Kernel-Classes');
- smalltalk.ClassBuilder.comment="ClassBuilder is responsible for compiling new classes or modifying existing classes in the system.\x0a\x0aRather than using ClassBuilder directly to compile a class, use `Class >> subclass:instanceVariableNames:package:`."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "addSubclassOf:named:instanceVariableNames:package:",
- category: 'class definition',
- fn: function (aClass,aString,aCollection,packageName){
- var self=this;
- var theClass;
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- theClass=_st(_st($Smalltalk())._current())._at_(aString);
- $1=theClass;
- if(($receiver = $1) == nil || $receiver == undefined){
- $1;
- } else {
- $2=_st(_st(theClass)._superclass()).__eq_eq(aClass);
- if(! smalltalk.assert($2)){
- $3=_st(self)._migrateClassNamed_superclass_instanceVariableNames_package_(aString,aClass,aCollection,packageName);
- return $3;
- };
- };
- $4=_st(self)._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,aString,aCollection,packageName);
- return $4;
- }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName,theClass:theClass},smalltalk.ClassBuilder)})},
- args: ["aClass", "aString", "aCollection", "packageName"],
- source: "addSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09| theClass |\x0a\x09\x0a\x09theClass := Smalltalk current at: aString.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass superclass == aClass ifFalse: [\x0a\x09\x09\x09^ self\x0a\x09\x09\x09\x09migrateClassNamed: aString\x0a\x09\x09\x09\x09superclass: aClass\x0a\x09\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09\x09package: packageName ] ].\x0a\x0a\x09^ self\x0a\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09named: aString\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName",
- messageSends: ["at:", "current", "ifNotNil:", "ifFalse:", "migrateClassNamed:superclass:instanceVariableNames:package:", "==", "superclass", "basicAddSubclassOf:named:instanceVariableNames:package:"],
- referencedClasses: ["Smalltalk"]
- }),
- smalltalk.ClassBuilder);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
- category: 'private',
- fn: function (aClass,aString,aCollection,packageName){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- smalltalk.addClass(aString, aClass, aCollection, packageName);
- return smalltalk[aString]
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},smalltalk.ClassBuilder)})},
- args: ["aClass", "aString", "aCollection", "packageName"],
- source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<\x0a\x09\x09smalltalk.addClass(aString, aClass, aCollection, packageName);\x0a\x09\x09return smalltalk[aString]\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ClassBuilder);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "basicClass:instanceVariableNames:",
- category: 'private',
- fn: function (aClass,aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._basicClass_instanceVariables_(aClass,_st(self)._instanceVariableNamesFor_(aString));
- return self}, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})},
- args: ["aClass", "aString"],
- source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
- messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"],
- referencedClasses: []
- }),
- smalltalk.ClassBuilder);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "basicClass:instanceVariables:",
- category: 'private',
- fn: function (aClass,aCollection){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(aClass)._isMetaclass();
- if(! smalltalk.assert($1)){
- _st(self)._error_(_st(_st(aClass)._name()).__comma(" is not a metaclass"));
- };
- _st(aClass)._basicAt_put_("iVarNames",aCollection);
- return self}, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},smalltalk.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",
- messageSends: ["ifFalse:", "error:", ",", "name", "isMetaclass", "basicAt:put:"],
- referencedClasses: []
- }),
- smalltalk.ClassBuilder);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "basicRemoveClass:",
- category: 'private',
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- smalltalk.removeClass(aClass);
- return self}, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},smalltalk.ClassBuilder)})},
- args: ["aClass"],
- source: "basicRemoveClass: aClass\x0a\x09<smalltalk.removeClass(aClass)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ClassBuilder);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "basicRenameClass:to:",
- category: 'private',
- fn: function (aClass,aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- smalltalk[aString] = aClass;
- delete smalltalk[aClass.className];
- aClass.className = aString;
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})},
- args: ["aClass", "aString"],
- source: "basicRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09smalltalk[aString] = aClass;\x0a\x09\x09delete smalltalk[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ClassBuilder);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "basicSwapClassNames:with:",
- category: 'private',
- fn: function (aClass,anotherClass){
- var self=this;
- return smalltalk.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},smalltalk.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>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ClassBuilder);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "class:instanceVariableNames:",
- category: 'class definition',
- fn: function (aClass,aString){
- var self=this;
- function $ClassDefinitionChanged(){return smalltalk.ClassDefinitionChanged||(typeof ClassDefinitionChanged=="undefined"?nil:ClassDefinitionChanged)}
- function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- _st(self)._basicClass_instanceVariableNames_(aClass,aString);
- _st(self)._setupClass_(aClass);
- $1=_st($ClassDefinitionChanged())._new();
- _st($1)._theClass_(aClass);
- $2=_st($1)._yourself();
- _st(_st($SystemAnnouncer())._current())._announce_($2);
- return self}, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})},
- args: ["aClass", "aString"],
- source: "class: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariableNames: aString.\x0a\x09self setupClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
- messageSends: ["basicClass:instanceVariableNames:", "setupClass:", "announce:", "theClass:", "new", "yourself", "current"],
- referencedClasses: ["ClassDefinitionChanged", "SystemAnnouncer"]
- }),
- smalltalk.ClassBuilder);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "copyClass:named:",
- category: 'copying',
- fn: function (aClass,aString){
- var self=this;
- var newClass;
- function $ClassAdded(){return smalltalk.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
- function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3;
- newClass=_st(self)._addSubclassOf_named_instanceVariableNames_package_(_st(aClass)._superclass(),aString,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
- _st(self)._copyClass_to_(aClass,newClass);
- $1=_st($ClassAdded())._new();
- _st($1)._theClass_(newClass);
- $2=_st($1)._yourself();
- _st(_st($SystemAnnouncer())._current())._announce_($2);
- $3=newClass;
- return $3;
- }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,aString:aString,newClass:newClass},smalltalk.ClassBuilder)})},
- args: ["aClass", "aString"],
- source: "copyClass: aClass named: aString\x0a\x09| newClass |\x0a\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass superclass\x0a\x09\x09named: aString\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",
- messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "theClass:", "new", "yourself", "current"],
- referencedClasses: ["ClassAdded", "SystemAnnouncer"]
- }),
- smalltalk.ClassBuilder);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "copyClass:to:",
- category: 'copying',
- fn: function (aClass,anotherClass){
- var self=this;
- function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
- return smalltalk.withContext(function($ctx1) {
- _st(anotherClass)._comment_(_st(aClass)._comment());
- _st(_st(_st(aClass)._methodDictionary())._values())._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st($Compiler())._new())._install_forClass_category_(_st(each)._source(),anotherClass,_st(each)._category());
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- _st(self)._basicClass_instanceVariables_(_st(anotherClass)._class(),_st(_st(aClass)._class())._instanceVariableNames());
- _st(_st(_st(_st(aClass)._class())._methodDictionary())._values())._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st($Compiler())._new())._install_forClass_category_(_st(each)._source(),_st(anotherClass)._class(),_st(each)._category());
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- _st(self)._setupClass_(anotherClass);
- return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},smalltalk.ClassBuilder)})},
- args: ["aClass", "anotherClass"],
- source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary values do: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass category: each category ].\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary values do: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass class category: each category ].\x0a\x0a\x09self setupClass: anotherClass",
- messageSends: ["comment:", "comment", "do:", "install:forClass:category:", "source", "category", "new", "values", "methodDictionary", "basicClass:instanceVariables:", "class", "instanceVariableNames", "setupClass:"],
- referencedClasses: ["Compiler"]
- }),
- smalltalk.ClassBuilder);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "installMethod:forClass:category:",
- category: 'method definition',
- fn: function (aCompiledMethod,aBehavior,aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- _st(aCompiledMethod)._category_(aString);
- _st(aBehavior)._addCompiledMethod_(aCompiledMethod);
- _st(self)._setupClass_(aBehavior);
- $1=aCompiledMethod;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:category:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},smalltalk.ClassBuilder)})},
- args: ["aCompiledMethod", "aBehavior", "aString"],
- source: "installMethod: aCompiledMethod forClass: aBehavior category: aString\x0a\x09aCompiledMethod category: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09self setupClass: aBehavior.\x0a\x09^aCompiledMethod",
- messageSends: ["category:", "addCompiledMethod:", "setupClass:"],
- referencedClasses: []
- }),
- smalltalk.ClassBuilder);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "instanceVariableNamesFor:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(aString)._tokenize_(" "))._reject_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(each)._isEmpty();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},smalltalk.ClassBuilder)})},
- args: ["aString"],
- source: "instanceVariableNamesFor: aString\x0a\x09^(aString tokenize: ' ') reject: [ :each | each isEmpty ]",
- messageSends: ["reject:", "isEmpty", "tokenize:"],
- referencedClasses: []
- }),
- smalltalk.ClassBuilder);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "migrateClass:superclass:",
- category: 'class migration',
- fn: function (aClass,anotherClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(console)._log_(_st(aClass)._name());
- _st(self)._migrateClassNamed_superclass_instanceVariableNames_package_(_st(aClass)._name(),anotherClass,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
- return self}, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},smalltalk.ClassBuilder)})},
- args: ["aClass", "anotherClass"],
- source: "migrateClass: aClass superclass: anotherClass\x0a\x09console log: aClass name.\x0a\x09self\x0a\x09\x09migrateClassNamed: aClass name\x0a\x09\x09superclass: anotherClass\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name",
- messageSends: ["log:", "name", "migrateClassNamed:superclass:instanceVariableNames:package:", "instanceVariableNames", "package"],
- referencedClasses: []
- }),
- smalltalk.ClassBuilder);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
- category: 'class migration',
- fn: function (aString,aClass,aCollection,packageName){
- var self=this;
- var oldClass,newClass,tmp;
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5;
- tmp=_st("new*").__comma(aString);
- oldClass=_st(_st($Smalltalk())._current())._at_(aString);
- newClass=_st(self)._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
- _st(self)._basicSwapClassNames_with_(oldClass,newClass);
- _st((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(self)._copyClass_to_(oldClass,newClass);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(exception){
- return smalltalk.withContext(function($ctx2) {
- $1=self;
- _st($1)._basicSwapClassNames_with_(oldClass,newClass);
- $2=_st($1)._basicRemoveClass_(newClass);
- $2;
- return _st(exception)._signal();
- }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1)})}));
- $3=self;
- _st($3)._rawRenameClass_to_(oldClass,tmp);
- $4=_st($3)._rawRenameClass_to_(newClass,aString);
- _st(_st(oldClass)._subclasses())._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(self)._migrateClass_superclass_(each,newClass);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- _st(self)._basicRemoveClass_(oldClass);
- $5=newClass;
- return $5;
- }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{aString:aString,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass,tmp:tmp},smalltalk.ClassBuilder)})},
- args: ["aString", "aClass", "aCollection", "packageName"],
- source: "migrateClassNamed: aString superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', aString.\x0a\x09oldClass := Smalltalk current at: aString.\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\x09exception signal ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: aString.\x0a\x0a\x09oldClass subclasses do: [ :each |\x0a\x09\x09self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09^newClass",
- messageSends: [",", "at:", "current", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "basicRemoveClass:", "signal", "copyClass:to:", "rawRenameClass:to:", "do:", "migrateClass:superclass:", "subclasses"],
- referencedClasses: ["Smalltalk", "Error"]
- }),
- smalltalk.ClassBuilder);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "rawRenameClass:to:",
- category: 'private',
- fn: function (aClass,aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- smalltalk[aString] = aClass;
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})},
- args: ["aClass", "aString"],
- source: "rawRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09smalltalk[aString] = aClass;\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ClassBuilder);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "renameClass:to:",
- category: 'class migration',
- fn: function (aClass,aString){
- var self=this;
- function $ClassRenamed(){return smalltalk.ClassRenamed||(typeof ClassRenamed=="undefined"?nil:ClassRenamed)}
- function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- _st(self)._basicRenameClass_to_(aClass,aString);
- $1=_st($ClassRenamed())._new();
- _st($1)._theClass_(aClass);
- $2=_st($1)._yourself();
- _st(_st($SystemAnnouncer())._current())._announce_($2);
- return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})},
- args: ["aClass", "aString"],
- source: "renameClass: aClass to: aString\x0a\x09self basicRenameClass: aClass to: aString.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRenamed new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
- messageSends: ["basicRenameClass:to:", "announce:", "theClass:", "new", "yourself", "current"],
- referencedClasses: ["ClassRenamed", "SystemAnnouncer"]
- }),
- smalltalk.ClassBuilder);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "setupClass:",
- category: 'public',
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- smalltalk.init(aClass);;
- return self}, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},smalltalk.ClassBuilder)})},
- args: ["aClass"],
- source: "setupClass: aClass\x0a\x09<smalltalk.init(aClass);>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ClassBuilder);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "superclass:subclass:",
- category: 'class definition',
- fn: function (aClass,aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._superclass_subclass_instanceVariableNames_package_(aClass,aString,"",nil);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})},
- args: ["aClass", "aString"],
- source: "superclass: aClass subclass: aString\x0a\x09^self superclass: aClass subclass: aString instanceVariableNames: '' package: nil",
- messageSends: ["superclass:subclass:instanceVariableNames:package:"],
- referencedClasses: []
- }),
- smalltalk.ClassBuilder);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "superclass:subclass:instanceVariableNames:package:",
- category: 'class definition',
- fn: function (aClass,aString,aString2,aString3){
- var self=this;
- var newClass;
- function $ClassAdded(){return smalltalk.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
- function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3,$4,$6,$5,$7,$8,$9;
- $1=self;
- $2=aClass;
- $3=aString;
- $4=_st(self)._instanceVariableNamesFor_(aString2);
- $6=aString3;
- if(($receiver = $6) == nil || $receiver == undefined){
- $5="unclassified";
- } else {
- $5=$6;
- };
- newClass=_st($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$4,$5);
- _st(self)._setupClass_(newClass);
- $7=_st($ClassAdded())._new();
- _st($7)._theClass_(newClass);
- $8=_st($7)._yourself();
- _st(_st($SystemAnnouncer())._current())._announce_($8);
- $9=newClass;
- return $9;
- }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,aString:aString,aString2:aString2,aString3:aString3,newClass:newClass},smalltalk.ClassBuilder)})},
- args: ["aClass", "aString", "aString2", "aString3"],
- source: "superclass: aClass subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: aString instanceVariableNames: (self instanceVariableNamesFor: aString2)\x0a\x09\x09package: (aString3 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",
- messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "theClass:", "new", "yourself", "current"],
- referencedClasses: ["ClassAdded", "SystemAnnouncer"]
- }),
- smalltalk.ClassBuilder);
- smalltalk.addClass('ClassCategoryReader', smalltalk.Object, ['class', 'category'], 'Kernel-Classes');
- smalltalk.ClassCategoryReader.comment="ClassCategoryReader represents a mechanism for retrieving class descriptions stored on a file."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "class:category:",
- category: 'accessing',
- fn: function (aClass,aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@class"]=aClass;
- self["@category"]=aString;
- return self}, function($ctx1) {$ctx1.fill(self,"class:category:",{aClass:aClass,aString:aString},smalltalk.ClassCategoryReader)})},
- args: ["aClass", "aString"],
- source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ClassCategoryReader);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "compileMethod:",
- category: 'private',
- fn: function (aString){
- var self=this;
- function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
- return smalltalk.withContext(function($ctx1) {
- _st(_st($Compiler())._new())._install_forClass_category_(aString,self["@class"],self["@category"]);
- return self}, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},smalltalk.ClassCategoryReader)})},
- args: ["aString"],
- source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class category: category",
- messageSends: ["install:forClass:category:", "new"],
- referencedClasses: ["Compiler"]
- }),
- smalltalk.ClassCategoryReader);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "initialize",
- category: 'initialization',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
- return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ClassCategoryReader)})},
- args: [],
- source: "initialize\x0a\x09super initialize.",
- messageSends: ["initialize"],
- referencedClasses: []
- }),
- smalltalk.ClassCategoryReader);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "scanFrom:",
- category: 'fileIn',
- fn: function (aChunkParser){
- var self=this;
- var chunk;
- function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
- return smalltalk.withContext(function($ctx1) {
- _st((function(){
- return smalltalk.withContext(function($ctx2) {
- chunk=_st(aChunkParser)._nextChunk();
- chunk;
- return _st(chunk)._isEmpty();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(self)._compileMethod_(chunk);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- _st(_st($ClassBuilder())._new())._setupClass_(self["@class"]);
- return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},smalltalk.ClassCategoryReader)})},
- 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",
- messageSends: ["whileFalse:", "compileMethod:", "nextChunk", "isEmpty", "setupClass:", "new"],
- referencedClasses: ["ClassBuilder"]
- }),
- smalltalk.ClassCategoryReader);
- smalltalk.addClass('ClassCommentReader', smalltalk.Object, ['class'], 'Kernel-Classes');
- smalltalk.ClassCommentReader.comment="ClassCommentReader represents a mechanism for retrieving class comments stored on a file.\x0aSee `ClassCategoryReader` too."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "class:",
- category: 'accessing',
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@class"]=aClass;
- return self}, function($ctx1) {$ctx1.fill(self,"class:",{aClass:aClass},smalltalk.ClassCommentReader)})},
- args: ["aClass"],
- source: "class: aClass\x0a\x09class := aClass",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ClassCommentReader);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "initialize",
- category: 'initialization',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
- return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ClassCommentReader)})},
- args: [],
- source: "initialize\x0a\x09super initialize.",
- messageSends: ["initialize"],
- referencedClasses: []
- }),
- smalltalk.ClassCommentReader);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "scanFrom:",
- category: 'fileIn',
- fn: function (aChunkParser){
- var self=this;
- var chunk;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- chunk=_st(aChunkParser)._nextChunk();
- $1=_st(chunk)._isEmpty();
- if(! smalltalk.assert($1)){
- _st(self)._setComment_(chunk);
- };
- return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},smalltalk.ClassCommentReader)})},
- args: ["aChunkParser"],
- source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk].",
- messageSends: ["nextChunk", "ifFalse:", "setComment:", "isEmpty"],
- referencedClasses: []
- }),
- smalltalk.ClassCommentReader);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "setComment:",
- category: 'private',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self["@class"])._comment_(aString);
- return self}, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},smalltalk.ClassCommentReader)})},
- args: ["aString"],
- source: "setComment: aString\x0a\x09class comment: aString",
- messageSends: ["comment:"],
- referencedClasses: []
- }),
- smalltalk.ClassCommentReader);
- smalltalk.addClass('ClassSorterNode', smalltalk.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "getNodesFrom:",
- category: 'accessing',
- fn: function (aCollection){
- var self=this;
- var children,others;
- function $ClassSorterNode(){return smalltalk.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- children=[];
- others=[];
- _st(aCollection)._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- $1=_st(_st(each)._superclass()).__eq(_st(self)._theClass());
- if(smalltalk.assert($1)){
- return _st(children)._add_(each);
- } else {
- return _st(others)._add_(each);
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- self["@nodes"]=_st(children)._collect_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st($ClassSorterNode())._on_classes_level_(each,others,_st(_st(self)._level()).__plus((1)));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},smalltalk.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]",
- messageSends: ["do:", "ifTrue:ifFalse:", "add:", "=", "theClass", "superclass", "collect:", "on:classes:level:", "+", "level"],
- referencedClasses: ["ClassSorterNode"]
- }),
- smalltalk.ClassSorterNode);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "level",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@level"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"level",{},smalltalk.ClassSorterNode)})},
- args: [],
- source: "level\x0a\x09^level",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ClassSorterNode);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "level:",
- category: 'accessing',
- fn: function (anInteger){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@level"]=anInteger;
- return self}, function($ctx1) {$ctx1.fill(self,"level:",{anInteger:anInteger},smalltalk.ClassSorterNode)})},
- args: ["anInteger"],
- source: "level: anInteger\x0a\x09level := anInteger",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ClassSorterNode);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "nodes",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@nodes"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"nodes",{},smalltalk.ClassSorterNode)})},
- args: [],
- source: "nodes\x0a\x09^nodes",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ClassSorterNode);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "theClass",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@theClass"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ClassSorterNode)})},
- args: [],
- source: "theClass\x0a\x09^theClass",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ClassSorterNode);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "theClass:",
- category: 'accessing',
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@theClass"]=aClass;
- return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ClassSorterNode)})},
- args: ["aClass"],
- source: "theClass: aClass\x0a\x09theClass := aClass",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ClassSorterNode);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "traverseClassesWith:",
- category: 'visiting',
- fn: function (aCollection){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(aCollection)._add_(_st(self)._theClass());
- _st(_st(_st(self)._nodes())._sorted_((function(a,b){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(_st(a)._theClass())._name()).__lt_eq(_st(_st(b)._theClass())._name());
- }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(aNode){
- return smalltalk.withContext(function($ctx2) {
- return _st(aNode)._traverseClassesWith_(aCollection);
- }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},smalltalk.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 ].",
- messageSends: ["add:", "theClass", "do:", "traverseClassesWith:", "sorted:", "<=", "name", "nodes"],
- referencedClasses: []
- }),
- smalltalk.ClassSorterNode);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "on:classes:level:",
- category: 'instance creation',
- fn: function (aClass,aCollection,anInteger){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st(self)._new();
- _st($2)._theClass_(aClass);
- _st($2)._level_(anInteger);
- _st($2)._getNodesFrom_(aCollection);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},smalltalk.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",
- messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"],
- referencedClasses: []
- }),
- smalltalk.ClassSorterNode.klass);
- smalltalk.addPackage('Kernel-Methods');
- smalltalk.addClass('BlockClosure', smalltalk.Object, [], 'Kernel-Methods');
- smalltalk.BlockClosure.comment="A BlockClosure is a lexical closure.\x0aThe JavaScript representation is a function.\x0a\x0aA BlockClosure is evaluated with the `#value*` methods in the 'evaluating' protocol."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "applyTo:arguments:",
- category: 'evaluating',
- fn: function (anObject,aCollection){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.apply(anObject, aCollection);
- return self}, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},smalltalk.BlockClosure)})},
- args: ["anObject", "aCollection"],
- source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asCompiledMethod:",
- category: 'converting',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return smalltalk.method({selector:aString, fn:self});;
- return self}, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},smalltalk.BlockClosure)})},
- args: ["aString"],
- source: "asCompiledMethod: aString\x0a\x09<return smalltalk.method({selector:aString, fn:self});>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "compiledSource",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.toString();
- return self}, function($ctx1) {$ctx1.fill(self,"compiledSource",{},smalltalk.BlockClosure)})},
- args: [],
- source: "compiledSource\x0a\x09<return self.toString()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "currySelf",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.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",{},smalltalk.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>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "ensure:",
- category: 'evaluating',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- try{return self()}finally{aBlock._value()};
- return self}, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},smalltalk.BlockClosure)})},
- args: ["aBlock"],
- source: "ensure: aBlock\x0a\x09<try{return self()}finally{aBlock._value()}>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "fork",
- category: 'timeout/interval',
- fn: function (){
- var self=this;
- function $ForkPool(){return smalltalk.ForkPool||(typeof ForkPool=="undefined"?nil:ForkPool)}
- return smalltalk.withContext(function($ctx1) {
- _st(_st($ForkPool())._default())._fork_(self);
- return self}, function($ctx1) {$ctx1.fill(self,"fork",{},smalltalk.BlockClosure)})},
- args: [],
- source: "fork\x0a\x09ForkPool default fork: self",
- messageSends: ["fork:", "default"],
- referencedClasses: ["ForkPool"]
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "new",
- category: 'evaluating',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return new self();
- return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.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()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "newValue:",
- category: 'evaluating',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return new self(anObject);
- return self}, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},smalltalk.BlockClosure)})},
- args: ["anObject"],
- source: "newValue: anObject\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(anObject)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "newValue:value:",
- category: 'evaluating',
- fn: function (anObject,anObject2){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return new self(anObject, anObject2);
- return self}, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},smalltalk.BlockClosure)})},
- args: ["anObject", "anObject2"],
- source: "newValue: anObject value: anObject2\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(anObject, anObject2)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "newValue:value:value:",
- category: 'evaluating',
- fn: function (anObject,anObject2,anObject3){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return new self(anObject, anObject2,anObject3);
- return self}, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},smalltalk.BlockClosure)})},
- args: ["anObject", "anObject2", "anObject3"],
- source: "newValue: anObject value: anObject2 value: anObject3\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(anObject, anObject2,anObject3)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "numArgs",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.length;
- return self}, function($ctx1) {$ctx1.fill(self,"numArgs",{},smalltalk.BlockClosure)})},
- args: [],
- source: "numArgs\x0a\x09<return self.length>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "on:do:",
- category: 'error handling',
- fn: function (anErrorClass,aBlock){
- var self=this;
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $1=_st(self)._try_catch_(self,(function(error){
- var smalltalkError;
- return smalltalk.withContext(function($ctx2) {
- smalltalkError=_st(_st($Smalltalk())._current())._asSmalltalkException_(error);
- smalltalkError;
- $2=_st(smalltalkError)._isKindOf_(anErrorClass);
- if(smalltalk.assert($2)){
- return _st(aBlock)._value_(smalltalkError);
- } else {
- return _st(smalltalkError)._signal();
- };
- }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},smalltalk.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 try: self catch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk current asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError signal ] ]",
- messageSends: ["try:catch:", "asSmalltalkException:", "current", "ifTrue:ifFalse:", "value:", "signal", "isKindOf:"],
- referencedClasses: ["Smalltalk"]
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "timeToRun",
- category: 'evaluating',
- fn: function (){
- var self=this;
- function $Date(){return smalltalk.Date||(typeof Date=="undefined"?nil:Date)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st($Date())._millisecondsToRun_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},smalltalk.BlockClosure)})},
- args: [],
- source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
- messageSends: ["millisecondsToRun:"],
- referencedClasses: ["Date"]
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "value",
- category: 'evaluating',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self();;
- return self}, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.BlockClosure)})},
- args: [],
- source: "value\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self();>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "value:",
- category: 'evaluating',
- fn: function (anArg){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self(anArg);;
- return self}, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},smalltalk.BlockClosure)})},
- args: ["anArg"],
- source: "value: anArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(anArg);>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "value:value:",
- category: 'evaluating',
- fn: function (firstArg,secondArg){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self(firstArg, secondArg);;
- return self}, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},smalltalk.BlockClosure)})},
- args: ["firstArg", "secondArg"],
- source: "value: firstArg value: secondArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg);>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "value:value:value:",
- category: 'evaluating',
- fn: function (firstArg,secondArg,thirdArg){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self(firstArg, secondArg, thirdArg);;
- return self}, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},smalltalk.BlockClosure)})},
- args: ["firstArg", "secondArg", "thirdArg"],
- source: "value: firstArg value: secondArg value: thirdArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "valueWithInterval:",
- category: 'timeout/interval',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var interval = setInterval(self, aNumber);
- return smalltalk.Timeout._on_(interval);
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},smalltalk.BlockClosure)})},
- args: ["aNumber"],
- source: "valueWithInterval: aNumber\x0a\x09<\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return smalltalk.Timeout._on_(interval);\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "valueWithPossibleArguments:",
- category: 'evaluating',
- fn: function (aCollection){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.apply(null, aCollection);;
- return self}, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},smalltalk.BlockClosure)})},
- args: ["aCollection"],
- source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "valueWithTimeout:",
- category: 'timeout/interval',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var timeout = setTimeout(self, aNumber);
- return smalltalk.Timeout._on_(timeout);
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},smalltalk.BlockClosure)})},
- args: ["aNumber"],
- source: "valueWithTimeout: aNumber\x0a\x09<\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return smalltalk.Timeout._on_(timeout);\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "whileFalse",
- category: 'controlling',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._whileFalse_((function(){
- return smalltalk.withContext(function($ctx2) {
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"whileFalse",{},smalltalk.BlockClosure)})},
- args: [],
- source: "whileFalse\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileFalse: []",
- messageSends: ["whileFalse:"],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "whileFalse:",
- category: 'controlling',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- while(!self()) {aBlock()};
- return self}, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},smalltalk.BlockClosure)})},
- args: ["aBlock"],
- source: "whileFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(!self()) {aBlock()}>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "whileTrue",
- category: 'controlling',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._whileTrue_((function(){
- return smalltalk.withContext(function($ctx2) {
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"whileTrue",{},smalltalk.BlockClosure)})},
- args: [],
- source: "whileTrue\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileTrue: []",
- messageSends: ["whileTrue:"],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "whileTrue:",
- category: 'controlling',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- while(self()) {aBlock()};
- return self}, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},smalltalk.BlockClosure)})},
- args: ["aBlock"],
- source: "whileTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(self()) {aBlock()}>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.BlockClosure);
- smalltalk.addClass('CompiledMethod', smalltalk.Object, [], 'Kernel-Methods');
- smalltalk.CompiledMethod.comment="CompiledMethod hold the source and compiled code of a class method.\x0a\x0aYou can get a CompiledMethod using `Behavior>>methodAt:`\x0a\x0a\x09String methodAt: 'lines'\x0a\x0aand read the source code\x0a\x0a\x09(String methodAt: 'lines') source\x0a\x0aSee referenced classes:\x0a\x0a\x09(String methodAt: 'lines') referencedClasses\x0a\x0aor messages sent from this method:\x0a\x09\x0a\x09(String methodAt: 'lines') messageSends"
- smalltalk.addMethod(
- smalltalk.method({
- selector: "arguments",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.args || [];
- return self}, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.CompiledMethod)})},
- args: [],
- source: "arguments\x0a\x09<return self.args || []>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "category",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=_st(self)._basicAt_("category");
- if(($receiver = $2) == nil || $receiver == undefined){
- $1=_st(self)._defaultCategory();
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"category",{},smalltalk.CompiledMethod)})},
- args: [],
- source: "category\x0a\x09^(self basicAt: 'category') ifNil: [ self defaultCategory ]",
- messageSends: ["ifNil:", "defaultCategory", "basicAt:"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "category:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- var oldProtocol;
- function $MethodMoved(){return smalltalk.MethodMoved||(typeof MethodMoved=="undefined"?nil:MethodMoved)}
- function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3;
- oldProtocol=_st(self)._protocol();
- _st(self)._basicAt_put_("category",aString);
- $1=_st($MethodMoved())._new();
- _st($1)._method_(self);
- _st($1)._oldProtocol_(oldProtocol);
- $2=_st($1)._yourself();
- _st(_st($SystemAnnouncer())._current())._announce_($2);
- $3=_st(self)._methodClass();
- if(($receiver = $3) == nil || $receiver == undefined){
- $3;
- } else {
- _st(_st(_st(self)._methodClass())._organization())._addElement_(aString);
- _st(_st(_st(_st(self)._methodClass())._methods())._select_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(each)._protocol()).__eq(oldProtocol);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._ifEmpty_((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(_st(self)._methodClass())._organization())._removeElement_(oldProtocol);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- };
- return self}, function($ctx1) {$ctx1.fill(self,"category:",{aString:aString,oldProtocol:oldProtocol},smalltalk.CompiledMethod)})},
- args: ["aString"],
- source: "category: aString\x0a\x09| oldProtocol |\x0a\x09oldProtocol := self protocol.\x0a\x09self basicAt: 'category' 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: [\x0a\x09\x09self methodClass organization addElement: aString.\x0a\x09\x0a\x09\x09(self methodClass methods\x0a\x09\x09\x09select: [ :each | each protocol = oldProtocol ])\x0a\x09\x09\x09ifEmpty: [ self methodClass organization removeElement: oldProtocol ] ]",
- messageSends: ["protocol", "basicAt:put:", "announce:", "method:", "new", "oldProtocol:", "yourself", "current", "ifNotNil:", "addElement:", "organization", "methodClass", "ifEmpty:", "removeElement:", "select:", "=", "methods"],
- referencedClasses: ["MethodMoved", "SystemAnnouncer"]
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "defaultCategory",
- category: 'defaults',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return "as yet unclassified";
- }, function($ctx1) {$ctx1.fill(self,"defaultCategory",{},smalltalk.CompiledMethod)})},
- args: [],
- source: "defaultCategory\x0a\x09^ 'as yet unclassified'",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "fn",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._basicAt_("fn");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"fn",{},smalltalk.CompiledMethod)})},
- args: [],
- source: "fn\x0a\x09^self basicAt: 'fn'",
- messageSends: ["basicAt:"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "fn:",
- category: 'accessing',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._basicAt_put_("fn",aBlock);
- return self}, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},smalltalk.CompiledMethod)})},
- args: ["aBlock"],
- source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
- messageSends: ["basicAt:put:"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isCompiledMethod",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return true;
- }, function($ctx1) {$ctx1.fill(self,"isCompiledMethod",{},smalltalk.CompiledMethod)})},
- args: [],
- source: "isCompiledMethod\x0a\x09^ true",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isOverridden",
- category: 'testing',
- fn: function (){
- var self=this;
- var selector;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- var $early={};
- try {
- selector=_st(self)._selector();
- _st(_st(self)._methodClass())._allSubclassesDo_((function(each){
- return smalltalk.withContext(function($ctx2) {
- $1=_st(each)._includesSelector_(selector);
- if(smalltalk.assert($1)){
- throw $early=[true];
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return false;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},smalltalk.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",
- messageSends: ["selector", "allSubclassesDo:", "ifTrue:", "includesSelector:", "methodClass"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isOverride",
- category: 'testing',
- fn: function (){
- var self=this;
- var superclass;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- superclass=_st(_st(self)._methodClass())._superclass();
- $1=superclass;
- if(($receiver = $1) == nil || $receiver == undefined){
- return false;
- } else {
- $1;
- };
- $2=_st(_st(_st(_st(self)._methodClass())._superclass())._lookupSelector_(_st(self)._selector()))._notNil();
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},smalltalk.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",
- messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "messageSends",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._basicAt_("messageSends");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"messageSends",{},smalltalk.CompiledMethod)})},
- args: [],
- source: "messageSends\x0a\x09^self basicAt: 'messageSends'",
- messageSends: ["basicAt:"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "methodClass",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._basicAt_("methodClass");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"methodClass",{},smalltalk.CompiledMethod)})},
- args: [],
- source: "methodClass\x0a\x09^self basicAt: 'methodClass'",
- messageSends: ["basicAt:"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "protocol",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._category();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"protocol",{},smalltalk.CompiledMethod)})},
- args: [],
- source: "protocol\x0a\x09^ self category",
- messageSends: ["category"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "protocol:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._category_(aString);
- return self}, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString},smalltalk.CompiledMethod)})},
- args: ["aString"],
- source: "protocol: aString\x0a\x09self category: aString",
- messageSends: ["category:"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "referencedClasses",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._basicAt_("referencedClasses");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},smalltalk.CompiledMethod)})},
- args: [],
- source: "referencedClasses\x0a\x09^self basicAt: 'referencedClasses'",
- messageSends: ["basicAt:"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "selector",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._basicAt_("selector");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.CompiledMethod)})},
- args: [],
- source: "selector\x0a\x09^self basicAt: 'selector'",
- messageSends: ["basicAt:"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "selector:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._basicAt_put_("selector",aString);
- return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.CompiledMethod)})},
- args: ["aString"],
- source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
- messageSends: ["basicAt:put:"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "source",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=_st(self)._basicAt_("source");
- if(($receiver = $2) == nil || $receiver == undefined){
- $1="";
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.CompiledMethod)})},
- args: [],
- source: "source\x0a\x09^(self basicAt: 'source') ifNil: ['']",
- messageSends: ["ifNil:", "basicAt:"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "source:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._basicAt_put_("source",aString);
- return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.CompiledMethod)})},
- args: ["aString"],
- source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
- messageSends: ["basicAt:put:"],
- referencedClasses: []
- }),
- smalltalk.CompiledMethod);
- smalltalk.addClass('ForkPool', smalltalk.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
- smalltalk.ForkPool.comment="A ForkPool is responsible for handling forked blocks.\x0aThe pool size sets the maximum concurrent forked blocks.\x0a\x0aThe default instance is accessed with `ForkPool default`"
- smalltalk.addMethod(
- smalltalk.method({
- selector: "addWorker",
- category: 'private',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self["@worker"])._valueWithTimeout_((0));
- self["@poolSize"]=_st(self["@poolSize"]).__plus((1));
- return self}, function($ctx1) {$ctx1.fill(self,"addWorker",{},smalltalk.ForkPool)})},
- args: [],
- source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
- messageSends: ["valueWithTimeout:", "+"],
- referencedClasses: []
- }),
- smalltalk.ForkPool);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "defaultMaxPoolSize",
- category: 'defaults',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._class())._defaultMaxPoolSize();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},smalltalk.ForkPool)})},
- args: [],
- source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
- messageSends: ["defaultMaxPoolSize", "class"],
- referencedClasses: []
- }),
- smalltalk.ForkPool);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "fork:",
- category: 'actions',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self["@poolSize"]).__lt(_st(self)._maxPoolSize());
- if(smalltalk.assert($1)){
- _st(self)._addWorker();
- };
- _st(self["@queue"])._nextPut_(aBlock);
- return self}, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},smalltalk.ForkPool)})},
- args: ["aBlock"],
- source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
- messageSends: ["ifTrue:", "addWorker", "<", "maxPoolSize", "nextPut:"],
- referencedClasses: []
- }),
- smalltalk.ForkPool);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "initialize",
- category: 'initialization',
- fn: function (){
- var self=this;
- function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
- return smalltalk.withContext(function($ctx1) {
- smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
- self["@poolSize"]=(0);
- self["@queue"]=_st($Queue())._new();
- self["@worker"]=_st(self)._makeWorker();
- return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ForkPool)})},
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
- messageSends: ["initialize", "new", "makeWorker"],
- referencedClasses: ["Queue"]
- }),
- smalltalk.ForkPool);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "makeWorker",
- category: 'initialization',
- fn: function (){
- var self=this;
- var sentinel;
- function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- sentinel=_st($Object())._new();
- $1=(function(){
- var block;
- return smalltalk.withContext(function($ctx2) {
- self["@poolSize"]=_st(self["@poolSize"]).__minus((1));
- self["@poolSize"];
- block=_st(self["@queue"])._nextIfAbsent_((function(){
- return smalltalk.withContext(function($ctx3) {
- return sentinel;
- }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
- block;
- $2=_st(block).__eq_eq(sentinel);
- if(! smalltalk.assert($2)){
- return _st((function(){
- return smalltalk.withContext(function($ctx3) {
- return _st(block)._value();
- }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._ensure_((function(){
- return smalltalk.withContext(function($ctx3) {
- return _st(self)._addWorker();
- }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
- };
- }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1)})});
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},smalltalk.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 ]]]",
- messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "ensure:", "addWorker", "value", "=="],
- referencedClasses: ["Object"]
- }),
- smalltalk.ForkPool);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "maxPoolSize",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@maxPoolSize"];
- if(($receiver = $2) == nil || $receiver == undefined){
- $1=_st(self)._defaultMaxPoolSize();
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},smalltalk.ForkPool)})},
- args: [],
- source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
- messageSends: ["ifNil:", "defaultMaxPoolSize"],
- referencedClasses: []
- }),
- smalltalk.ForkPool);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "maxPoolSize:",
- category: 'accessing',
- fn: function (anInteger){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@maxPoolSize"]=anInteger;
- return self}, function($ctx1) {$ctx1.fill(self,"maxPoolSize:",{anInteger:anInteger},smalltalk.ForkPool)})},
- args: ["anInteger"],
- source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ForkPool);
- smalltalk.ForkPool.klass.iVarNames = ['default'];
- smalltalk.addMethod(
- smalltalk.method({
- selector: "default",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@default"];
- if(($receiver = $2) == nil || $receiver == undefined){
- self["@default"]=_st(self)._new();
- $1=self["@default"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"default",{},smalltalk.ForkPool.klass)})},
- args: [],
- source: "default\x0a\x09^default ifNil: [ default := self new ]",
- messageSends: ["ifNil:", "new"],
- referencedClasses: []
- }),
- smalltalk.ForkPool.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "defaultMaxPoolSize",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=(100);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},smalltalk.ForkPool.klass)})},
- args: [],
- source: "defaultMaxPoolSize\x0a\x09^100",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ForkPool.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "resetDefault",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@default"]=nil;
- return self}, function($ctx1) {$ctx1.fill(self,"resetDefault",{},smalltalk.ForkPool.klass)})},
- args: [],
- source: "resetDefault\x0a\x09default := nil",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ForkPool.klass);
- smalltalk.addClass('Message', smalltalk.Object, ['selector', 'arguments'], 'Kernel-Methods');
- smalltalk.Message.comment="Generally, the system does not use instances of Message 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:`"
- smalltalk.addMethod(
- smalltalk.method({
- selector: "arguments",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@arguments"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.Message)})},
- args: [],
- source: "arguments\x0a\x09^arguments",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Message);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "arguments:",
- category: 'accessing',
- fn: function (anArray){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@arguments"]=anArray;
- return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{anArray:anArray},smalltalk.Message)})},
- args: ["anArray"],
- source: "arguments: anArray\x0a\x09arguments := anArray",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Message);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "printOn:",
- category: 'printing',
- fn: function (aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- smalltalk.Object.fn.prototype._printOn_.apply(_st(self), [aStream]);
- $1=aStream;
- _st($1)._nextPutAll_("(");
- _st($1)._nextPutAll_(_st(self)._selector());
- $2=_st($1)._nextPutAll_(")");
- return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Message)})},
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
- messageSends: ["printOn:", "nextPutAll:", "selector"],
- referencedClasses: []
- }),
- smalltalk.Message);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "selector",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@selector"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.Message)})},
- args: [],
- source: "selector\x0a\x09^selector",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Message);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "selector:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@selector"]=aString;
- return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.Message)})},
- args: ["aString"],
- source: "selector: aString\x0a\x09selector := aString",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Message);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "sendTo:",
- category: 'actions',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(anObject)._perform_withArguments_(_st(self)._selector(),_st(self)._arguments());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},smalltalk.Message)})},
- args: ["anObject"],
- source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
- messageSends: ["perform:withArguments:", "selector", "arguments"],
- referencedClasses: []
- }),
- smalltalk.Message);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "selector:arguments:",
- category: 'instance creation',
- fn: function (aString,anArray){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st(self)._new();
- _st($2)._selector_(aString);
- _st($2)._arguments_(anArray);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},smalltalk.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",
- messageSends: ["selector:", "new", "arguments:", "yourself"],
- referencedClasses: []
- }),
- smalltalk.Message.klass);
- smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods');
- smalltalk.MethodContext.comment="MethodContext holds all the dynamic state associated with the execution of either a method activation resulting from a message send. That is used to build the call stack while debugging.\x0a\x0aMethodContext instances are JavaScript `SmalltalkMethodContext` objects defined in boot.js"
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asString",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=_st(self)._isBlockContext();
- if(smalltalk.assert($2)){
- $1=_st(_st("a block (in ").__comma(_st(_st(_st(_st(self)._methodContext())._receiver())._class())._printString())).__comma(")");
- } else {
- $1=_st(_st(_st(_st(_st(self)._receiver())._class())._printString()).__comma(" >> ")).__comma(_st(self)._selector());
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.MethodContext)})},
- args: [],
- source: "asString\x0a\x09^self isBlockContext\x0a\x09\x09ifTrue: [ 'a block (in ', self methodContext receiver class printString, ')' ]\x0a\x09\x09ifFalse: [ self receiver class printString, ' >> ', self selector ]",
- messageSends: ["ifTrue:ifFalse:", ",", "printString", "class", "receiver", "methodContext", "selector", "isBlockContext"],
- referencedClasses: []
- }),
- smalltalk.MethodContext);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "home",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.methodContext || self.homeContext;
- return self}, function($ctx1) {$ctx1.fill(self,"home",{},smalltalk.MethodContext)})},
- args: [],
- source: "home\x0a\x09<return self.methodContext || self.homeContext>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MethodContext);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isBlockContext",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._selector())._isNil();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},smalltalk.MethodContext)})},
- args: [],
- source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
- messageSends: ["isNil", "selector"],
- referencedClasses: []
- }),
- smalltalk.MethodContext);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "locals",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.locals;
- return self}, function($ctx1) {$ctx1.fill(self,"locals",{},smalltalk.MethodContext)})},
- args: [],
- source: "locals\x0a\x09<return self.locals>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MethodContext);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "method",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(_st(_st(self)._methodContext())._receiver())._class())._lookupSelector_(_st(_st(self)._methodContext())._selector());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.MethodContext)})},
- args: [],
- source: "method\x0a\x09^self methodContext receiver class lookupSelector: self methodContext selector",
- messageSends: ["lookupSelector:", "selector", "methodContext", "class", "receiver"],
- referencedClasses: []
- }),
- smalltalk.MethodContext);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "methodContext",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3;
- $1=_st(self)._isBlockContext();
- if(! smalltalk.assert($1)){
- $2=self;
- return $2;
- };
- $3=_st(self)._home();
- return $3;
- }, function($ctx1) {$ctx1.fill(self,"methodContext",{},smalltalk.MethodContext)})},
- args: [],
- source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self home",
- messageSends: ["ifFalse:", "isBlockContext", "home"],
- referencedClasses: []
- }),
- smalltalk.MethodContext);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "outerContext",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.homeContext;
- return self}, function($ctx1) {$ctx1.fill(self,"outerContext",{},smalltalk.MethodContext)})},
- args: [],
- source: "outerContext\x0a\x09<return self.homeContext>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MethodContext);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "pc",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.pc;
- return self}, function($ctx1) {$ctx1.fill(self,"pc",{},smalltalk.MethodContext)})},
- args: [],
- source: "pc\x0a\x09<return self.pc>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MethodContext);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "printOn:",
- category: 'printing',
- fn: function (aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- smalltalk.Object.fn.prototype._printOn_.apply(_st(self), [aStream]);
- $1=aStream;
- _st($1)._nextPutAll_("(");
- _st($1)._nextPutAll_(_st(self)._asString());
- $2=_st($1)._nextPutAll_(")");
- return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.MethodContext)})},
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
- messageSends: ["printOn:", "nextPutAll:", "asString"],
- referencedClasses: []
- }),
- smalltalk.MethodContext);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "receiver",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.receiver;
- return self}, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.MethodContext)})},
- args: [],
- source: "receiver\x0a\x09<return self.receiver>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MethodContext);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "selector",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- if(self.selector) {
- return smalltalk.convertSelector(self.selector);
- } else {
- return nil;
- }
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.MethodContext)})},
- args: [],
- source: "selector\x0a\x09<\x0a\x09\x09if(self.selector) {\x0a\x09\x09\x09return smalltalk.convertSelector(self.selector);\x0a\x09\x09} else {\x0a\x09\x09\x09return nil;\x0a\x09\x09}\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MethodContext);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "temps",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- _st(self)._deprecatedAPI();
- $1=_st(self)._locals();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"temps",{},smalltalk.MethodContext)})},
- args: [],
- source: "temps\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09^ self locals",
- messageSends: ["deprecatedAPI", "locals"],
- referencedClasses: []
- }),
- smalltalk.MethodContext);
- smalltalk.addClass('NativeFunction', smalltalk.Object, [], 'Kernel-Methods');
- smalltalk.NativeFunction.comment="NativeFunction is a wrapper around native functions, such as `WebSocket`.\x0aFor 'normal' functions (whose constructor is the JavaScript `Function` object), use `BlockClosure`.\x0a\x0aSee the class-side `instance creation` methods.\x0a\x0aCreated instances will most probably be instance of `JSObjectProxy`.\x0a\x0aUsage example:\x0a\x0a\x09| ws |\x0a\x09ws := NativeFunction constructor: 'WebSocket' value: 'ws://localhost'.\x0a\x09ws at: 'onopen' put: [ ws send: 'hey there from Amber' ]"
- smalltalk.addMethod(
- smalltalk.method({
- selector: "constructor:",
- category: 'instance creation',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var native=eval(aString);
- return new native();
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},smalltalk.NativeFunction.klass)})},
- args: ["aString"],
- source: "constructor: aString\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native();\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.NativeFunction.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "constructor:value:",
- category: 'instance creation',
- fn: function (aString,anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var native=eval(aString);
- return new native(anObject);
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},smalltalk.NativeFunction.klass)})},
- args: ["aString", "anObject"],
- source: "constructor: aString value:anObject\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native(anObject);\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.NativeFunction.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "constructor:value:value:",
- category: 'instance creation',
- fn: function (aString,anObject,anObject2){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var native=eval(aString);
- return new native(anObject,anObject2);
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},smalltalk.NativeFunction.klass)})},
- args: ["aString", "anObject", "anObject2"],
- source: "constructor: aString value:anObject value: anObject2\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native(anObject,anObject2);\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.NativeFunction.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "constructor:value:value:value:",
- category: 'instance creation',
- fn: function (aString,anObject,anObject2,anObject3){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var native=eval(aString);
- return new native(anObject,anObject2, anObject3);
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},smalltalk.NativeFunction.klass)})},
- args: ["aString", "anObject", "anObject2", "anObject3"],
- source: "constructor: aString value:anObject value: anObject2 value:anObject3\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native(anObject,anObject2, anObject3);\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.NativeFunction.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "exists:",
- category: 'testing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- if(aString in window) {
- return true
- } else {
- return false
- }
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},smalltalk.NativeFunction.klass)})},
- args: ["aString"],
- source: "exists: aString\x0a\x09<\x0a\x09\x09if(aString in window) {\x0a\x09\x09\x09return true\x0a\x09\x09} else {\x0a\x09\x09\x09return false\x0a\x09\x09}\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.NativeFunction.klass);
- smalltalk.addPackage('Kernel-Collections');
- smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel-Collections');
- smalltalk.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:`"
- smalltalk.addMethod(
- smalltalk.method({
- selector: "=",
- category: 'comparing',
- fn: function (anAssociation){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(_st(self)._class()).__eq(_st(anAssociation)._class()))._and_((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(_st(self)._key()).__eq(_st(anAssociation)._key()))._and_((function(){
- return smalltalk.withContext(function($ctx3) {
- return _st(_st(self)._value()).__eq(_st(anAssociation)._value());
- }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},smalltalk.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]]",
- messageSends: ["and:", "=", "value", "key", "class"],
- referencedClasses: []
- }),
- smalltalk.Association);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "key",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@key"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"key",{},smalltalk.Association)})},
- args: [],
- source: "key\x0a\x09^key",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Association);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "key:",
- category: 'accessing',
- fn: function (aKey){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@key"]=aKey;
- return self}, function($ctx1) {$ctx1.fill(self,"key:",{aKey:aKey},smalltalk.Association)})},
- args: ["aKey"],
- source: "key: aKey\x0a\x09key := aKey",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Association);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "printOn:",
- category: 'printing',
- fn: function (aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(_st(self)._key())._printOn_(aStream);
- _st(aStream)._nextPutAll_(" -> ");
- _st(_st(self)._value())._printOn_(aStream);
- return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Association)})},
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
- messageSends: ["printOn:", "key", "nextPutAll:", "value"],
- referencedClasses: []
- }),
- smalltalk.Association);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "value",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@value"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.Association)})},
- args: [],
- source: "value\x0a\x09^value",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Association);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "value:",
- category: 'accessing',
- fn: function (aValue){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@value"]=aValue;
- return self}, function($ctx1) {$ctx1.fill(self,"value:",{aValue:aValue},smalltalk.Association)})},
- args: ["aValue"],
- source: "value: aValue\x0a\x09value := aValue",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Association);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "key:value:",
- category: 'instance creation',
- fn: function (aKey,aValue){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st(self)._new();
- _st($2)._key_(aKey);
- _st($2)._value_(aValue);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},smalltalk.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",
- messageSends: ["key:", "new", "value:", "yourself"],
- referencedClasses: []
- }),
- smalltalk.Association.klass);
- smalltalk.addClass('Collection', smalltalk.Object, [], 'Kernel-Collections');
- smalltalk.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 Collectiohn hierarchy such as enumerating and converting methods."
- smalltalk.addMethod(
- smalltalk.method({
- selector: ",",
- category: 'copying',
- fn: function (aCollection){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st(self)._copy();
- _st($2)._addAll_(aCollection);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},smalltalk.Collection)})},
- args: ["aCollection"],
- source: ", aCollection\x0a\x09^self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
- messageSends: ["addAll:", "copy", "yourself"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "add:",
- category: 'adding/removing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._subclassResponsibility();
- return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.Collection)})},
- args: ["anObject"],
- source: "add: anObject\x0a\x09self subclassResponsibility",
- messageSends: ["subclassResponsibility"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "addAll:",
- category: 'adding/removing',
- fn: function (aCollection){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- _st(aCollection)._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(self)._add_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- $1=aCollection;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},smalltalk.Collection)})},
- args: ["aCollection"],
- source: "addAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09\x09self add: each].\x0a\x09^aCollection",
- messageSends: ["do:", "add:"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asArray",
- category: 'converting',
- fn: function (){
- var self=this;
- function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st($Array())._withAll_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asArray",{},smalltalk.Collection)})},
- args: [],
- source: "asArray\x0a\x09^Array withAll: self",
- messageSends: ["withAll:"],
- referencedClasses: ["Array"]
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asJSON",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._asArray())._collect_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(each)._asJSON();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Collection)})},
- args: [],
- source: "asJSON\x0a\x09^self asArray collect: [:each | each asJSON]",
- messageSends: ["collect:", "asJSON", "asArray"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asOrderedCollection",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._asArray();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},smalltalk.Collection)})},
- args: [],
- source: "asOrderedCollection\x0a\x09^self asArray",
- messageSends: ["asArray"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asSet",
- category: 'converting',
- fn: function (){
- var self=this;
- function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st($Set())._withAll_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asSet",{},smalltalk.Collection)})},
- args: [],
- source: "asSet\x0a\x09^Set withAll: self",
- messageSends: ["withAll:"],
- referencedClasses: ["Set"]
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "collect:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- var stream;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- stream=_st(_st(_st(self)._class())._new())._writeStream();
- _st(self)._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(stream)._nextPut_(_st(aBlock)._value_(each));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- $1=_st(stream)._contents();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},smalltalk.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",
- messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "copyWith:",
- category: 'copying',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st(self)._copy();
- _st($2)._add_(anObject);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},smalltalk.Collection)})},
- args: ["anObject"],
- source: "copyWith: anObject\x0a\x09^self copy add: anObject; yourself",
- messageSends: ["add:", "copy", "yourself"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "copyWithAll:",
- category: 'copying',
- fn: function (aCollection){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st(self)._copy();
- _st($2)._addAll_(aCollection);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},smalltalk.Collection)})},
- args: ["aCollection"],
- source: "copyWithAll: aCollection\x0a\x09^self copy addAll: aCollection; yourself",
- messageSends: ["addAll:", "copy", "yourself"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "copyWithoutAll:",
- category: 'copying',
- fn: function (aCollection){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._reject_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(aCollection)._includes_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},smalltalk.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]",
- messageSends: ["reject:", "includes:"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "detect:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._detect_ifNone_(aBlock,(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(self)._errorNotFound();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},smalltalk.Collection)})},
- args: ["aBlock"],
- source: "detect: aBlock\x0a\x09^self detect: aBlock ifNone: [self errorNotFound]",
- messageSends: ["detect:ifNone:", "errorNotFound"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "detect:ifNone:",
- category: 'enumerating',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._subclassResponsibility();
- return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Collection)})},
- args: ["aBlock", "anotherBlock"],
- source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
- messageSends: ["subclassResponsibility"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "do:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._subclassResponsibility();
- return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.Collection)})},
- args: ["aBlock"],
- source: "do: aBlock\x0a\x09self subclassResponsibility",
- messageSends: ["subclassResponsibility"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "do:separatedBy:",
- category: 'enumerating',
- fn: function (aBlock,anotherBlock){
- var self=this;
- var actionBeforeElement;
- return smalltalk.withContext(function($ctx1) {
- actionBeforeElement=(function(){
- return smalltalk.withContext(function($ctx2) {
- actionBeforeElement=anotherBlock;
- return actionBeforeElement;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
- _st(self)._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- _st(actionBeforeElement)._value();
- return _st(aBlock)._value_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},smalltalk.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]",
- messageSends: ["do:", "value", "value:"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "errorNotFound",
- category: 'error handling',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._error_("Object is not in the collection");
- return self}, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},smalltalk.Collection)})},
- args: [],
- source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
- messageSends: ["error:"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "ifEmpty:",
- category: 'testing',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=_st(self)._isEmpty();
- if(smalltalk.assert($2)){
- $1=_st(aBlock)._value();
- } else {
- $1=self;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},smalltalk.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. Note 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: self classifyMethodAs:\x0a\x09\x09(myProtocol ifEmpty: ['As yet unclassified'])\x22\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ aBlock value ]\x0a\x09\x09ifFalse: [ self ]",
- messageSends: ["ifTrue:ifFalse:", "value", "isEmpty"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "ifNotEmpty:",
- category: 'testing',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._notEmpty();
- _st($1)._ifTrue_(aBlock);
- return self}, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},smalltalk.Collection)})},
- args: ["aBlock"],
- source: "ifNotEmpty: aBlock\x0a\x09self notEmpty ifTrue: aBlock.",
- messageSends: ["ifTrue:", "notEmpty"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "includes:",
- category: 'testing',
- fn: function (anObject){
- var self=this;
- var sentinel;
- function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- sentinel=_st($Object())._new();
- $1=_st(_st(self)._detect_ifNone_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(each).__eq(anObject);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
- return smalltalk.withContext(function($ctx2) {
- return sentinel;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__tild_eq(sentinel);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,sentinel:sentinel},smalltalk.Collection)})},
- args: ["anObject"],
- source: "includes: anObject\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09^(self detect: [ :each | each = anObject] ifNone: [ sentinel ]) ~= sentinel",
- messageSends: ["new", "~=", "detect:ifNone:", "="],
- referencedClasses: ["Object"]
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "inject:into:",
- category: 'enumerating',
- fn: function (anObject,aBlock){
- var self=this;
- var result;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- result=anObject;
- _st(self)._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- result=_st(aBlock)._value_value_(result,each);
- return result;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- $1=result;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},smalltalk.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",
- messageSends: ["do:", "value:value:"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "intersection:",
- category: 'enumerating',
- fn: function (aCollection){
- var self=this;
- var set,outputSet;
- function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- set=_st(self)._asSet();
- outputSet=_st($Set())._new();
- _st(aCollection)._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- $1=_st(_st(set)._includes_(each))._and_((function(){
- return smalltalk.withContext(function($ctx3) {
- return _st(_st(outputSet)._includes_(each))._not();
- }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
- if(smalltalk.assert($1)){
- return _st(outputSet)._add_(each);
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- $2=_st(_st(self)._class())._withAll_(_st(outputSet)._asArray());
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},smalltalk.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",
- messageSends: ["asSet", "new", "do:", "ifTrue:", "add:", "and:", "not", "includes:", "withAll:", "asArray", "class"],
- referencedClasses: ["Set"]
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isEmpty",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._size()).__eq((0));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},smalltalk.Collection)})},
- args: [],
- source: "isEmpty\x0a\x09^self size = 0",
- messageSends: ["=", "size"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "notEmpty",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._isEmpty())._not();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},smalltalk.Collection)})},
- args: [],
- source: "notEmpty\x0a\x09^self isEmpty not",
- messageSends: ["not", "isEmpty"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "occurrencesOf:",
- category: 'accessing',
- fn: function (anObject){
- var self=this;
- var tally;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- tally=(0);
- _st(self)._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- $1=_st(anObject).__eq(each);
- if(smalltalk.assert($1)){
- tally=_st(tally).__plus((1));
- return tally;
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- $2=tally;
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},smalltalk.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",
- messageSends: ["do:", "ifTrue:", "+", "="],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "putOn:",
- category: 'streaming',
- fn: function (aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(each)._putOn_(aStream);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},smalltalk.Collection)})},
- args: ["aStream"],
- source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
- messageSends: ["do:", "putOn:"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "reject:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._select_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(aBlock)._value_(each)).__eq(false);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},smalltalk.Collection)})},
- args: ["aBlock"],
- source: "reject: aBlock\x0a\x09^self select: [:each | (aBlock value: each) = false]",
- messageSends: ["select:", "=", "value:"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "remove:",
- category: 'adding/removing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._remove_ifAbsent_(anObject,(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(self)._errorNotFound();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},smalltalk.Collection)})},
- args: ["anObject"],
- source: "remove: anObject\x0a\x09^self remove: anObject ifAbsent: [self errorNotFound]",
- messageSends: ["remove:ifAbsent:", "errorNotFound"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "remove:ifAbsent:",
- category: 'adding/removing',
- fn: function (anObject,aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._subclassResponsibility();
- return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.Collection)})},
- args: ["anObject", "aBlock"],
- source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
- messageSends: ["subclassResponsibility"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "select:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- var stream;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- stream=_st(_st(_st(self)._class())._new())._writeStream();
- _st(self)._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- $1=_st(aBlock)._value_(each);
- if(smalltalk.assert($1)){
- return _st(stream)._nextPut_(each);
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- $2=_st(stream)._contents();
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},smalltalk.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",
- messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "nextPut:", "value:", "contents"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "size",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._subclassResponsibility();
- return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Collection)})},
- args: [],
- source: "size\x0a\x09self subclassResponsibility",
- messageSends: ["subclassResponsibility"],
- referencedClasses: []
- }),
- smalltalk.Collection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "new:",
- category: 'instance creation',
- fn: function (anInteger){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._new();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},smalltalk.Collection.klass)})},
- args: ["anInteger"],
- source: "new: anInteger\x0a\x09^self new",
- messageSends: ["new"],
- referencedClasses: []
- }),
- smalltalk.Collection.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "with:",
- category: 'instance creation',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st(self)._new();
- _st($2)._add_(anObject);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},smalltalk.Collection.klass)})},
- args: ["anObject"],
- source: "with: anObject\x0a\x09\x09^self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
- messageSends: ["add:", "new", "yourself"],
- referencedClasses: []
- }),
- smalltalk.Collection.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "with:with:",
- category: 'instance creation',
- fn: function (anObject,anotherObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st(self)._new();
- _st($2)._add_(anObject);
- _st($2)._add_(anotherObject);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},smalltalk.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",
- messageSends: ["add:", "new", "yourself"],
- referencedClasses: []
- }),
- smalltalk.Collection.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "with:with:with:",
- category: 'instance creation',
- fn: function (firstObject,secondObject,thirdObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st(self)._new();
- _st($2)._add_(firstObject);
- _st($2)._add_(secondObject);
- _st($2)._add_(thirdObject);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},smalltalk.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",
- messageSends: ["add:", "new", "yourself"],
- referencedClasses: []
- }),
- smalltalk.Collection.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "withAll:",
- category: 'instance creation',
- fn: function (aCollection){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st(self)._new();
- _st($2)._addAll_(aCollection);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},smalltalk.Collection.klass)})},
- args: ["aCollection"],
- source: "withAll: aCollection\x0a\x09\x09^self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
- messageSends: ["addAll:", "new", "yourself"],
- referencedClasses: []
- }),
- smalltalk.Collection.klass);
- smalltalk.addClass('IndexableCollection', smalltalk.Collection, [], 'Kernel-Collections');
- smalltalk.IndexableCollection.comment="I am a key-value store, that is,\x0ait stores values under indexes.\x0a\x0aAs a rule of thumb, if a collection has at: and at:put:,\x0ait is an IndexableCollection."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "at:",
- category: 'accessing',
- fn: function (anIndex){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._at_ifAbsent_(anIndex,(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(self)._errorNotFound();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},smalltalk.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 ]",
- messageSends: ["at:ifAbsent:", "errorNotFound"],
- referencedClasses: []
- }),
- smalltalk.IndexableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "at:ifAbsent:",
- category: 'accessing',
- fn: function (anIndex,aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._subclassReponsibility();
- return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},smalltalk.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 subclassReponsibility",
- messageSends: ["subclassReponsibility"],
- referencedClasses: []
- }),
- smalltalk.IndexableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "at:ifPresent:",
- category: 'accessing',
- fn: function (anIndex,aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
- return smalltalk.withContext(function($ctx2) {
- return nil;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},smalltalk.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 ]",
- messageSends: ["at:ifPresent:ifAbsent:"],
- referencedClasses: []
- }),
- smalltalk.IndexableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "at:ifPresent:ifAbsent:",
- category: 'accessing',
- fn: function (anIndex,aBlock,anotherBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._subclassReponsibility();
- return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.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 subclassReponsibility",
- messageSends: ["subclassReponsibility"],
- referencedClasses: []
- }),
- smalltalk.IndexableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "at:put:",
- category: 'accessing',
- fn: function (anIndex,anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._subclassReponsibility();
- return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},smalltalk.IndexableCollection)})},
- args: ["anIndex", "anObject"],
- source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassReponsibility",
- messageSends: ["subclassReponsibility"],
- referencedClasses: []
- }),
- smalltalk.IndexableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "indexOf:",
- category: 'accessing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._indexOf_ifAbsent_(anObject,(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(self)._errorNotFound();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},smalltalk.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 ]",
- messageSends: ["indexOf:ifAbsent:", "errorNotFound"],
- referencedClasses: []
- }),
- smalltalk.IndexableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "indexOf:ifAbsent:",
- category: 'accessing',
- fn: function (anObject,aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._subclassResponsibility();
- return self}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.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",
- messageSends: ["subclassResponsibility"],
- referencedClasses: []
- }),
- smalltalk.IndexableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "with:do:",
- category: 'enumarating',
- fn: function (anotherCollection,aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._withIndexDo_((function(each,index){
- return smalltalk.withContext(function($ctx2) {
- return _st(aBlock)._value_value_(each,_st(anotherCollection)._at_(index));
- }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},smalltalk.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) ]",
- messageSends: ["withIndexDo:", "value:value:", "at:"],
- referencedClasses: []
- }),
- smalltalk.IndexableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "withIndexDo:",
- category: 'enumarating',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._subclassReponsibility();
- return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},smalltalk.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 subclassReponsibility",
- messageSends: ["subclassReponsibility"],
- referencedClasses: []
- }),
- smalltalk.IndexableCollection);
- smalltalk.addClass('HashedCollection', smalltalk.IndexableCollection, [], 'Kernel-Collections');
- smalltalk.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, it can only have strings as keys."
- smalltalk.addMethod(
- smalltalk.method({
- selector: ",",
- category: 'copying',
- fn: function (aCollection){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._shouldNotImplement();
- return self}, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},smalltalk.HashedCollection)})},
- args: ["aCollection"],
- source: ", aCollection\x0a\x09self shouldNotImplement",
- messageSends: ["shouldNotImplement"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "=",
- category: 'comparing',
- fn: function (aHashedCollection){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3;
- $1=_st(_st(self)._class()).__eq(_st(aHashedCollection)._class());
- if(! smalltalk.assert($1)){
- return false;
- };
- $2=_st(_st(self)._size()).__eq(_st(aHashedCollection)._size());
- if(! smalltalk.assert($2)){
- return false;
- };
- $3=_st(_st(self)._associations()).__eq(_st(aHashedCollection)._associations());
- return $3;
- }, function($ctx1) {$ctx1.fill(self,"=",{aHashedCollection:aHashedCollection},smalltalk.HashedCollection)})},
- args: ["aHashedCollection"],
- source: "= aHashedCollection\x0a\x09self class = aHashedCollection class ifFalse: [^false].\x0a\x09self size = aHashedCollection size ifFalse: [^false].\x0a\x09^self associations = aHashedCollection associations",
- messageSends: ["ifFalse:", "=", "class", "size", "associations"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "add:",
- category: 'adding/removing',
- fn: function (anAssociation){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._at_put_(_st(anAssociation)._key(),_st(anAssociation)._value());
- return self}, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},smalltalk.HashedCollection)})},
- args: ["anAssociation"],
- source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
- messageSends: ["at:put:", "key", "value"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "addAll:",
- category: 'adding/removing',
- fn: function (aHashedCollection){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- smalltalk.IndexableCollection.fn.prototype._addAll_.apply(_st(self), [_st(aHashedCollection)._associations()]);
- $1=aHashedCollection;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"addAll:",{aHashedCollection:aHashedCollection},smalltalk.HashedCollection)})},
- args: ["aHashedCollection"],
- source: "addAll: aHashedCollection\x0a\x09super addAll: aHashedCollection associations.\x0a\x09^aHashedCollection",
- messageSends: ["addAll:", "associations"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asDictionary",
- category: 'converting',
- fn: function (){
- var self=this;
- function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st($Dictionary())._fromPairs_(_st(self)._associations());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},smalltalk.HashedCollection)})},
- args: [],
- source: "asDictionary\x0a\x09^Dictionary fromPairs: self associations",
- messageSends: ["fromPairs:", "associations"],
- referencedClasses: ["Dictionary"]
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asJSON",
- category: 'converting',
- fn: function (){
- var self=this;
- var c;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- c=_st(_st(self)._class())._new();
- _st(self)._keysAndValuesDo_((function(key,value){
- return smalltalk.withContext(function($ctx2) {
- return _st(c)._at_put_(key,_st(value)._asJSON());
- }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
- $1=c;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJSON",{c:c},smalltalk.HashedCollection)})},
- args: [],
- source: "asJSON\x0a\x09| c |\x0a\x09c := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09\x09c at: key put: value asJSON].\x0a\x09^c",
- messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "asJSON"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "associations",
- category: 'accessing',
- fn: function (){
- var self=this;
- var associations;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- associations=[];
- _st(self)._associationsDo_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(associations)._add_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- $1=associations;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},smalltalk.HashedCollection)})},
- args: [],
- source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [:each | associations add: each].\x0a\x09^associations",
- messageSends: ["associationsDo:", "add:"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "associationsDo:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- function $Association(){return smalltalk.Association||(typeof Association=="undefined"?nil:Association)}
- return smalltalk.withContext(function($ctx1) {
- _st(self)._keysAndValuesDo_((function(key,value){
- return smalltalk.withContext(function($ctx2) {
- return _st(aBlock)._value_(_st($Association())._key_value_(key,value));
- }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
- args: ["aBlock"],
- source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09\x09aBlock value: (Association key: key value: value)]",
- messageSends: ["keysAndValuesDo:", "value:", "key:value:"],
- referencedClasses: ["Association"]
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "at:ifAbsent:",
- category: 'accessing',
- fn: function (aKey,aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=_st(self)._includesKey_(aKey);
- $1=_st($2)._ifTrue_ifFalse_((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(self)._basicAt_(aKey);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.HashedCollection)})},
- args: ["aKey", "aBlock"],
- source: "at: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [self basicAt: aKey]\x0a\x09\x09ifFalse: aBlock",
- messageSends: ["ifTrue:ifFalse:", "basicAt:", "includesKey:"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "at:ifAbsentPut:",
- category: 'accessing',
- fn: function (aKey,aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._at_ifAbsent_(aKey,(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(self)._at_put_(aKey,_st(aBlock)._value());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},smalltalk.HashedCollection)})},
- args: ["aKey", "aBlock"],
- source: "at: aKey ifAbsentPut: aBlock\x0a\x09^self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value]",
- messageSends: ["at:ifAbsent:", "at:put:", "value"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "at:ifPresent:ifAbsent:",
- category: 'accessing',
- fn: function (aKey,aBlock,anotherBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=_st(self)._includesKey_(aKey);
- $1=_st($2)._ifTrue_ifFalse_((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(aBlock)._value_(_st(self)._at_(aKey));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),anotherBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.HashedCollection)})},
- 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 with the value associated with the key,\x0a\x09otherwise answer the value of absentBlock.\x22\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: anotherBlock",
- messageSends: ["ifTrue:ifFalse:", "value:", "at:", "includesKey:"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "at:put:",
- category: 'accessing',
- fn: function (aKey,aValue){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._basicAt_put_(aKey,aValue);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},smalltalk.HashedCollection)})},
- args: ["aKey", "aValue"],
- source: "at: aKey put: aValue\x0a\x09^self basicAt: aKey put: aValue",
- messageSends: ["basicAt:put:"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "collect:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- var newDict;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- newDict=_st(_st(self)._class())._new();
- _st(self)._keysAndValuesDo_((function(key,value){
- return smalltalk.withContext(function($ctx2) {
- return _st(newDict)._at_put_(key,_st(aBlock)._value_(value));
- }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
- $1=newDict;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},smalltalk.HashedCollection)})},
- 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",
- messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "deepCopy",
- category: 'copying',
- fn: function (){
- var self=this;
- var copy;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- copy=_st(_st(self)._class())._new();
- _st(self)._keysAndValuesDo_((function(key,value){
- return smalltalk.withContext(function($ctx2) {
- return _st(copy)._at_put_(key,_st(value)._deepCopy());
- }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
- $1=copy;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},smalltalk.HashedCollection)})},
- 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",
- messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "detect:ifNone:",
- category: 'enumerating',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._values())._detect_ifNone_(aBlock,anotherBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.HashedCollection)})},
- args: ["aBlock", "anotherBlock"],
- source: "detect: aBlock ifNone: anotherBlock\x0a\x09^self values detect: aBlock ifNone: anotherBlock",
- messageSends: ["detect:ifNone:", "values"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "do:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._valuesDo_(aBlock);
- return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.HashedCollection)})},
- args: ["aBlock"],
- source: "do: aBlock\x0a\x09self valuesDo: aBlock",
- messageSends: ["valuesDo:"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "includes:",
- category: 'enumerating',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._values())._includes_(anObject);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},smalltalk.HashedCollection)})},
- args: ["anObject"],
- source: "includes: anObject\x0a\x09^self values includes: anObject",
- messageSends: ["includes:", "values"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "includesKey:",
- category: 'testing',
- fn: function (aKey){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.hasOwnProperty(aKey);
- return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},smalltalk.HashedCollection)})},
- args: ["aKey"],
- source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "indexOf:ifAbsent:",
- category: 'accessing',
- fn: function (anObject,aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._keys())._detect_ifNone_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(self)._at_(each)).__eq(anObject);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),aBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.HashedCollection)})},
- args: ["anObject", "aBlock"],
- source: "indexOf: anObject ifAbsent: aBlock\x0a\x0a\x09^ self keys detect: [ :each | (self at: each) = anObject ] ifNone: aBlock",
- messageSends: ["detect:ifNone:", "=", "at:", "keys"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "keys",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- if ('function'===typeof Object.keys) return Object.keys(self);
- var keys = [];
- for(var i in self) {
- if(self.hasOwnProperty(i)) {
- keys.push(i);
- }
- };
- return keys;
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"keys",{},smalltalk.HashedCollection)})},
- args: [],
- source: "keys\x0a\x09<\x0a\x09\x09if ('function'===typeof Object.keys) return Object.keys(self);\x0a\x09\x09var keys = [];\x0a\x09\x09for(var i in self) {\x0a\x09\x09\x09if(self.hasOwnProperty(i)) {\x0a\x09\x09\x09\x09keys.push(i);\x0a\x09\x09\x09}\x0a\x09\x09};\x0a\x09\x09return keys;\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "keysAndValuesDo:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._keysDo_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(aBlock)._value_value_(each,_st(self)._at_(each));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
- args: ["aBlock"],
- source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [:each |\x0a\x09\x09aBlock value: each value: (self at: each)]",
- messageSends: ["keysDo:", "value:value:", "at:"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "keysDo:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(_st(self)._keys())._do_(aBlock);
- return self}, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
- args: ["aBlock"],
- source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
- messageSends: ["do:", "keys"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "printOn:",
- category: 'printing',
- fn: function (aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- smalltalk.IndexableCollection.fn.prototype._printOn_.apply(_st(self), [aStream]);
- _st(aStream)._nextPutAll_(" (");
- _st(_st(self)._associations())._do_separatedBy_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(each)._printOn_(aStream);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(aStream)._nextPutAll_(" , ");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- _st(aStream)._nextPutAll_(")");
- return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.HashedCollection)})},
- 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: ')'",
- messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "remove:ifAbsent:",
- category: 'adding/removing',
- fn: function (aKey,aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._removeKey_ifAbsent_(aKey,aBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.HashedCollection)})},
- args: ["aKey", "aBlock"],
- source: "remove: aKey ifAbsent: aBlock\x0a\x09^self removeKey: aKey ifAbsent: aBlock",
- messageSends: ["removeKey:ifAbsent:"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "removeKey:",
- category: 'adding/removing',
- fn: function (aKey){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._remove_(aKey);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},smalltalk.HashedCollection)})},
- args: ["aKey"],
- source: "removeKey: aKey\x0a\x09^self remove: aKey",
- messageSends: ["remove:"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "removeKey:ifAbsent:",
- category: 'adding/removing',
- fn: function (aKey,aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=_st(self)._includesKey_(aKey);
- if(smalltalk.assert($2)){
- $1=_st(self)._basicDelete_(aKey);
- } else {
- $1=_st(aBlock)._value();
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.HashedCollection)})},
- args: ["aKey", "aBlock"],
- source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifFalse: [aBlock value]\x0a\x09\x09ifTrue: [self basicDelete: aKey]",
- messageSends: ["ifFalse:ifTrue:", "value", "basicDelete:", "includesKey:"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "select:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- var newDict;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- newDict=_st(_st(self)._class())._new();
- _st(self)._keysAndValuesDo_((function(key,value){
- return smalltalk.withContext(function($ctx2) {
- $1=_st(aBlock)._value_(value);
- if(smalltalk.assert($1)){
- return _st(newDict)._at_put_(key,value);
- };
- }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
- $2=newDict;
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},smalltalk.HashedCollection)})},
- 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",
- messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "at:put:", "value:"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "shallowCopy",
- category: 'copying',
- fn: function (){
- var self=this;
- var copy;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- copy=_st(_st(self)._class())._new();
- _st(self)._keysAndValuesDo_((function(key,value){
- return smalltalk.withContext(function($ctx2) {
- return _st(copy)._at_put_(key,value);
- }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
- $1=copy;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},smalltalk.HashedCollection)})},
- 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",
- messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "size",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._keys())._size();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.HashedCollection)})},
- args: [],
- source: "size\x0a\x09^self keys size",
- messageSends: ["size", "keys"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "values",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._keys())._collect_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(self)._at_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"values",{},smalltalk.HashedCollection)})},
- args: [],
- source: "values\x0a\x09^self keys collect: [:each | self at: each]",
- messageSends: ["collect:", "at:", "keys"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "valuesDo:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._keysAndValuesDo_((function(key,value){
- return smalltalk.withContext(function($ctx2) {
- return _st(aBlock)._value_(value);
- }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
- args: ["aBlock"],
- source: "valuesDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value ]",
- messageSends: ["keysAndValuesDo:", "value:"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "withIndexDo:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._keysAndValuesDo_((function(key,value){
- return smalltalk.withContext(function($ctx2) {
- return _st(aBlock)._value_value_(value,key);
- }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
- args: ["aBlock"],
- source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
- messageSends: ["keysAndValuesDo:", "value:value:"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "fromPairs:",
- category: 'instance creation',
- fn: function (aCollection){
- var self=this;
- var dict;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- dict=_st(self)._new();
- _st(aCollection)._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(dict)._add_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- $1=dict;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection,dict:dict},smalltalk.HashedCollection.klass)})},
- args: ["aCollection"],
- source: "fromPairs: aCollection\x0a\x09| dict |\x0a\x09dict := self new.\x0a\x09aCollection do: [:each | dict add: each].\x0a\x09^dict",
- messageSends: ["new", "do:", "add:"],
- referencedClasses: []
- }),
- smalltalk.HashedCollection.klass);
- smalltalk.addClass('Dictionary', smalltalk.HashedCollection, ['keys', 'values'], 'Kernel-Collections');
- smalltalk.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."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asHashedCollection",
- category: 'converting',
- fn: function (){
- var self=this;
- function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st($HashedCollection())._fromPairs_(_st(self)._associations());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},smalltalk.Dictionary)})},
- args: [],
- source: "asHashedCollection\x0a\x09^HashedCollection fromPairs: self associations",
- messageSends: ["fromPairs:", "associations"],
- referencedClasses: ["HashedCollection"]
- }),
- smalltalk.Dictionary);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asJSON",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._asHashedCollection())._asJSON();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Dictionary)})},
- args: [],
- source: "asJSON\x0a\x09^self asHashedCollection asJSON",
- messageSends: ["asJSON", "asHashedCollection"],
- referencedClasses: []
- }),
- smalltalk.Dictionary);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "at:ifAbsent:",
- category: 'accessing',
- fn: function (aKey,aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var index = self._positionOfKey_(aKey);
- return index >=0 ? self['@values'][index] : aBlock();
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.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();\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Dictionary);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "at:put:",
- category: 'accessing',
- fn: function (aKey,aValue){
- var self=this;
- return smalltalk.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},smalltalk.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>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Dictionary);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "includesKey:",
- category: 'testing',
- fn: function (aKey){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self._positionOfKey_(aKey) >= 0; ;
- return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},smalltalk.Dictionary)})},
- args: ["aKey"],
- source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Dictionary);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "indexOf:ifAbsent:",
- category: 'accessing',
- fn: function (anObject,aBlock){
- var self=this;
- var index;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- index=_st(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
- return smalltalk.withContext(function($ctx2) {
- return (0);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- $2=_st(index).__eq((0));
- if(smalltalk.assert($2)){
- $1=_st(aBlock)._value();
- } else {
- $1=_st(self["@keys"])._at_(index);
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},smalltalk.Dictionary)})},
- args: ["anObject", "aBlock"],
- source: "indexOf: anObject ifAbsent: aBlock\x0a\x0a\x09| index |\x0a\x09index := values indexOf: anObject ifAbsent: [0].\x0a\x09^ index = 0 ifTrue: [ aBlock value ] ifFalse: [ keys at: index ]",
- messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "value", "at:", "="],
- referencedClasses: []
- }),
- smalltalk.Dictionary);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "initialize",
- category: 'initialization',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- smalltalk.HashedCollection.fn.prototype._initialize.apply(_st(self), []);
- self["@keys"]=[];
- self["@values"]=[];
- return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Dictionary)})},
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
- messageSends: ["initialize"],
- referencedClasses: []
- }),
- smalltalk.Dictionary);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "keys",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self["@keys"])._copy();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"keys",{},smalltalk.Dictionary)})},
- args: [],
- source: "keys\x0a\x09^keys copy",
- messageSends: ["copy"],
- referencedClasses: []
- }),
- smalltalk.Dictionary);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "keysAndValuesDo:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self["@keys"])._with_do_(self["@values"],aBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},smalltalk.Dictionary)})},
- args: ["aBlock"],
- source: "keysAndValuesDo: aBlock\x0a\x09^keys with: values do: aBlock",
- messageSends: ["with:do:"],
- referencedClasses: []
- }),
- smalltalk.Dictionary);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "keysDo:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self["@keys"])._do_(aBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},smalltalk.Dictionary)})},
- args: ["aBlock"],
- source: "keysDo: aBlock\x0a\x09^keys do: aBlock",
- messageSends: ["do:"],
- referencedClasses: []
- }),
- smalltalk.Dictionary);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "positionOfKey:",
- category: 'private',
- fn: function (anObject){
- var self=this;
- return smalltalk.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},smalltalk.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>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Dictionary);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "removeKey:ifAbsent:",
- category: 'adding/removing',
- fn: function (aKey,aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var index = self._positionOfKey_(aKey);
- if(index === -1) {
- return aBlock()
- } 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},smalltalk.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()\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>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Dictionary);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "values",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self["@values"])._copy();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"values",{},smalltalk.Dictionary)})},
- args: [],
- source: "values\x0a\x09^values copy",
- messageSends: ["copy"],
- referencedClasses: []
- }),
- smalltalk.Dictionary);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "valuesDo:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self["@values"])._do_(aBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},smalltalk.Dictionary)})},
- args: ["aBlock"],
- source: "valuesDo: aBlock\x0a\x09^values do: aBlock",
- messageSends: ["do:"],
- referencedClasses: []
- }),
- smalltalk.Dictionary);
- smalltalk.addClass('SequenceableCollection', smalltalk.IndexableCollection, [], 'Kernel-Collections');
- smalltalk.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "=",
- category: 'comparing',
- fn: function (aCollection){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- var $early={};
- try {
- $1=_st(_st(_st(self)._class()).__eq(_st(aCollection)._class()))._and_((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(self)._size()).__eq(_st(aCollection)._size());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- if(! smalltalk.assert($1)){
- return false;
- };
- _st(self)._withIndexDo_((function(each,i){
- return smalltalk.withContext(function($ctx2) {
- $2=_st(_st(aCollection)._at_(i)).__eq(each);
- if(! smalltalk.assert($2)){
- throw $early=[false];
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1)})}));
- return true;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},smalltalk.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",
- messageSends: ["ifFalse:", "and:", "=", "size", "class", "withIndexDo:", "at:"],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "addLast:",
- category: 'adding',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._add_(anObject);
- return self}, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},smalltalk.SequenceableCollection)})},
- args: ["anObject"],
- source: "addLast: anObject\x0a\x09self add: anObject",
- messageSends: ["add:"],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "allButFirst",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._copyFrom_to_((2),_st(self)._size());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},smalltalk.SequenceableCollection)})},
- args: [],
- source: "allButFirst\x0a\x09^self copyFrom: 2 to: self size",
- messageSends: ["copyFrom:to:", "size"],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "allButLast",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._copyFrom_to_((1),_st(_st(self)._size()).__minus((1)));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"allButLast",{},smalltalk.SequenceableCollection)})},
- args: [],
- source: "allButLast\x0a\x09^self copyFrom: 1 to: self size - 1",
- messageSends: ["copyFrom:to:", "-", "size"],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "atRandom",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._at_(_st(_st(self)._size())._atRandom());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"atRandom",{},smalltalk.SequenceableCollection)})},
- args: [],
- source: "atRandom\x0a\x09^ self at: self size atRandom",
- messageSends: ["at:", "atRandom", "size"],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "copyFrom:to:",
- category: 'copying',
- fn: function (anIndex,anotherIndex){
- var self=this;
- var range,newCollection;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- range=_st(anIndex)._to_(anotherIndex);
- newCollection=_st(_st(self)._class())._new_(_st(range)._size());
- _st(range)._withIndexDo_((function(each,i){
- return smalltalk.withContext(function($ctx2) {
- return _st(newCollection)._at_put_(i,_st(self)._at_(each));
- }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1)})}));
- $1=newCollection;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex,range:range,newCollection:newCollection},smalltalk.SequenceableCollection)})},
- args: ["anIndex", "anotherIndex"],
- source: "copyFrom: anIndex to: anotherIndex\x0a\x09| range newCollection |\x0a\x09range := anIndex to: anotherIndex.\x0a\x09newCollection := self class new: range size.\x0a\x09range withIndexDo: [:each :i |\x0a\x09\x09newCollection at: i put: (self at: each)].\x0a\x09^newCollection",
- messageSends: ["to:", "new:", "size", "class", "withIndexDo:", "at:put:", "at:"],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "deepCopy",
- category: 'copying',
- fn: function (){
- var self=this;
- var newCollection;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- newCollection=_st(_st(self)._class())._new_(_st(self)._size());
- _st(self)._withIndexDo_((function(each,index){
- return smalltalk.withContext(function($ctx2) {
- return _st(newCollection)._at_put_(index,_st(each)._deepCopy());
- }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
- $1=newCollection;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"deepCopy",{newCollection:newCollection},smalltalk.SequenceableCollection)})},
- args: [],
- source: "deepCopy\x0a\x09| newCollection |\x0a\x09newCollection := self class new: self size.\x0a\x09self withIndexDo: [:each :index |\x0a\x09\x09newCollection at: index put: each deepCopy].\x0a\x09^newCollection",
- messageSends: ["new:", "size", "class", "withIndexDo:", "at:put:", "deepCopy"],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "detect:ifNone:",
- category: 'enumerating',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- for(var i = 0; i < self.length; i++)
- if(aBlock(self[i]))
- return self[i];
- return anotherBlock();
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.SequenceableCollection)})},
- args: ["aBlock", "anotherBlock"],
- source: "detect: aBlock ifNone: anotherBlock\x0a\x09<\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock();\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "do:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- for(var i=0;i<self.length;i++){aBlock(self[i]);};
- return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.SequenceableCollection)})},
- args: ["aBlock"],
- source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self[i]);}>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "first",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._at_((1));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"first",{},smalltalk.SequenceableCollection)})},
- args: [],
- source: "first\x0a\x09^self at: 1",
- messageSends: ["at:"],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "first:",
- category: 'accessing',
- fn: function (n){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._copyFrom_to_((1),n);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"first:",{n:n},smalltalk.SequenceableCollection)})},
- args: ["n"],
- source: "first: n\x0a\x09\x22Answer the first n elements of the receiver.\x0a\x09Raise an error if there are not enough elements.\x22\x0a\x0a\x09^ self copyFrom: 1 to: n",
- messageSends: ["copyFrom:to:"],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "fourth",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._at_((4));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"fourth",{},smalltalk.SequenceableCollection)})},
- args: [],
- source: "fourth\x0a\x09^self at: 4",
- messageSends: ["at:"],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "includes:",
- category: 'testing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._indexOf_ifAbsent_(anObject,(function(){
- return smalltalk.withContext(function($ctx2) {
- return nil;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._notNil();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},smalltalk.SequenceableCollection)})},
- args: ["anObject"],
- source: "includes: anObject\x0a\x09^(self indexOf: anObject ifAbsent: [nil]) notNil",
- messageSends: ["notNil", "indexOf:ifAbsent:"],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "indexOf:ifAbsent:",
- category: 'accessing',
- fn: function (anObject,aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- for(var i=0;i<self.length;i++) {
- if(self[i].__eq(anObject)) {return i+1}
- };
- return aBlock();
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.SequenceableCollection)})},
- args: ["anObject", "aBlock"],
- source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<\x0a\x09\x09for(var i=0;i<self.length;i++) {\x0a\x09\x09\x09if(self[i].__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock();\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "indexOf:startingAt:",
- category: 'accessing',
- fn: function (anObject,start){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
- return smalltalk.withContext(function($ctx2) {
- return (0);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},smalltalk.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]",
- messageSends: ["indexOf:startingAt:ifAbsent:"],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "indexOf:startingAt:ifAbsent:",
- category: 'accessing',
- fn: function (anObject,start,aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- for(var i=start-1;i<self.length;i++){
- if(self[i].__eq(anObject)) {return i+1}
- }
- return aBlock();
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},smalltalk.SequenceableCollection)})},
- args: ["anObject", "start", "aBlock"],
- source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<\x0a\x09\x09for(var i=start-1;i<self.length;i++){\x0a\x09\x09\x09if(self[i].__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock();\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "last",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._at_(_st(self)._size());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"last",{},smalltalk.SequenceableCollection)})},
- args: [],
- source: "last\x0a\x09^self at: self size",
- messageSends: ["at:", "size"],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "newStream",
- category: 'streaming',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._streamClass())._on_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.SequenceableCollection)})},
- args: [],
- source: "newStream\x0a\x09^self streamClass on: self",
- messageSends: ["on:", "streamClass"],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "readStream",
- category: 'streaming',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._stream();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"readStream",{},smalltalk.SequenceableCollection)})},
- args: [],
- source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^self stream",
- messageSends: ["stream"],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "removeLast",
- category: 'adding',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._remove_(_st(self)._last());
- return self}, function($ctx1) {$ctx1.fill(self,"removeLast",{},smalltalk.SequenceableCollection)})},
- args: [],
- source: "removeLast\x0a\x09self remove: self last",
- messageSends: ["remove:", "last"],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "reversed",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._subclassResponsibility();
- return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},smalltalk.SequenceableCollection)})},
- args: [],
- source: "reversed\x0a\x09self subclassResponsibility",
- messageSends: ["subclassResponsibility"],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "second",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._at_((2));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"second",{},smalltalk.SequenceableCollection)})},
- args: [],
- source: "second\x0a\x09^self at: 2",
- messageSends: ["at:"],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "shallowCopy",
- category: 'copying',
- fn: function (){
- var self=this;
- var newCollection;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- newCollection=_st(_st(self)._class())._new_(_st(self)._size());
- _st(self)._withIndexDo_((function(each,index){
- return smalltalk.withContext(function($ctx2) {
- return _st(newCollection)._at_put_(index,each);
- }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
- $1=newCollection;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{newCollection:newCollection},smalltalk.SequenceableCollection)})},
- args: [],
- source: "shallowCopy\x0a\x09| newCollection |\x0a\x09newCollection := self class new: self size.\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09newCollection at: index put: each].\x0a\x09^newCollection",
- messageSends: ["new:", "size", "class", "withIndexDo:", "at:put:"],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "stream",
- category: 'streaming',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._newStream();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"stream",{},smalltalk.SequenceableCollection)})},
- args: [],
- source: "stream\x0a\x09^self newStream",
- messageSends: ["newStream"],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "streamClass",
- category: 'streaming',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._class())._streamClass();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.SequenceableCollection)})},
- args: [],
- source: "streamClass\x0a\x09^self class streamClass",
- messageSends: ["streamClass", "class"],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "third",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._at_((3));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"third",{},smalltalk.SequenceableCollection)})},
- args: [],
- source: "third\x0a\x09^self at: 3",
- messageSends: ["at:"],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "with:do:",
- category: 'enumerating',
- fn: function (anotherCollection,aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- for(var i=0;i<self.length;i++){aBlock(self[i], anotherCollection[i]);};
- return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},smalltalk.SequenceableCollection)})},
- args: ["anotherCollection", "aBlock"],
- source: "with: anotherCollection do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self[i], anotherCollection[i]);}>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "withIndexDo:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- for(var i=0;i<self.length;i++){aBlock(self[i], i+1);};
- return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},smalltalk.SequenceableCollection)})},
- args: ["aBlock"],
- source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self[i], i+1);}>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "writeStream",
- category: 'streaming',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._stream();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"writeStream",{},smalltalk.SequenceableCollection)})},
- args: [],
- source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^self stream",
- messageSends: ["stream"],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "streamClass",
- category: 'accessing',
- fn: function (){
- var self=this;
- function $Stream(){return smalltalk.Stream||(typeof Stream=="undefined"?nil:Stream)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=$Stream();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.SequenceableCollection.klass)})},
- args: [],
- source: "streamClass\x0a\x09\x09^Stream",
- messageSends: [],
- referencedClasses: ["Stream"]
- }),
- smalltalk.SequenceableCollection.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "streamContents:",
- category: 'streaming',
- fn: function (aBlock){
- var self=this;
- var stream;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- stream=_st(_st(self)._streamClass())._on_(_st(self)._new());
- _st(aBlock)._value_(stream);
- $1=_st(stream)._contents();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},smalltalk.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",
- messageSends: ["on:", "new", "streamClass", "value:", "contents"],
- referencedClasses: []
- }),
- smalltalk.SequenceableCollection.klass);
- smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
- smalltalk.Array.comment="I represent a collection of objects ordered by the collector. The size of arrays is dynamic.\x0aIn Amber, OrderedCollection is an alias for Array."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "add:",
- category: 'adding/removing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self.push(anObject); return anObject;;
- return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.Array)})},
- args: ["anObject"],
- source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Array);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asJavascript",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st("[").__comma(_st(_st(self)._collect_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(each)._asJavascript();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._join_(", "))).__comma("]");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Array)})},
- args: [],
- source: "asJavascript\x0a\x09^'[', ((self collect: [:each | each asJavascript]) join: ', '), ']'",
- messageSends: [",", "join:", "collect:", "asJavascript"],
- referencedClasses: []
- }),
- smalltalk.Array);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "at:ifAbsent:",
- category: 'accessing',
- fn: function (anIndex,aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- if((anIndex < 1) || (self.length < anIndex)) {return aBlock()};
- return self[anIndex - 1];
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},smalltalk.Array)})},
- args: ["anIndex", "aBlock"],
- source: "at: anIndex ifAbsent: aBlock\x0a\x09<\x0a\x09\x09if((anIndex < 1) || (self.length < anIndex)) {return aBlock()};\x0a\x09\x09return self[anIndex - 1];\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Array);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "at:put:",
- category: 'accessing',
- fn: function (anIndex,anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self[anIndex - 1] = anObject;
- return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},smalltalk.Array)})},
- args: ["anIndex", "anObject"],
- source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Array);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "join:",
- category: 'enumerating',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.join(aString);
- return self}, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},smalltalk.Array)})},
- args: ["aString"],
- source: "join: aString\x0a\x09<return self.join(aString)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Array);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "printOn:",
- category: 'printing',
- fn: function (aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- smalltalk.SequenceableCollection.fn.prototype._printOn_.apply(_st(self), [aStream]);
- _st(aStream)._nextPutAll_(" (");
- _st(self)._do_separatedBy_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(each)._printOn_(aStream);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(aStream)._nextPutAll_(" ");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- _st(aStream)._nextPutAll_(")");
- return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.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: ')'",
- messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"],
- referencedClasses: []
- }),
- smalltalk.Array);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "remove:ifAbsent:",
- category: 'adding/removing',
- fn: function (anObject,aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- for(var i=0;i<self.length;i++) {
- if(self[i] == anObject) {
- self.splice(i,1);
- return self;
- }
- };
- aBlock._value();
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.Array)})},
- args: ["anObject", "aBlock"],
- source: "remove: anObject ifAbsent: aBlock\x0a\x09<\x0a\x09\x09for(var i=0;i<self.length;i++) {\x0a\x09\x09\x09if(self[i] == anObject) {\x0a\x09\x09\x09\x09self.splice(i,1);\x0a\x09\x09\x09\x09return self;\x0a\x09\x09\x09}\x0a\x09\x09};\x0a\x09\x09aBlock._value();\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Array);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "removeFrom:to:",
- category: 'adding/removing',
- fn: function (aNumber,anotherNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self.splice(aNumber - 1,anotherNumber - 1);
- return self}, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},smalltalk.Array)})},
- args: ["aNumber", "anotherNumber"],
- source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber - 1,anotherNumber - 1)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Array);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "reversed",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self._copy().reverse();
- return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},smalltalk.Array)})},
- args: [],
- source: "reversed\x0a\x09<return self._copy().reverse()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Array);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "size",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.length;
- return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Array)})},
- args: [],
- source: "size\x0a\x09<return self.length>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Array);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "sort",
- category: 'enumerating',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._basicPerform_("sort");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"sort",{},smalltalk.Array)})},
- args: [],
- source: "sort\x0a\x09^self basicPerform: 'sort'",
- messageSends: ["basicPerform:"],
- referencedClasses: []
- }),
- smalltalk.Array);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "sort:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.sort(function(a, b) {
- if(aBlock(a,b)) {return -1} else {return 1}
- })
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},smalltalk.Array)})},
- args: ["aBlock"],
- source: "sort: aBlock\x0a\x09<\x0a\x09\x09return self.sort(function(a, b) {\x0a\x09\x09\x09if(aBlock(a,b)) {return -1} else {return 1}\x0a\x09\x09})\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Array);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "sorted",
- category: 'enumerating',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._copy())._sort();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"sorted",{},smalltalk.Array)})},
- args: [],
- source: "sorted\x0a\x09^self copy sort",
- messageSends: ["sort", "copy"],
- referencedClasses: []
- }),
- smalltalk.Array);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "sorted:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._copy())._sort_(aBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},smalltalk.Array)})},
- args: ["aBlock"],
- source: "sorted: aBlock\x0a\x09^self copy sort: aBlock",
- messageSends: ["sort:", "copy"],
- referencedClasses: []
- }),
- smalltalk.Array);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "new:",
- category: 'instance creation',
- fn: function (anInteger){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return new Array(anInteger);
- return self}, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},smalltalk.Array.klass)})},
- args: ["anInteger"],
- source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Array.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "with:",
- category: 'instance creation',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st(self)._new_((1));
- _st($2)._at_put_((1),anObject);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},smalltalk.Array.klass)})},
- args: ["anObject"],
- source: "with: anObject\x0a\x09\x09^(self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
- messageSends: ["at:put:", "new:", "yourself"],
- referencedClasses: []
- }),
- smalltalk.Array.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "with:with:",
- category: 'instance creation',
- fn: function (anObject,anObject2){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st(self)._new_((2));
- _st($2)._at_put_((1),anObject);
- _st($2)._at_put_((2),anObject2);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},smalltalk.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",
- messageSends: ["at:put:", "new:", "yourself"],
- referencedClasses: []
- }),
- smalltalk.Array.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "with:with:with:",
- category: 'instance creation',
- fn: function (anObject,anObject2,anObject3){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st(self)._new_((3));
- _st($2)._at_put_((1),anObject);
- _st($2)._at_put_((2),anObject2);
- _st($2)._at_put_((3),anObject3);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},smalltalk.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",
- messageSends: ["at:put:", "new:", "yourself"],
- referencedClasses: []
- }),
- smalltalk.Array.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "withAll:",
- category: 'instance creation',
- fn: function (aCollection){
- var self=this;
- var instance,index;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- index=(1);
- instance=_st(self)._new_(_st(aCollection)._size());
- _st(aCollection)._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- _st(instance)._at_put_(index,each);
- index=_st(index).__plus((1));
- return index;
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- $1=instance;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},smalltalk.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",
- messageSends: ["new:", "size", "do:", "at:put:", "+"],
- referencedClasses: []
- }),
- smalltalk.Array.klass);
- smalltalk.addClass('CharacterArray', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
- smalltalk.CharacterArray.comment="I am the abstract superclass of string-like collections."
- smalltalk.addMethod(
- smalltalk.method({
- selector: ",",
- category: 'copying',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._asString()).__comma(_st(aString)._asString());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},smalltalk.CharacterArray)})},
- args: ["aString"],
- source: ", aString\x0a\x09^self asString, aString asString",
- messageSends: [",", "asString"],
- referencedClasses: []
- }),
- smalltalk.CharacterArray);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "add:",
- category: 'adding',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._errorReadOnly();
- return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.CharacterArray)})},
- args: ["anObject"],
- source: "add: anObject\x0a\x09self errorReadOnly",
- messageSends: ["errorReadOnly"],
- referencedClasses: []
- }),
- smalltalk.CharacterArray);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asLowercase",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._class())._fromString_(_st(_st(self)._asString())._asLowercase());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},smalltalk.CharacterArray)})},
- args: [],
- source: "asLowercase\x0a\x09^self class fromString: self asString asLowercase",
- messageSends: ["fromString:", "asLowercase", "asString", "class"],
- referencedClasses: []
- }),
- smalltalk.CharacterArray);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asNumber",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._asString())._asNumber();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asNumber",{},smalltalk.CharacterArray)})},
- args: [],
- source: "asNumber\x0a\x09^self asString asNumber",
- messageSends: ["asNumber", "asString"],
- referencedClasses: []
- }),
- smalltalk.CharacterArray);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asString",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._subclassResponsibility();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.CharacterArray)})},
- args: [],
- source: "asString\x0a\x09^self subclassResponsibility",
- messageSends: ["subclassResponsibility"],
- referencedClasses: []
- }),
- smalltalk.CharacterArray);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asSymbol",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._asString();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},smalltalk.CharacterArray)})},
- args: [],
- source: "asSymbol\x0a\x09^self asString",
- messageSends: ["asString"],
- referencedClasses: []
- }),
- smalltalk.CharacterArray);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asUppercase",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._class())._fromString_(_st(_st(self)._asString())._asUppercase());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},smalltalk.CharacterArray)})},
- args: [],
- source: "asUppercase\x0a\x09^self class fromString: self asString asUppercase",
- messageSends: ["fromString:", "asUppercase", "asString", "class"],
- referencedClasses: []
- }),
- smalltalk.CharacterArray);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "at:put:",
- category: 'accessing',
- fn: function (anIndex,anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._errorReadOnly();
- return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},smalltalk.CharacterArray)})},
- args: ["anIndex", "anObject"],
- source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
- messageSends: ["errorReadOnly"],
- referencedClasses: []
- }),
- smalltalk.CharacterArray);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "errorReadOnly",
- category: 'error handling',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._error_("Object is read-only");
- return self}, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},smalltalk.CharacterArray)})},
- args: [],
- source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
- messageSends: ["error:"],
- referencedClasses: []
- }),
- smalltalk.CharacterArray);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "printOn:",
- category: 'printing',
- fn: function (aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(_st(self)._asString())._printOn_(aStream);
- return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.CharacterArray)})},
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09self asString printOn: aStream",
- messageSends: ["printOn:", "asString"],
- referencedClasses: []
- }),
- smalltalk.CharacterArray);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "putOn:",
- category: 'streaming',
- fn: function (aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(aStream)._nextPutString_(self);
- return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},smalltalk.CharacterArray)})},
- args: ["aStream"],
- source: "putOn: aStream\x0a\x09aStream nextPutString: self",
- messageSends: ["nextPutString:"],
- referencedClasses: []
- }),
- smalltalk.CharacterArray);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "remove:",
- category: 'adding',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._errorReadOnly();
- return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},smalltalk.CharacterArray)})},
- args: ["anObject"],
- source: "remove: anObject\x0a\x09self errorReadOnly",
- messageSends: ["errorReadOnly"],
- referencedClasses: []
- }),
- smalltalk.CharacterArray);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "fromString:",
- category: 'instance creation',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._subclassResponsibility();
- return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.CharacterArray.klass)})},
- args: ["aString"],
- source: "fromString: aString\x0a\x09self subclassResponsibility",
- messageSends: ["subclassResponsibility"],
- referencedClasses: []
- }),
- smalltalk.CharacterArray.klass);
- smalltalk.addClass('String', smalltalk.CharacterArray, [], 'Kernel-Collections');
- smalltalk.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 >> #,`"
- smalltalk.addMethod(
- smalltalk.method({
- selector: ",",
- category: 'copying',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self + aString;
- return self}, function($ctx1) {$ctx1.fill(self,",",{aString:aString},smalltalk.String)})},
- args: ["aString"],
- source: ", aString\x0a\x09<return self + aString>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "<",
- category: 'comparing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return String(self) < aString._asString();
- return self}, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},smalltalk.String)})},
- args: ["aString"],
- source: "< aString\x0a\x09<return String(self) < aString._asString()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "<=",
- category: 'comparing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return String(self) <= aString._asString();
- return self}, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},smalltalk.String)})},
- args: ["aString"],
- source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "=",
- category: 'comparing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- if(typeof aString === 'undefined') { return false }
- if(!aString._isString || ! aString._isString()) {
- return false;
- }
- return String(self) === String(aString)
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},smalltalk.String)})},
- args: ["aString"],
- source: "= aString\x0a\x09<\x0a\x09\x09if(typeof aString === 'undefined') { return false }\x0a\x09\x09if(!aString._isString || ! aString._isString()) {\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09return String(self) === String(aString)\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "==",
- category: 'comparing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self).__eq(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},smalltalk.String)})},
- args: ["aString"],
- source: "== aString\x0a\x09^self = aString",
- messageSends: ["="],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: ">",
- category: 'comparing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return String(self) > aString._asString();
- return self}, function($ctx1) {$ctx1.fill(self,">",{aString:aString},smalltalk.String)})},
- args: ["aString"],
- source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: ">=",
- category: 'comparing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return String(self) >= aString._asString();
- return self}, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},smalltalk.String)})},
- args: ["aString"],
- source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asJSON",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.String)})},
- args: [],
- source: "asJSON\x0a\x09^self",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asJavascript",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.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",{},smalltalk.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>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asLowercase",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.toLowerCase();
- return self}, function($ctx1) {$ctx1.fill(self,"asLowercase",{},smalltalk.String)})},
- args: [],
- source: "asLowercase\x0a\x09<return self.toLowerCase()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asNumber",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return Number(self);
- return self}, function($ctx1) {$ctx1.fill(self,"asNumber",{},smalltalk.String)})},
- args: [],
- source: "asNumber\x0a\x09<return Number(self)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asRegexp",
- category: 'converting',
- fn: function (){
- var self=this;
- function $RegularExpression(){return smalltalk.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st($RegularExpression())._fromString_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},smalltalk.String)})},
- args: [],
- source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
- messageSends: ["fromString:"],
- referencedClasses: ["RegularExpression"]
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asSelector",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return smalltalk.selector(self);
- return self}, function($ctx1) {$ctx1.fill(self,"asSelector",{},smalltalk.String)})},
- args: [],
- source: "asSelector\x0a\x09<return smalltalk.selector(self)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asString",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.String)})},
- args: [],
- source: "asString\x0a\x09^self",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asSymbol",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},smalltalk.String)})},
- args: [],
- source: "asSymbol\x0a\x09^ self",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asUppercase",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.toUpperCase();
- return self}, function($ctx1) {$ctx1.fill(self,"asUppercase",{},smalltalk.String)})},
- args: [],
- source: "asUppercase\x0a\x09<return self.toUpperCase()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asciiValue",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.charCodeAt(0);;
- return self}, function($ctx1) {$ctx1.fill(self,"asciiValue",{},smalltalk.String)})},
- args: [],
- source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "at:ifAbsent:",
- category: 'accessing',
- fn: function (anIndex,aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return String(self).charAt(anIndex - 1) || aBlock();
- return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},smalltalk.String)})},
- args: ["anIndex", "aBlock"],
- source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self).charAt(anIndex - 1) || aBlock()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "charCodeAt:",
- category: 'accessing',
- fn: function (anInteger){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.charCodeAt(anInteger - 1) ;
- return self}, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},smalltalk.String)})},
- args: ["anInteger"],
- source: "charCodeAt: anInteger\x0a\x09< return self.charCodeAt(anInteger - 1) >",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "copyFrom:to:",
- category: 'copying',
- fn: function (anIndex,anotherIndex){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.substring(anIndex - 1, anotherIndex);
- return self}, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},smalltalk.String)})},
- args: ["anIndex", "anotherIndex"],
- source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "crlfSanitized",
- category: 'converting',
- fn: function (){
- var self=this;
- function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._lines())._join_(_st($String())._lf());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},smalltalk.String)})},
- args: [],
- source: "crlfSanitized\x0a\x09^self lines join: String lf",
- messageSends: ["join:", "lf", "lines"],
- referencedClasses: ["String"]
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "deepCopy",
- category: 'copying',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._shallowCopy();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.String)})},
- args: [],
- source: "deepCopy\x0a\x09^self shallowCopy",
- messageSends: ["shallowCopy"],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "do:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- for(var i=0;i<self.length;i++){aBlock(self.charAt(i));};
- return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.String)})},
- args: ["aBlock"],
- source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self.charAt(i));}>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "escaped",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return escape(self);
- return self}, function($ctx1) {$ctx1.fill(self,"escaped",{},smalltalk.String)})},
- args: [],
- source: "escaped\x0a\x09<return escape(self)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "includesSubString:",
- category: 'testing',
- fn: function (subString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.indexOf(subString) != -1 ;
- return self}, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},smalltalk.String)})},
- args: ["subString"],
- source: "includesSubString: subString\x0a\x09< return self.indexOf(subString) != -1 >",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isImmutable",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return true;
- }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.String)})},
- args: [],
- source: "isImmutable\x0a\x09^ true",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isString",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return true;
- }, function($ctx1) {$ctx1.fill(self,"isString",{},smalltalk.String)})},
- args: [],
- source: "isString\x0a\x09^true",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isVowel",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(_st(self)._size()).__eq((1)))._and_((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st("aeiou")._includes_(_st(self)._asLowercase());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isVowel",{},smalltalk.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 ]",
- messageSends: ["and:", "includes:", "asLowercase", "=", "size"],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "join:",
- category: 'split join',
- fn: function (aCollection){
- var self=this;
- function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st($String())._streamContents_((function(stream){
- return smalltalk.withContext(function($ctx2) {
- return _st(aCollection)._do_separatedBy_((function(each){
- return smalltalk.withContext(function($ctx3) {
- return _st(stream)._nextPutAll_(_st(each)._asString());
- }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
- return smalltalk.withContext(function($ctx3) {
- return _st(stream)._nextPutAll_(self);
- }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
- }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},smalltalk.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]]",
- messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"],
- referencedClasses: ["String"]
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "lineIndicesDo:",
- category: 'split join',
- fn: function (aBlock){
- var self=this;
- var cr,lf,start,sz,nextLF,nextCR;
- function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- var $early={};
- try {
- start=(1);
- sz=_st(self)._size();
- cr=_st($String())._cr();
- nextCR=_st(self)._indexOf_startingAt_(cr,(1));
- lf=_st($String())._lf();
- nextLF=_st(self)._indexOf_startingAt_(lf,(1));
- _st((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(start).__lt_eq(sz);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
- return smalltalk.withContext(function($ctx2) {
- $1=_st(_st(nextLF).__eq((0)))._and_((function(){
- return smalltalk.withContext(function($ctx3) {
- return _st(nextCR).__eq((0));
- }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
- if(smalltalk.assert($1)){
- _st(aBlock)._value_value_value_(start,sz,sz);
- $2=self;
- throw $early=[$2];
- };
- $3=_st(_st(nextCR).__eq((0)))._or_((function(){
- return smalltalk.withContext(function($ctx3) {
- return _st(_st((0)).__lt(nextLF))._and_((function(){
- return smalltalk.withContext(function($ctx4) {
- return _st(nextLF).__lt(nextCR);
- }, function($ctx4) {$ctx4.fillBlock({},$ctx1)})}));
- }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
- if(smalltalk.assert($3)){
- _st(aBlock)._value_value_value_(start,_st(nextLF).__minus((1)),nextLF);
- start=_st((1)).__plus(nextLF);
- start;
- nextLF=_st(self)._indexOf_startingAt_(lf,start);
- return nextLF;
- } else {
- $4=_st(_st((1)).__plus(nextCR)).__eq(nextLF);
- if(smalltalk.assert($4)){
- _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextLF);
- start=_st((1)).__plus(nextLF);
- start;
- nextCR=_st(self)._indexOf_startingAt_(cr,start);
- nextCR;
- nextLF=_st(self)._indexOf_startingAt_(lf,start);
- return nextLF;
- } else {
- _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextCR);
- start=_st((1)).__plus(nextCR);
- start;
- nextCR=_st(self)._indexOf_startingAt_(cr,start);
- return nextCR;
- };
- };
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- 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},smalltalk.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 ]]]",
- messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "ifTrue:", "value:value:value:", "and:", "=", "ifTrue:ifFalse:", "-", "+", "or:", "<", "<="],
- referencedClasses: ["String"]
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "lineNumber:",
- category: 'split join',
- fn: function (anIndex){
- var self=this;
- var lineCount;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- var $early={};
- try {
- lineCount=(0);
- _st(self)._lineIndicesDo_((function(start,endWithoutDelimiters,end){
- return smalltalk.withContext(function($ctx2) {
- lineCount=_st(lineCount).__plus((1));
- $1=_st(lineCount).__eq(anIndex);
- if(smalltalk.assert($1)){
- $2=_st(self)._copyFrom_to_(start,endWithoutDelimiters);
- throw $early=[$2];
- };
- }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1)})}));
- return nil;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},smalltalk.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",
- messageSends: ["lineIndicesDo:", "ifTrue:", "copyFrom:to:", "=", "+"],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "lines",
- category: 'split join',
- fn: function (){
- var self=this;
- var lines;
- function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- lines=_st($Array())._new();
- _st(self)._linesDo_((function(aLine){
- return smalltalk.withContext(function($ctx2) {
- return _st(lines)._add_(aLine);
- }, function($ctx2) {$ctx2.fillBlock({aLine:aLine},$ctx1)})}));
- $1=lines;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"lines",{lines:lines},smalltalk.String)})},
- args: [],
- source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a\x0a\x09| lines |\x0a\x09lines := Array new.\x0a\x09self linesDo: [:aLine | lines add: aLine].\x0a\x09^lines",
- messageSends: ["new", "linesDo:", "add:"],
- referencedClasses: ["Array"]
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "linesDo:",
- category: 'split join',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._lineIndicesDo_((function(start,endWithoutDelimiters,end){
- return smalltalk.withContext(function($ctx2) {
- return _st(aBlock)._value_(_st(self)._copyFrom_to_(start,endWithoutDelimiters));
- }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},smalltalk.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 lineIndicesDo: [:start :endWithoutDelimiters :end |\x0a\x09\x09aBlock value: (self copyFrom: start to: endWithoutDelimiters)]",
- messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "match:",
- category: 'regular expressions',
- fn: function (aRegexp){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.search(aRegexp) != -1;
- return self}, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},smalltalk.String)})},
- args: ["aRegexp"],
- source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "matchesOf:",
- category: 'regular expressions',
- fn: function (aRegularExpression){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.match(aRegularExpression);
- return self}, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},smalltalk.String)})},
- args: ["aRegularExpression"],
- source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "printNl",
- category: 'printing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- console.log(self);
- return self}, function($ctx1) {$ctx1.fill(self,"printNl",{},smalltalk.String)})},
- args: [],
- source: "printNl\x0a\x09<console.log(self)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "printOn:",
- category: 'printing',
- fn: function (aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=aStream;
- _st($1)._nextPutAll_("'");
- _st($1)._nextPutAll_(self);
- $2=_st($1)._nextPutAll_("'");
- return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.String)})},
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
- messageSends: ["nextPutAll:"],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "replace:with:",
- category: 'regular expressions',
- fn: function (aString,anotherString){
- var self=this;
- function $RegularExpression(){return smalltalk.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(aString,"g"),anotherString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},smalltalk.String)})},
- args: ["aString", "anotherString"],
- source: "replace: aString with: anotherString\x0a\x09^self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
- messageSends: ["replaceRegexp:with:", "fromString:flag:"],
- referencedClasses: ["RegularExpression"]
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "replaceRegexp:with:",
- category: 'regular expressions',
- fn: function (aRegexp,aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.replace(aRegexp, aString);
- return self}, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},smalltalk.String)})},
- args: ["aRegexp", "aString"],
- source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "reversed",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.split("").reverse().join("");
- return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},smalltalk.String)})},
- args: [],
- source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "shallowCopy",
- category: 'copying',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._class())._fromString_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.String)})},
- args: [],
- source: "shallowCopy\x0a\x09^self class fromString: self",
- messageSends: ["fromString:", "class"],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "size",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.length;
- return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.String)})},
- args: [],
- source: "size\x0a\x09<return self.length>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "subStrings:",
- category: 'split join',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._tokenize_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},smalltalk.String)})},
- args: ["aString"],
- source: "subStrings: aString\x0a\x09^ self tokenize: aString",
- messageSends: ["tokenize:"],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "tokenize:",
- category: 'split join',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.split(aString);
- return self}, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},smalltalk.String)})},
- args: ["aString"],
- source: "tokenize: aString\x0a\x09<return self.split(aString)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "trimBoth",
- category: 'regular expressions',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._trimBoth_("\x5cs");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},smalltalk.String)})},
- args: [],
- source: "trimBoth\x0a\x09^self trimBoth: '\x5cs'",
- messageSends: ["trimBoth:"],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "trimBoth:",
- category: 'regular expressions',
- fn: function (separators){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._trimLeft_(separators))._trimRight_(separators);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},smalltalk.String)})},
- args: ["separators"],
- source: "trimBoth: separators\x0a\x0a\x09^(self trimLeft: separators) trimRight: separators",
- messageSends: ["trimRight:", "trimLeft:"],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "trimLeft",
- category: 'regular expressions',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._trimLeft_("\x5cs");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},smalltalk.String)})},
- args: [],
- source: "trimLeft\x0a\x09^self trimLeft: '\x5cs'",
- messageSends: ["trimLeft:"],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "trimLeft:",
- category: 'regular expressions',
- fn: function (separators){
- var self=this;
- function $RegularExpression(){return smalltalk.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(_st(_st("^[").__comma(separators)).__comma("]+"),"g"),"");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},smalltalk.String)})},
- args: ["separators"],
- source: "trimLeft: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
- messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
- referencedClasses: ["RegularExpression"]
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "trimRight",
- category: 'regular expressions',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._trimRight_("\x5cs");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"trimRight",{},smalltalk.String)})},
- args: [],
- source: "trimRight\x0a\x09^self trimRight: '\x5cs'",
- messageSends: ["trimRight:"],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "trimRight:",
- category: 'regular expressions',
- fn: function (separators){
- var self=this;
- function $RegularExpression(){return smalltalk.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(_st(_st("[").__comma(separators)).__comma("]+$"),"g"),"");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},smalltalk.String)})},
- args: ["separators"],
- source: "trimRight: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
- messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
- referencedClasses: ["RegularExpression"]
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "unescaped",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return unescape(self);
- return self}, function($ctx1) {$ctx1.fill(self,"unescaped",{},smalltalk.String)})},
- args: [],
- source: "unescaped\x0a\x09<return unescape(self)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "withIndexDo:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- for(var i=0;i<self.length;i++){aBlock(self.charAt(i), i+1);};
- return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},smalltalk.String)})},
- args: ["aBlock"],
- source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self.charAt(i), i+1);}>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "cr",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return '\r';
- return self}, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.String.klass)})},
- args: [],
- source: "cr\x0a\x09<return '\x5cr'>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "crlf",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return '\r\n';
- return self}, function($ctx1) {$ctx1.fill(self,"crlf",{},smalltalk.String.klass)})},
- args: [],
- source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "fromCharCode:",
- category: 'instance creation',
- fn: function (anInteger){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return String.fromCharCode(anInteger);
- return self}, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},smalltalk.String.klass)})},
- args: ["anInteger"],
- source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "fromString:",
- category: 'instance creation',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return String(aString);
- return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.String.klass)})},
- args: ["aString"],
- source: "fromString: aString\x0a\x09\x09<return String(aString)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "lf",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return '\n';
- return self}, function($ctx1) {$ctx1.fill(self,"lf",{},smalltalk.String.klass)})},
- args: [],
- source: "lf\x0a\x09<return '\x5cn'>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "random",
- category: 'random',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
- return self}, function($ctx1) {$ctx1.fill(self,"random",{},smalltalk.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);>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "randomNotIn:",
- category: 'random',
- fn: function (aString){
- var self=this;
- var result;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- _st((function(){
- return smalltalk.withContext(function($ctx2) {
- result=_st(self)._random();
- result;
- return _st(aString)._includesSubString_(result);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue();
- $1=result;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},smalltalk.String.klass)})},
- args: ["aString"],
- source: "randomNotIn: aString\x0a\x09| result |\x0a [ result := self random. aString includesSubString: result ] whileTrue.\x0a ^result",
- messageSends: ["whileTrue", "random", "includesSubString:"],
- referencedClasses: []
- }),
- smalltalk.String.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "space",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return ' ';
- return self}, function($ctx1) {$ctx1.fill(self,"space",{},smalltalk.String.klass)})},
- args: [],
- source: "space\x0a\x09<return ' '>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "streamClass",
- category: 'accessing',
- fn: function (){
- var self=this;
- function $StringStream(){return smalltalk.StringStream||(typeof StringStream=="undefined"?nil:StringStream)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=$StringStream();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.String.klass)})},
- args: [],
- source: "streamClass\x0a\x09\x09^StringStream",
- messageSends: [],
- referencedClasses: ["StringStream"]
- }),
- smalltalk.String.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "tab",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return '\t';
- return self}, function($ctx1) {$ctx1.fill(self,"tab",{},smalltalk.String.klass)})},
- args: [],
- source: "tab\x0a\x09<return '\x5ct'>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "value:",
- category: 'instance creation',
- fn: function (aUTFCharCode){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return String.fromCharCode(aUTFCharCode);;
- return self}, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},smalltalk.String.klass)})},
- args: ["aUTFCharCode"],
- source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.String.klass);
- smalltalk.addClass('Set', smalltalk.Collection, ['elements'], 'Kernel-Collections');
- smalltalk.Set.comment="I represent an unordered set of objects without duplicates."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "=",
- category: 'comparing',
- fn: function (aCollection){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3;
- var $early={};
- try {
- $1=_st(_st(self)._class()).__eq(_st(aCollection)._class());
- if(! smalltalk.assert($1)){
- return false;
- };
- $2=_st(_st(self)._size()).__eq(_st(aCollection)._size());
- if(! smalltalk.assert($2)){
- return false;
- };
- _st(self)._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- $3=_st(aCollection)._includes_(each);
- if(! smalltalk.assert($3)){
- throw $early=[false];
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return true;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},smalltalk.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",
- messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"],
- referencedClasses: []
- }),
- smalltalk.Set);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "add:",
- category: 'adding/removing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var found;
- for(var i=0; i < self['@elements'].length; i++) {
- if(anObject == self['@elements'][i]) {
- found = true;
- break;
- }
- }
- if(!found) {self['@elements'].push(anObject)}
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.Set)})},
- args: ["anObject"],
- source: "add: anObject\x0a\x09<\x0a\x09\x09var found;\x0a\x09\x09for(var i=0; i < self['@elements'].length; i++) {\x0a\x09\x09\x09if(anObject == self['@elements'][i]) {\x0a\x09\x09\x09\x09found = true;\x0a\x09\x09\x09\x09break;\x0a\x09\x09\x09}\x0a\x09\x09}\x0a\x09\x09if(!found) {self['@elements'].push(anObject)}\x0a\x09>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Set);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "asArray",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self["@elements"])._copy();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asArray",{},smalltalk.Set)})},
- args: [],
- source: "asArray\x0a\x09^elements copy",
- messageSends: ["copy"],
- referencedClasses: []
- }),
- smalltalk.Set);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "collect:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._class())._withAll_(_st(self["@elements"])._collect_(aBlock));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},smalltalk.Set)})},
- args: ["aBlock"],
- source: "collect: aBlock\x0a\x09^self class withAll: (elements collect: aBlock)",
- messageSends: ["withAll:", "collect:", "class"],
- referencedClasses: []
- }),
- smalltalk.Set);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "detect:ifNone:",
- category: 'enumerating',
- fn: function (aBlock,anotherBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self["@elements"])._detect_ifNone_(aBlock,anotherBlock);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Set)})},
- args: ["aBlock", "anotherBlock"],
- source: "detect: aBlock ifNone: anotherBlock\x0a\x09^elements detect: aBlock ifNone: anotherBlock",
- messageSends: ["detect:ifNone:"],
- referencedClasses: []
- }),
- smalltalk.Set);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "do:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self["@elements"])._do_(aBlock);
- return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.Set)})},
- args: ["aBlock"],
- source: "do: aBlock\x0a\x09elements do: aBlock",
- messageSends: ["do:"],
- referencedClasses: []
- }),
- smalltalk.Set);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "includes:",
- category: 'testing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self["@elements"])._includes_(anObject);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},smalltalk.Set)})},
- args: ["anObject"],
- source: "includes: anObject\x0a\x09^elements includes: anObject",
- messageSends: ["includes:"],
- referencedClasses: []
- }),
- smalltalk.Set);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "initialize",
- category: 'initialization',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- smalltalk.Collection.fn.prototype._initialize.apply(_st(self), []);
- self["@elements"]=[];
- return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Set)})},
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09elements := #()",
- messageSends: ["initialize"],
- referencedClasses: []
- }),
- smalltalk.Set);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "printOn:",
- category: 'printing',
- fn: function (aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- smalltalk.Collection.fn.prototype._printOn_.apply(_st(self), [aStream]);
- _st(aStream)._nextPutAll_(" (");
- _st(self)._do_separatedBy_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(each)._printOn_(aStream);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(aStream)._nextPutAll_(" ");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- _st(aStream)._nextPutAll_(")");
- return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.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: ')'",
- messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"],
- referencedClasses: []
- }),
- smalltalk.Set);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "remove:",
- category: 'adding/removing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self["@elements"])._remove_(anObject);
- return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},smalltalk.Set)})},
- args: ["anObject"],
- source: "remove: anObject\x0a\x09elements remove: anObject",
- messageSends: ["remove:"],
- referencedClasses: []
- }),
- smalltalk.Set);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "select:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- var collection;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- collection=_st(_st(self)._class())._new();
- _st(self)._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- $1=_st(aBlock)._value_(each);
- if(smalltalk.assert($1)){
- return _st(collection)._add_(each);
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- $2=collection;
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},smalltalk.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",
- messageSends: ["new", "class", "do:", "ifTrue:", "add:", "value:"],
- referencedClasses: []
- }),
- smalltalk.Set);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "size",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self["@elements"])._size();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Set)})},
- args: [],
- source: "size\x0a\x09^elements size",
- messageSends: ["size"],
- referencedClasses: []
- }),
- smalltalk.Set);
- smalltalk.addClass('Queue', smalltalk.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
- smalltalk.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."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "initialize",
- category: 'initialization',
- fn: function (){
- var self=this;
- function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
- return smalltalk.withContext(function($ctx1) {
- smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
- self["@read"]=_st($OrderedCollection())._new();
- self["@write"]=_st($OrderedCollection())._new();
- self["@readIndex"]=(1);
- return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Queue)})},
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
- messageSends: ["initialize", "new"],
- referencedClasses: ["OrderedCollection"]
- }),
- smalltalk.Queue);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "next",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._nextIfAbsent_((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(self)._error_("Cannot read from empty Queue.");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.Queue)})},
- args: [],
- source: "next\x0a\x09^self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
- messageSends: ["nextIfAbsent:", "error:"],
- referencedClasses: []
- }),
- smalltalk.Queue);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "nextIfAbsent:",
- category: 'accessing',
- fn: function (aBlock){
- var self=this;
- var result;
- function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- var $early={};
- try {
- result=_st(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
- return smalltalk.withContext(function($ctx2) {
- $1=_st(self["@write"])._isEmpty();
- if(smalltalk.assert($1)){
- $2=_st(self["@readIndex"]).__gt((1));
- if(smalltalk.assert($2)){
- self["@read"]=[];
- self["@read"];
- self["@readIndex"]=(1);
- self["@readIndex"];
- };
- $3=_st(aBlock)._value();
- throw $early=[$3];
- };
- self["@read"]=self["@write"];
- self["@read"];
- self["@readIndex"]=(1);
- self["@readIndex"];
- self["@write"]=_st($OrderedCollection())._new();
- self["@write"];
- return _st(self["@read"])._first();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- _st(self["@read"])._at_put_(self["@readIndex"],nil);
- self["@readIndex"]=_st(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},smalltalk.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",
- messageSends: ["at:ifAbsent:", "ifTrue:", ">", "value", "isEmpty", "new", "first", "at:put:", "+"],
- referencedClasses: ["OrderedCollection"]
- }),
- smalltalk.Queue);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "nextPut:",
- category: 'accessing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self["@write"])._add_(anObject);
- return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},smalltalk.Queue)})},
- args: ["anObject"],
- source: "nextPut: anObject\x0a\x09write add: anObject",
- messageSends: ["add:"],
- referencedClasses: []
- }),
- smalltalk.Queue);
- smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
- smalltalk.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "compile:",
- category: 'evaluating',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.compile(aString);
- return self}, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},smalltalk.RegularExpression)})},
- args: ["aString"],
- source: "compile: aString\x0a\x09<return self.compile(aString)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.RegularExpression);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "exec:",
- category: 'evaluating',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.exec(aString) || nil;
- return self}, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},smalltalk.RegularExpression)})},
- args: ["aString"],
- source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.RegularExpression);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "test:",
- category: 'evaluating',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.test(aString);
- return self}, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},smalltalk.RegularExpression)})},
- args: ["aString"],
- source: "test: aString\x0a\x09<return self.test(aString)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.RegularExpression);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "fromString:",
- category: 'instance creation',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._fromString_flag_(aString,"");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.RegularExpression.klass)})},
- args: ["aString"],
- source: "fromString: aString\x0a\x09\x09^self fromString: aString flag: ''",
- messageSends: ["fromString:flag:"],
- referencedClasses: []
- }),
- smalltalk.RegularExpression.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "fromString:flag:",
- category: 'instance creation',
- fn: function (aString,anotherString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return new RegExp(aString, anotherString);
- return self}, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},smalltalk.RegularExpression.klass)})},
- args: ["aString", "anotherString"],
- source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.RegularExpression.klass);
- smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
- smalltalk.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."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "<<",
- category: 'writing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._write_(anObject);
- return self}, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},smalltalk.Stream)})},
- args: ["anObject"],
- source: "<< anObject\x0a\x09self write: anObject",
- messageSends: ["write:"],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "atEnd",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._position()).__eq(_st(self)._size());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.Stream)})},
- args: [],
- source: "atEnd\x0a\x09^self position = self size",
- messageSends: ["=", "size", "position"],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "atStart",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._position()).__eq((0));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"atStart",{},smalltalk.Stream)})},
- args: [],
- source: "atStart\x0a\x09^self position = 0",
- messageSends: ["=", "position"],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "close",
- category: 'actions',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self}, function($ctx1) {$ctx1.fill(self,"close",{},smalltalk.Stream)})},
- args: [],
- source: "close",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "collection",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@collection"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.Stream)})},
- args: [],
- source: "collection\x0a\x09^collection",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "contents",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._collection())._copyFrom_to_((1),_st(self)._streamSize());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"contents",{},smalltalk.Stream)})},
- args: [],
- source: "contents\x0a\x09^self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
- messageSends: ["copyFrom:to:", "streamSize", "collection"],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "do:",
- category: 'enumerating',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(self)._atEnd();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(aBlock)._value_(_st(self)._next());
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.Stream)})},
- args: ["aBlock"],
- source: "do: aBlock\x0a\x09[self atEnd] whileFalse: [aBlock value: self next]",
- messageSends: ["whileFalse:", "value:", "next", "atEnd"],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "flush",
- category: 'actions',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self}, function($ctx1) {$ctx1.fill(self,"flush",{},smalltalk.Stream)})},
- args: [],
- source: "flush",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isEmpty",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._size()).__eq((0));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},smalltalk.Stream)})},
- args: [],
- source: "isEmpty\x0a\x09^self size = 0",
- messageSends: ["=", "size"],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "next",
- category: 'reading',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=_st(self)._atEnd();
- if(smalltalk.assert($2)){
- $1=nil;
- } else {
- _st(self)._position_(_st(_st(self)._position()).__plus((1)));
- $1=_st(self["@collection"])._at_(_st(self)._position());
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.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]",
- messageSends: ["ifTrue:ifFalse:", "position:", "+", "position", "at:", "atEnd"],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "next:",
- category: 'reading',
- fn: function (anInteger){
- var self=this;
- var tempCollection;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- tempCollection=_st(_st(_st(self)._collection())._class())._new();
- _st(anInteger)._timesRepeat_((function(){
- return smalltalk.withContext(function($ctx2) {
- $1=_st(self)._atEnd();
- if(! smalltalk.assert($1)){
- return _st(tempCollection)._add_(_st(self)._next());
- };
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- $2=tempCollection;
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},smalltalk.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",
- messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "add:", "next", "atEnd"],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "nextPut:",
- category: 'writing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._position_(_st(_st(self)._position()).__plus((1)));
- _st(_st(self)._collection())._at_put_(_st(self)._position(),anObject);
- _st(self)._setStreamSize_(_st(_st(self)._streamSize())._max_(_st(self)._position()));
- return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},smalltalk.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)",
- messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "nextPutAll:",
- category: 'writing',
- fn: function (aCollection){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(aCollection)._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(self)._nextPut_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},smalltalk.Stream)})},
- args: ["aCollection"],
- source: "nextPutAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09\x09self nextPut: each]",
- messageSends: ["do:", "nextPut:"],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "nextPutString:",
- category: 'writing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._nextPut_(aString);
- return self}, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},smalltalk.Stream)})},
- args: ["aString"],
- source: "nextPutString: aString\x0a\x09self nextPut: aString",
- messageSends: ["nextPut:"],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "peek",
- category: 'reading',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=_st(self)._atEnd();
- if(! smalltalk.assert($2)){
- $1=_st(_st(self)._collection())._at_(_st(_st(self)._position()).__plus((1)));
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"peek",{},smalltalk.Stream)})},
- args: [],
- source: "peek\x0a\x09^self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1]",
- messageSends: ["ifFalse:", "at:", "+", "position", "collection", "atEnd"],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "position",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@position"];
- if(($receiver = $2) == nil || $receiver == undefined){
- self["@position"]=(0);
- $1=self["@position"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"position",{},smalltalk.Stream)})},
- args: [],
- source: "position\x0a\x09^position ifNil: [position := 0]",
- messageSends: ["ifNil:"],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "position:",
- category: 'accessing',
- fn: function (anInteger){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@position"]=anInteger;
- return self}, function($ctx1) {$ctx1.fill(self,"position:",{anInteger:anInteger},smalltalk.Stream)})},
- args: ["anInteger"],
- source: "position: anInteger\x0a\x09position := anInteger",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "reset",
- category: 'actions',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._position_((0));
- return self}, function($ctx1) {$ctx1.fill(self,"reset",{},smalltalk.Stream)})},
- args: [],
- source: "reset\x0a\x09self position: 0",
- messageSends: ["position:"],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "resetContents",
- category: 'actions',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._reset();
- _st(self)._setStreamSize_((0));
- return self}, function($ctx1) {$ctx1.fill(self,"resetContents",{},smalltalk.Stream)})},
- args: [],
- source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
- messageSends: ["reset", "setStreamSize:"],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "setCollection:",
- category: 'accessing',
- fn: function (aCollection){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@collection"]=aCollection;
- return self}, function($ctx1) {$ctx1.fill(self,"setCollection:",{aCollection:aCollection},smalltalk.Stream)})},
- args: ["aCollection"],
- source: "setCollection: aCollection\x0a\x09collection := aCollection",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "setStreamSize:",
- category: 'accessing',
- fn: function (anInteger){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@streamSize"]=anInteger;
- return self}, function($ctx1) {$ctx1.fill(self,"setStreamSize:",{anInteger:anInteger},smalltalk.Stream)})},
- args: ["anInteger"],
- source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "setToEnd",
- category: 'positioning',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._position_(_st(self)._size());
- return self}, function($ctx1) {$ctx1.fill(self,"setToEnd",{},smalltalk.Stream)})},
- args: [],
- source: "setToEnd\x0a\x09self position: self size",
- messageSends: ["position:", "size"],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "size",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._streamSize();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Stream)})},
- args: [],
- source: "size\x0a\x09^self streamSize",
- messageSends: ["streamSize"],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "skip:",
- category: 'positioning',
- fn: function (anInteger){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._position_(_st(_st(_st(self)._position()).__plus(anInteger))._min_max_(_st(self)._size(),(0)));
- return self}, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},smalltalk.Stream)})},
- args: ["anInteger"],
- source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
- messageSends: ["position:", "min:max:", "size", "+", "position"],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "streamSize",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@streamSize"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"streamSize",{},smalltalk.Stream)})},
- args: [],
- source: "streamSize\x0a\x09^streamSize",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "write:",
- category: 'writing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(anObject)._putOn_(self);
- return self}, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},smalltalk.Stream)})},
- args: ["anObject"],
- source: "write: anObject\x0a\x09anObject putOn: self",
- messageSends: ["putOn:"],
- referencedClasses: []
- }),
- smalltalk.Stream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "on:",
- category: 'instance creation',
- fn: function (aCollection){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st(self)._new();
- _st($2)._setCollection_(aCollection);
- _st($2)._setStreamSize_(_st(aCollection)._size());
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},smalltalk.Stream.klass)})},
- args: ["aCollection"],
- source: "on: aCollection\x0a\x09\x09^self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
- messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"],
- referencedClasses: []
- }),
- smalltalk.Stream.klass);
- smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel-Collections');
- smalltalk.StringStream.comment="I am a Stream specific to `String` objects."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "cr",
- category: 'writing',
- fn: function (){
- var self=this;
- function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._nextPutAll_(_st($String())._cr());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.StringStream)})},
- args: [],
- source: "cr\x0a\x09^self nextPutAll: String cr",
- messageSends: ["nextPutAll:", "cr"],
- referencedClasses: ["String"]
- }),
- smalltalk.StringStream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "crlf",
- category: 'writing',
- fn: function (){
- var self=this;
- function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._nextPutAll_(_st($String())._crlf());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"crlf",{},smalltalk.StringStream)})},
- args: [],
- source: "crlf\x0a\x09^self nextPutAll: String crlf",
- messageSends: ["nextPutAll:", "crlf"],
- referencedClasses: ["String"]
- }),
- smalltalk.StringStream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "lf",
- category: 'writing',
- fn: function (){
- var self=this;
- function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._nextPutAll_(_st($String())._lf());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"lf",{},smalltalk.StringStream)})},
- args: [],
- source: "lf\x0a\x09^self nextPutAll: String lf",
- messageSends: ["nextPutAll:", "lf"],
- referencedClasses: ["String"]
- }),
- smalltalk.StringStream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "next:",
- category: 'reading',
- fn: function (anInteger){
- var self=this;
- var tempCollection;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- tempCollection=_st(_st(_st(self)._collection())._class())._new();
- _st(anInteger)._timesRepeat_((function(){
- return smalltalk.withContext(function($ctx2) {
- $1=_st(self)._atEnd();
- if(! smalltalk.assert($1)){
- tempCollection=_st(tempCollection).__comma(_st(self)._next());
- return tempCollection;
- };
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- $2=tempCollection;
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},smalltalk.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",
- messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", ",", "next", "atEnd"],
- referencedClasses: []
- }),
- smalltalk.StringStream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "nextPut:",
- category: 'writing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._nextPutAll_(aString);
- return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},smalltalk.StringStream)})},
- args: ["aString"],
- source: "nextPut: aString\x0a\x09self nextPutAll: aString",
- messageSends: ["nextPutAll:"],
- referencedClasses: []
- }),
- smalltalk.StringStream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "nextPutAll:",
- category: 'writing',
- fn: function (aString){
- var self=this;
- var pre,post;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._atEnd();
- if(smalltalk.assert($1)){
- _st(self)._setCollection_(_st(_st(self)._collection()).__comma(aString));
- } else {
- pre=_st(_st(self)._collection())._copyFrom_to_((1),_st(self)._position());
- pre;
- post=_st(_st(self)._collection())._copyFrom_to_(_st(_st(_st(self)._position()).__plus((1))).__plus(_st(aString)._size()),_st(_st(self)._collection())._size());
- post;
- _st(self)._setCollection_(_st(_st(pre).__comma(aString)).__comma(post));
- };
- _st(self)._position_(_st(_st(self)._position()).__plus(_st(aString)._size()));
- _st(self)._setStreamSize_(_st(_st(self)._streamSize())._max_(_st(self)._position()));
- return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},smalltalk.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)",
- messageSends: ["ifTrue:ifFalse:", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "atEnd", "position:", "setStreamSize:", "max:", "streamSize"],
- referencedClasses: []
- }),
- smalltalk.StringStream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "nextPutString:",
- category: 'writing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._nextPutAll_(aString);
- return self}, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},smalltalk.StringStream)})},
- args: ["aString"],
- source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
- messageSends: ["nextPutAll:"],
- referencedClasses: []
- }),
- smalltalk.StringStream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "space",
- category: 'writing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._nextPut_(" ");
- return self}, function($ctx1) {$ctx1.fill(self,"space",{},smalltalk.StringStream)})},
- args: [],
- source: "space\x0a\x09self nextPut: ' '",
- messageSends: ["nextPut:"],
- referencedClasses: []
- }),
- smalltalk.StringStream);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "tab",
- category: 'writing',
- fn: function (){
- var self=this;
- function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._nextPutAll_(_st($String())._tab());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"tab",{},smalltalk.StringStream)})},
- args: [],
- source: "tab\x0a\x09^self nextPutAll: String tab",
- messageSends: ["nextPutAll:", "tab"],
- referencedClasses: ["String"]
- }),
- smalltalk.StringStream);
- smalltalk.addPackage('Kernel-Exceptions');
- smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel-Exceptions');
- smalltalk.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."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "context",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.context;
- return self}, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.Error)})},
- args: [],
- source: "context\x0a\x09<return self.context>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Error);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "initialize",
- category: 'initialization',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._messageText_(_st("Errorclass: ").__comma(_st(_st(self)._class())._name()));
- return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Error)})},
- args: [],
- source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
- messageSends: ["messageText:", ",", "name", "class"],
- referencedClasses: []
- }),
- smalltalk.Error);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isSmalltalkError",
- category: 'testing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.smalltalkError === true;
- return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},smalltalk.Error)})},
- args: [],
- source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Error);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "jsStack",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.stack;
- return self}, function($ctx1) {$ctx1.fill(self,"jsStack",{},smalltalk.Error)})},
- args: [],
- source: "jsStack\x0a\x09<return self.stack>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Error);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "messageText",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@messageText"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.Error)})},
- args: [],
- source: "messageText\x0a\x09^messageText",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Error);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "messageText:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@messageText"]=aString;
- return self}, function($ctx1) {$ctx1.fill(self,"messageText:",{aString:aString},smalltalk.Error)})},
- args: ["aString"],
- source: "messageText: aString\x0a\x09messageText := aString",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Error);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "signal",
- category: 'signaling',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self);
- return self}, function($ctx1) {$ctx1.fill(self,"signal",{},smalltalk.Error)})},
- args: [],
- source: "signal\x0a\x09<self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self)>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Error);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "signal:",
- category: 'signaling',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._messageText_(aString);
- _st(self)._signal();
- return self}, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},smalltalk.Error)})},
- args: ["aString"],
- source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
- messageSends: ["messageText:", "signal"],
- referencedClasses: []
- }),
- smalltalk.Error);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "signal",
- category: 'instance creation',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._new())._signal();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"signal",{},smalltalk.Error.klass)})},
- args: [],
- source: "signal\x0a\x09^self new signal",
- messageSends: ["signal", "new"],
- referencedClasses: []
- }),
- smalltalk.Error.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "signal:",
- category: 'instance creation',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._new())._signal_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},smalltalk.Error.klass)})},
- args: ["aString"],
- source: "signal: aString\x0a\x09\x09^self new\x0a\x09\x09signal: aString",
- messageSends: ["signal:", "new"],
- referencedClasses: []
- }),
- smalltalk.Error.klass);
- smalltalk.addClass('JavaScriptException', smalltalk.Error, ['exception'], 'Kernel-Exceptions');
- smalltalk.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:`"
- smalltalk.addMethod(
- smalltalk.method({
- selector: "context:",
- category: 'accessing',
- fn: function (aMethodContext){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self.context = aMethodContext;
- return self}, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},smalltalk.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>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.JavaScriptException);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "exception",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@exception"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"exception",{},smalltalk.JavaScriptException)})},
- args: [],
- source: "exception\x0a\x09^ exception",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.JavaScriptException);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "exception:",
- category: 'accessing',
- fn: function (anException){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@exception"]=anException;
- return self}, function($ctx1) {$ctx1.fill(self,"exception:",{anException:anException},smalltalk.JavaScriptException)})},
- args: ["anException"],
- source: "exception: anException\x0a\x09exception := anException",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.JavaScriptException);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "messageText",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return 'JavaScript exception: ' + self["@exception"].toString();
- return self}, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.JavaScriptException)})},
- args: [],
- source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.JavaScriptException);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "on:",
- category: 'instance creation',
- fn: function (anException){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st(self)._new();
- _st($2)._exception_(anException);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},smalltalk.JavaScriptException.klass)})},
- args: ["anException"],
- source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
- messageSends: ["exception:", "new", "yourself"],
- referencedClasses: []
- }),
- smalltalk.JavaScriptException.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "on:context:",
- category: 'instance creation',
- fn: function (anException,aMethodContext){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st(self)._new();
- _st($2)._exception_(anException);
- _st($2)._context_(aMethodContext);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},smalltalk.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",
- messageSends: ["exception:", "new", "context:", "yourself"],
- referencedClasses: []
- }),
- smalltalk.JavaScriptException.klass);
- smalltalk.addClass('MessageNotUnderstood', smalltalk.Error, ['message', 'receiver'], 'Kernel-Exceptions');
- smalltalk.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "message",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@message"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"message",{},smalltalk.MessageNotUnderstood)})},
- args: [],
- source: "message\x0a\x09^message",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MessageNotUnderstood);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "message:",
- category: 'accessing',
- fn: function (aMessage){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@message"]=aMessage;
- return self}, function($ctx1) {$ctx1.fill(self,"message:",{aMessage:aMessage},smalltalk.MessageNotUnderstood)})},
- args: ["aMessage"],
- source: "message: aMessage\x0a\x09message := aMessage",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MessageNotUnderstood);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "messageText",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(_st(_st(self)._receiver())._asString()).__comma(" does not understand #")).__comma(_st(_st(self)._message())._selector());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.MessageNotUnderstood)})},
- args: [],
- source: "messageText\x0a\x09^self receiver asString, ' does not understand #', self message selector",
- messageSends: [",", "selector", "message", "asString", "receiver"],
- referencedClasses: []
- }),
- smalltalk.MessageNotUnderstood);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "receiver",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@receiver"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.MessageNotUnderstood)})},
- args: [],
- source: "receiver\x0a\x09^receiver",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MessageNotUnderstood);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "receiver:",
- category: 'accessing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@receiver"]=anObject;
- return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},smalltalk.MessageNotUnderstood)})},
- args: ["anObject"],
- source: "receiver: anObject\x0a\x09receiver := anObject",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MessageNotUnderstood);
- smalltalk.addClass('NonBooleanReceiver', smalltalk.Error, ['object'], 'Kernel-Exceptions');
- smalltalk.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "object",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@object"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"object",{},smalltalk.NonBooleanReceiver)})},
- args: [],
- source: "object\x0a\x09^ object",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.NonBooleanReceiver);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "object:",
- category: 'accessing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@object"]=anObject;
- return self}, function($ctx1) {$ctx1.fill(self,"object:",{anObject:anObject},smalltalk.NonBooleanReceiver)})},
- args: ["anObject"],
- source: "object: anObject\x0a\x09object := anObject",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.NonBooleanReceiver);
- smalltalk.addClass('ErrorHandler', smalltalk.Object, [], 'Kernel-Exceptions');
- smalltalk.ErrorHandler.comment="ErrorHandler is used to manage Smalltalk errors.\x0aSee `boot.js` `handleError()` function.\x0a\x0aSubclasses of `ErrorHandler` can register themselves as the current handler with\x0a`ErrorHandler class >> register`.\x0a\x0aSubclasses may override `#handleError:` to perform an action on the thrown exception.\x0aThe default behavior is to log the error and the context stack to the JavaScript console."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "handleError:",
- category: 'error handling',
- fn: function (anError){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(anError)._context();
- if(($receiver = $1) == nil || $receiver == undefined){
- $1;
- } else {
- _st(self)._logErrorContext_(_st(anError)._context());
- };
- _st(self)._logError_(anError);
- return self}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},smalltalk.ErrorHandler)})},
- args: ["anError"],
- source: "handleError: anError\x0a\x09anError context ifNotNil: [self logErrorContext: anError context].\x0a\x09self logError: anError",
- messageSends: ["ifNotNil:", "logErrorContext:", "context", "logError:"],
- referencedClasses: []
- }),
- smalltalk.ErrorHandler);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "log:",
- category: 'private',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(console)._log_(aString);
- return self}, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},smalltalk.ErrorHandler)})},
- args: ["aString"],
- source: "log: aString\x0a\x09console log: aString",
- messageSends: ["log:"],
- referencedClasses: []
- }),
- smalltalk.ErrorHandler);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "logContext:",
- category: 'private',
- fn: function (aContext){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(aContext)._home();
- if(($receiver = $1) == nil || $receiver == undefined){
- $1;
- } else {
- _st(self)._logContext_(_st(aContext)._home());
- };
- _st(self)._log_(_st(_st(_st(_st(aContext)._receiver())._asString()).__comma(">>")).__comma(_st(_st(aContext)._selector())._asString()));
- return self}, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},smalltalk.ErrorHandler)})},
- args: ["aContext"],
- source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home].\x0a\x09self log: aContext receiver asString, '>>', aContext selector asString",
- messageSends: ["ifNotNil:", "logContext:", "home", "log:", ",", "asString", "selector", "receiver"],
- referencedClasses: []
- }),
- smalltalk.ErrorHandler);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "logError:",
- category: 'private',
- fn: function (anError){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._log_(_st(anError)._messageText());
- return self}, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},smalltalk.ErrorHandler)})},
- args: ["anError"],
- source: "logError: anError\x0a\x09self log: anError messageText",
- messageSends: ["log:", "messageText"],
- referencedClasses: []
- }),
- smalltalk.ErrorHandler);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "logErrorContext:",
- category: 'private',
- fn: function (aContext){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=aContext;
- if(($receiver = $1) == nil || $receiver == undefined){
- $1;
- } else {
- $2=_st(aContext)._home();
- if(($receiver = $2) == nil || $receiver == undefined){
- $2;
- } else {
- _st(self)._logContext_(_st(aContext)._home());
- };
- };
- return self}, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},smalltalk.ErrorHandler)})},
- args: ["aContext"],
- source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home]]",
- messageSends: ["ifNotNil:", "logContext:", "home"],
- referencedClasses: []
- }),
- smalltalk.ErrorHandler);
- smalltalk.ErrorHandler.klass.iVarNames = ['current'];
- smalltalk.addMethod(
- smalltalk.method({
- selector: "current",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@current"];
- if(($receiver = $2) == nil || $receiver == undefined){
- self["@current"]=_st(self)._new();
- $1=self["@current"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.ErrorHandler.klass)})},
- args: [],
- source: "current\x0a\x09^current ifNil: [current := self new]",
- messageSends: ["ifNil:", "new"],
- referencedClasses: []
- }),
- smalltalk.ErrorHandler.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "initialize",
- category: 'initialization',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._register();
- return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ErrorHandler.klass)})},
- args: [],
- source: "initialize\x0a\x09self register",
- messageSends: ["register"],
- referencedClasses: []
- }),
- smalltalk.ErrorHandler.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "register",
- category: 'initialization',
- fn: function (){
- var self=this;
- function $ErrorHandler(){return smalltalk.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
- return smalltalk.withContext(function($ctx1) {
- _st($ErrorHandler())._setCurrent_(_st(self)._new());
- return self}, function($ctx1) {$ctx1.fill(self,"register",{},smalltalk.ErrorHandler.klass)})},
- args: [],
- source: "register\x0a\x09ErrorHandler setCurrent: self new",
- messageSends: ["setCurrent:", "new"],
- referencedClasses: ["ErrorHandler"]
- }),
- smalltalk.ErrorHandler.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "setCurrent:",
- category: 'accessing',
- fn: function (anHandler){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@current"]=anHandler;
- return self}, function($ctx1) {$ctx1.fill(self,"setCurrent:",{anHandler:anHandler},smalltalk.ErrorHandler.klass)})},
- args: ["anHandler"],
- source: "setCurrent: anHandler\x0a\x09current := anHandler",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ErrorHandler.klass);
- smalltalk.addPackage('Kernel-Transcript');
- smalltalk.addClass('ConsoleTranscript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "clear",
- category: 'printing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self}, function($ctx1) {$ctx1.fill(self,"clear",{},smalltalk.ConsoleTranscript)})},
- args: [],
- source: "clear\x0a\x09\x22no op\x22",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ConsoleTranscript);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "cr",
- category: 'printing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self}, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.ConsoleTranscript)})},
- args: [],
- source: "cr\x0a\x09\x22no op\x22",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ConsoleTranscript);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "open",
- category: 'actions',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self}, function($ctx1) {$ctx1.fill(self,"open",{},smalltalk.ConsoleTranscript)})},
- args: [],
- source: "open",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ConsoleTranscript);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "show:",
- category: 'printing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- console.log(String(string._asString()));
- return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},smalltalk.ConsoleTranscript)})},
- args: ["anObject"],
- source: "show: anObject\x0a\x09<console.log(String(string._asString()))>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ConsoleTranscript);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "initialize",
- category: 'initialization',
- fn: function (){
- var self=this;
- function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
- return smalltalk.withContext(function($ctx1) {
- _st($Transcript())._register_(_st(self)._new());
- return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ConsoleTranscript.klass)})},
- args: [],
- source: "initialize\x0a\x09Transcript register: self new",
- messageSends: ["register:", "new"],
- referencedClasses: ["Transcript"]
- }),
- smalltalk.ConsoleTranscript.klass);
- smalltalk.addClass('Transcript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
- smalltalk.Transcript.klass.iVarNames = ['current'];
- smalltalk.addMethod(
- smalltalk.method({
- selector: "clear",
- category: 'printing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(_st(self)._current())._clear();
- return self}, function($ctx1) {$ctx1.fill(self,"clear",{},smalltalk.Transcript.klass)})},
- args: [],
- source: "clear\x0a\x09self current clear",
- messageSends: ["clear", "current"],
- referencedClasses: []
- }),
- smalltalk.Transcript.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "cr",
- category: 'printing',
- fn: function (){
- var self=this;
- function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
- return smalltalk.withContext(function($ctx1) {
- _st(_st(self)._current())._show_(_st($String())._cr());
- return self}, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.Transcript.klass)})},
- args: [],
- source: "cr\x0a\x09self current show: String cr",
- messageSends: ["show:", "cr", "current"],
- referencedClasses: ["String"]
- }),
- smalltalk.Transcript.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "current",
- category: 'instance creation',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@current"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.Transcript.klass)})},
- args: [],
- source: "current\x0a\x09^current",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Transcript.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "new",
- category: 'instance creation',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._shouldNotImplement();
- return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.Transcript.klass)})},
- args: [],
- source: "new\x0a\x09self shouldNotImplement",
- messageSends: ["shouldNotImplement"],
- referencedClasses: []
- }),
- smalltalk.Transcript.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "open",
- category: 'instance creation',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(_st(self)._current())._open();
- return self}, function($ctx1) {$ctx1.fill(self,"open",{},smalltalk.Transcript.klass)})},
- args: [],
- source: "open\x0a\x09self current open",
- messageSends: ["open", "current"],
- referencedClasses: []
- }),
- smalltalk.Transcript.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "register:",
- category: 'instance creation',
- fn: function (aTranscript){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@current"]=aTranscript;
- return self}, function($ctx1) {$ctx1.fill(self,"register:",{aTranscript:aTranscript},smalltalk.Transcript.klass)})},
- args: ["aTranscript"],
- source: "register: aTranscript\x0a\x09current := aTranscript",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Transcript.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "show:",
- category: 'printing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(_st(self)._current())._show_(anObject);
- return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},smalltalk.Transcript.klass)})},
- args: ["anObject"],
- source: "show: anObject\x0a\x09self current show: anObject",
- messageSends: ["show:", "current"],
- referencedClasses: []
- }),
- smalltalk.Transcript.klass);
- smalltalk.addPackage('Kernel-Announcements');
- smalltalk.addClass('AnnouncementSubscription', smalltalk.Object, ['block', 'announcementClass'], 'Kernel-Announcements');
- smalltalk.AnnouncementSubscription.comment="The subscription is a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "announcementClass",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@announcementClass"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"announcementClass",{},smalltalk.AnnouncementSubscription)})},
- args: [],
- source: "announcementClass\x0a\x09^ announcementClass",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.AnnouncementSubscription);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "announcementClass:",
- category: 'accessing',
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@announcementClass"]=aClass;
- return self}, function($ctx1) {$ctx1.fill(self,"announcementClass:",{aClass:aClass},smalltalk.AnnouncementSubscription)})},
- args: ["aClass"],
- source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.AnnouncementSubscription);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "block",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@block"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"block",{},smalltalk.AnnouncementSubscription)})},
- args: [],
- source: "block\x0a\x09^block",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.AnnouncementSubscription);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "block:",
- category: 'accessing',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@block"]=aBlock;
- return self}, function($ctx1) {$ctx1.fill(self,"block:",{aBlock:aBlock},smalltalk.AnnouncementSubscription)})},
- args: ["aBlock"],
- source: "block: aBlock\x0a\x09block := aBlock",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.AnnouncementSubscription);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "deliver:",
- category: 'announcing',
- fn: function (anAnnouncement){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._handlesAnnouncement_(anAnnouncement);
- if(smalltalk.assert($1)){
- _st(_st(self)._block())._value_(anAnnouncement);
- };
- return self}, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},smalltalk.AnnouncementSubscription)})},
- args: ["anAnnouncement"],
- source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [self block value: anAnnouncement]",
- messageSends: ["ifTrue:", "value:", "block", "handlesAnnouncement:"],
- referencedClasses: []
- }),
- smalltalk.AnnouncementSubscription);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "handlesAnnouncement:",
- category: 'announcing',
- fn: function (anAnnouncement){
- var self=this;
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=_st(_st($Smalltalk())._current())._at_(_st(_st(self)._announcementClass())._name());
- if(($receiver = $2) == nil || $receiver == undefined){
- return false;
- } else {
- var class_;
- class_=$receiver;
- $1=_st(class_)._includesBehavior_(_st(_st($Smalltalk())._current())._at_(_st(_st(_st(anAnnouncement)._class())._theNonMetaClass())._name()));
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},smalltalk.AnnouncementSubscription)})},
- args: ["anAnnouncement"],
- source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk current at: self announcementClass name)\x0a\x09\x09ifNil: [ ^ false ]\x0a\x09\x09ifNotNil: [ :class |\x0a\x09\x09class includesBehavior: (Smalltalk current at: anAnnouncement class theNonMetaClass name) ]",
- messageSends: ["ifNil:ifNotNil:", "includesBehavior:", "at:", "name", "theNonMetaClass", "class", "current", "announcementClass"],
- referencedClasses: ["Smalltalk"]
- }),
- smalltalk.AnnouncementSubscription);
- smalltalk.addClass('Announcer', smalltalk.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
- smalltalk.Announcer.comment="The code is based on the announcements as [described by Vassili Bykov](http://www.cincomsmalltalk.com/userblogs/vbykov/blogView?searchCategory=Announcements%20Framework).\x0aThe Announcer holds annoncement subscriptions (`AnnouncementSubscription`) in a private registry.\x0a\x0aUse `#on:do:` to register subscriptions."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "announce:",
- category: 'announcing',
- fn: function (anAnnouncement){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self["@subscriptions"])._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(each)._deliver_(anAnnouncement);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},smalltalk.Announcer)})},
- args: ["anAnnouncement"],
- source: "announce: anAnnouncement\x0a\x09subscriptions do: [:each |\x0a\x09\x09each deliver: anAnnouncement]",
- messageSends: ["do:", "deliver:"],
- referencedClasses: []
- }),
- smalltalk.Announcer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "initialize",
- category: 'initialization',
- fn: function (){
- var self=this;
- function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
- return smalltalk.withContext(function($ctx1) {
- smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
- self["@subscriptions"]=_st($Array())._new();
- return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Announcer)})},
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := Array new",
- messageSends: ["initialize", "new"],
- referencedClasses: ["Array"]
- }),
- smalltalk.Announcer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "on:do:",
- category: 'subscribing',
- fn: function (aClass,aBlock){
- var self=this;
- function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=_st($AnnouncementSubscription())._new();
- _st($1)._block_(aBlock);
- _st($1)._announcementClass_(aClass);
- $2=_st($1)._yourself();
- _st(self["@subscriptions"])._add_($2);
- return self}, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},smalltalk.Announcer)})},
- args: ["aClass", "aBlock"],
- source: "on: aClass do: aBlock\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09block: aBlock;\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
- messageSends: ["add:", "block:", "new", "announcementClass:", "yourself"],
- referencedClasses: ["AnnouncementSubscription"]
- }),
- smalltalk.Announcer);
- smalltalk.addClass('SystemAnnouncer', smalltalk.Announcer, [], 'Kernel-Announcements');
- smalltalk.SystemAnnouncer.comment="My unique instance #current is the global announcer handling all Amber system-related announces"
- smalltalk.SystemAnnouncer.klass.iVarNames = ['current'];
- smalltalk.addMethod(
- smalltalk.method({
- selector: "current",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@current"];
- if(($receiver = $2) == nil || $receiver == undefined){
- self["@current"]=smalltalk.Announcer.klass.fn.prototype._new.apply(_st(self), []);
- $1=self["@current"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.SystemAnnouncer.klass)})},
- args: [],
- source: "current\x0a\x09^ current ifNil: [ current := super new ]",
- messageSends: ["ifNil:", "new"],
- referencedClasses: []
- }),
- smalltalk.SystemAnnouncer.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "new",
- category: 'instance creation',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._shouldNotImplement();
- return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.SystemAnnouncer.klass)})},
- args: [],
- source: "new\x0a\x09self shouldNotImplement",
- messageSends: ["shouldNotImplement"],
- referencedClasses: []
- }),
- smalltalk.SystemAnnouncer.klass);
- smalltalk.addClass('SystemAnnouncement', smalltalk.Object, ['theClass'], 'Kernel-Announcements');
- smalltalk.SystemAnnouncement.comment="I am the superclass of all system announcements"
- smalltalk.addMethod(
- smalltalk.method({
- selector: "theClass",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@theClass"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.SystemAnnouncement)})},
- args: [],
- source: "theClass\x0a\x09^ theClass",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.SystemAnnouncement);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "theClass:",
- category: 'accessing',
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@theClass"]=aClass;
- return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.SystemAnnouncement)})},
- args: ["aClass"],
- source: "theClass: aClass\x0a\x09theClass := aClass",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.SystemAnnouncement);
- smalltalk.addClass('ClassAnnouncement', smalltalk.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "theClass",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@theClass"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ClassAnnouncement)})},
- args: [],
- source: "theClass\x0a\x09^ theClass",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ClassAnnouncement);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "theClass:",
- category: 'accessing',
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@theClass"]=aClass;
- return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ClassAnnouncement)})},
- args: ["aClass"],
- source: "theClass: aClass\x0a\x09theClass := aClass",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ClassAnnouncement);
- smalltalk.addClass('ClassAdded', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
- smalltalk.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods"
- smalltalk.addClass('ClassCommentChanged', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
- smalltalk.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)"
- smalltalk.addClass('ClassDefinitionChanged', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
- smalltalk.ClassDefinitionChanged.comment="I am emitted when the defintion of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:"
- smalltalk.addClass('ClassMoved', smalltalk.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "oldPackage",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@oldPackage"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"oldPackage",{},smalltalk.ClassMoved)})},
- args: [],
- source: "oldPackage\x0a\x09^ oldPackage",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ClassMoved);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "oldPackage:",
- category: 'accessing',
- fn: function (aPackage){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@oldPackage"]=aPackage;
- return self}, function($ctx1) {$ctx1.fill(self,"oldPackage:",{aPackage:aPackage},smalltalk.ClassMoved)})},
- args: ["aPackage"],
- source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ClassMoved);
- smalltalk.addClass('ClassRemoved', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
- smalltalk.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:"
- smalltalk.addClass('ClassRenamed', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
- smalltalk.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:"
- smalltalk.addClass('MethodAnnouncement', smalltalk.SystemAnnouncement, ['method'], 'Kernel-Announcements');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "method",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@method"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.MethodAnnouncement)})},
- args: [],
- source: "method\x0a\x09^ method",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MethodAnnouncement);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "method:",
- category: 'accessing',
- fn: function (aCompiledMethod){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@method"]=aCompiledMethod;
- return self}, function($ctx1) {$ctx1.fill(self,"method:",{aCompiledMethod:aCompiledMethod},smalltalk.MethodAnnouncement)})},
- args: ["aCompiledMethod"],
- source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MethodAnnouncement);
- smalltalk.addClass('MethodAdded', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
- smalltalk.addClass('MethodModified', smalltalk.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "oldMethod",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@oldMethod"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"oldMethod",{},smalltalk.MethodModified)})},
- args: [],
- source: "oldMethod\x0a\x09^ oldMethod",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MethodModified);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "oldMethod:",
- category: 'accessing',
- fn: function (aMethod){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@oldMethod"]=aMethod;
- return self}, function($ctx1) {$ctx1.fill(self,"oldMethod:",{aMethod:aMethod},smalltalk.MethodModified)})},
- args: ["aMethod"],
- source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MethodModified);
- smalltalk.addClass('MethodMoved', smalltalk.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "oldProtocol",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@oldProtocol"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"oldProtocol",{},smalltalk.MethodMoved)})},
- args: [],
- source: "oldProtocol\x0a\x09^ oldProtocol",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MethodMoved);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "oldProtocol:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@oldProtocol"]=aString;
- return self}, function($ctx1) {$ctx1.fill(self,"oldProtocol:",{aString:aString},smalltalk.MethodMoved)})},
- args: ["aString"],
- source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MethodMoved);
- smalltalk.addClass('MethodRemoved', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
- smalltalk.addClass('PackageAnnouncement', smalltalk.SystemAnnouncement, ['package'], 'Kernel-Announcements');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "package",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@package"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"package",{},smalltalk.PackageAnnouncement)})},
- args: [],
- source: "package\x0a\x09^ package",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.PackageAnnouncement);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "package:",
- category: 'accessing',
- fn: function (aPackage){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@package"]=aPackage;
- return self}, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage},smalltalk.PackageAnnouncement)})},
- args: ["aPackage"],
- source: "package: aPackage\x0a\x09package := aPackage",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.PackageAnnouncement);
- smalltalk.addClass('PackageAdded', smalltalk.PackageAnnouncement, [], 'Kernel-Announcements');
- smalltalk.addClass('PackageRemoved', smalltalk.PackageAnnouncement, [], 'Kernel-Announcements');
- smalltalk.addClass('ProtocolAnnouncement', smalltalk.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "protocol",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@protocol"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"protocol",{},smalltalk.ProtocolAnnouncement)})},
- args: [],
- source: "protocol\x0a\x09^ protocol",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ProtocolAnnouncement);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "protocol:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@protocol"]=aString;
- return self}, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString},smalltalk.ProtocolAnnouncement)})},
- args: ["aString"],
- source: "protocol: aString\x0a\x09protocol := aString",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ProtocolAnnouncement);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "theClass",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@theClass"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ProtocolAnnouncement)})},
- args: [],
- source: "theClass\x0a\x09^ theClass",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ProtocolAnnouncement);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "theClass:",
- category: 'accessing',
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@theClass"]=aClass;
- return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ProtocolAnnouncement)})},
- args: ["aClass"],
- source: "theClass: aClass\x0a\x09theClass := aClass",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ProtocolAnnouncement);
- smalltalk.addClass('ProtocolAdded', smalltalk.ProtocolAnnouncement, [], 'Kernel-Announcements');
- smalltalk.addClass('ProtocolRemoved', smalltalk.ProtocolAnnouncement, [], 'Kernel-Announcements');
- smalltalk.addPackage('AmberCli');
- smalltalk.addClass('AmberCli', smalltalk.Object, [], 'AmberCli');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commandLineSwitches",
- category: 'commandline',
- fn: function (){
- var self=this;
- var switches;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- switches=_st(_st(_st(self)._class())._methodsInProtocol_("commands"))._collect_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(each)._selector();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- switches=_st(switches)._select_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(each)._match_("^[^:]*:$");
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- switches=_st(switches)._collect_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(_st(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- $1=switches;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},smalltalk.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",
- messageSends: ["collect:", "selector", "methodsInProtocol:", "class", "select:", "match:", "asLowercase", "replace:with:", "allButLast"],
- referencedClasses: []
- }),
- smalltalk.AmberCli.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "handleArguments:",
- category: 'commandline',
- fn: function (args){
- var self=this;
- var command;
- function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
- return smalltalk.withContext(function($ctx1) {
- command=_st(self)._selectorForCommandLineSwitch_(_st(args)._first());
- _st(args)._remove_(_st(args)._first());
- _st(self)._perform_withArguments_(command,_st($Array())._with_(args));
- return self}, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,command:command},smalltalk.AmberCli.klass)})},
- args: ["args"],
- source: "handleArguments: args\x0a\x09| command |\x0a\x09command := self selectorForCommandLineSwitch: (args first).\x0a\x09args remove: args first.\x0a\x09self perform: command withArguments: (Array with: args).",
- messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"],
- referencedClasses: ["Array"]
- }),
- smalltalk.AmberCli.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "help:",
- category: 'commands',
- fn: function (args){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(console)._log_("Available Commands:");
- _st(_st(self)._commandLineSwitches())._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(console)._log_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"help:",{args:args},smalltalk.AmberCli.klass)})},
- args: ["args"],
- source: "help: args\x0a\x09console log: 'Available Commands:'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
- messageSends: ["log:", "do:", "commandLineSwitches"],
- referencedClasses: []
- }),
- smalltalk.AmberCli.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "main",
- category: 'startup',
- fn: function (){
- var self=this;
- var args;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- args=_st(process)._argv();
- _st(args)._removeFrom_to_((1),(3));
- $1=_st(args)._isEmpty();
- if(smalltalk.assert($1)){
- _st(self)._help_(nil);
- } else {
- $2=_st(self)._handleArguments_(args);
- return $2;
- };
- return self}, function($ctx1) {$ctx1.fill(self,"main",{args:args},smalltalk.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\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\x09\x0a\x09(args isEmpty)\x0a\x09\x09ifTrue: [self help: nil]\x0a\x09\x09ifFalse: [^self handleArguments: args]",
- messageSends: ["argv", "removeFrom:to:", "ifTrue:ifFalse:", "help:", "handleArguments:", "isEmpty"],
- referencedClasses: []
- }),
- smalltalk.AmberCli.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "repl:",
- category: 'commands',
- fn: function (args){
- var self=this;
- function $Repl(){return smalltalk.Repl||(typeof Repl=="undefined"?nil:Repl)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st($Repl())._new())._createInterface();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},smalltalk.AmberCli.klass)})},
- args: ["args"],
- source: "repl: args\x0a\x09^Repl new createInterface",
- messageSends: ["createInterface", "new"],
- referencedClasses: ["Repl"]
- }),
- smalltalk.AmberCli.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "selectorForCommandLineSwitch:",
- category: 'commandline',
- fn: function (aSwitch){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(aSwitch)._replace_with_("-[a-z]",(function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(each)._second())._asUppercase();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}))).__comma(":");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},smalltalk.AmberCli.klass)})},
- args: ["aSwitch"],
- source: "selectorForCommandLineSwitch: aSwitch\x0a\x09\x22Add ':' 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: '-[a-z]' with: [ :each | each second asUppercase ]), ':'",
- messageSends: [",", "replace:with:", "asUppercase", "second"],
- referencedClasses: []
- }),
- smalltalk.AmberCli.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "server:",
- category: 'commands',
- fn: function (args){
- var self=this;
- function $FileServer(){return smalltalk.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st($FileServer())._createServerWithArguments_(args))._start();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"server:",{args:args},smalltalk.AmberCli.klass)})},
- args: ["args"],
- source: "server: args\x0a\x09^(FileServer createServerWithArguments: args) start",
- messageSends: ["start", "createServerWithArguments:"],
- referencedClasses: ["FileServer"]
- }),
- smalltalk.AmberCli.klass);
- smalltalk.addClass('FileServer', smalltalk.Object, ['path', 'http', 'fs', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "base64Decode:",
- category: 'private',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return (new Buffer(aString, 'base64').toString());
- return self}, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},smalltalk.FileServer)})},
- args: ["aString"],
- source: "base64Decode: aString\x0a\x09<return (new Buffer(aString, 'base64').toString())>",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "basePath",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@basePath"];
- if(($receiver = $2) == nil || $receiver == undefined){
- $1="./";
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"basePath",{},smalltalk.FileServer)})},
- args: [],
- source: "basePath\x0a\x09^basePath ifNil: ['./']",
- messageSends: ["ifNil:"],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "basePath:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@basePath"]=aString;
- return self}, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},smalltalk.FileServer)})},
- args: ["aString"],
- source: "basePath: aString\x0a\x09basePath := aString",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "checkDirectoryLayout",
- category: 'initialization',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3;
- $1=_st(self["@fs"])._existsSync_(_st(_st(self)._basePath()).__comma("index.html"));
- if(! smalltalk.assert($1)){
- _st(console)._warn_("Warning: project directory does not contain index.html");
- };
- $2=_st(self["@fs"])._existsSync_(_st(_st(self)._basePath()).__comma("st"));
- if(! smalltalk.assert($2)){
- _st(console)._warn_("Warning: project directory is missing an \x22st\x22 directory");
- };
- $3=_st(self["@fs"])._existsSync_(_st(_st(self)._basePath()).__comma("js"));
- if(! smalltalk.assert($3)){
- _st(console)._warn_("Warning: project directory is missing a \x22js\x22 directory");
- };
- return self}, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},smalltalk.FileServer)})},
- args: [],
- source: "checkDirectoryLayout\x0a\x09(fs existsSync: self basePath, 'index.html') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory does not contain index.html'].\x0a\x09(fs existsSync: self basePath, 'st') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory is missing an \x22st\x22 directory'].\x0a\x09(fs existsSync: self basePath, 'js') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory is missing a \x22js\x22 directory'].",
- messageSends: ["ifFalse:", "warn:", "existsSync:", ",", "basePath"],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "fallbackPage",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@fallbackPage"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"fallbackPage",{},smalltalk.FileServer)})},
- args: [],
- source: "fallbackPage\x0a\x09^fallbackPage",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "fallbackPage:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@fallbackPage"]=aString;
- return self}, function($ctx1) {$ctx1.fill(self,"fallbackPage:",{aString:aString},smalltalk.FileServer)})},
- args: ["aString"],
- source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "handleGETRequest:respondTo:",
- category: 'request handling',
- fn: function (aRequest,aResponse){
- var self=this;
- var uri,filename;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- uri=_st(_st(self["@url"])._parse_(_st(aRequest)._url()))._pathname();
- filename=_st(self["@path"])._join_with_(_st(self)._basePath(),uri);
- _st(self["@fs"])._exists_do_(filename,(function(aBoolean){
- return smalltalk.withContext(function($ctx2) {
- $1=aBoolean;
- if(smalltalk.assert($1)){
- return _st(self)._respondFileNamed_to_(filename,aResponse);
- } else {
- return _st(self)._respondNotFoundTo_(aResponse);
- };
- }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},smalltalk.FileServer)})},
- args: ["aRequest", "aResponse"],
- source: "handleGETRequest: aRequest respondTo: aResponse\x0a\x09| uri filename |\x0a\x09uri := (url parse: aRequest url) pathname.\x0a\x09filename := path join: self basePath with: uri.\x0a\x09fs exists: filename do: [:aBoolean |\x0a\x09\x09aBoolean\x0a\x09\x09\x09ifFalse: [self respondNotFoundTo: aResponse]\x0a\x09\x09\x09ifTrue: [self respondFileNamed: filename to: aResponse]]",
- messageSends: ["pathname", "parse:", "url", "join:with:", "basePath", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "respondFileNamed:to:"],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "handleOPTIONSRequest:respondTo:",
- category: 'request handling',
- fn: function (aRequest,aResponse){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(aResponse)._writeHead_options_((200),smalltalk.HashedCollection._fromPairs_([_st("Access-Control-Allow-Origin").__minus_gt("*"),_st("Access-Control-Allow-Methods").__minus_gt("GET, PUT, POST, DELETE, OPTIONS"),_st("Access-Control-Allow-Headers").__minus_gt("Content-Type, Accept"),_st("Content-Length").__minus_gt((0)),_st("Access-Control-Max-Age").__minus_gt((10))]));
- _st(aResponse)._end();
- return self}, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},smalltalk.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",
- messageSends: ["writeHead:options:", "->", "end"],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "handlePUTRequest:respondTo:",
- category: 'request handling',
- fn: function (aRequest,aResponse){
- var self=this;
- var file,stream;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=_st(self)._isAuthenticated_(aRequest);
- if(! smalltalk.assert($1)){
- _st(self)._respondAuthenticationRequiredTo_(aResponse);
- return nil;
- };
- file=_st(".").__comma(_st(aRequest)._url());
- stream=_st(self["@fs"])._createWriteStream_(file);
- _st(stream)._on_do_("error",(function(error){
- return smalltalk.withContext(function($ctx2) {
- _st(console)._warn_(_st("Error creating WriteStream for file ").__comma(file));
- _st(console)._warn_(" Did you forget to create the necessary js/ or st/ directory in your project?");
- _st(console)._warn_(_st(" The exact error is: ").__comma(error));
- return _st(self)._respondNotCreatedTo_(aResponse);
- }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})}));
- _st(stream)._on_do_("close",(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(self)._respondCreatedTo_(aResponse);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- _st(aRequest)._setEncoding_("utf8");
- _st(aRequest)._on_do_("data",(function(data){
- return smalltalk.withContext(function($ctx2) {
- return _st(stream)._write_(data);
- }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1)})}));
- _st(aRequest)._on_do_("end",(function(){
- return smalltalk.withContext(function($ctx2) {
- $2=_st(stream)._writable();
- if(smalltalk.assert($2)){
- return _st(stream)._end();
- };
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},smalltalk.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 js/ or st/ directory in your project?'.\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]]",
- messageSends: ["ifFalse:", "respondAuthenticationRequiredTo:", "isAuthenticated:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "end", "writable"],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "handleRequest:respondTo:",
- category: 'request handling',
- fn: function (aRequest,aResponse){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3;
- $1=_st(_st(aRequest)._method()).__eq("PUT");
- if(smalltalk.assert($1)){
- _st(self)._handlePUTRequest_respondTo_(aRequest,aResponse);
- };
- $2=_st(_st(aRequest)._method()).__eq("GET");
- if(smalltalk.assert($2)){
- _st(self)._handleGETRequest_respondTo_(aRequest,aResponse);
- };
- $3=_st(_st(aRequest)._method()).__eq("OPTIONS");
- if(smalltalk.assert($3)){
- _st(self)._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
- };
- return self}, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},smalltalk.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]",
- messageSends: ["ifTrue:", "handlePUTRequest:respondTo:", "=", "method", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "host",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@host"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"host",{},smalltalk.FileServer)})},
- args: [],
- source: "host\x0a\x09^host",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "host:",
- category: 'accessing',
- fn: function (hostname){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@host"]=hostname;
- return self}, function($ctx1) {$ctx1.fill(self,"host:",{hostname:hostname},smalltalk.FileServer)})},
- args: ["hostname"],
- source: "host: hostname\x0a\x09host := hostname",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "initialize",
- category: 'initialization',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
- self["@path"]=_st(self)._require_("path");
- self["@http"]=_st(self)._require_("http");
- self["@fs"]=_st(self)._require_("fs");
- self["@util"]=_st(self)._require_("util");
- self["@url"]=_st(self)._require_("url");
- self["@host"]=_st(_st(self)._class())._defaultHost();
- self["@port"]=_st(_st(self)._class())._defaultPort();
- self["@username"]=nil;
- self["@password"]=nil;
- self["@fallbackPage"]=nil;
- return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.FileServer)})},
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09path := self require: 'path'.\x0a\x09http := self require: 'http'.\x0a\x09fs := self require: 'fs'.\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.",
- messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isAuthenticated:",
- category: 'private',
- fn: function (aRequest){
- var self=this;
- var header,token,auth,parts;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5;
- $1=_st(_st(self["@username"])._isNil())._and_((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(self["@password"])._isNil();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- if(smalltalk.assert($1)){
- return true;
- };
- $2=_st(_st(aRequest)._headers())._at_("authorization");
- if(($receiver = $2) == nil || $receiver == undefined){
- header="";
- } else {
- header=$2;
- };
- $3=_st(header)._isEmpty();
- if(smalltalk.assert($3)){
- return false;
- } else {
- $4=_st(header)._tokenize_(" ");
- if(($receiver = $4) == nil || $receiver == undefined){
- token="";
- } else {
- token=$4;
- };
- token;
- auth=_st(self)._base64Decode_(_st(token)._at_((2)));
- auth;
- parts=_st(auth)._tokenize_(":");
- parts;
- $5=_st(_st(self["@username"]).__eq(_st(parts)._at_((1))))._and_((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(self["@password"]).__eq(_st(parts)._at_((2)));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- if(smalltalk.assert($5)){
- return true;
- } else {
- return false;
- };
- };
- return self}, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},smalltalk.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].",
- messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "tokenize:", "base64Decode:", "=", "isEmpty"],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "password:",
- category: 'accessing',
- fn: function (aPassword){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@password"]=aPassword;
- return self}, function($ctx1) {$ctx1.fill(self,"password:",{aPassword:aPassword},smalltalk.FileServer)})},
- args: ["aPassword"],
- source: "password: aPassword\x0a\x09password := aPassword.",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "port",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@port"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"port",{},smalltalk.FileServer)})},
- args: [],
- source: "port\x0a\x09^port",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "port:",
- category: 'accessing',
- fn: function (aNumber){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@port"]=aNumber;
- return self}, function($ctx1) {$ctx1.fill(self,"port:",{aNumber:aNumber},smalltalk.FileServer)})},
- args: ["aNumber"],
- source: "port: aNumber\x0a\x09port := aNumber",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "require:",
- category: 'private',
- fn: function (aModuleString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(require)._value_(aModuleString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},smalltalk.FileServer)})},
- args: ["aModuleString"],
- source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
- messageSends: ["value:"],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "respondAuthenticationRequiredTo:",
- category: 'request handling',
- fn: function (aResponse){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=aResponse;
- _st($1)._writeHead_options_((401),smalltalk.HashedCollection._fromPairs_([_st("WWW-Authenticate").__minus_gt("Basic realm=\x22Secured Developer Area\x22")]));
- _st($1)._write_("<html><body>Authentication needed</body></html>");
- $2=_st($1)._end();
- return self}, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},smalltalk.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.",
- messageSends: ["writeHead:options:", "->", "write:", "end"],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "respondCreatedTo:",
- category: 'request handling',
- fn: function (aResponse){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=aResponse;
- _st($1)._writeHead_options_((201),smalltalk.HashedCollection._fromPairs_([_st("Content-Type").__minus_gt("text/plain"),_st("Access-Control-Allow-Origin").__minus_gt("*")]));
- $2=_st($1)._end();
- return self}, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},smalltalk.FileServer)})},
- args: ["aResponse"],
- source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
- messageSends: ["writeHead:options:", "->", "end"],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "respondFileNamed:to:",
- category: 'request handling',
- fn: function (aFilename,aResponse){
- var self=this;
- var type,filename;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5;
- filename=aFilename;
- $1=_st(_st(self["@fs"])._statSync_(aFilename))._isDirectory();
- if(smalltalk.assert($1)){
- filename=_st(filename).__comma("index.html");
- filename;
- };
- _st(self["@fs"])._readFile_do_(filename,(function(ex,file){
- return smalltalk.withContext(function($ctx2) {
- $2=_st(ex)._notNil();
- if(smalltalk.assert($2)){
- _st(console)._log_(_st(filename).__comma(" does not exist"));
- return _st(self)._respondInternalErrorTo_(aResponse);
- } else {
- type=_st(_st(self)._class())._mimeTypeFor_(filename);
- type;
- $3=_st(type).__eq("application/javascript");
- if(smalltalk.assert($3)){
- type=_st(type).__comma(";charset=utf-8");
- type;
- };
- $4=aResponse;
- _st($4)._writeHead_options_((200),smalltalk.HashedCollection._fromPairs_([_st("Content-Type").__minus_gt(type)]));
- _st($4)._write_encoding_(file,"binary");
- $5=_st($4)._end();
- return $5;
- };
- }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},smalltalk.FileServer)})},
- args: ["aFilename", "aResponse"],
- source: "respondFileNamed: aFilename to: aResponse\x0a\x09| type filename |\x0a\x0a\x09filename := aFilename.\x0a\x09(fs statSync: aFilename) isDirectory ifTrue: [\x0a\x09\x09filename := filename, 'index.html'].\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 respondInternalErrorTo: 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]]",
- messageSends: ["ifTrue:", ",", "isDirectory", "statSync:", "readFile:do:", "ifTrue:ifFalse:", "log:", "respondInternalErrorTo:", "mimeTypeFor:", "class", "=", "writeHead:options:", "->", "write:encoding:", "end", "notNil"],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "respondInternalErrorTo:",
- category: 'request handling',
- fn: function (aResponse){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=aResponse;
- _st($1)._writeHead_options_((500),smalltalk.HashedCollection._fromPairs_([_st("Content-Type").__minus_gt("text/plain")]));
- _st($1)._write_("500 Internal server error");
- $2=_st($1)._end();
- return self}, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},smalltalk.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",
- messageSends: ["writeHead:options:", "->", "write:", "end"],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "respondNotCreatedTo:",
- category: 'request handling',
- fn: function (aResponse){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=aResponse;
- _st($1)._writeHead_options_((400),smalltalk.HashedCollection._fromPairs_([_st("Content-Type").__minus_gt("text/plain")]));
- _st($1)._write_("File could not be created. Did you forget to create the st/js directories on the server?");
- $2=_st($1)._end();
- return self}, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},smalltalk.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 st/js directories on the server?';\x0a\x09\x09end.",
- messageSends: ["writeHead:options:", "->", "write:", "end"],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "respondNotFoundTo:",
- category: 'request handling',
- fn: function (aResponse){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- $1=_st(_st(self)._fallbackPage())._isNil();
- if(! smalltalk.assert($1)){
- $2=_st(self)._respondFileNamed_to_(_st(self)._fallbackPage(),aResponse);
- return $2;
- };
- $3=aResponse;
- _st($3)._writeHead_options_((404),smalltalk.HashedCollection._fromPairs_([_st("Content-Type").__minus_gt("text/plain")]));
- _st($3)._write_("404 Not found");
- $4=_st($3)._end();
- return self}, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},smalltalk.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/plain'};\x0a\x09\x09write: '404 Not found';\x0a\x09\x09end",
- messageSends: ["ifFalse:", "respondFileNamed:to:", "fallbackPage", "isNil", "writeHead:options:", "->", "write:", "end"],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "respondOKTo:",
- category: 'request handling',
- fn: function (aResponse){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=aResponse;
- _st($1)._writeHead_options_((200),smalltalk.HashedCollection._fromPairs_([_st("Content-Type").__minus_gt("text/plain"),_st("Access-Control-Allow-Origin").__minus_gt("*")]));
- $2=_st($1)._end();
- return self}, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},smalltalk.FileServer)})},
- args: ["aResponse"],
- source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
- messageSends: ["writeHead:options:", "->", "end"],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "start",
- category: 'starting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- _st(self)._checkDirectoryLayout();
- $1=_st(self["@http"])._createServer_((function(request,response){
- return smalltalk.withContext(function($ctx2) {
- return _st(self)._handleRequest_respondTo_(request,response);
- }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1)})}));
- _st($1)._on_do_("error",(function(error){
- return smalltalk.withContext(function($ctx2) {
- return _st(console)._log_(_st("Error starting server: ").__comma(error));
- }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})}));
- _st($1)._on_do_("listening",(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(console)._log_(_st(_st(_st("Starting file server on ").__comma(_st(self)._host())).__comma(":")).__comma(_st(_st(self)._port())._asString()));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- $2=_st($1)._listen_host_(_st(self)._port(),_st(self)._host());
- return self}, function($ctx1) {$ctx1.fill(self,"start",{},smalltalk.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 ', self host, ':', self port asString];\x0a\x09 listen: self port host: self host.",
- messageSends: ["checkDirectoryLayout", "on:do:", "log:", ",", "createServer:", "handleRequest:respondTo:", "asString", "port", "host", "listen:host:"],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "startOn:",
- category: 'starting',
- fn: function (aPort){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._port_(aPort);
- _st(self)._start();
- return self}, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},smalltalk.FileServer)})},
- args: ["aPort"],
- source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
- messageSends: ["port:", "start"],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "username:",
- category: 'accessing',
- fn: function (aUsername){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@username"]=aUsername;
- return self}, function($ctx1) {$ctx1.fill(self,"username:",{aUsername:aUsername},smalltalk.FileServer)})},
- args: ["aUsername"],
- source: "username: aUsername\x0a\x09username := aUsername.",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "username:password:",
- category: 'accessing',
- fn: function (aUsername,aPassword){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@username"]=aUsername;
- self["@password"]=aPassword;
- return self}, function($ctx1) {$ctx1.fill(self,"username:password:",{aUsername:aUsername,aPassword:aPassword},smalltalk.FileServer)})},
- args: ["aUsername", "aPassword"],
- source: "username: aUsername password: aPassword\x0a\x09username := aUsername.\x0a\x09password := aPassword.",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "writeData:toFileNamed:",
- category: 'private',
- fn: function (data,aFilename){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(console)._log_(aFilename);
- return self}, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},smalltalk.FileServer)})},
- args: ["data", "aFilename"],
- source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
- messageSends: ["log:"],
- referencedClasses: []
- }),
- smalltalk.FileServer);
- smalltalk.FileServer.klass.iVarNames = ['mimeTypes'];
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commandLineSwitches",
- category: 'accessing',
- fn: function (){
- var self=this;
- var switches;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- switches=_st(_st(self)._methodsInProtocol_("accessing"))._collect_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(each)._selector();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- switches=_st(switches)._select_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(each)._match_("^[^:]*:$");
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- switches=_st(switches)._collect_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(_st(_st(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- $1=switches;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},smalltalk.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",
- messageSends: ["collect:", "selector", "methodsInProtocol:", "select:", "match:", "replace:with:", "asLowercase", "allButLast"],
- referencedClasses: []
- }),
- smalltalk.FileServer.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "createServerWithArguments:",
- category: 'initialization',
- fn: function (options){
- var self=this;
- var server,popFront,front,optionName,optionValue,switches;
- function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5;
- var $early={};
- try {
- switches=_st(self)._commandLineSwitches();
- server=_st(self)._new();
- _st(options)._ifEmpty_((function(){
- return smalltalk.withContext(function($ctx2) {
- $1=server;
- throw $early=[$1];
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- $2=_st(_st(options)._size())._even();
- if(! smalltalk.assert($2)){
- _st(console)._log_("Using default parameters.");
- _st(console)._log_(_st("Wrong commandline options or not enough arguments for: ").__comma(options));
- _st(console)._log_(_st("Use any of the following ones: ").__comma(switches));
- $3=server;
- return $3;
- };
- popFront=(function(args){
- return smalltalk.withContext(function($ctx2) {
- front=_st(args)._first();
- front;
- _st(args)._remove_(front);
- return front;
- }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1)})});
- _st((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(options)._notEmpty();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
- return smalltalk.withContext(function($ctx2) {
- optionName=_st(popFront)._value_(options);
- optionName;
- optionValue=_st(popFront)._value_(options);
- optionValue;
- $4=_st(switches)._includes_(optionName);
- if(smalltalk.assert($4)){
- optionName=_st(self)._selectorForCommandLineSwitch_(optionName);
- optionName;
- return _st(server)._perform_withArguments_(optionName,_st($Array())._with_(optionValue));
- } else {
- _st(console)._log_(_st(optionName).__comma(" is not a valid commandline option"));
- return _st(console)._log_(_st("Use any of the following ones: ").__comma(switches));
- };
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- $5=server;
- return $5;
- }
- 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},smalltalk.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.",
- messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "log:", ",", "even", "size", "first", "remove:", "whileTrue:", "value:", "ifTrue:ifFalse:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:", "includes:", "notEmpty"],
- referencedClasses: ["Array"]
- }),
- smalltalk.FileServer.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "defaultHost",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return "127.0.0.1";
- }, function($ctx1) {$ctx1.fill(self,"defaultHost",{},smalltalk.FileServer.klass)})},
- args: [],
- source: "defaultHost\x0a\x09^'127.0.0.1'",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.FileServer.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "defaultMimeTypes",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=smalltalk.HashedCollection._fromPairs_([_st("%").__minus_gt("application/x-trash"),_st("323").__minus_gt("text/h323"),_st("abw").__minus_gt("application/x-abiword"),_st("ai").__minus_gt("application/postscript"),_st("aif").__minus_gt("audio/x-aiff"),_st("aifc").__minus_gt("audio/x-aiff"),_st("aiff").__minus_gt("audio/x-aiff"),_st("alc").__minus_gt("chemical/x-alchemy"),_st("art").__minus_gt("image/x-jg"),_st("asc").__minus_gt("text/plain"),_st("asf").__minus_gt("video/x-ms-asf"),_st("asn").__minus_gt("chemical/x-ncbi-asn1-spec"),_st("aso").__minus_gt("chemical/x-ncbi-asn1-binary"),_st("asx").__minus_gt("video/x-ms-asf"),_st("au").__minus_gt("audio/basic"),_st("avi").__minus_gt("video/x-msvideo"),_st("b").__minus_gt("chemical/x-molconn-Z"),_st("bak").__minus_gt("application/x-trash"),_st("bat").__minus_gt("application/x-msdos-program"),_st("bcpio").__minus_gt("application/x-bcpio"),_st("bib").__minus_gt("text/x-bibtex"),_st("bin").__minus_gt("application/octet-stream"),_st("bmp").__minus_gt("image/x-ms-bmp"),_st("book").__minus_gt("application/x-maker"),_st("bsd").__minus_gt("chemical/x-crossfire"),_st("c").__minus_gt("text/x-csrc"),_st("c++").__minus_gt("text/x-c++src"),_st("c3d").__minus_gt("chemical/x-chem3d"),_st("cac").__minus_gt("chemical/x-cache"),_st("cache").__minus_gt("chemical/x-cache"),_st("cascii").__minus_gt("chemical/x-cactvs-binary"),_st("cat").__minus_gt("application/vnd.ms-pki.seccat"),_st("cbin").__minus_gt("chemical/x-cactvs-binary"),_st("cc").__minus_gt("text/x-c++src"),_st("cdf").__minus_gt("application/x-cdf"),_st("cdr").__minus_gt("image/x-coreldraw"),_st("cdt").__minus_gt("image/x-coreldrawtemplate"),_st("cdx").__minus_gt("chemical/x-cdx"),_st("cdy").__minus_gt("application/vnd.cinderella"),_st("cef").__minus_gt("chemical/x-cxf"),_st("cer").__minus_gt("chemical/x-cerius"),_st("chm").__minus_gt("chemical/x-chemdraw"),_st("chrt").__minus_gt("application/x-kchart"),_st("cif").__minus_gt("chemical/x-cif"),_st("class").__minus_gt("application/java-vm"),_st("cls").__minus_gt("text/x-tex"),_st("cmdf").__minus_gt("chemical/x-cmdf"),_st("cml").__minus_gt("chemical/x-cml"),_st("cod").__minus_gt("application/vnd.rim.cod"),_st("com").__minus_gt("application/x-msdos-program"),_st("cpa").__minus_gt("chemical/x-compass"),_st("cpio").__minus_gt("application/x-cpio"),_st("cpp").__minus_gt("text/x-c++src"),_st("cpt").__minus_gt("image/x-corelphotopaint"),_st("crl").__minus_gt("application/x-pkcs7-crl"),_st("crt").__minus_gt("application/x-x509-ca-cert"),_st("csf").__minus_gt("chemical/x-cache-csf"),_st("csh").__minus_gt("text/x-csh"),_st("csm").__minus_gt("chemical/x-csml"),_st("csml").__minus_gt("chemical/x-csml"),_st("css").__minus_gt("text/css"),_st("csv").__minus_gt("text/comma-separated-values"),_st("ctab").__minus_gt("chemical/x-cactvs-binary"),_st("ctx").__minus_gt("chemical/x-ctx"),_st("cu").__minus_gt("application/cu-seeme"),_st("cub").__minus_gt("chemical/x-gaussian-cube"),_st("cxf").__minus_gt("chemical/x-cxf"),_st("cxx").__minus_gt("text/x-c++src"),_st("dat").__minus_gt("chemical/x-mopac-input"),_st("dcr").__minus_gt("application/x-director"),_st("deb").__minus_gt("application/x-debian-package"),_st("dif").__minus_gt("video/dv"),_st("diff").__minus_gt("text/plain"),_st("dir").__minus_gt("application/x-director"),_st("djv").__minus_gt("image/vnd.djvu"),_st("djvu").__minus_gt("image/vnd.djvu"),_st("dl").__minus_gt("video/dl"),_st("dll").__minus_gt("application/x-msdos-program"),_st("dmg").__minus_gt("application/x-apple-diskimage"),_st("dms").__minus_gt("application/x-dms"),_st("doc").__minus_gt("application/msword"),_st("dot").__minus_gt("application/msword"),_st("dv").__minus_gt("video/dv"),_st("dvi").__minus_gt("application/x-dvi"),_st("dx").__minus_gt("chemical/x-jcamp-dx"),_st("dxr").__minus_gt("application/x-director"),_st("emb").__minus_gt("chemical/x-embl-dl-nucleotide"),_st("embl").__minus_gt("chemical/x-embl-dl-nucleotide"),_st("ent").__minus_gt("chemical/x-pdb"),_st("eps").__minus_gt("application/postscript"),_st("etx").__minus_gt("text/x-setext"),_st("exe").__minus_gt("application/x-msdos-program"),_st("ez").__minus_gt("application/andrew-inset"),_st("fb").__minus_gt("application/x-maker"),_st("fbdoc").__minus_gt("application/x-maker"),_st("fch").__minus_gt("chemical/x-gaussian-checkpoint"),_st("fchk").__minus_gt("chemical/x-gaussian-checkpoint"),_st("fig").__minus_gt("application/x-xfig"),_st("flac").__minus_gt("application/x-flac"),_st("fli").__minus_gt("video/fli"),_st("fm").__minus_gt("application/x-maker"),_st("frame").__minus_gt("application/x-maker"),_st("frm").__minus_gt("application/x-maker"),_st("gal").__minus_gt("chemical/x-gaussian-log"),_st("gam").__minus_gt("chemical/x-gamess-input"),_st("gamin").__minus_gt("chemical/x-gamess-input"),_st("gau").__minus_gt("chemical/x-gaussian-input"),_st("gcd").__minus_gt("text/x-pcs-gcd"),_st("gcf").__minus_gt("application/x-graphing-calculator"),_st("gcg").__minus_gt("chemical/x-gcg8-sequence"),_st("gen").__minus_gt("chemical/x-genbank"),_st("gf").__minus_gt("application/x-tex-gf"),_st("gif").__minus_gt("image/gif"),_st("gjc").__minus_gt("chemical/x-gaussian-input"),_st("gjf").__minus_gt("chemical/x-gaussian-input"),_st("gl").__minus_gt("video/gl"),_st("gnumeric").__minus_gt("application/x-gnumeric"),_st("gpt").__minus_gt("chemical/x-mopac-graph"),_st("gsf").__minus_gt("application/x-font"),_st("gsm").__minus_gt("audio/x-gsm"),_st("gtar").__minus_gt("application/x-gtar"),_st("h").__minus_gt("text/x-chdr"),_st("h++").__minus_gt("text/x-c++hdr"),_st("hdf").__minus_gt("application/x-hdf"),_st("hh").__minus_gt("text/x-c++hdr"),_st("hin").__minus_gt("chemical/x-hin"),_st("hpp").__minus_gt("text/x-c++hdr"),_st("hqx").__minus_gt("application/mac-binhex40"),_st("hs").__minus_gt("text/x-haskell"),_st("hta").__minus_gt("application/hta"),_st("htc").__minus_gt("text/x-component"),_st("htm").__minus_gt("text/html"),_st("html").__minus_gt("text/html"),_st("hxx").__minus_gt("text/x-c++hdr"),_st("ica").__minus_gt("application/x-ica"),_st("ice").__minus_gt("x-conference/x-cooltalk"),_st("ico").__minus_gt("image/x-icon"),_st("ics").__minus_gt("text/calendar"),_st("icz").__minus_gt("text/calendar"),_st("ief").__minus_gt("image/ief"),_st("iges").__minus_gt("model/iges"),_st("igs").__minus_gt("model/iges"),_st("iii").__minus_gt("application/x-iphone"),_st("inp").__minus_gt("chemical/x-gamess-input"),_st("ins").__minus_gt("application/x-internet-signup"),_st("iso").__minus_gt("application/x-iso9660-image"),_st("isp").__minus_gt("application/x-internet-signup"),_st("ist").__minus_gt("chemical/x-isostar"),_st("istr").__minus_gt("chemical/x-isostar"),_st("jad").__minus_gt("text/vnd.sun.j2me.app-descriptor"),_st("jar").__minus_gt("application/java-archive"),_st("java").__minus_gt("text/x-java"),_st("jdx").__minus_gt("chemical/x-jcamp-dx"),_st("jmz").__minus_gt("application/x-jmol"),_st("jng").__minus_gt("image/x-jng"),_st("jnlp").__minus_gt("application/x-java-jnlp-file"),_st("jpe").__minus_gt("image/jpeg"),_st("jpeg").__minus_gt("image/jpeg"),_st("jpg").__minus_gt("image/jpeg"),_st("js").__minus_gt("application/javascript"),_st("kar").__minus_gt("audio/midi"),_st("key").__minus_gt("application/pgp-keys"),_st("kil").__minus_gt("application/x-killustrator"),_st("kin").__minus_gt("chemical/x-kinemage"),_st("kpr").__minus_gt("application/x-kpresenter"),_st("kpt").__minus_gt("application/x-kpresenter"),_st("ksp").__minus_gt("application/x-kspread"),_st("kwd").__minus_gt("application/x-kword"),_st("kwt").__minus_gt("application/x-kword"),_st("latex").__minus_gt("application/x-latex"),_st("lha").__minus_gt("application/x-lha"),_st("lhs").__minus_gt("text/x-literate-haskell"),_st("lsf").__minus_gt("video/x-la-asf"),_st("lsx").__minus_gt("video/x-la-asf"),_st("ltx").__minus_gt("text/x-tex"),_st("lzh").__minus_gt("application/x-lzh"),_st("lzx").__minus_gt("application/x-lzx"),_st("m3u").__minus_gt("audio/x-mpegurl"),_st("m4a").__minus_gt("audio/mpeg"),_st("maker").__minus_gt("application/x-maker"),_st("man").__minus_gt("application/x-troff-man"),_st("mcif").__minus_gt("chemical/x-mmcif"),_st("mcm").__minus_gt("chemical/x-macmolecule"),_st("mdb").__minus_gt("application/msaccess"),_st("me").__minus_gt("application/x-troff-me"),_st("mesh").__minus_gt("model/mesh"),_st("mid").__minus_gt("audio/midi"),_st("midi").__minus_gt("audio/midi"),_st("mif").__minus_gt("application/x-mif"),_st("mm").__minus_gt("application/x-freemind"),_st("mmd").__minus_gt("chemical/x-macromodel-input"),_st("mmf").__minus_gt("application/vnd.smaf"),_st("mml").__minus_gt("text/mathml"),_st("mmod").__minus_gt("chemical/x-macromodel-input"),_st("mng").__minus_gt("video/x-mng"),_st("moc").__minus_gt("text/x-moc"),_st("mol").__minus_gt("chemical/x-mdl-molfile"),_st("mol2").__minus_gt("chemical/x-mol2"),_st("moo").__minus_gt("chemical/x-mopac-out"),_st("mop").__minus_gt("chemical/x-mopac-input"),_st("mopcrt").__minus_gt("chemical/x-mopac-input"),_st("mov").__minus_gt("video/quicktime"),_st("movie").__minus_gt("video/x-sgi-movie"),_st("mp2").__minus_gt("audio/mpeg"),_st("mp3").__minus_gt("audio/mpeg"),_st("mp4").__minus_gt("video/mp4"),_st("mpc").__minus_gt("chemical/x-mopac-input"),_st("mpe").__minus_gt("video/mpeg"),_st("mpeg").__minus_gt("video/mpeg"),_st("mpega").__minus_gt("audio/mpeg"),_st("mpg").__minus_gt("video/mpeg"),_st("mpga").__minus_gt("audio/mpeg"),_st("ms").__minus_gt("application/x-troff-ms"),_st("msh").__minus_gt("model/mesh"),_st("msi").__minus_gt("application/x-msi"),_st("mvb").__minus_gt("chemical/x-mopac-vib"),_st("mxu").__minus_gt("video/vnd.mpegurl"),_st("nb").__minus_gt("application/mathematica"),_st("nc").__minus_gt("application/x-netcdf"),_st("nwc").__minus_gt("application/x-nwc"),_st("o").__minus_gt("application/x-object"),_st("oda").__minus_gt("application/oda"),_st("odb").__minus_gt("application/vnd.oasis.opendocument.database"),_st("odc").__minus_gt("application/vnd.oasis.opendocument.chart"),_st("odf").__minus_gt("application/vnd.oasis.opendocument.formula"),_st("odg").__minus_gt("application/vnd.oasis.opendocument.graphics"),_st("odi").__minus_gt("application/vnd.oasis.opendocument.image"),_st("odm").__minus_gt("application/vnd.oasis.opendocument.text-master"),_st("odp").__minus_gt("application/vnd.oasis.opendocument.presentation"),_st("ods").__minus_gt("application/vnd.oasis.opendocument.spreadsheet"),_st("odt").__minus_gt("application/vnd.oasis.opendocument.text"),_st("ogg").__minus_gt("application/ogg"),_st("old").__minus_gt("application/x-trash"),_st("oth").__minus_gt("application/vnd.oasis.opendocument.text-web"),_st("oza").__minus_gt("application/x-oz-application"),_st("p").__minus_gt("text/x-pascal"),_st("p7r").__minus_gt("application/x-pkcs7-certreqresp"),_st("pac").__minus_gt("application/x-ns-proxy-autoconfig"),_st("pas").__minus_gt("text/x-pascal"),_st("pat").__minus_gt("image/x-coreldrawpattern"),_st("pbm").__minus_gt("image/x-portable-bitmap"),_st("pcf").__minus_gt("application/x-font"),_st("pcf.Z").__minus_gt("application/x-font"),_st("pcx").__minus_gt("image/pcx"),_st("pdb").__minus_gt("chemical/x-pdb"),_st("pdf").__minus_gt("application/pdf"),_st("pfa").__minus_gt("application/x-font"),_st("pfb").__minus_gt("application/x-font"),_st("pgm").__minus_gt("image/x-portable-graymap"),_st("pgn").__minus_gt("application/x-chess-pgn"),_st("pgp").__minus_gt("application/pgp-signature"),_st("pk").__minus_gt("application/x-tex-pk"),_st("pl").__minus_gt("text/x-perl"),_st("pls").__minus_gt("audio/x-scpls"),_st("pm").__minus_gt("text/x-perl"),_st("png").__minus_gt("image/png"),_st("pnm").__minus_gt("image/x-portable-anymap"),_st("pot").__minus_gt("text/plain"),_st("ppm").__minus_gt("image/x-portable-pixmap"),_st("pps").__minus_gt("application/vnd.ms-powerpoint"),_st("ppt").__minus_gt("application/vnd.ms-powerpoint"),_st("prf").__minus_gt("application/pics-rules"),_st("prt").__minus_gt("chemical/x-ncbi-asn1-ascii"),_st("ps").__minus_gt("application/postscript"),_st("psd").__minus_gt("image/x-photoshop"),_st("psp").__minus_gt("text/x-psp"),_st("py").__minus_gt("text/x-python"),_st("pyc").__minus_gt("application/x-python-code"),_st("pyo").__minus_gt("application/x-python-code"),_st("qt").__minus_gt("video/quicktime"),_st("qtl").__minus_gt("application/x-quicktimeplayer"),_st("ra").__minus_gt("audio/x-realaudio"),_st("ram").__minus_gt("audio/x-pn-realaudio"),_st("rar").__minus_gt("application/rar"),_st("ras").__minus_gt("image/x-cmu-raster"),_st("rd").__minus_gt("chemical/x-mdl-rdfile"),_st("rdf").__minus_gt("application/rdf+xml"),_st("rgb").__minus_gt("image/x-rgb"),_st("rm").__minus_gt("audio/x-pn-realaudio"),_st("roff").__minus_gt("application/x-troff"),_st("ros").__minus_gt("chemical/x-rosdal"),_st("rpm").__minus_gt("application/x-redhat-package-manager"),_st("rss").__minus_gt("application/rss+xml"),_st("rtf").__minus_gt("text/rtf"),_st("rtx").__minus_gt("text/richtext"),_st("rxn").__minus_gt("chemical/x-mdl-rxnfile"),_st("sct").__minus_gt("text/scriptlet"),_st("sd").__minus_gt("chemical/x-mdl-sdfile"),_st("sd2").__minus_gt("audio/x-sd2"),_st("sda").__minus_gt("application/vnd.stardivision.draw"),_st("sdc").__minus_gt("application/vnd.stardivision.calc"),_st("sdd").__minus_gt("application/vnd.stardivision.impress"),_st("sdf").__minus_gt("chemical/x-mdl-sdfile"),_st("sdp").__minus_gt("application/vnd.stardivision.impress"),_st("sdw").__minus_gt("application/vnd.stardivision.writer"),_st("ser").__minus_gt("application/java-serialized-object"),_st("sgf").__minus_gt("application/x-go-sgf"),_st("sgl").__minus_gt("application/vnd.stardivision.writer-global"),_st("sh").__minus_gt("text/x-sh"),_st("shar").__minus_gt("application/x-shar"),_st("shtml").__minus_gt("text/html"),_st("sid").__minus_gt("audio/prs.sid"),_st("sik").__minus_gt("application/x-trash"),_st("silo").__minus_gt("model/mesh"),_st("sis").__minus_gt("application/vnd.symbian.install"),_st("sit").__minus_gt("application/x-stuffit"),_st("skd").__minus_gt("application/x-koan"),_st("skm").__minus_gt("application/x-koan"),_st("skp").__minus_gt("application/x-koan"),_st("skt").__minus_gt("application/x-koan"),_st("smf").__minus_gt("application/vnd.stardivision.math"),_st("smi").__minus_gt("application/smil"),_st("smil").__minus_gt("application/smil"),_st("snd").__minus_gt("audio/basic"),_st("spc").__minus_gt("chemical/x-galactic-spc"),_st("spl").__minus_gt("application/x-futuresplash"),_st("src").__minus_gt("application/x-wais-source"),_st("stc").__minus_gt("application/vnd.sun.xml.calc.template"),_st("std").__minus_gt("application/vnd.sun.xml.draw.template"),_st("sti").__minus_gt("application/vnd.sun.xml.impress.template"),_st("stl").__minus_gt("application/vnd.ms-pki.stl"),_st("stw").__minus_gt("application/vnd.sun.xml.writer.template"),_st("sty").__minus_gt("text/x-tex"),_st("sv4cpio").__minus_gt("application/x-sv4cpio"),_st("sv4crc").__minus_gt("application/x-sv4crc"),_st("svg").__minus_gt("image/svg+xml"),_st("svgz").__minus_gt("image/svg+xml"),_st("sw").__minus_gt("chemical/x-swissprot"),_st("swf").__minus_gt("application/x-shockwave-flash"),_st("swfl").__minus_gt("application/x-shockwave-flash"),_st("sxc").__minus_gt("application/vnd.sun.xml.calc"),_st("sxd").__minus_gt("application/vnd.sun.xml.draw"),_st("sxg").__minus_gt("application/vnd.sun.xml.writer.global"),_st("sxi").__minus_gt("application/vnd.sun.xml.impress"),_st("sxm").__minus_gt("application/vnd.sun.xml.math"),_st("sxw").__minus_gt("application/vnd.sun.xml.writer"),_st("t").__minus_gt("application/x-troff"),_st("tar").__minus_gt("application/x-tar"),_st("taz").__minus_gt("application/x-gtar"),_st("tcl").__minus_gt("text/x-tcl"),_st("tex").__minus_gt("text/x-tex"),_st("texi").__minus_gt("application/x-texinfo"),_st("texinfo").__minus_gt("application/x-texinfo"),_st("text").__minus_gt("text/plain"),_st("tgf").__minus_gt("chemical/x-mdl-tgf"),_st("tgz").__minus_gt("application/x-gtar"),_st("tif").__minus_gt("image/tiff"),_st("tiff").__minus_gt("image/tiff"),_st("tk").__minus_gt("text/x-tcl"),_st("tm").__minus_gt("text/texmacs"),_st("torrent").__minus_gt("application/x-bittorrent"),_st("tr").__minus_gt("application/x-troff"),_st("ts").__minus_gt("text/texmacs"),_st("tsp").__minus_gt("application/dsptype"),_st("tsv").__minus_gt("text/tab-separated-values"),_st("txt").__minus_gt("text/plain"),_st("udeb").__minus_gt("application/x-debian-package"),_st("uls").__minus_gt("text/iuls"),_st("ustar").__minus_gt("application/x-ustar"),_st("val").__minus_gt("chemical/x-ncbi-asn1-binary"),_st("vcd").__minus_gt("application/x-cdlink"),_st("vcf").__minus_gt("text/x-vcard"),_st("vcs").__minus_gt("text/x-vcalendar"),_st("vmd").__minus_gt("chemical/x-vmd"),_st("vms").__minus_gt("chemical/x-vamas-iso14976"),_st("vor").__minus_gt("application/vnd.stardivision.writer"),_st("vrm").__minus_gt("x-world/x-vrml"),_st("vrml").__minus_gt("x-world/x-vrml"),_st("vsd").__minus_gt("application/vnd.visio"),_st("wad").__minus_gt("application/x-doom"),_st("wav").__minus_gt("audio/x-wav"),_st("wax").__minus_gt("audio/x-ms-wax"),_st("wbmp").__minus_gt("image/vnd.wap.wbmp"),_st("wbxml").__minus_gt("application/vnd.wap.wbxml"),_st("wk").__minus_gt("application/x-123"),_st("wm").__minus_gt("video/x-ms-wm"),_st("wma").__minus_gt("audio/x-ms-wma"),_st("wmd").__minus_gt("application/x-ms-wmd"),_st("wml").__minus_gt("text/vnd.wap.wml"),_st("wmlc").__minus_gt("application/vnd.wap.wmlc"),_st("wmls").__minus_gt("text/vnd.wap.wmlscript"),_st("wmlsc").__minus_gt("application/vnd.wap.wmlscriptc"),_st("wmv").__minus_gt("video/x-ms-wmv"),_st("wmx").__minus_gt("video/x-ms-wmx"),_st("wmz").__minus_gt("application/x-ms-wmz"),_st("wp5").__minus_gt("application/wordperfect5.1"),_st("wpd").__minus_gt("application/wordperfect"),_st("wrl").__minus_gt("x-world/x-vrml"),_st("wsc").__minus_gt("text/scriptlet"),_st("wvx").__minus_gt("video/x-ms-wvx"),_st("wz").__minus_gt("application/x-wingz"),_st("xbm").__minus_gt("image/x-xbitmap"),_st("xcf").__minus_gt("application/x-xcf"),_st("xht").__minus_gt("application/xhtml+xml"),_st("xhtml").__minus_gt("application/xhtml+xml"),_st("xlb").__minus_gt("application/vnd.ms-excel"),_st("xls").__minus_gt("application/vnd.ms-excel"),_st("xlt").__minus_gt("application/vnd.ms-excel"),_st("xml").__minus_gt("application/xml"),_st("xpi").__minus_gt("application/x-xpinstall"),_st("xpm").__minus_gt("image/x-xpixmap"),_st("xsl").__minus_gt("application/xml"),_st("xtel").__minus_gt("chemical/x-xtel"),_st("xul").__minus_gt("application/vnd.mozilla.xul+xml"),_st("xwd").__minus_gt("image/x-xwindowdump"),_st("xyz").__minus_gt("chemical/x-xyz"),_st("zip").__minus_gt("application/zip"),_st("zmt").__minus_gt("chemical/x-mopac-input"),_st("~").__minus_gt("application/x-trash")]);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"defaultMimeTypes",{},smalltalk.FileServer.klass)})},
- 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}",
- messageSends: ["->"],
- referencedClasses: []
- }),
- smalltalk.FileServer.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "defaultPort",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=(4000);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"defaultPort",{},smalltalk.FileServer.klass)})},
- args: [],
- source: "defaultPort\x0a\x09^4000",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.FileServer.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "main",
- category: 'initialization',
- fn: function (){
- var self=this;
- var fileServer,args;
- function $FileServer(){return smalltalk.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- var $early={};
- try {
- args=_st(process)._argv();
- _st(args)._removeFrom_to_((1),(3));
- _st(args)._detect_ifNone_((function(each){
- return smalltalk.withContext(function($ctx2) {
- $1=_st(each).__eq("--help");
- if(smalltalk.assert($1)){
- return _st($FileServer())._printHelp();
- };
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
- return smalltalk.withContext(function($ctx2) {
- fileServer=_st($FileServer())._createServerWithArguments_(args);
- fileServer;
- $2=_st(fileServer)._start();
- throw $early=[$2];
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return self}
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},smalltalk.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]",
- messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "printHelp", "=", "createServerWithArguments:", "start"],
- referencedClasses: ["FileServer"]
- }),
- smalltalk.FileServer.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "mimeTypeFor:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._mimeTypes())._at_ifAbsent_(_st(aString)._replace_with_(".*[\x5c.]",""),(function(){
- return smalltalk.withContext(function($ctx2) {
- return "text/plain";
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},smalltalk.FileServer.klass)})},
- args: ["aString"],
- source: "mimeTypeFor: aString\x0a\x09^self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
- messageSends: ["at:ifAbsent:", "replace:with:", "mimeTypes"],
- referencedClasses: []
- }),
- smalltalk.FileServer.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "mimeTypes",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@mimeTypes"];
- if(($receiver = $2) == nil || $receiver == undefined){
- self["@mimeTypes"]=_st(self)._defaultMimeTypes();
- $1=self["@mimeTypes"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},smalltalk.FileServer.klass)})},
- args: [],
- source: "mimeTypes\x0a\x09^mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
- messageSends: ["ifNil:", "defaultMimeTypes"],
- referencedClasses: []
- }),
- smalltalk.FileServer.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "printHelp",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(console)._log_("Available commandline options are:");
- _st(console)._log_("--help");
- _st(_st(self)._commandLineSwitches())._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(console)._log_(_st(each).__comma(" <parameter>"));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"printHelp",{},smalltalk.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>']",
- messageSends: ["log:", "do:", ",", "commandLineSwitches"],
- referencedClasses: []
- }),
- smalltalk.FileServer.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "selectorForCommandLineSwitch:",
- category: 'accessing',
- fn: function (aSwitch){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(_st(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(each)._second())._asUppercase();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}))).__comma(":");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},smalltalk.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 ]), ':'",
- messageSends: [",", "replace:with:", "asUppercase", "second"],
- referencedClasses: []
- }),
- smalltalk.FileServer.klass);
- smalltalk.addClass('Repl', smalltalk.Object, ['readline', 'interface', 'util'], 'AmberCli');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "close",
- category: 'actions',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(_st(process)._stdin())._destroy();
- return self}, function($ctx1) {$ctx1.fill(self,"close",{},smalltalk.Repl)})},
- args: [],
- source: "close\x0a\x09process stdin destroy",
- messageSends: ["destroy", "stdin"],
- referencedClasses: []
- }),
- smalltalk.Repl);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "createInterface",
- category: 'actions',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@interface"]=_st(self["@readline"])._createInterface_stdout_(_st(process)._stdin(),_st(process)._stdout());
- _st(self["@interface"])._on_do_("line",(function(buffer){
- return smalltalk.withContext(function($ctx2) {
- return _st(self)._eval_(buffer);
- }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1)})}));
- _st(self["@interface"])._on_do_("close",(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(self)._close();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- _st(self)._setPrompt();
- _st(self["@interface"])._prompt();
- return self}, function($ctx1) {$ctx1.fill(self,"createInterface",{},smalltalk.Repl)})},
- args: [],
- source: "createInterface\x0a\x09\x22No completion for now\x22\x0a\x09interface := readline createInterface: process stdin stdout: process stdout.\x0a\x09interface on: 'line' do: [:buffer | self eval: buffer].\x0a\x09interface on: 'close' do: [self close].\x0a\x09self setPrompt.\x0a\x09interface prompt",
- messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "eval:", "close", "setPrompt", "prompt"],
- referencedClasses: []
- }),
- smalltalk.Repl);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "eval:",
- category: 'actions',
- fn: function (buffer){
- var self=this;
- var result;
- function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
- function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
- function $ErrorHandler(){return smalltalk.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=_st(buffer)._isEmpty();
- if(! smalltalk.assert($1)){
- _st(self)._try_catch_((function(){
- return smalltalk.withContext(function($ctx2) {
- result=_st(_st($Compiler())._new())._evaluateExpression_(buffer);
- result;
- return _st($Transcript())._show_(result);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(e){
- return smalltalk.withContext(function($ctx2) {
- $2=_st(e)._isSmalltalkError();
- if(smalltalk.assert($2)){
- return _st(_st($ErrorHandler())._new())._handleError_(e);
- } else {
- return _st(_st(process)._stdout())._write_(_st(e)._jsStack());
- };
- }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1)})}));
- };
- _st(self["@interface"])._prompt();
- return self}, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer,result:result},smalltalk.Repl)})},
- args: ["buffer"],
- source: "eval: buffer\x0a\x09| result |\x0a\x09buffer isEmpty ifFalse: [\x0a\x09\x09self try: [\x0a\x09\x09\x09result := Compiler new evaluateExpression: buffer.\x0a\x09\x09\x09Transcript show: result]\x0a\x09\x09catch: [:e |\x0a\x09\x09\x09e isSmalltalkError\x0a\x09\x09\x09 ifTrue: [ErrorHandler new handleError: e]\x0a\x09\x09\x09 ifFalse: [process stdout write: e jsStack]]].\x0a\x09interface prompt",
- messageSends: ["ifFalse:", "try:catch:", "evaluateExpression:", "new", "show:", "ifTrue:ifFalse:", "handleError:", "write:", "jsStack", "stdout", "isSmalltalkError", "isEmpty", "prompt"],
- referencedClasses: ["Compiler", "Transcript", "ErrorHandler"]
- }),
- smalltalk.Repl);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "initialize",
- category: 'initialization',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
- self["@readline"]=_st(require)._value_("readline");
- self["@util"]=_st(require)._value_("util");
- return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Repl)})},
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'",
- messageSends: ["initialize", "value:"],
- referencedClasses: []
- }),
- smalltalk.Repl);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "prompt",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return "amber >> ";
- }, function($ctx1) {$ctx1.fill(self,"prompt",{},smalltalk.Repl)})},
- args: [],
- source: "prompt\x0a\x09^'amber >> '",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Repl);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "setPrompt",
- category: 'actions',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self["@interface"])._setPrompt_(_st(self)._prompt());
- return self}, function($ctx1) {$ctx1.fill(self,"setPrompt",{},smalltalk.Repl)})},
- args: [],
- source: "setPrompt\x0a\x09interface setPrompt: self prompt",
- messageSends: ["setPrompt:", "prompt"],
- referencedClasses: []
- }),
- smalltalk.Repl);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "main",
- category: 'not yet classified',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(_st(self)._new())._createInterface();
- return self}, function($ctx1) {$ctx1.fill(self,"main",{},smalltalk.Repl.klass)})},
- args: [],
- source: "main\x0a\x09self new createInterface",
- messageSends: ["createInterface", "new"],
- referencedClasses: []
- }),
- smalltalk.Repl.klass);
- (function () {
- var inBrowser = typeof amber !== "undefined" && typeof amber.load === "function";
- function init() {
- smalltalk.initialize();
- /* Similar to jQuery(document).ready() */
- if (inBrowser && amber.smalltalkReady) {
- amber.smalltalkReady();
- }
- }
- if (inBrowser) {
- // init is lengthy process done in JavaScript.
- // setTimeout here postpones it, so DOM ready
- // event can occur sooner, thus load process
- // may appear optically faster.
- setTimeout(init, 0);
- } else {
- // In certain configurations, setTimeout is not feasible.
- // It is mainly for `amberc`-produced concatenated
- // node.js programs. There, the actual "main" appears
- // immediately after init, so it must happens synchronously.
- init();
- }
- })();smalltalk.AmberCli._main()
|