1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941 |
- /* ====================================================================
- |
- | 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;
- };
- st.allSubclasses = function(klass) {
- var result, subclasses;
- result = subclasses = st.subclasses(klass);
- subclasses.forEach(function(subclass) {
- result.push.apply(result, st.allSubclasses(subclass));
- });
- return result;
- };
- /* 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);
- // If already initialized (else it will be done later anyway),
- // re-initialize all subclasses to ensure the new method
- // propagation (for wrapped classes, not using the prototype
- // chain.
- if(initialized) {
- st.allSubclasses(klass).forEach(function(subclass) {
- st.initClass(subclass);
- });
- }
- 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.outerContext = 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="**I am the root of the Smalltalk class system**. All classes in the system are subclasses of me.\x0a\x0aI provide default behavior common to all normal objects, such as:\x0a\x0a- accessing\x0a- copying\x0a- comparison\x0a- error handling\x0a- message sending\x0a- reflection\x0a\x0aAlso utility messages that all objects should respond to are defined here.\x0a\x0aI have no instance variable.\x0a\x0a##Access\x0a\x0aInstance variables can be accessed with `#instVarAt:` and `#instVarAt:put:`. `#instanceVariableNames` answers a collection of all instance variable names.\x0aAccessing JavaScript properties of an object is done through `#basicAt:`, `#basicAt:put:` and `basicDelete:`.\x0a\x0a##Copying\x0a\x0aCopying an object is handled by `#copy` and `#deepCopy`. The first one performs a shallow copy of the receiver, while the second one performs a deep copy.\x0aThe hook method `#postCopy` can be overriden in subclasses to copy fields as necessary to complete the full copy. It will be sent by the copy of the receiver.\x0a\x0a##Comparison\x0a\x0aI understand equality `#=` and identity `#==` comparison.\x0a\x0a##Error handling\x0a\x0a- `#halt` is the typical message to use for inserting breakpoints during debugging.\x0a- `#error:` throws a generic error exception\x0a- `#doesNotUnderstand:` handles the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message.\x0a\x09Overriding this message can be useful to implement proxies for example."
- 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: "inspect",
- category: 'inspecting',
- fn: function (){
- var self=this;
- function $InspectorHandler(){return smalltalk.InspectorHandler||(typeof InspectorHandler=="undefined"?nil:InspectorHandler)}
- return smalltalk.withContext(function($ctx1) {
- _st($InspectorHandler())._inspect_(self);
- return self}, function($ctx1) {$ctx1.fill(self,"inspect",{},smalltalk.Object)})},
- args: [],
- source: "inspect\x0a\x09InspectorHandler inspect: self",
- messageSends: ["inspect:"],
- referencedClasses: ["InspectorHandler"]
- }),
- smalltalk.Object);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "inspectOn:",
- category: 'inspecting',
- fn: function (anInspector){
- var self=this;
- var variables;
- function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- variables=_st($Dictionary())._new();
- _st(variables)._at_put_("#self",self);
- _st(_st(_st(self)._class())._allInstanceVariableNames())._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(variables)._at_put_(each,_st(self)._instVarAt_(each));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- $1=anInspector;
- _st($1)._setLabel_(_st(self)._printString());
- $2=_st($1)._setVariables_(variables);
- return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},smalltalk.Object)})},
- args: ["anInspector"],
- source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09self class allInstanceVariableNames do: [:each |\x0a\x09\x09variables at: each put: (self instVarAt: each)].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
- messageSends: ["new", "at:put:", "do:", "instVarAt:", "allInstanceVariableNames", "class", "setLabel:", "printString", "setVariables:"],
- referencedClasses: ["Dictionary"]
- }),
- 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: "heliosClass",
- category: 'helios',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return "class";
- }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Object.klass)})},
- args: [],
- source: "heliosClass\x0a\x09\x22Should be an Helios extension. Unfortunately, since helios can browse remote\x0a\x09environments, we can't extend base classes\x22\x0a\x09\x0a\x09^ 'class'",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Object.klass);
- 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="I define the protocol for logic testing operations and conditional control structures for the logical values (see the `controlling` protocol).\x0a\x0aI have two instances, `true` and `false`.\x0a\x0aI am directly mapped to JavaScript Boolean. The `true` and `false` objects are the JavaScript boolean objects.\x0a\x0a## Usage Example:\x0a\x0a aBoolean not ifTrue: [ ... ] ifFalse: [ ... ]"
- 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: "asBit",
- category: 'converting',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self;
- if(smalltalk.assert($2)){
- $1=(1);
- } else {
- $1=(0);
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"asBit",{},smalltalk.Boolean)})},
- args: [],
- source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
- 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="I am used to work with both dates and times. Therefore `Date today` and `Date now` are both valid in\x0aAmber and answer the same date object.\x0a\x0aDate directly maps to the `Date()` JavaScript constructor, and Amber date objects are JavaScript date objects.\x0a\x0a## API\x0a\x0aThe class-side `instance creation` protocol contains some convenience methods for creating date/time objects such as `#fromSeconds:`.\x0a\x0aArithmetic and comparison is supported (see the `comparing` and `arithmetic` protocols).\x0a\x0aThe `converting` protocol provides convenience methods for various convertions (to numbers, strings, etc.)."
- 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="I provide an unified entry point to manipulate Amber packages, classes and methods.\x0a\x0aTypical use cases include IDEs, remote access and restricting browsing."
- 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.Environment)})},
- 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: "evaluate:on:do:",
- category: 'error handling',
- fn: function (aBlock,anErrorClass,exceptionBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- _st(self)._try_catch_(aBlock,(function(exception){
- return smalltalk.withContext(function($ctx2) {
- $1=_st(exception)._isKindOf_(_st(self)._classNamed_(_st(anErrorClass)._name()));
- if(smalltalk.assert($1)){
- return _st(exceptionBlock)._value_(exception);
- } else {
- return _st(exception)._signal();
- };
- }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},smalltalk.Environment)})},
- args: ["aBlock", "anErrorClass", "exceptionBlock"],
- source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09self try: aBlock catch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception signal ] ]",
- messageSends: ["try:catch:", "ifTrue:ifFalse:", "value:", "signal", "isKindOf:", "classNamed:", "name"],
- referencedClasses: []
- }),
- 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: "registerErrorHandler:",
- category: 'actions',
- fn: function (anErrorHandler){
- var self=this;
- function $ErrorHandler(){return smalltalk.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
- return smalltalk.withContext(function($ctx1) {
- _st($ErrorHandler())._setCurrent_(anErrorHandler);
- return self}, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},smalltalk.Environment)})},
- args: ["anErrorHandler"],
- source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler setCurrent: anErrorHandler",
- messageSends: ["setCurrent:"],
- referencedClasses: ["ErrorHandler"]
- }),
- smalltalk.Environment);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "registerInspector:",
- category: 'actions',
- fn: function (anInspector){
- var self=this;
- function $InspectorHandler(){return smalltalk.InspectorHandler||(typeof InspectorHandler=="undefined"?nil:InspectorHandler)}
- return smalltalk.withContext(function($ctx1) {
- _st($InspectorHandler())._register_(anInspector);
- return self}, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},smalltalk.Environment)})},
- args: ["anInspector"],
- source: "registerInspector: anInspector\x0a\x09InspectorHandler register: anInspector",
- messageSends: ["register:"],
- referencedClasses: ["InspectorHandler"]
- }),
- 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: "setClassCommentOf:to:",
- category: 'actions',
- fn: function (aClass,aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(aClass)._comment_(aString);
- return self}, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},smalltalk.Environment)})},
- args: ["aClass", "aString"],
- source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
- messageSends: ["comment:"],
- 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('InspectorHandler', smalltalk.Object, [], 'Kernel-Objects');
- smalltalk.InspectorHandler.comment="I am responsible for inspecting object.\x0a\x0aMy class-side `inspector` inst var holds the current inspector I'm delegating object inspection to.\x0a\x0aThe default inspector object is the transcript."
- smalltalk.InspectorHandler.klass.iVarNames = ['inspector'];
- smalltalk.addMethod(
- smalltalk.method({
- selector: "inspect:",
- category: 'registration',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._inspector())._inspect_(anObject);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},smalltalk.InspectorHandler.klass)})},
- args: ["anObject"],
- source: "inspect: anObject\x0a\x09^ self inspector inspect: anObject",
- messageSends: ["inspect:", "inspector"],
- referencedClasses: []
- }),
- smalltalk.InspectorHandler.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "inspector",
- category: 'accessing',
- fn: function (){
- var self=this;
- function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@inspector"];
- if(($receiver = $2) == nil || $receiver == undefined){
- self["@inspector"]=$Transcript();
- $1=self["@inspector"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"inspector",{},smalltalk.InspectorHandler.klass)})},
- args: [],
- source: "inspector\x0a\x09^ inspector ifNil: [ inspector := Transcript ]",
- messageSends: ["ifNil:"],
- referencedClasses: ["Transcript"]
- }),
- smalltalk.InspectorHandler.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "register:",
- category: 'registration',
- fn: function (anInspector){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- self["@inspector"]=anInspector;
- $1=self["@inspector"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"register:",{anInspector:anInspector},smalltalk.InspectorHandler.klass)})},
- args: ["anInspector"],
- source: "register: anInspector\x0a\x09^ inspector := anInspector",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.InspectorHandler.klass);
- smalltalk.addClass('JSObjectProxy', smalltalk.Object, ['jsObject'], 'Kernel-Objects');
- smalltalk.JSObjectProxy.comment="I handle sending messages to JavaScript objects, making JavaScript object accessing from Amber fully transparent.\x0aMy instances make intensive use of `#doesNotUnderstand:`.\x0a\x0aMy instances are automatically created by Amber whenever a message is sent to a JavaScript object.\x0a\x0a## Usage examples\x0a\x0aJSObjectProxy objects are instanciated by Amber when a Smalltalk message is sent to a JavaScript object.\x0a\x0a\x09window alert: 'hello world'.\x0a\x09window inspect.\x0a\x09(window jQuery: 'body') append: 'hello world'\x0a\x0aAmber messages sends are converted to JavaScript function calls or object property access _(in this order)_. If n one of them match, a `MessageNotUnderstood` error will be thrown.\x0a\x0a## Message conversion rules\x0a\x0a- `someUser name` becomes `someUser.name`\x0a- `someUser name: 'John'` becomes `someUser name = \x22John\x22`\x0a- `console log: 'hello world'` becomes `console.log('hello world')`\x0a- `(window jQuery: 'foo') css: 'background' color: 'red'` becomes `window.jQuery('foo').css('background', 'red')`\x0a\x0a__Note:__ For keyword-based messages, only the first keyword is kept: `window foo: 1 bar: 2` is equivalent to `window foo: 1 baz: 2`."
- 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="I am the Amber representation for all numbers.\x0aI am directly mapped to JavaScript Number.\x0a\x0a## API\x0a\x0aI provide all necessary methods for arithmetic operations, comparison, conversion and so on with numbers.\x0a\x0aMy instances can also be used to evaluate a block a fixed number of times:\x0a\x0a\x095 timesRepeat: [Transcript show: 'This will be printed 5 times'; cr].\x0a\x09\x0a\x091 to: 5 do: [:aNumber| Transcript show: aNumber asString; cr].\x0a\x09\x0a\x091 to: 10 by: 2 do: [:aNumber| Transcript show: aNumber asString; cr]."
- 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: "\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: "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: "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.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances."
- 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.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes."
- 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.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information."
- smalltalk.addClass('Package', smalltalk.Object, ['commitPathJs', 'commitPathSt'], 'Kernel-Objects');
- smalltalk.Package.comment="I am similar to a \x22class category\x22 typically found in other Smalltalks like Pharo or Squeak. Amber does not have class categories anymore, it had in the beginning but now each class in the system knows which package it belongs to.\x0a\x0aEach package has a name and can be queried for its classes, but it will then resort to a reverse scan of all classes to find them.\x0a\x0a## API\x0a\x0aPackages are manipulated through \x22Smalltalk current\x22, like for example finding one based on a name or with `Package class >> #name` directly:\x0a\x0a Smalltalk current packageAt: 'Kernel'\x0a Package named: 'Kernel'\x0a\x0aA package differs slightly from a Monticello package which can span multiple class categories using a naming convention based on hyphenation. But just as in Monticello a package supports \x22class extensions\x22 so a package can define behaviors in foreign classes using a naming convention for method categories where the category starts with an asterisk and then the name of the owning package follows.\x0a\x0aYou can fetch a package from the server:\x0a\x0a\x09Package load: 'Additional-Examples'"
- 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="I represent an x-y pair of numbers usually designating a geometric coordinate.\x0a\x0a## API\x0a\x0aInstances are traditionally created using the binary `#@` message to a number:\x0a\x0a\x09100@120\x0a\x0aPoints can then be arithmetically manipulated:\x0a\x0a\x09100@100 + (10@10)\x0a\x0a...or for example:\x0a\x0a\x09(100@100) * 2\x0a\x0a**NOTE:** Creating a point with a negative y-value will need a space after `@` in order to avoid a parsing error:\x0a\x0a\x09100@ -100 \x22but 100@-100 would not parse\x22"
- 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="I an used to generate a random number and I am implemented as a trivial wrapper around javascript `Math.random()`.\x0a\x0a## API\x0a\x0aThe typical use case it to use the `#next` method like the following:\x0a\x0a\x09Random new next\x0a\x0aThis will return a float x where x < 1 and x > 0. If you want a random integer from 1 to 10 you can use `#atRandom`\x0a\x0a\x0910 atRandom\x0a\x0aA random number in a specific interval can be obtained with the following:\x0a\x0a\x09(3 to: 7) atRandom\x0a\x0aBe aware that `#to:` does not create an Interval as in other Smalltalk implementations but in fact an `Array` of numbers, so it's better to use:\x0a\x0a\x095 atRandom + 2\x0a\x0aSince `#atRandom` is implemented in `SequencableCollection` you can easy pick an element at random:\x0a\x0a\x09#('a' 'b' 'c') atRandom\x0a\x0aAs well as letter from a `String`:\x0a\x0a\x09'abc' atRandom\x0a\x0aSince Amber does not have Characters this will return a `String` of length 1 like for example `'b'`."
- 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="I represent the global JavaScript variable `smalltalk` declared in `js/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with class-side method `#current`.\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 Amber 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 $2,$3,$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)})}));
- $2=result;
- _st($2)._source_(aString);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},smalltalk.Smalltalk)})},
- args: ["aString"],
- source: "parse: aString\x0a\x09| result |\x0a\x09\x0a\x09self \x0a\x09\x09try: [result := self basicParse: aString] \x0a\x09\x09catch: [:ex | (self parseError: ex parsing: aString) signal].\x0a\x09\x09\x0a\x09^ result\x0a\x09\x09source: aString;\x0a\x09\x09yourself",
- messageSends: ["try:catch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"],
- 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\x0a## Motivation\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="I describe the behavior of my sole instance, `nil`. `nil` represents a prior value for variables that have not been initialized, or for results which are meaningless.\x0a\x0a`nil` is the Smalltalk equivalent of the `undefined` JavaScript object.\x0a\x0a__note:__ When sending messages to the `undefined` JavaScript object, it will be replaced by `nil`."
- 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="I am the superclass of all class objects.\x0a\x0aI define the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0a\x0aMy instances know about the subclass/superclass relationships between classes, contain the description that instances are created from,\x0aand hold the method dictionary that's associated with each class.\x0a\x0aI also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy."
- smalltalk.addMethod(
- smalltalk.method({
- selector: ">>",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._methodAt_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},smalltalk.Behavior)})},
- args: ["aString"],
- source: ">> aString\x0a\x09^ self methodAt: aString",
- messageSends: ["methodAt:"],
- referencedClasses: []
- }),
- smalltalk.Behavior);
- 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,$2;
- $1=_st(self)._superclass();
- if(($receiver = $1) == nil || $receiver == undefined){
- return false;
- } else {
- $1;
- };
- $2=_st(_st(aClass).__eq_eq(_st(self)._superclass()))._or_((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(self)._superclass())._inheritsFrom_(aClass);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},smalltalk.Behavior)})},
- args: ["aClass"],
- source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
- messageSends: ["ifNil:", "superclass", "or:", "inheritsFrom:", "=="],
- 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="I am __the__ class object.\x0a\x0aMy instances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder` instance."
- 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,$3,$4;
- $1=_st(_st(self)._package()).__eq(aPackage);
- if(smalltalk.assert($1)){
- $2=self;
- return $2;
- };
- oldPackage=_st(self)._package();
- _st(self)._basicAt_put_("pkg",aPackage);
- _st(_st(oldPackage)._organization())._removeElement_(self);
- _st(_st(aPackage)._organization())._addElement_(self);
- $3=_st($ClassMoved())._new();
- _st($3)._theClass_(self);
- _st($3)._oldPackage_(oldPackage);
- $4=_st($3)._yourself();
- _st(_st($SystemAnnouncer())._current())._announce_($4);
- return self}, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},smalltalk.Class)})},
- args: ["aPackage"],
- source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self basicAt: 'pkg' put: aPackage.\x0a\x09oldPackage organization removeElement: self.\x0a\x09aPackage organization addElement: self.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
- messageSends: ["ifTrue:", "=", "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="I am the root of the class hierarchy.\x0a\x0aMy instances are metaclasses, one for each real class, and have a single instance, which they hold onto: the class that they are the metaclass of."
- 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="I am responsible for compiling new classes or modifying existing classes in the system.\x0a\x0aRather than using me directly to compile a class, use `Class >> subclass:instanceVariableNames:package:`."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "addSubclassOf:named:instanceVariableNames:package:",
- category: 'class definition',
- fn: function (aClass,className,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_(className);
- $1=theClass;
- if(($receiver = $1) == nil || $receiver == undefined){
- $1;
- } else {
- _st(theClass)._package_(_st(self)._createPackageNamed_(packageName));
- $2=_st(_st(theClass)._superclass()).__eq_eq(aClass);
- if(! smalltalk.assert($2)){
- $3=_st(self)._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
- return $3;
- };
- };
- $4=_st(self)._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
- return $4;
- }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass},smalltalk.ClassBuilder)})},
- args: ["aClass", "className", "aCollection", "packageName"],
- source: "addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName\x0a\x09| theClass |\x0a\x09\x0a\x09theClass := Smalltalk current at: className.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass package: (self createPackageNamed: packageName).\x0a\x09\x09theClass superclass == aClass ifFalse: [\x0a\x09\x09\x09^ self\x0a\x09\x09\x09\x09migrateClassNamed: className\x0a\x09\x09\x09\x09superclass: aClass\x0a\x09\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09\x09package: packageName ] ].\x0a\x09\x09\x0a\x09\x09^ self\x0a\x09\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09\x09named: className\x0a\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09package: packageName",
- messageSends: ["at:", "current", "ifNotNil:", "package:", "createPackageNamed:", "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,ivarNames){
- 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,ivarNames);
- _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,ivarNames:ivarNames},smalltalk.ClassBuilder)})},
- args: ["aClass", "ivarNames"],
- source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self basicClass: aClass instanceVariableNames: ivarNames.\x0a\x09self setupClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
- 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,className){
- 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(),className,_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,className:className,newClass:newClass},smalltalk.ClassBuilder)})},
- args: ["aClass", "className"],
- source: "copyClass: aClass named: className\x0a\x09| newClass |\x0a\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass superclass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name.\x0a\x0a\x09self copyClass: aClass to: newClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^newClass",
- 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: "createPackageNamed:",
- category: 'private',
- fn: function (aString){
- var self=this;
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st($Package())._named_ifAbsent_(aString,(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st($Smalltalk())._current())._createPackage_(aString);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"createPackageNamed:",{aString:aString},smalltalk.ClassBuilder)})},
- args: ["aString"],
- source: "createPackageNamed: aString\x0a\x09^ Package named: aString ifAbsent: [\x0a\x09\x09Smalltalk current createPackage: aString ]",
- messageSends: ["named:ifAbsent:", "createPackage:", "current"],
- referencedClasses: ["Smalltalk", "Package"]
- }),
- 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) {
- var $1;
- $1=_st(self)._migrateClassNamed_superclass_instanceVariableNames_package_(_st(aClass)._name(),anotherClass,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},smalltalk.ClassBuilder)})},
- args: ["aClass", "anotherClass"],
- source: "migrateClass: aClass superclass: anotherClass\x0a\x09^ self\x0a\x09\x09migrateClassNamed: aClass name\x0a\x09\x09superclass: anotherClass\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name",
- messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"],
- referencedClasses: []
- }),
- smalltalk.ClassBuilder);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
- category: 'class migration',
- fn: function (className,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)}
- function $ClassMigrated(){return smalltalk.ClassMigrated||(typeof ClassMigrated=="undefined"?nil:ClassMigrated)}
- function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5,$6,$7;
- tmp=_st("new*").__comma(className);
- oldClass=_st(_st($Smalltalk())._current())._at_(className);
- 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,className);
- _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=_st($ClassMigrated())._new();
- _st($5)._theClass_(newClass);
- _st($5)._oldClass_(oldClass);
- $6=_st($5)._yourself();
- _st(_st($SystemAnnouncer())._current())._announce_($6);
- $7=newClass;
- return $7;
- }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{className:className,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass,tmp:tmp},smalltalk.ClassBuilder)})},
- args: ["className", "aClass", "aCollection", "packageName"],
- source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk current at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09exception signal ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses do: [ :each |\x0a\x09\x09self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^newClass",
- messageSends: [",", "at:", "current", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "basicRemoveClass:", "signal", "copyClass:to:", "rawRenameClass:to:", "do:", "migrateClass:superclass:", "subclasses", "announce:", "theClass:", "new", "oldClass:", "yourself"],
- referencedClasses: ["Smalltalk", "Error", "ClassMigrated", "SystemAnnouncer"]
- }),
- 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,className){
- 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,className);
- $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,className:className},smalltalk.ClassBuilder)})},
- args: ["aClass", "className"],
- source: "renameClass: aClass to: className\x0a\x09self basicRenameClass: aClass to: className.\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,className){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self)._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},smalltalk.ClassBuilder)})},
- args: ["aClass", "className"],
- source: "superclass: aClass subclass: className\x0a\x09^self superclass: aClass subclass: className 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,className,ivarNames,packageName){
- 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=className;
- $4=_st(self)._instanceVariableNamesFor_(ivarNames);
- $6=packageName;
- 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,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},smalltalk.ClassBuilder)})},
- args: ["aClass", "className", "ivarNames", "packageName"],
- source: "superclass: aClass subclass: className instanceVariableNames: ivarNames package: packageName\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: className instanceVariableNames: (self instanceVariableNamesFor: ivarNames)\x0a\x09\x09package: (packageName ifNil: ['unclassified']).\x0a\x09self setupClass: newClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^newClass",
- 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="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format."
- 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="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`."
- 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.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://github.com/amber-smalltalk/amber/issues/143) on GitHub."
- 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="I represent a lexical closure.\x0aI am is directly mapped to JavaScript Function.\x0a\x0a## API\x0a\x0a1. Evaluation\x0a\x0a My instances get evaluated with the `#value*` methods in the 'evaluating' protocol.\x0a\x0a Example: ` [ :x | x + 1 ] value: 3 \x22Answers 4\x22 `\x0a\x0a2. Control structures\x0a\x0a Blocks are used (together with `Boolean`) for control structures (methods in the `controlling` protocol).\x0a\x0a Example: `aBlock whileTrue: [ ... ]`\x0a\x0a3. Error handling\x0a\x0a I provide the `#on:do:` method for handling exceptions.\x0a\x0a Example: ` aBlock on: MessageNotUnderstood do: [ :ex | ... ] `"
- 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: "receiver",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return nil;
- }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.BlockClosure)})},
- args: [],
- source: "receiver\x0a\x09^ nil",
- messageSends: [],
- referencedClasses: []
- }),
- 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="I represent a class method of the system. I hold the source and compiled code of a class method.\x0a\x0a## API\x0aMy instances can be accessed using `Behavior >> #methodAt:`\x0a\x0a Object methodAt: 'asString'\x0a\x0aSource code access:\x0a\x0a\x09(String methodAt: 'lines') source\x0a\x0aReferenced classes:\x0a\x0a\x09(String methodAt: 'lines') referencedClasses\x0a\x0aMessages sent from an instance:\x0a\x09\x0a\x09(String methodAt: 'lines') messageSends"
- 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="I am responsible for handling forked blocks.\x0aThe pool size sets the maximum concurrent forked blocks.\x0a\x0a## API\x0a\x0aThe default instance is accessed with `#default`.\x0aThe maximum concurrent forked blocks can be set with `#maxPoolSize:`.\x0a\x0aForking is done via `BlockClosure >> #fork`\x0a"
- 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="In general, the system does not use instances of me for efficiency reasons.\x0aHowever, when a message is not understood by its receiver, the interpreter will make up an instance of it in order to capture the information involved in an actual message transmission.\x0aThis instance is sent it as an argument with the message `#doesNotUnderstand:` to the receiver.\x0a\x0aSee boot.js, `messageNotUnderstood` and its counterpart `Object >> #doesNotUnderstand:`\x0a\x0a## API\x0a\x0aBesides accessing methods, `#sendTo:` provides a convenient way to send a message to an object."
- 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('MessageSend', smalltalk.Object, ['receiver', 'message'], 'Kernel-Methods');
- smalltalk.MessageSend.comment="I encapsulate message sends to objects. Arguments can be either predefined or supplied when the message send is performed. \x0a\x0a## API\x0a\x0aUse `#value` to perform a message send with its predefined arguments and `#value:*` if additonal arguments have to supplied.\x0a"
- smalltalk.addMethod(
- smalltalk.method({
- selector: "arguments",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self["@message"])._arguments();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.MessageSend)})},
- args: [],
- source: "arguments\x0a\x09^ message arguments",
- messageSends: ["arguments"],
- referencedClasses: []
- }),
- smalltalk.MessageSend);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "arguments:",
- category: 'accessing',
- fn: function (aCollection){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self["@message"])._arguments_(aCollection);
- return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},smalltalk.MessageSend)})},
- args: ["aCollection"],
- source: "arguments: aCollection\x0a\x09message arguments: aCollection",
- messageSends: ["arguments:"],
- referencedClasses: []
- }),
- smalltalk.MessageSend);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "initialize",
- category: 'initialization',
- fn: function (){
- var self=this;
- function $Message(){return smalltalk.Message||(typeof Message=="undefined"?nil:Message)}
- return smalltalk.withContext(function($ctx1) {
- smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
- self["@message"]=_st($Message())._new();
- return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.MessageSend)})},
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
- messageSends: ["initialize", "new"],
- referencedClasses: ["Message"]
- }),
- smalltalk.MessageSend);
- 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)._receiver());
- _st($1)._nextPutAll_(" >> ");
- _st($1)._nextPutAll_(_st(self)._selector());
- $2=_st($1)._nextPutAll_(")");
- return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.MessageSend)})},
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self receiver;\x0a\x09\x09nextPutAll: ' >> ';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
- messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"],
- referencedClasses: []
- }),
- smalltalk.MessageSend);
- 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.MessageSend)})},
- args: [],
- source: "receiver\x0a\x09^ receiver",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MessageSend);
- 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.MessageSend)})},
- args: ["anObject"],
- source: "receiver: anObject\x0a\x09receiver := anObject",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.MessageSend);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "selector",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self["@message"])._selector();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.MessageSend)})},
- args: [],
- source: "selector\x0a\x09^ message selector",
- messageSends: ["selector"],
- referencedClasses: []
- }),
- smalltalk.MessageSend);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "selector:",
- category: 'accessing',
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self["@message"])._selector_(aString);
- return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.MessageSend)})},
- args: ["aString"],
- source: "selector: aString\x0a\x09message selector: aString",
- messageSends: ["selector:"],
- referencedClasses: []
- }),
- smalltalk.MessageSend);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "value",
- category: 'evaluating',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self["@message"])._sendTo_(_st(self)._receiver());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.MessageSend)})},
- args: [],
- source: "value\x0a\x09^ message sendTo: self receiver",
- messageSends: ["sendTo:", "receiver"],
- referencedClasses: []
- }),
- smalltalk.MessageSend);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "value:",
- category: 'evaluating',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self["@message"];
- _st($2)._arguments_([anObject]);
- $3=_st($2)._sendTo_(_st(self)._receiver());
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},smalltalk.MessageSend)})},
- args: ["anObject"],
- source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
- messageSends: ["arguments:", "sendTo:", "receiver"],
- referencedClasses: []
- }),
- smalltalk.MessageSend);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "value:value:",
- category: 'evaluating',
- fn: function (firstArgument,secondArgument){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self["@message"];
- _st($2)._arguments_([firstArgument,secondArgument]);
- $3=_st($2)._sendTo_(_st(self)._receiver());
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},smalltalk.MessageSend)})},
- args: ["firstArgument", "secondArgument"],
- source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
- messageSends: ["arguments:", "sendTo:", "receiver"],
- referencedClasses: []
- }),
- smalltalk.MessageSend);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "value:value:value:",
- category: 'evaluating',
- fn: function (firstArgument,secondArgument,thirdArgument){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self["@message"];
- _st($2)._arguments_([firstArgument,secondArgument,thirdArgument]);
- $3=_st($2)._sendTo_(_st(self)._receiver());
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},smalltalk.MessageSend)})},
- args: ["firstArgument", "secondArgument", "thirdArgument"],
- source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
- messageSends: ["arguments:", "sendTo:", "receiver"],
- referencedClasses: []
- }),
- smalltalk.MessageSend);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "valueWithPossibleArguments:",
- category: 'evaluating',
- fn: function (aCollection){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- _st(self)._arguments_(aCollection);
- $1=_st(self)._value();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},smalltalk.MessageSend)})},
- args: ["aCollection"],
- source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
- messageSends: ["arguments:", "value"],
- referencedClasses: []
- }),
- smalltalk.MessageSend);
- smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods');
- smalltalk.MethodContext.comment="I hold all the dynamic state associated with the execution of either a method activation resulting from a message send. I am used to build the call stack while debugging.\x0a\x0aMy instances are JavaScript `SmalltalkMethodContext` objects defined in `boot.js`."
- 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(self)._methodContext())._asString())).__comma(")");
- } else {
- $1=_st(_st(_st(_st(_st(self)._receiver())._class())._name()).__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 asString, ')' ]\x0a\x09\x09ifFalse: [ self receiver class name, ' >> ', self selector ]",
- messageSends: ["ifTrue:ifFalse:", ",", "asString", "methodContext", "selector", "name", "class", "receiver", "isBlockContext"],
- referencedClasses: []
- }),
- smalltalk.MethodContext);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "home",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.homeContext;
- return self}, function($ctx1) {$ctx1.fill(self,"home",{},smalltalk.MethodContext)})},
- args: [],
- source: "home\x0a\x09<return 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 $2,$1;
- $2=_st(self)._methodContext();
- if(($receiver = $2) == nil || $receiver == undefined){
- $1=$2;
- } else {
- $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 ifNotNil: [\x0a\x09\x09self methodContext receiver class lookupSelector: self methodContext selector ]",
- messageSends: ["ifNotNil:", "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,$4,$3;
- $1=_st(self)._isBlockContext();
- if(! smalltalk.assert($1)){
- $2=self;
- return $2;
- };
- $4=_st(self)._home();
- if(($receiver = $4) == nil || $receiver == undefined){
- $3=$4;
- } else {
- var home;
- home=$receiver;
- $3=_st(home)._methodContext();
- };
- return $3;
- }, function($ctx1) {$ctx1.fill(self,"methodContext",{},smalltalk.MethodContext)})},
- args: [],
- source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self home ifNotNil: [ :home |\x0a\x09\x09home methodContext ]",
- messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "methodContext", "home"],
- referencedClasses: []
- }),
- smalltalk.MethodContext);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "outerContext",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return self.outerContext || self.homeContext;
- return self}, function($ctx1) {$ctx1.fill(self,"outerContext",{},smalltalk.MethodContext)})},
- args: [],
- source: "outerContext\x0a\x09<return self.outerContext || 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="I am a wrapper around native functions, such as `WebSocket`.\x0aFor 'normal' functions (whose constructor is the JavaScript `Function` object), use `BlockClosure`.\x0a\x0a## API\x0a\x0aSee the class-side `instance creation` methods for instance creation.\x0a\x0aCreated instances will most probably be instance of `JSObjectProxy`.\x0a\x0a## Usage example:\x0a\x0a\x09| ws |\x0a\x09ws := NativeFunction constructor: 'WebSocket' value: 'ws://localhost'.\x0a\x09ws at: 'onopen' put: [ ws send: 'hey there from Amber' ]"
- 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 Collection 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: "contains:",
- category: 'testing',
- fn: function (aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- var $early={};
- try {
- _st(self)._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- $1=_st(aBlock)._value_(each);
- 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,"contains:",{aBlock:aBlock},smalltalk.Collection)})},
- args: ["aBlock"],
- source: "contains: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns true for any element return true.\x0a\x09Otherwise return false.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^ true ] ].\x0a\x09^ false",
- messageSends: ["do:", "ifTrue:", "value:"],
- 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: "heliosClass",
- category: 'helios',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return "collection";
- }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Collection.klass)})},
- args: [],
- source: "heliosClass\x0a\x09^ 'collection'",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Collection.klass);
- 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 collection, that is,\x0aI store values under indexes.\x0a\x0aAs a rule of thumb, if a collection has `#at:` and `#at:put:`,\x0ait is an IndexableCollection."
- 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)._subclassResponsibility();
- 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 subclassResponsibility",
- messageSends: ["subclassResponsibility"],
- 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`, I 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.\x0a\x0aI am directly mapped to JavaScript Number.\x0a\x0a*Note* In 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:ifPresent:ifAbsent:",
- category: 'accessing',
- fn: function (anIndex,aBlock,anotherBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return anIndex < 1 || self.length < anIndex ? anotherBlock._value() : aBlock._value_(self[anIndex - 1]);;
- return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Array)})},
- args: ["anIndex", "aBlock", "anotherBlock"],
- source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<return anIndex < 1 || self.length < anIndex ? anotherBlock._value() : aBlock._value_(self[anIndex - 1]);>",
- 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: "at:ifPresent:ifAbsent:",
- category: 'accessing',
- fn: function (anIndex,aBlock,anotherBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var result = String(self).charAt(anIndex - 1);
- return result ? aBlock._value_(result) : anotherBlock._value();
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.String)})},
- args: ["anIndex", "aBlock", "anotherBlock"],
- source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<\x0a\x09\x09var result = String(self).charAt(anIndex - 1);\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09>",
- 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: "remove:ifAbsent:",
- category: 'adding/removing',
- fn: function (anObject,aBlock){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self["@elements"])._remove_ifAbsent_(anObject,aBlock);
- return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.Set)})},
- args: ["anObject", "aBlock"],
- source: "remove: anObject ifAbsent: aBlock\x0a\x09elements remove: anObject ifAbsent: aBlock",
- messageSends: ["remove:ifAbsent:"],
- 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: "heliosClass",
- category: 'helios',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return "exception";
- }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Error.klass)})},
- args: [],
- source: "heliosClass\x0a\x09^ 'exception'",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.Error.klass);
- 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(aContext)._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 asString",
- messageSends: ["ifNotNil:", "logContext:", "home", "log:", "asString"],
- 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.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default."
- 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, [], 'Kernel-Transcript');
- smalltalk.Transcript.comment="I am a facade for Transcript actions.\x0a\x0aI delegate actions to the currently registered transcript.\x0a\x0a## API\x0a\x0a Transcript \x0a show: 'hello world';\x0a cr;\x0a show: anObject."
- 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: "inspect:",
- category: 'printing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._show_(anObject);
- return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},smalltalk.Transcript.klass)})},
- args: ["anObject"],
- source: "inspect: anObject\x0a\x09self show: anObject",
- messageSends: ["show:"],
- 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, ['valuable', 'announcementClass'], 'Kernel-Announcements');
- smalltalk.AnnouncementSubscription.comment="I am 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;
- _st(self)._deprecatedAPI();
- $1=_st(self)._valuable();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"block",{},smalltalk.AnnouncementSubscription)})},
- args: [],
- source: "block\x0a\x09\x22Use #valuable instead\x22\x0a\x09\x0a\x09self deprecatedAPI.\x0a\x09^ self valuable",
- messageSends: ["deprecatedAPI", "valuable"],
- referencedClasses: []
- }),
- smalltalk.AnnouncementSubscription);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "block:",
- category: 'accessing',
- fn: function (aValuable){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self)._deprecatedAPI();
- _st(self)._valuable_(aValuable);
- return self}, function($ctx1) {$ctx1.fill(self,"block:",{aValuable:aValuable},smalltalk.AnnouncementSubscription)})},
- args: ["aValuable"],
- source: "block: aValuable\x0a\x09\x22Use #valuable instead\x22\x0a\x09\x0a\x09self deprecatedAPI.\x0a\x09self valuable: aValuable",
- messageSends: ["deprecatedAPI", "valuable:"],
- 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)._valuable())._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 valuable value: anAnnouncement]",
- messageSends: ["ifTrue:", "value:", "valuable", "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.addMethod(
- smalltalk.method({
- selector: "receiver",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self)._valuable())._receiver();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.AnnouncementSubscription)})},
- args: [],
- source: "receiver\x0a\x09^ self valuable receiver",
- messageSends: ["receiver", "valuable"],
- referencedClasses: []
- }),
- smalltalk.AnnouncementSubscription);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "valuable",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@valuable"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"valuable",{},smalltalk.AnnouncementSubscription)})},
- args: [],
- source: "valuable\x0a\x09^ valuable",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.AnnouncementSubscription);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "valuable:",
- category: 'accessing',
- fn: function (aValuable){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@valuable"]=aValuable;
- return self}, function($ctx1) {$ctx1.fill(self,"valuable:",{aValuable:aValuable},smalltalk.AnnouncementSubscription)})},
- args: ["aValuable"],
- source: "valuable: aValuable\x0a\x09valuable := aValuable",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.AnnouncementSubscription);
- smalltalk.addClass('Announcer', smalltalk.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
- smalltalk.Announcer.comment="I hold annoncement subscriptions (instances of `AnnouncementSubscription`) in a private registry.\x0aI announce (trigger) announces, which are then dispatched to all subscriptions.\x0a\x0aThe code is based on the announcements as [described by Vassili Bykov](http://www.cincomsmalltalk.com/userblogs/vbykov/blogView?searchCategory=Announcements%20Framework).\x0a\x0a## API\x0a\x0aUse `#announce:` to trigger an announcement.\x0a\x0aUse `#on:do:` or `#on:send:to:` to register subscriptions.\x0a\x0aWhen using `#on:send:to:`, unregistration can be done with `#unregister:`.\x0a\x0a## Usage example:\x0a\x0a SystemAnnouncer current\x0a on: ClassAdded\x0a do: [ :ann | window alert: ann theClass name, ' added' ].\x0a"
- 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 $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
- return smalltalk.withContext(function($ctx1) {
- smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
- self["@subscriptions"]=_st($OrderedCollection())._new();
- return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Announcer)})},
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
- messageSends: ["initialize", "new"],
- referencedClasses: ["OrderedCollection"]
- }),
- 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)._valuable_(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\x09valuable: aBlock;\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
- messageSends: ["add:", "valuable:", "new", "announcementClass:", "yourself"],
- referencedClasses: ["AnnouncementSubscription"]
- }),
- smalltalk.Announcer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "on:send:to:",
- category: 'subscribing',
- fn: function (aClass,aSelector,anObject){
- var self=this;
- function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
- function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- $1=_st($AnnouncementSubscription())._new();
- $2=_st($MessageSend())._new();
- _st($2)._receiver_(anObject);
- _st($2)._selector_(aSelector);
- $3=_st($2)._yourself();
- _st($1)._valuable_($3);
- _st($1)._announcementClass_(aClass);
- $4=_st($1)._yourself();
- _st(self["@subscriptions"])._add_($4);
- return self}, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},smalltalk.Announcer)})},
- args: ["aClass", "aSelector", "anObject"],
- source: "on: aClass send: aSelector to: anObject\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09valuable: (MessageSend new\x0a\x09\x09\x09receiver: anObject;\x0a\x09\x09\x09selector: aSelector;\x0a\x09\x09\x09yourself);\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
- messageSends: ["add:", "valuable:", "receiver:", "new", "selector:", "yourself", "announcementClass:"],
- referencedClasses: ["MessageSend", "AnnouncementSubscription"]
- }),
- smalltalk.Announcer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "unsubscribe:",
- category: 'subscribing',
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@subscriptions"]=_st(self["@subscriptions"])._reject_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(each)._receiver()).__eq(anObject);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},smalltalk.Announcer)})},
- args: ["anObject"],
- source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
- messageSends: ["reject:", "=", "receiver"],
- referencedClasses: []
- }),
- smalltalk.Announcer);
- smalltalk.addClass('SystemAnnouncer', smalltalk.Announcer, [], 'Kernel-Announcements');
- smalltalk.SystemAnnouncer.comment="My unique instance is the global announcer handling all Amber system-related announces.\x0a\x0a## API\x0a\x0aAccess to the unique instance is done via `#current`"
- 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.ClassAnnouncement.comment="I am the abstract superclass of class-related 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 definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:"
- smalltalk.addClass('ClassMigrated', smalltalk.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements');
- smalltalk.ClassMigrated.comment="I am emitted when a class is migrated."
- smalltalk.addMethod(
- smalltalk.method({
- selector: "oldClass",
- category: 'accessing',
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@oldClass"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"oldClass",{},smalltalk.ClassMigrated)})},
- args: [],
- source: "oldClass\x0a\x09^ oldClass",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ClassMigrated);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "oldClass:",
- category: 'accessing',
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@oldClass"]=aClass;
- return self}, function($ctx1) {$ctx1.fill(self,"oldClass:",{aClass:aClass},smalltalk.ClassMigrated)})},
- args: ["aClass"],
- source: "oldClass: aClass\x0a\x09oldClass := aClass",
- messageSends: [],
- referencedClasses: []
- }),
- smalltalk.ClassMigrated);
- smalltalk.addClass('ClassMoved', smalltalk.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
- smalltalk.ClassMoved.comment="I am emitted when a class is moved from one package to another."
- 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.MethodAnnouncement.comment="I am the abstract superclass of method-related 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.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class."
- smalltalk.addClass('MethodModified', smalltalk.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
- smalltalk.MethodModified.comment="I am emitted when a `CompiledMethod` is modified (a new method is installed). I hold a reference to the old method being replaced."
- 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.MethodMoved.comment="I am emitted when a `CompiledMethod` is moved to another protocol. I hold a refernce to the old protocol of the method."
- 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.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class."
- smalltalk.addClass('PackageAnnouncement', smalltalk.SystemAnnouncement, ['package'], 'Kernel-Announcements');
- smalltalk.PackageAnnouncement.comment="I am the abstract superclass of package-related 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.PackageAdded.comment="I am emitted when a `Package` is added to the system."
- smalltalk.addClass('PackageRemoved', smalltalk.PackageAnnouncement, [], 'Kernel-Announcements');
- smalltalk.PackageRemoved.comment="I am emitted when a `Package` is removed from the system."
- smalltalk.addClass('ProtocolAnnouncement', smalltalk.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
- smalltalk.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related 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.ProtocolAdded.comment="I am emitted when a protocol is added to a class."
- smalltalk.addClass('ProtocolRemoved', smalltalk.ProtocolAnnouncement, [], 'Kernel-Announcements');
- smalltalk.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class."
- smalltalk.addPackage('AmberCli');
- smalltalk.addClass('AmberCli', smalltalk.Object, [], 'AmberCli');
- smalltalk.AmberCli.comment="I am the Amber CLI (CommandLine Interface) tool which runs on Node.js.\x0a\x0aMy responsibility is to start different Amber programs like the FileServer or the Repl.\x0aWhich program to start is determined by the first commandline parameters passed to the AmberCli executable.\x0aUse `help` to get a list of all available options.\x0aAny further commandline parameters are passed to the specific program.\x0a\x0a## Commands\x0a\x0aNew commands can be added by creating a class side method in the `commands` protocol which takes one parameter.\x0aThis parameter is an array of all commandline options + values passed on to the program.\x0aAny `camelCaseCommand` is transformed into a commandline parameter of the form `camel-case-command` and vice versa."
- 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 selector;
- function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
- return smalltalk.withContext(function($ctx1) {
- selector=_st(self)._selectorForCommandLineSwitch_(_st(args)._first());
- _st(args)._remove_(_st(args)._first());
- _st(self)._perform_withArguments_(selector,_st($Array())._with_(args));
- return self}, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},smalltalk.AmberCli.klass)})},
- args: ["args"],
- source: "handleArguments: args\x0a\x09| selector |\x0a\x0a\x09selector := self selectorForCommandLineSwitch: (args first).\x0a\x09args remove: args first.\x0a\x09self perform: selector withArguments: (Array with: args)",
- 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;
- var command,selector;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=_st(_st(self)._commandLineSwitches())._includes_(aSwitch);
- if(smalltalk.assert($1)){
- selector=_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(":");
- selector;
- } else {
- selector="help:";
- selector;
- };
- $2=selector;
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},smalltalk.AmberCli.klass)})},
- args: ["aSwitch"],
- source: "selectorForCommandLineSwitch: aSwitch\x0a\x09\x22Add ':' at the end and replace all occurences of a lowercase letter preceded by a '-' with the Uppercase letter.\x0a\x09 Example: fallback-page becomes fallbackPage:.\x0a\x09 If no correct selector is found return 'help:'\x22\x0a\x09 | command selector |\x0a\x0a\x09 (self commandLineSwitches includes: aSwitch)\x0a\x09 ifTrue: [ selector := (aSwitch replace: '-[a-z]' with: [ :each | each second asUppercase ]), ':']\x0a\x09 ifFalse: [ selector := 'help:' ].\x0a\x09^selector",
- messageSends: ["ifTrue:ifFalse:", ",", "replace:with:", "asUppercase", "second", "includes:", "commandLineSwitches"],
- referencedClasses: []
- }),
- smalltalk.AmberCli.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "serve:",
- 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,"serve:",{args:args},smalltalk.AmberCli.klass)})},
- args: ["args"],
- source: "serve: 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.FileServer.comment="I am the Amber Smalltalk FileServer.\x0aMy runtime requirement is a functional Node.js executable.\x0a\x0aTo start a FileServer instance on port `4000` use the following code:\x0a\x0a FileServer new start\x0a\x0aA parameterized instance can be created with the following code:\x0a\x0a FileServer createServerWithArguments: options\x0a\x0aHere, `options` is an array of commandline style strings each followed by a value e.g. `#('--port', '6000', '--host', '0.0.0.0')`.\x0aA list of all available parameters can be printed to the commandline by passing `--help` as parameter.\x0aSee the `Options` section for further details on how options are mapped to instance methods.\x0a\x0aAfter startup FileServer checks if the directory layout required by Amber is present and logs a warning on absence.\x0a\x0a\x0a## Options\x0a\x0aEach option is of the form `--some-option-string` which is transformed into a selector of the format `someOptionString:`.\x0aThe trailing `--` gets removed, each `-[a-z]` gets transformed into the according uppercase letter, and a `:` is appended to create a selector which takes a single argument.\x0aAfterwards, the selector gets executed on the `FileServer` instance with the value following in the options array as parameter.\x0a\x0a## Adding new commandline parameters\x0a\x0aAdding new commandline parameters to `FileServer` is as easy as adding a new single parameter method to the `accessing` protocol."
- 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: "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) {
- return (4000);
- }, 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.Repl.comment="I am a class representing a REPL (Read Evaluate Print Loop) and provide a command line interface to Amber Smalltalk.\x0aOn the prompt you can type Amber statements which will be evaluated after pressing <Enter>.\x0aThe evaluation is comparable with executing a 'DoIt' in a workspace.\x0a\x0aMy runtime requirement is a functional Node.js executable with working Readline support."
- 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()
|